@helpai/elements 1.3.17 → 1.4.1
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/LICENSE-OPENUI +21 -0
- package/NOTICE +15 -0
- package/configurator.css +19 -31
- package/configurator.d.ts +13 -14
- package/configurator.mjs +1 -1
- package/elements-web-component.esm.js +49 -30
- package/elements-web-component.esm.js.map +4 -4
- package/elements.cjs.js +49 -30
- package/elements.cjs.js.map +4 -4
- package/elements.esm.js +49 -30
- package/elements.esm.js.map +4 -4
- package/elements.js +49 -30
- package/elements.js.map +4 -4
- package/index.d.ts +51 -51
- package/index.mjs +23 -5
- package/loader.js +2 -2
- package/package.json +4 -2
- package/schema.d.ts +132 -133
- package/schema.json +8 -20
- package/schema.mjs +1 -1
- package/style.css +3 -1
- package/web-component.d.ts +1 -2
- package/web-component.mjs +23 -5
package/elements.cjs.js
CHANGED
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
"use strict";var Ao=Object.defineProperty;var Ju=Object.getOwnPropertyDescriptor;var Zu=Object.getOwnPropertyNames;var e_=Object.prototype.hasOwnProperty;var t_=(e,t,n)=>t in e?Ao(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var n_=(e,t)=>{for(var n in t)Ao(e,n,{get:t[n],enumerable:!0})},o_=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Zu(t))!e_.call(e,r)&&r!==n&&Ao(e,r,{get:()=>t[r],enumerable:!(o=Ju(t,r))||o.enumerable});return e};var r_=e=>o_(Ao({},"__esModule",{value:!0}),e);var ce=(e,t,n)=>t_(e,typeof t!="symbol"?t+"":t,n);var uv={};n_(uv,{HOOK_WILDCARD:()=>Xr,brand:()=>dv,destroy:()=>av,getAllInstances:()=>sv,getInstance:()=>iv,hook:()=>lv,init:()=>rv,mount:()=>vu,resolveInitialHostMode:()=>Qr,version:()=>cv});module.exports=r_(uv);var Fo,J,Qi,_a,Gt,Wi,Xi,Yi,ca,Lo,Qn,Ji,pa,da,ua,a_,No={},Do=[],i_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Xn=Array.isArray;function Ot(e,t){for(var n in t)e[n]=t[n];return e}function fa(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function Nt(e,t,n){var o,r,a,s={};for(a in t)a=="key"?o=t[a]:a=="ref"?r=t[a]:s[a]=t[a];if(arguments.length>2&&(s.children=arguments.length>3?Fo.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 Oo(e,s,o,r,null)}function Oo(e,t,n,o,r){var a={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:r??++Qi,__i:-1,__u:0};return r==null&&J.vnode!=null&&J.vnode(a),a}function fe(e){return e.children}function _t(e,t){this.props=e,this.context=t}function nn(e,t){if(t==null)return e.__?nn(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"?nn(e):null}function s_(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],r=[],a=Ot({},t);a.__v=t.__v+1,J.vnode&&J.vnode(a),ma(e.__P,a,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??nn(t),!!(32&t.__u),r),a.__v=t.__v,a.__.__k[a.__i]=a,os(o,a,r),t.__e=t.__=null,a.__e!=n&&Zi(a)}}function Zi(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}),Zi(e)}function Ki(e){(!e.__d&&(e.__d=!0)&&Gt.push(e)&&!$o.__r++||Wi!=J.debounceRendering)&&((Wi=J.debounceRendering)||Xi)($o)}function $o(){try{for(var e,t=1;Gt.length;)Gt.length>t&&Gt.sort(Yi),e=Gt.shift(),t=Gt.length,s_(e)}finally{Gt.length=$o.__r=0}}function es(e,t,n,o,r,a,s,l,c,d,_){var p,u,m,g,P,y,w=o&&o.__k||Do,S=t.length;for(c=l_(n,t,w,c,S),p=0;p<S;p++)(m=n.__k[p])!=null&&(u=m.__i!=-1&&w[m.__i]||No,m.__i=p,y=ma(e,m,u,r,a,s,l,c,d,_),g=m.__e,m.ref&&u.ref!=m.ref&&(u.ref&&ga(u.ref,null,m),_.push(m.ref,m.__c||g,m)),P==null&&g!=null&&(P=g),4&m.__u?(c=ts(m,c,e),u.__e&&(u.__e=null)):typeof m.type=="function"&&y!==void 0?c=y:g&&(c=g.nextSibling),m.__u&=-7);return n.__e=P,c}function l_(e,t,n,o,r){var a,s,l,c,d,_=n.length,p=_,u=0;for(e.__k=new Array(r),a=0;a<r;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]=Oo(null,s,null,null,null):Xn(s)?s=e.__k[a]=Oo(fe,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=e.__k[a]=Oo(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):e.__k[a]=s,c=a+u,s.__=e,s.__b=e.__b+1,l=null,(d=s.__i=c_(s,n,c,p))!=-1&&(p--,(l=n[d])&&(l.__u|=2)),l==null||l.__v==null?(d==-1&&(r>_?u--:r<_&&u++),typeof s.type!="function"&&(s.__u|=4)):d!=c&&(d==c-1?u--:d==c+1?u++:(d>c?u--:u++,s.__u|=4))):e.__k[a]=null;if(p)for(a=0;a<_;a++)(l=n[a])!=null&&(2&l.__u)==0&&(l.__e==o&&(o=nn(l)),as(l,l));return o}function ts(e,t,n){var o,r;if(typeof e.type=="function"){for(o=e.__k,r=0;o&&r<o.length;r++)o[r]&&(o[r].__=e,t=ts(o[r],t,n));return t}e.__e!=t&&(t&&e.type&&!t.parentNode&&(t=nn(e)),t=n.insertBefore(e.__e,t||null));do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function Yn(e,t){return t=t||[],e==null||typeof e=="boolean"||(Xn(e)?e.some(function(n){Yn(n,t)}):t.push(e)),t}function c_(e,t,n,o){var r,a,s,l=e.key,c=e.type,d=t[n],_=d!=null&&(2&d.__u)==0;if(d===null&&l==null||_&&l==d.key&&c==d.type)return n;if(o>(_?1:0)){for(r=n-1,a=n+1;r>=0||a<t.length;)if((d=t[s=r>=0?r--:a++])!=null&&(2&d.__u)==0&&l==d.key&&c==d.type)return s}return-1}function Gi(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||i_.test(t)?n:n+"px"}function Mo(e,t,n,o,r){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||Gi(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||Gi(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(Ji,"$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[Qn]=o[Qn]:(n[Qn]=pa,e.addEventListener(t,a?ua:da,a)):e.removeEventListener(t,a?ua:da,a);else{if(r=="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 ji(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t[Lo]==null)t[Lo]=pa++;else if(t[Lo]<n[Qn])return;return n(J.event?J.event(t):t)}}}function ma(e,t,n,o,r,a,s,l,c,d){var _,p,u,m,g,P,y,w,S,h,b,x,k,E,G,H,A=t.type;if(t.constructor!==void 0)return null;128&n.__u&&(c=!!(32&n.__u),a=[l=t.__e=n.__e]),(_=J.__b)&&_(t);e:if(typeof A=="function"){p=s.length;try{if(S=t.props,h=A.prototype&&A.prototype.render,b=(_=A.contextType)&&o[_.__c],x=_?b?b.props.value:_.__:o,n.__c?w=(u=t.__c=n.__c).__=u.__E:(h?t.__c=u=new A(S,x):(t.__c=u=new _t(S,x),u.constructor=A,u.render=u_),b&&b.sub(u),u.state||(u.state={}),u.__n=o,m=u.__d=!0,u.__h=[],u._sb=[]),h&&u.__s==null&&(u.__s=u.state),h&&A.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Ot({},u.__s)),Ot(u.__s,A.getDerivedStateFromProps(S,u.__s))),g=u.props,P=u.state,u.__v=t,m)h&&A.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),h&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(h&&A.getDerivedStateFromProps==null&&S!==g&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(S,x),t.__v==n.__v||!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(S,u.__s,x)===!1){t.__v!=n.__v&&(u.props=S,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(D){D&&(D.__=t)}),Do.push.apply(u.__h,u._sb),u._sb=[],u.__h.length&&s.push(u),l=nn(n);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(S,u.__s,x),h&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(g,P,y)})}if(u.context=x,u.props=S,u.__P=e,u.__e=!1,k=J.__r,E=0,h)u.state=u.__s,u.__d=!1,k&&k(t),_=u.render(u.props,u.state,u.context),Do.push.apply(u.__h,u._sb),u._sb=[];else do u.__d=!1,k&&k(t),_=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++E<25);u.state=u.__s,u.getChildContext!=null&&(o=Ot(Ot({},o),u.getChildContext())),h&&!m&&u.getSnapshotBeforeUpdate!=null&&(y=u.getSnapshotBeforeUpdate(g,P)),G=_!=null&&_.type===fe&&_.key==null?rs(_.props.children):_,l=es(e,Xn(G)?G:[G],t,n,o,r,a,s,l,c,d),u.base=t.__e,t.__u&=-161,u.__h.length&&s.push(u),w&&(u.__E=u.__=null)}catch(D){if(s.length=p,t.__v=null,c||a!=null){if(D.then){for(t.__u|=c?160:128;l&&l.nodeType==8&&l.nextSibling;)l=l.nextSibling;a!=null&&(a[a.indexOf(l)]=null),t.__e=l}else if(a!=null)for(H=a.length;H--;)fa(a[H])}else t.__e=n.__e;t.__k==null&&(t.__k=n.__k||[]),D.then||ns(t),J.__e(D,t,n)}}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):l=t.__e=d_(n.__e,t,n,o,r,a,s,c,d);return(_=J.diffed)&&_(t),128&t.__u?void 0:l}function ns(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(ns))}function os(e,t,n){for(var o=0;o<n.length;o++)ga(n[o],n[++o],n[++o]);J.__c&&J.__c(t,e),e.some(function(r){try{e=r.__h,r.__h=[],e.some(function(a){a.call(r)})}catch(a){J.__e(a,r.__v)}})}function rs(e){return typeof e!="object"||e==null||e.__b>0?e:Xn(e)?e.map(rs):e.constructor!==void 0?null:Ot({},e)}function d_(e,t,n,o,r,a,s,l,c){var d,_,p,u,m,g,P,y=n.props||No,w=t.props,S=t.type;if(S=="svg"?r="http://www.w3.org/2000/svg":S=="math"?r="http://www.w3.org/1998/Math/MathML":r||(r="http://www.w3.org/1999/xhtml"),a!=null){for(d=0;d<a.length;d++)if((m=a[d])&&"setAttribute"in m==!!S&&(S?m.localName==S:m.nodeType==3)){e=m,a[d]=null;break}}if(e==null){if(S==null)return document.createTextNode(w);e=document.createElementNS(r,S,w.is&&w),l&&(J.__m&&J.__m(t,a),l=!1),a=null}if(S==null)y===w||l&&e.data==w||(e.data=w);else{if(a=S=="textarea"&&w.defaultValue!=null?null:a&&Fo.call(e.childNodes),!l&&a!=null)for(y={},d=0;d<e.attributes.length;d++)y[(m=e.attributes[d]).name]=m.value;for(d in y)m=y[d],d=="dangerouslySetInnerHTML"?p=m:d=="children"||d in w||d=="value"&&"defaultValue"in w||d=="checked"&&"defaultChecked"in w||Mo(e,d,null,m,r);for(d in w)m=w[d],d=="children"?u=m:d=="dangerouslySetInnerHTML"?_=m:d=="value"?g=m:d=="checked"?P=m:l&&typeof m!="function"||y[d]===m||Mo(e,d,m,y[d],r);if(_)l||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[];else if(p&&(e.innerHTML=""),es(t.type=="template"?e.content:e,Xn(u)?u:[u],t,n,o,S=="foreignObject"?"http://www.w3.org/1999/xhtml":r,a,s,a?a[0]:n.__k&&nn(n,0),l,c),a!=null)for(d=a.length;d--;)fa(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!=y[d])&&Mo(e,d,g,y[d],r),d="checked",P!=null&&P!=e[d]&&Mo(e,d,P,y[d],r))}return e}function ga(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(r){J.__e(r,n)}}function as(e,t,n){var o,r;if(J.unmount&&J.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||ga(o,null,t)),(o=e.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){J.__e(a,t)}o.base=o.__P=o.__n=null}if(o=e.__k)for(r=0;r<o.length;r++)o[r]&&as(o[r],t,n||typeof e.type!="function");n||fa(e.__e),e.__c=e.__=e.__e=void 0}function u_(e,t,n){return this.constructor(e,n)}function Jn(e,t,n){var o,r,a,s;t==document&&(t=document.documentElement),J.__&&J.__(e,t),r=(o=typeof n=="function")?null:n&&n.__k||t.__k,a=[],s=[],ma(t,e=(!o&&n||t).__k=Nt(fe,null,[e]),r||No,No,t.namespaceURI,!o&&n?[n]:r?null:t.firstChild?Fo.call(t.childNodes):null,a,!o&&n?n:r?r.__e:t.firstChild,o,s),os(a,e,s),e.props.children=null}Fo=Do.slice,J={__e:function(e,t,n,o){for(var r,a,s;t=t.__;)if((r=t.__c)&&!r.__)try{if((a=r.constructor)&&a.getDerivedStateFromError!=null&&(r.setState(a.getDerivedStateFromError(e)),s=r.__d),r.componentDidCatch!=null&&(r.componentDidCatch(e,o||{}),s=r.__d),s)return r.__E=r}catch(l){e=l}throw e}},Qi=0,_a=function(e){return e!=null&&e.constructor===void 0},_t.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ot({},this.state),typeof e=="function"&&(e=e(Ot({},n),this.props)),e&&Ot(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),Ki(this))},_t.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),Ki(this))},_t.prototype.render=fe,Gt=[],Xi=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Yi=function(e,t){return e.__v.__b-t.__v.__b},$o.__r=0,ca=Math.random().toString(8),Lo="__d"+ca,Qn="__a"+ca,Ji=/(PointerCapture)$|Capture$/i,pa=0,da=ji(!1),ua=ji(!0),a_=0;var T={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var xn="1.3.17";var is={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",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 chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",popOut:"Open in new tab",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",queueMessage:"Queue message",removeQueuedMessage:"Remove queued message",compactingContext:"Optimizing conversation context\u2026",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",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",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",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:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},__={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:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",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:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",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:"Nouveau chat",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",queueMessage:"Mettre le message en attente",removeQueuedMessage:"Retirer le message en attente",compactingContext:"Optimisation du contexte de la conversation\u2026",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",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",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",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:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},p_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",popOut:"\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",queueMessage:"\u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",removeQueuedMessage:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",compactingContext:"\u062C\u0627\u0631\u064D \u062A\u062D\u0633\u064A\u0646 \u0633\u064A\u0627\u0642 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},f_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",popOut:"Abrir en una pesta\xF1a nueva",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",queueMessage:"Poner mensaje en cola",removeQueuedMessage:"Quitar mensaje de la cola",compactingContext:"Optimizando el contexto de la conversaci\xF3n\u2026",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},m_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",popOut:"\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D1\u05DB\u05E8\u05D8\u05D9\u05E1\u05D9\u05D9\u05D4 \u05D7\u05D3\u05E9\u05D4",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",queueMessage:"\u05D4\u05D5\u05E1\u05E4\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DC\u05EA\u05D5\u05E8",removeQueuedMessage:"\u05D4\u05E1\u05E8\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DE\u05D4\u05EA\u05D5\u05E8",compactingContext:"\u05DE\u05D1\u05E6\u05E2 \u05D0\u05D5\u05E4\u05D8\u05D9\u05DE\u05D9\u05D6\u05E6\u05D9\u05D4 \u05DC\u05D4\u05E7\u05E9\u05E8 \u05D4\u05E9\u05D9\u05D7\u05D4\u2026",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},g_={en:is,fr:__,ar:p_,es:f_,he:m_};function Bo(e,t){let n=ss(e),o=Uo(t),r=n==="en"?{}:g_[n]??{},a=o?t[n]??{}:t??{},s=o?t.en??{}:{};return{...is,...r,...s,...a}}function ss(e){return(e.split("-")[0]??"en").toLowerCase()}var v_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function ls(e){return v_.has(ss(e))}function lt(e,t){return e[t]??t}function Uo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function cs(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function ds(e,t){let{translations:n,defaultLocale:o,...r}=e,a=cs(n,t);return a?{...r,title:a.title??r.title,description:a.description??r.description,content:a.content??r.content}:r}function us(e,t){let{translations:n,defaultLocale:o,...r}=e,a=cs(n,t);if(!a)return r;let s=new Map((a.fields??[]).map(c=>[c.name,c])),l=r.fields.map(c=>{let d=s.get(c.name);if(!d)return c;let _=new Map((d.options??[]).map(p=>[p.value,p]));return{...c,label:d.label??c.label,placeholder:d.placeholder??c.placeholder,validationHint:d.validationHint??c.validationHint,options:c.options?.map(p=>{let u=_.get(p.value);return u?{...p,label:u.label??p.label,description:u.description??p.description}:p})}});return{...r,title:a.title??r.title,description:a.description??r.description,submitLabel:a.submitLabel??r.submitLabel,fields:l}}var va=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{}}},Ho=new va;var ya=["off","error","warn","info","debug","trace"],Pa=T.cssPrefix,_s=`${Pa}.debug`,h_=`__${T.global}_DEBUG__`,b_=`${Pa}-debug`,zo=2,ha=null;function y_(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(b_);if(e!==null){let t=ba(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(_s);if(e){let t=ba(e);if(t>=0)return t}}catch{}return Reflect.get(window,h_)?4:2}function ba(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=ya.findIndex(n=>n===e);if(t>=0)return t}return-1}function qo(e){let t=ba(e);if(!(t<0)){zo=t;try{window.localStorage?.setItem(_s,ya[t]??"off")}catch{}}}function xa(){return ya[zo]??"warn"}zo=y_();function ps(e){let t=`[${Pa}:${e}]`,n=(o,r,a)=>(s,l)=>{if(!(zo<o)&&(l===void 0?console[r](t,s):console[r](t,s,l),ha))try{ha({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=>ps(`${e}:${o}`)}}var Z=ps("core");function fs(e){ha=e}var on=Z.scope("context"),P_=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),ms=50,Sa=1024,x_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ka(e){return gs(e,"userContext",!0)}function wa(e){return gs(e,"pageContext",!1)}function gs(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){on.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let o={},r=0;for(let[a,s]of Object.entries(e)){if(P_.has(a)){on.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(s==null)continue;if(r>=ms){on.warn(`${t} truncated at ${ms} keys \u2014 dropped "${a}"`);continue}let l=S_(t,a,s);l!==void 0&&(o[a]=l,r++)}return n&&typeof o.email=="string"&&!x_.test(o.email)&&(on.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete o.email),Object.keys(o).length>0?o:void 0}function S_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){on.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let o=n.trim();return o===""?void 0:o.length>Sa?(on.warn(`truncated ${e}.${t} to ${Sa} chars`),o.slice(0,Sa)):o}on.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var Vo={maxBytes:10485760,maxCount:10,accept:"*/*"},vs={voice:"local"},hs={list:[],byTrigger:{}},Ca={enabled:!0,sampleRate:1},Wo={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Sn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},bs={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"]},Ra={enabled:!0,volume:.3,events:void 0},ys={enabled:!0,events:void 0},Ps=[{label:"tabConversations",layout:"chat"}];function kn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},o=t.behavior??{},r=t.i18n??{},a=t.feedback??{},s=t.footer??{},l=t.header??{},{themeMode:c,themeOverrides:d}=k_(t.theme),_=n.mode??"floating",p=w_(r.defaultLocale),u=r.availableLocales??[r.locale??p],m=wn(r.locale??p,u,p),g=(t.baseUrl??T.defaultBaseUrl).replace(/\/$/,""),P=(t.agentApiBaseUrl??`${g}/api/agent`).replace(/\/$/,""),y=(t.dataApiBaseUrl??`${g}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:g,agentApiBaseUrl:P,dataApiBaseUrl:y,userContext:ka(t.userContext),pageContext:wa(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:d,mode:_,iframe:n.iframe??!1,responseMode:o.responseMode??"streaming",showReasoning:o.showReasoning??!1,showToolCalls:o.showToolCalls??!1,showSources:o.showSources??!1,enableMessageFeedback:!(o.disableMessageFeedback??!1),autoSendSuggestions:o.autoSendSuggestions??!1,popOutUrl:o.popOutUrl,features:{voice:t.features?.voice??vs.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:Zn(t.forms,m),endpoints:{upload:t.endpoints?.upload??Wo.upload,transcribe:t.endpoints?.transcribe??Wo.transcribe,submitForm:t.endpoints?.submitForm??Wo.submitForm},attachments:{accept:t.composer?.attachments?.accept??Vo.accept,maxBytes:t.composer?.attachments?.maxBytes??Vo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Vo.maxCount},locale:m,defaultLocale:p,availableLocales:u,startMinimized:o.startMinimized??!0,actions:C_(_,l.actions),size:n.size??{},launcher:O_(t.launcher),sound:R_(a.sound),haptics:T_(a.haptics),strings:Bo(m,r.strings),stringsOverride:r.strings,composerDisclaimer:s.composerDisclaimer??"",poweredBy:E_(s.poweredBy),composer:A_(t.composer),modules:M_(t.modules),tracking:I_(t.tracking,y),storage:t.storage??Ho,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function k_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function w_(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function wn(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function C_(e,t){return t??bs[e]}function R_(e){return{enabled:e?.enabled??Ra.enabled,volume:e?.volume??Ra.volume,events:e?.events}}function T_(e){return{enabled:e?.enabled??ys.enabled,events:e?.events}}function I_(e,t){let n=e?.sampleRate??Ca.sampleRate;return{enabled:e?.enabled??Ca.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 E_(e){let n={...{text:`Powered by ${T.displayName}`,href:T.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function A_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function M_(e){let t=e??Ps,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?.length&&(c.contentTags=s),a.layout==="home"&&(c.brandName=a.brandName,c.greetingText=a.greetingText,c.showGreeting=!(a.hideGreeting??!1),c.showSearchBar=!(a.hideSearchBar??!1),c.showRecentConversations=!(a.hideRecentConversations??!1),a.userAvatars?.length&&(c.userAvatars=a.userAvatars),a.status&&(c.status=a.status),c.contentBlockTitle=a.contentBlockTitle),o.push(c)}let r=Object.fromEntries(o.map(a=>[a.id,a]));return{list:o,byId:r}}function Zn(e,t){var a;if(!e?.length)return hs;let n=[],o=new Set;for(let s of e){if(!s?.id||o.has(s.id))continue;let l=us(s,t),c=(l.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),d=(Array.isArray(l.on)?l.on:[l.on]).map(L_).filter(_=>_!==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 r={};for(let s of n)for(let l of s.triggers)(r[a=l.kind]??(r[a]=[])).push(s);return{list:n,byTrigger:r}}function L_(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 O_(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??Sn.variant,size:e?.size??Sn.size,label:e?.label??Sn.label,icon:e?.icon??Sn.icon,hidden:e?.hidden??Sn.hidden,callout:t}}function Ta(e,t,n,o){let r=wn(t,e.availableLocales,e.defaultLocale);if(r===e.locale&&n===e.themeMode&&o===e.textSize)return e;let a={...e};return r!==e.locale&&(a.locale=r,a.strings=Bo(r,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),o!==e.textSize&&(a.textSize=o),a}var N_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function Ia(e,t){if(!t)return e;let n={...e};for(let a of N_){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]=xs(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,r=t.i18n;if(o||r){let a=xs(r??{},o);r?.availableLocales!==void 0&&(a.availableLocales=r.availableLocales),r?.defaultLocale!==void 0&&(a.defaultLocale=r.defaultLocale);let s=o?.strings,l=r?.strings;(s||l)&&(a.strings=D_(l,s)),n.i18n=a}return n}function xs(e,t){if(!t)return e;let n={...e};for(let[o,r]of Object.entries(t))r!==void 0&&(n[o]=r);return n}function D_(e,t){if(!e)return t;if(!t)return e;let n=Uo(e),o=Uo(t);if(!n&&!o)return{...e,...t};let r={},a=n?e:{en:e},s=o?t:{en:t};for(let[l,c]of Object.entries(a))r[l]={...c};for(let[l,c]of Object.entries(s))r[l]={...r[l],...c};return r}var $_=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"],Dt=e=>e!=="false";var F_=[["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]],B_=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Dt]],U_=[["width","width"],["height","height"]],H_=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Dt],["show-reasoning","showReasoning",Dt],["show-tool-calls","showToolCalls",Dt],["show-sources","showSources",Dt],["disable-message-feedback","disableMessageFeedback",Dt],["auto-send-suggestions","autoSendSuggestions",Dt],["pop-out-url","popOutUrl"]],z_=[["locale","locale"]],Fv=new Set($_);var q_=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Dt]],V_=[["features-disable-file-upload","disableFileUpload",Dt],["features-voice","voice",e=>e]],W_=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],K_=[["user-id","id"],["user-email","email"],["user-name","name"]],G_=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],j_=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Q_=[F_,B_,U_,H_,z_,q_,V_,W_,K_,G_],X_=new Set(["iframe","start-minimized"]),Y_=[...Q_.flatMap(e=>e.map(([t])=>t).filter(t=>!X_.has(t))),...j_];function Ss(e){return`${T.cssPrefix}:${e}`}function eo(e,t,n){e.dispatchEvent(new CustomEvent(Ss(t),{detail:n}))}function ks(e,t){let o=Object.entries(t).map(([r,a])=>{let s=Ss(r),l=c=>a(c.detail);return e.addEventListener(s,l),[s,l]});return()=>{for(let[r,a]of o)e.removeEventListener(r,a)}}function pt(){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,J_(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 J_(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 jt=Z.scope("persistence");function Cn(e,t=Ho,n){let o=n?`${e}.${n}`:e,r=`${T.cssPrefix}.storageVersion`,a=t.get(r)??void 0,s=a?`.v${a}`:"",l=`${T.cssPrefix}.${o}${s}`,c=`${T.cssPrefix}${s}.visitorId`,d=`${l}.conversationId`,_=`${l}.userPrefs`,p=`${l}.panelOpen`,u=`${l}.panelSize`,m=`${l}.calloutDismissed`,g=`${l}.sidebarCollapsed`,P=`${l}.activeModule`,y=`${l}.historyCount`,w=`${l}.formsDone`,S={getVisitorId(){let h=t.get(c);if(h)return h;let b=pt();return t.set(c,b),b},loadConversationId(){return t.get(d)??void 0},saveConversationId(h){jt.trace("saveConversationId",{id:h,scope:o}),h?t.set(d,h):t.remove(d)},loadDraft(h){return t.get(`${l}.draft.${h}`)??""},saveDraft(h,b){let x=`${l}.draft.${h}`;b?t.set(x,b):t.remove(x)},loadMessageQueue(h){let b=t.get(`${l}.messageQueue.${h}`);if(!b)return[];try{let x=JSON.parse(b);return!Array.isArray(x)||!x.every(Z_)?[]:x}catch(x){return jt.warn("loadMessageQueue parse failed",{error:x}),[]}},saveMessageQueue(h,b){let x=`${l}.messageQueue.${h}`;if(b.length===0){t.remove(x);return}try{t.set(x,JSON.stringify(b))}catch(k){jt.warn("saveMessageQueue serialise failed",{error:k})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return Ea(JSON.parse(h))}catch(b){return jt.warn("loadUserPrefs parse failed",{error:b}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(b){jt.warn("saveUserPrefs serialise failed",{error:b})}},patchUserPrefs(h){let b=S.loadUserPrefs();S.saveUserPrefs({...b,...h})},loadPanelOpen(){let h=t.get(p);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(p,h?"1":"0")},loadPanelSize(){let h=t.get(u);return h==="normal"||h==="expanded"||h==="fullscreen"?h:null},savePanelSize(h){t.set(u,h)},loadCalloutDismissed(h){if(!h)return!1;let b=t.get(m);return!!b&&b===h},saveCalloutDismissed(h){h?t.set(m,h):t.remove(m)},loadSidebarCollapsed(){let h=t.get(g);return h==="1"?!0:h==="0"?!1:null},saveSidebarCollapsed(h){t.set(g,h?"1":"0")},loadActiveModule(){return t.get(P)||null},saveActiveModule(h){t.set(P,h)},loadHistoryCount(){let h=t.get(y);if(!h)return null;let b=Number.parseInt(h,10);return Number.isFinite(b)&&b>=0?b:null},saveHistoryCount(h){t.set(y,String(h))},loadFormsDone(){let h=t.get(w);if(!h)return{};try{let b=JSON.parse(h);return Ko(b)?Object.fromEntries(Object.entries(b).filter(x=>typeof x[1]=="number")):{}}catch(b){return jt.warn("loadFormsDone parse failed",{error:b}),{}}},saveFormDone(h){try{let b=S.loadFormsDone();b[h]=Date.now(),t.set(w,JSON.stringify(b))}catch(b){jt.warn("saveFormDone serialise failed",{error:b})}},rememberStorageVersion(h){h&&h!==t.get(r)&&(jt.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(r,h))},clearConversation(){t.remove(d)}};return S}function Ko(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Z_(e){return Ko(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function Ea(e){if(!Ko(e))return{};let t={};return typeof e.locale=="string"&&(t.locale=e.locale),typeof e.soundMuted=="boolean"&&(t.soundMuted=e.soundMuted),(e.themeMode==="auto"||e.themeMode==="light"||e.themeMode==="dark")&&(t.themeMode=e.themeMode),(e.textSize==="small"||e.textSize==="normal"||e.textSize==="large")&&(t.textSize=e.textSize),Ko(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var ws=`: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__-accent-fg: var(--__P__-accent);--__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__-pill-l-min: .3;--__P__-pill-l-max: .46;--__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__-conversation-max: 768px;--__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-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}: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);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;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__-pill-l-min: .75;--__P__-pill-l-max: .92;--__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);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
2
|
-
`;var
|
|
3
|
-
`;var Rs=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}: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-fg);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;overscroll-behavior:none;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:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;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:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;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-inline-start: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-fg);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-fg);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__-toolui-code,.__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__-toolui-code::-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__-toolui-code::-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;inset-inline-end: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__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__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)}.__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%;min-width:0;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:break-word;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-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__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-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__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-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start: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-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);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:start}.__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-inline-start:var(--__P__-space-3);border-inline-start: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-inline-end: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__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);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);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__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>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-compaction-status{width:100%;padding:10px 14px;justify-content:center;font-size:var(--__P__-text-xs)}.__P__-message-queue{display:flex;max-height:112px;flex-direction:column;gap:var(--__P__-space-1);overflow-y:auto}.__P__-attachment-chip.__P__-queued-message{width:100%;max-width:none}.__P__-queued-text{min-width:0;flex:1}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);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)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-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-fg);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-fg)}.__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-fg);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 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__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-fg)}.__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-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{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__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting-operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__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%;inset-inline-end: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-fg)}.__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-fg);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,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@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__-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-fg)}.__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:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__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-inline-start:-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-inline-start: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:start;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-fg)}.__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-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:start}.__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{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__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-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;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-fg);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__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__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:start;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-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;inset-inline-end: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-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__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-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__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__-textarea,.__P__-home-search-input,.__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;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{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);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{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);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__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-fg)}.__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:start}.__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__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
4
|
-
`;var Ts=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
5
|
-
`;var
|
|
6
|
-
`;var
|
|
7
|
-
`).replace(/__P__/g,ap).replaceAll("__BRAND_ACCENT_TEXT__",sp).replaceAll("__BRAND_ACCENT__",ip).replaceAll("__BRAND_RADIUS__",lp).replaceAll("__BRAND_FONT__",cp);var dp=Z.scope("mount"),Es=new WeakMap,As={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 Ms(e,t){e.style.cssText=As[t]}function to(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Go(e={}){let t=e.position??"flow";dp.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${T.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",T.id),o.style.cssText=As[t];let r=o.shadowRoot??o.attachShadow({mode:"open"}),a=o.ownerDocument;if(!up(r,a)){let l=a.createElement("style");l.textContent=Aa,r.appendChild(l)}let s=document.createElement("div");return s.className=`${T.cssPrefix}-app`,r.appendChild(s),{appRoot:s,destroy:()=>o.remove(),hostElement:o,shadowRoot:r}}function up(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let o=Es.get(t);if(!o)try{o=new n.CSSStyleSheet,o.replaceSync(Aa),Es.set(t,o)}catch{return!1}try{return e.adoptedStyleSheets=[o],!0}catch{return!1}}function _p(e,t){let n=T.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),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function pp(e,t){e.dataset.theme=t}function fp(e,t){let n=T.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 mp(e,t){e.dataset.position=t}function jo(e,t){e.dataset.mode=t}function Ls(e,t){pp(e,t.themeMode),_p(e,t.themeOverrides),mp(e,t.position),fp(e,t.size)}var gp=Z.scope("iframe"),vp='<!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 Ds(e,t,n="closed",o="floating",r=null){gp.debug("createIframeMount",{position:t,initialMode:n,layoutMode:o,hasTarget:!!r});let a=document.createElement("iframe");a.title=`${T.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),Ns(a,t,n,o),(o==="inline"&&r?r:document.body).appendChild(a);let l=a.contentDocument;if(!l)throw new Error("iframe contentDocument unavailable (cross-origin?)");l.open(),l.write(vp),l.close();let c=Go({...e,target:l.body}),d=new MutationObserver(()=>{Ns(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 Qo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Os={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 Ns(e,t,n,o){if(n==="fullscreen"||o==="standalone"){e.style.cssText=`${Qo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(o==="inline"){e.style.cssText=`${Qo}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=`${Qo}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}=Os[n]??Os.open;e.style.cssText=`${Qo}position:fixed;${a}:16px;${s}:16px;width:${l};height:${c};`}var Xo=class{constructor(){ce(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 r of o)try{r(n)}catch{}}clear(){this.handlers.clear()}};var Rn,Ne,Ma,$s,no=0,Ws=[],Be=J,Fs=Be.__b,Bs=Be.__r,Us=Be.diffed,Hs=Be.__c,zs=Be.unmount,qs=Be.__;function Jo(e,t){Be.__h&&Be.__h(Ne,e,no||t),no=0;var n=Ne.__H||(Ne.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function $(e){return no=1,Ks(Gs,e)}function Ks(e,t,n){var o=Jo(Rn++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Gs(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=Ne,!Ne.__f)){var r=function(l,c,d){if(!o.__c.__H)return!0;var _=!1,p=o.__c.props!==l;if(o.__c.__H.__.some(function(m){if(m.__N){_=!0;var g=m.__[0];m.__=m.__N,m.__N=void 0,g!==m.__[0]&&(p=!0)}}),a){var u=a.call(this,l,c,d);return _?u||p:u}return!_||p};Ne.__f=!0;var a=Ne.shouldComponentUpdate,s=Ne.componentWillUpdate;Ne.componentWillUpdate=function(l,c,d){if(this.__e){var _=a;a=void 0,r(l,c,d),a=_}s&&s.call(this,l,c,d)},Ne.shouldComponentUpdate=r}return o.__N||o.__}function M(e,t){var n=Jo(Rn++,3);!Be.__s&&Oa(n.__H,t)&&(n.__=e,n.u=t,Ne.__H.__h.push(n))}function Ct(e,t){var n=Jo(Rn++,4);!Be.__s&&Oa(n.__H,t)&&(n.__=e,n.u=t,Ne.__h.push(n))}function O(e){return no=5,oe(function(){return{current:e}},[])}function oe(e,t){var n=Jo(Rn++,7);return Oa(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function L(e,t){return no=8,oe(function(){return e},t)}function hp(){for(var e;e=Ws.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Yo),t.__h.some(La),t.__h=[]}catch(n){t.__h=[],Be.__e(n,e.__v)}}}Be.__b=function(e){Ne=null,Fs&&Fs(e)},Be.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),qs&&qs(e,t)},Be.__r=function(e){Bs&&Bs(e),Rn=0;var t=(Ne=e.__c).__H;t&&(Ma===Ne?(t.__h=[],Ne.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.some(Yo),t.__h.some(La),t.__h=[],Rn=0)),Ma=Ne},Be.diffed=function(e){Us&&Us(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(Ws.push(t)!==1&&$s===Be.requestAnimationFrame||(($s=Be.requestAnimationFrame)||bp)(hp)),t.__H.__.some(function(n){n.u&&(n.__H=n.u,n.u=void 0)})),Ma=Ne=null},Be.__c=function(e,t){t.some(function(n){try{n.__h.some(Yo),n.__h=n.__h.filter(function(o){return!o.__||La(o)})}catch(o){t.some(function(r){r.__h&&(r.__h=[])}),t=[],Be.__e(o,n.__v)}}),Hs&&Hs(e,t)},Be.unmount=function(e){zs&&zs(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Yo(o)}catch(r){t=r}}),n.__H=void 0,t&&Be.__e(t,n.__v))};var Vs=typeof requestAnimationFrame=="function";function bp(e){var t,n=function(){clearTimeout(o),Vs&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Vs&&(t=requestAnimationFrame(n))}function Yo(e){var t=Ne,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ne=t}function La(e){var t=Ne;e.__c=e.__(),Ne=t}function Oa(e,t){return!e||e.length!==t.length||t.some(function(n,o){return n!==e[o]})}function Gs(e,t){return typeof t=="function"?t(e):t}var yp=Symbol.for("preact-signals");function nr(){if($t>1)$t--;else{var e,t=!1;for((function(){var r=er;for(er=void 0;r!==void 0;){var a=r.S;if(a.v===r.v)for(var s=a.t;s!==void 0;s=s.x)s.i===r.i&&(s.i=a.i);r=r.o}})();ro!==void 0;){var n=ro;for(ro=void 0,Zo++;n!==void 0;){var o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Qs(n))try{n.c()}catch(r){t||(e=r,t=!0)}n=o}}if(Zo=0,$t--,t)throw e}}function xt(e){if($t>0)return e();Na=++Pp,$t++;try{return e()}finally{nr()}}var oo,Ae=void 0;function ao(e){var t=Ae,n=oo;Ae=void 0,oo=void 0;try{return e()}finally{Ae=t,oo=n}}var ro=void 0,$t=0,Zo=0,Pp=0,Na=0,er=void 0,tr=0;function js(e){if(Ae!==void 0){var t=e.n;if(t===void 0||t.t!==Ae)return t={i:0,S:e,p:Ae.s,n:void 0,t:Ae,e:void 0,x:void 0,r:t},Ae.s!==void 0&&(Ae.s.n=t),Ae.s=t,e.n=t,32&Ae.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=Ae.s,t.n=void 0,Ae.s.n=t,Ae.s=t),t}}function Qe(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}Qe.prototype.brand=yp;Qe.prototype.h=function(){return!0};Qe.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:ao(function(){var o;(o=t.W)==null||o.call(t)}))};Qe.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&&ao(function(){var r;(r=t.Z)==null||r.call(t)}))}};Qe.prototype.subscribe=function(e){var t=this;return Ft(function(){var n=t.value;ao(function(){return e(n)})},{name:"sub"})};Qe.prototype.valueOf=function(){return this.value};Qe.prototype.toString=function(){return this.value+""};Qe.prototype.toJSON=function(){return this.value};Qe.prototype.peek=function(){var e=this;return ao(function(){return e.value})};Object.defineProperty(Qe.prototype,"value",{get:function(){var e=js(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(Zo>100)throw new Error("Cycle detected");(function(n){$t!==0&&Zo===0&&n.l!==Na&&(n.l=Na,er={S:n,v:n.v,i:n.i,o:er})})(this),this.v=e,this.i++,tr++,$t++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{nr()}}}});function te(e,t){return new Qe(e,t)}function Qs(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 Xs(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 Ys(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 rn(e,t){Qe.call(this,void 0,t),this.x=e,this.s=void 0,this.g=tr-1,this.f=4}rn.prototype=new Qe;rn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===tr))return!0;if(this.g=tr,this.f|=1,this.i>0&&!Qs(this))return this.f&=-2,!0;var e=Ae;try{Xs(this),Ae=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 Ae=e,Ys(this),this.f&=-2,!0};rn.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)}Qe.prototype.S.call(this,e)};rn.prototype.U=function(e){if(this.t!==void 0&&(Qe.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)}};rn.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(rn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=js(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function ge(e,t){return new rn(e,t)}function Js(e){var t=e.m;if(e.m=void 0,typeof t=="function"){$t++;var n=Ae;Ae=void 0;try{t()}catch(o){throw e.f&=-2,e.f|=8,Da(e),o}finally{Ae=n,nr()}}}function Da(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Js(e)}function xp(e){if(Ae!==this)throw new Error("Out-of-order effect");Ys(this),Ae=e,this.f&=-2,8&this.f&&Da(this),nr()}function Tn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,oo&&oo.push(this)}Tn.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()}};Tn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Js(this),Xs(this),$t++;var e=Ae;return Ae=this,xp.bind(this,e)};Tn.prototype.N=function(){2&this.f||(this.f|=2,this.u=ro,ro=this)};Tn.prototype.d=function(){this.f|=8,1&this.f||Da(this)};Tn.prototype.dispose=function(){this.d()};function Ft(e,t){var n=new Tn(e,t);try{n.c()}catch(r){throw n.d(),r}var o=n.d.bind(n);return o[Symbol.dispose]=o,o}var Zs,ar,or,Sp=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var el=[];Ft(function(){Zs=this.N})();function In(e,t){J[e]=t.bind(null,J[e]||function(){})}function rr(e){if(or){var t=or;or=void 0,t()}or=e&&e.S()}function tl(e){var t=this,n=e.data,o=Pt(n);o.name="ReactiveDom",o.value=n;var r=oe(function(){for(var l=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var d=ge(function(){var m=o.value.value;return m===0?0:m===!0?"":m||""}),_=ge(function(){return!Array.isArray(d.value)&&!_a(d.value)}),p=Ft(function(){if(this.N=nl,_.value){var m=d.value;l.__v&&l.__v.__e&&l.__v.__e.nodeType===3&&(l.__v.__e.data=m)}}),u=t.__$u.d;return t.__$u.d=function(){p(),u.call(this)},[_,d]},[]),a=r[0],s=r[1];return a.value?s.peek():s.value}tl.displayName="ReactiveTextNode";Object.defineProperties(Qe.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:tl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});In("__b",function(e,t){if(typeof t.type=="string"){var n,o=t.props;for(var r in o)if(r!=="children"){var a=o[r];a instanceof Qe&&(n||(t.__np=n={}),n[r]=a,o[r]=a.peek())}}e(t)});In("__r",function(e,t){if(e(t),t.type!==fe){rr();var n,o=t.__c;o&&(o.__$f&=-2,(n=o.__$u)===void 0&&(o.__$u=n=(function(r,a){var s;return Ft(function(){s=this},{name:a}),s.c=r,s})((function(r){return function(){var a;Sp&&((a=this.y)==null||a.call(this)),r.__$f|=1,r.setState({})}})(o),typeof t.type=="function"?t.type.displayName||t.type.name:""))),ar=o,rr(n)}});In("__e",function(e,t,n,o){rr(),ar=void 0,e(t,n,o)});In("diffed",function(e,t){rr(),ar=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var o=t.__np,r=t.props,a=n.U;if(a)for(var s in a){var l=a[s];l===void 0||o&&s in o||(l.d(),a[s]=void 0)}if(o){a||(a={},n.U=a);for(var c in o){var d=a[c],_=o[c];d===void 0?(d=kp(n,c,_,r),a[c]=d):d.o(_,r)}}}e(t)});function kp(e,t,n,o){var r=t in e&&e.ownerSVGElement===void 0,a=te(n);return{o:function(s,l){a.value=s,o=l},d:Ft(function(){this.N=nl;var s=a.value.value;o[t]!==s&&(o[t]=s,r?e[t]=s:s!=null&&(s!==!1||t[4]==="-")?e.setAttribute(t,s):e.removeAttribute(t))})}}In("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 r in o){var a=o[r];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 _=d.__$u;_&&(d.__$u=void 0,_.d())}}e(t)});In("__h",function(e,t,n,o){o<3&&(t.__$f|=2),e(t,n,o)});_t.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,o=n&&n.s!==void 0;for(var r 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 Pt(e,t){return oe(function(){return te(e,t)},[])}function ft(e,t){var n=O(e);return n.current=e,ar.__$f|=4,oe(function(){return ge(function(){return n.current()},t)},[])}var wp=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Cp(){xt(function(){for(var e;e=el.shift();)Zs.call(e)})}function nl(){el.push(this)===1&&(J.requestAnimationFrame||wp)(Cp)}function ol(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function rl(e){return ol(e)}function al(e){return!(!ol(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function ir(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 Rp=900,Tp=640;function $a(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let o=t.initialSize;return o==="expanded"||o==="fullscreen"||o==="normal"?o:n>0&&n<Tp?"fullscreen":n>=(t.autoSizeBreakpoint??Rp)?"expanded":"normal"}function io(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:$a(e.mode,e.size,t);return{panelOpen:a,panelSize:l}}function En(){return typeof window>"u"?0:window.innerWidth}var Ip="x-public-key",Ep="x-ai-agent-deployment-id";function il(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[Ep]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??Ip]=e.publicKey),t}}}function so(e,t){return new Promise(n=>{if(t?.aborted)return n();let o=setTimeout(a,e),r=()=>a();t?.addEventListener("abort",r,{once:!0});function a(){clearTimeout(o),t?.removeEventListener("abort",r),n()}})}var Xe=class extends Error{constructor(n,o,r,a){super(n);ce(this,"code",o);ce(this,"status",r);ce(this,"cause",a);this.name="StreamError"}};var sl=Z.scope("parser");async function*ll(e,t,n){if(!e.ok){let o=await e.text().catch(()=>"");throw new Xe(`server responded ${e.status}: ${o.slice(0,200)}`,"server",e.status)}for await(let o of Ap(e,t)){let r=Mp(o,n);if(r==="done")return;r&&(yield r)}}async function*Ap(e,t){if(!e.body)throw new Xe("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:r,value:a}=await n.read();if(r){let l=o.trim();l&&(yield l);return}o+=a;let s;for(;(s=o.indexOf(`
|
|
1
|
+
"use strict";var Yr=Object.defineProperty;var o_=Object.getOwnPropertyDescriptor;var a_=Object.getOwnPropertyNames;var i_=Object.prototype.hasOwnProperty;var s_=(e,t,n)=>t in e?Yr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var l_=(e,t)=>{for(var n in t)Yr(e,n,{get:t[n],enumerable:!0})},c_=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of a_(t))!i_.call(e,o)&&o!==n&&Yr(e,o,{get:()=>t[o],enumerable:!(r=o_(t,o))||r.enumerable});return e};var d_=e=>c_(Yr({},"__esModule",{value:!0}),e);var ve=(e,t,n)=>s_(e,typeof t!="symbol"?t+"":t,n);var Fh={};l_(Fh,{HOOK_WILDCARD:()=>Ta,brand:()=>Bh,destroy:()=>Lh,getAllInstances:()=>Nh,getInstance:()=>Oh,hook:()=>$h,init:()=>Mh,mount:()=>Sp,resolveInitialHostMode:()=>Ia,version:()=>Dh});module.exports=d_(Fh);var be,zs,Ha,Qt,Bs,Zr,qs,Jr,Hs,Va,qa,u_,eo={},to=[],p_=/^m(i|n|o|s|text|space)$/,ro=Array.isArray,ja=to.slice,ln=Object.assign;function no(e){e&&e.parentNode&&e.remove()}function An(e,t,n){var r,o,i,a={},s=arguments.length;for(i in t)i=="key"?r=t[i]:i=="ref"&&typeof e!="function"?o=t[i]:a[i]=t[i];return s>2&&(a.children=s>3?ja.call(arguments,2):n),ar(e,a,r,o,null)}function ar(e,t,n,r,o){var i={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o||++zs,__i:-1,__u:0};return!o&&be.vnode&&be.vnode(i),i}function we(e){return e.children}function Ct(e,t){this.props=e,this.context=t,this.__g=0}function Yt(e,t){if(t==null)return e.__?Yt(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!="function"||e.props.__P?null:Yt(e)}function Vs(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Vs(e)}function Fs(e){(8&e.__g||!(e.__g|=8)||!Qt.push(e)||Zr++)&&Bs==be.debounceRendering||((Bs=be.debounceRendering)||queueMicrotask)(__)}function __(){var e,t,n,r,o,i,a,s,c;try{for(t=1;Qt.length;)Qt.length>t&&Qt.sort(qs),e=Qt.shift(),t=Qt.length,8&e.__g&&(r=void 0,o=void 0,i=(o=(n=e).__v).__e,a=[],s=[],(c=n.__P)&&((r=ln({constructor:void 0},o)).__v=o.__v+1,be.vnode&&be.vnode(r),Wa(c,r,o,n.__n,c.namespaceURI,32&o.__u?[i]:null,a,i||Yt(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,Ks(a,r,s),o.__=o.__e=null,r.__e!=i&&Vs(r)))}finally{Qt.length=Zr=0}}function js(e,t,n,r,o,i,a,s,c,u,d){var _,p,f,m,g,P,k=r.__k||to,S=t.length;for(c=f_(n,t,k,c,S),_=0;_<S;_++)(f=n.__k[_])!=null&&(p=~f.__i&&k[f.__i]||eo,f.__i=_,P=Wa(e,f,p,o,i,a,s,c,u,d),m=f.__e,(p.ref!=f.ref||8&p.__u)&&(p.ref&&Ga(p.ref,null,f,p),f.ref&&d.push(f.ref,f.__c||m,f)),g=g||m,4&f.__u?(c=Ws(f,c,e,!p.__v),p.__e&&(p.__e=null)):typeof f.type=="function"&&P!==void 0?c=P:m&&(c=m.nextSibling),f.__u&=-7);return n.__e=g,c}function f_(e,t,n,r,o){var i,a,s,c,u,d,_,p,f,m,g=n.length,P=g,k=0,S=!1,h=e.__k=Array(o);for(i=0;i<o;i++)(a=t[i])!=null&&typeof a!="boolean"&&typeof a!="function"?(typeof a!="object"||a.constructor==String?a=h[i]=ar(null,a):ro(a)?a=h[i]=ar(we,{children:a}):a.constructor===void 0&&a.__b?a=h[i]=ar(a.type,a.props,a.key,a.ref,a.__v):h[i]=a,c=i+k,a.__=e,a.__b=e.__b+1,s=null,~(u=a.__i=m_(a,n,c,P))&&(P--,(s=n[u])&&(s.__u|=2)),s&&s.__v?(a.__u|=2,u==c-1?k--:u==c+1?k++:u!=c&&(u>c?k--:k++,S=!0)):(~u||(o>g?k--:o<g&&k++),typeof a.type!="function"&&(a.__u|=4))):h[i]=null;if(S){for(d=[],_=[],i=0;i<o;i++)if((a=h[i])&&2&a.__u){for(p=0,f=d.length;p<f;)d[m=p+f>>1]<a.__i?p=m+1:f=m;d[p]=a.__i,_[i]=p+1}for(k=d.length;i--;)_[i]&&(_[i]==k?k--:h[i].__u|=4)}if(P)for(i=0;i<g;i++)!(s=n[i])||2&s.__u||(s.__e==r&&(r=Yt(s)),Ka(s,s));return r}function Ws(e,t,n,r){var o,i,a;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&(o[i].__=e,t=Ws(o[i],t,n,!1));return t}for(t&&!t.parentNode&&(t=Yt(e))&&!t.parentNode&&(t=null),a=t;a&&a.nodeType==8;)a=a.nextSibling;for(e.__e!=a&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t=t&&t.nextSibling)&&t.nodeType==8;);return t}function oo(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(ro(e)?e.some(function(n){oo(n,t)}):t.push(e)),t}function m_(e,t,n,r){var o,i,a,s=e.key,c=e.type,u=t[n],d=u&&!(2&u.__u);if(u===null&&s==null||d&&s==u.key&&c==u.type)return n;if(r>(d?1:0)){for(o=n-1,i=n+1;o>=0||i<t.length;)if((u=t[a=o>=0?o--:i++])&&!(2&u.__u)&&s==u.key&&c==u.type)return a}return-1}function Us(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function Xr(e,t,n,r,o){var i,a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||Us(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||Us(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(a=qa[t]||(qa[t]=g_(t)),(e.__a||(e.__a={}))[t]=Va,i=t!=(t=t.replace(Hs,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,a,i):e.removeEventListener(t,a,i));else{if(o=="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 g_(e){return function(t){if(this.__e){var n=this.__e[e];if(t[Jr]==null)t[Jr]=Va++;else if(t[Jr]<this.__a[e])return;return n(be.event?be.event(t):t)}}}function Wa(e,t,n,r,o,i,a,s,c,u){var d,_,p,f,m,g,P,k,S,h,b,y,C,E,Y,j,O,B,z,F,Z=t.type;if(t.constructor!==void 0)return null;if(128&n.__u&&(c=32&n.__u,d=n.__c.__z)){if(t.__u|=c,_=i=[],d.nodeType==8)for(p=1,f=d.nextSibling;f;f=f.nextSibling){if(f.nodeType==8){if(f.data.startsWith("$s"))p++;else if(f.data.startsWith("/$s")&&!--p)break}i.push(f)}else i.push(d);s=i[0]}(d=be.__b)&&d(t);e:if(typeof Z=="function"){m=a.length;try{if(h=t.props,b=(d=Z.prototype)&&d.render,y=(d=Z.contextType)&&r[d.__c],C=d?y?y.props.value:d.__:r,n.__c?2&(g=t.__c=n.__c).__g&&(g.__g|=1):(b?t.__c=g=new Z(h,C):(t.__c=g=new Ct(h,C),g.constructor=Z,g.render=h_),y&&y.sub(g),g.state||(g.state={}),g.__n=r,g.__g|=8,g.__h=[],g.__k=[]),b&&(g.__s||(g.__s=g.state),Z.getDerivedStateFromProps&&(g.__s==g.state&&(g.__s=ln({},g.__s)),ln(g.__s,Z.getDerivedStateFromProps(h,g.__s)))),P=g.props,k=g.state,g.__v=t,n.__c){if(b&&!Z.getDerivedStateFromProps&&h!==P&&g.componentWillReceiveProps&&g.componentWillReceiveProps(h,C),t.__v==n.__v&&!(8&g.__g)||!(4&g.__g)&&g.shouldComponentUpdate&&g.shouldComponentUpdate(h,g.__s,C)===!1){t.__v!=n.__v&&(g.props=h,g.state=g.__s,g.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),to.push.apply(g.__h,g.__k),g.__k=[],g.__h.length&&a.push(g),s=Yt(n);break e}g.componentWillUpdate&&g.componentWillUpdate(h,g.__s,C),b&&g.componentDidUpdate&&g.__h.push(function(){g.componentDidUpdate(P,k,S)})}else b&&!Z.getDerivedStateFromProps&&g.componentWillMount&&g.componentWillMount(),b&&g.componentDidMount&&g.__h.push(g.componentDidMount);if(g.context=C,g.props=h,g.__P=e,g.__g&=-5,E=be.__r,Y=0,b)g.state=g.__s,g.__g&=-9,E&&E(t),d=g.render(g.props,g.state,g.context),to.push.apply(g.__h,g.__k),g.__k=[];else do g.__g&=-9,E&&E(t),d=g.render(g.props,g.state,g.context),g.state=g.__s;while(8&g.__g&&++Y<25);g.state=g.__s,g.getChildContext&&(r=ln({},r,g.getChildContext())),b&&n.__c&&g.getSnapshotBeforeUpdate&&(S=g.getSnapshotBeforeUpdate(P,k)),j=d&&d.type===we&&d.key==null?d.props.children:d,h.__P&&(d=s,o=(e=h.__P).namespaceURI,c=i=null,n.props&&n.props.__P!=e&&(n.__k.some(function(L){L&&Ka(L,L)}),n.__k=null),s=n.__k?Yt(n,0):null),s=js(e,ro(j)?j:[j],t,n,r,o,i,a,s,c,u),h.__P&&(t.__e=null,s=d),t.__u&=-161,128&n.__u&&(g.__z=null),_&&_.some(no),g.__h.length&&a.push(g),1&g.__g&&(g.__g&=-4)}catch(L){if(a.length=m,t.__v=null,c||i)if(L.then){if(O=0,t.__u|=c?160:128,i){for(~(z=i.indexOf(s||void 0))||(z=i.length);(F=i[z-1])&&F.nodeType==8;)z--;for(;z<i.length;z++)if(F=i[z]){if(i[z]=null,F.nodeType==8){if(F.data.startsWith("$s"))O++||(B=F);else if(O&&F.data.startsWith("/$s")&&!--O){s=F;break}}else if(!O)break}}if(!B){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;B=s}t.__c.__z||(t.__c.__z=B),t.__e=s}else i&&i.some(no);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),L.then||Gs(t),be.__e(L,t,n)}}else s=t.__e=v_(n.__e,t,n,r,o,i,a,c,u,e);return(d=be.diffed)&&d(t),128&t.__u?void 0:s}function Gs(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Gs))}function Ks(e,t,n){for(var r=0;r<n.length;)Ga(n[r++],n[r++],n[r++]);be.__c&&be.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(i){i.call(o)})}catch(i){be.__e(i,o.__v)}})}function v_(e,t,n,r,o,i,a,s,c,u){var d,_,p,f,m,g,P,k,S,h=n.props||eo,b=t.props,y=t.type;if(y=="svg"?o="http://www.w3.org/2000/svg":y=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),i){for(d=0;d<i.length;d++)if((m=i[d])&&(y?m.localName==y:m.nodeType==3)){e=m,i[d]=null;break}}if(!e){if(k=u.ownerDocument||document,!y)return k.createTextNode(b);e=k.createElementNS(o,y,b.is&&b),s&&(be.__m&&be.__m(t,i),s=!1),i=null}if(y){if(u=y=="template"?e.content:e,i=y=="textarea"&&b.defaultValue!=null?null:i&&ja.call(u.childNodes),!s&&i)for(h={},d=0;d<e.attributes.length;d++)h[(m=e.attributes[d]).name]=m.value;for(d in h)m=h[d],d=="dangerouslySetInnerHTML"?p=m:d=="children"||d in b||d=="value"&&"defaultValue"in b||d=="checked"&&"defaultChecked"in b||Xr(e,d,null,m,o);for(d in S=1&n.__u,b)m=b[d],d=="children"?f=m:d=="dangerouslySetInnerHTML"?_=m:d=="value"?g=m:d=="checked"?P=m:s&&typeof m!="function"||!(h[d]!==m||S&&m!=null)||Xr(e,d,m,h[d],o);_?(s||p&&(_.__html==p.__html||_.__html==e.innerHTML)||(e.innerHTML=_.__html),t.__k=[]):(p&&(e.textContent=""),(y=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&p_.test(y))&&(o="http://www.w3.org/1999/xhtml"),js(u,ro(f)?f:[f],t,n,r,o,i,a,i?i[0]:n.__k&&Yt(n,0),s,c),i&&i.some(no)),s&&y!="textarea"||(d="value",y=="progress"&&g==null?e.removeAttribute(d):g==null||g===e[d]&&(y!="progress"||g)||Xr(e,d,g,h[d],o),d="checked",P!=null&&P!=e[d]&&Xr(e,d,P,h[d],o))}else h===b||s&&e.data==b||(e.data=b);return e}function Ga(e,t,n,r){try{typeof e=="function"?t?t.__x=e(t)||1:r&&(r=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t=="function"?t():e(null)):e.current=t}catch(o){be.__e(o,n)}}function Ka(e,t,n){var r,o;if(be.unmount&&be.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Ga(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(i){be.__e(i,t)}r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&Ka(r[o],t,typeof e.type!="function"||n&&!e.props.__P);(r=e.__e)&&(n||no(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function h_(e,t,n){return this.constructor(e,n)}function Xt(e,t){var n,r,o,i;be.__&&be.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=ar(we,{children:[e]}),o=[],i=[],Wa(t,t.__k,r||eo,eo,t.namespaceURI,r?null:t.firstChild?ja.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,i),Ks(o,t.__k,i),t.__k.props.children=null}be={__e:function(e,t,n,r){for(var o,i,a;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=o.constructor)&&i.getDerivedStateFromError&&(o.setState(i.getDerivedStateFromError(e)),a=8&o.__g),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),a=8&o.__g),a)return void(o.__g|=2)}catch(s){e=s,a=0}}throw Zr=0,e}},zs=0,Ha=function(e){return e!=null&&e.constructor===void 0},Ct.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=ln({},this.state)),typeof e=="function"&&(e=e(ln({},n),this.props)),e&&(ln(n,e),this.__v&&(t&&this.__k.push(t),Fs(this)))},Ct.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Fs(this))},Ct.prototype.render=we,Qt=[],Zr=0,qs=function(e,t){return e.__v.__b-t.__v.__b},Jr=Symbol(),Hs=/(PointerCapture)$|Capture$/i,Va=0,qa={},u_=0;var T={id:"help-ai",name:"@helpai/elements",global:"HelpAI",tagName:"web-ai-chat",cssPrefix:"helpai",defaultBaseUrl:"https://help.ai",displayName:"Help AI",domain:"help.ai",siteUrl:"https://help.ai"};var En="1.4.1";var ao={attach:"Attach files",attachmentMimeRejected:"File type not supported",attachmentTooLarge:"File is too large",attachmentTooMany:"Attachment limit reached",conversationClosed:"This chat is closed",conversationLoading:"Loading chat\u2026",loadPreviousMessages:"Load previous messages",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 chats yet",historyLoading:"Loading your chats\u2026",historyContinue:"Continue the chat",historyTitle:"Chat history",loadMoreConversations:"Load more conversations",language:"Language",launcherOpen:"Open chat",launcherLabel:"Chat with us",micStart:"Start voice input",micStop:"Stop voice input",micUnsupported:"Voice input is not supported in this browser",moreActions:"More actions",newConversation:"New chat",panelTitle:"Chat",popOut:"Open in new tab",resizeHandle:"Drag to resize",scrollToBottom:"Scroll to latest",send:"Send",queueMessage:"Queue message",removeQueuedMessage:"Remove queued message",compactingContext:"Optimizing conversation context\u2026",soundOff:"Sound off",soundOn:"Sound on",startNewConversation:"Start a new chat",talkToOperator:"Talk to an operator",connectingOperator:"Connecting you to an operator\u2026",noOperatorAvailable:"No one's available right now \u2014 leave your details and we'll follow up.",chattingWithOperator:"You're chatting with {operator}",cancelOperatorRequest:"Keep chatting with the AI",stop:"Stop",theme:"Theme",themeAuto:"Auto",themeDark:"Dark",themeLight:"Light",textSize:"Text size",textSizeSmall:"Small",textSizeNormal:"Normal",textSizeLarge:"Large",loading:"Loading\u2026",visualPreparing:"Preparing visual\u2026",visualError:"This visual could not be displayed.",thinking:"Thinking\u2026",thoughts:"Thoughts",toolResult:"Result",sources:"Sources",feedbackUp:"Good response",feedbackDown:"Bad response",feedbackThanks:"Thanks for your feedback",copy:"Copy",copied:"Copied",tabHome:"Home",tabConversations:"Chats",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:"Questions for you",inputBadge:"Questions",inputAnswered:"Answered",inputSkipped:"Skipped",showOptions:"Show options",hideOptions:"Hide options",qtypeText:"Your answer",qtypeEmail:"Email address",qtypePhone:"Phone number",qtypeNumber:"Number",qtypeDate:"Date",qtypeChooseOne:"Pick one",qtypeChooseAny:"Pick any",qtypeBoolean:"Yes / No",inputSubmit:"Submit answers",inputSubmitHint:"Enter to send \xB7 Shift+Enter = new line",inputSkip:"Skip",confirmYes:"Yes",confirmNo:"No",approve:"Approve",reject:"Reject",approvalPrompt:"{tool} requires your approval to execute.",approvalBody:"Review the tool input above and decide whether to allow this action.",approvalYourResponse:"Your response: {decision}",approvalEditHint:"You can edit this response until this step continues.",approvalSubmitting:"Response submitted. Request in progress\u2026",edit:"Edit",toolParameters:"Parameters",statusAwaiting:"Awaiting Approval",statusResponded:"Submitted",statusRunning:"Running",statusCompleted:"Completed",statusDenied:"Denied",statusError:"Error",statusSuperseded:"Skipped"},b_={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:"Ce chat est ferm\xE9",conversationLoading:"Chargement du chat\u2026",loadPreviousMessages:"Charger les messages pr\xE9c\xE9dents",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:"Aucun chat pour le moment",historyContinue:"Poursuivre le chat",historyLoading:"Chargement de vos chats\u2026",historyTitle:"Historique des chats",loadMoreConversations:"Charger plus de conversations",language:"Langue",launcherOpen:"Ouvrir le chat",launcherLabel:"Discuter avec nous",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:"Nouveau chat",panelTitle:"Chat",popOut:"Ouvrir dans un nouvel onglet",resizeHandle:"Glisser pour redimensionner",scrollToBottom:"Aller au plus r\xE9cent",send:"Envoyer",queueMessage:"Mettre le message en attente",removeQueuedMessage:"Retirer le message en attente",compactingContext:"Optimisation du contexte de la conversation\u2026",soundOff:"Son d\xE9sactiv\xE9",soundOn:"Son activ\xE9",startNewConversation:"D\xE9marrer un nouveau chat",talkToOperator:"Parler \xE0 un op\xE9rateur",connectingOperator:"Mise en relation avec un op\xE9rateur\u2026",noOperatorAvailable:"Personne n'est disponible pour le moment \u2014 laissez vos coordonn\xE9es et nous reviendrons vers vous.",chattingWithOperator:"Vous discutez avec {operator}",cancelOperatorRequest:"Continuer avec l'IA",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",visualPreparing:"Pr\xE9paration du visuel\u2026",visualError:"Ce visuel n\u2019a pas pu \xEAtre affich\xE9.",thinking:"R\xE9flexion\u2026",thoughts:"R\xE9flexions",toolResult:"R\xE9sultat",sources:"Sources",feedbackUp:"Bonne r\xE9ponse",feedbackDown:"Mauvaise r\xE9ponse",feedbackThanks:"Merci pour votre retour",copy:"Copier",copied:"Copi\xE9",tabHome:"Accueil",tabConversations:"Chats",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:"Questions pour vous",inputBadge:"Questions",inputAnswered:"R\xE9pondu",inputSkipped:"Ignor\xE9",showOptions:"Afficher les options",hideOptions:"Masquer les options",qtypeText:"Votre r\xE9ponse",qtypeEmail:"Adresse e-mail",qtypePhone:"Num\xE9ro de t\xE9l\xE9phone",qtypeNumber:"Nombre",qtypeDate:"Date",qtypeChooseOne:"Choisir une",qtypeChooseAny:"Choisir plusieurs",qtypeBoolean:"Oui / Non",inputSubmit:"Envoyer les r\xE9ponses",inputSubmitHint:"Entr\xE9e pour envoyer \xB7 Maj+Entr\xE9e = saut de ligne",inputSkip:"Ignorer",confirmYes:"Oui",confirmNo:"Non",approve:"Approuver",reject:"Refuser",approvalPrompt:"{tool} n\xE9cessite votre approbation pour s'ex\xE9cuter.",approvalBody:"V\xE9rifiez les param\xE8tres ci-dessus et d\xE9cidez d'autoriser ou non cette action.",approvalYourResponse:"Votre r\xE9ponse : {decision}",approvalEditHint:"Vous pouvez modifier votre r\xE9ponse jusqu'\xE0 la reprise de cette \xE9tape.",approvalSubmitting:"R\xE9ponse envoy\xE9e. Traitement en cours\u2026",edit:"Modifier",toolParameters:"Param\xE8tres",statusAwaiting:"En attente d'approbation",statusResponded:"Envoy\xE9",statusRunning:"En cours",statusCompleted:"Termin\xE9",statusDenied:"Refus\xE9",statusError:"Erreur",statusSuperseded:"Ignor\xE9"},y_={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",attachmentMimeRejected:"\u0646\u0648\u0639 \u0627\u0644\u0645\u0644\u0641 \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645",attachmentTooLarge:"\u062D\u062C\u0645 \u0627\u0644\u0645\u0644\u0641 \u0643\u0628\u064A\u0631 \u062C\u062F\u064B\u0627",attachmentTooMany:"\u062A\u0645 \u0628\u0644\u0648\u063A \u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 \u0644\u0644\u0645\u0631\u0641\u0642\u0627\u062A",conversationClosed:"\u062A\u0645 \u0625\u063A\u0644\u0627\u0642 \u0647\u0630\u0647 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",conversationLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0629\u2026",loadPreviousMessages:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0631\u0633\u0627\u0626\u0644 \u0627\u0644\u0633\u0627\u0628\u0642\u0629",close:"\u0625\u063A\u0644\u0627\u0642",collapse:"\u0637\u064A\u0651",collapseSidebar:"\u0637\u064A\u0651 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",composerPlaceholder:"\u0627\u0643\u062A\u0628 \u0631\u0633\u0627\u0644\u0629\u2026",dateLastWeek:"\u0622\u062E\u0631 \u0667 \u0623\u064A\u0627\u0645",dateOlder:"\u0623\u0642\u062F\u0645",dateToday:"\u0627\u0644\u064A\u0648\u0645",dateYesterday:"\u0623\u0645\u0633",dropZone:"\u0623\u0641\u0644\u062A \u0627\u0644\u0645\u0644\u0641\u0627\u062A \u0644\u0625\u0631\u0641\u0627\u0642\u0647\u0627",errorGeneric:"\u062D\u062F\u062B \u062E\u0637\u0623 \u0645\u0627",errorRateLimited:"\u0637\u0644\u0628\u0627\u062A \u0643\u062B\u064A\u0631\u0629 \u062C\u062F\u064B\u0627 \u2014 \u064A\u0631\u062C\u0649 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629 \u0628\u0639\u062F \u0644\u062D\u0638\u0629.",errorRetry:"\u0625\u0639\u0627\u062F\u0629 \u0627\u0644\u0645\u062D\u0627\u0648\u0644\u0629",expand:"\u062A\u0648\u0633\u064A\u0639",expandSidebar:"\u062A\u0648\u0633\u064A\u0639 \u0627\u0644\u0634\u0631\u064A\u0637 \u0627\u0644\u062C\u0627\u0646\u0628\u064A",exitFullscreen:"\u0625\u0646\u0647\u0627\u0621 \u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",fullscreen:"\u0645\u0644\u0621 \u0627\u0644\u0634\u0627\u0634\u0629",history:"\u0627\u0644\u0633\u062C\u0644",historyBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u062F\u0631\u062F\u0634\u0627\u062A \u0633\u0627\u0628\u0642\u0629 \u0628\u0639\u062F",historyContinue:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u062F\u0631\u062F\u0634\u0629",historyLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u062F\u0631\u062F\u0634\u0627\u062A\u0643\u2026",historyTitle:"\u0633\u062C\u0644 \u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",loadMoreConversations:"\u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0632\u064A\u062F \u0645\u0646 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0627\u062A",language:"\u0627\u0644\u0644\u063A\u0629",launcherOpen:"\u0641\u062A\u062D \u0627\u0644\u062F\u0631\u062F\u0634\u0629",launcherLabel:"\u062A\u062D\u062F\u062B \u0645\u0639\u0646\u0627",micStart:"\u0628\u062F\u0621 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micStop:"\u0625\u064A\u0642\u0627\u0641 \u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A",micUnsupported:"\u0627\u0644\u0625\u062F\u062E\u0627\u0644 \u0627\u0644\u0635\u0648\u062A\u064A \u063A\u064A\u0631 \u0645\u062F\u0639\u0648\u0645 \u0641\u064A \u0647\u0630\u0627 \u0627\u0644\u0645\u062A\u0635\u0641\u062D",moreActions:"\u0625\u062C\u0631\u0627\u0621\u0627\u062A \u0625\u0636\u0627\u0641\u064A\u0629",newConversation:"\u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",panelTitle:"\u0627\u0644\u062F\u0631\u062F\u0634\u0629",popOut:"\u0641\u062A\u062D \u0641\u064A \u0639\u0644\u0627\u0645\u0629 \u062A\u0628\u0648\u064A\u0628 \u062C\u062F\u064A\u062F\u0629",resizeHandle:"\u0627\u0633\u062D\u0628 \u0644\u062A\u063A\u064A\u064A\u0631 \u0627\u0644\u062D\u062C\u0645",scrollToBottom:"\u0627\u0644\u0627\u0646\u062A\u0642\u0627\u0644 \u0625\u0644\u0649 \u0627\u0644\u0623\u062D\u062F\u062B",send:"\u0625\u0631\u0633\u0627\u0644",queueMessage:"\u0625\u0636\u0627\u0641\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0625\u0644\u0649 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",removeQueuedMessage:"\u0625\u0632\u0627\u0644\u0629 \u0627\u0644\u0631\u0633\u0627\u0644\u0629 \u0645\u0646 \u0642\u0627\u0626\u0645\u0629 \u0627\u0644\u0627\u0646\u062A\u0638\u0627\u0631",compactingContext:"\u062C\u0627\u0631\u064D \u062A\u062D\u0633\u064A\u0646 \u0633\u064A\u0627\u0642 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629\u2026",soundOff:"\u0643\u062A\u0645 \u0627\u0644\u0635\u0648\u062A",soundOn:"\u062A\u0634\u063A\u064A\u0644 \u0627\u0644\u0635\u0648\u062A",startNewConversation:"\u0628\u062F\u0621 \u062F\u0631\u062F\u0634\u0629 \u062C\u062F\u064A\u062F\u0629",talkToOperator:"\u0627\u0644\u062A\u062D\u062F\u062B \u0625\u0644\u0649 \u0645\u0648\u0638\u0641",connectingOperator:"\u062C\u0627\u0631\u064A \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0623\u062D\u062F \u0627\u0644\u0645\u0648\u0638\u0641\u064A\u0646\u2026",noOperatorAvailable:"\u0644\u0627 \u064A\u0648\u062C\u062F \u0645\u0648\u0638\u0641\u0648\u0646 \u0645\u062A\u0627\u062D\u0648\u0646 \u0627\u0644\u0622\u0646 \u2014 \u0627\u062A\u0631\u0643 \u0628\u064A\u0627\u0646\u0627\u062A\u0643 \u0648\u0633\u0646\u062A\u0648\u0627\u0635\u0644 \u0645\u0639\u0643.",chattingWithOperator:"\u0623\u0646\u062A \u062A\u062A\u062D\u062F\u062B \u0645\u0639 {operator}",cancelOperatorRequest:"\u0645\u062A\u0627\u0628\u0639\u0629 \u0627\u0644\u0645\u062D\u0627\u062F\u062B\u0629 \u0645\u0639 \u0627\u0644\u0630\u0643\u0627\u0621 \u0627\u0644\u0627\u0635\u0637\u0646\u0627\u0639\u064A",stop:"\u0625\u064A\u0642\u0627\u0641",theme:"\u0627\u0644\u0645\u0638\u0647\u0631",themeAuto:"\u062A\u0644\u0642\u0627\u0626\u064A",themeDark:"\u062F\u0627\u0643\u0646",themeLight:"\u0641\u0627\u062A\u062D",textSize:"\u062D\u062C\u0645 \u0627\u0644\u0646\u0635",textSizeSmall:"\u0635\u063A\u064A\u0631",textSizeNormal:"\u0639\u0627\u062F\u064A",textSizeLarge:"\u0643\u0628\u064A\u0631",loading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",visualPreparing:"\u062C\u0627\u0631\u064D \u0625\u0639\u062F\u0627\u062F \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A\u2026",visualError:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0647\u0630\u0627 \u0627\u0644\u0645\u062D\u062A\u0648\u0649 \u0627\u0644\u0645\u0631\u0626\u064A.",thinking:"\u064A\u0641\u0643\u0651\u0631\u2026",thoughts:"\u0627\u0644\u0623\u0641\u0643\u0627\u0631",toolResult:"\u0627\u0644\u0646\u062A\u064A\u062C\u0629",sources:"\u0627\u0644\u0645\u0635\u0627\u062F\u0631",feedbackUp:"\u0631\u062F \u062C\u064A\u062F",feedbackDown:"\u0631\u062F \u0633\u064A\u0626",feedbackThanks:"\u0634\u0643\u0631\u064B\u0627 \u0639\u0644\u0649 \u0645\u0644\u0627\u062D\u0638\u0627\u062A\u0643",copy:"\u0646\u0633\u062E",copied:"\u062A\u0645 \u0627\u0644\u0646\u0633\u062E",tabHome:"\u0627\u0644\u0631\u0626\u064A\u0633\u064A\u0629",tabConversations:"\u0627\u0644\u062F\u0631\u062F\u0634\u0627\u062A",tabHelp:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",tabNews:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",modulesEmpty:"\u0644\u0627 \u0634\u064A\u0621 \u0647\u0646\u0627 \u0628\u0639\u062F",moduleBack:"\u0631\u062C\u0648\u0639",contentLoading:"\u062C\u0627\u0631\u064D \u0627\u0644\u062A\u062D\u0645\u064A\u0644\u2026",homeGreeting:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeGreetingNamed:"\u0645\u0631\u062D\u0628\u064B\u0627 {name} \u{1F44B}",homeGreetingLead:"\u0643\u064A\u0641 \u064A\u0645\u0643\u0646\u0646\u0627 \u0645\u0633\u0627\u0639\u062F\u062A\u0643\u061F",homeSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",homeContentTitle:"\u0645\u0642\u0627\u0644\u0627\u062A \u0634\u0627\u0626\u0639\u0629",homeStatus:"\u0627\u0644\u062D\u0627\u0644\u0629",helpTitle:"\u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629",helpSearchPlaceholder:"\u0627\u0628\u062D\u062B \u0639\u0646 \u0645\u0633\u0627\u0639\u062F\u0629",helpEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0645\u0642\u0627\u0644\u0627\u062A \u0645\u0633\u0627\u0639\u062F\u0629 \u0628\u0639\u062F",helpLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0645\u0633\u0627\u0639\u062F\u0629\u2026",helpSearchEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0646\u062A\u0627\u0626\u062C",newsTitle:"\u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsEmpty:"\u0644\u0627 \u062A\u0648\u062C\u062F \u0623\u062E\u0628\u0627\u0631 \u0628\u0639\u062F",newsLoading:"\u062C\u0627\u0631\u064D \u062A\u062D\u0645\u064A\u0644 \u0627\u0644\u0623\u062E\u0628\u0627\u0631\u2026",newsBack:"\u0627\u0644\u0639\u0648\u062F\u0629 \u0625\u0644\u0649 \u0627\u0644\u0623\u062E\u0628\u0627\u0631",newsPublishedAt:"\u0646\u064F\u0634\u0631 \u0641\u064A {date}",formSubmit:"\u0625\u0631\u0633\u0627\u0644",formSkip:"\u0644\u0627\u062D\u0642\u064B\u0627",formSubmitted:"\u062A\u0645",formSkipped:"\u0644\u0627\u062D\u0642\u064B\u0627",formFillOut:"\u062A\u0639\u0628\u0626\u0629",formRequired:"\u0647\u0630\u0627 \u0627\u0644\u062D\u0642\u0644 \u0645\u0637\u0644\u0648\u0628",formInvalidEmail:"\u0623\u062F\u062E\u0644 \u0628\u0631\u064A\u062F\u064B\u0627 \u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidTel:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645 \u0647\u0627\u062A\u0641 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidUrl:"\u0623\u062F\u062E\u0644 \u0631\u0627\u0628\u0637\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formInvalidNumber:"\u0623\u062F\u062E\u0644 \u0631\u0642\u0645\u064B\u0627 \u0635\u062D\u064A\u062D\u064B\u0627",formTooShort:"\u0642\u0635\u064A\u0631 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u062F\u0646\u0649 {min} \u062D\u0631\u0641\u064B\u0627)",formTooLong:"\u0637\u0648\u064A\u0644 \u062C\u062F\u064B\u0627 (\u0627\u0644\u062D\u062F \u0627\u0644\u0623\u0642\u0635\u0649 {max} \u062D\u0631\u0641\u064B\u0627)",formNumberTooSmall:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0642\u0644 \u0639\u0646 {min}",formNumberTooLarge:"\u064A\u062C\u0628 \u0623\u0644\u0627 \u064A\u0632\u064A\u062F \u0639\u0646 {max}",formPatternMismatch:"\u064A\u0631\u062C\u0649 \u0645\u0637\u0627\u0628\u0642\u0629 \u0627\u0644\u0635\u064A\u063A\u0629 \u0627\u0644\u0645\u0637\u0644\u0648\u0628\u0629",formChooseAtLeast:"\u0627\u062E\u062A\u0631 {min} \u0639\u0644\u0649 \u0627\u0644\u0623\u0642\u0644",formChooseAtMost:"\u0627\u062E\u062A\u0631 {max} \u0639\u0644\u0649 \u0627\u0644\u0623\u0643\u062B\u0631",formOther:"\u0623\u062E\u0631\u0649",formOtherPlaceholder:"\u0627\u0643\u062A\u0628 \u0625\u062C\u0627\u0628\u062A\u0643\u2026",inputRequired:"\u0623\u0633\u0626\u0644\u0629 \u0644\u0643",inputBadge:"\u0623\u0633\u0626\u0644\u0629",inputAnswered:"\u062A\u0645\u062A \u0627\u0644\u0625\u062C\u0627\u0628\u0629",inputSkipped:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A",showOptions:"\u0625\u0638\u0647\u0627\u0631 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",hideOptions:"\u0625\u062E\u0641\u0627\u0621 \u0627\u0644\u062E\u064A\u0627\u0631\u0627\u062A",qtypeText:"\u0625\u062C\u0627\u0628\u062A\u0643",qtypeEmail:"\u0639\u0646\u0648\u0627\u0646 \u0627\u0644\u0628\u0631\u064A\u062F \u0627\u0644\u0625\u0644\u0643\u062A\u0631\u0648\u0646\u064A",qtypePhone:"\u0631\u0642\u0645 \u0627\u0644\u0647\u0627\u062A\u0641",qtypeNumber:"\u0631\u0642\u0645",qtypeDate:"\u062A\u0627\u0631\u064A\u062E",qtypeChooseOne:"\u0627\u062E\u062A\u0631 \u0648\u0627\u062D\u062F\u064B\u0627",qtypeChooseAny:"\u0627\u062E\u062A\u0631 \u0623\u064A\u064B\u0627",qtypeBoolean:"\u0646\u0639\u0645 / \u0644\u0627",inputSubmit:"\u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0625\u062C\u0627\u0628\u0627\u062A",inputSubmitHint:"Enter \u0644\u0644\u0625\u0631\u0633\u0627\u0644 \xB7 Shift+Enter = \u0633\u0637\u0631 \u062C\u062F\u064A\u062F",inputSkip:"\u062A\u062E\u0637\u064D\u0651",confirmYes:"\u0646\u0639\u0645",confirmNo:"\u0644\u0627",approve:"\u0645\u0648\u0627\u0641\u0642\u0629",reject:"\u0631\u0641\u0636",approvalPrompt:"\u062A\u062A\u0637\u0644\u0628 {tool} \u0645\u0648\u0627\u0641\u0642\u062A\u0643 \u0644\u0644\u062A\u0646\u0641\u064A\u0630.",approvalBody:"\u0631\u0627\u062C\u0639 \u0645\u064F\u0639\u0637\u064A\u0627\u062A \u0627\u0644\u0623\u062F\u0627\u0629 \u0623\u0639\u0644\u0627\u0647 \u0648\u0642\u0631\u0651\u0631 \u0627\u0644\u0633\u0645\u0627\u062D \u0628\u0647\u0630\u0627 \u0627\u0644\u0625\u062C\u0631\u0627\u0621 \u0623\u0648 \u0631\u0641\u0636\u0647.",approvalYourResponse:"\u0631\u062F\u0651\u0643: {decision}",approvalEditHint:"\u064A\u0645\u0643\u0646\u0643 \u062A\u0639\u062F\u064A\u0644 \u0631\u062F\u0651\u0643 \u062D\u062A\u0649 \u062A\u0633\u062A\u0623\u0646\u0641 \u0647\u0630\u0647 \u0627\u0644\u062E\u0637\u0648\u0629.",approvalSubmitting:"\u062A\u0645 \u0625\u0631\u0633\u0627\u0644 \u0627\u0644\u0631\u062F. \u062C\u0627\u0631\u064D \u0627\u0644\u062A\u0646\u0641\u064A\u0630\u2026",edit:"\u062A\u0639\u062F\u064A\u0644",toolParameters:"\u0627\u0644\u0645\u0639\u0637\u064A\u0627\u062A",statusAwaiting:"\u0628\u0627\u0646\u062A\u0638\u0627\u0631 \u0627\u0644\u0645\u0648\u0627\u0641\u0642\u0629",statusResponded:"\u062A\u0645 \u0627\u0644\u0625\u0631\u0633\u0627\u0644",statusRunning:"\u0642\u064A\u062F \u0627\u0644\u062A\u0646\u0641\u064A\u0630",statusCompleted:"\u0645\u0643\u062A\u0645\u0644",statusDenied:"\u0645\u0631\u0641\u0648\u0636",statusError:"\u062E\u0637\u0623",statusSuperseded:"\u062A\u0645 \u0627\u0644\u062A\u062E\u0637\u064A"},P_={attach:"Adjuntar archivos",attachmentMimeRejected:"Tipo de archivo no admitido",attachmentTooLarge:"El archivo es demasiado grande",attachmentTooMany:"Se alcanz\xF3 el l\xEDmite de adjuntos",conversationClosed:"Este chat est\xE1 cerrado",conversationLoading:"Cargando chat\u2026",loadPreviousMessages:"Cargar mensajes anteriores",close:"Cerrar",collapse:"Contraer",collapseSidebar:"Contraer la barra lateral",composerPlaceholder:"Escribe un mensaje\u2026",dateLastWeek:"\xDAltimos 7 d\xEDas",dateOlder:"Anteriores",dateToday:"Hoy",dateYesterday:"Ayer",dropZone:"Suelta los archivos para adjuntarlos",errorGeneric:"Algo sali\xF3 mal",errorRateLimited:"Demasiadas solicitudes: int\xE9ntalo de nuevo en un momento.",errorRetry:"Reintentar",expand:"Ampliar",expandSidebar:"Expandir la barra lateral",exitFullscreen:"Salir de pantalla completa",fullscreen:"Pantalla completa",history:"Historial",historyBack:"Volver al chat",historyEmpty:"A\xFAn no tienes chats",historyContinue:"Continuar el chat",historyLoading:"Cargando tus chats\u2026",historyTitle:"Historial de chats",loadMoreConversations:"Cargar m\xE1s conversaciones",language:"Idioma",launcherOpen:"Abrir el chat",launcherLabel:"Chatea con nosotros",micStart:"Iniciar entrada de voz",micStop:"Detener entrada de voz",micUnsupported:"Este navegador no admite la entrada de voz",moreActions:"M\xE1s acciones",newConversation:"Nuevo chat",panelTitle:"Chat",popOut:"Abrir en una pesta\xF1a nueva",resizeHandle:"Arrastra para cambiar el tama\xF1o",scrollToBottom:"Ir a lo m\xE1s reciente",send:"Enviar",queueMessage:"Poner mensaje en cola",removeQueuedMessage:"Quitar mensaje de la cola",compactingContext:"Optimizando el contexto de la conversaci\xF3n\u2026",soundOff:"Sonido desactivado",soundOn:"Sonido activado",startNewConversation:"Iniciar un chat nuevo",talkToOperator:"Hablar con un operador",connectingOperator:"Conect\xE1ndote con un operador\u2026",noOperatorAvailable:"Nadie est\xE1 disponible ahora \u2014 deja tus datos y te contactaremos.",chattingWithOperator:"Est\xE1s chateando con {operator}",cancelOperatorRequest:"Seguir con la IA",stop:"Detener",theme:"Tema",themeAuto:"Autom\xE1tico",themeDark:"Oscuro",themeLight:"Claro",textSize:"Tama\xF1o del texto",textSizeSmall:"Peque\xF1o",textSizeNormal:"Normal",textSizeLarge:"Grande",loading:"Cargando\u2026",visualPreparing:"Preparando visualizaci\xF3n\u2026",visualError:"No se pudo mostrar esta visualizaci\xF3n.",thinking:"Pensando\u2026",thoughts:"Razonamiento",toolResult:"Resultado",sources:"Fuentes",feedbackUp:"Buena respuesta",feedbackDown:"Mala respuesta",feedbackThanks:"Gracias por tu opini\xF3n",copy:"Copiar",copied:"Copiado",tabHome:"Inicio",tabConversations:"Chats",tabHelp:"Ayuda",tabNews:"Novedades",modulesEmpty:"A\xFAn no hay nada aqu\xED",moduleBack:"Atr\xE1s",contentLoading:"Cargando\u2026",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeContentTitle:"Art\xEDculos populares",homeStatus:"Estado",helpTitle:"Ayuda",helpSearchPlaceholder:"Buscar ayuda",helpEmpty:"A\xFAn no hay art\xEDculos de ayuda",helpLoading:"Cargando la ayuda\u2026",helpSearchEmpty:"No se encontraron resultados",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",formSubmit:"Enviar",formSkip:"Quiz\xE1 m\xE1s tarde",formSubmitted:"Completado",formSkipped:"Quiz\xE1 m\xE1s tarde",formFillOut:"Completar",formRequired:"Este campo es obligatorio",formInvalidEmail:"Introduce un correo electr\xF3nico v\xE1lido",formInvalidTel:"Introduce un n\xFAmero de tel\xE9fono v\xE1lido",formInvalidUrl:"Introduce una URL v\xE1lida",formInvalidNumber:"Introduce un n\xFAmero v\xE1lido",formTooShort:"Demasiado corto (m\xEDn. {min} caracteres)",formTooLong:"Demasiado largo (m\xE1x. {max} caracteres)",formNumberTooSmall:"Debe ser al menos {min}",formNumberTooLarge:"Debe ser como m\xE1ximo {max}",formPatternMismatch:"Respeta el formato solicitado",formChooseAtLeast:"Elige al menos {min}",formChooseAtMost:"Elige como m\xE1ximo {max}",formOther:"Otro",formOtherPlaceholder:"Escribe tu respuesta\u2026",inputRequired:"Preguntas para ti",inputBadge:"Preguntas",inputAnswered:"Respondido",inputSkipped:"Omitido",showOptions:"Mostrar opciones",hideOptions:"Ocultar opciones",qtypeText:"Tu respuesta",qtypeEmail:"Correo electr\xF3nico",qtypePhone:"N\xFAmero de tel\xE9fono",qtypeNumber:"N\xFAmero",qtypeDate:"Fecha",qtypeChooseOne:"Elige una",qtypeChooseAny:"Elige varias",qtypeBoolean:"S\xED / No",inputSubmit:"Enviar respuestas",inputSubmitHint:"Enter para enviar \xB7 May\xFAs+Enter = nueva l\xEDnea",inputSkip:"Omitir",confirmYes:"S\xED",confirmNo:"No",approve:"Aprobar",reject:"Rechazar",approvalPrompt:"{tool} requiere tu aprobaci\xF3n para ejecutarse.",approvalBody:"Revisa los par\xE1metros de arriba y decide si permites esta acci\xF3n.",approvalYourResponse:"Tu respuesta: {decision}",approvalEditHint:"Puedes cambiar tu respuesta hasta que este paso contin\xFAe.",approvalSubmitting:"Respuesta enviada. Procesando\u2026",edit:"Editar",toolParameters:"Par\xE1metros",statusAwaiting:"Esperando aprobaci\xF3n",statusResponded:"Enviado",statusRunning:"En curso",statusCompleted:"Completado",statusDenied:"Denegado",statusError:"Error",statusSuperseded:"Omitido"},x_={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",attachmentMimeRejected:"\u05E1\u05D5\u05D2 \u05D4\u05E7\u05D5\u05D1\u05E5 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA",attachmentTooLarge:"\u05D4\u05E7\u05D5\u05D1\u05E5 \u05D2\u05D3\u05D5\u05DC \u05DE\u05D3\u05D9",attachmentTooMany:"\u05D4\u05D2\u05E2\u05EA \u05DC\u05DE\u05E1\u05E4\u05E8 \u05D4\u05DE\u05E8\u05D1\u05D9 \u05E9\u05DC \u05E7\u05D1\u05E6\u05D9\u05DD \u05DE\u05E6\u05D5\u05E8\u05E4\u05D9\u05DD",conversationClosed:"\u05D4\u05E6\u05F3\u05D0\u05D8 \u05D4\u05D6\u05D4 \u05E0\u05E1\u05D2\u05E8",conversationLoading:"\u05D8\u05D5\u05E2\u05DF \u05E6\u05F3\u05D0\u05D8\u2026",loadPreviousMessages:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05D4\u05D5\u05D3\u05E2\u05D5\u05EA \u05E7\u05D5\u05D3\u05DE\u05D5\u05EA",close:"\u05E1\u05D2\u05D9\u05E8\u05D4",collapse:"\u05DB\u05D9\u05D5\u05D5\u05E5",collapseSidebar:"\u05DB\u05D9\u05D5\u05D5\u05E5 \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",composerPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D4\u05D5\u05D3\u05E2\u05D4\u2026",dateLastWeek:"7 \u05D4\u05D9\u05DE\u05D9\u05DD \u05D4\u05D0\u05D7\u05E8\u05D5\u05E0\u05D9\u05DD",dateOlder:"\u05D9\u05E9\u05DF \u05D9\u05D5\u05EA\u05E8",dateToday:"\u05D4\u05D9\u05D5\u05DD",dateYesterday:"\u05D0\u05EA\u05DE\u05D5\u05DC",dropZone:"\u05E9\u05D7\u05E8\u05E8 \u05E7\u05D1\u05E6\u05D9\u05DD \u05DB\u05D3\u05D9 \u05DC\u05E6\u05E8\u05E3",errorGeneric:"\u05DE\u05E9\u05D4\u05D5 \u05D4\u05E9\u05EA\u05D1\u05E9",errorRateLimited:"\u05D9\u05D5\u05EA\u05E8 \u05DE\u05D3\u05D9 \u05D1\u05E7\u05E9\u05D5\u05EA \u2014 \u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1 \u05D1\u05E2\u05D5\u05D3 \u05E8\u05D2\u05E2.",errorRetry:"\u05E0\u05E1\u05D4 \u05E9\u05D5\u05D1",expand:"\u05D4\u05E8\u05D7\u05D1\u05D4",expandSidebar:"\u05D4\u05E8\u05D7\u05D1\u05EA \u05E1\u05E8\u05D2\u05DC \u05D4\u05E6\u05D3",exitFullscreen:"\u05D9\u05E6\u05D9\u05D0\u05D4 \u05DE\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",fullscreen:"\u05DE\u05E1\u05DA \u05DE\u05DC\u05D0",history:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D4",historyBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05E6\u05F3\u05D0\u05D8",historyEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E7\u05D5\u05D3\u05DE\u05D9\u05DD",historyContinue:"\u05D4\u05DE\u05E9\u05DA \u05E6\u05F3\u05D0\u05D8",historyLoading:"\u05D8\u05D5\u05E2\u05DF \u05D0\u05EA \u05D4\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA\u2026",historyTitle:"\u05D4\u05D9\u05E1\u05D8\u05D5\u05E8\u05D9\u05D9\u05EA \u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",loadMoreConversations:"\u05D8\u05E2\u05D9\u05E0\u05EA \u05E9\u05D9\u05D7\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",language:"\u05E9\u05E4\u05D4",launcherOpen:"\u05E4\u05EA\u05D9\u05D7\u05EA \u05E6\u05F3\u05D0\u05D8",launcherLabel:"\u05D3\u05D1\u05E8\u05D5 \u05D0\u05D9\u05EA\u05E0\u05D5",micStart:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micStop:"\u05E2\u05E6\u05D9\u05E8\u05EA \u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9",micUnsupported:"\u05E7\u05DC\u05D8 \u05E7\u05D5\u05DC\u05D9 \u05D0\u05D9\u05E0\u05D5 \u05E0\u05EA\u05DE\u05DA \u05D1\u05D3\u05E4\u05D3\u05E4\u05DF \u05D6\u05D4",moreActions:"\u05E4\u05E2\u05D5\u05DC\u05D5\u05EA \u05E0\u05D5\u05E1\u05E4\u05D5\u05EA",newConversation:"\u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",panelTitle:"\u05E6\u05F3\u05D0\u05D8",popOut:"\u05E4\u05EA\u05D9\u05D7\u05D4 \u05D1\u05DB\u05E8\u05D8\u05D9\u05E1\u05D9\u05D9\u05D4 \u05D7\u05D3\u05E9\u05D4",resizeHandle:"\u05D2\u05E8\u05D5\u05E8 \u05DC\u05E9\u05D9\u05E0\u05D5\u05D9 \u05D4\u05D2\u05D5\u05D3\u05DC",scrollToBottom:"\u05DE\u05E2\u05D1\u05E8 \u05DC\u05D7\u05D3\u05E9 \u05D1\u05D9\u05D5\u05EA\u05E8",send:"\u05E9\u05DC\u05D9\u05D7\u05D4",queueMessage:"\u05D4\u05D5\u05E1\u05E4\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DC\u05EA\u05D5\u05E8",removeQueuedMessage:"\u05D4\u05E1\u05E8\u05EA \u05D4\u05D4\u05D5\u05D3\u05E2\u05D4 \u05DE\u05D4\u05EA\u05D5\u05E8",compactingContext:"\u05DE\u05D1\u05E6\u05E2 \u05D0\u05D5\u05E4\u05D8\u05D9\u05DE\u05D9\u05D6\u05E6\u05D9\u05D4 \u05DC\u05D4\u05E7\u05E9\u05E8 \u05D4\u05E9\u05D9\u05D7\u05D4\u2026",soundOff:"\u05D4\u05E9\u05EA\u05E7\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",soundOn:"\u05D4\u05E4\u05E2\u05DC\u05EA \u05D4\u05E6\u05DC\u05D9\u05DC",startNewConversation:"\u05D4\u05EA\u05D7\u05DC\u05EA \u05E6\u05F3\u05D0\u05D8 \u05D7\u05D3\u05E9",talkToOperator:"\u05D3\u05D1\u05E8 \u05E2\u05DD \u05E0\u05E6\u05D9\u05D2",connectingOperator:"\u05DE\u05D7\u05D1\u05E8 \u05D0\u05D5\u05EA\u05DA \u05DC\u05E0\u05E6\u05D9\u05D2\u2026",noOperatorAvailable:"\u05D0\u05D9\u05DF \u05E0\u05E6\u05D9\u05D2\u05D9\u05DD \u05D6\u05DE\u05D9\u05E0\u05D9\u05DD \u05DB\u05E2\u05EA \u2014 \u05D4\u05E9\u05D0\u05E8 \u05D0\u05EA \u05D4\u05E4\u05E8\u05D8\u05D9\u05DD \u05E9\u05DC\u05DA \u05D5\u05E0\u05D7\u05D6\u05D5\u05E8 \u05D0\u05DC\u05D9\u05DA.",chattingWithOperator:"\u05D0\u05EA\u05D4 \u05DE\u05E6\u05F3\u05D5\u05D8\u05D8 \u05E2\u05DD {operator}",cancelOperatorRequest:"\u05D4\u05DE\u05E9\u05DA \u05DC\u05E9\u05D5\u05D7\u05D7 \u05E2\u05DD \u05D4-AI",stop:"\u05E2\u05E6\u05D9\u05E8\u05D4",theme:"\u05E2\u05E8\u05DB\u05EA \u05E0\u05D5\u05E9\u05D0",themeAuto:"\u05D0\u05D5\u05D8\u05D5\u05DE\u05D8\u05D9",themeDark:"\u05DB\u05D4\u05D4",themeLight:"\u05D1\u05D4\u05D9\u05E8",textSize:"\u05D2\u05D5\u05D3\u05DC \u05D8\u05E7\u05E1\u05D8",textSizeSmall:"\u05E7\u05D8\u05DF",textSizeNormal:"\u05E8\u05D2\u05D9\u05DC",textSizeLarge:"\u05D2\u05D3\u05D5\u05DC",loading:"\u05D8\u05D5\u05E2\u05DF\u2026",visualPreparing:"\u05DE\u05DB\u05D9\u05DF \u05EA\u05E6\u05D5\u05D2\u05D4\u2026",visualError:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05EA\u05E6\u05D5\u05D2\u05D4 \u05D6\u05D5.",thinking:"\u05D7\u05D5\u05E9\u05D1\u2026",thoughts:"\u05DE\u05D7\u05E9\u05D1\u05D5\u05EA",toolResult:"\u05EA\u05D5\u05E6\u05D0\u05D4",sources:"\u05DE\u05E7\u05D5\u05E8\u05D5\u05EA",feedbackUp:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D8\u05D5\u05D1\u05D4",feedbackDown:"\u05EA\u05E9\u05D5\u05D1\u05D4 \u05D2\u05E8\u05D5\u05E2\u05D4",feedbackThanks:"\u05EA\u05D5\u05D3\u05D4 \u05E2\u05DC \u05D4\u05DE\u05E9\u05D5\u05D1",copy:"\u05D4\u05E2\u05EA\u05E7",copied:"\u05D4\u05D5\u05E2\u05EA\u05E7",tabHome:"\u05D1\u05D9\u05EA",tabConversations:"\u05E6\u05F3\u05D0\u05D8\u05D9\u05DD",tabHelp:"\u05E2\u05D6\u05E8\u05D4",tabNews:"\u05D7\u05D3\u05E9\u05D5\u05EA",modulesEmpty:"\u05D0\u05D9\u05DF \u05DB\u05D0\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DB\u05DC\u05D5\u05DD",moduleBack:"\u05D7\u05D6\u05E8\u05D4",contentLoading:"\u05D8\u05D5\u05E2\u05DF\u2026",homeGreeting:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeGreetingNamed:"\u05E9\u05DC\u05D5\u05DD {name} \u{1F44B}",homeGreetingLead:"\u05DB\u05D9\u05E6\u05D3 \u05E0\u05D5\u05DB\u05DC \u05DC\u05E2\u05D6\u05D5\u05E8?",homeSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",homeContentTitle:"\u05DE\u05D0\u05DE\u05E8\u05D9\u05DD \u05E4\u05D5\u05E4\u05D5\u05DC\u05E8\u05D9\u05D9\u05DD",homeStatus:"\u05E1\u05D8\u05D8\u05D5\u05E1",helpTitle:"\u05E2\u05D6\u05E8\u05D4",helpSearchPlaceholder:"\u05D7\u05D9\u05E4\u05D5\u05E9 \u05E2\u05D6\u05E8\u05D4",helpEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05DE\u05D0\u05DE\u05E8\u05D9 \u05E2\u05D6\u05E8\u05D4",helpLoading:"\u05D8\u05D5\u05E2\u05DF \u05E2\u05D6\u05E8\u05D4\u2026",helpSearchEmpty:"\u05DC\u05D0 \u05E0\u05DE\u05E6\u05D0\u05D5 \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA",newsTitle:"\u05D7\u05D3\u05E9\u05D5\u05EA",newsEmpty:"\u05D0\u05D9\u05DF \u05E2\u05D3\u05D9\u05D9\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA",newsLoading:"\u05D8\u05D5\u05E2\u05DF \u05D7\u05D3\u05E9\u05D5\u05EA\u2026",newsBack:"\u05D7\u05D6\u05E8\u05D4 \u05DC\u05D7\u05D3\u05E9\u05D5\u05EA",newsPublishedAt:"\u05E4\u05D5\u05E8\u05E1\u05DD \u05D1-{date}",formSubmit:"\u05E9\u05DC\u05D9\u05D7\u05D4",formSkip:"\u05D0\u05D7\u05E8 \u05DB\u05DA",formSubmitted:"\u05E0\u05E9\u05DC\u05D7",formSkipped:"\u05D3\u05D5\u05DC\u05D2",formFillOut:"\u05DE\u05D9\u05DC\u05D5\u05D9",formRequired:"\u05E9\u05D3\u05D4 \u05D7\u05D5\u05D1\u05D4",formInvalidEmail:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidTel:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF \u05EA\u05E7\u05D9\u05DF",formInvalidUrl:"\u05D4\u05D6\u05DF \u05DB\u05EA\u05D5\u05D1\u05EA URL \u05EA\u05E7\u05D9\u05E0\u05D4",formInvalidNumber:"\u05D4\u05D6\u05DF \u05DE\u05E1\u05E4\u05E8 \u05EA\u05E7\u05D9\u05DF",formTooShort:"\u05E7\u05E6\u05E8 \u05DE\u05D3\u05D9 (\u05DC\u05E4\u05D7\u05D5\u05EA {min} \u05EA\u05D5\u05D5\u05D9\u05DD)",formTooLong:"\u05D0\u05E8\u05D5\u05DA \u05DE\u05D3\u05D9 (\u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max} \u05EA\u05D5\u05D5\u05D9\u05DD)",formNumberTooSmall:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formNumberTooLarge:"\u05D7\u05D9\u05D9\u05D1 \u05DC\u05D4\u05D9\u05D5\u05EA \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formPatternMismatch:"\u05D4\u05EA\u05D0\u05DD \u05DC\u05EA\u05D1\u05E0\u05D9\u05EA \u05D4\u05E0\u05D3\u05E8\u05E9\u05EA",formChooseAtLeast:"\u05D1\u05D7\u05E8 \u05DC\u05E4\u05D7\u05D5\u05EA {min}",formChooseAtMost:"\u05D1\u05D7\u05E8 \u05DC\u05DB\u05DC \u05D4\u05D9\u05D5\u05EA\u05E8 {max}",formOther:"\u05D0\u05D7\u05E8",formOtherPlaceholder:"\u05DB\u05EA\u05D5\u05D1 \u05D0\u05EA \u05EA\u05E9\u05D5\u05D1\u05EA\u05DA\u2026",inputRequired:"\u05E9\u05D0\u05DC\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8\u05DA",inputBadge:"\u05E9\u05D0\u05DC\u05D5\u05EA",inputAnswered:"\u05E0\u05E2\u05E0\u05D4",inputSkipped:"\u05D3\u05D5\u05DC\u05D2",showOptions:"\u05D4\u05E6\u05D2 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",hideOptions:"\u05D4\u05E1\u05EA\u05E8 \u05D0\u05E4\u05E9\u05E8\u05D5\u05D9\u05D5\u05EA",qtypeText:"\u05D4\u05EA\u05E9\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA",qtypeEmail:"\u05DB\u05EA\u05D5\u05D1\u05EA \u05D0\u05D9\u05DE\u05D9\u05D9\u05DC",qtypePhone:"\u05DE\u05E1\u05E4\u05E8 \u05D8\u05DC\u05E4\u05D5\u05DF",qtypeNumber:"\u05DE\u05E1\u05E4\u05E8",qtypeDate:"\u05EA\u05D0\u05E8\u05D9\u05DA",qtypeChooseOne:"\u05D1\u05D7\u05E8 \u05D0\u05D7\u05EA",qtypeChooseAny:"\u05D1\u05D7\u05E8 \u05DB\u05DE\u05D4",qtypeBoolean:"\u05DB\u05DF / \u05DC\u05D0",inputSubmit:"\u05E9\u05DC\u05D9\u05D7\u05EA \u05EA\u05E9\u05D5\u05D1\u05D5\u05EA",inputSubmitHint:"Enter \u05DC\u05E9\u05DC\u05D9\u05D7\u05D4 \xB7 Shift+Enter = \u05E9\u05D5\u05E8\u05D4 \u05D7\u05D3\u05E9\u05D4",inputSkip:"\u05D3\u05D9\u05DC\u05D5\u05D2",confirmYes:"\u05DB\u05DF",confirmNo:"\u05DC\u05D0",approve:"\u05D0\u05D9\u05E9\u05D5\u05E8",reject:"\u05D3\u05D7\u05D9\u05D9\u05D4",approvalPrompt:"\u05D4\u05DB\u05DC\u05D9 {tool} \u05D3\u05D5\u05E8\u05E9 \u05D0\u05EA \u05D0\u05D9\u05E9\u05D5\u05E8\u05DA \u05DB\u05D3\u05D9 \u05DC\u05E4\u05E2\u05D5\u05DC.",approvalBody:"\u05D1\u05D3\u05D5\u05E7 \u05D0\u05EA \u05E4\u05E8\u05DE\u05D8\u05E8\u05D9 \u05D4\u05DB\u05DC\u05D9 \u05E9\u05DC\u05DE\u05E2\u05DC\u05D4 \u05D5\u05D4\u05D7\u05DC\u05D8 \u05D0\u05DD \u05DC\u05D0\u05E9\u05E8 \u05E4\u05E2\u05D5\u05DC\u05D4 \u05D6\u05D5.",approvalYourResponse:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E9\u05DC\u05DA: {decision}",approvalEditHint:"\u05E0\u05D9\u05EA\u05DF \u05DC\u05E2\u05E8\u05D5\u05DA \u05D0\u05EA \u05EA\u05D2\u05D5\u05D1\u05EA\u05DA \u05E2\u05D3 \u05E9\u05D4\u05E9\u05DC\u05D1 \u05D4\u05D6\u05D4 \u05D9\u05EA\u05D7\u05D3\u05E9.",approvalSubmitting:"\u05D4\u05EA\u05D2\u05D5\u05D1\u05D4 \u05E0\u05E9\u05DC\u05D7\u05D4. \u05DE\u05D1\u05E6\u05E2\u2026",edit:"\u05E2\u05E8\u05D9\u05DB\u05D4",toolParameters:"\u05E4\u05E8\u05DE\u05D8\u05E8\u05D9\u05DD",statusAwaiting:"\u05DE\u05DE\u05EA\u05D9\u05DF \u05DC\u05D0\u05D9\u05E9\u05D5\u05E8",statusResponded:"\u05E0\u05E9\u05DC\u05D7",statusRunning:"\u05E4\u05D5\u05E2\u05DC",statusCompleted:"\u05D4\u05D5\u05E9\u05DC\u05DD",statusDenied:"\u05E0\u05D3\u05D7\u05D4",statusError:"\u05E9\u05D2\u05D9\u05D0\u05D4",statusSuperseded:"\u05D3\u05D5\u05DC\u05D2"},S_={en:ao,fr:b_,ar:y_,es:P_,he:x_};function io(e,t){let n=Qs(e),r=so(t),o=n==="en"?{}:S_[n]??{},i=r?t[n]??{}:t??{},a=r?t.en??{}:{};return{...ao,...o,...a,...i}}function Qs(e){return(e.split("-")[0]??"en").toLowerCase()}var k_=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function Ys(e){return k_.has(Qs(e))}function _t(e,t){return e[t]??t}function so(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}function Xs(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function Js(e,t){let{translations:n,defaultLocale:r,...o}=e,i=Xs(n,t);return i?{...o,title:i.title??o.title,description:i.description??o.description,content:i.content??o.content}:o}function Zs(e,t){let{translations:n,defaultLocale:r,...o}=e,i=Xs(n,t);if(!i)return o;let a=new Map((i.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let u=a.get(c.name);if(!u)return c;let d=new Map((u.options??[]).map(_=>[_.value,_]));return{...c,label:u.label??c.label,placeholder:u.placeholder??c.placeholder,validationHint:u.validationHint??c.validationHint,options:c.options?.map(_=>{let p=d.get(_.value);return p?{..._,label:p.label??_.label,description:p.description??_.description}:_})}});return{...o,title:i.title??o.title,description:i.description??o.description,submitLabel:i.submitLabel??o.submitLabel,fields:s}}var Qa=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{}}},lo=new Qa;var Ja=["off","error","warn","info","debug","trace"],Za=T.cssPrefix,el=`${Za}.debug`,w_=`__${T.global}_DEBUG__`,C_=`${Za}-debug`,co=2,Ya=null;function R_(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(C_);if(e!==null){let t=Xa(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(el);if(e){let t=Xa(e);if(t>=0)return t}}catch{}return Reflect.get(window,w_)?4:2}function Xa(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=Ja.findIndex(n=>n===e);if(t>=0)return t}return-1}function uo(e){let t=Xa(e);if(!(t<0)){co=t;try{window.localStorage?.setItem(el,Ja[t]??"off")}catch{}}}function ei(){return Ja[co]??"warn"}co=R_();function tl(e){let t=`[${Za}:${e}]`;function n(r,o,i){return(a,s)=>{if(!(co<r)&&(s===void 0?console[o](t,a):console[o](t,a,s),Ya))try{Ya({level:i,scope:e,message:a,payload:s})}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:r=>tl(`${e}:${r}`)}}var le=tl("core");function nl(e){Ya=e}var cn=le.scope("context"),I_=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),rl=50,ti=1024,T_=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function ni(e){return ol(e,"userContext",!0)}function ri(e){return ol(e,"pageContext",!1)}function ol(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){cn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[i,a]of Object.entries(e)){if(I_.has(i)){cn.warn(`dropped reserved ${t} key "${i}" \u2014 managed by the widget, not host-settable`);continue}if(a==null)continue;if(o>=rl){cn.warn(`${t} truncated at ${rl} keys \u2014 dropped "${i}"`);continue}let s=A_(t,i,a);s!==void 0&&(r[i]=s,o++)}return n&&typeof r.email=="string"&&!T_.test(r.email)&&(cn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function A_(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){cn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>ti?(cn.warn(`truncated ${e}.${t} to ${ti} chars`),r.slice(0,ti)):r}cn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}var po={maxBytes:10485760,maxCount:10,accept:"*/*"},al={voice:"local"},il={list:[],byTrigger:{}},oi={enabled:!0,sampleRate:1},_o={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Mn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},sl={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"]},ai={enabled:!0,volume:.3,events:void 0},ll={enabled:!0,events:void 0},cl=[{label:"tabConversations",layout:"chat"}];function Ln(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},i=t.feedback??{},a=t.footer??{},s=t.header??{},{themeMode:c,themeOverrides:u}=E_(t.theme),d=n.mode??"floating",_=M_(o.defaultLocale),p=o.availableLocales??[o.locale??_],f=On(o.locale??_,p,_),m=(t.baseUrl??T.defaultBaseUrl).replace(/\/$/,""),g=(t.agentApiBaseUrl??`${m}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${m}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:m,agentApiBaseUrl:g,dataApiBaseUrl:P,userContext:ni(t.userContext),pageContext:ri(t.pageContext),position:n.position??"bottom-right",themeMode:c,textSize:"normal",themeOverrides:u,mode:d,iframe:n.iframe??!1,responseMode:r.responseMode??"streaming",showReasoning:r.showReasoning??!1,showToolCalls:r.showToolCalls??!1,showSources:r.showSources??!1,enableMessageFeedback:!(r.disableMessageFeedback??!1),autoSendSuggestions:r.autoSendSuggestions??!1,popOutUrl:r.popOutUrl,features:{voice:t.features?.voice??al.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:ir(t.forms,f),endpoints:{upload:t.endpoints?.upload??_o.upload,transcribe:t.endpoints?.transcribe??_o.transcribe,submitForm:t.endpoints?.submitForm??_o.submitForm},attachments:{accept:t.composer?.attachments?.accept??po.accept,maxBytes:t.composer?.attachments?.maxBytes??po.maxBytes,maxCount:t.composer?.attachments?.maxCount??po.maxCount},locale:f,defaultLocale:_,availableLocales:p,startMinimized:r.startMinimized??!0,actions:L_(d,s.actions),size:n.size??{},launcher:z_(t.launcher),sound:O_(i.sound),haptics:N_(i.haptics),strings:io(f,o.strings),stringsOverride:o.strings,composerDisclaimer:a.composerDisclaimer??"",poweredBy:D_(a.poweredBy),composer:B_(t.composer),modules:F_(t.modules),tracking:$_(t.tracking,P),storage:t.storage??lo,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function E_(e){return typeof e=="string"?{themeMode:e,themeOverrides:{}}:e&&typeof e=="object"?{themeMode:"auto",themeOverrides:e}:{themeMode:"auto",themeOverrides:{}}}function M_(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function On(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function L_(e,t){return t??sl[e]}function O_(e){return{enabled:e?.enabled??ai.enabled,volume:e?.volume??ai.volume,events:e?.events}}function N_(e){return{enabled:e?.enabled??ll.enabled,events:e?.events}}function $_(e,t){let n=e?.sampleRate??oi.sampleRate;return{enabled:e?.enabled??oi.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 D_(e){let n={...{text:`Powered by ${T.displayName}`,href:T.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function B_(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function F_(e){let t=e??cl,n=new Set,r=[];for(let i of t.slice(0,4)){if(!i?.label||!i?.layout)continue;let a=i.contentTags?.filter(Boolean),s=i.id??a?.[0]??i.layout;for(;n.has(s);)s=`${s}-${r.length}`;n.add(s);let c={id:s,label:i.label,layout:i.layout};a?.length&&(c.contentTags=a),i.layout==="home"&&(c.brandName=i.brandName,c.greetingText=i.greetingText,c.showGreeting=!(i.hideGreeting??!1),c.showSearchBar=!(i.hideSearchBar??!1),c.showRecentConversations=!(i.hideRecentConversations??!1),i.userAvatars?.length&&(c.userAvatars=i.userAvatars),i.status&&(c.status=i.status),c.contentBlockTitle=i.contentBlockTitle),r.push(c)}let o=Object.fromEntries(r.map(i=>[i.id,i]));return{list:r,byId:o}}function ir(e,t){var i;if(!e?.length)return il;let n=[],r=new Set;for(let a of e){if(!a?.id||r.has(a.id))continue;let s=Zs(a,t),c=(s.fields??[]).filter(d=>!!(d?.name&&d.label&&d.type)),u=(Array.isArray(s.on)?s.on:[s.on]).map(U_).filter(d=>d!==null);c.length===0||u.length===0||(r.add(s.id),n.push({id:s.id,triggers:u,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let a of n)for(let s of a.triggers)(o[i=s.kind]??(o[i]=[])).push(a);return{list:n,byTrigger:o}}function U_(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 r=Number(n);return Number.isFinite(r)&&r>0?{kind:"after-messages",param:r}:null}if(t==="idle"){let r=Number(n);return Number.isFinite(r)&&r>0?{kind:"idle",param:r}:null}return t==="page-area"&&n?{kind:"page-area",param:n}:null}function z_(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??Mn.variant,size:e?.size??Mn.size,label:e?.label??Mn.label,icon:e?.icon??Mn.icon,hidden:e?.hidden??Mn.hidden,callout:t}}function ii(e,t,n,r){let o=On(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let i={...e};return o!==e.locale&&(i.locale=o,i.strings=io(o,e.stringsOverride)),n!==e.themeMode&&(i.themeMode=n),r!==e.textSize&&(i.textSize=r),i}var q_=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints"];function si(e,t){if(!t)return e;let n={...e};for(let i of q_){let a=t[i];if(a===void 0)continue;let s=e[i];if(i==="theme"){s===void 0&&(n[i]=a);continue}i!=="i18n"&&(n[i]=dl(a,s))}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 r=e.i18n,o=t.i18n;if(r||o){let i=dl(o??{},r);o?.availableLocales!==void 0&&(i.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(i.defaultLocale=o.defaultLocale);let a=r?.strings,s=o?.strings;(a||s)&&(i.strings=H_(s,a)),n.i18n=i}return n}function dl(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o!==void 0&&(n[r]=o);return n}function H_(e,t){if(!e)return t;if(!t)return e;let n=so(e),r=so(t);if(!n&&!r)return{...e,...t};let o={},i=n?e:{en:e},a=r?t:{en:t};for(let[s,c]of Object.entries(i))o[s]={...c};for(let[s,c]of Object.entries(a))o[s]={...o[s],...c};return o}var V_=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function Bt(e){return e!=="false"}var j_=[["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]],W_=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",Bt]],G_=[["width","width"],["height","height"]],K_=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",Bt],["show-reasoning","showReasoning",Bt],["show-tool-calls","showToolCalls",Bt],["show-sources","showSources",Bt],["disable-message-feedback","disableMessageFeedback",Bt],["auto-send-suggestions","autoSendSuggestions",Bt],["pop-out-url","popOutUrl"]],Q_=[["locale","locale"]],pb=new Set(V_);var Y_=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",Bt]],X_=[["features-disable-file-upload","disableFileUpload",Bt],["features-voice","voice",e=>e]],J_=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],Z_=[["user-id","id"],["user-email","email"],["user-name","name"]],ef=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],tf=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],nf=[j_,W_,G_,K_,Q_,Y_,X_,J_,Z_,ef],rf=new Set(["iframe","start-minimized"]),of=[...nf.flatMap(e=>e.map(([t])=>t).filter(t=>!rf.has(t))),...tf];function ul(e){return`${T.cssPrefix}:${e}`}function sr(e,t,n){e.dispatchEvent(new CustomEvent(ul(t),{detail:n}))}function pl(e,t){let r=Object.entries(t).map(([o,i])=>{let a=ul(o);function s(c){return i(c.detail)}return e.addEventListener(a,s),[a,s]});return()=>{for(let[o,i]of r)e.removeEventListener(o,i)}}function vt(){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,af(t.subarray(6)),t[6]=t[6]&15|112,t[8]=t[8]&63|128;let n=Array.from(t,r=>r.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 af(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 Jt=le.scope("persistence");function Nn(e,t=lo,n){let r=n?`${e}.${n}`:e,o=`${T.cssPrefix}.storageVersion`,i=t.get(o)??void 0,a=i?`.v${i}`:"",s=`${T.cssPrefix}.${r}${a}`,c=`${T.cssPrefix}${a}.visitorId`,u=`${s}.conversationId`,d=`${s}.userPrefs`,_=`${s}.panelOpen`,p=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,g=`${s}.activeModule`,P=`${s}.historyCount`,k=`${s}.formsDone`,S={getVisitorId(){let h=t.get(c);if(h)return h;let b=vt();return t.set(c,b),b},loadConversationId(){return t.get(u)??void 0},saveConversationId(h){Jt.trace("saveConversationId",{id:h,scope:r}),h?t.set(u,h):t.remove(u)},loadDraft(h){return t.get(`${s}.draft.${h}`)??""},saveDraft(h,b){let y=`${s}.draft.${h}`;b?t.set(y,b):t.remove(y)},loadMessageQueue(h){let b=t.get(`${s}.messageQueue.${h}`);if(!b)return[];try{let y=JSON.parse(b);return!Array.isArray(y)||!y.every(sf)?[]:y}catch(y){return Jt.warn("loadMessageQueue parse failed",{error:y}),[]}},saveMessageQueue(h,b){let y=`${s}.messageQueue.${h}`;if(b.length===0){t.remove(y);return}try{t.set(y,JSON.stringify(b))}catch(C){Jt.warn("saveMessageQueue serialise failed",{error:C})}},loadUserPrefs(){let h=t.get(d);if(!h)return{};try{return li(JSON.parse(h))}catch(b){return Jt.warn("loadUserPrefs parse failed",{error:b}),{}}},saveUserPrefs(h){try{t.set(d,JSON.stringify(h))}catch(b){Jt.warn("saveUserPrefs serialise failed",{error:b})}},patchUserPrefs(h){let b=S.loadUserPrefs();S.saveUserPrefs({...b,...h})},loadPanelOpen(){let h=t.get(_);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(_,h?"1":"0")},loadPanelSize(){let h=t.get(p);return h==="normal"||h==="expanded"||h==="fullscreen"?h:null},savePanelSize(h){t.set(p,h)},loadCalloutDismissed(h){if(!h)return!1;let b=t.get(f);return!!b&&b===h},saveCalloutDismissed(h){h?t.set(f,h):t.remove(f)},loadSidebarCollapsed(){let h=t.get(m);return h==="1"?!0:h==="0"?!1:null},saveSidebarCollapsed(h){t.set(m,h?"1":"0")},loadActiveModule(){return t.get(g)||null},saveActiveModule(h){t.set(g,h)},loadHistoryCount(){let h=t.get(P);if(!h)return null;let b=Number.parseInt(h,10);return Number.isFinite(b)&&b>=0?b:null},saveHistoryCount(h){t.set(P,String(h))},loadFormsDone(){let h=t.get(k);if(!h)return{};try{let b=JSON.parse(h);return fo(b)?Object.fromEntries(Object.entries(b).filter(y=>typeof y[1]=="number")):{}}catch(b){return Jt.warn("loadFormsDone parse failed",{error:b}),{}}},saveFormDone(h){try{let b=S.loadFormsDone();b[h]=Date.now(),t.set(k,JSON.stringify(b))}catch(b){Jt.warn("saveFormDone serialise failed",{error:b})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(Jt.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(o,h))},clearConversation(){t.remove(u)}};return S}function fo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function sf(e){return fo(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function li(e){if(!fo(e))return{};let t={};return typeof e.locale=="string"&&(t.locale=e.locale),typeof e.soundMuted=="boolean"&&(t.soundMuted=e.soundMuted),(e.themeMode==="auto"||e.themeMode==="light"||e.themeMode==="dark")&&(t.themeMode=e.themeMode),(e.textSize==="small"||e.textSize==="normal"||e.textSize==="large")&&(t.textSize=e.textSize),fo(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var _l=`.__P__-generative-ui{display:grid;gap:var(--__P__-space-3);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-generative-ui p{margin:0}.__P__-generative-ui section{display:grid;gap:var(--__P__-space-2);padding:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);min-width:0}.__P__-generative-ui-metric{font-size:1.6em;font-weight:700}.__P__-generative-ui-table{overflow-x:auto}.__P__-generative-ui table{width:100%;border-collapse:collapse;white-space:normal}.__P__-generative-ui caption{text-align:start;font-weight:600;padding-bottom:var(--__P__-space-2)}.__P__-generative-ui th,.__P__-generative-ui td{text-align:start;padding:var(--__P__-space-2);border-bottom:1px solid var(--__P__-border)}.__P__-generative-ui-chart{display:block;width:100%;color:var(--__P__-accent)}.__P__-generative-ui-axis{stroke:var(--__P__-border)}.__P__-generative-ui-data{display:flex;flex-wrap:wrap;gap:var(--__P__-space-2);font-size:.85em}
|
|
2
|
+
`;var fl=`: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__-accent-fg: var(--__P__-accent);--__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__-pill-l-min: .3;--__P__-pill-l-max: .46;--__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__-conversation-max: 768px;--__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-mode="modal"]),:host([data-mode="drawer"]){--__P__-conversation-max: 100%}: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);--__P__-pill-l-min: .75;--__P__-pill-l-max: .92;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__-pill-l-min: .75;--__P__-pill-l-max: .92;--__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);--__P__-accent-fg: oklch(from var(--__P__-accent-user) clamp(.3, l, .46) c h)}:host([data-theme="dark"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}@media(prefers-color-scheme:dark){:host([data-theme="auto"]){--__P__-accent: oklch(from var(--__P__-accent-user) clamp(.65, l, .85) c h);--__P__-accent-fg: var(--__P__-accent)}}}@media(prefers-reduced-motion:reduce){:host{--__P__-dur-quick: 1ms;--__P__-dur-base: 1ms;--__P__-dur-slow: 1ms}}
|
|
3
|
+
`;var ml=`*,*: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-fg);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}
|
|
4
|
+
`;var gl=`.__P__-anchor{color-scheme:var(--__P__-color-scheme, light);right:16px;bottom:16px}.__P__-surface{display:contents}.__P__-surface[hidden]{display:none}: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-fg);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;overscroll-behavior:none;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:var(--__P__-visual-viewport-top, 0px) 0 auto;height:var(--__P__-visual-viewport-height, 100dvh);padding:0;justify-content:flex-end;align-items:flex-end}:host([data-mode="fullscreen"][data-position*="top"]) .__P__-anchor{justify-content:flex-start}:host([data-mode="fullscreen"][data-position*="left"]) .__P__-anchor{align-items:flex-start}:host([data-mode="fullscreen"]) .__P__-panel{width:100vw;height:100%;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:var(--__P__-visual-viewport-top, 0px) 0 auto;align-items:stretch;height:var(--__P__-visual-viewport-height, 100dvh);padding:0}:host([data-mode="open"]) .__P__-panel,:host([data-mode="expanded"]) .__P__-panel{width:100vw;height:100%;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-inline-start: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-fg);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-fg);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__-toolui-code,.__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__-toolui-code::-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__-toolui-code::-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;inset-inline-end: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__-list--fade{--__P__-fade-size: 20px;--__P__-fade-top: 0px;--__P__-fade-bottom: 0px;-webkit-mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%);mask-image:linear-gradient(to bottom,transparent 0,#000 var(--__P__-fade-top),#000 calc(100% - var(--__P__-fade-bottom)),transparent 100%)}.__P__-list--fade[data-fade-top=true]{--__P__-fade-top: var(--__P__-fade-size)}.__P__-list--fade[data-fade-bottom=true]{--__P__-fade-bottom: var(--__P__-fade-size)}.__P__-list>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-load-previous,.__P__-history-more{display:flex;justify-content:center}.__P__-load-previous button,.__P__-history-more button{border:0;padding:4px 8px;background:transparent;color:var(--__P__-accent);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;cursor:pointer}.__P__-load-previous button:hover,.__P__-history-more button:hover{text-decoration:underline}.__P__-load-previous button:focus-visible,.__P__-history-more button:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-load-previous button:disabled,.__P__-history-more button:disabled{cursor:wait;opacity:.6}.__P__-date-divider{display:flex;justify-content:center;margin-block:var(--__P__-space-3)}.__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)}.__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%;min-width:0;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:break-word;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-end-end-radius:5px}.__P__-bubble-row[data-role=assistant] .__P__-bubble{background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border:1px solid var(--__P__-border);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble{display:flex;align-items:stretch;padding:0;overflow:hidden;background:var(--__P__-bubble-assistant);color:var(--__P__-bubble-assistant-text);border-end-start-radius:5px}.__P__-bubble-row[data-role=operator] .__P__-bubble-col{align-items:flex-start}.__P__-bubble-author{display:flex;flex:0 0 auto;align-items:center;padding:0 .875rem;border-inline-end:1px solid color-mix(in oklab,var(--__P__-accent),transparent 60%);color:var(--__P__-accent);font-size:calc(13px * var(--__P__-text-scale));font-weight:600;letter-spacing:.025em;user-select:none}.__P__-bubble-row[data-role=operator] .__P__-bubble-body{flex:1 1 auto;min-width:0;padding:var(--__P__-space-3) var(--__P__-space-4)}.__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-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui){width:100%}.__P__-bubble-row[data-role=assistant] .__P__-bubble-col:has(.__P__-toolui) .__P__-bubble{width:100%}@media(max-width:640px){.__P__-bubble-col{max-width:92%}.__P__-toolui:not(.__P__-toolui-collapsible){padding:var(--__P__-space-3);gap:var(--__P__-space-2)}details.__P__-toolui-collapsible>summary{padding:var(--__P__-space-2) var(--__P__-space-3)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-3)}.__P__-toolui-section,.__P__-toolui-desc{padding:var(--__P__-space-2) var(--__P__-space-3)}}.__P__-bubble-meta{display:flex;align-items:center;gap:8px;margin-top:2px;padding:0 2px;min-height:24px}.__P__-bubble-actions{display:flex;align-items:center;gap:2px}.__P__-bubble-time{font-size:calc(11px * var(--__P__-text-scale));line-height:1;color:var(--__P__-fg-muted);user-select:none}.__P__-feedback{display:flex;align-items:center;gap:2px}.__P__-msg-action{display:inline-flex;align-items:center;justify-content:center;width:24px;height:24px;border:0;border-radius:var(--__P__-radius-sm);background:transparent;color:var(--__P__-fg-muted);cursor:pointer;opacity:.65;transition:opacity var(--__P__-dur-quick) var(--__P__-ease),background var(--__P__-dur-quick) var(--__P__-ease),color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-msg-action:hover{opacity:1;background:var(--__P__-bg-elevated);color:var(--__P__-fg)}.__P__-msg-action:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;opacity:1}.__P__-msg-action[data-active=true]{opacity:1;color:var(--__P__-accent-fg)}.__P__-msg-action svg{width:15px;height:15px}.__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-inline-start:1.5em;margin:10px 0}.__P__-md ul{list-style:disc}.__P__-md ol{list-style:decimal}.__P__-md li{margin:6px 0;padding-inline-start: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-inline-start:3px solid color-mix(in srgb,var(--__P__-accent) 50%,transparent);background:color-mix(in srgb,var(--__P__-accent) 5%,transparent);border-start-end-radius:var(--__P__-radius-sm);border-end-end-radius:var(--__P__-radius-sm);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:start}.__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-inline-start:var(--__P__-space-3);border-inline-start: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-inline-end: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__-source{display:inline-flex;align-items:center;gap:6px;max-width:100%;margin-top:6px;margin-inline-end:6px;padding:var(--__P__-space-1) var(--__P__-space-2);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);text-decoration:none}a.__P__-source:hover{color:var(--__P__-fg);border-color:var(--__P__-accent)}.__P__-source-label{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__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>*{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-compaction-status{width:100%;padding:10px 14px;justify-content:center;font-size:var(--__P__-text-xs)}.__P__-message-queue{display:flex;max-height:112px;flex-direction:column;gap:var(--__P__-space-1);overflow-y:auto}.__P__-attachment-chip.__P__-queued-message{width:100%;max-width:none}.__P__-queued-text{min-width:0;flex:1}.__P__-composer-row{display:flex;align-items:flex-end;gap:6px}.__P__-textarea{flex:1;--__P__-textarea-base-height: 40px;height:var(--__P__-textarea-base-height);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)}.__P__-textarea:focus-visible{outline:none;border-color:var(--__P__-focus)}@media(pointer:coarse){.__P__-textarea{--__P__-textarea-base-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-fg);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-fg)}.__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-fg);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 12px;border-radius:var(--__P__-radius-sm);background:color-mix(in oklab,var(--__P__-danger) 8%,var(--__P__-bg-elevated));border:1px solid color-mix(in oklab,var(--__P__-danger) 20%,transparent);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);display:flex;align-items:center;gap:var(--__P__-space-2)}.__P__-error span{min-width:0}.__P__-error button{margin-inline-start:auto;flex-shrink:0;border:0;background:none;padding:0;color:var(--__P__-accent-fg);font:inherit;font-size:var(--__P__-text-sm);font-weight:600;text-decoration:underline;white-space:nowrap;cursor:pointer}.__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-card>[role=listitem]{display:flex;flex-direction:column}.__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-card>*+*{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-fg)}.__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-item-skeleton{cursor:default;pointer-events:none}.__P__-skeleton{display:block;border-radius:4px;background:linear-gradient(90deg,color-mix(in oklab,var(--__P__-fg) 9%,transparent) 30%,color-mix(in oklab,var(--__P__-fg) 17%,transparent),color-mix(in oklab,var(--__P__-fg) 9%,transparent) 70%);background-size:200% 100%;animation:__P__-skeleton-shimmer 1.8s ease-in-out infinite}.__P__-history-avatar.__P__-skeleton{border-radius:50%}.__P__-skeleton-heading{width:52px;height:8px}.__P__-skeleton-title{width:55%;height:12px}.__P__-skeleton-time{width:34px;height:10px}.__P__-skeleton-preview{width:80%;height:10px}@keyframes __P__-skeleton-shimmer{0%{background-position:200% 0}to{background-position:-200% 0}}@media(prefers-reduced-motion:reduce){.__P__-skeleton{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__-operator-banner{display:flex;align-items:center;justify-content:center;gap:8px;margin:0 var(--__P__-space-3) var(--__P__-space-1);padding:8px 12px;border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg-elevated),var(--__P__-accent) 6%);color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm);line-height:1.3;text-align:center}.__P__-operator-pulse{flex:0 0 auto;width:8px;height:8px;border-radius:50%;background:var(--__P__-accent)}.__P__-operator-banner[data-mode=awaiting-operator] .__P__-operator-pulse{animation:__P__-operator-pulse 1.4s var(--__P__-ease-out) infinite}.__P__-cancel-operator-request{flex:0 0 auto;padding:0;border:0;background:none;color:var(--__P__-accent);font:inherit;font-weight:600;text-decoration:underline;text-underline-offset:2px;cursor:pointer}.__P__-cancel-operator-request:hover{opacity:.8}.__P__-cancel-operator-request:focus-visible{outline:2px solid var(--__P__-accent);outline-offset:2px;border-radius:var(--__P__-radius-sm)}@keyframes __P__-operator-pulse{0%,to{opacity:1;transform:scale(1)}50%{opacity:.4;transform:scale(.7)}}.__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%;inset-inline-end: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-fg)}.__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-fg);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,.__P__-messenger-pane{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}.__P__-messenger-pane[hidden]{display:none}@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__-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-fg)}.__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:-2px;left:calc(50% + 6px);width:8px;height:8px;border-radius:50%;background:var(--__P__-accent);box-shadow:0 0 0 2px var(--__P__-bg-elevated)}.__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-inline-start:-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-inline-start: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:start;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-fg)}.__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-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:start}.__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{outline:2px solid var(--__P__-focus);outline-offset:2px}.__P__-home-search[data-input=true]:focus-within{outline:none;border-color:var(--__P__-focus)}.__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-input:focus-visible{outline:none}.__P__-home-search-icon svg{width:18px;height:18px;color:var(--__P__-accent-fg)}.__P__-list-row{display:flex;align-items:center;gap:var(--__P__-space-3);width:100%;min-height:44px;text-align:start;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-fg);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__-history>*,.__P__-home-scroll>*,.__P__-module-scroll>*,.__P__-help-list>*,.__P__-history-footer>*,.__P__-module-pad{width:100%;max-width:var(--__P__-conversation-max, 768px);margin-inline:auto}.__P__-header,.__P__-back-header{padding-inline:max(12px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__P__-tabbar{padding-inline:max(0px,calc((100% - var(--__P__-conversation-max, 768px)) / 2))}.__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:start;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-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;inset-inline-end: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-head{display:flex;flex-wrap:wrap;align-items:baseline;gap:var(--__P__-space-2)}.__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-type{flex-shrink:0;align-self:center;margin-inline-start:auto;border:1px solid var(--__P__-border);border-radius:5px;background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);padding:1px 7px;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);white-space:nowrap}.__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__-textarea,.__P__-home-search-input,.__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;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}.__P__-form-hint{flex:1 1 auto;min-width:6rem;margin-inline-end:auto;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted)}.__P__-form-submit{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);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:filter var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-submit:hover:not(:disabled){filter:brightness(1.06)}.__P__-form-submit:disabled{opacity:.6;cursor:default}.__P__-form-skip{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);white-space:nowrap;flex-shrink:0;cursor:pointer;transition:background var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-form-skip:hover:not(:disabled){background:var(--__P__-bg-elevated)}@media(max-width:640px){.__P__-form-hint{flex-basis:100%;margin-inline-end:0;font-size:var(--__P__-text-xs)}.__P__-form-submit,.__P__-form-skip{flex:1 1 0;text-align:center}}.__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-fg)}.__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:start}.__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__-toolui{margin-block:var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-lg, 14px);background:var(--__P__-bg-elevated);font-size:var(--__P__-text-sm)}.__P__-toolui:not(.__P__-toolui-collapsible){display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-group{display:flex;flex-direction:column;gap:var(--__P__-space-3);margin-block:var(--__P__-space-3)}.__P__-toolui-group>.__P__-toolui{margin-block:0}.__P__-toolui-stale{opacity:.7}details.__P__-toolui-collapsible>summary{display:flex;align-items:center;gap:var(--__P__-space-2);padding:var(--__P__-space-3) var(--__P__-space-4);cursor:pointer;list-style:none;-webkit-tap-highlight-color:transparent;user-select:none}details.__P__-toolui-collapsible>summary::-webkit-details-marker{display:none}details.__P__-toolui-collapsible[open]>summary{border-bottom:1px solid var(--__P__-border)}details.__P__-toolui-collapsible>.__P__-toolui-section{margin:var(--__P__-space-4)}details.__P__-toolui-collapsible>.__P__-toolui-section~.__P__-toolui-section{margin-top:calc(-1 * var(--__P__-space-2))}.__P__-toolui-name-text{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-toolui-chevron{display:inline-flex;color:var(--__P__-fg-muted);transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}details.__P__-toolui-collapsible>summary .__P__-toolui-status{margin-inline-start:auto}.__P__-toolui-chevron svg{width:16px;height:16px}details.__P__-toolui-collapsible[open]>summary .__P__-toolui-chevron{transform:rotate(180deg)}.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{--__P__-pill: var(--__P__-fg-muted);display:inline-flex;min-width:0;align-items:center;gap:5px;padding:3px 7px;border-radius:5px;border:1px solid var(--__P__-border);background:color-mix(in oklab,var(--__P__-fg-muted) 9%,transparent);color:var(--__P__-pill);font-size:var(--__P__-text-xs);font-weight:600;white-space:nowrap}.__P__-toolui-badge svg,.__P__-toolui-name-pill svg,.__P__-toolui-q-pill svg{flex-shrink:0;width:14px;height:14px}.__P__-toolui-status-icon{display:inline-flex}.__P__-toolui-name-pill{--__P__-pill: oklch(.68 .13 233)}.__P__-toolui-q-pill{--__P__-pill: oklch(.66 .12 195)}.__P__-toolui-status[data-status=completed]{--__P__-pill: var(--__P__-success, #16a34a)}.__P__-toolui-status[data-status=responded]{--__P__-pill: oklch(.62 .15 255)}.__P__-toolui-status[data-status=awaiting]{--__P__-pill: var(--__P__-warning, #f59e0b)}.__P__-toolui-status[data-status=denied]{--__P__-pill: oklch(.66 .16 45)}.__P__-toolui-status[data-status=error]{--__P__-pill: var(--__P__-danger, #dc2626)}.__P__-toolui-status[data-status=superseded]{--__P__-pill: var(--__P__-fg-muted)}@supports (color: oklch(from red l c h)){.__P__-toolui-badge,.__P__-toolui-name-pill,.__P__-toolui-q-pill{color:oklch(from var(--__P__-pill) clamp(var(--__P__-pill-l-min),l,var(--__P__-pill-l-max)) c h)}}.__P__-toolui-head{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2)}.__P__-toolui-head-end{display:inline-flex;align-items:center;gap:var(--__P__-space-2);margin-inline-start:auto}.__P__-toolui-collapse-body{display:flex;flex-direction:column;gap:var(--__P__-space-3);padding:var(--__P__-space-4)}.__P__-toolui-summary{display:flex;flex-direction:column;gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form{gap:var(--__P__-space-3)}.__P__-toolui-collapse-body>.__P__-form>.__P__-field,.__P__-toolui-summary>.__P__-field{padding:10px var(--__P__-space-3);border:1px solid var(--__P__-border);border-radius:var(--__P__-radius-md);background:color-mix(in oklab,var(--__P__-bg) 80%,transparent);line-height:1.5}.__P__-toolui-collapse-body>.__P__-form>.__P__-field{gap:var(--__P__-space-2)}.__P__-toolui-summary>.__P__-field{gap:var(--__P__-space-1)}.__P__-toolui-summary .__P__-field-label{color:var(--__P__-fg-muted)}.__P__-toolui-answer{margin:0;font-size:var(--__P__-text-sm);color:var(--__P__-fg-muted);overflow-wrap:anywhere;white-space:pre-wrap}.__P__-toolui-footer{display:flex;align-items:center;justify-content:space-between;gap:var(--__P__-space-3);margin-inline:calc(-1 * var(--__P__-space-4));padding:var(--__P__-space-3) var(--__P__-space-4) 0;border-top:1px solid var(--__P__-border)}.__P__-toolui-options-toggle{display:inline-flex;align-items:center;gap:4px;border:0;background:transparent;padding:0;cursor:pointer;font-size:var(--__P__-text-xs);font-weight:600;color:var(--__P__-fg-muted);transition:color var(--__P__-dur-quick) var(--__P__-ease)}.__P__-toolui-options-toggle:hover{color:var(--__P__-fg)}.__P__-toolui-options-chevron{display:inline-flex;transition:transform var(--__P__-dur-quick) var(--__P__-ease-out)}.__P__-toolui-options-chevron svg{width:14px;height:14px}.__P__-toolui-options-chevron.__P__-open{transform:rotate(180deg)}.__P__-toolui-desc{margin:0;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-section{display:flex;flex-direction:column;gap:8px;padding:var(--__P__-space-3);border-radius:var(--__P__-radius-md);background:var(--__P__-bg);border:1px solid var(--__P__-border)}.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-section,.__P__-toolui:not(.__P__-toolui-collapsible) .__P__-toolui-desc{padding:0;background:none;border:0;border-radius:0}.__P__-toolui-label{font-size:var(--__P__-text-xs);font-weight:600;letter-spacing:.06em;text-transform:uppercase;color:var(--__P__-fg-muted)}.__P__-toolui-code{margin:0;max-height:240px;overflow:auto;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);font-size:var(--__P__-text-xs);line-height:1.5;white-space:pre-wrap;word-break:break-word}.__P__-toolui-code[data-error=true]{color:var(--__P__-danger, #dc2626)}.__P__-toolui-body{gap:6px}.__P__-toolui-prompt{margin:0;font-weight:600;color:var(--__P__-fg);overflow-wrap:anywhere}.__P__-toolui-subtle{margin:0;font-size:var(--__P__-text-xs);color:var(--__P__-fg-muted);line-height:1.5}.__P__-toolui-actions{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:var(--__P__-space-2);margin-top:var(--__P__-space-2)}:host([dir="rtl"]) .__P__-icon-dir{transform:scaleX(-1)}:host([dir="rtl"]) .__P__-field-input[type=date],:host([dir="rtl"]) .__P__-field-input[type=time]{position:relative;text-align:right;padding-left:34px}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-datetime-edit,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-datetime-edit{text-align:right}:host([dir="rtl"]) .__P__-field-input[type=date]::-webkit-calendar-picker-indicator,:host([dir="rtl"]) .__P__-field-input[type=time]::-webkit-calendar-picker-indicator{position:absolute;left:var(--__P__-space-3);margin:0}
|
|
5
|
+
`;var vl=`.__P__-standalone-page{margin:0;height:100vh;background:var(--__P__-bg, #fff);display:grid;place-items:stretch}
|
|
6
|
+
`;var hl=`: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-inline-end: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}}
|
|
7
|
+
`;var ff="helpai",mf="#5B5BD6",gf="#FFFFFF",vf="12px",hf="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",ci=[fl,ml,gl,_l,vl,hl].join(`
|
|
8
|
+
`).replace(/__P__/g,ff).replaceAll("__BRAND_ACCENT_TEXT__",gf).replaceAll("__BRAND_ACCENT__",mf).replaceAll("__BRAND_RADIUS__",vf).replaceAll("__BRAND_FONT__",hf);var bf=le.scope("mount"),bl=new WeakMap,yl={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 Pl(e,t){e.style.cssText=yl[t]}function lr(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function mo(e={}){let t=e.position??"flow";bf.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${T.cssPrefix}-chat-host`;typeof customElements<"u"&&!customElements.get(n)&&customElements.define(n,class extends HTMLElement{});let r;e.existingHost?r=e.existingHost:(r=document.createElement(n),(e.target??document.body).appendChild(r)),r.setAttribute("data-brand",T.id),r.style.cssText=yl[t];let o=r.shadowRoot??r.attachShadow({mode:"open"}),i=r.ownerDocument;if(!yf(o,i)){let s=i.createElement("style");s.textContent=ci,o.appendChild(s)}let a=document.createElement("div");return a.className=`${T.cssPrefix}-app`,o.appendChild(a),{appRoot:a,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function yf(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=bl.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(ci),bl.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function Pf(e,t){let n=T.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),t.contentMaxWidth&&e.style.setProperty(`--${n}-conversation-max`,t.contentMaxWidth)}function xf(e,t){e.dataset.theme=t}function Sf(e,t){let n=T.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 kf(e,t){e.dataset.position=t}function go(e,t){e.dataset.mode=t}function xl(e,t){xf(e,t.themeMode),Pf(e,t.themeOverrides),kf(e,t.position),Sf(e,t.size)}var wf=le.scope("iframe"),Cf='<!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 wl(e,t,n="closed",r="floating",o=null){wf.debug("createIframeMount",{position:t,initialMode:n,layoutMode:r,hasTarget:!!o});let i=document.createElement("iframe");i.title=`${T.name} chat`,i.setAttribute("allow","microphone; clipboard-write"),kl(i,t,n,r),(r==="inline"&&o?o:document.body).appendChild(i);let s=i.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(Cf),s.close();let c=mo({...e,target:s.body}),u=new MutationObserver(()=>{kl(i,t,c.hostElement.dataset.mode??"closed",r)});return u.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:i,destroy(){u.disconnect(),c.destroy(),i.remove()}}}var vo="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",Sl={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 kl(e,t,n,r){if(n==="fullscreen"||r==="standalone"){e.style.cssText=`${vo}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(r==="inline"){e.style.cssText=`${vo}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=`${vo}position:fixed;inset:0;width:100vw;height:100vh;`;return}let i=t.startsWith("top-")?"top":"bottom",a=t.endsWith("-left")?"left":"right",{w:s,h:c}=Sl[n]??Sl.open;e.style.cssText=`${vo}position:fixed;${i}:16px;${a}:16px;width:${s};height:${c};`}var ho=class{constructor(){ve(this,"handlers",new Map)}on(t,n){let r=this.handlers.get(t);return r||(r=new Set,this.handlers.set(t,r)),r.add(n),()=>this.handlers.get(t)?.delete(n)}emit(t,n){let r=this.handlers.get(t);if(r)for(let o of r)try{o(n)}catch{}}clear(){this.handlers.clear()}};var $n,Ze,di,Cl,ui=Object.is,dr=0,Nl=[],pi=[],We=be,Rl=We.__b,Il=We.__r,Tl=We.diffed,Al=We.__c,El=We.unmount,Ml=We.__;function bo(e,t){We.__h&&We.__h(Ze,e,dr||t),dr=0;var n=Ze.__H||(Ze.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return dr=1,$l(Dl,e)}function $l(e,t,n){var r=bo($n++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Dl(void 0,t),function(i){var a=r.__N?r.__N[0]:r.__[0],s=r.t(a,i);ui(a,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=Ze,!Ze.__f)){Ze.__f=!0;var o=Ze.shouldComponentUpdate;Ze.shouldComponentUpdate=function(i,a,s){var c=this.__H;if(!c)return!0;var u=!1,d=this.props!=i;if(c.__.some(function(p){p.__N&&(u=!0,ui(p.__[0],p.__N[0])||(d=!0))}),o){var _=o.call(this,i,a,s);return u?_||d:_}return!u||d}}return r.__}function D(e,t){var n=bo($n++,3);!We.__s&&fi(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,Ze.__H.__h.push(n))}function Pt(e,t){var n=bo($n++,4);!We.__s&&fi(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,Ze.__h.push(n))}function $(e){return dr=5,de(function(){return{current:e}},[])}function de(e,t){var n=bo($n++,7);return fi(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function N(e,t){return dr=8,de(function(){return e},t)}function Rf(){var e;do{for(;e=pi.shift();)try{cr(e)}catch(n){We.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=Nl.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(cr),t.__h.some(_i),t.__h=[]}catch(n){t.__h=[],We.__e(n,e.__v)}}}while(pi.length)}We.__b=function(e){Ze=null,Rl&&Rl(e)},We.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),Ml&&Ml(e,t)},We.__r=function(e){Il&&Il(e),$n=0;var t=(Ze=e.__c).__H;t&&(di==Ze?Ze.__h=[]:(t.__h.some(cr),t.__h.some(_i),$n=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),di=Ze},We.diffed=function(e){Tl&&Tl(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Ol(Nl.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),di=Ze=null},We.__c=function(e,t){t.some(function(n){try{n.__h.some(cr),n.__h=n.__h.filter(function(r){return!r.__||_i(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],We.__e(r,n.__v)}}),Al&&Al(e,t)},We.unmount=function(e){El&&El(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(o){try{if(o.__P&&o.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n=n&&n.__c}o.__P=n,Ol(pi.push(o))}else cr(o)}catch(i){t=i}}),r.__H=void 0,t&&We.__e(t,r.__v))};var Ll=typeof requestAnimationFrame=="function";function If(e){var t,n=function(){clearTimeout(r),Ll&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);Ll&&(t=requestAnimationFrame(n))}function Ol(e){e!=1&&Cl==We.requestAnimationFrame||((Cl=We.requestAnimationFrame)||If)(Rf)}function cr(e){var t=Ze,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),Ze=t}function _i(e){var t=Ze;e.__c=e.__(),Ze=t}function fi(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!ui(n,e[r])})}function Dl(e,t){return typeof t=="function"?t(e):t}var Tf=Symbol.for("preact-signals");function So(){if(Ft>1)Ft--;else{var e,t=!1;for((function(){var o=Po;for(Po=void 0;o!==void 0;){var i=o.S;if(i.v===o.v)for(var a=i.t;a!==void 0;a=a.x)a.i===o.i&&(a.i=i.i);o=o.o}})();pr!==void 0;){var n=pr;for(pr=void 0,yo++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Fl(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(yo=0,Ft--,t)throw e}}function Rt(e){if(Ft>0)return e();mi=++Af,Ft++;try{return e()}finally{So()}}var ur,qe=void 0;function _r(e){var t=qe,n=ur;qe=void 0,ur=void 0;try{return e()}finally{qe=t,ur=n}}var pr=void 0,Ft=0,yo=0,Af=0,mi=0,Po=void 0,xo=0;function Bl(e){if(qe!==void 0){var t=e.n;if(t===void 0||t.t!==qe)return t={i:0,S:e,p:qe.s,n:void 0,t:qe,e:void 0,x:void 0,r:t},qe.s!==void 0&&(qe.s.n=t),qe.s=t,e.n=t,32&qe.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=qe.s,t.n=void 0,qe.s.n=t,qe.s=t),t}}function ot(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}ot.prototype.brand=Tf;ot.prototype.h=function(){return!0};ot.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:_r(function(){var r;(r=t.W)==null||r.call(t)}))};ot.prototype.U=function(e){var t=this;if(this.t!==void 0){var n=e.e,r=e.x;n!==void 0&&(n.x=r,e.e=void 0),r!==void 0&&(r.e=n,e.x=void 0),e===this.t&&(this.t=r,r===void 0&&_r(function(){var o;(o=t.Z)==null||o.call(t)}))}};ot.prototype.subscribe=function(e){var t=this;return Ut(function(){var n=t.value;_r(function(){return e(n)})},{name:"sub"})};ot.prototype.valueOf=function(){return this.value};ot.prototype.toString=function(){return this.value+""};ot.prototype.toJSON=function(){return this.value};ot.prototype.peek=function(){var e=this;return _r(function(){return e.value})};Object.defineProperty(ot.prototype,"value",{get:function(){var e=Bl(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(yo>100)throw new Error("Cycle detected");(function(n){Ft!==0&&yo===0&&n.l!==mi&&(n.l=mi,Po={S:n,v:n.v,i:n.i,o:Po})})(this),this.v=e,this.i++,xo++,Ft++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{So()}}}});function ie(e,t){return new ot(e,t)}function Fl(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 Ul(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 zl(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function dn(e,t){ot.call(this,void 0,t),this.x=e,this.s=void 0,this.g=xo-1,this.f=4}dn.prototype=new ot;dn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===xo))return!0;if(this.g=xo,this.f|=1,this.i>0&&!Fl(this))return this.f&=-2,!0;var e=qe;try{Ul(this),qe=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 qe=e,zl(this),this.f&=-2,!0};dn.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)}ot.prototype.S.call(this,e)};dn.prototype.U=function(e){if(this.t!==void 0&&(ot.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)}};dn.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(dn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Bl(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Ce(e,t){return new dn(e,t)}function ql(e){var t=e.m;if(e.m=void 0,typeof t=="function"){Ft++;var n=qe;qe=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,gi(e),r}finally{qe=n,So()}}}function gi(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,ql(e)}function Ef(e){if(qe!==this)throw new Error("Out-of-order effect");zl(this),qe=e,this.f&=-2,8&this.f&&gi(this),So()}function Dn(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,ur&&ur.push(this)}Dn.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()}};Dn.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ql(this),Ul(this),Ft++;var e=qe;return qe=this,Ef.bind(this,e)};Dn.prototype.N=function(){2&this.f||(this.f|=2,this.u=pr,pr=this)};Dn.prototype.d=function(){this.f|=8,1&this.f||gi(this)};Dn.prototype.dispose=function(){this.d()};function Ut(e,t){var n=new Dn(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var Hl,mr,ko,Mf=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var Vl=[];Ut(function(){Hl=this.N})();function Bn(e,t){be[e]=t.bind(null,be[e]||function(){})}function fr(e){if(ko){var t=ko;ko=void 0,t()}ko=e&&e.S()}function jl(e){var t=this,n=e.data,r=wt(n);r.name="ReactiveDom",r.value=n;var o=de(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var u=Ce(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),d=Ce(function(){return!Array.isArray(u.value)&&!Ha(u.value)}),_=Ut(function(){if(this.N=Wl,d.value){var f=u.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),p=t.__$u.d;return t.__$u.d=function(){_(),p.call(this)},[d,u]},[]),i=o[0],a=o[1];return i.value?a.peek():a.value}jl.displayName="ReactiveTextNode";Object.defineProperties(ot.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:jl},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});Bn("__b",function(e,t){if(fr(),mr=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var i=r[o];i instanceof ot&&(n||(t.__np=n={}),n[o]=i,r[o]=i.peek())}}e(t)});Bn("__r",function(e,t){if(e(t),t.type!==we){fr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,i){var a;return Ut(function(){a=this},{name:i}),a.c=o,a})((function(o){return function(){var i;Mf&&((i=this.y)==null||i.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),mr=r,fr(n)}});Bn("__e",function(e,t,n,r){fr(),mr=void 0,e(t,n,r)});Bn("diffed",function(e,t){fr(),mr=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,i=n.U;if(i)for(var a in i){var s=i[a];s===void 0||r&&a in r||(s.d(),i[a]=void 0)}if(r){i||(i={},n.U=i);for(var c in r){var u=i[c],d=r[c];u===void 0?(u=Lf(n,c,d,o),i[c]=u):u.o(d,o)}}}e(t)});function Lf(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,i=ie(n);return{o:function(a,s){i.value=a,r=s},d:Ut(function(){this.N=Wl;var a=i.value.value;r[t]!==a&&(r[t]=a,o?e[t]=a:a!=null&&(a!==!1||t[4]==="-")?e.setAttribute(t,a):e.removeAttribute(t))})}}Bn("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var i=r[o];i&&i.d()}}}var a=t.__np;if(a){var s=t.props;for(var c in a)s[c]=a[c]}t.__np=void 0}else{var u=t.__c;if(u){u.__$f|=8;var d=u.__$u;d&&(u.__$u=void 0,d.d())}}e(t)});Bn("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Ct.prototype.shouldComponentUpdate=function(e,t){if(this.__R)return!0;var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var i=2&this.__$f;if(!(r||i||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var a in e)if(a!=="__source"&&e[a]!==this.props[a])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function wt(e,t){return de(function(){return ie(e,t)},[])}function ht(e,t){var n=$(e);return n.current=e,mr.__$f|=4,de(function(){return Ce(function(){return n.current()},t)},[])}var Of=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Nf(){Rt(function(){for(var e;e=Vl.shift();)Hl.call(e)})}function Wl(){Vl.push(this)===1&&(be.requestAnimationFrame||Of)(Nf)}function Gl(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Kl(e){return Gl(e)}function Ql(e){return!(!Gl(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}function wo(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 $f=900,Df=640;function vi(e,t,n){if(e==="standalone"||e==="page")return"fullscreen";let r=t.initialSize;return r==="expanded"||r==="fullscreen"||r==="normal"?r:n>0&&n<Df?"fullscreen":n>=(t.autoSizeBreakpoint??$f)?"expanded":"normal"}function gr(e,t,n,r=null){let i=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:vi(e.mode,e.size,t);return{panelOpen:i,panelSize:s}}function Fn(){return typeof window>"u"?0:window.innerWidth}var Bf="x-public-key",Ff="x-ai-agent-deployment-id";function Yl(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[Ff]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??Bf]=e.publicKey),t}}}function vr(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(i,e);function o(){return i()}t?.addEventListener("abort",o,{once:!0});function i(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}var at=class extends Error{constructor(n,r,o,i){super(n);ve(this,"code",r);ve(this,"status",o);ve(this,"cause",i);this.name="StreamError"}};var Xl=le.scope("parser");async function*Jl(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new at(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of Uf(e,t)){let o=zf(r,n);if(o==="done")return;o&&(yield o)}}async function*Uf(e,t){if(!e.body)throw new at("response has no body","no-body");let n=e.body.pipeThrough(new TextDecoderStream).getReader(),r="";try{for(;;){if(t.aborted)throw new DOMException("aborted","AbortError");let{done:o,value:i}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=i;let a;for(;(a=r.indexOf(`
|
|
8
9
|
|
|
9
|
-
`))!==-1;){let
|
|
10
|
-
`))if(
|
|
11
|
-
${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let r=JSON.parse(n);return sl.trace("chunk",{type:r.type,eventId:o}),{chunk:r,eventId:o}}catch(r){throw sl.trace("frame parse failed",{errorType:r instanceof Error?r.name:typeof r,payloadLength:n.length}),new Xe("invalid SSE frame","network",void 0,r)}}function Lp(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 cl=e=>e&&Object.keys(e).length>0?e:void 0;function dl(e,t){let n=cl(e),o=cl(t);if(!n&&!o)return;let r={};return n&&(r.user=n),o&&(r.page=o),Lp(JSON.stringify(r))}function ul(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Op(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function _l(e){return e.startsWith("tool-")?e.slice(5):e}var mt={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",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},pl="context";function sr(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function fl(e){if(!sr(e))return;let t=e,n=t.controlMode,o=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof o!="number"||!Number.isSafeInteger(o)||o<0))return{controlMode:n,controlRevision:o,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function ml(e){if(!sr(e))return;let t=e.status,n=e.postFinishSequence;if(!(t!=="compacting"&&t!=="ready"||typeof n!="number"||!Number.isSafeInteger(n)||n<0))return{status:t,postFinishSequence:n}}function lr(e){let t=sr(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let o of t){if(!sr(o))continue;let{id:r,label:a,text:s}=o;typeof a!="string"||!a||n.push({id:typeof r=="string"&&r?r:`s${n.length}`,label:a,text:typeof s=="string"&&s?s:a})}return n}function Fa(e){let n={messages:e.messages.map(o=>({id:o.serverMessageId??o.id,parts:Dp(o),role:o.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Np(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function Dp(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),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"&&Np(n)){let o=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Op(n.toolName),toolCallId:n.toolCallId,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?.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 Me=Z.scope("transport"),$p=6e4,Fp=1e4,Ua=50,yl=new WeakMap;function An(e){return yl.get(e)}function lo(e,t){return yl.set(e,t),e}function gl(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Bp(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function Bt(e,t,n=!0){switch(t.type){case"snapshot":{let o=new Map(e.map(s=>[s.conversationId,s])),r=e.filter(s=>(An(s)?.activityRevision??0)>t.requestedRevision).toSorted((s,l)=>An(l).activityRevision-An(s).activityRevision),a=new Set(r.map(s=>s.conversationId));return[...r,...t.result.conversations.filter(s=>!a.has(s.conversationId)).map(s=>{let l=o.get(s.conversationId);if(!l)return s;let c=An(l);return(c?.upsertRevision??0)>t.requestedRevision?l:c?.read&&!l.hasUnread&&c.read.lastMessageAt===s.lastMessageAt?lo({...s,hasUnread:!1},{upsertRevision:0,read:c.read}):s})]}case"read":{let o=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(o<0)return e;let r=e[o],a=An(r);if(gl(a)>t.revision)return e;let s=t.lastMessageAt??r.lastMessageAt,l={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...s?{lastMessageAt:s}:{}}};return r.hasUnread?e.map((c,d)=>d===o?lo({...c,hasUnread:!1},l):c):(lo(r,l),e)}case"upsert":{let o=e.findIndex(d=>d.conversationId===t.conversation.conversationId);if(o<0&&!n)return e;let r=o<0?void 0:e[o],a=r?An(r):void 0;if(gl(a)>t.revision)return e;let s=t.activity?t.revision:a?.activityRevision,l={upsertRevision:t.revision,...s===void 0?{}:{activityRevision:s},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=r?{...r,...t.conversation,title:r.title}:{...t.conversation};return r&&Bp(r,c)?(lo(r,l),e):(lo(c,l),t.activity?[c,...e.filter(d=>d.conversationId!==c.conversationId)]:r?e.map((d,_)=>_===o?c:d):[...e,c])}default:return t}}var vl=3,Up=400,Hp=3e4,zp=1e4,qp=6e4,Vp=15e3,Wp=1024*1024,hl=new Set([408,425,429,500,502,503,504]);function bl(e){return Up*2**e+Math.floor(Math.random()*250)}function Kp(e){return qp+Math.ceil(e/Wp)*Vp}function Gp(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}var cr=class{constructor(t){ce(this,"ttlMs",t);ce(this,"map",new Map)}getOrFetch(t,n){let o=this.map.get(t);if(o&&performance.now()-o.at<this.ttlMs)return o.result;let r={at:performance.now(),result:n().then(a=>(r.value=a,a)).catch(a=>{throw this.map.get(t)===r&&this.map.delete(t),a})};return this.map.set(t,r),r.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let o=t(n.value);n.value=o,n.result=Promise.resolve(o);continue}n.result=n.result.then(o=>{let r=t(o);return n.value=r,r})}}delete(t){this.map.delete(t)}},dr=class{constructor(t){ce(this,"opts",t);ce(this,"conversationListeners",new Set);ce(this,"conversationRevision",0);ce(this,"visitorId");ce(this,"conversationId");ce(this,"userContext");ce(this,"pageContext");ce(this,"locale");ce(this,"conversationsCache",new cr(Fp));ce(this,"contentCache",new cr($p))}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={_ev:xn};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=dl(this.userContext,this.pageContext);return n&&(t[pl]=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,r]of Object.entries(this.envelope()))n.searchParams.has(o)||n.searchParams.set(o,r);return n.toString()}async handshake(t){Me.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(mt.handshake,t,"handshake");return Me.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),this.visitorId=t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){Me.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let o=new FormData;o.append("file",t,t.name);let r=await this.postForm(this.uploadPath,o,"upload",n,Kp(t.size));return Me.debug("uploadFile \u2190",{id:r.id,url:r.url}),r}async transcribe(t,n="audio/webm"){Me.debug("transcribe \u2192",{size:t.size,mimeType:n});let o=new FormData;o.append("audio",t,`voice.${jp(n)}`),o.append("mimeType",n);let r=await this.postForm(this.transcribePath,o,"transcribe");return Me.debug("transcribe \u2190",{textLen:r.text.length}),r}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let o={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(r=>{let a=r.pagination.page===1,s=r.conversations.some(p=>p.conversationId===t.conversationId),l=Bt(r.conversations,o,a&&n),c=a&&l.length>r.pagination.limit?l.slice(0,r.pagination.limit):l;if(!a||!n||s||r.pagination.hasNext)return c===r.conversations?r:{...r,conversations:c};let d=Math.max(r.pagination.total,r.conversations.length)+1,_=Math.ceil(d/r.pagination.limit);return{...r,conversations:c,pagination:{...r.pagination,total:d,totalPages:_,hasNext:r.pagination.page<_}}});for(let r of this.conversationListeners)r(o)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let o=this.localeCacheKey(t),r=this.conversationRevision;n&&this.conversationsCache.delete(o);let a=this.conversationsCache.getOrFetch(o,()=>this.fetchConversations(t));return n?a.then(s=>{let l={type:"snapshot",result:s,requestedRevision:r};for(let c of this.conversationListeners)c(l);return s}):a}async fetchConversations(t){let n=new URL(this.url(mt.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:o,beforeCreatedAt:r}={}){let a=new URL(this.url(mt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(Ua)),n.length>0&&a.searchParams.set("ids",n.join(",")),o&&a.searchParams.set("beforeId",o),r&&a.searchParams.set("beforeCreatedAt",r);let s=await this.getJson(a.toString(),"loadConversation");return{...s,messages:s.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let o={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(r=>{let a=Bt(r.conversations,o);return a===r.conversations?r:{...r,conversations:a}});for(let r of this.conversationListeners)r(o);try{await this.postJson(mt.markRead,{conversationId:t},"markRead",!0)}catch(r){Me.debug("markRead failed (non-fatal)",{err:r})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(mt.requestOperator,{},"requestOperator")).controlState}catch(t){Me.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(mt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Me.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(mt.content));for(let[a,s]of Object.entries(t))s!==void 0&&n.searchParams.set(a,Array.isArray(s)?s.join(","):String(s));let o=await this.getJson(n.toString(),"listContent"),r=(o.items??[]).map(a=>ds(a,this.locale));return{...o,items:r}}async bootstrap(t){let n=new URL(this.dataUrl(mt.bootstrap));t&&n.searchParams.set("conversationId",t);let o=await this.getJson(n.toString(),"bootstrap"),r=o.forms??[],a=o.formSubmissions??[];return{forms:r,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(mt.updateSettings,{userPrefs:t},"saveUserPrefs")}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??mt.submitForm}async submitForm(t){Me.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){Me.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Me.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(mt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Me.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){Me.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let o=await this.fetchImpl(this.url(mt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(o.status!==202)throw new Xe(`sendTurn failed: expected 202, received ${o.status}`,"server",o.status);let r;try{r=await o.json()}catch(a){throw n?.aborted?a:new Xe("sendTurn failed: invalid acknowledgement","server",o.status,a)}if(!Qp(r))throw new Xe("sendTurn failed: invalid acknowledgement","server",o.status);return r},void 0,Hp)}catch(n){throw n instanceof Xe?n:new Xe("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Me.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(mt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(o=>Me.debug("cancel POST failed (non-fatal)",{err:o})))}async connectResumeStream(t){let n=new AbortController,o=()=>n.abort(t.signal.reason);t.signal.aborted?o():t.signal.addEventListener("abort",o,{once:!0});let r=setTimeout(()=>n.abort(),zp),a=()=>{clearTimeout(r),t.signal.removeEventListener("abort",o)},s;try{s=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return a(),t.signal.aborted||Me.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!s.ok)return a(),s.status===409||hl.has(s.status)?(Me.debug("resume-stream \u2192 transient response; reconnecting",{status:s.status}),"held"):(Me.debug("resume-stream \u2192 endpoint unavailable",{status:s.status}),"unavailable");if(!s.body)return a(),Me.debug("resume-stream \u2192 bodyless response; stopping",{status:s.status}),"unavailable";if(!(s.headers.get("content-type")??"").includes("text/event-stream"))return a(),Me.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let l=!1;try{for await(let{chunk:c}of ll(s,n.signal,d=>{l||d!=="connected"||(l=!0,clearTimeout(r),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Me.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(mt.streamResume)}async postJson(t,n,o,r=!1){let a=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)),...r?{keepalive:!0}:{}}],o);return this.assertOk(a,o)}async postForm(t,n,o,r,a){return this.runWithAbort(async s=>{let l=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:s});return this.assertOk(l,o)},r,a)}async runWithAbort(t,n,o){if(!n&&o===void 0)return t();let r=new AbortController,a=()=>r.abort(n?.reason);n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let s=o===void 0?void 0:setTimeout(()=>r.abort(),o);try{return await t(r.signal)}finally{s!==void 0&&clearTimeout(s),n?.removeEventListener("abort",a)}}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[r,a]=t(),s;try{s=await this.fetchImpl(r,a)}catch(c){if(o>=vl)throw new Xe(`${n} failed: network error`,"network",void 0,c);Me.debug("request network error \u2014 retrying",{label:n,attempt:o}),await so(bl(o));continue}if(s.ok||!hl.has(s.status)||o>=vl)return s;let l=Gp(s.headers)??bl(o);Me.debug("request retryable status \u2014 retrying",{label:n,status:s.status,attempt:o,wait:l}),await so(l)}}async assertOk(t,n){if(!t.ok)throw new Xe(`${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 jp(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 Qp(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),o=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(o===void 0||typeof o=="string"&&o.length>0)}function za(e,t,n=pt()){let o=e?[{kind:"text",id:"t0",textSig:te(e),doneSig:te(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:te(o)}}function Ut(){return{id:pt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:te([])}}function xl(e){let t=pt();return Xp({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function Xp(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:te(e.parts.map(of))}}function Yp(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function qa(e){let t=new Set,n=e.parts.map((r,a)=>r.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:te(r.text),doneSig:te(!0)}:r.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:te(r.text),doneSig:te(r.state!=="streaming")}:r.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:r.type==="file"?{kind:"file",url:r.url,mediaType:r.mediaType}:r.type==="source-url"?{kind:"source",sourceId:r.sourceId,url:r.url,title:r.title}:r.type==="source-document"?{kind:"source",sourceId:r.sourceId,title:r.title,filename:r.filename,mediaType:r.mediaType}:r.type==="data-suggestions"?null:r.type==="dynamic-tool"||r.type.startsWith("tool-")?{kind:"tool",toolCallId:r.toolCallId,toolName:r.type==="dynamic-tool"?r.toolName:_l(r.type),dynamic:r.type==="dynamic-tool"?!0:void 0,inputPartialSig:te(""),inputSig:te(r.input),outputSig:te(r.output),errorSig:te(r.errorText),stateSig:te(r.state),approvalSig:te(r.approval)}:null).filter(r=>r!==null).filter(r=>r.kind!=="source"?!0:t.has(r.sourceId)?!1:(t.add(r.sourceId),!0)),o=e.parts.find(r=>r.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:o?.type==="data-suggestions"?lr(o.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:Yp(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:te(n)}}function Jp(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function Zp(e){return e.role==="assistant"&&e.status==="streaming"&&Jp(e)}function Qt(e){let t=e.length-1;return e.filter((n,o)=>o===t||!Zp(n)).map(qa)}function Sl(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,o=e.at(n);return!o||o.ephemeral?[]:[o]}function Va(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(rf)}}function Ue(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function ur(e,t,n,o,r,a=t.createdAt){let s=e.find(_=>_.role==="user"&&!_.ephemeral),l=(_,p)=>Ue(_).replace(/\s+/g," ").trim().slice(0,p),c=s?l(s,80):"",d=l(t,120);return{conversationId:n,title:c||o,lastMessageAt:new Date(a).toISOString(),preview:d||void 0,canContinue:r}}function Rt(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function ef(e){return Ue(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Wa(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}var Mn=e=>e.kind==="tool",kl=e=>e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file";function co(e){let t=e.partsSig.value,n=t.findLastIndex(o=>o.kind==="tool");return t.slice(n+1).some(kl)}function ln(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(Mn);return t.length>0&&t.every(n=>Wa(n.stateSig.value))}function cn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!co(e)}function _r(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||kl(n))}function pr(e){return e.partsSig.value.some(t=>Mn(t)&&!Wa(t.stateSig.value))}function wl(e,t){if(t.length===0)return e;let n=new Set;for(let s of e)n.add(s.id),s.serverMessageId&&n.add(s.serverMessageId);let o=t.filter(s=>{let l=[s.id,s.serverMessageId].filter(c=>c!==void 0);return l.some(c=>n.has(c))?!1:(l.forEach(c=>n.add(c)),!0)});if(o.length===0)return e;let r=e.findIndex(s=>!s.ephemeral),a=r<0?e.length:r;return[...e.slice(0,a),...o,...e.slice(a)]}function an(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function Cl(e,t,n,o){if(!Ka(e))return;if(t.length===0){let s=Math.max(...o.values());return n.find(l=>l.role==="assistant"&&o.get(l.serverMessageId??l.id)===s&&Ue(l).length>=Ue(e).length)}let r=t.at(-1);if(r?.role!=="user")return;let a=o.get(r.serverMessageId??r.id);if(a!==void 0)return n.find(s=>s.role==="assistant"&&o.get(s.serverMessageId??s.id)===a+1&&Ue(s).length>=Ue(e).length)}function Ka(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function tf(e,t){let n=new Map(t.partsSig.value.filter(Mn).filter(a=>Wa(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let o=!1,r=e.partsSig.value.map(a=>{if(!Mn(a))return a;let s=n.get(a.toolCallId);if(!s)return a;let l=a.approvalSig.value,c=s.approvalSig.value,d=l===void 0||l.approved===void 0&&c?.approved!==void 0?s.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?s.inputSig:a.inputSig,p=a.toolName==="tool"?s.toolName:a.toolName,u=a.dynamic??s.dynamic;return d===a.approvalSig&&_===a.inputSig&&p===a.toolName&&u===a.dynamic?a:(o=!0,{...a,toolName:p,dynamic:u,inputSig:_,approvalSig:d})});o&&(e.partsSig.value=r)}function Ga(e,t){let n=t.filter(p=>!p.ephemeral&&(p.status==="streaming"||p.status==="pending"||p.status==="error"||p.retryAction!==void 0||(p.attachments?.length??0)>0||Rt(p))),o=new Map;for(let p of n)o.set(p.id,p),p.serverMessageId!==void 0&&o.set(p.serverMessageId,p);let r=new Set,a=[],s=e.map(p=>{let u=(p.serverMessageId!==void 0?o.get(p.serverMessageId):void 0)??o.get(p.id);return u===void 0?(a.push(p),p):(r.add(u),u.role!==p.role?p:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?an(u,p):u.status==="streaming"||Ue(u).length>=Ue(p).length?(tf(u,p),u.suggestions??(u.suggestions=p.suggestions),u.feedback===void 0&&(u.feedback=p.feedback),p.canceled&&(u.canceled=!0),u):an(u,p))}),l=n.filter(p=>!r.has(p)),c=l.findLast(Ka),d=new Map;e.forEach((p,u)=>{d.set(p.id,u),p.serverMessageId!==void 0&&d.set(p.serverMessageId,u)});let _=Cl(c,c?n.slice(0,n.indexOf(c)):[],a,d);if(c&&_){let p=s.indexOf(_);p>=0&&(s[p]=an(c,_)),l=l.filter(u=>u!==c)}return[...s,...l]}function uo(e,t){let n=new Map(t.filter(p=>p.serverMessageId!==void 0).map(p=>[p.serverMessageId,p])),o=new Map;t.forEach((p,u)=>{o.set(p.id,u),p.serverMessageId!==void 0&&o.set(p.serverMessageId,u)});let r=new Set(e.flatMap(p=>[p.serverMessageId,p.id].filter(u=>u!==void 0))),a=!1,s=e.map(p=>{let u=n.get(p.serverMessageId??p.id);if(u===void 0||u.role!==p.role)return p;if(p.role==="user"&&p.serverMessageId===void 0)return a=!0,an(p,u);if(p.serverMessageId===void 0)return p;let m=Ue(u),g=Ue(p),P=u.status!=="streaming"&&m.length>=g.length&&Ha(p,u);if(m.length>g.length||m===g&&u.partsSig.value.length>p.partsSig.value.length||P)return a=!0,an(p,u);if(p.status==="streaming"&&u.status!=="streaming"&&nf(p,u)){if(p.continuationStreaming&&pr(u))return p;if(!Ha(u,p))return a=!0,an(p,u)}return p}),l=[...n.values()].filter(p=>!r.has(p.serverMessageId)),c=s.findLastIndex(Ka),d=s[c],_=Cl(d,s.slice(0,c),l,o);if(d!==void 0&&_!==void 0&&Ue(_).length>=Ue(d).length&&(an(d,_),s[c]=_,l.splice(l.indexOf(_),1),a=!0),l.length===0)return{messages:a?s:e,changed:a};for(let p of l){let u=o.get(p.serverMessageId??p.id),m=!1,g=s.findIndex(P=>{let y=o.get(P.serverMessageId??P.id);return u===void 0?!1:y===void 0?m:y>u?!0:(m=!0,!1)});g===-1?s.push(p):s.splice(g,0,p)}return{messages:s,changed:!0}}function Rl(e,t){if(e.role!==t.role)return!1;let n=Ue(t),o=Ue(e);return n.length>o.length||t.partsSig.value.length>e.partsSig.value.length||Ha(e,t)}function nf(e,t){let n=e.partsSig.value,o=t.partsSig.value;return n.length!==o.length?!1:n.every((r,a)=>{let s=o[a];switch(r.kind){case"text":return s?.kind==="text"&&s.textSig.value===r.textSig.value;case"reasoning":return s?.kind==="reasoning"&&s.textSig.value===r.textSig.value;case"step-start":return s?.kind==="step-start";case"tool":return s?.kind==="tool"&&s.toolCallId===r.toolCallId&&fr(s.toolName,r.toolName);case"file":return s?.kind==="file"&&s.url===r.url&&s.mediaType===r.mediaType;case"source":return s?.kind==="source"&&s.sourceId===r.sourceId&&s.url===r.url&&s.title===r.title&&s.filename===r.filename&&s.mediaType===r.mediaType;default:return r}})}function fr(e,t){let n=e.startsWith("tool:")?e.slice(5):e,o=t.startsWith("tool:")?t.slice(5):t;return n===o}var Pl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ha(e,t){let n=new Map(e.partsSig.value.filter(Mn).map(o=>[o.toolCallId,o]));return t.partsSig.value.filter(Mn).some(o=>{let r=n.get(o.toolCallId);if(!r||Pl[o.stateSig.value]>Pl[r.stateSig.value])return!0;let a=o.approvalSig.value?.approved;return a!==void 0&&a!==r.approvalSig.value?.approved})}function sn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Rt(e)}function mr(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!sn(t))return;let n=e.indexOf(t);for(let o=n-1;o>=0;o--){let r=e[o];if(r?.role==="user"&&!r.ephemeral)return{kind:"repeat-user",messageId:r.id}}}function Tl(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!ef(e)}function Il(e,t){return e.operatorRoutedTurn?sn(e)?"drop":"complete-operator-routed":t||sn(e)?"error":"complete"}function of(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:te(e.text),doneSig:te(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:te(e.inputPartial),inputSig:te(e.input),outputSig:te(e.output),errorSig:te(e.error),stateSig:te(e.state),approvalSig:te(e.approval)}:e}function rf(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,dynamic:e.dynamic,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}var El=Z.scope("feedback:audio"),gr=class{constructor(){ce(this,"ctx",null);ce(this,"master",null);ce(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){El.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 r=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(),_=r+l*a;d.gain.setValueAtTime(1e-4,_),d.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),d.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(d).connect(o),c.start(_),c.stop(_+a+.01)})}async playUrl(t){let n=this.ctx,o=this.master;if(!n||!o||n.state!=="running")return;let r=await this.getBuffer(t);if(!r)return;let a=n.createBufferSource();a.buffer=r,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,r=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=>(El.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,r),r}};var Al={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Ml={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 Xt=null,vr=0;function af(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function sf(){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=`__${T.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 Ll(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(af())try{navigator.vibrate(e);return}catch{}if(Xt??(Xt=sf()),!!Xt)try{Xt.label.click()}catch{}}}function Ol(){vr++;let e=!1;return()=>{e||(e=!0,vr=Math.max(0,vr-1),vr===0&&Xt&&(Xt.input.remove(),Xt.label.remove(),Xt=null))}}var lf=Z.scope("feedback"),cf=100,hr=class{constructor(t,n){ce(this,"mutedSig",te(!1));ce(this,"audio",new gr);ce(this,"releaseHaptics");ce(this,"sound");ce(this,"haptics");ce(this,"lastPlayed",new Map);ce(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=Ol(),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<cf}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(r=>lf.warn("audio play failed",{err:r,url:n}));return}let o=Ml[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?Al[t]:n;Ll(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}};var df=0;function i(e,t,n,o,r,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:--df,__i:-1,__u:0,__source:r,__self:a};if(typeof e=="function"&&(s=e.defaultProps))for(l in s)c[l]===void 0&&(c[l]=s[l]);return J.vnode&&J.vnode(d),d}var Y={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},_o=`${T.cssPrefix}-icon-dir`,ja=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})}),St=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M18 6 6 18M6 6l12 12"})}),Nl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 5v14M5 12h14"})}),Dl=()=>i("svg",{...Y,class:_o,"aria-hidden":"true",children:[i("path",{d:"m22 2-7 20-4-9-9-4Z"}),i("path",{d:"M22 2 11 13"})]}),$l=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M12 19V5M5 12l7-7 7 7"})}),Fl=()=>i("svg",{...Y,class:_o,"aria-hidden":"true",children:i("path",{d:"M3 20V4l18 8-18 8Z"})}),Ln=()=>i("svg",{...Y,class:_o,"aria-hidden":"true",children:i("path",{d:"m9 18 6-6-6-6"})}),Bl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})}),Ul=()=>i("svg",{...Y,"aria-hidden":"true",children:i("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"})}),Hl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),i("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]}),zl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})}),ql=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})}),Vl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})}),Wl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})}),Kl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 3h7v7M21 3l-9 9"}),i("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),Gl=()=>i("svg",{...Y,"aria-hidden":"true",viewBox:"0 0 10 10",children:i("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})}),jl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),i("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]}),Ql=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})}),Xl=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})}),Yl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),i("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]}),Jl=()=>i("svg",{...Y,class:_o,"aria-hidden":"true",children:i("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})}),dn=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M20 6 9 17l-5-5"})}),Zl=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 3v6h6"}),i("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),i("path",{d:"M12 7v5l3 2"})]}),ec=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M2 12h20"}),i("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"})]}),po=()=>i("svg",{...Y,class:_o,"aria-hidden":"true",children:i("path",{d:"M19 12H5M12 19l-7-7 7-7"})}),tc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M12 20h9"}),i("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]}),un=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"m6 9 6 6 6-6"})}),nc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),i("path",{d:"M14 2v6h6"})]}),uf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),i("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]}),Qa=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})}),fo=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),i("path",{d:"M12 17h.01"})]}),_f=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m15 4 3 3-9 9-3-3z"}),i("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]}),pf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),i("path",{d:"M12 8V4"}),i("circle",{cx:"12",cy:"3",r:"1"}),i("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]}),Xa=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),i("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),i("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),i("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]}),ff=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"10"}),i("circle",{cx:"12",cy:"12",r:"4"}),i("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"})]}),Ya=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"11",cy:"11",r:"7"}),i("path",{d:"m21 21-4.3-4.3"})]}),oc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),rc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M3 9.5 12 3l9 6.5"}),i("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]}),ac=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"m3 11 15-5v12L3 13z"}),i("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),i("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),i("path",{d:"M21 10a3 3 0 0 1 0 4"})]}),mo=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),i("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]}),ic=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"4"}),i("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"})]}),sc=()=>i("svg",{...Y,"aria-hidden":"true",children:i("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}),lc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 3v18"}),i("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]}),mf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),i("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),i("path",{d:"m20 20-4.4-4.4"})]}),gf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("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"}),i("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]}),vf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M4 18h16"}),i("path",{d:"M5 18a7 7 0 0 1 14 0"}),i("path",{d:"M12 8V6"}),i("path",{d:"M10 6h4"})]}),hf=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),i("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),i("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"})]}),cc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),i("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]}),dc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),i("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]}),uc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),i("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]}),_c=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"3.5"}),i("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]}),pc=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"M12 7v5l3 2"})]}),br=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]}),yr=()=>i("svg",{...Y,"aria-hidden":"true",children:[i("circle",{cx:"12",cy:"12",r:"9"}),i("path",{d:"m15 9-6 6M9 9l6 6"})]}),fc={chat:ja,message:Qa,bubbles:mo,spark:uf,wand:_f,bot:pf,help:fo,lifebuoy:ff,headset:Xa,search:mf,sparkles:gf,concierge:vf,wave:hf};var F=T.cssPrefix,R={launcher:`${F}-launcher`,callout:`${F}-callout`,calloutDismiss:`${F}-callout-dismiss`,panel:`${F}-panel`,panelHeader:`${F}-panel-header`,resizeGrip:`${F}-resize-grip`,scrollToBottom:`${F}-scroll-to-bottom`,loadPreviousMessages:`${F}-load-previous-messages`,actionHistory:`${F}-action-history`,actionClose:`${F}-action-close`,langSegment:`${F}-lang-segment`,composer:`${F}-composer`,composerInput:`${F}-composer-input`,composerSend:`${F}-composer-send`,composerStop:`${F}-composer-stop`,compactionStatus:`${F}-compaction-status`,messageQueue:`${F}-message-queue`,queuedMessage:`${F}-queued-message`,queuedMessageRemove:`${F}-queued-message-remove`,composerAttach:`${F}-composer-attach`,composerFileInput:`${F}-composer-file-input`,composerVoice:`${F}-composer-voice`,attachmentChip:`${F}-attachment-chip`,attachmentRemove:`${F}-attachment-remove`,suggestion:`${F}-suggestion`,messageBubble:`${F}-message`,messageRetry:`${F}-message-retry`,messageFeedback:`${F}-message-feedback`,feedbackUp:`${F}-feedback-up`,feedbackDown:`${F}-feedback-down`,messageCopy:`${F}-message-copy`,historyPane:`${F}-history-pane`,historyBack:`${F}-history-back`,historyItem:`${F}-history-item`,historyLoadMore:`${F}-history-load-more`,sidebar:`${F}-sidebar`,sidebarToggle:`${F}-sidebar-toggle`,sidebarNewConversation:`${F}-sidebar-new-conversation`,sidebarItem:`${F}-sidebar-item`,messengerHome:`${F}-messenger-home`,modulesEmpty:`${F}-modules-empty`,tab:`${F}-tab`,tabBadge:`${F}-tab-badge`,homeView:`${F}-home-view`,homeGreeting:`${F}-home-greeting`,homeBrand:`${F}-home-brand`,backHeader:`${F}-back-header`,contentView:`${F}-content-view`,contentScroll:`${F}-content-scroll`,homeSearch:`${F}-home-search`,helpSearch:`${F}-help-search`,homeRecent:`${F}-home-recent`,homeContentRow:`${F}-home-content-row`,helpArticle:`${F}-help-article`,newsItem:`${F}-news-item`,formGate:`${F}-form-gate`,formDone:`${F}-form-done`,formDoneToggle:`${F}-form-done-toggle`,formAnswers:`${F}-form-answers`,formFill:`${F}-form-fill`,formSubmit:`${F}-form-submit`,formSkip:`${F}-form-skip`,formField:`${F}-form-field`,toolAskQuestions:`${F}-tool-ask-questions`,toolInputSubmit:`${F}-tool-input-submit`,toolInputSkip:`${F}-tool-input-skip`,toolApproval:`${F}-tool-approval`,toolApprove:`${F}-tool-approve`,toolReject:`${F}-tool-reject`,toolEdit:`${F}-tool-edit`,toolDecision:`${F}-tool-decision`,typingDots:`${F}-typing-dots`,reasoning:`${F}-reasoning`,toolAskSummary:`${F}-ask-questions-summary`,toolAskOptions:`${F}-ask-questions-options-toggle`,toolCall:`${F}-tool-call`,source:`${F}-source`,operatorRequest:`${F}-operator-request`,operatorBanner:`${F}-operator-banner`,cancelOperatorRequest:`${F}-cancel-operator-request`};function Ye(e,t){return`${e}-${t}`}var Pr=T.cssPrefix;function mc({onToggle:e,launcher:t,strings:n,leaving:o,edgeTab:r}){let a=t.variant!=="circle"&&!!t.label;return i("button",{type:"button",class:`${Pr}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":r?"true":void 0,"data-leaving":o?"true":void 0,"data-testid":R.launcher,onClick:e,"aria-label":n.launcherOpen,children:[bf(t.icon),a?i("span",{class:`${Pr}-fab-label`,children:lt(n,t.label??"")}):null]})}function bf(e){let t=fc[e];return t?i(t,{}):i(yf,{source:e})}function yf({source:e}){return i("span",{ref:t=>{t&&Pf(t,e)},"aria-hidden":"true"})}function Pf(e,t){if(e.dataset.svgMounted!==t)try{let o=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;o.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(o,!0)),e.dataset.svgMounted=t)}catch{}}function gc({callout:e,launcherPosition:t,strings:n,closeLabel:o,onDismiss:r}){let[a,s]=$(!1);return M(()=>{let l=setTimeout(()=>s(!0),e.delayMs);return()=>clearTimeout(l)},[e.delayMs]),M(()=>{if(!a||e.autoDismissMs<=0)return;let l=setTimeout(r,e.autoDismissMs);return()=>clearTimeout(l)},[a,e.autoDismissMs,r]),a?i("div",{class:`${Pr}-callout`,role:"status","data-shape":e.shape,"data-position":xf(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":R.callout,children:[i("span",{children:lt(n,e.text)}),i("button",{type:"button",class:`${Pr}-callout-close`,onClick:r,"aria-label":o,title:o,"data-testid":R.calloutDismiss,children:i(St,{})})]}):null}function xf(e,t){let n=t.endsWith("-right"),o=t.startsWith("bottom-");return e==="vertical"?o?"top":"bottom":n?"left":"right"}function xr({panelEl:e,resize:t,position:n,initialSize:o,onSizeChange:r,strings:a}){let s=T.cssPrefix,l=O(null);if(M(()=>{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"),_=`${s}-resize-grip ${s}-resize-grip--${c?"bottom":"top"}-${d?"left":"right"}`,p=g=>{if(!e)return;let P=g.currentTarget,y=e.getBoundingClientRect();l.current={pointerId:g.pointerId,startX:g.clientX,startY:g.clientY,startW:y.width,startH:y.height,dirX:d?-1:1,dirY:c?1:-1},P.setPointerCapture(g.pointerId),e.setAttribute("data-resizing",""),g.preventDefault()},u=g=>{let P=l.current;if(!P||g.pointerId!==P.pointerId||!e)return;let y=(g.clientX-P.startX)*P.dirX,w=(g.clientY-P.startY)*P.dirY;e.style.setProperty(`--${s}-widget-w`,`${P.startW+y}px`),e.style.setProperty(`--${s}-widget-h`,`${P.startH+w}px`)},m=g=>{let P=l.current;if(!P||g.pointerId!==P.pointerId||!e)return;g.currentTarget.releasePointerCapture(g.pointerId),e.removeAttribute("data-resizing");let y=e.getBoundingClientRect();r({width:Math.round(y.width),height:Math.round(y.height)}),l.current=null};return i("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:p,onPointerMove:u,onPointerUp:m,onPointerCancel:m,"data-testid":R.resizeGrip,children:i(Gl,{})})}var _n=T.cssPrefix,Sf=`.${_n}-header, .${_n}-back-header, .${_n}-home-hero`,kf='button, a, input, textarea, select, [role="tab"], [contenteditable]',vc=56;function Sr(e,t){M(()=>{if(!t||!e)return;let n=c=>Number.parseFloat(c)||0,o=(c,d)=>Math.min(d,Math.max(-d,c)),r=null,a=c=>{let d=c.target;if(!(d instanceof Element)||!d.closest(Sf)||d.closest(kf))return;let _=e.getBoundingClientRect();r={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${_n}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${_n}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-vc,maxY:(window.innerHeight+_.height)/2-vc},e.dataset.dragging="true",c.preventDefault()},s=c=>{if(!r||c.pointerId!==r.id)return;let d=o(r.dx+c.clientX-r.x,r.maxX),_=o(r.dy+c.clientY-r.y,r.maxY);e.style.setProperty(`--${_n}-modal-dx`,`${d}px`),e.style.setProperty(`--${_n}-modal-dy`,`${_}px`)},l=c=>{!r||c.pointerId!==r.id||(r=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 On(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"popOut":return t!=="standalone"&&t!=="page";case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function kr(e,t,n){return On("close",e,t)?n.includes("close"):!1}function hc(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var wf='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function wr(e){let t=n=>{if(n.key!=="Tab")return;let o=[...e.querySelectorAll(wf)].filter(l=>l.offsetParent!==null||l===document.activeElement);if(o.length===0){n.preventDefault();return}let r=o[0],a=o[o.length-1];if(!r||!a)return;let s=e.getRootNode().activeElement;n.shiftKey&&s===r?(n.preventDefault(),a.focus()):!n.shiftKey&&s===a&&(n.preventDefault(),r.focus())};return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function Cr(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ja=T.cssPrefix;function bc({agent:e,strings:t}){let n=e.status??"online",o=lt(t,e.name),r=e.title?lt(t,e.title):null;return i("div",{class:`${Ja}-agent`,children:[i("div",{class:`${Ja}-agent-avatar`,"data-status":n,children:e.avatar?i("img",{src:e.avatar,alt:""}):i("span",{children:Cr(o)})}),i("div",{class:`${Ja}-agent-meta`,children:[i("strong",{children:o}),r?i("span",{children:r}):null]})]})}var yc=Z.scope("attachments");function Rr(e,t,n){let o=Rf(e),r=[],a=[],s=Ef(n.accept),l=t.reduce((d,_)=>d+_.size,0),c=t.length;for(let d of o){let _=Cf(d,c,l,n,s);if(_){a.push({file:d,reason:_});continue}r.push(If(d)),l+=d.size,c+=1}return(r.length||a.length)&&yc.debug("ingest",{accepted:r.length,rejected:a.map(d=>({name:d.file.name,reason:d.reason}))}),{accepted:r,rejected:a}}function Nn(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){yc.debug("revokeObjectURL failed",{error:t})}}function Cf(e,t,n,o,r){return t>=o.maxCount?"count":n+e.size>o.maxBytes?"bytes":Af(e,r)?null:"mime"}function Rf(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Tf(t)).filter(t=>t!==null):[]}function Tf(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function If(e){return{file:e,id:pt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function Ef(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 Af(e,t){if(t.length===0)return!0;let[n="*",o="*"]=(e.type||"").toLowerCase().split("/"),r=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?r.endsWith(a.ext):(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===o))}var go=T.cssPrefix;function Pc({attachment:e,onRemove:t,disabled:n=!1}){let o=e.mediaType.startsWith("image/");return i("span",{class:`${go}-attachment-chip`,title:e.name,"data-testid":Ye(R.attachmentChip,e.id),children:[o?i("img",{class:`${go}-attachment-thumb`,src:e.previewUrl,alt:""}):i("span",{class:`${go}-attachment-thumb`,"aria-hidden":"true",children:i(nc,{})}),i("span",{class:`${go}-attachment-name`,children:e.name}),i("button",{type:"button",class:`${go}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":Ye(R.attachmentRemove,e.id),children:i(St,{})})]})}var Za={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function ei(e,t,n){return e==="disabled"?Za:e==="server"?Nf(n):Mf(t)}function Mf(e){let t=Lf();if(!t)return Za;let n=null,o=0;return{isSupported:!0,start(r,a){let s=n,l=++o;n=null,s?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let d=!1;c.addEventListener("result",p=>{if(o!==l||n!==c)return;let u=p,m="",g=!1;for(let P=u.resultIndex;P<u.results.length;P++){let y=u.results[P];y&&(m+=y[0].transcript,y.isFinal&&(g=!0))}r(m,g)});let _=()=>{d||o!==l||n!==c||(d=!0,n=null,a())};c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){o++;let r=n;n=null,r?.abort()}}}function Lf(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Of=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Nf(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Za;let t=0,n=null,o=s=>{for(let l of s.stream?.getTracks()??[])l.stop();s.stream=null},r=()=>{t++;let s=n;n=null,s&&(o(s),s.recorder?.state!=="inactive"&&s.recorder?.stop())},a=async s=>{if(s.finishing)return;s.finishing=!0;let l=s.recorder?.mimeType??"audio/webm";o(s);let c=new Blob(s.chunks,{type:l});s.chunks=[];try{let{text:d}=await e(c,l);n===s&&t===s.generation&&d&&s.onText(d,!0)}catch{}finally{n===s&&t===s.generation&&(n=null,s.onEnd())}};return{isSupported:!0,async start(s,l){r();let c={generation:t,recorder:null,stream:null,chunks:[],onText:s,onEnd:l,finishing:!1};n=c;try{let d=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of d.getTracks())u.stop();return}c.stream=d;let _=Df(),p=new MediaRecorder(d,_?{mimeType:_}:void 0);c.recorder=p,p.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),p.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),p.start()}catch{o(c),n===c&&t===c.generation&&(n=null,l())}},stop(){let s=n;if(s){if(!s.recorder){r();return}s.recorder.state!=="inactive"&&s.recorder.stop()}},cancel(){r()}}}function Df(){for(let e of Of)if(MediaRecorder.isTypeSupported(e))return e}var He=T.cssPrefix,Dn=Z.scope("composer");function $n(e){return e.reduce((t,n)=>t+n.size,0)}var $f={arrowUp:$l,paperPlane:Dl,send:Fl,chevron:Ln};function xc(e){return"activeElement"in e}function Ff(e){return"host"in e&&"activeElement"in e}function Sc({options:e,transport:t,feedback:n,bus:o,persistence:r,conversationId:a,isStreaming:s,isMemoryCompacting:l=!1,canReleaseQueuedMessages:c=!0,queueManualMessages:d=!1,active:_=!0,isPreparing:p=!1,operatorRequestEnabled:u,canRequestOperator:m=!1,controlMode:g="ai-agent",onRequestOperator:P,onSend:y,onStop:w,apiRef:S}){let h=e.strings,[b,x]=$(()=>r.loadDraft(a)),[k,E]=$([]),[G,H]=$(()=>r.loadMessageQueue(a).map(I=>({id:I.id,text:I.text,attachments:[]}))),A=O(G),D=O(!1),[K,B]=$(!1),[ne,q]=$(!1),de=O(!1),re=O(null),qe=O(null),_e=O(null),Se=O(0),Ze=O(a);Ze.current=a;let Te=O(_);Te.current=_;let Ve=O(p);Ve.current=p;let Fe=ne||p||!_,rt=s&&g==="ai-agent",We=rt||l&&g==="ai-agent",tt=g==="ai-agent"&&(We||d||G.length>0),ct=L(I=>{H(W=>{let j=I(W);return r.saveMessageQueue(Ze.current,j.filter(le=>le.attachments.length===0).map(({id:le,text:je})=>({id:le,text:je}))),A.current=j,j})},[r]),we=L(I=>{ct(W=>(W.find(j=>j.id===I)?.attachments.forEach(Nn),W.filter(j=>j.id!==I)))},[ct]),Ie=L(I=>{x(W=>{let j=typeof I=="function"?I(W):I;return j===W?W:(r.saveDraft(Ze.current,j),j)})},[r]),dt=e.features.fileUpload,me=e.features.voice,[Le,Ke]=$(()=>ei(me,e.locale,(I,W)=>t.transcribe(I,W))),Ee=O(Le);Ee.current=Le;let at=O({mode:me,locale:e.locale,transport:t});M(()=>{let I=at.current;I.mode===me&&I.locale===e.locale&&I.transport===t||(at.current={mode:me,locale:e.locale,transport:t},Se.current++,Ee.current.cancel(),_e.current=null,B(!1),Ke(ei(me,e.locale,(W,j)=>t.transcribe(W,j))))},[e.locale,me,t]),M(()=>()=>{Se.current++,Le.cancel()},[Le]);let bt=L(I=>{let W=_e.current;if(W===null)return!1;let j=Math.round(performance.now()-W);return Dn[I]("voiceStop",{durationMs:j}),o.emit("voiceStop",{durationMs:j}),_e.current=null,!0},[o]),f=L(()=>{_e.current!==null&&(Le.stop(),B(!1),bt("info")&&n.play("voiceStop"))},[bt,n,Le]),N=L(()=>{Se.current++,Le.cancel(),B(!1),bt("info")&&n.play("voiceStop")},[bt,n,Le]);M(()=>{(p||!_)&&N()},[_,N,p]),M(()=>{let I=re.current;if(!I)return;let W=I.getRootNode(),j=xc(W)?W.activeElement:null;j&&I.closest(`.${He}-panel`)?.contains(j)||I.focus({preventScroll:!0})},[]),M(()=>{let I=re.current;if(!I)return;if(b.length===0){I.style.height="";return}I.style.height="auto";let W=getComputedStyle(I),j=Number.parseFloat(W.getPropertyValue(`--${He}-textarea-base-height`)),le=Number.parseFloat(W.borderTopWidth)+Number.parseFloat(W.borderBottomWidth),je=Math.min(I.scrollHeight+le,Number.parseFloat(W.maxHeight)),yt=Number.parseFloat(W.fontSize)*.7;I.style.height=`${je<j+yt?j:je}px`},[b]);let V=O(k);V.current=k,M(()=>()=>{V.current.forEach(Nn);for(let I of A.current)I.attachments.forEach(Nn)},[]),M(()=>{if(S)return S.current={attachFromDrop:I=>{if(!dt||!Te.current||de.current||Ve.current)return;let W=Rr(I,V.current,e.attachments);W.accepted.length!==0&&(Dn.info("attach (drop)",{count:W.accepted.length,totalBytes:$n(W.accepted)}),o.emit("attach",{count:W.accepted.length,totalBytes:$n(W.accepted)}),E(j=>[...j,...W.accepted]))},fill:I=>{if(!Te.current||de.current||Ve.current)return;Ie(I);let W=re.current;W&&(W.focus({preventScroll:!0}),requestAnimationFrame(()=>W.setSelectionRange(W.value.length,W.value.length)))},acceptQueuedMessage:we},()=>{S.current&&(S.current=null)}},[S,dt,p,e.attachments,we,Ie]),M(()=>{let I=re.current;if(!I)return;let W=I.closest(`.${He}-panel`);if(!W)return;let j=le=>{if(!Te.current||de.current||Ve.current)return;let je=le.clipboardData;if(!je)return;let yt=le.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(yt&&yt!==I)return;if(dt){let it=Rr(je.items,V.current,e.attachments);if(it.accepted.length>0){le.preventDefault(),Dn.info("attach (paste)",{count:it.accepted.length,totalBytes:$n(it.accepted)}),o.emit("attach",{count:it.accepted.length,totalBytes:$n(it.accepted)}),E(tn=>[...tn,...it.accepted]);return}}if(yt===I)return;let Tt=je.getData("text/plain");Tt&&(le.preventDefault(),Ie(it=>it+Tt),I.focus())};return W.addEventListener("paste",j),()=>W.removeEventListener("paste",j)},[dt,e.attachments,Ie]);let Q=async()=>{let I=b.trim();if(!I&&k.length===0||!_||rt||de.current||p)return;N(),de.current=!0,q(!0);let W=b,j=k;try{await y(I,j)&&(Ie(le=>le===W?"":le),E(le=>le!==j?le:(j.forEach(Nn),V.current=[],[])))}finally{de.current=!1,q(!1),requestAnimationFrame(()=>{let le=re.current;if(!le||le.disabled||!Te.current)return;let je=le.getRootNode(),yt=xc(je)?je.activeElement:null,Tt=yt?.getAttribute("data-testid");if(!(yt&&yt!==le&&Tt!==R.composerSend&&Tt!==R.composerStop)){if(Ff(je)){let it=je.host.ownerDocument;if(!it.hasFocus())return;let tn=it.activeElement;if(tn&&tn!==je.host&&tn!==it.body)return}le.focus({preventScroll:!0})}})}},ie=()=>{let I=b.trim();if(!I&&k.length===0||!_||!tt||de.current||p)return;N();let W=k;ct(j=>[...j,{id:pt(),text:I,attachments:W}]),Ie(""),E(j=>j!==W?j:(V.current=[],[])),re.current?.focus({preventScroll:!0})};M(()=>{We&&(D.current=!1)},[We]),M(()=>{let I=G[0];if(!I||!c||We||D.current||ne||p||!_)return;let W=setTimeout(()=>{D.current=!0,y(I.text,I.attachments,I.id).then(j=>{if(j){we(I.id);return}D.current=!1})},300);return()=>clearTimeout(W)},[_,c,p,y,We,G,we,ne]);let be=I=>{I.key!=="Enter"||I.shiftKey||I.isComposing||(I.preventDefault(),tt&&(b.trim()||k.length>0)?ie():rt?w():Q())},ye=I=>{let W=I.target;if(!_||de.current||p){W.value="";return}let j=Rr(W.files,k,e.attachments);j.accepted.length>0&&(Dn.info("attach (file picker)",{count:j.accepted.length,totalBytes:$n(j.accepted)}),o.emit("attach",{count:j.accepted.length,totalBytes:$n(j.accepted)}),E(le=>[...le,...j.accepted])),W.value=""},pe=I=>{!_||de.current||p||(Dn.info("removeAttachment",{id:I}),o.emit("removeAttachment",{id:I}),E(W=>{let j=W.find(le=>le.id===I);return j&&Nn(j),W.filter(le=>le.id!==I)}))},Ge=()=>{if(K){f();return}if(!_||!Le.isSupported||de.current||p)return;let I=++Se.current;_e.current=performance.now(),Dn.info("voiceStart"),o.emit("voiceStart",void 0),B(!0),n.play("voiceStart"),Le.start((W,j)=>{Se.current!==I||!Te.current||Ve.current||de.current||!j||Ie(le=>`${le}${W} `)},()=>{Se.current!==I||!Te.current||(B(!1),bt("debug"))})},se=$f[e.composer.sendButton.icon],nt=!!(b.trim()||k.length>0);return i("div",{class:`${He}-composer`,"data-testid":R.composer,children:[G.length>0?i("div",{class:`${He}-message-queue`,"aria-label":h.queueMessage,"data-testid":R.messageQueue,children:G.map(I=>i("div",{class:`${He}-attachment-chip ${He}-queued-message`,"data-testid":`${R.queuedMessage}-${I.id}`,children:[i("span",{class:`${He}-attachment-name ${He}-queued-text`,children:I.text||I.attachments.map(W=>W.name).join(", ")}),i("button",{type:"button",class:`${He}-attachment-remove`,onClick:()=>we(I.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${R.queuedMessageRemove}-${I.id}`,children:i(St,{})})]},I.id))}):null,k.length>0?i("div",{class:`${He}-attachments`,children:k.map(I=>i(Pc,{attachment:I,onRemove:()=>pe(I.id),disabled:Fe},I.id))}):null,i("div",{class:`${He}-composer-row`,children:[i("div",{class:`${He}-composer-actions`,children:[dt?i("button",{type:"button",class:`${He}-icon-btn`,onClick:()=>qe.current?.click(),disabled:Fe,"aria-label":h.attach,"data-testid":R.composerAttach,children:i(Ul,{})}):null,Le.isSupported?i("button",{type:"button",class:`${He}-icon-btn`,onClick:Ge,disabled:Fe,"aria-label":K?h.micStop:h.micStart,"aria-pressed":K,"data-recording":K?"true":void 0,"data-testid":R.composerVoice,children:i(Hl,{})}):null]}),i("textarea",{ref:re,name:"message",class:`${He}-textarea`,rows:1,value:b,placeholder:h.composerPlaceholder,onInput:I=>Ie(I.currentTarget.value),onKeyDown:be,disabled:Fe,"aria-label":h.composerPlaceholder,"data-testid":R.composerInput}),tt&&nt?i("button",{type:"button",class:`${He}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:ie,disabled:Fe,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":R.composerSend,children:i(se,{})}):null,rt?i("button",{type:"button",class:`${He}-send`,onClick:w,disabled:Fe,"aria-label":h.stop,"data-testid":R.composerStop,children:i(Bl,{})}):null,!rt&&(!tt||!nt)?i("button",{type:"button",class:`${He}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{Q()},disabled:Fe||!b.trim()&&k.length===0,"aria-label":h.send,"data-testid":R.composerSend,children:i(se,{})}):null,u&&g==="ai-agent"&&P?i("button",{type:"button",class:`${He}-icon-btn`,onClick:P,disabled:Fe||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":R.operatorRequest,children:i(Xa,{})}):null]}),i("input",{ref:qe,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:ye,disabled:Fe,class:`${He}-sr-only`,"data-testid":R.composerFileInput})]})}var Bf=T.cssPrefix;function kc({visible:e,strings:t}){return e?i("div",{class:`${Bf}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function Tr({containerRef:e,onDrop:t,disabled:n=!1}){let[o,r]=$(!1);return M(()=>{if(n){r(!1);return}let a=e.current;if(!a)return;let s=0,l=p=>{s+=1,p.dataTransfer?.types.includes("Files")&&(p.preventDefault(),r(!0))},c=()=>{s-=1,!(s>0)&&(s=0,r(!1))},d=p=>{p.dataTransfer?.types.includes("Files")&&p.preventDefault()},_=p=>{s=0,r(!1),p.dataTransfer&&(p.preventDefault(),t(p.dataTransfer.items))};return a.addEventListener("dragenter",l),a.addEventListener("dragleave",c),a.addEventListener("dragover",d),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",l),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",d),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:o}}function wc({itemCount:e,initialFocusIndex:t}){let[n,o]=$(!1),r=O(null),a=O(null),[s,l]=$(-1),c=L(()=>{o(!1),l(-1),r.current?.focus()},[]),d=L(()=>o(u=>!u),[]);M(()=>{if(!n)return;let u=m=>{let g=a.current,P=r.current;if(!g||!P)return;let y=m.composedPath();y.includes(g)||y.includes(P)||(o(!1),l(-1))};return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),M(()=>{if(!n||e===0)return;let u=t?.()??0,m=u<0||u>=e?0:u;l(m)},[n,e,t]),M(()=>{if(!n||s<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[s]?.focus()},[n,s]);let _=L(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),o(!0))},[]),p=L(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),l(m=>(m+1)%e);return;case"ArrowUp":u.preventDefault(),l(m=>(m-1+e)%e);return;case"Home":u.preventDefault(),l(0);return;case"End":u.preventDefault(),l(e-1)}},[e,c]);return{open:n,focusIndex:s,triggerRef:r,menuRef:a,toggle:d,close:c,onTriggerKey:_,onMenuKey:p}}function Cc({items:e,triggerLabel:t}){let n=T.cssPrefix,o=wc({itemCount:e.length}),r=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 _=Math.max(0,d.findIndex(u=>u.value===c.value)),p=-1;if(l.key==="ArrowRight"||l.key==="Enter"||l.key===" ")p=(_+1)%d.length;else if(l.key==="ArrowLeft")p=(_-1+d.length)%d.length;else return;l.preventDefault(),l.stopPropagation(),a(c,d[p].value)};return i("div",{class:`${n}-menu-wrap`,children:[i("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:i(jl,{})}),o.open?i("div",{ref:o.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:o.onMenuKey,tabIndex:-1,children:e.map(l=>l.segments?i("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?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),i("span",{class:`${n}-segmented`,role:"group","aria-label":l.label,children:l.segments.map(c=>{let d=c.value===l.value;return i("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":`${R.langSegment}-${c.value}`,onClick:()=>a(l,c.value),children:c.label},c.value)})})]},l.id):i("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":l.type==="switch"?l.on:void 0,disabled:l.disabled,onClick:()=>r(l),children:[l.icon?i("span",{class:`${n}-menu-icon`,children:l.icon}):null,i("span",{class:`${n}-menu-label`,children:l.label}),l.type==="switch"&&l.on?i("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:i(dn,{})}):null]},l.id))}):null]})}var ti=T.cssPrefix;function Uf(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 Hf={normal:"large",large:"small",small:"normal"};function zf(e){return e==="light"?i(ic,{}):e==="dark"?i(sc,{}):i(lc,{})}function qf(e){return(e.split("-")[0]??e).toUpperCase()}function Vf(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}if(!(n.protocol!=="http:"&&n.protocol!=="https:"))return t.conversationId&&n.searchParams.set("chat",t.conversationId),n.searchParams.set("widgetId",t.widgetId),t.publicKey&&n.searchParams.set("public_key",t.publicKey),n.searchParams.set("ai_agent_deployment_id",t.aiAgentDeploymentId),n.href}function Et({panelProps:e,variant:t}){let{options:n,panelSize:o,feedback:r,onClose:a,onClear:s,onExpand:l,onFullscreen:c,onSoundToggle:d}=e,{onToggleHistory:_,onLocaleChange:p,onThemeChange:u,onTextSizeChange:m}=e,g=n.strings,P=n.mode,y=t==="chat",w=ft(()=>r.mutedSig.value).value,S=new Set(n.actions),h=q=>S.has(q),b=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches,x=q=>b?!1:On(q,P,o),k=n.themeMode,E={auto:g.themeAuto,light:g.themeLight,dark:g.themeDark},G=n.textSize,H={small:g.textSizeSmall,normal:g.textSizeNormal,large:g.textSizeLarge},A=[];if(y&&h("clear")&&A.push({id:"clear",icon:i(tc,{}),label:g.newConversation,onSelect:s}),h("expand")&&x("expand")){let q=o==="expanded";A.push({id:"expand",icon:q?i(ql,{}):i(zl,{}),label:q?g.collapse:g.expand,type:"switch",on:q,onSelect:l})}if(h("fullscreen")&&x("fullscreen")){let q=o==="fullscreen";A.push({id:"fullscreen",icon:q?i(Wl,{}):i(Vl,{}),label:q?g.exitFullscreen:g.fullscreen,type:"switch",on:q,onSelect:c})}let D=n.popOutUrl,K=n.aiAgentDeploymentId;h("popOut")&&D&&K&&On("popOut",P,o)&&A.push({id:"popOut",icon:i(Kl,{}),label:g.popOut,onSelect:()=>{let q=Vf(D,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:K});q&&window.open(q,"_blank","noopener,noreferrer")}}),y&&h("sound")&&A.push({id:"sound",icon:w?i(Xl,{}):i(Ql,{}),label:w?g.soundOff:g.soundOn,type:"switch",on:!w,onSelect:d}),h("theme")&&A.push({id:"theme",icon:zf(k),label:`${g.theme}: ${E[k]}`,onSelect:()=>u(Uf(k)),keepOpen:!0}),h("textSize")&&A.push({id:"textSize",icon:i(Yl,{}),label:`${g.textSize}: ${H[G]}`,onSelect:()=>m(Hf[G]),keepOpen:!0}),h("language")&&n.availableLocales.length>1&&A.push({id:"language",icon:i(ec,{}),label:g.language,segments:n.availableLocales.map(q=>({value:q,label:qf(q),lang:q})),value:n.locale,onSelectValue:p});let B=!!a&&kr(P,o,n.actions),ne=y&&h("history");return i("div",{class:`${ti}-header-actions`,children:[ne?i("button",{type:"button",class:`${ti}-icon-btn`,onClick:_,"aria-label":g.history,title:g.history,"data-testid":R.actionHistory,children:i(Zl,{})}):null,A.length>0?i(Cc,{items:A,triggerLabel:g.moreActions}):null,B?i("button",{type:"button",class:`${ti}-icon-btn`,onClick:a,"aria-label":g.close,title:g.close,"data-testid":R.actionClose,children:i(St,{})}):null]})}var Wf=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Kf=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Gf=/^[+]?[\d\s().-]{6,}$/;function Fn(e,t){return e.replace(/\{(\w+)\}/g,(n,o)=>String(t[o]??`{${o}}`))}function jf(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function Qf(e,t,n){let o=e.required??!0,r=e.validation;if(e.type==="multiselect"){let s=jf(t);return o&&s===0?n.formRequired:s===0?void 0:r?.minSelections!=null&&s<r.minSelections?Fn(n.formChooseAtLeast,{min:r.minSelections}):r?.maxSelections!=null&&s>r.maxSelections?Fn(n.formChooseAtMost,{max:r.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return o?n.formRequired:void 0;switch(e.type){case"email":if(!Wf.test(a))return n.formInvalidEmail;break;case"url":if(!Kf.test(a))return n.formInvalidUrl;break;case"tel":if(!Gf.test(a))return n.formInvalidTel;break;case"number":{let s=Number(a);if(!Number.isFinite(s))return n.formInvalidNumber;if(r?.min!=null&&s<r.min)return Fn(n.formNumberTooSmall,{min:r.min});if(r?.max!=null&&s>r.max)return Fn(n.formNumberTooLarge,{max:r.max});break}default:break}if(r?.minLength!=null&&a.length<r.minLength)return Fn(n.formTooShort,{min:r.minLength});if(r?.maxLength!=null&&a.length>r.maxLength)return Fn(n.formTooLong,{max:r.maxLength});if(r?.pattern)try{if(!new RegExp(r.pattern).test(a))return n.formPatternMismatch}catch{}}function Rc(e,t,n){let o={};for(let r of e){let a=Qf(r,t[r.name],n);a&&(o[r.name]=a)}return o}function Tc(e){let t={};for(let[n,o]of Object.entries(e)){let r=Array.isArray(o)?o.join(", "):o;r.trim()&&(t[n]=r.trim())}return t}var Ce=T.cssPrefix,Ir="__other__";function vo({fields:e,strings:t,submitLabel:n,onSubmit:o,skipLabel:r,onSkip:a,footerHint:s,submitOnEnter:l,disabled:c,initialValues:d,hideActions:_,fieldTypeLabels:p,rootTestId:u,submitTestId:m,skipTestId:g}){let[P,y]=$(()=>({...Zf(e),...d})),[w,S]=$({}),[h,b]=$({}),x=A=>{h[A]&&b(D=>({...D,[A]:""}))},k=(A,D)=>{y(K=>({...K,[A]:D})),x(A)},E=(A,D)=>{S(K=>({...K,[A]:D})),x(A)},G=A=>{if(A.preventDefault(),c)return;let D=em(e,P,w),K=Rc(e,D,t);if(Object.keys(K).length>0){b(K);return}o(Tc(D))},H=A=>{!l||A.key!=="Enter"||A.shiftKey||A.isComposing||A.target?.tagName==="TEXTAREA"&&G(A)};return i("form",{class:`${Ce}-form`,onSubmit:G,onKeyDown:H,"data-testid":u,noValidate:!0,children:[e.map(A=>i(Xf,{field:A,value:P[A.name],otherText:w[A.name]??"",error:h[A.name],disabled:c,typeLabel:p?.[A.name],strings:t,onChange:D=>k(A.name,D),onOtherChange:D=>E(A.name,D)},A.name)),_?null:i("div",{class:`${Ce}-form-actions`,children:[s?i("span",{class:`${Ce}-form-hint`,children:s}):null,r&&a?i("button",{type:"button",class:`${Ce}-form-skip`,onClick:a,disabled:c,"data-testid":g,children:r}):null,i("button",{type:"submit",class:`${Ce}-form-submit`,disabled:c,"data-testid":m,children:n})]})]})}function Xf({field:e,value:t,otherText:n,error:o,disabled:r,typeLabel:a,strings:s,onChange:l,onOtherChange:c}){let d=Ye(R.formField,e.name),_=Yf({field:e,value:t,otherText:n,disabled:r,strings:s,onChange:l,onOtherChange:c,fieldTid:d});return i("label",{class:`${Ce}-field`,"data-field":e.name,"data-invalid":o?"true":void 0,children:[i("span",{class:`${Ce}-field-head`,children:[i("span",{class:`${Ce}-field-label`,children:[e.label,e.required??!0?i("span",{class:`${Ce}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?i("span",{class:`${Ce}-field-type`,children:a}):null]}),_,e.validationHint&&!o?i("span",{class:`${Ce}-field-hint`,children:e.validationHint}):null,o?i("span",{class:`${Ce}-field-error`,role:"alert",children:o}):null]})}function Yf(e){let{field:t,value:n,otherText:o,disabled:r,strings:a,onChange:s,onOtherChange:l,fieldTid:c}=e,d=typeof n=="string"?n:"";switch(t.type){case"textarea":return i("textarea",{class:`${Ce}-field-input`,rows:3,value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c});case"select":return i("select",{class:`${Ce}-field-input`,value:d,disabled:r,onChange:_=>s(_.target.value),"data-testid":c,children:[i("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>i("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&d===Ir;return i("div",{class:`${Ce}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>i("label",{class:`${Ce}-choice`,children:[i("input",{type:"radio",name:`${Ce}-${t.name}`,checked:d===p.value,disabled:r,onChange:()=>s(p.value)}),i("span",{children:p.label??p.value})]},p.value)),t.allowOther?i("label",{class:`${Ce}-choice`,children:[i("input",{type:"radio",name:`${Ce}-${t.name}`,checked:d===Ir,disabled:r,onChange:()=>s(Ir)}),i("span",{children:a.formOther})]}):null,_?i("input",{class:`${Ce}-field-input`,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:p=>l(p.target.value)}):null]})}case"checkbox":return i("label",{class:`${Ce}-choice`,children:[i("input",{type:"checkbox",checked:d==="true",disabled:r,onChange:_=>s(_.target.checked?"true":""),"data-testid":c}),i("span",{children:t.placeholder??t.label})]});case"multiselect":{let _=Array.isArray(n)?n:[],p=(u,m)=>s(m?[..._,u]:_.filter(g=>g!==u));return i("div",{class:`${Ce}-field-choices`,"data-testid":c,children:[(t.options??[]).map(u=>i("label",{class:`${Ce}-choice`,children:[i("input",{type:"checkbox",checked:_.includes(u.value),disabled:r,onChange:m=>p(u.value,m.target.checked)}),i("span",{children:u.label??u.value})]},u.value)),t.allowOther||(t.options??[]).length===0?i("textarea",{class:`${Ce}-field-input`,rows:2,value:o,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:r,onInput:u=>l(u.target.value)}):null]})}default:return i("input",{class:`${Ce}-field-input`,type:Jf(t.type),value:d,placeholder:t.placeholder,disabled:r,onInput:_=>s(_.target.value),"data-testid":c})}}function Jf(e){switch(e){case"number":case"email":case"tel":case"url":case"date":case"time":return e;default:return"text"}}function Zf(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 em(e,t,n){let o={...t};for(let r of e){let a=n[r.name]?.trim();if(r.type==="radio"&&r.allowOther&&t[r.name]===Ir)o[r.name]=a??"";else if(r.type==="multiselect"&&a){let s=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),l=Array.isArray(t[r.name])?t[r.name]:[];o[r.name]=[...l,...s]}}return o}var At=T.cssPrefix;function ni({form:e,strings:t,onSubmit:n,onSkip:o}){return i("div",{class:`${At}-form-gate`,"data-testid":R.formGate,children:[e.title?i("h3",{class:`${At}-form-gate-title`,children:e.title}):null,e.description?i("p",{class:`${At}-form-gate-desc`,children:e.description}):null,i(vo,{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:R.formSubmit,skipTestId:R.formSkip})]})}function Ic({marker:e,strings:t,onFill:n}){let o=e.outcome==="skipped",r=o?t.formSkipped:t.formSubmitted,a=e.title?i(fe,{children:[i("span",{children:e.title}),i("span",{class:`${At}-sr-only`,children:r})]}):i("span",{children:r}),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(_=>_.name===d)?.label??d;return i("details",{class:`${At}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,children:[i("summary",{class:`${At}-form-done-summary`,"data-testid":R.formDoneToggle,children:[i(dn,{}),a,i(Ln,{})]}),i("dl",{class:`${At}-form-answers`,"data-testid":R.formAnswers,children:Object.entries(l).map(([d,_])=>i("div",{class:`${At}-form-answer`,children:[i("dt",{children:c(d)}),i("dd",{children:_})]},d))})]})}return i("div",{class:`${At}-form-done`,"data-outcome":e.outcome,"data-testid":R.formDone,role:"status",children:[o?i(Jl,{}):i(dn,{}),a,o&&e.form?.reopenable&&n?i("button",{type:"button",class:`${At}-form-done-fill`,"data-testid":R.formFill,onClick:n,children:t.formFillOut}):null]})}function om(e,t){for(var n in t)e[n]=t[n];return e}function ri(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var o in t)if(o!=="__source"&&e[o]!==t[o])return!0;return!1}function Ec(e,t){this.props=e,this.context=t}function Fc(e,t){function n(r){var a=this.props.ref;return a!=r.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,r)||a!=r.ref:ri(this.props,r)}function o(r){return this.shouldComponentUpdate=n,Nt(e,r)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o}(Ec.prototype=new _t).isPureReactComponent=!0,Ec.prototype.shouldComponentUpdate=function(e,t){return ri(this.props,e)||ri(this.state,t)};var Ac=J.__b;J.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Ac&&Ac(e)};var rP=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var rm=J.__e;J.__e=function(e,t,n,o){if(e.then){for(var r,a=t;a=a.__;)if((r=a.__c)&&r.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k||[]),r.__c(e,t)}rm(e,t,n,o)};var Mc=J.unmount;function Bc(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(o){typeof o.__c=="function"&&o.__c()}),e.__c.__H=null),(e=om({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(o){return Bc(o,t,n)})),e}function Uc(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(o){return Uc(o,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function oi(){this.__u=0,this.o=null,this.__b=null}function Hc(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Er(){this.i=null,this.l=null}J.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Mc&&Mc(e)},(oi.prototype=new _t).__c=function(e,t){var n=t.__c,o=this;o.o==null&&(o.o=[]),o.o.push(n);var r=Hc(o.__v),a=!1,s=function(){a||o.__z||(a=!0,n.__R=null,r?r(c):c())};n.__R=s;var l=n.__P;n.__P=null;var c=function(){if(!--o.__u){if(o.state.__a){var d=o.state.__a;o.__v.__k[0]=Uc(d,d.__c.__P,d.__c.__O)}var _;for(o.setState({__a:o.__b=null});_=o.o.pop();)_.__P=l,_.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(s,s)},oi.prototype.componentWillUnmount=function(){this.o=[]},oi.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Bc(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&Nt(fe,null,e.fallback);return r&&(r.__u&=-33),[Nt(fe,null,t.__a?null:e.children),r]};var Lc=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};(Er.prototype=new _t).__a=function(e){var t=this,n=Hc(t.__v),o=t.l.get(e);return o[0]++,function(r){var a=function(){t.props.revealOrder?(o.push(r),Lc(t,e,o)):r()};n?n(a):a()}},Er.prototype.render=function(e){this.i=null,this.l=new Map;var t=Yn(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Er.prototype.componentDidUpdate=Er.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Lc(e,n,t)})};var am=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,im=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,sm=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,lm=/[A-Z0-9]/g,cm=typeof document<"u",dm=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};_t.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(_t.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Oc=J.event;J.event=function(e){return Oc&&(e=Oc(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var zc,um={configurable:!0,get:function(){return this.class}},Nc=J.vnode;J.vnode=function(e){typeof e.type=="string"&&(function(t){var n=t.props,o=t.type,r={},a=o.indexOf("-")==-1;for(var s in n){var l=n[s];if(!(s==="value"&&"defaultValue"in n&&l==null||cm&&s==="children"&&o==="noscript"||s==="class"||s==="className")){var c=s.toLowerCase();s==="defaultValue"&&"value"in n&&n.value==null?s="value":s==="download"&&l===!0?l="":c==="translate"&&l==="no"?l=!1:c[0]==="o"&&c[1]==="n"?c==="ondoubleclick"?s="ondblclick":c!=="onchange"||o!=="input"&&o!=="textarea"||dm(n.type)?c==="onfocus"?s="onfocusin":c==="onblur"?s="onfocusout":sm.test(s)&&(s=c):c=s="oninput":a&&im.test(s)?s=s.replace(lm,"-$&").toLowerCase():l===null&&(l=void 0),c==="oninput"&&r[s=c]&&(s="oninputCapture"),r[s]=l}}o=="select"&&(r.multiple&&Array.isArray(r.value)&&(r.value=Yn(n.children).forEach(function(d){d.props.selected=r.value.indexOf(d.props.value)!=-1})),r.defaultValue!=null&&(r.value=Yn(n.children).forEach(function(d){d.props.selected=r.multiple?r.defaultValue.indexOf(d.props.value)!=-1:r.defaultValue==d.props.value}))),n.class&&!n.className?(r.class=n.class,Object.defineProperty(r,"className",um)):n.className&&(r.class=r.className=n.className),t.props=r})(e),e.$$typeof=am,Nc&&Nc(e)};var Dc=J.__r;J.__r=function(e){Dc&&Dc(e),zc=e.__c};var $c=J.diffed;J.diffed=function(e){$c&&$c(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),zc=null};function Ar(e){return e?(e.startsWith("tool:")?e.slice(5):e)==="ask-user-questions":!1}var kt=T.cssPrefix;function ii(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function Mr(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",o=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:o,decided:n||o}}function si({status:e,icon:t,label:n}){return i("span",{class:`${kt}-toolui-badge ${kt}-toolui-status`,"data-status":e,children:[i("span",{class:`${kt}-toolui-status-icon`,children:t}),n]})}function _m(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function li(e,t,n={}){return n.submitted?"responded":mm(_m(e,t),n.superseded,n.live??!0)}function pm({status:e}){return e==="denied"||e==="error"||e==="superseded"?i(yr,{}):e==="completed"||e==="responded"?i(br,{}):i(pc,{})}function fm(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function mm(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function gm({state:e,approval:t,strings:n,superseded:o,live:r=!0,submitted:a=!1}){let s=li(e,t,{superseded:o,live:r,submitted:a});return i(si,{status:s,icon:i(pm,{status:s}),label:fm(s,n)})}function vm({name:e,state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}){return i(fe,{children:[i("span",{class:`${kt}-toolui-name-pill`,children:[i(_c,{}),i("span",{class:`${kt}-toolui-name-text`,children:e})]}),i(gm,{state:t,approval:n,strings:o,superseded:r,live:a,submitted:s}),i("span",{class:`${kt}-toolui-chevron`,children:i(un,{})})]})}function Lr({part:e,strings:t,testid:n,superseded:o,live:r,submitted:a}){let s=oe(()=>ge(()=>e.inputSig.value),[e]),l=oe(()=>ge(()=>e.outputSig.value),[e]),c=oe(()=>ge(()=>e.errorSig.value),[e]),d=oe(()=>ge(()=>e.stateSig.value),[e]),_=oe(()=>ge(()=>e.approvalSig.value),[e]);return i("details",{class:`${kt}-toolui ${kt}-toolui-collapsible`,"data-testid":n,children:[i("summary",{class:`${kt}-toolui-head`,children:i(vm,{name:ii(e.toolName),state:d.value,approval:_.value,strings:t,superseded:o,live:r,submitted:a})}),i(ai,{label:t.toolParameters,value:s.value}),l.value!==void 0?i(ai,{label:t.toolResult,value:l.value}):null,c.value?i(ai,{label:t.statusError,value:c.value,error:!0}):null]})}function ai({label:e,value:t,error:n}){let o=n?typeof t=="string"?t:"":Or(ci(t));return o?i("div",{class:`${kt}-toolui-section`,children:[i("span",{class:`${kt}-toolui-label`,children:e}),i("pre",{class:`${kt}-toolui-code`,"data-error":n?"true":void 0,children:o})]}):null}function ci(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function Or(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function qc(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function Vc(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function hm(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function Wc(e){let{streaming:t,reasoningVisible:n,emptyReply:o,hidden:r}=e,a=e.responseMode==="buffered"&&t,s=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:s,showStreamDots:hm({streaming:t,bufferedHold:a,reasoningVisible:n,working:s}),emptyReply:o,hidden:r}}function Kc(e,t){let n=e.stateSig.value,o=e.approvalSig.value,{terminal:r,responded:a,decided:s}=Mr(n,o),l=t.continuationStreaming===!0&&!s,c=t.superseded&&!s&&!l;return{pill:li(n,o,{superseded:c,live:t.live,submitted:l}),state:n,terminal:r,decided:s||l,showApproveReject:!s&&!t.superseded&&!l,showAnswered:a&&!r&&!c,showSubmitted:l,showEdit:a&&t.active&&!r,skipped:c,answeredApproved:o?.approved}}var _i=1,jc=2,Qc=4,Xc=8,Yc=16;function bm(e){switch(e){case _i:return"href";case jc:return"src";case Qc:return"class";case Xc:return"checked";case Yc:return"start"}}var ym=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}},Pm=ym;var Gc=24;function fi(e){let t=new Uint32Array(Gc);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(Gc),indent:"",indent_len:0,table_state:0}}function Jc(e){e.pending.length>0&&et(e,`
|
|
12
|
-
`)}function
|
|
13
|
-
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){
|
|
14
|
-
`:if(e.hr_chars<3)break;
|
|
15
|
-
`:{
|
|
16
|
-
`:e.table_state=2,e.pending="";continue;default:
|
|
17
|
-
`:
|
|
18
|
-
`:
|
|
10
|
+
`))!==-1;){let s=r.slice(0,a);r=r.slice(a+2),yield s}}}finally{n.releaseLock()}}function zf(e,t){let n="",r;for(let o of e.split(`
|
|
11
|
+
`))if(o!==""){if(o.startsWith(":")){t?.(o.slice(1).trim());continue}if(o.startsWith("data:")){let i=o.slice(5).replace(/^ /,"");n=n?`${n}
|
|
12
|
+
${i}`:i;continue}o.startsWith("id:")&&(r=o.slice(3).trim())}if(n==="[DONE]")return"done";if(!n)return null;try{let o=JSON.parse(n);return Xl.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw Xl.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new at("invalid SSE frame","network",void 0,o)}}function qf(e){let t=new TextEncoder().encode(e),n="";for(let r of t)n+=String.fromCharCode(r);return btoa(n).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,"")}function Zl(e){return e&&Object.keys(e).length>0?e:void 0}function ec(e,t){let n=Zl(e),r=Zl(t);if(!n&&!r)return;let o={};return n&&(o.user=n),r&&(o.page=r),qf(JSON.stringify(o))}function tc(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function Hf(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function nc(e){return e.startsWith("tool-")?e.slice(5):e}var bt={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",messageFeedback:"/pai/message-feedback",requestOperator:"/pai/request-operator",cancelOperatorRequest:"/pai/cancel-request-operator",bootstrap:"/pai/bootstrap",content:"/pai/content",submitForm:"/pai/submit-form"},rc="context";function Co(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function oc(e){if(!Co(e))return;let t=e,n=t.controlMode,r=t.controlRevision;if(!(n!=="ai-agent"&&n!=="awaiting-operator"&&n!=="operator"||typeof r!="number"||!Number.isSafeInteger(r)||r<0))return{controlMode:n,controlRevision:r,assignedOperatorInitials:typeof t.assignedOperatorInitials=="string"&&t.assignedOperatorInitials?t.assignedOperatorInitials:void 0,operatorAvailable:typeof t.operatorAvailable=="boolean"?t.operatorAvailable:void 0}}function ac(e){if(!Co(e))return;let t=e.status,n=e.postFinishSequence;if(!(t!=="compacting"&&t!=="ready"||typeof n!="number"||!Number.isSafeInteger(n)||n<0))return{status:t,postFinishSequence:n}}function Ro(e){let t=Co(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Co(r))continue;let{id:o,label:i,text:a}=r;typeof i!="string"||!i||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:i,text:typeof a=="string"&&a?a:i})}return n}function hi(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:jf(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),n}function Vf(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function jf(e){let t=[];for(let n of e.parts)if(n.kind==="step-start"&&t.push({type:"step-start"}),n.kind==="reasoning"&&n.text&&t.push({type:"reasoning",text:n.text,state:n.done?"done":"streaming"}),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"&&Vf(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:Hf(n.toolName),toolCallId:n.toolCallId,state:n.state};n.input!==void 0&&(r.input=n.input),n.output!==void 0&&(r.output=n.output),n.error!==void 0&&(r.errorText=n.error),n.approval?.approved!==void 0&&(r.approval=n.approval),t.push(r)}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 He=le.scope("transport"),Wf=6e4,Gf=1e4,yi=50,dc=new WeakMap;function Un(e){return dc.get(e)}function hr(e,t){return dc.set(e,t),e}function ic(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Kf(e,t){return e.conversationId===t.conversationId&&e.title===t.title&&e.lastMessageAt===t.lastMessageAt&&e.preview===t.preview&&e.canContinue===t.canContinue&&e.hasUnread===t.hasUnread&&e.controlState===t.controlState}function zt(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(a=>[a.conversationId,a])),o=e.filter(a=>(Un(a)?.activityRevision??0)>t.requestedRevision).toSorted((a,s)=>Un(s).activityRevision-Un(a).activityRevision),i=new Set(o.map(a=>a.conversationId));return[...o,...t.result.conversations.filter(a=>!i.has(a.conversationId)).map(a=>{let s=r.get(a.conversationId);if(!s)return a;let c=Un(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===a.lastMessageAt?hr({...a,hasUnread:!1},{upsertRevision:0,read:c.read}):a})]}case"read":{let r=e.findIndex(c=>c.conversationId===t.conversationId&&(t.lastMessageAt===void 0||c.lastMessageAt===t.lastMessageAt));if(r<0)return e;let o=e[r],i=Un(o);if(ic(i)>t.revision)return e;let a=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:i?.upsertRevision??0,...i?.activityRevision===void 0?{}:{activityRevision:i.activityRevision},read:{revision:t.revision,...a?{lastMessageAt:a}:{}}};return o.hasUnread?e.map((c,u)=>u===r?hr({...c,hasUnread:!1},s):c):(hr(o,s),e)}case"upsert":{let r=e.findIndex(u=>u.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],i=o?Un(o):void 0;if(ic(i)>t.revision)return e;let a=t.activity?t.revision:i?.activityRevision,s={upsertRevision:t.revision,...a===void 0?{}:{activityRevision:a},...!t.conversation.hasUnread&&i?.read?{read:i.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&Kf(o,c)?(hr(o,s),e):(hr(c,s),t.activity?[c,...e.filter(u=>u.conversationId!==c.conversationId)]:o?e.map((u,d)=>d===r?c:u):[...e,c])}default:return t}}var sc=3,Qf=400,Yf=3e4,Xf=1e4,Jf=6e4,Zf=15e3,em=1024*1024,lc=new Set([408,425,429,500,502,503,504]);function cc(e){return Qf*2**e+Math.floor(Math.random()*250)}function tm(e){return Jf+Math.ceil(e/em)*Zf}function nm(e){let t=e.get("retry-after");if(!t)return null;let n=Number(t),r=Number.isFinite(n)?n*1e3:Date.parse(t)-Date.now();return Number.isFinite(r)&&r>=0?Math.min(r,3e4):null}var Io=class{constructor(t){ve(this,"ttlMs",t);ve(this,"map",new Map)}getOrFetch(t,n){let r=this.map.get(t);if(r&&performance.now()-r.at<this.ttlMs)return r.result;let o={at:performance.now(),result:n().then(i=>(o.value=i,i)).catch(i=>{throw this.map.get(t)===o&&this.map.delete(t),i})};return this.map.set(t,o),o.result}peek(t){let n=this.map.get(t);if(n?.value!==void 0&&performance.now()-n.at<this.ttlMs)return n.value}update(t){for(let n of this.map.values()){if(n.value!==void 0){let r=t(n.value);n.value=r,n.result=Promise.resolve(r);continue}n.result=n.result.then(r=>{let o=t(r);return n.value=o,o})}}delete(t){this.map.delete(t)}},To=class{constructor(t){ve(this,"opts",t);ve(this,"conversationListeners",new Set);ve(this,"conversationRevision",0);ve(this,"visitorId");ve(this,"conversationId");ve(this,"userContext");ve(this,"pageContext");ve(this,"locale");ve(this,"conversationsCache",new Io(Gf));ve(this,"contentCache",new Io(Wf))}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={_ev:En};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=ec(this.userContext,this.pageContext);return n&&(t[rc]=n),t}withEnvelope(t){return{...this.envelope(),...t}}appendEnvelope(t){for(let[n,r]of Object.entries(this.envelope()))t.append(n,r);return t}withEnvelopeQuery(t){let n=new URL(this.url(t));for(let[r,o]of Object.entries(this.envelope()))n.searchParams.has(r)||n.searchParams.set(r,o);return n.toString()}async handshake(t){He.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale});let n=await this.postJson(bt.handshake,t,"handshake");return He.debug("handshake \u2190",{visitorId:n.visitorId,conversationId:n.conversationId,hasWelcome:!!n.welcome,hasConfig:!!n.config,rebind:n.rebind}),this.visitorId=t.visitorId,this.conversationId=n.conversationId,n}async uploadFile(t,n){He.debug("uploadFile \u2192",{name:t.name,size:t.size,type:t.type});let r=new FormData;r.append("file",t,t.name);let o=await this.postForm(this.uploadPath,r,"upload",n,tm(t.size));return He.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){He.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${rm(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return He.debug("transcribe \u2190",{textLen:o.text.length}),o}subscribeConversationChanges(t){return this.conversationListeners.add(t),()=>this.conversationListeners.delete(t)}publishConversation(t,n=!1){let r={type:"upsert",conversation:t,revision:++this.conversationRevision,...n?{activity:!0}:{}};this.conversationsCache.update(o=>{let i=o.pagination.page===1,a=o.conversations.some(_=>_.conversationId===t.conversationId),s=zt(o.conversations,r,i&&n),c=i&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!i||!n||a||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let u=Math.max(o.pagination.total,o.conversations.length)+1,d=Math.ceil(u/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:u,totalPages:d,hasNext:o.pagination.page<d}}});for(let o of this.conversationListeners)o(r)}localeCacheKey(t){return`${this.locale??""}|${JSON.stringify(t,Object.keys(t).toSorted())}`}peekConversations(t={}){return this.conversationsCache.peek(this.localeCacheKey(t))}listConversations(t={},n=!1){if((t.page??1)>1)return this.fetchConversations(t);let r=this.localeCacheKey(t),o=this.conversationRevision;n&&this.conversationsCache.delete(r);let i=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?i.then(a=>{let s={type:"snapshot",result:a,requestedRevision:o};for(let c of this.conversationListeners)c(s);return a}):i}async fetchConversations(t){let n=new URL(this.url(bt.listConversations));return t.visitorId&&n.searchParams.set("visitorId",t.visitorId),t.page&&n.searchParams.set("page",String(t.page)),t.limit&&n.searchParams.set("limit",String(t.limit)),t.ids?.length&&n.searchParams.set("ids",t.ids.join(",")),this.getJson(n.toString(),"listConversations")}async loadConversation(t,{ids:n=[],beforeId:r,beforeCreatedAt:o}={}){let i=new URL(this.url(bt.listMessages));i.searchParams.set("conversationId",t),i.searchParams.set("limit",String(yi)),n.length>0&&i.searchParams.set("ids",n.join(",")),r&&i.searchParams.set("beforeId",r),o&&i.searchParams.set("beforeCreatedAt",o);let a=await this.getJson(i.toString(),"loadConversation");return{...a,messages:a.messages.toReversed()}}async markRead(t,n){if(!this.visitorId||!t)return;let r={type:"read",conversationId:t,...n===void 0?{}:{lastMessageAt:n},revision:++this.conversationRevision};this.conversationsCache.update(o=>{let i=zt(o.conversations,r);return i===o.conversations?o:{...o,conversations:i}});for(let o of this.conversationListeners)o(r);try{await this.postJson(bt.markRead,{conversationId:t},"markRead",!0)}catch(o){He.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(bt.requestOperator,{},"requestOperator")).controlState}catch(t){He.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(bt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){He.debug("cancelOperatorRequest failed (non-fatal)",{err:t});return}}listContent(t={}){return this.contentCache.getOrFetch(this.localeCacheKey(t),()=>this.fetchContent(t))}async fetchContent(t){let n=new URL(this.dataUrl(bt.content));for(let[i,a]of Object.entries(t))a!==void 0&&n.searchParams.set(i,Array.isArray(a)?a.join(","):String(a));let r=await this.getJson(n.toString(),"listContent"),o=(r.items??[]).map(i=>Js(i,this.locale));return{...r,items:o}}async bootstrap(t){let n=new URL(this.dataUrl(bt.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],i=r.formSubmissions??[];return{forms:o,formSubmissions:i}}async saveUserPrefs(t){return this.postJson(bt.updateSettings,{userPrefs:t},"saveUserPrefs")}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??bt.submitForm}async submitForm(t){He.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){He.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){He.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(bt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){He.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t){He.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});try{return await this.runWithAbort(async n=>{let r=await this.fetchImpl(this.url(bt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope(t)),signal:n});if(r.status!==202)throw new at(`sendTurn failed: expected 202, received ${r.status}`,"server",r.status);let o;try{o=await r.json()}catch(i){throw n?.aborted?i:new at("sendTurn failed: invalid acknowledgement","server",r.status,i)}if(!om(o))throw new at("sendTurn failed: invalid acknowledgement","server",r.status);return o},void 0,Yf)}catch(n){throw n instanceof at?n:new at("sendTurn failed: network error","network",void 0,n)}}cancelTurn(t,n){!this.visitorId||!t||!n||(He.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(bt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.opts.auth.headers()},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>He.debug("cancel POST failed (non-fatal)",{err:r})))}async connectResumeStream(t){let n=new AbortController;function r(){return n.abort(t.signal.reason)}t.signal.aborted?r():t.signal.addEventListener("abort",r,{once:!0});let o=setTimeout(()=>n.abort(),Xf);function i(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let a;try{a=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.opts.auth.headers()},signal:n.signal})}catch(c){return i(),t.signal.aborted||He.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!a.ok)return i(),a.status===409||lc.has(a.status)?(He.debug("resume-stream \u2192 transient response; reconnecting",{status:a.status}),"held"):(He.debug("resume-stream \u2192 endpoint unavailable",{status:a.status}),"unavailable");if(!a.body)return i(),He.debug("resume-stream \u2192 bodyless response; stopping",{status:a.status}),"unavailable";if(!(a.headers.get("content-type")??"").includes("text/event-stream"))return i(),He.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of Jl(a,n.signal,u=>{s||u!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";He.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{i()}return"held"}resumeUrl(){return this.withEnvelopeQuery(bt.streamResume)}async postJson(t,n,r,o=!1){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?{keepalive:!0}:{}}],r);return this.assertOk(i,r)}async postForm(t,n,r,o,i){return this.runWithAbort(async a=>{let s=await this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.opts.auth.headers(),body:this.appendEnvelope(n),signal:a});return this.assertOk(s,r)},o,i)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function i(){return o.abort(n?.reason)}n?.aborted?i():n?.addEventListener("abort",i,{once:!0});let a=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{a!==void 0&&clearTimeout(a),n?.removeEventListener("abort",i)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.opts.auth.headers()}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let[o,i]=t(),a;try{a=await this.fetchImpl(o,i)}catch(c){if(r>=sc)throw new at(`${n} failed: network error`,"network",void 0,c);He.debug("request network error \u2014 retrying",{label:n,attempt:r}),await vr(cc(r));continue}if(a.ok||!lc.has(a.status)||r>=sc)return a;let s=nm(a.headers)??cc(r);He.debug("request retryable status \u2014 retrying",{label:n,status:a.status,attempt:r,wait:s}),await vr(s)}}async assertOk(t,n){if(!t.ok)throw new at(`${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 rm(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 om(e){if(typeof e!="object"||e===null)return!1;let t=Reflect.get(e,"status"),n=Reflect.get(e,"conversationId"),r=Reflect.get(e,"runId");return t==="accepted"&&typeof n=="string"&&n.length>0&&(r===void 0||typeof r=="string"&&r.length>0)}var am=0;function l(e,t,n,r,o,i){t||(t={});var a,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?a=t[s]:c[s]=t[s];var u={type:e,props:c,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--am,__i:-1,__u:0};return(o||i)&&(u.__source=o,u.__self=i),be.vnode&&be.vnode(u),u}var Si=1,pc=2,br=4,_c=8,fc=16;function im(e){switch(e){case Si:return"href";case pc:return"src";case br:return"class";case _c:return"checked";case fc:return"start"}}var sm=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}},lm=sm;var uc=24;function yr(e){let t=new Uint32Array(uc);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(uc),indent:"",indent_len:0,table_state:0}}function Eo(e){e.pending.length>0&&et(e,`
|
|
13
|
+
`)}function Ie(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 Ge(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 Te(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&Ge(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function cm(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function un(e,t){for(e.fence_start=0;e.len>t;)Ge(e)}function Ao(e,t){let n=0;for(let r=0;r<=e.len&&(t-=e.spaces[r],!(t<0));r+=1)switch(e.tokens[r]){case 9:case 10:case 20:case 25:n=r;break}for(;e.len>n;)Ge(e);return t}function Pi(e,t){let n=-1,r=-1;for(let o=e.blockquote_idx+1;o<=e.len;o+=1)if(e.tokens[o]===25){if(e.indent_len<e.spaces[o]){r=-1;break}r=o}else e.tokens[o]===t&&(n=o);return r===-1?n===-1?(un(e,e.blockquote_idx),Te(e,t),!0):(un(e,n),!1):(un(e,r),Te(e,t),!0)}function xi(e,t){Te(e,25),e.spaces[e.len]=e.indent_len+t,qt(e),e.token=103}function qt(e){e.indent="",e.indent_len=0,e.pending=""}function ki(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 dm(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 um(e){return ki(e)||dm(e)}function et(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 o=Ao(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&et(e," ".repeat(o))}let r=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`
|
|
14
|
+
`:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){Ge(e),qt(e),e.pending=n;continue}un(e,e.blockquote_idx),qt(e),e.blockquote_idx=0,e.fence_start=0,e.pending=n;continue;case"#":switch(n){case"#":if(e.pending.length<6){e.pending=r;continue}break;case" ":Ao(e,e.indent_len),Te(e,lm(e.pending.length)),qt(e);continue}break;case">":{let i=cm(e,20,e.blockquote_idx+1);i===-1?(un(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Te(e,20)):e.blockquote_idx=i,qt(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=r;continue;case" ":e.pending=r;continue;case`
|
|
15
|
+
`:if(e.hr_chars<3)break;Ao(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),qt(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){Pi(e,23),xi(e,2),et(e,r.slice(2));continue}break;case"`":if(e.pending.length<3){if(n==="`"){e.pending=r,e.fence_start=r.length;continue}e.fence_start=0;break}switch(n){case"`":e.pending.length===e.fence_start?(e.pending=r,e.fence_start=r.length):(Te(e,2),qt(e),e.fence_start=0,et(e,r));continue;case`
|
|
16
|
+
`:{Ao(e,e.indent_len),Te(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,br,e.pending.slice(e.fence_start)),qt(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;Pi(e,23),xi(e,2);continue;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":if(e.pending[e.pending.length-1]==="."){if(n!==" ")break;Pi(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,fc,e.pending.slice(0,-1)),xi(e,e.pending.length+1);continue}else{let i=n.charCodeAt(0);if(i===46||ki(i)){e.pending=r;continue}}break;case"|":un(e,e.blockquote_idx),Te(e,27),Te(e,28),e.pending="",et(e,n);continue}let o=r;if(e.token===21)e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data);else if(e.indent_len>=4){let i=0;for(;i<4;i+=1)if(e.indent[i]===" "){i=i+1;break}o=e.indent.slice(i)+r,Te(e,9)}else Te(e,2);qt(e),et(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
|
|
17
|
+
`:e.table_state=2,e.pending="";continue;default:Ge(e),e.table_state=0;break}else switch(e.pending){case"|":Te(e,28),e.pending="",et(e,n);continue;case`
|
|
18
|
+
`:Ge(e),e.pending="",e.table_state=0,et(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Te(e,29),Ge(e),e.pending="",et(e,n);continue;case`
|
|
19
|
+
`:Ge(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",et(e,n);continue;default:Te(e,29),et(e,n);continue}break;case 29:if(e.pending==="|"){Ie(e),Ge(e),e.pending="",et(e,n);continue}break;case 9:switch(r){case`
|
|
19
20
|
`:case`
|
|
20
21
|
`:case`
|
|
21
22
|
`:case`
|
|
@@ -25,18 +26,36 @@ ${a}`:a;continue}r.startsWith("id:")&&(o=r.slice(3).trim())}if(n==="[DONE]")retu
|
|
|
25
26
|
`:case`
|
|
26
27
|
`:case`
|
|
27
28
|
`:case`
|
|
28
|
-
`:e.pending=
|
|
29
|
-
`:if(
|
|
30
|
-
`){e.pending=
|
|
31
|
-
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,
|
|
32
|
-
`?(
|
|
33
|
-
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,
|
|
34
|
-
`:e.pending=n;continue;default:let
|
|
35
|
-
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:
|
|
36
|
-
`?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let
|
|
37
|
-
`){
|
|
38
|
-
`){
|
|
39
|
-
`){ve(e),he(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(km(n.charCodeAt(0)))break;ve(e),he(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ve(e),he(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ve(e),he(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}ve(e)}function mi(e){return{add_token:wm,end_token:Cm,add_text:Rm,set_attr:Tm,data:{nodes:[e,,,,,],index:0}}}function wm(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 r=o=document.createElement("input");r.type="checkbox",r.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 Cm(e){e.index-=1}function Rm(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Tm(e,t,n){e.nodes[e.index].setAttribute(bm(t),n)}function Dr({textSig:e,doneSig:t}){let n=O(null);return Ct(()=>{let o=n.current;if(!o)return;o.classList.add(`${T.cssPrefix}-md`),o.replaceChildren();let r=mi(o),a=fi(r),s=0,l=Ft(()=>{let _=e.value,p=t.value;_.length<s&&(o.replaceChildren(),r=mi(o),a=fi(r),s=0);let u=_.slice(s);u&&et(a,u),s=_.length,p&&Jc(a)}),c=new MutationObserver(_=>{for(let p of _)for(let u of p.addedNodes){if(!(u instanceof HTMLElement))continue;let m=u.matches?.("a")?[u]:[...u.querySelectorAll?.("a")??[]];for(let g of m)Zc(g)}});c.observe(o,{childList:!0,subtree:!0});for(let _ of o.querySelectorAll("a"))Zc(_);let d=_=>{let p=_.target?.closest?.("a");if(!p||!(p instanceof HTMLAnchorElement))return;let u=p.getAttribute("href")??"";!u||u.startsWith("#")||(_.preventDefault(),window.open(u,"_blank","noopener,noreferrer"))};return o.addEventListener("click",d),()=>{l(),c.disconnect(),o.removeEventListener("click",d)}},[e,t]),i("div",{ref:n})}function ed({text:e}){let t=oe(()=>te(e),[e]),n=oe(()=>te(!0),[]);return i(Dr,{textSig:t,doneSig:n})}function Zc(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 $r=T.cssPrefix;function td({messageId:e,initial:t,strings:n,onFeedback:o}){let[r,a]=$(t);M(()=>a(t),[e,t]);let s=l=>{let c=r===l?null:l;a(c),o(e,c)};return i("div",{class:`${$r}-feedback`,role:"group","data-testid":R.messageFeedback,children:[i("button",{type:"button",class:`${$r}-msg-action`,"data-active":r==="up"?"true":void 0,"aria-pressed":r==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>s("up"),"data-testid":R.feedbackUp,children:i(dc,{})}),i("button",{type:"button",class:`${$r}-msg-action`,"data-active":r==="down"?"true":void 0,"aria-pressed":r==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>s("down"),"data-testid":R.feedbackDown,children:i(uc,{})}),i("span",{class:`${$r}-sr-only`,role:"status","aria-live":"polite",children:r?n.feedbackThanks:""})]})}var Bn=T.cssPrefix;function nd({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?i("a",{class:`${Bn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":R.source,children:[i("span",{class:`${Bn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),i("span",{class:`${Bn}-source-label`,children:n})]}):i("span",{class:`${Bn}-source`,"data-testid":R.source,children:[i("span",{class:`${Bn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),i("span",{class:`${Bn}-source-label`,children:n})]})}var vt=T.cssPrefix;function od({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=oe(()=>ge(()=>e.approvalSig.value),[e]),c=oe(()=>ge(()=>Kc(e,{active:n,superseded:o,continuationStreaming:r})),[e,n,o,r]).value,{terminal:d,showApproveReject:_,showAnswered:p,showSubmitted:u,showEdit:m,skipped:g}=c,P=ii(e.toolName),y=c.answeredApproved,w=e.toolCallId,S=i(fe,{children:[i("p",{class:`${vt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",P)}),i("p",{class:`${vt}-toolui-subtle`,children:t.approvalBody})]});u?S=i("p",{class:`${vt}-toolui-subtle`,children:t.approvalSubmitting}):p&&y!==!1?S=i(fe,{children:[i("p",{class:`${vt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",y?t.approve:t.reject),l.value?.reason?` \u2014 ${l.value.reason}`:""]}),m?i("p",{class:`${vt}-toolui-subtle`,children:t.approvalEditHint}):null,m?null:i("p",{class:`${vt}-toolui-subtle`,children:t.approvalSubmitting})]}):p&&(S=i(fe,{}));let h=_||u||m||p&&y!==!1;return i("div",{class:`${vt}-toolui-group`,"data-testid":c.decided?R.toolDecision:R.toolApproval,children:[i(Lr,{part:e,strings:t,superseded:g,submitted:u}),g||d||!h?null:i("div",{class:`${vt}-toolui ${vt}-toolui-body`,children:[S,_?i("div",{class:`${vt}-toolui-actions`,children:[i("button",{type:"button",class:`${vt}-form-skip`,disabled:!n,onClick:()=>a(w,!1),"data-testid":R.toolReject,children:t.reject}),i("button",{type:"button",class:`${vt}-form-submit`,disabled:!n,onClick:()=>a(w,!0),"data-testid":R.toolApprove,children:t.approve})]}):null,m?i("div",{class:`${vt}-toolui-actions`,children:i("button",{type:"button",class:`${vt}-form-skip`,onClick:()=>s(w),"data-testid":R.toolEdit,children:t.edit})}):null]})]})}var Em=new Set(["text","email","phone","number","date","single-select","multi-select","boolean"]);function rd(e){let t=e&&typeof e=="object"?e:{},o=(Array.isArray(t.questions)?t.questions:[]).map(Am).filter(r=>r!==null);return{intro:Fr(t.intro),questions:o}}function Am(e,t){if(!e||typeof e!="object")return null;let n=e,o=Em.has(n.type)?n.type:"text";return{key:Fr(n.key)??`q${t+1}`,question:Fr(n.question)??"Please provide the missing information.",type:o,options:Array.isArray(n.options)?n.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof n.required=="boolean"?n.required:void 0,helpText:Fr(n.helpText)}}function Mm(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function gi(e,t,n){return e.questions.map(o=>{let r=Mm(o.type),a=o.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(o.options??[]).map(s=>({value:s,label:s}));return{name:o.key,label:o.question,type:r,required:o.required??!1,options:a.length>0?a:void 0,validationHint:o.helpText}})}function Fr(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var ze=T.cssPrefix;function Lm({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var Om={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function ad(e,t){let n={};for(let o of e)n[o.key]=t[Om[o.type]];return n}function id({part:e,strings:t,active:n,superseded:o=!1,continuationStreaming:r=!1,onDecision:a,onEdit:s}){let l=oe(()=>ge(()=>e.stateSig.value),[e]).value,c=oe(()=>ge(()=>e.approvalSig.value),[e]).value,d=oe(()=>ge(()=>rd(e.inputSig.value)),[e]).value,{terminal:_,decided:p}=Mr(l,c),u=p&&c?.approved===!0,m=r&&!p,g=!p&&!o&&!m,P=!g&&!u&&!m,y=u&&n&&!_,w=d.questions,[S,h]=$(null),x=S??(g||u||m),[k,E]=$(!1),G=w.length>1?ja:fo,H=g?t.inputRequired:t.inputBadge,A=m?i("p",{class:`${ze}-toolui-subtle`,children:t.approvalSubmitting}):g?i(Nm,{req:d,strings:t,active:n,resolve:(B,ne)=>a(e.toolCallId,ne,B)}):k?i(vo,{fields:gi(d,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:ad(w,t),initialValues:u?Um(w,c?.reason):void 0}):i(Dm,{questions:w,answers:u?Bm(c?.reason):{},strings:t}),{status:D,statusLabel:K}=Lm({skipped:P,submitted:m,strings:t});return i("details",{class:`${ze}-toolui ${ze}-toolui-collapsible${o?` ${ze}-toolui-stale`:""}`,open:x,onToggle:B=>{let ne=B.currentTarget.open;ne!==x&&h(ne)},"data-testid":g?R.toolAskQuestions:R.toolDecision,children:[i("summary",{class:`${ze}-toolui-head`,children:[i("span",{class:`${ze}-toolui-q-pill`,children:[i(G,{}),H]}),i("span",{class:`${ze}-toolui-head-end`,children:[g?null:i(si,{status:D,icon:P?i(yr,{}):i(br,{}),label:K}),i("span",{class:`${ze}-toolui-chevron`,children:i(un,{})})]})]}),i("div",{class:`${ze}-toolui-collapse-body`,children:[d.intro?i("div",{class:`${ze}-toolui-desc`,children:d.intro}):null,A,g||m?null:i("div",{class:`${ze}-toolui-footer`,children:[i("button",{type:"button",class:`${ze}-toolui-options-toggle`,onClick:()=>E(B=>!B),"data-testid":R.toolAskOptions,children:[i("span",{class:`${ze}-toolui-options-chevron${k?` ${ze}-open`:""}`,children:i(un,{})}),k?t.hideOptions:t.showOptions]}),y?i("button",{type:"button",class:`${ze}-form-skip`,onClick:()=>s(e.toolCallId),"data-testid":R.toolEdit,children:t.edit}):null]})]})]})}function Nm({req:e,strings:t,active:n,resolve:o}){let r=gi(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return i(vo,{fields:r,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:s=>o(Fm(e.questions,s),!0),skipLabel:t.inputSkip,onSkip:()=>o(void 0,!1),submitOnEnter:a,fieldTypeLabels:ad(e.questions,t),submitTestId:R.toolInputSubmit,skipTestId:R.toolInputSkip})}function Dm({questions:e,answers:t,strings:n}){return i("div",{class:`${ze}-toolui-summary`,"data-testid":R.toolAskSummary,children:e.map(o=>i("div",{class:`${ze}-field`,children:[i("span",{class:`${ze}-field-head`,children:i("span",{class:`${ze}-field-label`,children:[o.question,o.required?i("span",{class:`${ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),i("p",{class:`${ze}-toolui-answer`,children:$m(o,t[o.key],n)||"\u2014"})]},o.key))})}function $m(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Fm(e,t){let n=e.flatMap(o=>{let r=t[o.key];if(r==null||r.trim()==="")return[];let a=o.type==="multi-select"?r.split(",").map(s=>s.trim()).filter(Boolean):r;return[{key:o.key,value:a}]});return JSON.stringify({answers:n})}function sd(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let o={};for(let r of n)if(r&&typeof r=="object"&&"key"in r){let{key:a,value:s}=r;if(typeof a!="string")continue;typeof s=="string"?o[a]=s:Array.isArray(s)&&(o[a]=s.filter(l=>typeof l=="string"))}return o}function Bm(e){let t=sd(e),n={};for(let[o,r]of Object.entries(t))n[o]=Array.isArray(r)?r.join(", "):r;return n}function Um(e,t){let n=sd(t),o={};for(let r of e){let a=n[r.key];a!==void 0&&(r.type==="multi-select"?o[r.key]=Array.isArray(a)?a:[a]:o[r.key]=Array.isArray(a)?a[0]??"":a)}return o}function ld({part:e,strings:t,live:n}){let o=oe(()=>ge(()=>e.inputSig.value),[e]),r=oe(()=>ge(()=>e.outputSig.value),[e]),a=oe(()=>ge(()=>e.errorSig.value),[e]);return oe(()=>ge(()=>!!Or(o.value)||!!a.value||!!Or(ci(r.value))),[o,r,a]).value?i(Lr,{part:e,strings:t,testid:R.toolCall,live:n}):null}var Je=T.cssPrefix,cd=Fc(Hm);function Hm({message:e,status:t,strings:n,responseMode:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l=!1,superseded:c=!1,tool:d,onRetry:_,enableMessageFeedback:p=!1,onFeedback:u}){let g=oe(()=>ge(()=>e.partsSig.value),[e]).value,P=oe(()=>ge(()=>sn(e)),[e]),y=oe(()=>ge(()=>Tl(e)),[e]),w=oe(()=>ge(()=>qc(e)),[e]),S=oe(()=>ge(()=>r&&Vc(e)),[e,r]),h=t==="streaming",b=e.role==="assistant"&&h,x=Wc({streaming:b,responseMode:o,reasoningVisible:S.value,hasAnswerText:w.value,emptyReply:P.value,hidden:y.value}),{bufferedHold:k,working:E,showStreamDots:G}=x;if(x.hidden)return null;let H=qm(e.createdAt),A=e.role==="assistant"||e.role==="operator",D=p&&!!u&&!!e.serverMessageId&&A&&!h&&t!=="error"&&!P.value,K=h?"":g.filter(q=>q.kind==="text").map(q=>q.textSig.peek()).join(`
|
|
29
|
+
`:e.pending=r;continue;default:e.pending.length!==0?(Ie(e),Ge(e),e.pending=n):e.text+=n;continue}case 10:switch(n){case"`":e.pending=r;continue;case`
|
|
30
|
+
`:if(r.length===e.fence_start+e.fence_end+1){Ie(e),Ge(e),e.pending="",e.fence_start=0,e.fence_end=0,e.token=101;continue}e.token=101;break;case" ":if(e.pending[0]===`
|
|
31
|
+
`){e.pending=r,e.fence_end+=1;continue}break}e.text+=e.pending,e.pending=n,e.fence_end=1;continue;case 11:switch(n){case"`":r.length===e.fence_start+ +(e.pending[0]===" ")?(Ie(e),Ge(e),e.pending="",e.fence_start=0):e.pending=r;continue;case`
|
|
32
|
+
`:e.text+=e.pending,e.pending="",e.token=21,e.blockquote_idx=0,Ie(e);continue;case" ":e.text+=e.pending,e.pending=n;continue;default:e.text+=r,e.pending="";continue}case 103:switch(e.pending.length){case 0:if(n!=="[")break;e.pending=r;continue;case 1:if(n!==" "&&n!=="x")break;e.pending=r;continue;case 2:if(n!=="]")break;e.pending=r;continue;case 3:if(n!==" ")break;e.renderer.add_token(e.renderer.data,26),e.pending[1]==="x"&&e.renderer.set_attr(e.renderer.data,_c,""),e.renderer.end_token(e.renderer.data),e.pending=" ";continue}e.token=e.tokens[e.len],e.pending="",et(e,r);continue;case 14:case 15:{let i="*",a=12;if(e.token===15&&(i="_",a=13),i===e.pending){if(Ie(e),i===n){Ge(e),e.pending="";continue}Te(e,a),e.pending=n;continue}break}case 12:case 13:{let i="*",a=14;switch(e.token===13&&(i="_",a=15),e.pending){case i:i===n?e.tokens[e.len-1]===a?e.pending=r:(Ie(e),Te(e,a),e.pending=""):(Ie(e),Ge(e),e.pending=n);continue;case i+i:let s=e.token;Ie(e),Ge(e),Ge(e),i!==n?(Te(e,s),e.pending=n):e.pending="";continue}break}case 16:if(r==="~~"){Ie(e),Ge(e),e.pending="";continue}break;case 105:n===`
|
|
33
|
+
`?(Ie(e),Te(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",et(e,n));continue;case 30:if(r==="\\]"||r==="$$"){Ie(e),Ge(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){Ie(e),Ge(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(Ie(e),Te(e,18),e.pending=r,e.text=r):"http:/"[e.pending.length]===n||"https:/"[e.pending.length]===n?e.pending=r:(e.token=e.tokens[e.len],et(e,n));continue;case 17:case 19:if(e.pending==="]"){Ie(e),n==="("?e.pending=r:(Ge(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let i=e.token===17?Si:pc,a=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,i,a),Ge(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
|
|
34
|
+
`||n==="\\"?(e.renderer.set_attr(e.renderer.data,Si,e.pending),Ie(e),Ge(e),e.pending=n):(e.text+=n,e.pending=r);continue;case 104:if(r.startsWith("<br")){if(r.length===3||n===" "||n==="/"&&(r.length===4||e.pending[e.pending.length-1]===" ")){e.pending=r;continue}if(n===">"){Ie(e),e.token=e.tokens[e.len],e.renderer.add_token(e.renderer.data,21),e.renderer.end_token(e.renderer.data),e.pending="";continue}}e.token=e.tokens[e.len],e.text+="<",e.pending=e.pending.slice(1),et(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":Ie(e),Te(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
|
|
35
|
+
`:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=ki(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
|
|
36
|
+
`:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:Ie(e),un(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:Ie(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){Ie(e),e.pending=r,e.token=104;continue}break;case"`":if(e.token===19)break;n==="`"?(e.fence_start+=1,e.pending=r):(e.fence_start+=1,Ie(e),Te(e,11),e.text=n===" "||n===`
|
|
37
|
+
`?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let o=12,i=14,a=e.pending[0];if(a==="_"&&(o=13,i=15),e.pending.length===1){if(a===n){e.pending=r;continue}if(n!==" "&&n!==`
|
|
38
|
+
`){Ie(e),Te(e,o),e.pending=n;continue}}else{if(a===n){Ie(e),Te(e,i),Te(e,o),e.pending="";continue}if(n!==" "&&n!==`
|
|
39
|
+
`){Ie(e),Te(e,i),e.pending=n;continue}}break}case"~":if(e.token!==19&&e.token!==16){if(e.pending==="~"){if(n==="~"){e.pending=r;continue}}else if(n!==" "&&n!==`
|
|
40
|
+
`){Ie(e),Te(e,16),e.pending=n;continue}}break;case"$":if(e.token!==19&&e.token!==16&&e.pending==="$")if(n==="$"){e.token=105,e.pending=r;continue}else{if(um(n.charCodeAt(0)))break;Ie(e),Te(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){Ie(e),Te(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){Ie(e),Te(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}Ie(e)}function Pr(e){return{add_token:pm,end_token:wi,add_text:Ci,set_attr:Ri,data:{nodes:[e,,,,,],index:0}}}function pm(e,t){let n=e.nodes[e.index],r;switch(t){case 1:return;case 20:r=document.createElement("blockquote");break;case 2:r=document.createElement("p");break;case 21:r=document.createElement("br");break;case 22:r=document.createElement("hr");break;case 3:r=document.createElement("h1");break;case 4:r=document.createElement("h2");break;case 5:r=document.createElement("h3");break;case 6:r=document.createElement("h4");break;case 7:r=document.createElement("h5");break;case 8:r=document.createElement("h6");break;case 12:case 13:r=document.createElement("em");break;case 14:case 15:r=document.createElement("strong");break;case 16:r=document.createElement("s");break;case 11:r=document.createElement("code");break;case 18:case 17:r=document.createElement("a");break;case 19:r=document.createElement("img");break;case 23:r=document.createElement("ul");break;case 24:r=document.createElement("ol");break;case 25:r=document.createElement("li");break;case 26:let o=r=document.createElement("input");o.type="checkbox",o.disabled=!0;break;case 9:case 10:n=n.appendChild(document.createElement("pre")),r=document.createElement("code");break;case 27:r=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]}r=document.createElement("tr");break;case 29:r=document.createElement(n.parentElement?.tagName==="THEAD"?"th":"td");break;case 30:r=document.createElement("equation-block");break;case 31:r=document.createElement("equation-inline");break}e.nodes[++e.index]=n.appendChild(r)}function wi(e){e.index-=1}function Ci(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function Ri(e,t,n){e.nodes[e.index].setAttribute(im(t),n)}var xr={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1,description:"A UI block containing text, cards, metrics, tables, and charts in display order."},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1,description:"Plain text."},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1,description:"A titled card with plain text content."},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1,description:"A dashboard metric. Value includes its unit; detail adds context or is empty."},Table:{type:"object",properties:{title:{type:"string"},columns:{type:"array",items:{type:"string"}},rows:{type:"array",items:{type:"array",items:{type:"string"}}}},required:["title","columns","rows"],additionalProperties:!1,description:"A data table. Every row has one string cell per column, in the same order."},Chart:{type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1,description:"A single-series chart. Use bar to compare categories or line for an ordered trend. Values are finite numbers."}}}};var gc=Sr;var _m={type:"object",properties:{title:{type:"string"},type:{type:"string",enum:["bar","line"]},data:{type:"array",items:{type:"object",properties:{label:{type:"string"},value:{type:"number"}},required:["label","value"],additionalProperties:!1}}},required:["title","type","data"],additionalProperties:!1,description:"A single-series chart. Use bar to compare categories or line for an ordered trend. Values are finite numbers."};function Sr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:i={}}={}){let a=null,s=0,c=Sr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let u=s,d=!1,_=s;if(s===_)if(e&&typeof e=="object"&&!Array.isArray(e)){let q;if(e.typeName===void 0&&(q="typeName")||e.statementId===void 0&&(q="statementId")||e.props===void 0&&(q="props")){let R={instancePath:t,schemaPath:"#/anyOf/0/required",keyword:"required",params:{missingProperty:q}};a===null?a=[R]:a.push(R),s++}else{if(e.typeName!==void 0){let R=s;if(e.typeName!=="Text"){let ue={instancePath:t+"/typeName",schemaPath:"#/anyOf/0/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}};a===null?a=[ue]:a.push(ue),s++}var p=R===s}else var p=!0;if(p){if(e.statementId!==void 0){let R=s;if(typeof e.statementId!="string"){let oe={instancePath:t+"/statementId",schemaPath:"#/anyOf/0/properties/statementId/type",keyword:"type",params:{type:"string"}};a===null?a=[oe]:a.push(oe),s++}var p=R===s}else var p=!0;if(p)if(e.props!==void 0){let R=e.props,ue=s;if(s===s)if(R&&typeof R=="object"&&!Array.isArray(R)){let te;if(R.text===void 0&&(te="text")){let se={instancePath:t+"/props",schemaPath:"#/$defs/Text/required",keyword:"required",params:{missingProperty:te}};a===null?a=[se]:a.push(se),s++}else{let se=s;for(let W in R)if(W!=="text"){let ee={instancePath:t+"/props",schemaPath:"#/$defs/Text/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}};a===null?a=[ee]:a.push(ee),s++;break}if(se===s&&R.text!==void 0&&typeof R.text!="string"){let W={instancePath:t+"/props/text",schemaPath:"#/$defs/Text/properties/text/type",keyword:"type",params:{type:"string"}};a===null?a=[W]:a.push(W),s++}}}else{let te={instancePath:t+"/props",schemaPath:"#/$defs/Text/type",keyword:"type",params:{type:"object"}};a===null?a=[te]:a.push(te),s++}var p=ue===s}else var p=!0}}}else{let q={instancePath:t,schemaPath:"#/anyOf/0/type",keyword:"type",params:{type:"object"}};a===null?a=[q]:a.push(q),s++}var L=_===s;if(d=d||L,L){var f={};f.typeName=!0,f.statementId=!0,f.props=!0}let m=s;if(s===m)if(e&&typeof e=="object"&&!Array.isArray(e)){let q;if(e.typeName===void 0&&(q="typeName")||e.statementId===void 0&&(q="statementId")||e.props===void 0&&(q="props")){let R={instancePath:t,schemaPath:"#/anyOf/1/required",keyword:"required",params:{missingProperty:q}};a===null?a=[R]:a.push(R),s++}else{if(e.typeName!==void 0){let R=s;if(e.typeName!=="Card"){let ue={instancePath:t+"/typeName",schemaPath:"#/anyOf/1/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}};a===null?a=[ue]:a.push(ue),s++}var g=R===s}else var g=!0;if(g){if(e.statementId!==void 0){let R=s;if(typeof e.statementId!="string"){let oe={instancePath:t+"/statementId",schemaPath:"#/anyOf/1/properties/statementId/type",keyword:"type",params:{type:"string"}};a===null?a=[oe]:a.push(oe),s++}var g=R===s}else var g=!0;if(g)if(e.props!==void 0){let R=e.props,ue=s;if(s===s)if(R&&typeof R=="object"&&!Array.isArray(R)){let te;if(R.title===void 0&&(te="title")||R.body===void 0&&(te="body")){let se={instancePath:t+"/props",schemaPath:"#/$defs/Card/required",keyword:"required",params:{missingProperty:te}};a===null?a=[se]:a.push(se),s++}else{let se=s;for(let W in R)if(!(W==="title"||W==="body")){let ee={instancePath:t+"/props",schemaPath:"#/$defs/Card/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}};a===null?a=[ee]:a.push(ee),s++;break}if(se===s){if(R.title!==void 0){let W=s;if(typeof R.title!="string"){let ee={instancePath:t+"/props/title",schemaPath:"#/$defs/Card/properties/title/type",keyword:"type",params:{type:"string"}};a===null?a=[ee]:a.push(ee),s++}var P=W===s}else var P=!0;if(P)if(R.body!==void 0){let W=s;if(typeof R.body!="string"){let Be={instancePath:t+"/props/body",schemaPath:"#/$defs/Card/properties/body/type",keyword:"type",params:{type:"string"}};a===null?a=[Be]:a.push(Be),s++}var P=W===s}else var P=!0}}}else{let te={instancePath:t+"/props",schemaPath:"#/$defs/Card/type",keyword:"type",params:{type:"object"}};a===null?a=[te]:a.push(te),s++}var g=ue===s}else var g=!0}}}else{let q={instancePath:t,schemaPath:"#/anyOf/1/type",keyword:"type",params:{type:"object"}};a===null?a=[q]:a.push(q),s++}var L=m===s;d=d||L,L&&f!==!0&&(f=f||{},f.typeName=!0,f.statementId=!0,f.props=!0);let k=s;if(s===k)if(e&&typeof e=="object"&&!Array.isArray(e)){let q;if(e.typeName===void 0&&(q="typeName")||e.statementId===void 0&&(q="statementId")||e.props===void 0&&(q="props")){let R={instancePath:t,schemaPath:"#/anyOf/2/required",keyword:"required",params:{missingProperty:q}};a===null?a=[R]:a.push(R),s++}else{if(e.typeName!==void 0){let R=s;if(e.typeName!=="Metric"){let ue={instancePath:t+"/typeName",schemaPath:"#/anyOf/2/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}};a===null?a=[ue]:a.push(ue),s++}var S=R===s}else var S=!0;if(S){if(e.statementId!==void 0){let R=s;if(typeof e.statementId!="string"){let oe={instancePath:t+"/statementId",schemaPath:"#/anyOf/2/properties/statementId/type",keyword:"type",params:{type:"string"}};a===null?a=[oe]:a.push(oe),s++}var S=R===s}else var S=!0;if(S)if(e.props!==void 0){let R=e.props,ue=s;if(s===s)if(R&&typeof R=="object"&&!Array.isArray(R)){let te;if(R.label===void 0&&(te="label")||R.value===void 0&&(te="value")||R.detail===void 0&&(te="detail")){let se={instancePath:t+"/props",schemaPath:"#/$defs/Metric/required",keyword:"required",params:{missingProperty:te}};a===null?a=[se]:a.push(se),s++}else{let se=s;for(let W in R)if(!(W==="label"||W==="value"||W==="detail")){let ee={instancePath:t+"/props",schemaPath:"#/$defs/Metric/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}};a===null?a=[ee]:a.push(ee),s++;break}if(se===s){if(R.label!==void 0){let W=s;if(typeof R.label!="string"){let ee={instancePath:t+"/props/label",schemaPath:"#/$defs/Metric/properties/label/type",keyword:"type",params:{type:"string"}};a===null?a=[ee]:a.push(ee),s++}var h=W===s}else var h=!0;if(h){if(R.value!==void 0){let W=s;if(typeof R.value!="string"){let Be={instancePath:t+"/props/value",schemaPath:"#/$defs/Metric/properties/value/type",keyword:"type",params:{type:"string"}};a===null?a=[Be]:a.push(Be),s++}var h=W===s}else var h=!0;if(h)if(R.detail!==void 0){let W=s;if(typeof R.detail!="string"){let Be={instancePath:t+"/props/detail",schemaPath:"#/$defs/Metric/properties/detail/type",keyword:"type",params:{type:"string"}};a===null?a=[Be]:a.push(Be),s++}var h=W===s}else var h=!0}}}}else{let te={instancePath:t+"/props",schemaPath:"#/$defs/Metric/type",keyword:"type",params:{type:"object"}};a===null?a=[te]:a.push(te),s++}var S=ue===s}else var S=!0}}}else{let q={instancePath:t,schemaPath:"#/anyOf/2/type",keyword:"type",params:{type:"object"}};a===null?a=[q]:a.push(q),s++}var L=k===s;d=d||L,L&&f!==!0&&(f=f||{},f.typeName=!0,f.statementId=!0,f.props=!0);let b=s;if(s===b)if(e&&typeof e=="object"&&!Array.isArray(e)){let q;if(e.typeName===void 0&&(q="typeName")||e.statementId===void 0&&(q="statementId")||e.props===void 0&&(q="props")){let R={instancePath:t,schemaPath:"#/anyOf/3/required",keyword:"required",params:{missingProperty:q}};a===null?a=[R]:a.push(R),s++}else{if(e.typeName!==void 0){let R=s;if(e.typeName!=="Table"){let ue={instancePath:t+"/typeName",schemaPath:"#/anyOf/3/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}};a===null?a=[ue]:a.push(ue),s++}var y=R===s}else var y=!0;if(y){if(e.statementId!==void 0){let R=s;if(typeof e.statementId!="string"){let oe={instancePath:t+"/statementId",schemaPath:"#/anyOf/3/properties/statementId/type",keyword:"type",params:{type:"string"}};a===null?a=[oe]:a.push(oe),s++}var y=R===s}else var y=!0;if(y)if(e.props!==void 0){let R=e.props,ue=s;if(s===s)if(R&&typeof R=="object"&&!Array.isArray(R)){let te;if(R.title===void 0&&(te="title")||R.columns===void 0&&(te="columns")||R.rows===void 0&&(te="rows")){let se={instancePath:t+"/props",schemaPath:"#/$defs/Table/required",keyword:"required",params:{missingProperty:te}};a===null?a=[se]:a.push(se),s++}else{let se=s;for(let W in R)if(!(W==="title"||W==="columns"||W==="rows")){let ee={instancePath:t+"/props",schemaPath:"#/$defs/Table/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}};a===null?a=[ee]:a.push(ee),s++;break}if(se===s){if(R.title!==void 0){let W=s;if(typeof R.title!="string"){let ee={instancePath:t+"/props/title",schemaPath:"#/$defs/Table/properties/title/type",keyword:"type",params:{type:"string"}};a===null?a=[ee]:a.push(ee),s++}var C=W===s}else var C=!0;if(C){if(R.columns!==void 0){let W=R.columns,ee=s;if(s===ee)if(Array.isArray(W)){var E=!0;let xe=W.length;for(let he=0;he<xe;he++){let Se=s;if(typeof W[he]!="string"){let Ae={instancePath:t+"/props/columns/"+he,schemaPath:"#/$defs/Table/properties/columns/items/type",keyword:"type",params:{type:"string"}};a===null?a=[Ae]:a.push(Ae),s++}var E=Se===s;if(!E)break}}else{let xe={instancePath:t+"/props/columns",schemaPath:"#/$defs/Table/properties/columns/type",keyword:"type",params:{type:"array"}};a===null?a=[xe]:a.push(xe),s++}var C=ee===s}else var C=!0;if(C)if(R.rows!==void 0){let W=R.rows,ee=s;if(s===ee)if(Array.isArray(W)){var Y=!0;let xe=W.length;for(let he=0;he<xe;he++){let Se=W[he],Ye=s;if(s===Ye)if(Array.isArray(Se)){var j=!0;let Pe=Se.length;for(let Fe=0;Fe<Pe;Fe++){let pe=s;if(typeof Se[Fe]!="string"){let je={instancePath:t+"/props/rows/"+he+"/"+Fe,schemaPath:"#/$defs/Table/properties/rows/items/items/type",keyword:"type",params:{type:"string"}};a===null?a=[je]:a.push(je),s++}var j=pe===s;if(!j)break}}else{let Pe={instancePath:t+"/props/rows/"+he,schemaPath:"#/$defs/Table/properties/rows/items/type",keyword:"type",params:{type:"array"}};a===null?a=[Pe]:a.push(Pe),s++}var Y=Ye===s;if(!Y)break}}else{let xe={instancePath:t+"/props/rows",schemaPath:"#/$defs/Table/properties/rows/type",keyword:"type",params:{type:"array"}};a===null?a=[xe]:a.push(xe),s++}var C=ee===s}else var C=!0}}}}else{let te={instancePath:t+"/props",schemaPath:"#/$defs/Table/type",keyword:"type",params:{type:"object"}};a===null?a=[te]:a.push(te),s++}var y=ue===s}else var y=!0}}}else{let q={instancePath:t,schemaPath:"#/anyOf/3/type",keyword:"type",params:{type:"object"}};a===null?a=[q]:a.push(q),s++}var L=b===s;d=d||L,L&&f!==!0&&(f=f||{},f.typeName=!0,f.statementId=!0,f.props=!0);let O=s;if(s===O)if(e&&typeof e=="object"&&!Array.isArray(e)){let q;if(e.typeName===void 0&&(q="typeName")||e.statementId===void 0&&(q="statementId")||e.props===void 0&&(q="props")){let R={instancePath:t,schemaPath:"#/anyOf/4/required",keyword:"required",params:{missingProperty:q}};a===null?a=[R]:a.push(R),s++}else{if(e.typeName!==void 0){let R=s;if(e.typeName!=="Chart"){let ue={instancePath:t+"/typeName",schemaPath:"#/anyOf/4/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}};a===null?a=[ue]:a.push(ue),s++}var B=R===s}else var B=!0;if(B){if(e.statementId!==void 0){let R=s;if(typeof e.statementId!="string"){let oe={instancePath:t+"/statementId",schemaPath:"#/anyOf/4/properties/statementId/type",keyword:"type",params:{type:"string"}};a===null?a=[oe]:a.push(oe),s++}var B=R===s}else var B=!0;if(B)if(e.props!==void 0){let R=e.props,ue=s;if(s===s)if(R&&typeof R=="object"&&!Array.isArray(R)){let te;if(R.title===void 0&&(te="title")||R.type===void 0&&(te="type")||R.data===void 0&&(te="data")){let se={instancePath:t+"/props",schemaPath:"#/$defs/Chart/required",keyword:"required",params:{missingProperty:te}};a===null?a=[se]:a.push(se),s++}else{let se=s;for(let W in R)if(!(W==="title"||W==="type"||W==="data")){let ee={instancePath:t+"/props",schemaPath:"#/$defs/Chart/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:W}};a===null?a=[ee]:a.push(ee),s++;break}if(se===s){if(R.title!==void 0){let W=s;if(typeof R.title!="string"){let ee={instancePath:t+"/props/title",schemaPath:"#/$defs/Chart/properties/title/type",keyword:"type",params:{type:"string"}};a===null?a=[ee]:a.push(ee),s++}var z=W===s}else var z=!0;if(z){if(R.type!==void 0){let W=R.type,ee=s;if(typeof W!="string"){let xe={instancePath:t+"/props/type",schemaPath:"#/$defs/Chart/properties/type/type",keyword:"type",params:{type:"string"}};a===null?a=[xe]:a.push(xe),s++}if(!(W==="bar"||W==="line")){let xe={instancePath:t+"/props/type",schemaPath:"#/$defs/Chart/properties/type/enum",keyword:"enum",params:{allowedValues:_m.properties.type.enum}};a===null?a=[xe]:a.push(xe),s++}var z=ee===s}else var z=!0;if(z)if(R.data!==void 0){let W=R.data,ee=s;if(s===ee)if(Array.isArray(W)){var F=!0;let xe=W.length;for(let he=0;he<xe;he++){let Se=W[he],Ye=s;if(s===Ye)if(Se&&typeof Se=="object"&&!Array.isArray(Se)){let Pe;if(Se.label===void 0&&(Pe="label")||Se.value===void 0&&(Pe="value")){let Fe={instancePath:t+"/props/data/"+he,schemaPath:"#/$defs/Chart/properties/data/items/required",keyword:"required",params:{missingProperty:Pe}};a===null?a=[Fe]:a.push(Fe),s++}else{let Fe=s;for(let pe in Se)if(!(pe==="label"||pe==="value")){let Re={instancePath:t+"/props/data/"+he,schemaPath:"#/$defs/Chart/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:pe}};a===null?a=[Re]:a.push(Re),s++;break}if(Fe===s){if(Se.label!==void 0){let pe=s;if(typeof Se.label!="string"){let Re={instancePath:t+"/props/data/"+he+"/label",schemaPath:"#/$defs/Chart/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}};a===null?a=[Re]:a.push(Re),s++}var Z=pe===s}else var Z=!0;if(Z)if(Se.value!==void 0){let pe=Se.value,Re=s;if(!(typeof pe=="number"&&isFinite(pe))){let Oe={instancePath:t+"/props/data/"+he+"/value",schemaPath:"#/$defs/Chart/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}};a===null?a=[Oe]:a.push(Oe),s++}var Z=Re===s}else var Z=!0}}}else{let Pe={instancePath:t+"/props/data/"+he,schemaPath:"#/$defs/Chart/properties/data/items/type",keyword:"type",params:{type:"object"}};a===null?a=[Pe]:a.push(Pe),s++}var F=Ye===s;if(!F)break}}else{let xe={instancePath:t+"/props/data",schemaPath:"#/$defs/Chart/properties/data/type",keyword:"type",params:{type:"array"}};a===null?a=[xe]:a.push(xe),s++}var z=ee===s}else var z=!0}}}}else{let te={instancePath:t+"/props",schemaPath:"#/$defs/Chart/type",keyword:"type",params:{type:"object"}};a===null?a=[te]:a.push(te),s++}var B=ue===s}else var B=!0}}}else{let q={instancePath:t,schemaPath:"#/anyOf/4/type",keyword:"type",params:{type:"object"}};a===null?a=[q]:a.push(q),s++}var L=O===s;if(d=d||L,L&&f!==!0&&(f=f||{},f.typeName=!0,f.statementId=!0,f.props=!0),d)s=u,a!==null&&(u?a.length=u:a=null);else{let q={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return a===null?a=[q]:a.push(q),s++,Sr.errors=a,!1}return Sr.errors=a,c.props=f,s===0}Sr.evaluated={dynamicProps:!0,dynamicItems:!1};function vc(e){switch(e.k){case"StateRef":case"RuntimeRef":case"BinOp":case"UnaryOp":case"Ternary":case"Member":case"Index":case"Assign":return!0;default:return!1}}var fm=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function pn(e){return!e||typeof e!="object"||Array.isArray(e)?!1:fm.has(e.k)}function kr(e,t){let n=r=>{switch(t(r),r.k){case"Comp":r.args.forEach(n),Object.values(r.mappedProps??{}).forEach(n);break;case"Arr":r.els.forEach(n);break;case"Obj":r.entries.forEach(([,o])=>n(o));break;case"BinOp":n(r.left),n(r.right);break;case"UnaryOp":n(r.operand);break;case"Ternary":n(r.cond),n(r.then),n(r.else);break;case"Member":n(r.obj);break;case"Index":n(r.obj),n(r.index);break;case"Assign":n(r.value);break}};n(e)}function Mo(e){return e==null?{k:"Null"}:typeof e=="string"?{k:"Str",v:e}:typeof e=="number"?{k:"Num",v:e}:typeof e=="boolean"?{k:"Bool",v:e}:Array.isArray(e)?{k:"Arr",els:e.map(Mo)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,Mo(n)])}:{k:"Null"}}function Lo(e){switch(e.k){case"Str":case"Num":case"Bool":return{v:e.v};case"Null":return{v:null};case"Arr":{let t=[];for(let n of e.els){let r=Lo(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=Lo(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var Oo=new Map([["Count",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["First",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Last",{kind:"function",params:[{name:"array",required:!1}],builtin:!0}],["Sum",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Avg",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Min",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Max",{kind:"function",params:[{name:"numbers",required:!1}],builtin:!0}],["Sort",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"direction",required:!1}],builtin:!0}],["Filter",{kind:"function",params:[{name:"array",required:!1},{name:"field",required:!1},{name:"operator",required:!1},{name:"value",required:!1}],builtin:!0}],["Round",{kind:"function",params:[{name:"number",required:!1},{name:"decimals",required:!1}],builtin:!0}],["Abs",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Floor",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Ceil",{kind:"function",params:[{name:"number",required:!1}],builtin:!0}],["Each",{kind:"function",params:[{name:"array",required:!1},{name:"varName",required:!1},{name:"template",required:!1}],builtin:!0,lazy:!0}],["Run",{kind:"action",params:[{name:"ref",required:!1}],builtin:!0,lazy:!0}],["ToAssistant",{kind:"action",params:[{name:"message",required:!1},{name:"context",required:!1}],builtin:!0}],["OpenUrl",{kind:"action",params:[{name:"url",required:!1}],builtin:!0}],["Set",{kind:"action",params:[{name:"variable",required:!1},{name:"value",required:!1}],builtin:!0,lazy:!0}],["Reset",{kind:"action",params:[{name:"variable",required:!1}],builtin:!0,lazy:!0}],["Action",{kind:"action",params:[{name:"steps",required:!0}],builtin:!0,lazy:!0}]]),hc={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},Zt={Query:"Query",Mutation:"Mutation"};function wr(e){return e?.callDefs??Oo}function Cr(e){return Oo.has(e)}function zn(e){return e in Zt}var w;(function(e){e[e.Newline=0]="Newline",e[e.LParen=1]="LParen",e[e.RParen=2]="RParen",e[e.LBrack=3]="LBrack",e[e.RBrack=4]="RBrack",e[e.LBrace=5]="LBrace",e[e.RBrace=6]="RBrace",e[e.Comma=7]="Comma",e[e.Colon=8]="Colon",e[e.Equals=9]="Equals",e[e.True=10]="True",e[e.False=11]="False",e[e.Null=12]="Null",e[e.EOF=13]="EOF",e[e.Str=14]="Str",e[e.Num=15]="Num",e[e.Ident=16]="Ident",e[e.Type=17]="Type",e[e.StateVar=18]="StateVar",e[e.Dot=19]="Dot",e[e.Plus=20]="Plus",e[e.Minus=21]="Minus",e[e.Star=22]="Star",e[e.Slash=23]="Slash",e[e.Percent=24]="Percent",e[e.EqEq=25]="EqEq",e[e.NotEq=26]="NotEq",e[e.Greater=27]="Greater",e[e.Less=28]="Less",e[e.GreaterEq=29]="GreaterEq",e[e.LessEq=30]="LessEq",e[e.And=31]="And",e[e.Or=32]="Or",e[e.Not=33]="Not",e[e.Question=34]="Question",e[e.BuiltinCall=35]="BuiltinCall"})(w||(w={}));var mm=1,bc=2,yc=3,Ii=4,Rr=5,Ti=6,No=7,Pc=8,gm=9;function $o(e){let t=0,n=()=>e[t]??{t:w.EOF},r=()=>{let p=n();return t++,p},o=p=>{n().t===p&&t++};function i(p){switch(p.t){case w.Question:return mm;case w.Or:return bc;case w.And:return yc;case w.EqEq:case w.NotEq:return Ii;case w.Greater:case w.Less:case w.GreaterEq:case w.LessEq:return Rr;case w.Plus:case w.Minus:return Ti;case w.Star:case w.Slash:case w.Percent:return No;case w.Dot:case w.LBrack:return gm;default:return 0}}function a(p=0){let f=s();for(;i(n())>p;)f=c(f);return f}function s(){let p=n();if(p.t===w.Str)return r(),{k:"Str",v:p.v};if(p.t===w.Num)return r(),{k:"Num",v:p.v};if(p.t===w.True)return r(),{k:"Bool",v:!0};if(p.t===w.False)return r(),{k:"Bool",v:!1};if(p.t===w.Null)return r(),{k:"Null"};if(p.t===w.LBrack)return d();if(p.t===w.LBrace)return _();if(p.t===w.StateVar){let f=p.v;if(r(),n().t===w.Equals){r();let m=a(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(p.t===w.Type){let f=p.v;return e[t+1]?.t===w.LParen&&(!Cr(f)||f==="Action")?u():(r(),{k:"Ref",n:f})}if(p.t===w.BuiltinCall){if(e[t+1]?.t===w.LParen){let f=u();return f.k==="Comp"&&!Cr(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:p.v}}if(p.t===w.Ident)return r(),{k:"Ref",n:p.v};if(p.t===w.Not)return r(),{k:"UnaryOp",op:"!",operand:a(Pc)};if(p.t===w.Minus)return r(),{k:"UnaryOp",op:"-",operand:a(Pc)};if(p.t===w.LParen){r();let f=a(0);return o(w.RParen),f}return r(),{k:"Null"}}function c(p){let f=n();if(f.t===w.Plus)return r(),{k:"BinOp",op:"+",left:p,right:a(Ti)};if(f.t===w.Minus)return r(),{k:"BinOp",op:"-",left:p,right:a(Ti)};if(f.t===w.Star)return r(),{k:"BinOp",op:"*",left:p,right:a(No)};if(f.t===w.Slash)return r(),{k:"BinOp",op:"/",left:p,right:a(No)};if(f.t===w.Percent)return r(),{k:"BinOp",op:"%",left:p,right:a(No)};if(f.t===w.EqEq)return r(),{k:"BinOp",op:"==",left:p,right:a(Ii)};if(f.t===w.NotEq)return r(),{k:"BinOp",op:"!=",left:p,right:a(Ii)};if(f.t===w.Greater)return r(),{k:"BinOp",op:">",left:p,right:a(Rr)};if(f.t===w.Less)return r(),{k:"BinOp",op:"<",left:p,right:a(Rr)};if(f.t===w.GreaterEq)return r(),{k:"BinOp",op:">=",left:p,right:a(Rr)};if(f.t===w.LessEq)return r(),{k:"BinOp",op:"<=",left:p,right:a(Rr)};if(f.t===w.And)return r(),{k:"BinOp",op:"&&",left:p,right:a(yc)};if(f.t===w.Or)return r(),{k:"BinOp",op:"||",left:p,right:a(bc)};if(f.t===w.Question){r();let m=a(0);o(w.Colon);let g=a(0);return{k:"Ternary",cond:p,then:m,else:g}}if(f.t===w.Dot){r();let m=n(),g=m.t===w.Ident||m.t===w.Type||m.t===w.Str||m.t===w.Num?(r(),String(m.v)):m.t===w.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:p,field:g}}if(f.t===w.LBrack){r();let m=a(0);return o(w.RBrack),{k:"Index",obj:p,index:m}}return p}function u(){let p=n().v;r(),o(w.LParen);let f=[];for(;n().t!==w.RParen&&n().t!==w.EOF;)f.push(a(0)),n().t===w.Comma&&r();return o(w.RParen),{k:"Comp",name:p,args:f}}function d(){r();let p=[];for(;n().t!==w.RBrack&&n().t!==w.EOF;)p.push(a(0)),n().t===w.Comma&&r();return o(w.RBrack),{k:"Arr",els:p}}function _(){r();let p=[];for(;n().t!==w.RBrace&&n().t!==w.EOF;){let f=n(),m=f.t===w.Ident||f.t===w.Str||f.t===w.Type||f.t===w.Num?(r(),String(f.v)):f.t===w.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(w.Colon),p.push([m,a(0)]),n().t===w.Comma&&r()}return o(w.RBrace),{k:"Obj",entries:p}}return a(0)}function Do(e){let t=[],n=0,r=e.length;for(;n<r;){for(;n<r&&(e[n]===" "||e[n]===" "||e[n]==="\r");)n++;if(n>=r)break;let o=e[n];if(o===`
|
|
41
|
+
`){t.push({t:w.Newline}),n++;continue}if(o==="("){t.push({t:w.LParen}),n++;continue}if(o===")"){t.push({t:w.RParen}),n++;continue}if(o==="["){t.push({t:w.LBrack}),n++;continue}if(o==="]"){t.push({t:w.RBrack}),n++;continue}if(o==="{"){t.push({t:w.LBrace}),n++;continue}if(o==="}"){t.push({t:w.RBrace}),n++;continue}if(o===","){t.push({t:w.Comma}),n++;continue}if(o===":"){t.push({t:w.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:w.EqEq}),n+=2):(t.push({t:w.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:w.NotEq}),n+=2):(t.push({t:w.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:w.GreaterEq}),n+=2):(t.push({t:w.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:w.LessEq}),n+=2):(t.push({t:w.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:w.And}),n+=2):(t.push({t:w.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:w.Or}),n+=2):(t.push({t:w.Or}),n++);continue}if(o==="."){t.push({t:w.Dot}),n++;continue}if(o==="?"){t.push({t:w.Question}),n++;continue}if(o==="+"){t.push({t:w.Plus}),n++;continue}if(o==="*"){t.push({t:w.Star}),n++;continue}if(o==="/"){t.push({t:w.Slash}),n++;continue}if(o==="%"){t.push({t:w.Percent}),n++;continue}if(o==='"'){let c=n;n++;let u=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,u=!0;break}else n++;let d=e.slice(c,n);try{let _=u?d:d+'"';t.push({t:w.Str,v:JSON.parse(_)})}catch{let _=d.replace(/^"|"$/g,"");t.push({t:w.Str,v:_})}continue}if(o==="'"){n++;let c="",u=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let d=e[n];d==="'"?c+="'":d==="\\"?c+="\\":d==="n"?c+=`
|
|
42
|
+
`:d==="t"?c+=" ":c+=d,n++}}else if(e[n]==="'"){n++,u=!0;break}else c+=e[n],n++;t.push({t:w.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===w.Num||c.t===w.Str||c.t===w.Ident||c.t===w.Type||c.t===w.RParen||c.t===w.RBrack||c.t===w.True||c.t===w.False||c.t===w.Null||c.t===w.StateVar||c.t===w.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:w.Minus}),n++;continue}}let i=o>="0"&&o<="9",a=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(i||a){let c=n;for(e[n]==="-"&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&e[n]==="."&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")for(n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;if(n<r&&(e[n]==="e"||e[n]==="E"))for(n++,n<r&&(e[n]==="+"||e[n]==="-")&&n++;n<r&&e[n]>="0"&&e[n]<="9";)n++;t.push({t:w.Num,v:+e.slice(c,n)});continue}if(o==="$"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){let c=n;for(n++;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:w.StateVar,v:e.slice(c,n)});continue}if(o>="a"&&o<="z"||o>="A"&&o<="Z"||o==="_"){let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;let u=e.slice(c,n);if(u==="true"){t.push({t:w.True});continue}if(u==="false"){t.push({t:w.False});continue}if(u==="null"){t.push({t:w.Null});continue}let d=o>="A"&&o<="Z"?w.Type:w.Ident;t.push({t:d,v:u});continue}if(o==="@"&&n+1<r&&(e[n+1]>="a"&&e[n+1]<="z"||e[n+1]>="A"&&e[n+1]<="Z"||e[n+1]==="_")){n++;let c=n;for(;n<r&&(e[n]>="a"&&e[n]<="z"||e[n]>="A"&&e[n]<="Z"||e[n]>="0"&&e[n]<="9"||e[n]==="_");)n++;t.push({t:w.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:w.EOF}),t}function _n(e){if(!e||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="element"&&typeof t.typeName=="string"&&typeof t.props=="object"&&t.props!==null&&typeof t.partial=="boolean"}var xc;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(xc||(xc={}));var vm=["string","number","boolean"],hm={},bm=[];function Ai(e){return Array.isArray(e)?"array":typeof e}function Sc(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function kc(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function wc(e){if(Array.isArray(e.enum))return{enumValues:e.enum};if("const"in e)return{enumValues:[e.const]};switch(e.type){case"string":return{expectedType:"string"};case"number":case"integer":return{expectedType:"number"};case"boolean":return{expectedType:"boolean"};default:return{}}}function Bo(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function ym(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Sc(t);if(n)return n;let r=wc(t);return r.enumValues?r.enumValues.map(o=>JSON.stringify(o)).join("|"):r.expectedType?r.expectedType:typeof t.type=="string"?t.type:void 0}function Ei(e,t){let n=t.map(r=>{let o=ym(r.schema),i=r.required?`${r.name}*`:r.name;return o?`${i}: ${o}`:i}).join(", ");return`${e}(${n})`}function Pm(e,t){let n=typeof e;return t.enumValues?!vm.includes(n)||t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:JSON.stringify(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:Ai(e)}:null}function xm(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"missing-required":return`missing required field "${t}"${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"null-required":return`required field "${t}" cannot be null${n.signature?` \u2014 signature: ${n.signature}`:""}`;case"unknown-component":return`Unknown component "${e}" \u2014 not found in catalog or builtins${n.available?.length?`. Available components: ${n.available.join(", ")}`:""}`;case"inline-reserved":return`${e}() must be declared as a top-level statement, not used inline as a value`;case"excess-args":return`${e} takes ${n.declared} arg(s), got ${n.got} (${n.got-n.declared} excess dropped)`;case"unknown-function":return`Unknown function "@${e}": not a built-in or action step. The call evaluates to null`;case"no-root":return n.reason==="not-component"?"root does not evaluate to a component":n.reason==="fallback"?`No root statement. Rendering the first statement that calls the root component ${e}`:e?`No root statement, and no statement calls the root component ${e}`:"No root statement"}}function tt(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:xm(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var ft=Symbol("invalid");function Fo(e,t){return t!==void 0?t:e?ft:void 0}function Sm(e,t,n,r,o){return kc(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(tt(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function Cc(e){return(e.anyOf??e.oneOf??[e]).map(Sc)}function km(e,t){let n=Cc(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function wm(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return tt(o,n,r,{code:"type-mismatch",expected:"object",actual:Ai(e)}),ft;let i=e,a,s=t.properties&&typeof t.properties=="object"?t.properties:hm,c=Array.isArray(t.required)?t.required:bm,u=!1;if(!o.partial)for(let d of c){let _=d in i;if(!_||i[d]==null){let p=Bo(s[d]);if(p!==void 0){(a??(a={...i}))[d]=p;continue}tt(o,n,`${r}/${d}`,{code:_?"null-required":"missing-required"}),u=!0}}for(let d of Object.keys(s)){if(!(d in i))continue;let _=s[d],p=Ir(i[d],_,n,`${r}/${d}`,o);if(p===ft&&(p=Fo(c.includes(d),Bo(_)),p===ft)){u=!0;continue}p!==i[d]&&(a??(a={...i}),p===void 0?delete a[d]:a[d]=p)}return u?ft:a??i}function Cm(e,t,n,r,o){if(!Array.isArray(e))return tt(o,n,r,{code:"type-mismatch",expected:"array",actual:Ai(e)}),ft;let i=t.items;if(!i||typeof i!="object"||Array.isArray(i))return e;let a;for(let s=0;s<e.length;s++){let c=Ir(e[s],i,n,`${r}/${s}`,o);c!==e[s]&&!a&&(a=e.slice(0,s)),a&&c!==ft&&a.push(c)}return a??e}function Rm(e,t,n,r,o){let i=wc(t);if(i.expectedType==null&&i.enumValues==null||i.enumValues&&o.partial)return!1;let a=Pm(e,i);return a?(tt(o,n,r,{code:"type-mismatch",...a}),!0):!1}function Ir(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let i=t;if(e==null||pn(e))return e;if(_n(e))return Sm(e,i,n,r,o)?ft:e;if(kc(i))return km(i,o)?(tt(o,n,r,{code:"type-mismatch",expected:Cc(i).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),ft):e;let a=i.type;return a==="object"?wm(e,i,n,r,o):a==="array"?Cm(e,i,n,r,o):Rm(e,i,n,r,o)?ft:e}function Uo(e){if(e==null||typeof e!="object")return!1;if(pn(e))return!0;if(Array.isArray(e))return e.some(Uo);if(_n(e))return Object.values(e.props).some(Uo);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(Uo)}function Rc(e,t,n){if(t.visited.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;if(!t.syms.has(e))return t.unres.push(e),n==="expr"?{k:"Ph",n:e}:null;let r=t.syms.get(e);if(t.unreached?.delete(e),r.k==="Comp"&&zn(r.name)){let i=r.name===Zt.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:i}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let i=n==="value"?fn(r,t):Mi(r,t);return n==="value"&&_n(i)&&(i.statementId=e),i}finally{t.currentStatementId=o,t.visited.delete(e)}}function zo(e,t){return wr(t.cat).has(e)||zn(e)}function Li(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Ic(e,t,n,r){let{params:o}=n;t.length>o.length&&tt(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let i=Li(t,o),a=!1,s=r.errors.length;for(let c of o){let u=i[c.name],d=u?Lo(u):{v:void 0};if(!d)continue;if(d.v==null){if(!c.required||c.defaultValue!==void 0)continue;tt(r,e,`/${c.name}`,{code:u?"null-required":"missing-required",signature:Ei(e,o)}),a=!0;continue}let _=Ir(d.v,c.schema,e,`/${c.name}`,r);_===ft&&(_=Fo(c.required,c.defaultValue)),_===ft?a=!0:_===void 0?delete i[c.name]:_!==d.v&&(i[c.name]=Mo(_))}return n.kind==="action"&&r.errors.length>s&&(a=!0),a?null:i}function Tc(e,t,n){let r=e.args.map(n),o=wr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let i=o.builtin?Li(r,o.params):Ic(e.name,r,o,t);return i?{...e,args:r,mappedProps:i}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Oi(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let i of e)kr(i,a=>{if(a.k!=="Comp"||o.has(a))return;o.add(a);let s=wr(t.cat).get(a.name);if(!s||s.lazy)return;let c=s.builtin?null:Ic(a.name,a.args,s,t);a.mappedProps=c??Li(a.args,s.params)});t.currentStatementId=r}function Ac(e,t,n){let r=wr(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],i=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!i)return null;let a=new Set(n);a.add(i);let s=e.args.map((c,u)=>u===1?c:mt(c,t,a));return{...e,args:s}}function mt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Rc(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!zo(e.name,t))return tt(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Ac(e,t,n);if(r)return r;if(zo(e.name,t))return Tc(e,t,a=>mt(a,t,n));let o=e.args.map(a=>mt(a,t,n)),i=t.cat?.get(e.name);if(i){let a={};for(let s=0;s<i.params.length&&s<o.length;s++)a[i.params[s].name]=o[s];return{...e,args:o,mappedProps:a}}return tt(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>mt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,mt(o,t,n)])};case"BinOp":return{...e,left:mt(e.left,t,n),right:mt(e.right,t,n)};case"UnaryOp":return{...e,operand:mt(e.operand,t,n)};case"Ternary":return{...e,cond:mt(e.cond,t,n),then:mt(e.then,t,n),else:mt(e.else,t,n)};case"Member":return{...e,obj:mt(e.obj,t,n)};case"Index":return{...e,obj:mt(e.obj,t,n),index:mt(e.index,t,n)};case"Assign":return{...e,value:mt(e.value,t,n)};default:return e}}function Mi(e,t){return mt(e,t,new Set)}function fn(e,t){switch(e.k){case"Ref":return Rc(e.n,t,"value");case"Str":return e.v;case"Num":return e.v;case"Bool":return e.v;case"Null":return null;case"Ph":return null;case"Arr":{let n=[];for(let r of e.els){if(r.k==="Ph")continue;let o=fn(r,t);o===null&&(r.k==="Comp"||r.k==="Ref")||n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=fn(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!zo(n,t))return tt(t,n,"",{code:"unknown-function"}),null;if(zn(n))return tt(t,n,"",{code:"inline-reserved"}),null;if(zo(n,t)){let s=Ac(e,t,new Set);return s||Tc(e,t,c=>Mi(c,t))}let o=t.cat?.get(n),i={};if(o){let s=!1;for(let u=0;u<o.params.length&&u<r.length;u++){let d=o.params[u],_=fn(r[u],t);if(i[d.name]=_,d.schema===void 0)continue;let p=Ir(_,d.schema,n,`/${d.name}`,t);p===ft&&(p=Fo(d.required,d.defaultValue),p===ft?s=!0:p===void 0&&delete i[d.name]),p!==ft&&p!==void 0&&(i[d.name]=p)}r.length>o.params.length&&tt(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(u=>u.required&&(!(u.name in i)||i[u.name]===null));if(c.length){let u=c.filter(d=>d.defaultValue!==void 0?(i[d.name]=d.defaultValue,!1):!0);if(u.length){for(let d of u)tt(t,n,`/${d.name}`,{code:d.name in i?"null-required":"missing-required",signature:Ei(n,o.params)});return null}}if(s)return null}else return tt(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let a=Object.values(i).some(s=>Uo(s));return{type:"element",typeName:n,props:i,partial:t.partial,hasDynamicProps:a}}default:return vc(e)?Mi(e,t):e}}function Ni(e){let t=[],n=!1,r=!1;for(let a=0;a<e.length;a++){let s=e[a];if(r){r=!1;continue}if(s==="\\"&&n){r=!0;continue}if(n){s===n&&(n=!1);continue}if(s==='"'||s==="'"){n=s;continue}s==="("||s==="["||s==="{"?t.push(s):(s===")"&&t[t.length-1]==="("||s==="]"&&t[t.length-1]==="["||s==="}"&&t[t.length-1]==="{")&&t.pop()}if(!(!!n||t.length>0))return{text:e,wasIncomplete:!1};let i=e;n&&(r&&(i+="\\"),i+=n);for(let a=t.length-1;a>=0;a--)i+=t[a]==="("?")":t[a]==="["?"]":"}";return{text:i,wasIncomplete:!0}}function qo(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===w.Newline;)n++;if(n>=e.length||e[n].t===w.EOF)break;let r=e[n];if(r.t!==w.Ident&&r.t!==w.Type&&r.t!==w.StateVar){for(;n<e.length&&e[n].t!==w.Newline&&e[n].t!==w.EOF;)n++;continue}let o=r.v,i=r.t;if(n++,n>=e.length||e[n].t!==w.Equals){for(;n<e.length&&e[n].t!==w.Newline&&e[n].t!==w.EOF;)n++;continue}n++;let a=[],s=0,c=0;for(;n<e.length&&e[n].t!==w.EOF;){let u=e[n].t;if(u===w.Newline&&s<=0&&c<=0){let d=n+1;for(;d<e.length&&e[d].t===w.Newline;)d++;let _=d<e.length?e[d].t:w.EOF;if(_===w.Question||_===w.Colon&&c>0){n++;continue}break}if(u===w.Newline){n++;continue}u===w.LParen||u===w.LBrack||u===w.LBrace?s++:(u===w.RParen||u===w.RBrack||u===w.RBrace)&&s>0?s--:u===w.Question&&s===0?c++:u===w.Colon&&s===0&&c>0&&c--,a.push(e[n++])}a.length&&t.push({id:o,idTokenType:i,tokens:a})}return t}function Vo(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Lc(e){if(!pn(e))return[];let t=new Set;return kr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Di(e,t){if(t.k==="Comp"&&t.name===Zt.Query){let n=Lc(t.args[1]);return{kind:"query",id:e.id,call:{callee:Zt.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===Zt.Mutation?{kind:"mutation",id:e.id,call:{callee:Zt.Mutation,args:t.args},expr:t}:e.idTokenType===w.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function Im(e,t,n){let r={},o=[],i=[];for(let a of e)switch(a.kind){case"state":r[a.id]=fn(a.init,t);break;case"query":Oi(a.call.args,t,a.id),o.push({statementId:a.id,toolAST:a.call.args[0]??null,argsAST:a.call.args[1]??null,defaultsAST:a.call.args[2]??null,refreshAST:a.call.args[3]??null,deps:a.deps,complete:!0});break;case"mutation":Oi(a.call.args,t,a.id),i.push({statementId:a.id,toolAST:a.call.args[0]??null,argsAST:a.call.args[1]??null});break}for(let a of e){let s=a.kind==="state"?[a.init]:a.kind==="value"?[a.expr]:a.kind==="query"||a.kind==="mutation"?a.call.args:[];for(let c of s)for(let u of Lc(c))u===n?.name&&n.stmts.has(a)||u in r||(r[u]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:i}}var Ec="root";function Fi(e){return e?.k==="Comp"&&!e.fn&&!Cr(e.name)&&!zn(e.name)}function Tm(e,t){if(e.has(Ec))return{id:Ec,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Fi(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function Am(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Fi(e)}function Em(e){let t=!1;return kr(e,n=>{Fi(n)&&(t=!0)}),t}function Ho(e,t,n,r,o,i,a){let s=Tm(e,i),c=new Map;for(let[b,y]of e)c.set(b,y.kind==="state"?y.init:y.expr);let u=[],d=[],_=new Set;for(let[b,y]of e)b!==s?.id&&(y.kind==="state"||y.kind==="query"||y.kind==="mutation"||_.add(b));let p={syms:c,cat:o,errors:d,unres:u,visited:new Set,partial:n,currentStatementId:s?.id,unreached:_},f=null,m;if(s){let b=fn(c.get(s.id),p);_n(b)?(f=b,f.statementId=s.id):pn(b)&&Em(b)&&(m=b)}let{stateDeclarations:g,queryStatements:P,mutationStatements:k}=Im(t,p,a);p.currentStatementId=s?.id;let S=i??"";s?!f&&!m&&!Am(c.get(s.id),c)?tt(p,S,"",{code:"no-root",reason:"not-component"}):s.fallback&&tt(p,S,"",{code:"no-root",reason:f?"fallback":"missing"}):tt(p,S,"",{code:"no-root",reason:"missing"});let h=s?[..._]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:u,orphaned:h,statementCount:r,errors:d},stateDeclarations:g,queryStatements:P,mutationStatements:k}}function Mc(e,t){if(e[t]!=='"')return t;let n=t+1;for(;n<e.length;){let r=e[n];if(r==="\\")n+=2;else{if(r==='"')return n+1;n++}}return n}function Mm(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Mc(e,n);if(s>n){n=s;continue}if(e[n]==="`"&&n+1<e.length&&e[n+1]==="`"&&n+2<e.length&&e[n+2]==="`"){r=n;break}n++}if(r===-1)break;let o=r+3;for(;o<e.length&&e[o]!==`
|
|
43
|
+
`;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let i=-1,a=o;for(;a<e.length;){let s=Mc(e,a);if(s>a){a=s;continue}if(e[a]==="`"&&a+1<e.length&&e[a+1]==="`"&&a+2<e.length&&e[a+2]==="`"){i=a;break}a++}i!==-1?(t.push(e.slice(o,i)),n=i+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
|
|
44
|
+
`);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
|
|
45
|
+
`;)r++;let o=r<e.length?r+1:3,i=e.slice(o),a=i.lastIndexOf("```");return a!==-1?i.slice(0,a):i}return e}function Lm(e){let t=!1;return e.split(`
|
|
46
|
+
`).map(n=>{for(let r=0;r<n.length;r++){let o=n[r];if(t){if(o==="\\"&&r+1<n.length){r++;continue}o===t&&(t=!1);continue}if(o==='"'||o==="'"){t=o;continue}if(o==="/"&&n[r+1]==="/"||o==="#")return n.substring(0,r).trimEnd()}return n}).join(`
|
|
47
|
+
`)}function Oc(e){return Lm(Mm(e.trim())).trim()}function Nc(e,t,n){let r=Oc(e);if(!r)return Vo();let{text:o,wasIncomplete:i}=Ni(r),a=qo(Do(o));if(!a.length)return Vo(i);let s=new Map;for(let u of a){let d=$o(u.tokens),_=Di(u,d);s.set(u.id,_)}let c=[...s.values()];return Ho(s,c,i,s.size,t,n)}function $c(e,t){let n="",r="",o=0,i=new Map,a=0;function s(p){let f=p.trim();if(f)for(let m of qo(Do(f))){let g=$o(m.tokens),P=Di(m,g);i.set(m.id,P),a++}}function c(){let p=Oc(n);p.startsWith(r.slice(0,o))||(o=0,i.clear(),a=0),r=p}function u(){let p=0,f=0,m=!1,g=!1,P=o;for(let k=o;k<r.length;k++){let S=r[k];if(g){g=!1;continue}if(S==="\\"&&m){g=!0;continue}if(m){S===m&&(m=!1);continue}if(S==='"'||S==="'"){m=S;continue}if(S==="("||S==="["||S==="{")p++;else if(S===")"||S==="]"||S==="}")p=Math.max(0,p-1);else if(S==="?"&&p===0)f++;else if(S===":"&&p===0&&f>0)f--;else if(S===`
|
|
48
|
+
`&&p<=0&&f<=0){let h=k+1;for(;h<r.length&&(r[h]===" "||r[h]===" "||r[h]==="\r"||r[h]===`
|
|
49
|
+
`);)h++;if(h<r.length&&(r[h]==="?"||r[h]===":"&&f>0))continue;let b=r.slice(P,k).trim();b&&s(b),P=k+1,o=k+1}}return P}function d(p=!1){c();let f=u(),m=r.slice(f).trim();if(!m)return a===0?Vo():Ho(i,[...i.values()],!1,a,e,t);let{text:g,wasIncomplete:P}=Ni(m),k=qo(Do(g));if(!k.length)return a===0?Vo(P):Ho(i,[...i.values()],P,a,e,t);let S=new Map(i),h=new Set;for(let E of k){if(i.has(E.id)&&P)continue;let Y=$o(E.tokens),j=Di(E,Y);S.set(E.id,j),h.add(j)}let b=p?void 0:/\$\w+$/.exec(n)?.[0],y=b&&m.endsWith(b)&&!new RegExp(`\\${b}(?!\\w)`).test(m.slice(0,-b.length))?b:void 0,C=[...S.values()];return Ho(S,C,P,a+k.length,e,t,y?{name:y,stmts:h}:void 0)}function _(){n="",r="",o=0,i.clear(),a=0}return{push(p,f){return n+=p,d(f)},set(p,f){(p.length<n.length||!p.startsWith(n))&&_();let m=p.slice(n.length);return m&&(n+=m),d(f)},getResult:d}}function Bi(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Bi(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[i,a]of Object.entries(r))r[i]=Bi(a,t),o||(o=r[i]!==a);return o?r:e}function $i(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:Bo(n[o]),schema:t.size?Bi(n[o],t):n[o]}))}function Dc(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(hc),...Object.keys(e.actions??{})]){let i=e.$defs?.[o];i&&!n?.has(o)&&r.set(`#/$defs/${o}`,i)}for(let[o,i]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:$i(i,r)});t.callDefs=new Map(Oo);for(let[o,i]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:$i(i.params,r)});for(let[o,i]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:$i(i.params,r)});return t}var Bc=Dc(xr.schema),Om={parse(e){return Nc(e,Bc,xr.root)}};function Fc(){return $c(Bc,xr.root)}function Ui(e,t){let n=e.root?.props.children,r=[],o=new Set,i=e.meta.errors.some(c=>c.severity!=="warning");for(let c of Array.isArray(n)?n:[]){if(!gc(c)||o.has(c.statementId)){i=!0;continue}if(c.typeName==="Table"&&c.props.rows.some(u=>u.length!==c.props.columns.length)){i=!0;continue}o.add(c.statementId),!((c.typeName==="Chart"||c.typeName==="Table")&&t)&&r.push(c)}let s=e.root?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.root!==null&&e.root.typeName!==xr.root||!t&&(!Array.isArray(n)||i||e.meta.incomplete||e.meta.unresolved.length>0);return{elements:s?[]:r,error:s}}function Uc(e){return Ui(Om.parse(e),!1).elements.map(n=>n.typeName==="Text"?n.props.text:n.typeName==="Card"?`${n.props.title}
|
|
50
|
+
${n.props.body}`:n.typeName==="Metric"?[n.props.label,n.props.value,n.props.detail].filter(Boolean).join(`
|
|
51
|
+
`):n.typeName==="Table"?[n.props.title,n.props.columns.join(" "),...n.props.rows.map(r=>r.join(" "))].join(`
|
|
52
|
+
`):[n.props.title,...n.props.data.map(r=>`${r.label}: ${r.value}`)].join(`
|
|
53
|
+
`)).join(`
|
|
40
54
|
|
|
41
|
-
`).trim(),B=!h&&t!=="error"&&!P.value&&K.length>0,ne=D||B;return i("div",{class:`${Je}-bubble-row`,"data-role":e.role,"data-testid":Ye(R.messageBubble,e.serverMessageId??e.id),children:i("div",{class:`${Je}-bubble-col`,children:[i("div",{class:`${Je}-bubble`,children:[e.role==="operator"&&e.operatorInitials?i("span",{class:`${Je}-bubble-author`,children:e.operatorInitials}):null,i("div",{class:`${Je}-bubble-body`,children:[k?i(Qm,{label:n.loading}):g.map((q,de)=>i(Vm,{part:q,active:E,live:b,strings:n,showReasoning:r,showToolCalls:a,showSources:s,interactive:l&&t==="complete"&&(q.kind!=="tool"||_r(e,de)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:d},`${Gm(q)}#${de}`)),G&&i(jm,{}),t==="error"||P.value?i("div",{class:`${Je}-error`,role:"alert",children:[i("span",{children:e.errorText??n.errorGeneric}),_?i("button",{type:"button",class:`${Je}-error-retry`,onClick:()=>_(e),"data-testid":R.messageRetry,children:n.errorRetry}):null]}):null]})]}),H||ne?i("div",{class:`${Je}-bubble-meta`,children:[H?i("time",{class:`${Je}-bubble-time`,dateTime:H.iso,title:H.full,children:H.short}):null,ne?i("div",{class:`${Je}-bubble-actions`,children:[D&&e.serverMessageId?i(td,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,B?i(zm,{text:K,strings:n}):null]}):null]}):null]})})}function zm({text:e,strings:t}){let[n,o]=$(!1),r=()=>{navigator.clipboard?.writeText(e).then(()=>{o(!0),setTimeout(()=>o(!1),1500)}).catch(()=>{})},a=n?t.copied:t.copy;return i("button",{type:"button",class:`${Je}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:r,"data-testid":R.messageCopy,children:n?i(dn,{}):i(cc,{})})}function qm(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 Vm({part:e,active:t,live:n,strings:o,showReasoning:r,showToolCalls:a,showSources:s,interactive:l,superseded:c,continuationStreaming:d,tool:_}){switch(e.kind){case"step-start":return null;case"text":return i(Dr,{textSig:e.textSig,doneSig:e.doneSig});case"reasoning":return r?i(Km,{part:e,active:t,strings:o}):null;case"tool":return i(Wm,{part:e,strings:o,showToolCalls:a,interactive:l,superseded:c,continuationStreaming:d,live:n,tool:_});case"file":return e.mediaType.startsWith("image/")?i("img",{src:e.url,alt:"",loading:"lazy"}):i("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?i(nd,{part:e,strings:o}):null}}function Wm({part:e,strings:t,showToolCalls:n,interactive:o,superseded:r,continuationStreaming:a,live:s,tool:l}){let c=oe(()=>ge(()=>e.approvalSig.value!==void 0),[e]);return l?.humanInLoop&&c.value?Ar(e.toolName)?i(id,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):i(od,{part:e,strings:t,active:o,superseded:r,continuationStreaming:a,onDecision:l.onDecision,onEdit:l.onEdit}):n?i(ld,{part:e,strings:t,live:s}):null}function Km({part:e,active:t,strings:n}){return i("details",{class:`${Je}-reasoning`,"data-testid":R.reasoning,open:t,"data-active":t?"true":void 0,children:[i("summary",{class:`${Je}-reasoning-summary`,children:i("span",{class:`${Je}-reasoning-label`,children:t?n.thinking:n.thoughts})}),i("div",{class:`${Je}-reasoning-body`,children:i(Dr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Gm(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function jm(){return i("span",{class:`${Je}-typing`,"data-testid":R.typingDots,"aria-hidden":"true",children:[i("span",{}),i("span",{}),i("span",{})]})}function Qm({label:e}){return i("span",{class:`${Je}-loading`,role:"status",children:[i("span",{class:`${Je}-loading-spinner`,"aria-hidden":"true"}),i("span",{class:`${Je}-loading-label`,children:e})]})}var Yt=T.cssPrefix,vi=120,Xm=350;function dd({messagesSig:e,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,enableMessageFeedback:s,onFeedback:l,loading:c,onLoadPreviousMessages:d,idle:_,controlMode:p="ai-agent",tool:u,onRetry:m,form:g,formMarkers:P,onFillForm:y}){let w=O(null),S=ft(()=>e.value),[h,b]=$(!1),[x,k]=$(!1),E=O(!1),G=O(!1),[H,A]=$(),D=O(!1),K=O(!1),B=O(!1),ne=O(0),q=()=>B.current||performance.now()-ne.current<Xm,de=O(0),re=f=>{let N=f.scrollHeight-f.clientHeight>1;f.dataset.fadeTop=N&&f.scrollTop>1?"true":"false",f.dataset.fadeBottom=N&&f.scrollHeight-f.scrollTop-f.clientHeight>1?"true":"false"},qe=f=>b(f.scrollHeight-f.scrollTop-f.clientHeight>vi*2),_e=f=>{de.current=performance.now(),f.scrollTop=f.scrollHeight,re(f)},Se=(f,N)=>{_e(f);let V=N,Q=0,ie=()=>{K.current||q()||(_e(f),--V>0&&(Q=requestAnimationFrame(ie)))};return N>0&&(Q=requestAnimationFrame(ie)),()=>cancelAnimationFrame(Q)},Ze=(f,N)=>{let V,Q,ie,be=-1,ye=()=>{V.disconnect(),Q.disconnect(),clearTimeout(ie)},pe=()=>{if(K.current||q()||be>=0&&f.scrollTop<be-4)return ye();_e(f),be=f.scrollTop};return V=new ResizeObserver(pe),Q=new MutationObserver(pe),pe(),V.observe(f),Q.observe(f,{childList:!0,subtree:!0,characterData:!0}),ie=setTimeout(ye,N),ye},Te=S.value[0]?.id;Ct(()=>{let f=w.current;if(f&&S.value.length!==0&&!G.current&&(D.current=!0,!!S.value.some(N=>N.role==="user")))return Ze(f,300)},[Te]);let Ve=O(0);M(()=>{let f=w.current,N=S.value,V=Ve.current;if(Ve.current=N.length,!f||!D.current||G.current)return;if(N.slice(V).some(ie=>ie.role==="user"))return K.current=!1,Se(f,3);if(!N.some(ie=>ie.role==="user")||K.current||q())return;f.scrollHeight-f.scrollTop-f.clientHeight<vi&&_e(f)},[S.value.length]);let Fe=O(null);M(()=>{let f=w.current,N=S.value.at(-1),V=Fe.current;if(Fe.current=N?{id:N.id,streaming:N.status==="streaming"}:null,!!f&&D.current&&!(!N||N.id!==V?.id||V.streaming||N.status!=="streaming"))return K.current=!1,Se(f,3)},[S.value]),M(()=>{let f=w.current;if(!f)return;let N=S.value.at(-1);if(!N||N.status!=="streaming"&&!S.value.some(ie=>ie.role==="user"))return;let V=()=>{if(K.current||q())return;f.scrollHeight-f.scrollTop-f.clientHeight<vi*2&&_e(f)};if(N.status!=="streaming")return Ze(f,300);V();let Q=new MutationObserver(V);return Q.observe(f,{childList:!0,subtree:!0,characterData:!0}),()=>Q.disconnect()},[S.value]);let rt=g?.form.id,ht=!!g&&(P??[]).some(f=>f.formId===g.form.id);Ct(()=>{let f=w.current;!f||!rt||K.current||S.value.some(N=>N.role==="user")&&(ht?f.querySelector(`[data-testid="${R.formGate}"]`)?.scrollIntoView({block:"nearest"}):_e(f))},[rt,ht]),M(()=>{let f=w.current;if(!f)return;let N=()=>{qe(f),re(f),performance.now()-de.current>150&&(K.current=f.scrollHeight-f.scrollTop-f.clientHeight>8)},V=()=>{K.current=!0},Q=se=>{se.deltaY<0&&V()},ie=0,be=se=>{ie=se.touches[0]?.clientY??0,B.current=!0},ye=se=>{(se.touches[0]?.clientY??0)>ie+4&&V()},pe=()=>{B.current=!1,ne.current=performance.now()},Ge=()=>{B.current=!0};return f.addEventListener("scroll",N,{passive:!0}),f.addEventListener("wheel",Q,{passive:!0}),f.addEventListener("touchstart",be,{passive:!0}),f.addEventListener("touchmove",ye,{passive:!0}),f.addEventListener("touchend",pe,{passive:!0}),f.addEventListener("touchcancel",pe,{passive:!0}),f.addEventListener("pointerdown",Ge,{passive:!0}),window.addEventListener("pointerup",pe,{passive:!0}),window.addEventListener("pointercancel",pe,{passive:!0}),qe(f),()=>{f.removeEventListener("scroll",N),f.removeEventListener("wheel",Q),f.removeEventListener("touchstart",be),f.removeEventListener("touchmove",ye),f.removeEventListener("touchend",pe),f.removeEventListener("touchcancel",pe),f.removeEventListener("pointerdown",Ge),window.removeEventListener("pointerup",pe),window.removeEventListener("pointercancel",pe)}},[]);let We=()=>{let f=w.current;f&&(K.current=!1,_e(f))},tt=S.value.filter(f=>!f.ephemeral),ct=tt[0],we=ct?.serverMessageId??ct?.id,Ie=!!(d&&tt.length>=Ua&&we!==H),dt=async()=>{if(!d||E.current)return;let f=w.current,N=f?.scrollHeight??0,V=f?.scrollTop??0;E.current=!0,G.current=!0,k(!0);try{let Q=await d();Q===!1&&we&&A(we),Q&&f&&(await new Promise(ie=>requestAnimationFrame(()=>requestAnimationFrame(()=>ie()))),f.scrollTop=V+f.scrollHeight-N,re(f),qe(f))}finally{G.current=!1,E.current=!1,k(!1)}},me=[],Le="",Ke=S.value.at(-1)?.id,Ee=[...P??[]].toSorted((f,N)=>(f.createdAt??1/0)-(N.createdAt??1/0)),at=f=>g&&f.formId===g.form.id?i(ni,{form:g.form,strings:t,onSubmit:g.onSubmit,onSkip:g.onSkip},`gate:${f.formId}`):i(Ic,{marker:f,strings:t,onFill:!g&&y?()=>y(f.formId):void 0},f.key),bt=f=>{for(let N=Ee[0];N?.createdAt!==void 0&&!(f!==void 0&&N.createdAt>f);N=Ee[0])Ee.shift(),me.push(at(N))};for(let f of S.value){if(f.role==="assistant"&&f.id!==Ke&&sn(f))continue;bt(f.createdAt);let N=Ym(f.createdAt);N&&N!==Le&&(me.push(i("div",{class:`${Yt}-date-divider`,children:i("span",{class:`${Yt}-date-pill`,title:Jm(f.createdAt),children:Zm(f.createdAt,t)})},`day:${N}`)),Le=N);let Q=f.retryAction!==void 0||f.role==="assistant"&&f.id===Ke?mr(S.value,f):void 0,ie=Q!==void 0&&(Q.kind!=="continue-assistant"||p==="ai-agent");me.push(i(cd,{message:f,status:f.status,strings:t,responseMode:n,showReasoning:o,showToolCalls:r,showSources:a,interactive:!!_&&p==="ai-agent"&&f.id===Ke,superseded:f.id!==Ke,tool:u,onRetry:_&&ie&&(f.role==="user"||f.id===Ke)?m:void 0,enableMessageFeedback:s,onFeedback:l},f.id))}for(let f of Ee)me.push(at(f));return i("div",{class:`${Yt}-list-wrap`,children:[i("div",{ref:w,class:`${Yt}-list ${Yt}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&S.value.length===0?i("div",{class:`${Yt}-list-loading`,role:"status",children:t.conversationLoading}):null,Ie?i("div",{class:`${Yt}-load-previous`,children:i("button",{type:"button",onClick:dt,disabled:x,"aria-busy":x,"data-testid":R.loadPreviousMessages,children:t.loadPreviousMessages})}):null,me,g&&!ht?i(ni,{form:g.form,strings:t,onSubmit:g.onSubmit,onSkip:g.onSkip}):null]}),h?i("button",{type:"button",class:`${Yt}-jump`,onClick:We,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":R.scrollToBottom,children:i(un,{})}):null]})}function Ym(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function Jm(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Zm(e,t){let n=new Date(e),o=a=>new Date(a.getFullYear(),a.getMonth(),a.getDate()).getTime(),r=Math.round((o(new Date)-o(n))/864e5);return r<=0?t.dateToday:r===1?t.dateYesterday:r<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var eg=["today","yesterday","lastWeek","older"];function tg(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let o=Math.floor((ud(e)-ud(n))/(1440*60*1e3));return o<=0?"today":o===1?"yesterday":o<7?"lastWeek":"older"}function _d(e,t){let n=new Map;for(let o of t){let r=tg(e,o.lastMessageAt),a=n.get(r);a?a.push(o):n.set(r,[o])}return eg.filter(o=>n.has(o)).map(o=>({bucket:o,conversations:n.get(o)}))}function ud(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var pd=Z.scope("history"),ng=3,og=6,rg={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function fd(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let r=Bt(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(r.length===0)return t.result;let d=Math.max(t.result.pagination.total,r.length);return{...t.result,conversations:r,pagination:{...t.result.pagination,total:d,totalPages:Math.ceil(d/t.result.pagination.limit)}}}let a=new Set(r.map(d=>d.conversationId)),s=e.conversations.slice(t.result.pagination.limit).filter(d=>!a.has(d.conversationId)),l=e.pagination.page,c={...t.result.pagination,page:l,hasPrev:l>1,hasNext:l<t.result.pagination.totalPages};return{conversations:[...r,...s],pagination:c}}let o=Bt(e.conversations,t,n);return o===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:o}}function ag(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 Br({transport:e,strings:t,locale:n,persistence:o,onSelect:r,onNewConversation:a}){let s=T.cssPrefix,l=e.peekConversations({limit:50}),[c,d]=$(l?"loaded":"loading"),[_,p]=$(l),[u,m]=$(!1),g=O(),P=_?.conversations??[],y=_?.pagination;M(()=>{let x=!1,k=!0,E=[],G=e.subscribeConversationChanges(A=>{k&&E.push(A),p(D=>D&&fd(D,A))});g.current=void 0,m(!1);let H=e.peekConversations({limit:50});return p(H),d(H?"loaded":"loading"),e.listConversations({limit:50}).then(A=>{if(x)return;let D=A;for(let K of E)D=fd(D,K);E=[],k=!1,p(D),d("loaded"),o.saveHistoryCount(D.conversations.length)}).catch(A=>{x||(E=[],k=!1,pd.warn("listConversations failed",{err:A}),d("error"))}),()=>{x=!0,G(),g.current=void 0}},[e,o,n]);let w=async()=>{if(g.current||!y?.hasNext)return;let x={};g.current=x,m(!0);try{let k=await e.listConversations({page:y.page+1,limit:y.limit});if(g.current!==x)return;p(E=>{if(!E)return E;let G=new Set(E.conversations.map(D=>D.conversationId)),H=k.conversations.filter(D=>G.has(D.conversationId)?!1:(G.add(D.conversationId),!0)),A={conversations:[...E.conversations,...H],pagination:k.pagination};return o.saveHistoryCount(A.conversations.length),A})}catch(k){if(g.current!==x)return;pd.warn("listConversations page failed",{err:k,page:y.page+1})}finally{g.current===x&&(g.current=void 0,m(!1))}},S=a?i("div",{class:`${s}-history-footer`,children:i("button",{type:"button",class:`${s}-history-new`,onClick:a,"data-testid":R.sidebarNewConversation,children:[i(Nl,{}),t.newConversation]})}):null;if(c==="loading"){let x=Math.min(o.loadHistoryCount()??ng,og);return i(fe,{children:[i("div",{class:`${s}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:i("div",{class:`${s}-history-group`,"aria-hidden":"true",children:[i("div",{class:`${s}-history-heading`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-heading`})}),i("div",{class:`${s}-history-card`,children:Array.from({length:Math.max(1,x)},(k,E)=>i("div",{class:`${s}-history-item ${s}-history-item-skeleton`,children:[i("span",{class:`${s}-history-avatar ${s}-skeleton`}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-title`})}),i("span",{class:`${s}-history-time`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-time`})})]}),i("span",{class:`${s}-history-row`,children:i("span",{class:`${s}-history-preview`,children:i("span",{class:`${s}-skeleton ${s}-skeleton-preview`})})})]})]},E))})]})}),S]})}if(c==="error"||P.length===0)return i(fe,{children:[i("div",{class:`${s}-history-empty`,children:t.historyEmpty}),S]});let h=Date.now(),b=_d(h,P);return i(fe,{children:[i("div",{class:`${s}-history`,role:"list",children:[b.map(x=>i("div",{class:`${s}-history-group`,children:[i("div",{class:`${s}-history-heading`,children:t[rg[x.bucket]]}),i("div",{class:`${s}-history-card`,children:x.conversations.map(k=>i("button",{type:"button",role:"listitem",class:`${s}-history-item`,onClick:()=>r(k),"data-closed":k.canContinue?void 0:"true","data-unread":k.hasUnread?"true":void 0,"data-testid":Ye(R.historyItem,k.conversationId),children:[i("span",{class:`${s}-history-avatar`,"aria-hidden":"true",children:i(Qa,{})}),i("span",{class:`${s}-history-body`,children:[i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-title`,children:k.title}),i("span",{class:`${s}-history-time`,children:ag(k.lastMessageAt,h,n)})]}),i("span",{class:`${s}-history-row`,children:[i("span",{class:`${s}-history-preview`,children:k.preview??(k.canContinue?t.historyContinue:t.conversationClosed)}),k.hasUnread?i("span",{class:`${s}-history-dot`}):null]})]})]},k.conversationId))})]},x.bucket)),y?.hasNext?i("div",{class:`${s}-history-more`,children:i("button",{type:"button",onClick:w,disabled:u,"aria-busy":u,"data-testid":R.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var md=T.cssPrefix;function gd({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:i("div",{class:`${md}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((o,r)=>i("button",{type:"button",class:`${md}-suggestion`,onClick:()=>t(o),disabled:n,"data-testid":Ye(R.suggestion,r),children:o.label},o.id))})}var $e=T.cssPrefix;function vd(e){let{options:t,onClose:n}=e,o=t.strings,r=O(null);M(()=>{let d=r.current;if(!d)return;let _=wr(d),p=u=>{u.key==="Escape"&&n?.()};return d.addEventListener("keydown",p),()=>{_(),d.removeEventListener("keydown",p)}},[n]);let a=e.composerApiRef,s=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,l=L(d=>{s&&a.current?.attachFromDrop(d)},[a,s]),{visible:c}=Tr({containerRef:r,onDrop:l,disabled:!s});return Sr(r.current,t.mode==="modal"),i("div",{ref:r,class:`${$e}-panel`,role:"dialog","aria-modal":"false","aria-label":o.panelTitle,style:{position:"relative"},"data-testid":R.panel,children:[i(hi,{...e,containerEl:r.current,dragOver:c}),i(bi,{poweredBy:e.options.poweredBy})]})}function hi(e){let{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,composerKey:l,panelSize:c,view:d,canSend:_,isStreaming:p,isMemoryCompacting:u,canReleaseQueuedMessages:m,queueManualMessages:g,sendPreparing:P,controlMode:y,assignedOperatorInitials:w,operatorAvailable:S,operatorRequestEnabled:h,onRequestOperator:b,onCancelOperatorRequest:x,loadingMessages:k,onLoadPreviousMessages:E,messagesSig:G,agent:H,suggestions:A,initialWidgetSize:D,onClose:K,onBack:B,onClear:ne,onToggleHistory:q,onSelectHistoryConversation:de,onNewConversation:re,onWidgetSizeChange:qe,onSend:_e,onStop:Se,onSuggestion:Ze,activeForm:Te,formMarkers:Ve,onFormSubmit:Fe,onFormSkip:rt,onFormFill:ht,tool:We,onRetry:tt,onMessageFeedback:ct,containerEl:we,dragOver:Ie,composerApiRef:dt}=e,me=t.strings,Le=ft(()=>G.value.some(Ee=>!Ee.ephemeral&&Ee.role!=="system")).value,Ke;return Te?Ke=null:_?Ke=i(fe,{children:[y&&y!=="ai-agent"?i(lg,{controlMode:y,operatorInitials:w,operatorAvailable:S,onCancelOperatorRequest:x,strings:me}):null,u&&y==="ai-agent"?i("div",{class:`${$e}-loading ${$e}-compaction-status`,role:"status","data-testid":R.compactionStatus,children:[i("span",{class:`${$e}-loading-spinner`,"aria-hidden":"true"}),me.compactingContext]}):null,!p&&!u&&y==="ai-agent"&&i(gd,{suggestions:A,onPick:Ze,disabled:P}),i(Sc,{options:t,transport:n,feedback:o,bus:r,persistence:a,conversationId:s,isStreaming:p,isMemoryCompacting:u,canReleaseQueuedMessages:m,queueManualMessages:g,active:e.composerActive&&d==="chat",isPreparing:P,operatorRequestEnabled:h,canRequestOperator:Le,controlMode:y,onRequestOperator:b,onSend:_e,onStop:Se,apiRef:dt},l)]}):Ke=i(sg,{label:me.conversationClosed,ctaLabel:me.startNewConversation,onNewConversation:ne}),i(fe,{children:[d==="history"?i(ig,{strings:me,onBack:q,onClose:K,showClose:kr(t.mode,c,t.actions)}):i("header",{class:`${$e}-header`,"data-testid":R.panelHeader,children:[B?i("button",{type:"button",class:`${$e}-icon-btn`,onClick:B,"aria-label":me.moduleBack,title:me.moduleBack,children:i(po,{})}):null,H?i(bc,{agent:H,strings:me}):i("h1",{children:me.panelTitle}),i(Et,{panelProps:e,variant:"chat"})]}),d==="history"?i(Br,{transport:n,strings:me,locale:t.locale,persistence:a,onSelect:de,onNewConversation:re}):i(fe,{children:[i(kc,{visible:Ie,strings:me}),i(dd,{messagesSig:G,strings:me,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:ct,loading:k,onLoadPreviousMessages:E,idle:!p&&!P&&_&&!Te,controlMode:y,tool:We,onRetry:tt,form:Te?{form:Te,onSubmit:Fe,onSkip:rt}:null,formMarkers:Ve,onFillForm:ht}),Ke,i(dg,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?i(xr,{panelEl:we,resize:t.size.resize,position:t.position,initialSize:D,onSizeChange:qe,strings:me}):null]})}function ig({strings:e,onBack:t,onClose:n,showClose:o}){return i("header",{class:`${$e}-header`,children:[i("button",{type:"button",class:`${$e}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:i(po,{})}),i("h1",{children:e.historyTitle}),o?i("button",{type:"button",class:`${$e}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:i(St,{})}):null]})}function sg({label:e,ctaLabel:t,onNewConversation:n}){return i("div",{class:`${$e}-readonly-banner`,role:"note",children:[i("span",{class:`${$e}-readonly-label`,children:e}),i("button",{type:"button",class:`${$e}-readonly-cta`,onClick:n,children:t})]})}function lg({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:o,strings:r}){let a=cg(e,t,n,r);return i("div",{class:`${$e}-operator-banner`,role:"status","data-mode":e,"data-testid":R.operatorBanner,children:[i("span",{class:`${$e}-operator-pulse`,"aria-hidden":"true"}),i("span",{class:`${$e}-operator-label`,children:a}),e==="awaiting-operator"&&o?i("button",{type:"button",class:`${$e}-cancel-operator-request`,"data-testid":R.cancelOperatorRequest,onClick:o,children:r.cancelOperatorRequest}):null]})}function cg(e,t,n,o){return e==="operator"?o.chattingWithOperator.replace("{operator}",t??""):n===!1?o.noOperatorAvailable:o.connectingOperator}function dg({disclaimer:e}){return e?i("div",{class:`${$e}-composer-footer`,children:i("div",{class:`${$e}-disclaimer`,children:e})}):null}function bi({poweredBy:e}){return e?i("div",{class:`${$e}-poweredby-bar`,children:i(ug,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function ug({logoUrl:e,text:t,href:n}){let o=i(fe,{children:[e?i("img",{class:`${$e}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?i("span",{children:t}):null]});return n?i("a",{class:`${$e}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:o}):i("span",{class:`${$e}-poweredby`,children:o})}function hd(e){let t=O(e);t.current=e;let n=O(null);return n.current??(n.current=_g(t)),n.current}function _g(e){let t=te(null),n=new Set,o=c=>`${e.current.conversationId()??""}:${c}`,r=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 _=e.current;if(c==="manual"){let p=_.forms.list.find(u=>u.id===d);p&&(t.value={form:p,trigger:"manual"});return}for(let p of _.forms.byTrigger[c]??[]){let u=p.triggers.find(m=>m.kind===c);if(!(!u||!pg(u,_)||r(p)||!fg(p,_))){t.value={form:p,trigger:c};return}}},s=(c,d)=>{let _=t.value;if(!_)return;t.value=null;let{form:p,trigger:u}=_;p.frequency==="conversation"?n.add(o(p.id)):p.frequency!=="always"&&e.current.persistence.saveFormDone(p.id),e.current.onComplete(p,u,c,d)};return{activeForm:t,fire:a,refresh:()=>{let c=t.value;if(!c)return;let d=e.current.forms.list.find(_=>_.id===c.form.id);d&&d!==c.form&&(t.value={form:d,trigger:c.trigger})},complete:c=>s(c,!1),skip:()=>s({},!0)}}function pg(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function fg(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let r=t.userContext()??{};if(n.missingContext.some(a=>r[a]!==void 0&&r[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 bd(e){let t=T.cssPrefix,{site:n,blocks:o,strings:r,collapsed:a}=e,s=o?.navigation??[],l=o?.linkCards??[],c=a?r.expandSidebar:r.collapseSidebar;return i("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":R.sidebar,children:[i("div",{class:`${t}-sidebar-header`,children:[i(mg,{site:n}),i("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":R.sidebarToggle,children:i(gg,{collapsed:a})})]}),a?null:i(fe,{children:[s.length>0?i("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:i(vg,{items:s})}):null,l.length>0?i("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:i(hg,{items:l})}):null,e.showConversations?i("div",{class:`${t}-sidebar-conversations`,children:i(Br,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function mg({site:e}){let t=T.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return i("picture",{children:[e.logoDark?.url?i("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,i("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return i("div",{class:`${t}-sidebar-title`,children:e?.title??T.name})}function gg({collapsed:e}){return i("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?i("polyline",{points:"9 6 15 12 9 18"}):i("polyline",{points:"15 6 9 12 15 18"})})}function vg({items:e}){let t=T.cssPrefix;return i("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>i("li",{children:i("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?i("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,i("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function hg({items:e}){let t=T.cssPrefix;return i("div",{class:`${t}-sidebar-cards`,children:e.map(n=>i("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[i("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?i("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var yd=T.cssPrefix;function Pd(e){return i("main",{class:`${yd}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[i(bd,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),i("section",{class:`${yd}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var xd=e=>Object.fromEntries(e.map(t=>[t,[]]));function yi(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Sd(e,t,n){let o=[...new Set(t)],r=yi(o,e,""),a=te({activeTab:r,stacks:xd(o)});return{sig:a,reconcile(s,l){let c=[...new Set(s)],d=a.value,_=yi(c,d.activeTab,l),p=Object.fromEntries(c.map(m=>[m,d.stacks[m]??[]])),u=_===d.activeTab&&c.length===Object.keys(d.stacks).length&&c.every(m=>d.stacks[m]===p[m]);o=c,!u&&(a.value={activeTab:_,stacks:p},_!==d.activeTab&&_&&n?.(_))},switchTab(s){!(s in a.value.stacks)||a.value.activeTab===s||(a.value={...a.value,activeTab:s},n?.(s))},push(s){let l=a.value,c=l.stacks[l.activeTab]??[];a.value={...l,stacks:{...l.stacks,[l.activeTab]:[...c,s]}}},pop(){let s=a.value,l=s.stacks[s.activeTab]??[];l.length!==0&&(a.value={...s,stacks:{...s.stacks,[s.activeTab]:l.slice(0,-1)}})},reset(s){a.value={activeTab:yi(o,s,""),stacks:xd(o)}}}}var kd=e=>e.stacks[e.activeTab]??[],wd=e=>kd(e).at(-1),Cd=e=>kd(e).length===0;var Rd={Icon:mo};var Jt=T.cssPrefix;function Ur({title:e,actions:t}){return i("header",{class:`${Jt}-back-header`,"data-variant":"title",children:[i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"}),i("h1",{class:`${Jt}-back-title`,children:e}),t??i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"})]})}function Hr({title:e,backLabel:t,onBack:n,actions:o,testid:r}){return i("header",{class:`${Jt}-back-header`,"data-testid":r,children:[i("button",{type:"button",class:`${Jt}-icon-btn`,onClick:n,"aria-label":t,title:t,children:i(po,{})}),i("h1",{class:`${Jt}-back-title`,children:e}),o??i("span",{class:`${Jt}-back-spacer`,"aria-hidden":"true"})]})}function fn(e,t){return e instanceof Xe&&e.status===429?t.errorRateLimited:t.errorGeneric}var Un=T.cssPrefix;function Td({placeholder:e,onActivate:t}){return i("button",{type:"button",class:`${Un}-home-search`,onClick:t,"data-testid":R.homeSearch,children:[i("span",{class:`${Un}-home-search-text`,children:e}),i("span",{class:`${Un}-home-search-icon`,"aria-hidden":"true",children:i(Ya,{})})]})}function Id({placeholder:e,value:t,onInput:n}){return i("div",{class:`${Un}-home-search`,"data-input":"true",children:[i("input",{type:"search",class:`${Un}-home-search-input`,placeholder:e,value:t,onInput:o=>n(o.currentTarget.value),"data-testid":R.helpSearch}),i("span",{class:`${Un}-home-search-icon`,"aria-hidden":"true",children:i(Ya,{})})]})}var ho=T.cssPrefix;function zr({title:e,subtitle:t,onClick:n,testid:o}){return i("button",{type:"button",class:`${ho}-list-row`,onClick:n,"data-testid":o,children:[i("span",{class:`${ho}-list-row-body`,children:[i("span",{class:`${ho}-list-row-title`,children:e}),t?i("span",{class:`${ho}-list-row-sub`,children:t}):null]}),i("span",{class:`${ho}-list-row-chevron`,"aria-hidden":"true",children:i(Ln,{})})]})}var Ed=T.cssPrefix;function wt({tone:e="info",message:t,onRetry:n,strings:o}){return i("div",{class:`${Ed}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[i("span",{children:t}),n?i("button",{type:"button",class:`${Ed}-module-retry`,onClick:n,children:o.errorRetry}):null]})}var mn=T.cssPrefix,bg=Z.scope("help"),yg=(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 Pg(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 Ad(e,t){let n=t.toLowerCase(),o=n.indexOf(e);if(o!==-1)return 100-Math.min(o,99);let r=0;for(let a of e){if(r=n.indexOf(a,r),r===-1)return 0;r+=1}return 1}function xg(e,t){let n=t.toLowerCase().trim();return n?e.map(o=>({item:o,score:Math.max(Ad(n,o.title)*2,Ad(n,o.description??""))})).filter(o=>o.score>0).toSorted((o,r)=>r.score-o.score).map(o=>o.item):[]}function Md({article:e,nav:t}){return i(zr,{title:e.title,subtitle:e.description,onClick:()=>yg(t,e),testid:Ye(R.helpArticle,e.id)})}function Sg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,_]=$(t.errorGeneric),[p,u]=$([]),[m,g]=$(""),[P,y]=$(0);M(()=>{let h=!1;return c("loading"),e.listContent({tags:s,sortBy:"order",limit:100}).then(b=>{if(h)return;let x=b.items??[];u(x),c("loaded"),r.emit("contentView",{section:"help",tags:s?.join(","),count:x.length})}).catch(b=>{h||(bg.warn("listContent (help) failed",{err:b}),_(fn(b,t)),c("error"))}),()=>{h=!0}},[e,s,P,r]);let w=oe(()=>xg(p,m),[p,m]);M(()=>{let h=m.trim();if(!h)return;let b=setTimeout(()=>r.emit("contentSearch",{queryLength:h.length,hitCount:w.length}),600);return()=>clearTimeout(b)},[m,w,r]);function S(){return m.trim().length>0?w.length===0?i(wt,{message:t.helpSearchEmpty,strings:t}):i("div",{class:`${mn}-help-card`,children:w.map(h=>i(Md,{article:h,nav:o},h.id))}):l==="loading"?i(wt,{message:t.helpLoading,strings:t}):l==="error"?i(wt,{tone:"error",message:d,onRetry:()=>y(h=>h+1),strings:t}):p.length===0?i(wt,{message:t.helpEmpty,strings:t}):Pg(p).map(([h,b])=>i("section",{class:`${mn}-help-group`,children:[h?i("h2",{class:`${mn}-help-section-title`,children:h}):null,i("div",{class:`${mn}-help-card`,children:b.map(x=>i(Md,{article:x,nav:o},x.id))})]},h))}return i("div",{class:`${mn}-module`,children:[i(Ur,{title:t.helpTitle,actions:i(Et,{panelProps:a,variant:"plain"})}),i("div",{class:`${mn}-module-pad`,children:i(Id,{placeholder:t.helpSearchPlaceholder,value:m,onInput:g})}),i("div",{class:`${mn}-help-list`,children:S()})]})}var Ld={Icon:fo,Root:e=>i(Sg,{...e})};var Od=T.cssPrefix;function Pi({onClick:e,children:t,testid:n}){return e?i("button",{type:"button",class:`${Od}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):i("div",{class:`${Od}-home-card`,"data-testid":n,children:t})}var Re=T.cssPrefix,Nd=Z.scope("home");function kg(e){let t=e.options.userContext?.name,n=e.config.greetingText?lt(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 wg=(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 Dd(e,t){return Bt(e,t,t.type!=="upsert"||t.activity===!0)}function Cg(e){let{transport:t,strings:n,config:o,nav:r,bus:a,panelProps:s}=e,[l,c]=$(null),[d,_]=$([]),p=o.contentTags?.join(","),u=e.options.modules.list.some(S=>S.layout==="chat");M(()=>{if(o.showRecentConversations===!1)return;let S=!1,h=!0,b=[],x=t.subscribeConversationChanges(k=>{h&&b.push(k),c(E=>Dd(E?[E]:[],k)[0]??null)});return t.listConversations({limit:u?50:1}).then(k=>{if(S)return;let E=b.reduce(Dd,k.conversations);b=[],h=!1,c(E[0]??null)}).catch(k=>{S||(b=[],h=!1,Nd.warn("listConversations (home) failed",{err:k}))}),()=>{S=!0,x()}},[t,o.showRecentConversations,u]),M(()=>{if(!o.contentTags?.length)return;let S=!1;return t.listContent({tags:o.contentTags,limit:6}).then(h=>{if(S)return;let b=h.items??[];_(b),a.emit("contentView",{section:"home",tags:p,count:b.length})}).catch(h=>!S&&Nd.warn("listContent (home) failed",{err:h})),()=>{S=!0}},[t,p,a]);let m=kg(e),g=o.userAvatars??[],P=o.status,y=P?.text?lt(n,P.text):n.homeStatus,w=o.contentBlockTitle?lt(n,o.contentBlockTitle):n.homeContentTitle;return i("div",{class:`${Re}-module ${Re}-home`,"data-testid":R.homeView,children:i("div",{class:`${Re}-home-scroll`,children:[i("div",{class:`${Re}-home-hero`,children:[i("div",{class:`${Re}-home-hero-top`,children:[o.brandName?i("span",{class:`${Re}-home-brand`,"data-testid":R.homeBrand,children:o.brandName}):i("span",{class:`${Re}-home-brand-spacer`,"aria-hidden":"true"}),i("div",{class:`${Re}-home-hero-actions`,children:[g.length>0?i("div",{class:`${Re}-home-avatars`,children:g.map(S=>i("span",{class:`${Re}-home-avatar`,title:S.role?`${S.name} \xB7 ${S.role}`:S.name,children:S.avatar?i("img",{src:S.avatar,alt:"",loading:"lazy"}):i("span",{children:Cr(S.name)})},S.name))}):null,i(Et,{panelProps:s,variant:"plain"})]})]}),o.showGreeting!==!1?i(fe,{children:[i("h1",{class:`${Re}-home-greeting`,"data-testid":R.homeGreeting,children:m.title}),m.subtitle?i("p",{class:`${Re}-home-lead`,children:m.subtitle}):null]}):null]}),i("div",{class:`${Re}-home-cards`,children:[o.showSearchBar!==!1?i(Td,{placeholder:n.homeSearchPlaceholder,onActivate:()=>r.switchToLayout("help")}):null,l?i(Pi,{onClick:()=>r.selectConversation(l),testid:R.homeRecent,children:i("div",{class:`${Re}-home-recent-row`,"data-unread":l.hasUnread?"true":void 0,children:[i("span",{class:`${Re}-home-recent-avatar`,"aria-hidden":"true",children:i(mo,{})}),i("span",{class:`${Re}-home-recent-body`,children:[i("span",{class:`${Re}-home-recent-title`,children:l.title}),l.preview?i("span",{class:`${Re}-home-recent-preview`,children:l.preview}):null]}),l.hasUnread?i("span",{class:`${Re}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,P?i(Pi,{onClick:P.url?()=>r.push({kind:"iframe",url:P.url,title:y}):void 0,children:i("div",{class:`${Re}-home-status`,"data-level":P.level??"operational",children:[i("span",{class:`${Re}-home-status-icon`,"aria-hidden":"true",children:i(oc,{})}),i("span",{class:`${Re}-home-status-text`,children:y})]})}):null,d.length>0?i("section",{class:`${Re}-home-content`,children:[i("div",{class:`${Re}-home-content-title`,children:w}),i("div",{class:`${Re}-home-content-list`,children:d.map(S=>i(zr,{title:S.title,subtitle:S.description,onClick:()=>wg(r,S),testid:Ye(R.homeContentRow,S.id)},S.id))})]}):null]})]})})}var $d={Icon:rc,Root:e=>i(Cg,{...e})};var Zt=T.cssPrefix,Rg=Z.scope("news");function Tg({transport:e,strings:t,config:n,nav:o,bus:r,panelProps:a}){let s=n.contentTags,[l,c]=$("loading"),[d,_]=$(t.errorGeneric),[p,u]=$([]),[m,g]=$(0);M(()=>{let y=!1;return c("loading"),e.listContent({tags:s,sortBy:"publishedAt",sortOrder:"desc"}).then(w=>{if(y)return;let S=w.items??[];u(S),c("loaded"),r.emit("contentView",{section:"news",tags:s?.join(","),count:S.length})}).catch(w=>{y||(Rg.warn("listContent (news) failed",{err:w}),_(fn(w,t)),c("error"))}),()=>{y=!0}},[e,s,m,r]);function P(){return l==="loading"?i(wt,{message:t.newsLoading,strings:t}):l==="error"?i(wt,{tone:"error",message:d,onRetry:()=>g(y=>y+1),strings:t}):p.length===0?i(wt,{message:t.newsEmpty,strings:t}):i("div",{class:`${Zt}-news-list`,children:p.map(y=>i("button",{type:"button",class:`${Zt}-news-card`,onClick:()=>o.push({kind:"content",id:y.id,title:y.title}),"data-testid":Ye(R.newsItem,y.id),children:[y.image?i("img",{class:`${Zt}-news-hero`,src:y.image,alt:"",loading:"lazy"}):null,i("span",{class:`${Zt}-news-body`,children:[i("span",{class:`${Zt}-news-title`,children:y.title}),y.description?i("span",{class:`${Zt}-news-summary`,children:y.description}):null]})]},y.id))})}return i("div",{class:`${Zt}-module`,children:[i(Ur,{title:t.newsTitle,actions:i(Et,{panelProps:a,variant:"plain"})}),i("div",{class:`${Zt}-module-scroll`,children:P()})]})}var Fd={Icon:ac,Root:e=>i(Tg,{...e})};var qr={chat:Rd,home:$d,help:Ld,news:Fd};var bo=T.cssPrefix;function Bd({modules:e,activeTab:t,strings:n,hasUnread:o,onSelect:r}){return i("nav",{class:`${bo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let s=qr[a.layout].Icon,l=a.id===t,c=a.layout==="chat"&&o;return i("button",{type:"button",role:"tab","aria-selected":l,class:`${bo}-tab`,onClick:()=>r(a.id),"data-testid":Ye(R.tab,a.id),children:[i("span",{class:`${bo}-tab-icon`,"aria-hidden":"true",children:[i(s,{}),c?i("span",{class:`${bo}-tab-badge`,"data-testid":R.tabBadge,"aria-label":"Unread"}):null]}),i("span",{class:`${bo}-tab-label`,children:lt(n,a.label)})]},a.id)})})}var Ud=T.cssPrefix,Ig="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Hd({url:e,title:t,strings:n,onBack:o,actions:r}){return i("div",{class:`${Ud}-module`,children:[i(Hr,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:o,actions:r}),i("iframe",{class:`${Ud}-content-frame`,src:e,title:t||"content",sandbox:Ig,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var yo=T.cssPrefix,Eg=Z.scope("content"),Ag=5e3;function zd({id:e,title:t,transport:n,strings:o,bus:r,onBack:a,actions:s}){let[l,c]=$(null),[d,_]=$(!1),[p,u]=$(0),m=L(()=>{_(!1),c(null),u(y=>y+1)},[]);M(()=>{let y=!1;return n.listContent({ids:[e],limit:1}).then(w=>{if(y)return;let S=w.items[0];S?(c(S),r.emit("contentOpen",{contentId:e,tags:S.tags?.length?S.tags.join(","):void 0})):_(!0)}).catch(w=>{y||(Eg.warn("listContent (reader) failed",{err:w}),_(!0))}),()=>{y=!0}},[n,e,p,r]),M(()=>{if(!l)return;let y=setTimeout(()=>r.emit("contentRead",{contentId:e}),Ag);return()=>clearTimeout(y)},[l,e,r]);let g=L(y=>{let S=y.target?.closest?.("a")?.getAttribute("href")??"";S&&!S.startsWith("#")&&r.emit("contentLinkClick",{contentId:e})},[r,e]);function P(){return d?i(wt,{tone:"error",message:o.errorGeneric,onRetry:m,strings:o}):l===null?i(wt,{message:o.contentLoading,strings:o}):i("article",{class:`${yo}-content`,"data-testid":R.contentView,onClick:g,children:[l.image?i("img",{class:`${yo}-content-hero`,src:l.image,alt:"",loading:"lazy"}):null,l.description?i("p",{class:`${yo}-content-subtitle`,children:l.description}):null,i(ed,{text:l.content??""})]})}return i("div",{class:`${yo}-module`,children:[i(Hr,{title:l?.title||t||o.moduleBack,backLabel:o.moduleBack,onBack:a,actions:s,testid:R.backHeader}),i("div",{class:`${yo}-module-scroll`,"data-testid":R.contentScroll,children:P()})]})}var Vr=T.cssPrefix;function qd({panelProps:e,enabledModules:t,nav:n,bus:o,hasUnread:r,onSelectConversation:a,onStartNewConversation:s,onSetPanelSize:l}){let c=e.options,d=c.strings,_=O(null),p=O(new Set);M(()=>{let B=_.current;if(!B)return;let ne=wr(B),q=de=>{de.key==="Escape"&&e.onClose?.()};return B.addEventListener("keydown",q),()=>{ne(),B.removeEventListener("keydown",q)}},[e.onClose]);let u=ft(()=>n.sig.value).value,m=wd(u),g=c.modules.byId[u.activeTab],P=e.composerActive&&g?.layout==="chat"&&m===void 0,y=e.composerApiRef,w=P&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,S=L(B=>{w&&y.current?.attachFromDrop(B)},[y,w]),{visible:h}=Tr({containerRef:_,onDrop:S,disabled:!w});Sr(_.current,c.mode==="modal");let b=m?.kind==="iframe"||m?.kind==="content",x=t.length>1&&(Cd(u)||!b),k=O(null);M(()=>{if(b&&k.current===null)k.current=e.panelSize,e.panelSize==="normal"&&l("expanded");else if(!b&&k.current!==null){let B=k.current;k.current=null,l(B)}},[b]);let E={push:B=>n.push(B),pop:()=>n.pop(),switchTab:B=>n.switchTab(B),switchToLayout:B=>{let ne=t.find(q=>q.layout===B);ne&&n.switchTab(ne.id)},selectConversation:a,startNewConversation:s},G=B=>({options:c,transport:e.transport,strings:d,config:B,nav:E,bus:o,panelProps:e}),H=i(Et,{panelProps:e,variant:"plain"});g&&p.current.add(g.id);let A=t.filter(B=>p.current.has(B.id)),D=B=>{if(B.layout==="chat")return i(hi,{...e,composerActive:P,containerEl:_.current,dragOver:h});let ne=qr[B.layout].Root;return ne?i(ne,{...G(B)}):null},K=()=>m?.kind==="iframe"?i(Hd,{url:m.url,title:m.title,strings:d,onBack:()=>n.pop(),actions:H}):m?.kind==="content"?i(zd,{id:m.id,title:m.title,transport:e.transport,strings:d,bus:o,onBack:()=>n.pop(),actions:H}):null;return i("div",{ref:_,class:`${Vr}-panel ${Vr}-messenger`,role:"dialog","aria-modal":"false","aria-label":d.panelTitle,style:{position:"relative"},"data-testid":R.messengerHome,children:[i("div",{class:`${Vr}-messenger-body`,children:[A.map(B=>i("div",{class:`${Vr}-messenger-pane`,hidden:b||B.id!==g?.id,children:D(B)},B.id)),K()]}),x?i(Bd,{modules:t,activeTab:u.activeTab,strings:d,hasUnread:r,onSelect:B=>n.switchTab(B)}):null,i(bi,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(g?.layout==="chat"&&!m)?i(xr,{panelEl:_.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:d}):null]})}var Po=T.cssPrefix;function Vd({strings:e,onClose:t}){return i("div",{class:`${Po}-panel ${Po}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":R.modulesEmpty,children:[t?i("button",{type:"button",class:`${Po}-icon-btn ${Po}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:i(St,{})}):null,i("p",{class:`${Po}-modules-empty-text`,children:e.modulesEmpty})]})}function Hn(e,t,n,o){let r={role:n,text:o};e.emit("message",r),t.onMessage?.(r)}var xi=Z.scope("hitl");function Wd(e){let{streaming:t,controlModeSig:n,messagesSig:o,sendAiTurn:r,bus:a,humanInLoop:s}=e,l=O(t);l.current=t;let c=L((u,m,g)=>{if(l.current||n.value!=="ai-agent")return!1;let P=o.value.at(-1),y=P?.partsSig.value.findIndex(S=>S.kind==="tool"&&S.toolCallId===u)??-1,w=P?.partsSig.value[y];return!P||w?.kind!=="tool"?(xi.warn("decideTool: tool part not found",{toolCallId:u}),!1):P.status!=="complete"||!_r(P,y)||!m(w)?!1:(g(w),P.partsSig.value=[...P.partsSig.value],ln(P)&&(P.status="streaming",P.retryAction={kind:"continue-assistant",messageId:P.serverMessageId??P.id},P.awaitingContinuation=!0,o.value=[...o.value],r({continueExisting:!0})),!0)},[n,o,r]),d=L((u,m,g)=>{let P=!1;if(c(u,w=>w.stateSig.value==="approval-requested",w=>{P=Ar(w.toolName);let S=w.approvalSig.value?.id??u;w.approvalSig.value={id:S,approved:m,reason:g},w.stateSig.value="approval-responded"})){if(P){xi.info("toolResult",{toolCallId:u}),a.emit("toolResult",{toolCallId:u});return}xi.info("toolDecision",{toolCallId:u,approved:m}),a.emit("toolDecision",{toolCallId:u,approved:m})}},[a,c]),_=L(u=>{c(u,m=>m.stateSig.value==="approval-responded"&&m.approvalSig.value?.approved!==void 0,m=>{let g=m.approvalSig.value?.id??u;m.approvalSig.value={id:g},m.stateSig.value="approval-requested"})},[c]);return{toolInteraction:oe(()=>({humanInLoop:s,onDecision:d,onEdit:_}),[s,d,_])}}function Kd({callout:e,persistence:t}){let n=e?.text??"",o=e?.persistent??!0,[r,a]=$(()=>o?!1:t.loadCalloutDismissed(n));M(()=>{a(o?!1:t.loadCalloutDismissed(n))},[n,o,t]);let s=L(()=>{a(!0),o||t.saveCalloutDismissed(n)},[t,n,o]);return{dismissed:r,dismissCallout:s}}function Gd(e){let{transport:t,conversationIdSig:n}=e,o=Pt("ai-agent"),r=Pt(void 0),a=Pt(void 0),s=O(),l=L(p=>{let u=p.controlRevision,m=s.current;m&&m.conversationId===n.value&&u<m.revision||(s.current={conversationId:n.value,revision:u},o.value=p.controlMode,r.value=p.assignedOperatorInitials,p.controlMode!=="awaiting-operator"?a.value=void 0:p.operatorAvailable!==void 0&&(a.value=p.operatorAvailable))},[n,o,r,a]),c=L(p=>{if(p.type!=="data-control-state")return;let u=fl(p.data);u&&l(u)},[l]),d=L(async()=>{let p=n.value,u=await t.requestOperator();u&&n.value===p&&l(u)},[t,n,l]),_=L(async()=>{let p=n.value,u=await t.cancelOperatorRequest();u&&n.value===p&&l(u)},[t,n,l]);return{controlModeSig:o,assignedOperatorInitialsSig:r,operatorAvailableSig:a,applyControlState:l,adoptControlStateChunk:c,requestOperator:d,cancelOperatorRequest:_}}var Wr=T.cssPrefix,jd=`--${Wr}-visual-viewport-height`,Qd=`--${Wr}-visual-viewport-top`;function Xd(e){let{hostElement:t,mode:n,panelSize:o,isOpen:r,surfaceReady:a,setIsOpen:s}=e;Ct(()=>{jo(t,ir(n,o,r))},[t,r,o,n]),Ct(()=>{if(!r||!a)return;let l=t.ownerDocument.defaultView,c=l?.visualViewport,d=t.shadowRoot?.querySelector(`.${Wr}-anchor`);if(!l||!c||!d)return;let _=()=>{d.style.setProperty(jd,`${c.height}px`),d.style.setProperty(Qd,`${c.offsetTop}px`)},p=0,u=()=>{l.cancelAnimationFrame(p),p=l.requestAnimationFrame(()=>{p=l.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{l.cancelAnimationFrame(p),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),d.style.removeProperty(jd),d.style.removeProperty(Qd)}},[t,r,a]),M(()=>{if(n!=="modal"||!r)return;let l=c=>{c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${Wr}-panel`))||s(!1)};return t.addEventListener("click",l),()=>t.removeEventListener("click",l)},[t,r,n,s]),M(()=>{if(n!=="drawer"||!r)return;let l=c=>{c.key==="Escape"&&s(!1)};return document.addEventListener("keydown",l),()=>document.removeEventListener("keydown",l)},[r,n,s])}var Si=Z.scope("reducer"),Kr=class{constructor(t,n){ce(this,"messagesSig",t);ce(this,"onReconcileNeeded",n);ce(this,"active",null);ce(this,"openTextParts",new Map);ce(this,"partSeq",0);ce(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let o=Ut();o.id=t.id;let r=gn(t)||cn(t)&&(t.status!=="streaming"||ln(t)),a=t.status==="streaming"&&ln(t)&&co(t);this.replay={baseline:t,shadow:o,chunks:[n],probeContinuation:r,continuationTailReplay:a,liveCatchUp:t.status==="streaming"&&!r},this.attach(o),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t.baseline||r?.id===t.baseline.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t.baseline)??o.find(l=>l.id===t.baseline.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t.baseline)return t;let s=t.baseline;return t.baseline=a,Yd(s,a),t.liveCatchUp&&gn(t.shadow)&&(a.status==="streaming"||cn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=gn(a)||cn(a)&&(a.status!=="streaming"||ln(a)),t.continuationTailReplay=a.status==="streaming"&&ln(a)&&co(a),t.liveCatchUp=a.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,o=this.messagesSig.value,r=o.at(-1),a=r===t||r?.id===t.id||n!==void 0&&r?.serverMessageId===n?r:o.find(l=>l===t)??o.find(l=>l.id===t.id||n!==void 0&&l.serverMessageId===n);if(!a)return this.detach(),null;if(a===t)return t;Yd(t,a);let s=gn(t)&&cn(a);return a.status!=="streaming"&&!s?(this.detach(),null):(this.replay={baseline:a,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return xt(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:o}=this.replay,r=pr(n);return this.replay=null,xt(()=>{if(t){let a=n.partsSig.value.findLastIndex(s=>s.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,a+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let a of o)this.apply(a);n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,o=pr(n);return this.replay=null,xt(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let r=(this.replay?.baseline??this.active)?.serverMessageId;r!==void 0&&t.messageId!==void 0&&r!==t.messageId&&this.onReconcileNeeded?.({messageId:r}),this.detach();let a=t.messageId,s=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(s!==void 0)return t.messageMetadata?.senderRole==="visitor"&&s.role==="user"&&(s.status==="pending"||s.status==="error")&&(s.serverMessageId=a,s.status="complete",s.errorText=void 0,s.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(s,t),null;let l=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(l===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Rt(c))return this.attach(c),this.apply(t),null;let d=Ut();return this.attach(d),this.messagesSig.value=[...this.messagesSig.value,d],this.apply(t),null}if(this.replay){let o=this.refreshReplayBaseline();if(!o)return null;o.chunks.push(t),t.type==="data-control-state"&&(o.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:r,shadow:a,probeContinuation:s,continuationTailReplay:l,liveCatchUp:c}=o,d=t.type==="finish"||t.type==="error"||t.type==="abort";if(s){if(!Og(r,a,t))return d&&(Fg(r,a)&&(r.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id})),this.detach()),null;let p=gn(r)&&d?this.settleOwnedContinuation(t):this.promoteContinuation();return d?(p.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:p.serverMessageId??p.id}):p.continuationStreaming=!1),this.detach(),p):null}if(l&&Lg(r,a)){let p=this.promoteContinuation(!0);return d?(this.detach(),p):null}if(!c)return d&&this.detach(),null;if(d&&!Rt(r)&&Rt(a)){let p=this.promoteReplay();return this.detach(),p}if(!Mg(r,a))return d&&(this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}),this.detach()),null;let _=this.promoteReplay();return d?(this.detach(),_):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let o=n;return o.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}):o.continuationStreaming=!1),this.detach(),o}return null}ensureTextPart(t,n,o){let r=`${n}:${o}`,a=this.openTextParts.get(r);if(a)return a;let s={kind:n,id:`${o}#${this.partSeq++}`,textSig:te(""),doneSig:te(!1)};return this.openTextParts.set(r,s),xo(t,s),s}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let o=t.messageMetadata;o?.senderRole==="operator"?(n.role="operator",o.operatorInitials&&(n.operatorInitials=o.operatorInitials)):o?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":xo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":Si.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":Si.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":Si.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let o=this.ensureTextPart(n,"text",t.id);o.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let o=this.ensureTextPart(n,"reasoning",t.id);o.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":Bg(n,t);return;case"file":xo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":Jd(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":Jd(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=lr(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let o=t}}}bumpDone(t){xt(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},ki={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function gn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function Yd(e,t){e.canceled&&(t.canceled=!0),!(!gn(e)||t.status!=="streaming"&&!cn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function Mg(e,t){let n=e.partsSig.value,o=t.partsSig.value;return e.role!==t.role||o.length<n.length?!1:n.every((r,a)=>Zd(r,o[a]))}function Lg(e,t){let n=e.partsSig.value,o=n.findLastIndex(l=>l.kind==="tool"),r=new Set(n.slice(0,o+1).flatMap(l=>l.kind==="tool"?[l.toolCallId]:[])),a=t.partsSig.value.filter(l=>l.kind!=="tool"||!r.has(l.toolCallId)),s=n.slice(o+1);return a.length<s.length?!1:s.every((l,c)=>Zd(l,a[c]))}function Zd(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!fr(t.toolName,e.toolName)||ki[t.stateSig.value]<ki[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function Og(e,t,n){return Ng(e,n)||!Dg(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:co(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(o=>o.kind==="step-start")}function Ng(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(o=>o.kind==="tool"&&o.toolCallId===t.toolCallId);return n!==void 0&&ki[n.stateSig.value]<4}function Dg(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let o=e.partsSig.value;return o.some((r,a)=>n.every((s,l)=>$g(o[a+l],s)))}function $g(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||fr(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function Fg(e,t){if(gn(e)||!cn(e))return!1;let n=new Set(e.partsSig.value.filter(r=>r.kind==="tool").map(r=>r.toolCallId));return!t.partsSig.value.some(r=>r.kind==="tool"&&n.has(r.toolCallId))}function en(e,t,n,o){let r=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(r)return o&&(r.dynamic=!0),r;let a={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:o?!0:void 0,inputPartialSig:te(""),inputSig:te(void 0),outputSig:te(void 0),errorSig:te(void 0),stateSig:te("input-streaming"),approvalSig:te(void 0)};return xo(e,a),a}function xo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function Jd(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||xo(e,t)}function Bg(e,t){switch(t.type){case"tool-input-start":en(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=en(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=en(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=en(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=en(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=en(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=en(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=en(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function eu(e){let t=1e3,n=!1,o=!1,r=!1,a=()=>{r||e.signal.aborted||(r=!0,e.onInitialBoundaryReady())};for(;!e.signal.aborted;){let s,l="held";try{l=await e.connect(()=>{if(e.signal.aborted)return;s=e.now();let c=n||o;n=!0,o=!1,r?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&s===void 0&&(o=!0,a()),l==="unavailable"))return;s!==void 0&&e.now()-s>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Ug=120;function tu(e){let{activated:t,conversationReady:n,conversationIdSig:o,messagesSig:r,optionsRef:a,transport:s,visitorId:l,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:d,settleSuggestions:_,recordConversationReply:p,transcriptRecoverySig:u,beginConversationTranscript:m,commitConversationTranscript:g,onReplyLanded:P,runCancellation:y,canContinueRef:w,setCanSend:S,feedback:h,bus:b,loadInitialThread:x,shouldReconcileOnConnect:k}=e,E=O(0);M(()=>{if(!t||!n||!o.value)return;let G=o.value,H=new AbortController,A=f=>{},D=new Kr(r,f=>A(f));s.primeIdentity(l,G);let K=!1,B=!1,ne,q=!1,de,re=0,qe=w.current,_e,Se,Ze=Date.now(),Te,Ve=!1,Fe=!1,rt=(f,N,V)=>{if(!Rt(f))return;let Q=r.value.findLast(be=>!be.ephemeral),ie=f.serverMessageId??f.id;if(!(Q&&(Q.serverMessageId??Q.id)!==ie))return ur(r.value,f,G,a.current.strings.newConversation,N,V)},ht=(f,N,V,Q)=>{let ie=rt(f,N,Q);if(!ie)return;let ye=`${f.serverMessageId??f.id}:${V}:${ie.preview??""}`;ye!==Se&&(Se=ye,s.publishConversation({...ie,hasUnread:!0},!0))},We,tt=()=>{We&&(clearTimeout(We.timer),We=void 0)},ct=()=>{let f=We;if(!f)return;clearTimeout(f.timer),We=void 0;let N=r.value.find(V=>(V.serverMessageId??V.id)===f.replyId);N?.role!=="assistant"&&N?.role!=="operator"||ht(N,f.canContinue,f.generation,f.activityAt)},we=(f,N,V,Q)=>{tt(),We={replyId:f.serverMessageId??f.id,canContinue:N,generation:V,activityAt:Q,timer:setTimeout(ct,Ug)}},Ie=(f,N,V,Q=Date.now(),ie=!0)=>{tt();let be=rt(f,N,Q);if(!be)return;let pe=`${f.serverMessageId??f.id}:${V}`;pe!==_e&&(_e=pe,p(be),ie&&Te&&(Ve=!0))},dt=(f,N)=>{(f||!y.localSendRef.current)&&y.settle(N),f&&P()},me=(f,N=[],V=!1,Q,ie=qe,be=re,ye=Date.now(),pe=!0)=>{let Ge=a.current;if(f.canceled){Ie(f,ie,be,ye,pe),dt(V,Q);return}let se=!0,nt=f.status==="error";switch(Il(f,nt)){case"drop":r.value=r.value.filter(I=>I!==f),se=!1;break;case"complete-operator-routed":f.status="complete",V&&(h.play("messageReceived"),Hn(b,Ge,"assistant",Ue(f)));break;case"error":{if(f.status="error",f.errorText=Ge.strings.errorGeneric,V){h.play("error");let I=new Error(nt?"stream error chunk":"empty reply");b.emit("error",I),Ge.onError?.(I)}break}case"complete":f.status="complete",V&&(h.play("messageReceived"),Hn(b,Ge,"assistant",Ue(f))),_(f,N);break}se&&Ie(f,ie,be,ye,pe),dt(V,Q)},Le=f=>{if(H.signal.aborted||o.value!==G)return;if(c(f),d?.(f),f.type==="start"){ct();let I=f.messageId===void 0?void 0:r.value.find(j=>j.serverMessageId===f.messageId||j.id===f.messageId);q=I!==void 0&&I.status!=="streaming";let W=de?.senderRole==="visitor"?de.messageId:void 0;if(de={messageId:f.messageId,senderRole:f.messageMetadata?.senderRole},re+=1,Ze=Date.now(),Se=void 0,K=f.messageMetadata?.senderRole===void 0,B=!1,ne=K?f.messageMetadata?.runId:void 0,K){let j=f.messageId!==void 0&&r.value.some(Tt=>Tt.serverMessageId===f.messageId||Tt.id===f.messageId),le=r.value.at(-1),je=f.messageId!==void 0&&(le?.serverMessageId===f.messageId||le?.id===f.messageId),yt=y.localSendRef.current&&(!j||je)&&le?.role==="assistant"&&le.status==="streaming"&&(je||le.serverMessageId===void 0&&le.partsSig.value.length===0);B=y.captureStart(G,f,yt,W)}}let N=K&&(f.type==="finish"||f.type==="error"||f.type==="abort"),V=N?ne:void 0,Q=N&&(B||y.ownsLocalRun(V)),ie=re,be=q;f.type==="finish"&&f.canContinue!==void 0&&(qe=f.canContinue);let ye=qe;N&&(K=!1,B=!1,ne=void 0);let pe=D.applyResume(f),Ge=de?.messageId,se=Ge===void 0?void 0:r.value.find(I=>I.serverMessageId===Ge||I.id===Ge);q&&de?.senderRole!=="visitor"&&(pe!==null||se?.status==="streaming")&&(q=!1,be=!1);let nt=!q&&(se?.role==="assistant"||se?.role==="operator");if(f.type==="text-delta"&&nt&&we(se,qe,re,Ze),f.type==="text-end"&&(tt(),nt&&ht(se,qe,re,Ze)),f.type==="finish"&&f.canContinue===!1&&S(!1),!pe){N&&(Q||!y.localSendRef.current)&&y.settle(V);return}if(pe.role==="operator"){be||(h.play("messageReceived"),Hn(b,a.current,"operator",Ue(pe))),Ie(pe,ye,ie,Ze),q=!1,N&&(Q||!y.localSendRef.current)&&y.settle(V);return}pe.role==="assistant"&&(me(pe,[],Q,V,ye,ie,Ze),q=!1)},Ke=async f=>{let N=re,V=await s.loadConversation(G,f?{ids:[f]}:void 0).catch(()=>null);if(H.signal.aborted||o.value!==G||!V)return!1;V.controlState&&c({type:"data-control-state",data:V.controlState});let Q=r.value.at(-1),ie=N===re&&(f===void 0||Q!==void 0&&(Q.serverMessageId===f||Q.id===f));if(V.messages.length===0)return!0;ie&&(qe=V.canContinue,S(qe));let be=r.value,ye=f===void 0?be.at(-1):be.find(j=>j.serverMessageId===f||j.id===f),{messages:pe,changed:Ge}=uo(be,Qt(V.messages));if(!Ge)return!0;r.value=pe;let se=f===void 0?pe.at(-1):pe.find(j=>j.serverMessageId===f||j.id===f),nt=ye!==void 0&&se!==void 0&&(ye.id===se.id||ye.serverMessageId!==void 0&&ye.serverMessageId===se.serverMessageId),I=se!==void 0&&se.status!=="streaming"&&(!nt||ye?.status==="streaming"),W=nt&&ye?.status==="streaming"?Date.now():se?.createdAt;return ie&&I&&se.role==="assistant"?me(se,se.suggestions??[],y.localSendRef.current,void 0,V.canContinue,N,W,!1):ie&&I&&se.role==="operator"?Ie(se,V.canContinue,N,W,!1):ie&&se?.role==="assistant"&&se.status!=="streaming"&&_(se,se.suggestions??[]),!0},Ee=new Set;A=({messageId:f})=>{if(Ee.has(f)||!r.value.some(V=>V.serverMessageId===f||V.id===f))return;Ee.add(f);let N=()=>Ee.delete(f);Ke(f).then(N,N)};let at=(f=!1)=>{if(H.signal.aborted||o.value!==G){Ve=!1;return}if(Te){Ve=!0;return}let N=f?x(G)??(k()?Ke():void 0):Ke();if(!N)return;m(G),Te=N;let V=(Q=!1)=>{if(Te===N){if(Te=void 0,Ve){Ve=!1,at();return}Q&&g(G)}};N.then(V,()=>V(!1))},bt=u.subscribe(f=>{f<=E.current||(E.current=f,Fe&&at())});return eu({signal:H.signal,now:()=>performance.now(),sleep:f=>so(f,H.signal),connect:f=>s.connectResumeStream({signal:H.signal,onChunk:Le,onConnected:f}),onInitialBoundaryReady:()=>{Fe=!0,at(!0)},backfill:()=>at()}),()=>{H.abort(),tt(),bt(),D.detach()}},[t,n,o,o.value,l,s,c,d,_,p,u,m,g,P,y,w,S,r,b,h,x,k])}var Hg=32;function nu(e){let{transport:t,setStreaming:n}=e,o=O(),r=O(),a=O(!1),s=O(),l=O(!1),c=O(new Map),d=O(new Set),_=L((x,k)=>{let E=`${x}:${k}`;s.current!==E&&(s.current=E,t.cancelTurn(x,k))},[t]),p=L(x=>{o.current=void 0,r.current=x,a.current=!1,s.current=void 0,l.current=!0,n(!0)},[n]),u=L((x,k)=>{c.current.set(x,{messageId:k})},[]),m=L(x=>{x!==void 0&&(d.current.add(x),d.current.size>Hg&&d.current.delete(d.current.values().next().value)),!(x!==void 0&&o.current?.runId!==x)&&(o.current=void 0,r.current=void 0,a.current=!1,l.current=!1,n(!1))},[n]),g=L((x,k)=>r.current!==x?k.runId&&o.current?.runId===k.runId?(o.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId),!0):!1:(r.current=void 0,k.runId?(o.current={conversationId:k.conversationId,runId:k.runId},n(!0),a.current&&_(k.conversationId,k.runId),!0):(m(),!0)),[_,n,m]),P=L((x,k)=>{let E=c.current.get(x);return E?(c.current.delete(x),!k.runId||d.current.has(k.runId)?!0:E.runId!==void 0?(E.runId!==k.runId||o.current?.runId===k.runId&&(o.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId)),!0):(l.current||r.current||(o.current={conversationId:k.conversationId,runId:k.runId},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0)),!0)):!1},[_,n]),y=L(x=>r.current!==x?!1:(m(),!0),[m]),w=L(x=>{let k=c.current.get(x);return k?(c.current.delete(x),k.runId===void 0):!1},[]),S=L((x,k,E,G)=>{let H=k.messageMetadata?.runId;if(k.messageMetadata?.senderRole!==void 0||typeof H!="string"||!H||d.current.has(H))return!1;if(o.current?.runId===H)return l.current;if(l.current)return o.current||!E?!1:(r.current=void 0,o.current={conversationId:x,runId:H},n(!0),a.current&&_(x,H),!0);let D=[...c.current.values()].filter(K=>K.runId===void 0).find(K=>K.messageId===G);return D?(D.runId=H,o.current={conversationId:x,runId:H},r.current=void 0,a.current=!1,s.current=void 0,l.current=!0,n(!0),!0):(r.current=void 0,o.current={conversationId:x,runId:H},n(!0),a.current&&_(x,H),l.current)},[_,n]),h=L(x=>typeof x=="string"&&o.current?.runId===x&&l.current,[]),b=L(()=>{let x=o.current;if(x)return a.current=!0,_(x.conversationId,x.runId),!0;let k=r.current;return k?(a.current=!0,k.then(E=>{E.runId&&_(E.conversationId,E.runId)}).catch(()=>{}),!0):!1},[_]);return oe(()=>({localSendRef:l,begin:p,beginRouted:u,acceptAck:g,acceptRoutedAck:P,reject:y,rejectRouted:w,captureStart:S,ownsLocalRun:h,settle:m,stop:b}),[g,P,p,u,S,h,y,w,m,b])}var zg=Z.scope("send");function ru(e,t,n,o,r,a=!0){e.publishConversation({...ur(t,n,o,r,a),hasUnread:!1},!0)}function au(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function iu(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Rt(t)))}function So(e,t,n,o,r){let a=iu(t);a?.role!=="user"||!au(a,n)||ru(e,t,a,o,r)}function ou(e){return!(e instanceof Xe)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function su(e){let{transport:t,messagesSig:n,conversationIdSig:o,options:r,bus:a,feedback:s,persistence:l,visitorId:c,adoptConversationId:d,applyControlState:_,setCanSend:p,settleSuggestions:u,runCancellation:m}=e,g=L(()=>{let w=o.value??pt();return o.value||(o.value=w,l.saveConversationId(w)),w},[o,l]),P=L(async({continueExisting:w,turn:S})=>{let h=g(),b=n.value.at(-1),x=S?[S]:Sl(n.value,w),k=x[0],E=Fa({messages:x.map(Va),conversationId:h,visitorId:c,userPrefs:l.loadUserPrefs()}),G=t.sendTurn(E);m.begin(G);try{let H=await G;if(o.value!==h||!m.acceptAck(G,H))return!1;if(d(H.conversationId),H.runId&&k?.role==="user"&&So(t,n.value,k,H.conversationId,r.strings.newConversation),!H.runId){let A=await t.loadConversation(H.conversationId).catch(()=>null);if(o.value!==H.conversationId)return!0;if(A){A.controlState&&_(A.controlState),p(A.canContinue);let D=Qt(A.messages),{messages:K,changed:B}=uo(n.value,D);B&&(n.value=K);let ne=D.findLast(re=>!re.ephemeral&&re.role!=="system"),q=iu(n.value);q&&ne&&au(q,ne)&&ru(t,n.value,q,H.conversationId,r.strings.newConversation,A.canContinue);let de=b?n.value.find(re=>re.id===b.id&&re.role==="assistant"&&re.status!=="streaming"):void 0;de&&u(de,de.suggestions??[]),!w&&b?.role==="assistant"&&n.value.includes(b)&&b.serverMessageId===void 0&&!Rt(b)&&(n.value=n.value.filter(re=>re!==b))}else b?.role==="assistant"&&n.value.includes(b)&&(b.status="error",b.errorText=r.strings.errorGeneric,w?b.retryAction={kind:"continue-assistant",messageId:b.serverMessageId??b.id}:b.retryAction=k?.role==="user"?{kind:"resend-user",messageId:k.id}:null,n.value=[...n.value])}return!0}catch(H){if(o.value!==h)return!1;if(!m.reject(G))return k?.role==="user"&&So(t,n.value,k,h,r.strings.newConversation),!0;let A=fn(H,r.strings),D=ou(H),K=S?.role==="assistant"?S:n.value.at(-1);if(w&&K?.role==="assistant"&&H instanceof Xe&&H.status===409){let B=K.serverMessageId??K.id,ne=await t.loadConversation(h,{ids:[B]}).catch(()=>null);if(o.value!==h)return!1;if(ne){ne.controlState&&_(ne.controlState),p(ne.canContinue);let q=Qt(ne.messages),de=q.find(re=>(re.serverMessageId??re.id)===B);if(de&&Rl(K,de)){let{messages:re,changed:qe}=uo(n.value,q),_e=re.find(Se=>(Se.serverMessageId??Se.id)===B);if(qe&&_e&&_e!==K)return _e.awaitingContinuation=!1,_e.continuationStreaming=void 0,_e.retryAction=null,n.value=re,_e.status!=="streaming"&&u(_e,_e.suggestions??[]),!0}}if(!n.value.includes(K)||K.status!=="streaming")return!1;K.continuationStreaming=!0}if(w&&K?.role==="assistant")K.status="error",K.errorText=A,K.retryAction=D?{kind:"continue-assistant",messageId:K.serverMessageId??K.id}:null,n.value=[...n.value];else if(b?.role==="assistant"&&n.value.includes(b)){b.status="error",b.errorText=A;let B=x[0];b.retryAction=D&&B?.role==="user"?{kind:"resend-user",messageId:B.id}:null,n.value=[...n.value]}else{let B=Ut();B.status="error",B.errorText=A;let ne=x[0];B.retryAction=D&&ne?.role==="user"?{kind:"resend-user",messageId:ne.id}:null,n.value=[...n.value,B]}return s.play("error"),a.emit("error",H),r.onError?.(H),!1}},[t,n,r,a,s,l,c,d,_,p,u,g,m]),y=L(async w=>{let S=g();w.status="pending",w.errorText=void 0,w.retryAction=void 0,n.value.includes(w)&&(n.value=[...n.value]);let h=Fa({messages:[Va(w)],conversationId:S,visitorId:c,userPrefs:l.loadUserPrefs()}),b=t.sendTurn(h);m.beginRouted(b,w.id);try{let x=await b;return o.value!==S?(m.rejectRouted(b),!1):m.acceptRoutedAck(b,x)?(d(x.conversationId),So(t,n.value,w,x.conversationId,r.strings.newConversation),w.status==="pending"&&(w.status="complete",n.value.includes(w)&&(n.value=[...n.value])),!0):!1}catch(x){let k=m.rejectRouted(b);if(o.value!==S)return!1;if(!k)return So(t,n.value,w,S,r.strings.newConversation),w.status==="pending"&&(w.status="complete",n.value.includes(w)&&(n.value=[...n.value])),!0;if(w.status!=="pending")return So(t,n.value,w,S,r.strings.newConversation),!0;zg.debug("operator-routed send failed",{error:x});let E=x instanceof Error?x:new Error(String(x));return w.status="error",w.errorText=fn(x,r.strings),w.retryAction=ou(x)?{kind:"resend-user",messageId:w.id}:null,n.value.includes(w)&&(n.value=[...n.value]),s.play("error"),a.emit("error",E),r.onError?.(E),!1}},[t,n,r,a,s,l,c,d,g,m]);return{sendAiTurn:P,sendRoutedTurn:y}}var qg=Z.scope("unread");function lu(e){let{transport:t,options:n,conversationIdSig:o,isConversationVisibleRef:r,activated:a,conversationReady:s}=e,l=Pt(!1),c=Pt(0),d=O([]),_=O(),p=O(!1),u=L(()=>{let x=o.value,k=r.current()&&_.current===x?x:void 0;l.value=d.current.some(E=>E.hasUnread&&E.conversationId!==k)},[o,l,r]),m=L(x=>{let k=o.value,E=d.current.find(D=>D.conversationId===k),G=Bt(d.current,x),H=G.find(D=>D.conversationId===k),A=x.type==="snapshot"&&k!==void 0&&H?.hasUnread===!0&&_.current===k&&E!==void 0&&E.lastMessageAt!==H.lastMessageAt;A&&(_.current=void 0),d.current=G,u(),A&&(c.value+=1)},[o,u,c]),g=L(()=>{if(u(),!r.current())return;let x=o.value;if(!x||_.current!==x)return;let k=d.current.find(E=>E.conversationId===x);k?.hasUnread&&t.markRead(x,k.lastMessageAt)},[o,r,u,t]),P=L(x=>{o.value===x&&(_.current=void 0,u())},[o,u]),y=L(x=>{o.value===x&&(_.current=x,g())},[o,g]),w=L(x=>_.current===x,[]),S=L((x=!1)=>{n.modules.list.some(k=>k.layout==="chat")&&(p.current||(p.current=!0,t.listConversations({limit:50},x).then(k=>{x||m({type:"snapshot",result:k,requestedRevision:0}),g()}).catch(k=>qg.debug("refreshUnread failed (non-fatal)",{err:k})).finally(()=>{p.current=!1})))},[m,g,n.modules,t]),h=L(x=>{let k=x.conversationId,E=r.current()&&o.value===k&&_.current===k,G=d.current.find(A=>A.conversationId===k),H=E&&(G?.lastMessageAt!==x.lastMessageAt||G.hasUnread);t.publishConversation({...x,hasUnread:!E},!0),H&&t.markRead(k,x.lastMessageAt)},[o,r,t]);M(()=>t.subscribeConversationChanges(m),[m,t]);let b=O(!1);return M(()=>{!a||!s||b.current||(b.current=!0,S())},[a,s,S]),M(()=>{if(!a)return;let x=()=>{document.visibilityState==="visible"&&(g(),S(!0))};return document.addEventListener("visibilitychange",x),()=>document.removeEventListener("visibilitychange",x)},[a,g,S]),{hasUnreadSig:l,transcriptRecoverySig:c,markVisibleConversationRead:g,beginConversationTranscript:P,commitConversationTranscript:y,isConversationTranscriptCommitted:w,recordConversationReply:h}}var ko=Z.scope("settings");function cu(e){let{options:t,persistence:n,transport:o,feedback:r,hostElement:a,bus:s}=e,l=n.loadUserPrefs(),[c,d]=$(()=>l.locale??t.locale),[_,p]=$(()=>l.themeMode??t.themeMode),[u,m]=$(()=>l.textSize??t.textSize),g=L(b=>{n.patchUserPrefs(b),o.saveUserPrefs(n.loadUserPrefs()).catch(x=>ko.warn("saveUserPrefs failed",{err:x}))},[n,o]);M(()=>{l.soundMuted!==void 0&&r.setMuted(l.soundMuted)},[]),M(()=>{a.dataset.theme=_},[a,_,t]),M(()=>{a.dataset.textSize=u},[a,u,t]),M(()=>{let b=!0;return r.mutedSig.subscribe(x=>{if(b){b=!1;return}g({soundMuted:x})})},[r,g]);let P=wn(c,t.availableLocales,t.defaultLocale);M(()=>{o.setLocale(P)},[o,P]),M(()=>{a.dir=ls(P)?"rtl":"ltr"},[a,P]),M(()=>{P!==c&&d(P)},[P,c]);let y=L(b=>{ko.info("localeChange",{locale:b}),d(b),g({locale:b}),s.emit("localeChange",b)},[g,s]),w=L(b=>{ko.info("themeChange",{mode:b}),p(b),a.dataset.theme=b,g({themeMode:b}),s.emit("themeChange",b)},[a,g,s]),S=L(b=>{ko.info("textSizeChange",{size:b}),m(b),a.dataset.textSize=b,g({textSize:b}),s.emit("textSizeChange",b)},[a,g,s]),h=L(()=>{r.toggleMuted();let b=r.mutedSig.value;ko.info("soundToggle",{muted:b}),s.emit("soundToggle",{muted:b})},[r,s]);return{activeLocale:c,activeThemeMode:_,activeTextSize:u,effectiveLocale:P,setActiveLocale:d,setActiveThemeMode:p,setActiveTextSize:m,patchAndSync:g,handleLocaleChange:y,handleThemeChange:w,handleTextSizeChange:S,handleSoundToggle:h}}var Pe=Z.scope("app"),Gr=T.cssPrefix;function du(e,t){return xl({...e,text:lt(t,e.text)})}function uu({options:e,hostElement:t,bus:n}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[r]=$(()=>Cn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[a]=$(()=>r.getVisitorId()),s=r.loadUserPrefs(),l=Pt(r.loadConversationId()),c=O(l.value!==void 0),d=Pt(l.value??""),_=Pt([]),[p,u]=$(!1),m=O(),[g,P]=$([]);function y(){let v=e.modules.list,C=new Set(v.map(z=>z.id)),X=r.loadActiveModule();return X&&C.has(X)?X:v[0]?.id??""}function w(){return e.modules.list.find(v=>v.layout==="chat")?.id}function S(){let v=w();return v?e.modules.list.length===1?!0:b.sig.value.activeTab===v:!1}let h=O();if(!h.current){let v=e.modules.list.map(X=>X.id),C=r.loadActiveModule()??v[0]??"";h.current=Sd(C,C?[...v,C]:v,X=>r.saveActiveModule(X))}let b=h.current,x=ft(()=>b.sig.value.activeTab).value,k=ft(()=>l.value).value,[E,G]=$(!1),[H,A]=$(null),[D,K]=$(!1),B=e.mode==="standalone"||e.mode==="inline",ne=O(io(e,En(),r.loadPanelOpen(),r.loadPanelSize())),[q,de]=$(ne.current.panelOpen),[re,qe]=$(ne.current.panelOpen),_e=O(),Se=O(),Ze=O(!1),Te=O(void 0);M(()=>{q&&qe(!0)},[q]);let Ve=O(!1),[Fe,rt]=$(!1),{dismissed:ht,dismissCallout:We}=Kd({callout:e.launcher.callout,persistence:r}),tt=e.launcher.callout?.persistent??!0,ct=L(()=>{Pe.info("calloutDismiss"),n.emit("calloutDismiss",void 0),We()},[n,We]),[we,Ie]=$(ne.current.panelSize),dt=O(!1),[me,Le]=$("chat"),Ke=O(()=>!1);Ke.current=()=>q&&me==="chat"&&!document.hidden&&S();let[Ee,at]=$(!0),bt=O(Ee);bt.current=Ee;let[f,N]=$(!1),V=O(f);V.current=f;let Q=O(null),[ie,be]=$(!1),[ye,pe]=$(null),[Ge,se]=$([]),nt=O(e.strings),I=O(e);I.current=e;let[W,j]=$(void 0),[le,je]=$(void 0),[yt,Tt]=$(()=>r.loadSidebarCollapsed()??!1),[it,tn]=$({}),[ue]=$(()=>new dr({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:il({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[gt]=$(()=>new hr(e.sound,e.haptics)),qt=nu({transport:ue,setStreaming:N}),{activeLocale:wo,activeThemeMode:Ci,activeTextSize:Ri,effectiveLocale:vn,setActiveLocale:hu,setActiveThemeMode:bu,setActiveTextSize:yu,patchAndSync:Ti,handleLocaleChange:Pu,handleThemeChange:xu,handleTextSizeChange:Su,handleSoundToggle:ku}=cu({options:e,persistence:r,transport:ue,feedback:gt,hostElement:t,bus:n}),{controlModeSig:It,assignedOperatorInitialsSig:wu,operatorAvailableSig:Cu,applyControlState:zn,adoptControlStateChunk:Ru,requestOperator:Tu,cancelOperatorRequest:Iu}=Gd({transport:ue,conversationIdSig:l}),Vt=Pt(new Map),Eu=L(v=>{if(v.type!=="data-memory-compaction-state")return;let C=l.value;if(!C)return;let X=ml(v.data);if(!X)return;let z=Vt.value.get(C);if(z&&(X.postFinishSequence<z.postFinishSequence||X.postFinishSequence===z.postFinishSequence&&(z.status==="ready"||z.status===X.status)))return;let ae=new Map(Vt.value);ae.set(C,X),Vt.value=ae},[l,Vt]),{hasUnreadSig:Au,transcriptRecoverySig:Mu,markVisibleConversationRead:Ii,beginConversationTranscript:Yr,commitConversationTranscript:hn,isConversationTranscriptCommitted:Ei,recordConversationReply:Lu}=lu({transport:ue,options:e,conversationIdSig:l,isConversationVisibleRef:Ke,activated:re,conversationReady:E});M(()=>{Ii()},[x,q,me,k,Ii]),M(()=>{gt.update(e.sound,e.haptics)},[gt,e.sound,e.haptics]),M(()=>()=>gt.destroy(),[gt]),M(()=>{dt.current||!e.size.initialSize||(dt.current=!0,!r.loadPanelSize()&&Ie($a(e.mode,e.size,En())))},[e.mode,e.size,r]),M(()=>{if(!E||Ve.current)return;Ve.current=!0;let v=io(e,En(),r.loadPanelOpen(),r.loadPanelSize());de(v.panelOpen),Ie(v.panelSize)},[E,e,r]);let Jr=O(null);M(()=>{E&&b.reconcile(e.modules.list.map(v=>v.id),y())},[E,e.modules.list,b]);let Co=L(v=>{!v||v.length===0||(_.value=v.map(C=>du(C,nt.current)))},[_]),Zr=O(null),Ro=L(async v=>{try{let{formSubmissions:C}=await(v?ue.bootstrap(v):Zr.current??ue.bootstrap()),X=new Map;return C.forEach((z,ae)=>X.set(z.formId,ae)),C.filter((z,ae)=>!z.skipped||X.get(z.formId)===ae).map((z,ae)=>({key:`wire:${z.formId}:${z.createdAt??ae}`,formId:z.formId,outcome:z.skipped?"skipped":"submitted",createdAt:ul(z.createdAt),values:z.values}))}catch(C){return Pe.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:C}),[]}},[ue]),qn=O(0),Mt=O(0),ea=L(v=>{if(v===l.value)return;let C=l.value;Mt.current++,u(!1),C&&(r.saveDraft(v,r.loadDraft(C)),r.saveDraft(C,""),r.saveMessageQueue(v,r.loadMessageQueue(C)),r.saveMessageQueue(C,[])),l.value=v,r.saveConversationId(v),ue.primeIdentity(void 0,v),Pe.info("conversation rebound",{previous:C,current:v}),C&&n.emit("conversationRebound",{previous:C,current:v})},[n,l,r,ue]),To=L((v,C)=>{let X=[...v.map(U=>U.createdAt),...C.map(U=>U.createdAt)].filter(U=>U!==void 0),z=(X.length?Math.min(...X):Date.now())-1;return[...(Te.current?.messages??[]).map(U=>{let ee=du(U,nt.current);return ee.createdAt=z,ee}),...v]},[]),Ai=L(async v=>{let C=Mt.current,X=()=>C!==Mt.current||l.value!==v;Se.current===v&&(Se.current=void 0),u(!0);try{let[z,ae]=await Promise.all([ue.loadConversation(v),Ro()]);if(X())return!1;let U=Qt(z.messages);P(ae);let ee=To(Ga(U,_.value),ae);if(_.value=ee,Se.current=ee.some(ke=>ke.role==="user")?void 0:v,U.length>0||z.controlState!==void 0){at(z.canContinue),z.controlState&&zn(z.controlState);let ke=U.findLast(st=>st.role==="assistant"&&!st.ephemeral);se(ke?.suggestions??[])}return!0}catch(z){return X()||(Pe.warn("loadThread failed; keeping conversation active",{err:z,conversationId:v}),n.emit("error",z),I.current.onError?.(z)),!1}finally{X()||u(!1)}},[ue,Ro,_,l,To,n]),Ou=L(v=>{if(_e.current===v)return _e.current=void 0,Ai(v)},[Ai]),Nu=L(()=>{if(m.current)return Promise.resolve(void 0);let v=l.value,C=_.value.find(ee=>ee.serverMessageId!==void 0),X=C?.serverMessageId,z=C?new Date(C.createdAt).toISOString():void 0;if(!v||!X||!z)return Promise.resolve(void 0);let ae=Mt.current,U={};return m.current=U,(async()=>{try{let ee=await ue.loadConversation(v,{beforeId:X,beforeCreatedAt:z});if(m.current!==U||Mt.current!==ae||l.value!==v)return;if(ee.messages.length===0)return!1;let xe=ee.messages.map(qa),ke=_.value,st=wl(ke,xe);if(st!==ke){let Lt=Math.min(...xe.map(ut=>ut.createdAt??1/0),...g.map(ut=>ut.createdAt??1/0));if(Number.isFinite(Lt))for(let ut of ke){if(!ut.ephemeral)break;(ut.createdAt??1/0)>=Lt&&(ut.createdAt=Lt-1)}_.value=st}return!0}catch(ee){if(m.current!==U||Mt.current!==ae||l.value!==v)return;Pe.warn("load previous messages failed",{err:ee,conversationId:v,beforeId:X}),n.emit("error",ee),e.onError?.(ee);return}finally{m.current===U&&(m.current=void 0)}})()},[n,l,g,_,e,ue]),Vn=L(async({newConversation:v})=>{let C=++qn.current,X=()=>C!==qn.current,z=l.value,ae=v||!z?pt():z;ae!==z&&(Mt.current++,u(!1),xt(()=>{l.value=ae,d.value=ae}),r.saveConversationId(ae)),ue.primeIdentity(a,ae);let U;try{U=await ue.handshake({visitorId:a,conversationId:ae,userPrefs:r.loadUserPrefs(),locale:wo})}catch(ke){if(X())return;n.emit("error",ke),e.onError?.(ke),v||G(!0);return}if(X())return;U.conversationId!==ae&&ea(U.conversationId),pe(U.agent),e.mode==="page"&&(U.site&&rl(U.site)?j(U.site):U.site&&Pe.warn("invalid site config, using fallback",{site:U.site}),U.blocks&&al(U.blocks)?je(U.blocks):U.blocks&&Pe.warn("invalid blocks config, using fallback",{blocks:U.blocks}));let ee=Ea(U.userPrefs);if(Object.keys(ee).length>0&&!v&&(r.saveUserPrefs(ee),ee.locale&&hu(ee.locale),ee.soundMuted!==void 0&>.setMuted(ee.soundMuted),ee.themeMode&&bu(ee.themeMode),ee.textSize&&yu(ee.textSize)),Te.current=U.welcome,v||n.emit("handshake",U),U.welcome?.suggestions){let ke=nt.current;se(U.welcome.suggestions.map(st=>({...st,label:lt(ke,st.label),...st.text===void 0?{}:{text:lt(ke,st.text)}})))}let xe=!v&&z&&U.conversationId===z;c.current=!!xe,xe?Ze.current||(_e.current=U.conversationId):(Se.current=U.conversationId,Co(U.welcome?.messages),hn(U.conversationId)),v||G(!0)},[ue,a,r,e,n,l,d,gt,Co,wo,ea,hn]),Wn=JSON.stringify(e.userContext??null),Du=JSON.stringify(e.pageContext??null),$u=JSON.stringify(it);M(()=>{let v=Object.keys(it).length?{...it,...e.userContext}:e.userContext;ue.setContext(v,Vg(e.pageContext))},[ue,Wn,Du,$u]);let Mi=L((v,C=[])=>se(v.suggestions??C),[]);M(()=>(ue.primeIdentity(a,l.value),Vn({newConversation:!1}),()=>{qn.current++,Mt.current++}),[]),M(()=>{!re||!E||Ze.current||(Ze.current=!0,Zr.current=ue.bootstrap(),(async()=>{try{let v=await Zr.current;A(Zn((v??{forms:[]}).forms,vn))}catch(v){Pe.debug("bootstrap failed \u2014 treating as no forms",{err:v})}finally{K(!0)}})(),_e.current===l.value&&u(!0))},[re,E]);let Kn=O(null);M(()=>{if(!re||!E||(Kn.current??(Kn.current=vn),Kn.current===vn))return;Kn.current=vn;let v=!1;return ue.bootstrap().then(C=>{v||A(Zn((C??{forms:[]}).forms,vn))}).catch(C=>Pe.debug("forms re-localize failed \u2014 keeping current copy",{err:C})),()=>{v=!0}},[re,E,vn,ue]);let Li=O(Wn);M(()=>{!E||Li.current===Wn||(Li.current=Wn,Vn({newConversation:!1}))},[Wn,E,Vn]),Xd({hostElement:t,mode:e.mode,panelSize:we,isOpen:q,surfaceReady:E,setIsOpen:de});let{sendAiTurn:Wt,sendRoutedTurn:bn}=su({transport:ue,messagesSig:_,conversationIdSig:l,options:e,bus:n,feedback:gt,persistence:r,visitorId:a,adoptConversationId:ea,applyControlState:zn,setCanSend:at,settleSuggestions:Mi,runCancellation:qt}),{toolInteraction:Fu}=Wd({streaming:f,controlModeSig:It,messagesSig:_,sendAiTurn:Wt,bus:n,humanInLoop:e.features.humanInLoop}),Bu=L((v,C)=>{let X=_.value.find(z=>z.serverMessageId===v);X&&(X.feedback=C),Pe.info("messageFeedback",{messageId:v,value:C}),n.emit("messageFeedback",{messageId:v,value:C}),ue.submitFeedback({messageId:v,value:C})},[n,_,ue]),Uu=()=>_.value.reduce((v,C)=>v+(C.role==="user"?1:0),0),yn=e.forms.list.length>0?e.forms:H??e.forms,Oe=hd({forms:yn,persistence:r,userContext:()=>e.userContext,messageCount:Uu,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>l.value,onComplete:(v,C,X,z)=>{Pe.info("formSubmit",{formId:v.id,trigger:C,skipped:z}),n.emit("formSubmit",{formId:v.id,values:X,skipped:z}),P(U=>{let xe=U.find(ke=>ke.formId===v.id&&ke.outcome==="skipped")?.createdAt??Date.now();return[...U.filter(ke=>!(ke.formId===v.id&&ke.outcome==="skipped")),{key:`local:${v.id}:${xe}`,formId:v.id,outcome:z?"skipped":"submitted",createdAt:xe,...z?{}:{values:X}}]});let ae=l.value??pt();l.value||(l.value=ae,r.saveConversationId(ae),ue.primeIdentity(void 0,ae)),!z&&v.mirrorToContext&&tn(U=>({...U,...X})),ue.submitForm({formId:v.id,conversationId:ae,trigger:C,values:X,skipped:z})}}),Io=ft(()=>Oe.activeForm.value),Hu=L(()=>Oe.fire("after-messages"),[Oe]),zu=L(()=>c.current||_.value.some(v=>!v.ephemeral&&v.role==="user"),[_]);tu({activated:re,conversationReady:E,conversationIdSig:l,messagesSig:_,optionsRef:I,transport:ue,visitorId:a,adoptControlStateChunk:Ru,adoptMemoryCompactionStateChunk:Eu,settleSuggestions:Mi,recordConversationReply:Lu,transcriptRecoverySig:Mu,beginConversationTranscript:Yr,commitConversationTranscript:hn,onReplyLanded:Hu,runCancellation:qt,canContinueRef:bt,setCanSend:at,feedback:gt,bus:n,loadInitialThread:Ou,shouldReconcileOnConnect:zu}),M(()=>{Oe.refresh()},[yn,Oe]);let Oi=e.pageContext?.area?String(e.pageContext.area):void 0,qu=ft(()=>_.value.length);M(()=>{E&&D&&Oe.fire("pre-chat")},[E,D,Oe]),M(()=>{D&&!Ee&&Oe.fire("conversation-closed")},[D,Ee,Oe]),M(()=>{E&&D&&Oi&&Oe.fire("page-area")},[E,D,Oi,Oe]);let ta=oe(()=>{let v=yn.list.flatMap(C=>C.triggers).filter(C=>C.kind==="idle").map(C=>Number(C.param));return v.length?Math.min(...v)*1e3:0},[yn]);M(()=>{if(!ta||!q)return;let v=setTimeout(()=>Oe.fire("idle"),ta);return()=>clearTimeout(v)},[ta,q,Oe,qu.value]);let Ni=L(async(v,C,X)=>{if(Q.current)return!1;let z=l.value,ae=z?Vt.value.get(z):void 0,U=It.value!=="ai-agent";if(!U&&ae?.status==="compacting"||(Pe.info("send",{textLen:v.length,attachments:C.length,streaming:V.current,routedToOperator:U}),V.current&&!U))return!1;let ee=new AbortController,xe={conversationId:z,controller:ee};Q.current=xe,be(!0);try{gt.unlock();let ke=await Kg(ue,C,ee.signal,Kt=>{ee.signal.aborted||(Pe.warn("upload failed",{err:Kt}),n.emit("error",Kt),e.onError?.(Kt))});if(ee.signal.aborted||l.value!==z||!bt.current||Oe.activeForm.value)return!1;let st=z?Vt.value.get(z):void 0,Lt=It.value!=="ai-agent";if(!Lt&&st?.status==="compacting"||V.current&&!Lt||!v&&ke.length===0)return!1;n.emit("send",{text:v,attachmentCount:C.length}),Ge.length>0&&se([]),gt.play("messageSent");let ut=za(v,ke,X);return Hn(n,e,"user",v),Lt?(_.value=[..._.value,ut],X?await bn(ut):(bn(ut),!0)):(_.value=[..._.value,ut,Ut()],X?await Wt({continueExisting:!1}):(Wt({continueExisting:!1}),!0))}finally{Q.current===xe&&(Q.current=null,be(!1))}},[ue,n,e,Ge.length,_,l,Vt,Wt,bn,It]),Di=l.value,Vu=(Di?Vt.value.get(Di):void 0)?.status==="compacting",$i=It.value==="ai-agent",Fi=ft(()=>{let v=_.value.at(-1);return v?.role==="assistant"&&v.partsSig.value.some(C=>C.kind==="tool"&&C.stateSig.value==="approval-requested")}),Bi=ft(()=>_.value.some(v=>v.retryAction?.kind==="resend-user"||v.retryAction?.kind==="continue-assistant"));M(()=>{let v=l.value;return()=>{let C=Q.current;!C||C.conversationId!==v||(Q.current=null,be(!1),C.controller.abort())}},[l.value]),M(()=>{Ee&&!Io.value||Q.current?.controller.abort()},[Io.value,Ee]);let Wu=L(()=>{if(!qt.stop())return;Pe.info("stop"),n.emit("stop",void 0);let v=_.value.at(-1);v&&v.role!=="user"&&v.status==="streaming"&&(v.canceled=!0,_.value=[..._.value])},[qt,n,_]),Ku=L(v=>{if(f)return;let C=_.value,X=mr(C,v);if(X)switch(Pe.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(It.value!=="ai-agent"||v.role!=="assistant"||(v.serverMessageId??v.id)!==X.messageId)return;v.status="streaming",v.errorText=void 0,v.retryAction=void 0,v.awaitingContinuation=!0,_.value=[...C],Wt({continueExisting:!0,turn:v});return}case"resend-user":{let z=C.find(ee=>ee.role==="user"&&ee.id===X.messageId);if(!z)return;let ae=ee=>{ee&&Jr.current?.acceptQueuedMessage(X.messageId)};if(z.status="complete",z.errorText=void 0,z.retryAction=void 0,It.value!=="ai-agent"){_.value=v.role==="assistant"?C.filter(ee=>ee!==v):[...C],bn(z).then(ae);return}let U=Ut();_.value=v.role==="assistant"?C.map(ee=>ee===v?U:ee):[...C,U],Wt({continueExisting:!1,turn:z}).then(ae);return}case"repeat-user":{let z=C.find(xe=>xe.role==="user"&&xe.id===X.messageId);if(!z)return;let ae=za(Ue(z),z.attachments?.map(xe=>({...xe}))??[]),U=new Set(ae.attachments?.flatMap(xe=>xe.url?[xe.url]:[])??[]),ee=z.partsSig.value.flatMap(xe=>xe.kind==="file"&&!U.has(xe.url)?[{...xe}]:[]);if(ee.length>0&&(ae.partsSig.value=[...ae.partsSig.value,...ee]),It.value!=="ai-agent"){_.value=[...C,ae],bn(ae);return}_.value=[...C,ae,Ut()],Wt({continueExisting:!1,turn:ae});return}default:return X}},[f,_,It,Wt,bn]),Gn=L(()=>{if(hc(e.mode,we)==="exit-fullscreen"){Pe.info("close \u2192 exit-fullscreen",{mode:e.mode}),Ie("normal"),n.emit("fullscreen",!1);return}Pe.info("close \u2192 panel closed",{mode:e.mode}),Oe.fire("panel-close"),de(!1),r.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,r,we,Oe]),na=L(()=>{Pe.info("open",{mode:e.mode}),gt.unlock(),rt(!0),de(!0),r.savePanelOpen(!0),!ht&&!tt&&ct(),setTimeout(()=>rt(!1),Wg),n.emit("open",void 0),e.onOpen?.()},[n,e,gt,r,ht,tt,ct]),oa=L(()=>{let v=_.value.some(C=>C.role==="user");if(Se.current===l.value&&!v&&Ee&&l.value){Pe.info("clear \u2192 reusing empty conversation",{conversationId:l.value}),_.value.length===0&&Co(Te.current?.messages);return}Pe.info("clear \u2192 new conversation",{wasStreaming:f}),n.emit("clear",void 0),qt.settle(),c.current=!1,_e.current=void 0,Se.current=void 0,xt(()=>{_.value=[],l.value=void 0,zn({controlMode:"ai-agent",controlRevision:0})}),r.clearConversation(),at(!0),P([]),se([]),Vn({newConversation:!0})},[f,_,l,r,Vn,n,Ee,Co,qt,zn]),ra=L(()=>{oa(),Le("chat");let v=e.modules.list.find(C=>C.layout==="chat")?.id;v&&b.switchTab(v)},[oa,b,e]),aa=L(()=>{let v=we==="expanded"?"normal":"expanded";Pe.info("expand",{from:we,expanded:v==="expanded"}),Ie(v),r.savePanelSize(v),n.emit("expand",v==="expanded")},[n,we,r]),ia=L(()=>{let v=we==="fullscreen"?"normal":"fullscreen";Pe.info("fullscreen",{from:we,fullscreen:v==="fullscreen"}),Ie(v),r.savePanelSize(v),n.emit("fullscreen",v==="fullscreen")},[n,we,r]),Gu=L(()=>{Le(v=>{let C=v==="history"?"chat":"history";return Pe.info("toggleHistory",{view:C}),n.emit("toggleHistory",{view:C}),C})},[n]),ju=L(()=>{Tt(v=>{let C=!v;return Pe.info("sidebarToggle",{collapsed:C}),r.saveSidebarCollapsed(C),n.emit("sidebarToggle",{collapsed:C}),C})},[r,n]),Qu=L(v=>{Pe.info("resize",v),Ti({widgetSize:v}),n.emit("resize",v)},[Ti,n]),Xu=L(async v=>{let C=v.conversationId;if(C===l.value&&Ei(C)){Pe.info("selectConversation",{conversationId:C,cached:!0}),n.emit("selectConversation",{conversationId:C}),ue.publishConversation(v),Le("chat");let U=w();U&&b.switchTab(U),hn(C);return}let z=++qn.current;Mt.current++,u(!1);let ae=()=>z!==qn.current;Pe.info("selectConversation",{conversationId:C,wasStreaming:f}),n.emit("selectConversation",{conversationId:C}),ue.publishConversation(v);try{let[U,ee]=await Promise.all([ue.loadConversation(C),Ro(C)]);if(ae())return;qt.settle(),c.current=!0,_e.current=void 0;let xe=Qt(U.messages),ke=U.conversationId!==l.value,st=ke?xe:Ga(xe,_.value);Se.current=st.some(Kt=>Kt.role==="user")?void 0:U.conversationId,xt(()=>{_.value=To(st,ee),ke&&(d.value=U.conversationId),l.value=U.conversationId}),P(ee),r.saveConversationId(U.conversationId),ue.primeIdentity(a,U.conversationId),at(U.canContinue),U.controlState&&zn(U.controlState);let Lt=st.findLast(Kt=>Kt.role==="assistant"&&!Kt.ephemeral);se(Lt?.suggestions??[]),ke?Yr(U.conversationId):hn(U.conversationId),Le("chat");let ut=w();ut&&b.switchTab(ut)}catch(U){if(ae())return;n.emit("error",U),e.onError?.(U)}},[ue,_,l,d,n,e,r,Ro,To,f,a,qt,Yr,hn,Ei,b]),Eo=O(null),Ui=L(v=>{typeof v=="string"&&(D?Oe.fire("manual",v):Eo.current=v)},[D,Oe]);M(()=>{!D||!Eo.current||(Oe.fire("manual",Eo.current),Eo.current=null)},[D,Oe]);let Pn=O({handleOpen:na,handleClose:Gn,handleExpand:aa,handleFullscreen:ia,openForm:Ui});Pn.current={handleOpen:na,handleClose:Gn,handleExpand:aa,handleFullscreen:ia,openForm:Ui},Ct(()=>ks(t,{open:()=>Pn.current.handleOpen(),close:()=>Pn.current.handleClose(),expand:()=>Pn.current.handleExpand(),fullscreen:()=>Pn.current.handleFullscreen(),openForm:v=>Pn.current.openForm(v)}),[t]);let ot=oe(()=>Ta(e,wo,Ci,Ri),[e,wo,Ci,Ri]);nt.current=ot.strings;let Yu=oe(()=>g.map(v=>{let C=yn.list.find(X=>X.id===v.formId);return{...v,title:C?.title,form:C}}),[g,yn]),sa=v=>{Xu(v)},Hi={options:ot,transport:ue,feedback:gt,bus:n,persistence:r,conversationId:l.value??"",composerKey:d.value,composerApiRef:Jr,view:me,canSend:Ee,isStreaming:f,isMemoryCompacting:Vu,canReleaseQueuedMessages:E&&!p&&!Io.value&&(!$i||!Fi.value&&!Bi.value),queueManualMessages:$i&&(Fi.value||Bi.value),sendPreparing:ie,composerActive:ot.mode==="page"||ot.mode==="inline"||ot.mode==="standalone"||q,controlMode:It.value,assignedOperatorInitials:wu.value,operatorAvailable:Cu.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Tu,onCancelOperatorRequest:Iu,loadingMessages:p,onLoadPreviousMessages:Nu,messagesSig:_,agent:ye,suggestions:Ge,initialWidgetSize:s.widgetSize??null,onClose:Gn,onClear:oa,onExpand:aa,onFullscreen:ia,onSoundToggle:ku,onToggleHistory:Gu,onSelectHistoryConversation:sa,onNewConversation:ra,onLocaleChange:Pu,onThemeChange:xu,onTextSizeChange:Su,onWidgetSizeChange:Qu,onSend:Ni,onStop:Wu,onSuggestion:v=>{if(Q.current)return;let C=v.text??v.label;Pe.info("suggestion",{text:C,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:C}),e.autoSendSuggestions?Ni(C,[]):Jr.current?.fill(C)},activeForm:Io.value?.form??null,formMarkers:Yu,onFormSubmit:Oe.complete,onFormSkip:Oe.skip,onFormFill:v=>Oe.fire("manual",v),tool:Fu,onRetry:Ku,onMessageFeedback:Bu};if(!E)return null;let jn=ot.modules.list,la=v=>{let C=On("close",ot.mode,v);return jn.length===0?i(Vd,{strings:ot.strings,onClose:C?Gn:void 0}):jn.length===1&&jn[0]?.layout==="chat"?i(vd,{...Hi,panelSize:v}):i(qd,{panelProps:{...Hi,panelSize:v,onClose:C?Gn:void 0},enabledModules:jn,nav:b,bus:n,hasUnread:Au.value,onSelectConversation:sa,onStartNewConversation:ra,onSetPanelSize:Ie})};if(e.mode==="page"){let v=jn.some(C=>C.layout==="chat");return i("div",{class:`${Gr}-anchor`,children:i(Pd,{site:W,blocks:le,transport:ue,strings:ot.strings,locale:ot.locale,persistence:r,showConversations:v,onSelectConversation:sa,onNewConversation:ra,sidebarCollapsed:yt,onToggleSidebarCollapsed:ju,children:la("fullscreen")})})}if(B){let v=e.mode==="standalone"?"fullscreen":we;return i("div",{class:`${Gr}-anchor`,children:la(v)})}let zi=e.mode==="drawer",qi=!(e.mode==="modal")&&!e.launcher.hidden&&(!q||Fe),Vi=qi&&!Fe&&!ht&&!zi?ot.launcher.callout:null;return i("div",{class:`${Gr}-anchor`,"data-launcher-size":ot.launcher.size,children:[q||re?i("div",{class:`${Gr}-surface`,hidden:!q,children:la(we)}):null,qi?i(mc,{onToggle:na,launcher:ot.launcher,strings:ot.strings,leaving:Fe,edgeTab:zi}):null,Vi?i(gc,{callout:Vi,launcherPosition:ot.position,strings:ot.strings,closeLabel:ot.strings.close,onDismiss:ct}):null]})}function Vg(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Wg=120;async function Kg(e,t,n,o){return(await Promise.all(t.map(async a=>{try{let{id:s,url:l}=await e.uploadFile(a.file,n);return{id:s,name:a.name,mediaType:a.mediaType,size:a.size,url:l}}catch(s){o(s);return}}))).filter(a=>a!==void 0)}var Gg=Z.scope("error-boundary"),jr=class extends _t{constructor(){super(...arguments);ce(this,"state",{crashed:!1})}componentDidCatch(n,o){Gg.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 jg="1",Qg=60,Xg=2e3,_u={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),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}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),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 Yg(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Jg(){return location.origin+location.pathname}function Zg(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function pu(e,t){let n=Math.random(),o=0,r=0,a=new Set,s=(c,d)=>{let{tracking:_,publicKey:p,aiAgentDeploymentId:u,mode:m,themeMode:g}=t.getOptions();if(!_.enabled||Yg()||n>=_.sampleRate)return;let P=performance.now();if(P-o>6e4&&(o=P,r=0),++r>Qg)return;let y=new URLSearchParams;y.set("v",jg),y.set("_ev",xn),y.set("e",c),_.token&&y.set("tk",_.token),p&&y.set("pk",p),u&&y.set("dep",u),y.set("vid",t.getVisitorId());let w=t.getConversationId();w&&y.set("cid",w),y.set("url",Jg());let S=Zg();S&&y.set("ref",S),y.set("sw",String(screen.width)),y.set("sh",String(screen.height)),y.set("vw",String(innerWidth)),y.set("vh",String(innerHeight)),y.set("dpr",String(devicePixelRatio)),y.set("lang",navigator.language);try{y.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(y.set("m",m),y.set("th",g),d)for(let[k,E]of Object.entries(d))E!==void 0&&y.set(k,String(E));y.set("ts",String(Date.now()));let h=`${_.endpoint}?${y}`;if(h.length>Xg)return;let b=new Image(1,1);a.add(b);let x=()=>a.delete(b);b.addEventListener("load",x,{once:!0}),b.addEventListener("error",x,{once:!0}),b.src=h},l=Object.keys(_u).map(c=>e.on(c,d=>s(c,_u[c]?.(d))));return()=>{for(let c of l)c();a.clear()}}function fu(e){let{bus:t,host:n,appRoot:o,persistence:r,reportError:a}=e,s=e.initialRaw,l,c=kn(s),d=!0,_=()=>{c=kn(l?Ia(s,l):s)},p=()=>{Ms(n,to(c.mode));let g=r.loadUserPrefs().themeMode;Ls(n,g?{...c,themeMode:g}:c),d&&(jo(n,Qr(c)),d=!1)},u=()=>{p(),Jn(Nt(jr,{onError:a},Nt(uu,{bus:t,hostElement:n,options:c})),o)};t.on("handshake",g=>{g.config&&(g.config.storageVersion&&r.rememberStorageVersion(g.config.storageVersion),l=g.config,_(),u())});let m=pu(t,{getOptions:()=>c,getVisitorId:()=>r.getVisitorId(),getConversationId:()=>r.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>s,render:u,setUserOptions:g=>{s=g,_(),u()},patchUserOptions:g=>{s={...s,...g},_(),u()},destroy:()=>m()}}function Qr(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Cn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:o}=io(e,En(),t.loadPanelOpen(),t.loadPanelSize());return ir(e.mode,o,n)}var ev=Z.scope("hooks"),Xr="*",wi=new Set;function mu(e,t,n){let o={widgetId:e,event:t,listener:n};return wi.add(o),()=>{wi.delete(o)}}function tv(e,t,n){let o=[...wi];for(let r of o)if(nv(r.widgetId,e.widgetId)&&!(r.event!==Xr&&r.event!==t))try{r.listener(e,t,n)}catch(a){ev.warn("hook listener threw",{event:t,error:a})}}function gu(e,t){let n=[];for(let o of ov)n.push(t.on(o,r=>{tv(e,o,r)}));return()=>{for(let o of n)o()}}function nv(e,t){return e===Xr||e===t}var ov=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound"];var zt=new Map;function vu(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&qo(e.debug);let t=Z.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=kn(e),o=n.widgetId,r=zt.get(o);r&&(t.debug("destroy existing instance at slot",{widgetId:o}),r.destroy());let a=Qr(n),s=n.iframe?Ds({position:to(n.mode)},n.position,a,n.mode,e.target??null):Go({position:to(n.mode),target:e.target??null});s.hostElement.dataset.widgetId=o;let l=new Xo,c=Cn(o,n.storage,n.aiAgentDeploymentId),d=P=>{l.emit("error",P),_.getOptions().onError?.(P)},_=fu({bus:l,host:s.hostElement,appRoot:s.appRoot,persistence:c,initialRaw:e,reportError:d});_.render();let p=s.hostElement,u=null,m=P=>{P.debug!==void 0&&qo(P.debug),_.patchUserOptions(P)},g={widgetId:o,open:()=>eo(p,"open"),close:()=>eo(p,"close"),expand:()=>eo(p,"expand"),openForm:P=>eo(p,"openForm",P),on:(P,y)=>l.on(P,y),update:P=>{t.debug("update",{patch:P}),m(P)},setUserContext:P=>{t.debug("setUserContext",{keys:Object.keys(P)}),m({userContext:{..._.getUserOptions().userContext,...P}})},clearUserContext:()=>{t.debug("clearUserContext"),m({userContext:void 0})},setPageContext:P=>{t.debug("setPageContext",{keys:Object.keys(P)}),m({pageContext:{..._.getUserOptions().pageContext,...P}})},clearPageContext:()=>{t.debug("clearPageContext"),m({pageContext:void 0})},setDebug:P=>{qo(P),t.info("debug level set",{level:xa()})},debugLevel:()=>xa(),onLog:P=>fs(P),destroy:()=>{t.info("destroy",{widgetId:o}),u?.(),_.destroy(),l.clear(),Jn(null,s.appRoot),s.destroy(),zt.get(o)===g&&zt.delete(o)}};return u=gu(g,l),zt.set(o,g),g}function rv(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=zt.get(t);return n?(n.update(e),n):vu(e)}function av(e){if(e!==void 0){zt.get(e)?.destroy();return}let t=[...zt.values()];for(let n of t)n.destroy()}function iv(e="default"){return zt.get(e)??null}function sv(){return[...zt.values()]}function lv(e,t,n){return mu(e,t,n)}var cv=xn,dv=T;
|
|
55
|
+
`)}function zi(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Pr(e),set_attr(i,a,s){if(a!==br||s!=="openui"||i.index!==1)return Ri(i,a,s);let c=document.createElement("div");i.nodes[i.index]?.parentElement?.replaceWith(c),o={textSig:ie(""),doneSig:ie(!1)},r.push(c),Xt(l($m,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(i,a){o?o.textSig.value=o.textSig.peek()+a:Ci(i,a)},end_token(i){o&&(o.doneSig.value=!0,o=void 0),wi(i)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let i of r)Xt(null,i);r.length=0,o=void 0}}}function $m({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=de(()=>{let i=Fc();return Ce(()=>Ui(i.set(e.value,t.value),!t.value))},[e,t]);return o.value.error?l("div",{role:"alert",children:r.visualError}):l("div",{class:`${n}-generative-ui`,"aria-busy":!t.value,children:[o.value.elements.map(i=>{switch(i.typeName){case"Text":return l("p",{children:i.props.text},i.statementId);case"Card":return l("section",{children:[l("strong",{children:i.props.title}),l("p",{children:i.props.body})]},i.statementId);case"Metric":return l("section",{children:[l("strong",{children:i.props.label}),l("span",{class:`${n}-generative-ui-metric`,children:i.props.value}),i.props.detail&&l("p",{children:i.props.detail})]},i.statementId);case"Table":return l("section",{children:l("div",{class:`${n}-generative-ui-table`,children:l("table",{children:[l("caption",{children:i.props.title}),l("thead",{children:l("tr",{children:i.props.columns.map((a,s)=>l("th",{scope:"col",children:a},s))})}),l("tbody",{children:i.props.rows.map((a,s)=>l("tr",{children:a.map((c,u)=>l("td",{children:c},u))},s))})]})})},i.statementId);case"Chart":return l(Dm,{element:i,cssPrefix:n},i.statementId)}}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function Dm({element:e,cssPrefix:t}){let n=Math.min(0,...e.props.data.map(s=>s.value)),o=Math.max(0,...e.props.data.map(s=>s.value))-n||1,i=148+n/o*136,a=e.props.data.map((s,c)=>({x:24+(c+.5)*272/e.props.data.length,y:148-(s.value-n)/o*136}));return l("section",{children:[l("strong",{children:e.props.title}),l("svg",{class:`${t}-generative-ui-chart`,viewBox:"0 0 320 168",role:"img","aria-label":`${e.props.title}. ${e.props.data.map(s=>`${s.label}: ${s.value}`).join(", ")}`,children:[l("line",{class:`${t}-generative-ui-axis`,x1:24,x2:296,y1:i,y2:i}),e.props.type==="line"&&l("polyline",{points:a.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),a.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,i),width:192/e.props.data.length,height:Math.abs(s.y-i),fill:"currentColor"},c):l("circle",{cx:s.x,cy:s.y,r:3,fill:"currentColor"},c))]}),l("div",{class:`${t}-generative-ui-data`,children:e.props.data.map((s,c)=>l("span",{children:[s.label,": ",s.value]},c))})]})}function jo(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,i=0,a;function s(u){a?.language==="openui"&&(t+=e.slice(n,a.start)+Uc(a.source)+(e[u-1]===`
|
|
56
|
+
`?`
|
|
57
|
+
`:""),n=u),a=void 0}let c=yr({data:void 0,add_token(u,d){i+=1,d===10&&i===1&&(a={start:o,source:"",language:""})},set_attr(u,d,_){a&&d===br&&(a.language=_)},add_text(u,d){a&&(a.source+=d)},end_token(){a&&s(Math.min(r+1,e.length)),i-=1}});for(;r<e.length;r++)et(c,e.charAt(r)),e[r]===`
|
|
58
|
+
`&&(o=r+1);return Eo(c),a&&s(e.length),t+e.slice(n)}function Hi(e,t,n=vt()){let r=e?[{kind:"text",id:"t0",textSig:ie(e),doneSig:ie(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:ie(r)}}function Ht(){return{id:vt(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:ie([])}}function qc(e){let t=vt();return Bm({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function Bm(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,feedback:e.feedback,partsSig:ie(e.parts.map(jm))}}function Fm(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function Vi(e){let t=new Set,n=e.parts.map((o,i)=>o.type==="text"?{kind:"text",id:`${e.id}-t${i}`,textSig:ie(o.text),doneSig:ie(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${i}`,textSig:ie(o.text),doneSig:ie(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${i}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType}:o.type==="source-url"?{kind:"source",sourceId:o.sourceId,url:o.url,title:o.title}:o.type==="source-document"?{kind:"source",sourceId:o.sourceId,title:o.title,filename:o.filename,mediaType:o.mediaType}:o.type==="data-suggestions"?null:o.type==="dynamic-tool"||o.type.startsWith("tool-")?{kind:"tool",toolCallId:o.toolCallId,toolName:o.type==="dynamic-tool"?o.toolName:nc(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,inputPartialSig:ie(""),inputSig:ie(o.input),outputSig:ie(o.output),errorSig:ie(o.errorText),stateSig:ie(o.state),approvalSig:ie(o.approval)}:null).filter(o=>o!==null).filter(o=>o.kind!=="source"?!0:t.has(o.sourceId)?!1:(t.add(o.sourceId),!0)),r=e.parts.find(o=>o.type==="data-suggestions");return{id:e.id,role:e.role,operatorInitials:e.operatorInitials,suggestions:r?.type==="data-suggestions"?Ro(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:Fm(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:ie(n)}}function Um(e){return!e.parts.some(t=>t.type==="text"&&t.text.trim()!==""||t.type==="dynamic-tool"||t.type.startsWith("tool-")||t.type==="file"||t.type==="source-url"||t.type==="source-document")}function zm(e){return e.role==="assistant"&&e.status==="streaming"&&Um(e)}function en(e){let t=e.length-1;return e.filter((n,r)=>r===t||!zm(n)).map(Vi)}function Hc(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function ji(e){return{id:e.id,role:e.role,createdAt:e.createdAt,status:e.status,canceled:e.canceled,errorText:e.errorText,finishReason:e.finishReason,serverMessageId:e.serverMessageId,ephemeral:e.ephemeral,attachments:e.attachments,parts:e.partsSig.value.map(Wm)}}function Ke(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Wo(e,t,n,r,o,i=t.createdAt){let a=e.find(d=>d.role==="user"&&!d.ephemeral);function s(d,_){return(d.role==="assistant"?jo(Ke(d)):Ke(d)).replace(/\s+/g," ").trim().slice(0,_)}let c=a?s(a,80):"",u=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(i).toISOString(),preview:u||void 0,canContinue:o}}function Et(e){return Ke(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function qm(e){return Ke(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Wi(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function qn(e){return e.kind==="tool"}function Vc(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function Tr(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(Vc)}function vn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(qn);return t.length>0&&t.every(n=>Wi(n.stateSig.value))}function hn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!Tr(e)}function Go(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||Vc(n))}function Ko(e){return e.partsSig.value.some(t=>qn(t)&&!Wi(t.stateSig.value))}function jc(e,t){if(t.length===0)return e;let n=new Set;for(let a of e)n.add(a.id),a.serverMessageId&&n.add(a.serverMessageId);let r=t.filter(a=>{let s=[a.id,a.serverMessageId].filter(c=>c!==void 0);return s.some(c=>n.has(c))?!1:(s.forEach(c=>n.add(c)),!0)});if(r.length===0)return e;let o=e.findIndex(a=>!a.ephemeral),i=o<0?e.length:o;return[...e.slice(0,i),...r,...e.slice(i)]}function mn(e,t){return t.id=e.id,e.canceled&&(t.canceled=!0),e.feedback!==void 0&&(t.feedback=e.feedback),t.suggestions??(t.suggestions=e.suggestions),t}function Wc(e,t,n,r){if(!Gi(e))return;if(t.length===0){let a=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===a&&Ke(s).length>=Ke(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let i=r.get(o.serverMessageId??o.id);if(i!==void 0)return n.find(a=>a.role==="assistant"&&r.get(a.serverMessageId??a.id)===i+1&&Ke(a).length>=Ke(e).length)}function Gi(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function Hm(e,t){let n=new Map(t.partsSig.value.filter(qn).filter(i=>Wi(i.stateSig.value)).map(i=>[i.toolCallId,i]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(i=>{if(!qn(i))return i;let a=n.get(i.toolCallId);if(!a)return i;let s=i.approvalSig.value,c=a.approvalSig.value,u=s===void 0||s.approved===void 0&&c?.approved!==void 0?a.approvalSig:i.approvalSig,d=i.inputSig.value===void 0?a.inputSig:i.inputSig,_=i.toolName==="tool"?a.toolName:i.toolName,p=i.dynamic??a.dynamic;return u===i.approvalSig&&d===i.inputSig&&_===i.toolName&&p===i.dynamic?i:(r=!0,{...i,toolName:_,dynamic:p,inputSig:d,approvalSig:u})});r&&(e.partsSig.value=o)}function Ki(e,t){let n=t.filter(_=>!_.ephemeral&&(_.status==="streaming"||_.status==="pending"||_.status==="error"||_.retryAction!==void 0||(_.attachments?.length??0)>0||Et(_))),r=new Map;for(let _ of n)r.set(_.id,_),_.serverMessageId!==void 0&&r.set(_.serverMessageId,_);let o=new Set,i=[],a=e.map(_=>{let p=(_.serverMessageId!==void 0?r.get(_.serverMessageId):void 0)??r.get(_.id);return p===void 0?(i.push(_),_):(o.add(p),p.role!==_.role?_:p.role==="user"&&p.serverMessageId===void 0&&(p.status==="pending"||p.status==="error")?mn(p,_):p.status==="streaming"||Ke(p).length>=Ke(_).length?(Hm(p,_),p.suggestions??(p.suggestions=_.suggestions),p.feedback===void 0&&(p.feedback=_.feedback),_.canceled&&(p.canceled=!0),p):mn(p,_))}),s=n.filter(_=>!o.has(_)),c=s.findLast(Gi),u=new Map;e.forEach((_,p)=>{u.set(_.id,p),_.serverMessageId!==void 0&&u.set(_.serverMessageId,p)});let d=Wc(c,c?n.slice(0,n.indexOf(c)):[],i,u);if(c&&d){let _=a.indexOf(d);_>=0&&(a[_]=mn(c,d)),s=s.filter(p=>p!==c)}return[...a,...s]}function Ar(e,t){let n=new Map(t.filter(_=>_.serverMessageId!==void 0).map(_=>[_.serverMessageId,_])),r=new Map;t.forEach((_,p)=>{r.set(_.id,p),_.serverMessageId!==void 0&&r.set(_.serverMessageId,p)});let o=new Set(e.flatMap(_=>[_.serverMessageId,_.id].filter(p=>p!==void 0))),i=!1,a=e.map(_=>{let p=n.get(_.serverMessageId??_.id);if(p===void 0||p.role!==_.role)return _;if(_.role==="user"&&_.serverMessageId===void 0)return i=!0,mn(_,p);if(_.serverMessageId===void 0)return _;let f=Ke(p),m=Ke(_),g=p.status!=="streaming"&&f.length>=m.length&&qi(_,p);if(f.length>m.length||f===m&&p.partsSig.value.length>_.partsSig.value.length||g)return i=!0,mn(_,p);if(_.status==="streaming"&&p.status!=="streaming"&&Vm(_,p)){if(_.continuationStreaming&&Ko(p))return _;if(!qi(p,_))return i=!0,mn(_,p)}return _}),s=[...n.values()].filter(_=>!o.has(_.serverMessageId)),c=a.findLastIndex(Gi),u=a[c],d=Wc(u,a.slice(0,c),s,r);if(u!==void 0&&d!==void 0&&Ke(d).length>=Ke(u).length&&(mn(u,d),a[c]=d,s.splice(s.indexOf(d),1),i=!0),s.length===0)return{messages:i?a:e,changed:i};for(let _ of s){let p=r.get(_.serverMessageId??_.id),f=!1,m=a.findIndex(g=>{let P=r.get(g.serverMessageId??g.id);return p===void 0?!1:P===void 0?f:P>p?!0:(f=!0,!1)});m===-1?a.push(_):a.splice(m,0,_)}return{messages:a,changed:!0}}function Gc(e,t){if(e.role!==t.role)return!1;let n=Ke(t),r=Ke(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||qi(e,t)}function Vm(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,i)=>{let a=r[i];switch(o.kind){case"text":return a?.kind==="text"&&a.textSig.value===o.textSig.value;case"reasoning":return a?.kind==="reasoning"&&a.textSig.value===o.textSig.value;case"step-start":return a?.kind==="step-start";case"tool":return a?.kind==="tool"&&a.toolCallId===o.toolCallId&&Qo(a.toolName,o.toolName);case"file":return a?.kind==="file"&&a.url===o.url&&a.mediaType===o.mediaType;case"source":return a?.kind==="source"&&a.sourceId===o.sourceId&&a.url===o.url&&a.title===o.title&&a.filename===o.filename&&a.mediaType===o.mediaType;default:return o}})}function Qo(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var zc={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function qi(e,t){let n=new Map(e.partsSig.value.filter(qn).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(qn).some(r=>{let o=n.get(r.toolCallId);if(!o||zc[r.stateSig.value]>zc[o.stateSig.value])return!0;let i=r.approvalSig.value?.approved;return i!==void 0&&i!==o.approvalSig.value?.approved})}function gn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Et(e)}function Yo(e,t){if(!e.includes(t)||t.retryAction===null)return;if(t.retryAction)return t.retryAction;if(t!==e.at(-1)||t.role!=="assistant"||t.serverMessageId===void 0||t.status!=="error"&&!gn(t))return;let n=e.indexOf(t);for(let r=n-1;r>=0;r--){let o=e[r];if(o?.role==="user"&&!o.ephemeral)return{kind:"repeat-user",messageId:o.id}}}function Kc(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!qm(e)}function Qc(e,t){return e.operatorRoutedTurn?gn(e)?"drop":"complete-operator-routed":t||gn(e)?"error":"complete"}function jm(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:ie(e.text),doneSig:ie(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,inputPartialSig:ie(e.inputPartial),inputSig:ie(e.input),outputSig:ie(e.output),errorSig:ie(e.error),stateSig:ie(e.state),approvalSig:ie(e.approval)}:e}function Wm(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,dynamic:e.dynamic,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}var Yc=le.scope("feedback:audio"),Xo=class{constructor(){ve(this,"ctx",null);ve(this,"master",null);ve(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){Yc.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,r=this.master;if(!n||!r||n.state!=="running")return;let o=n.currentTime,i=t.noteMs/1e3;t.notes.forEach((a,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=a;let u=n.createGain(),d=o+s*i;u.gain.setValueAtTime(1e-4,d),u.gain.exponentialRampToValueAtTime(t.peakGain,d+.005),u.gain.exponentialRampToValueAtTime(1e-4,d+i),c.connect(u).connect(r),c.start(d),c.stop(d+i+.01)})}async playUrl(t){let n=this.ctx,r=this.master;if(!n||!r||n.state!=="running")return;let o=await this.getBuffer(t);if(!o)return;let i=n.createBufferSource();i.buffer=o,i.connect(r),i.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 r=this.ctx,o=fetch(t).then(i=>i.ok?i.arrayBuffer():Promise.reject(new Error(`fetch ${i.status}`))).then(i=>r.decodeAudioData(i)).then(i=>(this.buffers.set(t,i),i)).catch(i=>(Yc.warn("audio fetch/decode failed",{url:t,err:i}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var Xc={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},Jc={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 tn=null,Jo=0;function Gm(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Km(){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=`__${T.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 Zc(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Gm())try{navigator.vibrate(e);return}catch{}if(tn??(tn=Km()),!!tn)try{tn.label.click()}catch{}}}function ed(){Jo++;let e=!1;return()=>{e||(e=!0,Jo=Math.max(0,Jo-1),Jo===0&&tn&&(tn.input.remove(),tn.label.remove(),tn=null))}}var Qm=le.scope("feedback"),Ym=100,Zo=class{constructor(t,n){ve(this,"mutedSig",ie(!1));ve(this,"audio",new Xo);ve(this,"releaseHaptics");ve(this,"sound");ve(this,"haptics");ve(this,"lastPlayed",new Map);ve(this,"reducedMotionMq",null);this.sound=t,this.haptics=n,this.releaseHaptics=ed(),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<Ym}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Qm.warn("audio play failed",{err:o,url:n}));return}let r=Jc[t];r&&this.audio.playTone(r)}playHaptic(t){if(this.reducedMotionMq?.matches)return;let n=this.haptics.events?.[t];if(n===!1)return;let r=n===!0||n===void 0?Xc[t]:n;Zc(r)}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}};var ae={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},Er=`${T.cssPrefix}-icon-dir`;function Qi(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M21 12a8 8 0 0 1-12 6.93L3 21l1.65-5.16A8 8 0 1 1 21 12Z"})})}function It(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function td(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function nd(){return l("svg",{...ae,class:Er,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function rd(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function od(){return l("svg",{...ae,class:Er,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function Hn(){return l("svg",{...ae,class:Er,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function ad(){return l("svg",{...ae,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function id(){return l("svg",{...ae,"aria-hidden":"true",children:l("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"})})}function sd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("rect",{x:"9",y:"2",width:"6",height:"12",rx:"3"}),l("path",{d:"M5 10a7 7 0 0 0 14 0M12 19v3"})]})}function ld(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function cd(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function dd(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function ud(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function pd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M14 3h7v7M21 3l-9 9"}),l("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]})}function _d(){return l("svg",{...ae,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function fd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"5",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"12",r:"1.5",fill:"currentColor",stroke:"none"}),l("circle",{cx:"12",cy:"19",r:"1.5",fill:"currentColor",stroke:"none"})]})}function md(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM15 9a5 5 0 0 1 0 6M18 7a9 9 0 0 1 0 10"})})}function gd(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function vd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M3 18 8 6l5 12M4.7 14h6.6"}),l("path",{d:"M14.5 18l3.2-7 3.2 7M15.6 15.8h4.2"})]})}function hd(){return l("svg",{...ae,class:Er,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function bn(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function bd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M3 3v6h6"}),l("path",{d:"M3.05 13A9 9 0 1 0 6 5.3L3 9"}),l("path",{d:"M12 7v5l3 2"})]})}function yd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M2 12h20"}),l("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"})]})}function Mr(){return l("svg",{...ae,class:Er,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function Pd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M12 20h9"}),l("path",{d:"M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z"})]})}function yn(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function xd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8Z"}),l("path",{d:"M14 2v6h6"})]})}function Xm(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"m12 3-1.5 4.5L6 9l4.5 1.5L12 15l1.5-4.5L18 9l-4.5-1.5Z"}),l("path",{d:"M19 15v4M17 17h4M5 3v2M4 4h2"})]})}function Yi(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M21 15a2 2 0 0 1-2 2H7l-4 4V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2Z"})})}function Lr(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("path",{d:"M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"}),l("path",{d:"M12 17h.01"})]})}function Jm(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"m15 4 3 3-9 9-3-3z"}),l("path",{d:"M18 2v2M20 4h2M3 20l3-3M3 16h2M5 14v2"})]})}function Zm(){return l("svg",{...ae,"aria-hidden":"true",children:[l("rect",{x:"4",y:"8",width:"16",height:"12",rx:"2"}),l("path",{d:"M12 8V4"}),l("circle",{cx:"12",cy:"3",r:"1"}),l("path",{d:"M2 14h2M20 14h2M9 13h.01M15 13h.01M9.5 17h5"})]})}function Xi(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M4 14v-2a8 8 0 0 1 16 0v2"}),l("rect",{x:"2",y:"14",width:"4",height:"6",rx:"1.5"}),l("rect",{x:"18",y:"14",width:"4",height:"6",rx:"1.5"}),l("path",{d:"M20 20v1a3 3 0 0 1-3 3h-5"})]})}function eg(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"10"}),l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Ji(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Sd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function kd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M3 9.5 12 3l9 6.5"}),l("path",{d:"M5 9v11a1 1 0 0 0 1 1h12a1 1 0 0 0 1-1V9"})]})}function wd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"m3 11 15-5v12L3 13z"}),l("path",{d:"M3 11v2a2 2 0 0 0 2 2h1V9H5a2 2 0 0 0-2 2z"}),l("path",{d:"M7 15v3a2 2 0 0 0 4 0v-2"}),l("path",{d:"M21 10a3 3 0 0 1 0 4"})]})}function Or(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M14 9a2 2 0 0 1-2 2H6l-4 4V4a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2z"}),l("path",{d:"M18 9h2a2 2 0 0 1 2 2v11l-4-4h-6a2 2 0 0 1-2-2v-1"})]})}function Cd(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"4"}),l("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"})]})}function Rd(){return l("svg",{...ae,"aria-hidden":"true",children:l("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})})}function Id(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 3v18"}),l("path",{d:"M12 3a9 9 0 0 1 0 18z",fill:"currentColor",stroke:"none"})]})}function tg(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"10.5",cy:"10.5",r:"6.5"}),l("path",{d:"M8 11a2.5 2.5 0 0 0 5 0"}),l("path",{d:"m20 20-4.4-4.4"})]})}function ng(){return l("svg",{...ae,"aria-hidden":"true",children:[l("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"}),l("path",{d:"M18.5 4v3M20 5.5h-3M5.5 16v2.5M6.75 17.25h-2.5"})]})}function rg(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M4 18h16"}),l("path",{d:"M5 18a7 7 0 0 1 14 0"}),l("path",{d:"M12 8V6"}),l("path",{d:"M10 6h4"})]})}function og(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M7 11V6.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M10 10V5.5a1.5 1.5 0 0 1 3 0V10"}),l("path",{d:"M13 10V6.5a1.5 1.5 0 0 1 3 0V12"}),l("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"})]})}function Td(){return l("svg",{...ae,"aria-hidden":"true",children:[l("rect",{x:"9",y:"9",width:"11",height:"11",rx:"2"}),l("path",{d:"M5 15a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2"})]})}function Ad(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M7 10v11H4a1 1 0 0 1-1-1v-9a1 1 0 0 1 1-1z"}),l("path",{d:"M7 10l4-7a2.5 2.5 0 0 1 2.5 2.5V8h5a2 2 0 0 1 2 2.3l-1.2 8A2 2 0 0 1 17.3 20H7"})]})}function Ed(){return l("svg",{...ae,"aria-hidden":"true",children:[l("path",{d:"M17 14V3h3a1 1 0 0 1 1 1v9a1 1 0 0 1-1 1z"}),l("path",{d:"M17 14l-4 7a2.5 2.5 0 0 1-2.5-2.5V16h-5a2 2 0 0 1-2-2.3l1.2-8A2 2 0 0 1 6.7 4H17"})]})}function Md(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"3.5"}),l("path",{d:"M12 2v3M12 19v3M2 12h3M19 12h3M4.9 4.9l2.1 2.1M17 17l2.1 2.1M19.1 4.9l-2.1 2.1M7 17l-2.1 2.1"})]})}function Ld(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function ea(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m8.5 12 2.5 2.5 4.5-5"})]})}function ta(){return l("svg",{...ae,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var Od={chat:Qi,message:Yi,bubbles:Or,spark:Xm,wand:Jm,bot:Zm,help:Lr,lifebuoy:eg,headset:Xi,search:tg,sparkles:ng,concierge:rg,wave:og};var V=T.cssPrefix,A={launcher:`${V}-launcher`,callout:`${V}-callout`,calloutDismiss:`${V}-callout-dismiss`,panel:`${V}-panel`,panelHeader:`${V}-panel-header`,resizeGrip:`${V}-resize-grip`,scrollToBottom:`${V}-scroll-to-bottom`,loadPreviousMessages:`${V}-load-previous-messages`,actionHistory:`${V}-action-history`,actionClose:`${V}-action-close`,langSegment:`${V}-lang-segment`,composer:`${V}-composer`,composerInput:`${V}-composer-input`,composerSend:`${V}-composer-send`,composerStop:`${V}-composer-stop`,compactionStatus:`${V}-compaction-status`,messageQueue:`${V}-message-queue`,queuedMessage:`${V}-queued-message`,queuedMessageRemove:`${V}-queued-message-remove`,composerAttach:`${V}-composer-attach`,composerFileInput:`${V}-composer-file-input`,composerVoice:`${V}-composer-voice`,attachmentChip:`${V}-attachment-chip`,attachmentRemove:`${V}-attachment-remove`,suggestion:`${V}-suggestion`,messageBubble:`${V}-message`,messageRetry:`${V}-message-retry`,messageFeedback:`${V}-message-feedback`,feedbackUp:`${V}-feedback-up`,feedbackDown:`${V}-feedback-down`,messageCopy:`${V}-message-copy`,historyPane:`${V}-history-pane`,historyBack:`${V}-history-back`,historyItem:`${V}-history-item`,historyLoadMore:`${V}-history-load-more`,sidebar:`${V}-sidebar`,sidebarToggle:`${V}-sidebar-toggle`,sidebarNewConversation:`${V}-sidebar-new-conversation`,sidebarItem:`${V}-sidebar-item`,messengerHome:`${V}-messenger-home`,modulesEmpty:`${V}-modules-empty`,tab:`${V}-tab`,tabBadge:`${V}-tab-badge`,homeView:`${V}-home-view`,homeGreeting:`${V}-home-greeting`,homeBrand:`${V}-home-brand`,backHeader:`${V}-back-header`,contentView:`${V}-content-view`,contentScroll:`${V}-content-scroll`,homeSearch:`${V}-home-search`,helpSearch:`${V}-help-search`,homeRecent:`${V}-home-recent`,homeContentRow:`${V}-home-content-row`,helpArticle:`${V}-help-article`,newsItem:`${V}-news-item`,formGate:`${V}-form-gate`,formDone:`${V}-form-done`,formDoneToggle:`${V}-form-done-toggle`,formAnswers:`${V}-form-answers`,formFill:`${V}-form-fill`,formSubmit:`${V}-form-submit`,formSkip:`${V}-form-skip`,formField:`${V}-form-field`,toolAskQuestions:`${V}-tool-ask-questions`,toolInputSubmit:`${V}-tool-input-submit`,toolInputSkip:`${V}-tool-input-skip`,toolApproval:`${V}-tool-approval`,toolApprove:`${V}-tool-approve`,toolReject:`${V}-tool-reject`,toolEdit:`${V}-tool-edit`,toolDecision:`${V}-tool-decision`,typingDots:`${V}-typing-dots`,reasoning:`${V}-reasoning`,toolAskSummary:`${V}-ask-questions-summary`,toolAskOptions:`${V}-ask-questions-options-toggle`,toolCall:`${V}-tool-call`,source:`${V}-source`,operatorRequest:`${V}-operator-request`,operatorBanner:`${V}-operator-banner`,cancelOperatorRequest:`${V}-cancel-operator-request`};function it(e,t){return`${e}-${t}`}var na=T.cssPrefix;function Nd({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let i=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${na}-fab`,"data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":A.launcher,onClick:e,"aria-label":n.launcherOpen,children:[ag(t.icon),i?l("span",{class:`${na}-fab-label`,children:_t(n,t.label??"")}):null]})}function ag(e){let t=Od[e];return t?l(t,{}):l(ig,{source:e})}function ig({source:e}){return l("span",{ref:t=>{t&&sg(t,e)},"aria-hidden":"true"})}function sg(e,t){if(e.dataset.svgMounted!==t)try{let r=new DOMParser().parseFromString(t,"image/svg+xml").documentElement;r.tagName.toLowerCase()==="svg"&&(e.replaceChildren(document.importNode(r,!0)),e.dataset.svgMounted=t)}catch{}}function $d({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[i,a]=H(!1);return D(()=>{let s=setTimeout(()=>a(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),D(()=>{if(!i||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[i,e.autoDismissMs,o]),i?l("div",{class:`${na}-callout`,role:"status","data-shape":e.shape,"data-position":lg(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":A.callout,children:[l("span",{children:_t(n,e.text)}),l("button",{type:"button",class:`${na}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":A.calloutDismiss,children:l(It,{})})]}):null}function lg(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}function ra({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:i}){let a=T.cssPrefix,s=$(null);if(D(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${a}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${a}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${a}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${a}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${a}-widget-w`,`${r.width}px`),m.setProperty(`--${a}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,a,r]),!e)return null;let c=n.startsWith("top-"),u=n.endsWith("-right"),d=`${a}-resize-grip ${a}-resize-grip--${c?"bottom":"top"}-${u?"left":"right"}`;function _(m){if(!e)return;let g=m.currentTarget,P=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:P.width,startH:P.height,dirX:u?-1:1,dirY:c?1:-1},g.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function p(m){let g=s.current;if(!g||m.pointerId!==g.pointerId||!e)return;let P=(m.clientX-g.startX)*g.dirX,k=(m.clientY-g.startY)*g.dirY;e.style.setProperty(`--${a}-widget-w`,`${g.startW+P}px`),e.style.setProperty(`--${a}-widget-h`,`${g.startH+k}px`)}function f(m){let g=s.current;if(!g||m.pointerId!==g.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let P=e.getBoundingClientRect();o({width:Math.round(P.width),height:Math.round(P.height)}),s.current=null}return l("div",{class:d,role:"separator","aria-orientation":"vertical","aria-label":i.resizeHandle,title:i.resizeHandle,onPointerDown:_,onPointerMove:p,onPointerUp:f,onPointerCancel:f,"data-testid":A.resizeGrip,children:l(_d,{})})}var Pn=T.cssPrefix,cg=`.${Pn}-header, .${Pn}-back-header, .${Pn}-home-hero`,dg='button, a, input, textarea, select, [role="tab"], [contenteditable]',Dd=56;function oa(e,t){D(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,u){return Math.min(u,Math.max(-u,c))}let o=null,i=c=>{let u=c.target;if(!(u instanceof Element)||!u.closest(cg)||u.closest(dg))return;let d=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Pn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Pn}-modal-dy`)),maxX:(window.innerWidth+d.width)/2-Dd,maxY:(window.innerHeight+d.height)/2-Dd},e.dataset.dragging="true",c.preventDefault()},a=c=>{if(!o||c.pointerId!==o.id)return;let u=r(o.dx+c.clientX-o.x,o.maxX),d=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${Pn}-modal-dx`,`${u}px`),e.style.setProperty(`--${Pn}-modal-dy`,`${d}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",i),window.addEventListener("pointermove",a),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",i),window.removeEventListener("pointermove",a),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function Vn(e,t,n){switch(e){case"clear":case"sound":case"history":case"language":case"theme":case"textSize":return!0;case"popOut":return t!=="standalone"&&t!=="page";case"expand":return t==="floating";case"fullscreen":return t!=="standalone";case"close":return t==="standalone"||t==="page"?!1:t==="inline"?n==="fullscreen":!0}}function aa(e,t,n){return Vn("close",e,t)?n.includes("close"):!1}function Bd(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}var ug='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function ia(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(ug)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],i=r[r.length-1];if(!o||!i)return;let a=e.getRootNode().activeElement;n.shiftKey&&a===o?(n.preventDefault(),i.focus()):!n.shiftKey&&a===i&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}function sa(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Zi=T.cssPrefix;function Fd({agent:e,strings:t}){let n=e.status??"online",r=_t(t,e.name),o=e.title?_t(t,e.title):null;return l("div",{class:`${Zi}-agent`,children:[l("div",{class:`${Zi}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:sa(r)})}),l("div",{class:`${Zi}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var Ud=le.scope("attachments");function la(e,t,n){let r=_g(e),o=[],i=[],a=gg(n.accept),s=t.reduce((u,d)=>u+d.size,0),c=t.length;for(let u of r){let d=pg(u,c,s,n,a);if(d){i.push({file:u,reason:d});continue}o.push(mg(u)),s+=u.size,c+=1}return(o.length||i.length)&&Ud.debug("ingest",{accepted:o.length,rejected:i.map(u=>({name:u.file.name,reason:u.reason}))}),{accepted:o,rejected:i}}function jn(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){Ud.debug("revokeObjectURL failed",{error:t})}}function pg(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":vg(e,o)?null:"mime"}function _g(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:fg(t)).filter(t=>t!==null):[]}function fg(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function mg(e){return{file:e,id:vt(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function gg(e){return e.split(",").map(t=>t.trim().toLowerCase()).filter(Boolean).map(t=>{if(t.startsWith("."))return{kind:"ext",ext:t};let[n="*",r="*"]=t.split("/");return{kind:"mime",type:n,subtype:r}})}function vg(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(i=>i.kind==="ext"?o.endsWith(i.ext):(i.type==="*"||i.type===n)&&(i.subtype==="*"||i.subtype===r))}var Nr=T.cssPrefix;function zd({attachment:e,onRemove:t,disabled:n=!1}){let r=e.mediaType.startsWith("image/");return l("span",{class:`${Nr}-attachment-chip`,title:e.name,"data-testid":it(A.attachmentChip,e.id),children:[r?l("img",{class:`${Nr}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${Nr}-attachment-thumb`,"aria-hidden":"true",children:l(xd,{})}),l("span",{class:`${Nr}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${Nr}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":it(A.attachmentRemove,e.id),children:l(It,{})})]})}var es={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function ts(e,t,n){return e==="disabled"?es:e==="server"?Pg(n):hg(t)}function hg(e){let t=bg();if(!t)return es;let n=null,r=0;return{isSupported:!0,start(o,i){let a=n,s=++r;n=null,a?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let u=!1;c.addEventListener("result",_=>{if(r!==s||n!==c)return;let p=_,f="",m=!1;for(let g=p.resultIndex;g<p.results.length;g++){let P=p.results[g];P&&(f+=P[0].transcript,P.isFinal&&(m=!0))}o(f,m)});function d(){u||r!==s||n!==c||(u=!0,n=null,i())}c.addEventListener("end",d),c.addEventListener("error",d);try{c.start()}catch{d()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function bg(){return window.SpeechRecognition??window.webkitSpeechRecognition}var yg=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Pg(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return es;let t=0,n=null;function r(a){for(let s of a.stream?.getTracks()??[])s.stop();a.stream=null}function o(){t++;let a=n;n=null,a&&(r(a),a.recorder?.state!=="inactive"&&a.recorder?.stop())}async function i(a){if(a.finishing)return;a.finishing=!0;let s=a.recorder?.mimeType??"audio/webm";r(a);let c=new Blob(a.chunks,{type:s});a.chunks=[];try{let{text:u}=await e(c,s);n===a&&t===a.generation&&u&&a.onText(u,!0)}catch{}finally{n===a&&t===a.generation&&(n=null,a.onEnd())}}return{isSupported:!0,async start(a,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:a,onEnd:s,finishing:!1};n=c;try{let u=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let p of u.getTracks())p.stop();return}c.stream=u;let d=xg(),_=new MediaRecorder(u,d?{mimeType:d}:void 0);c.recorder=_,_.addEventListener("dataavailable",p=>{n===c&&t===c.generation&&p.data.size>0&&c.chunks.push(p.data)}),_.addEventListener("stop",()=>{n===c&&t===c.generation&&i(c)}),_.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let a=n;if(a){if(!a.recorder){o();return}a.recorder.state!=="inactive"&&a.recorder.stop()}},cancel(){o()}}}function xg(){for(let e of yg)if(MediaRecorder.isTypeSupported(e))return e}var Xe=T.cssPrefix,Wn=le.scope("composer");function Gn(e){return e.reduce((t,n)=>t+n.size,0)}var Sg={arrowUp:rd,paperPlane:nd,send:od,chevron:Hn};function qd(e){return"activeElement"in e}function kg(e){return"host"in e&&"activeElement"in e}function Hd({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:i,isStreaming:a,isMemoryCompacting:s=!1,canReleaseQueuedMessages:c=!0,queueManualMessages:u=!1,active:d=!0,isPreparing:_=!1,operatorRequestEnabled:p,canRequestOperator:f=!1,controlMode:m="ai-agent",onRequestOperator:g,onSend:P,onStop:k,apiRef:S}){let h=e.strings,[b,y]=H(()=>o.loadDraft(i)),[C,E]=H([]),[Y,j]=H(()=>o.loadMessageQueue(i).map(M=>({id:M.id,text:M.text,attachments:[]}))),O=$(Y),B=$(!1),[z,F]=H(!1),[Z,L]=H(!1),q=$(!1),R=$(null),ue=$(null),oe=$(null),$e=$(0),te=$(i);te.current=i;let se=$(d);se.current=d;let W=$(_);W.current=_;let ee=Z||_||!d,Be=a&&m==="ai-agent",he=Be||s&&m==="ai-agent",Se=m==="ai-agent"&&(he||u||Y.length>0),Ye=N(M=>{j(X=>{let J=M(X);return o.saveMessageQueue(te.current,J.filter(ge=>ge.attachments.length===0).map(({id:ge,text:rt})=>({id:ge,text:rt}))),O.current=J,J})},[o]),Ae=N(M=>{Ye(X=>(X.find(J=>J.id===M)?.attachments.forEach(jn),X.filter(J=>J.id!==M)))},[Ye]),Pe=N(M=>{y(X=>{let J=typeof M=="function"?M(X):M;return J===X?X:(o.saveDraft(te.current,J),J)})},[o]),Fe=e.features.fileUpload,pe=e.features.voice,[Re,je]=H(()=>ts(pe,e.locale,(M,X)=>t.transcribe(M,X))),Oe=$(Re);Oe.current=Re;let dt=$({mode:pe,locale:e.locale,transport:t});D(()=>{let M=dt.current;M.mode===pe&&M.locale===e.locale&&M.transport===t||(dt.current={mode:pe,locale:e.locale,transport:t},$e.current++,Oe.current.cancel(),oe.current=null,F(!1),je(ts(pe,e.locale,(X,J)=>t.transcribe(X,J))))},[e.locale,pe,t]),Pt(()=>()=>{$e.current++,Re.cancel()},[Re]);let St=N(M=>{let X=oe.current;if(X===null)return!1;let J=Math.round(performance.now()-X);return Wn[M]("voiceStop",{durationMs:J}),r.emit("voiceStop",{durationMs:J}),oe.current=null,!0},[r]),v=N(()=>{oe.current!==null&&(Re.stop(),F(!1),St("info")&&n.play("voiceStop"))},[St,n,Re]),U=N(()=>{$e.current++,Re.cancel(),F(!1),St("info")&&n.play("voiceStop")},[St,n,Re]);D(()=>{(_||!d)&&U()},[d,U,_]),D(()=>{let M=R.current;if(!M)return;let X=M.getRootNode(),J=qd(X)?X.activeElement:null;J&&M.closest(`.${Xe}-panel`)?.contains(J)||M.focus({preventScroll:!0})},[]),D(()=>{let M=R.current;if(!M)return;if(b.length===0){M.style.height="";return}M.style.height="auto";let X=getComputedStyle(M),J=Number.parseFloat(X.getPropertyValue(`--${Xe}-textarea-base-height`)),ge=Number.parseFloat(X.borderTopWidth)+Number.parseFloat(X.borderBottomWidth),rt=Math.min(M.scrollHeight+ge,Number.parseFloat(X.maxHeight)),kt=Number.parseFloat(X.fontSize)*.7;M.style.height=`${rt<J+kt?J:rt}px`},[b]);let Q=$(C);Q.current=C,D(()=>()=>{Q.current.forEach(jn);for(let M of O.current)M.attachments.forEach(jn)},[]),D(()=>{if(S)return S.current={attachFromDrop:M=>{if(!Fe||!se.current||q.current||W.current)return;let X=la(M,Q.current,e.attachments);X.accepted.length!==0&&(Wn.info("attach (drop)",{count:X.accepted.length,totalBytes:Gn(X.accepted)}),r.emit("attach",{count:X.accepted.length,totalBytes:Gn(X.accepted)}),E(J=>[...J,...X.accepted]))},fill:M=>{if(!se.current||q.current||W.current)return;Pe(M);let X=R.current;X&&(X.focus({preventScroll:!0}),requestAnimationFrame(()=>X.setSelectionRange(X.value.length,X.value.length)))},acceptQueuedMessage:Ae},()=>{S.current&&(S.current=null)}},[S,Fe,_,e.attachments,Ae,Pe]),D(()=>{let M=R.current;if(!M)return;let X=M.closest(`.${Xe}-panel`);if(!X)return;let J=ge=>{if(!se.current||q.current||W.current)return;let rt=ge.clipboardData;if(!rt)return;let kt=ge.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(kt&&kt!==M)return;if(Fe){let ut=la(rt.items,Q.current,e.attachments);if(ut.accepted.length>0){ge.preventDefault(),Wn.info("attach (paste)",{count:ut.accepted.length,totalBytes:Gn(ut.accepted)}),r.emit("attach",{count:ut.accepted.length,totalBytes:Gn(ut.accepted)}),E(sn=>[...sn,...ut.accepted]);return}}if(kt===M)return;let Mt=rt.getData("text/plain");Mt&&(ge.preventDefault(),Pe(ut=>ut+Mt),M.focus())};return X.addEventListener("paste",J),()=>X.removeEventListener("paste",J)},[Fe,e.attachments,Pe]);async function ne(){let M=b.trim();if(!M&&C.length===0||!d||Be||q.current||_)return;U(),q.current=!0,L(!0);let X=b,J=C;try{await P(M,J)&&(Pe(ge=>ge===X?"":ge),E(ge=>ge!==J?ge:(J.forEach(jn),Q.current=[],[])))}finally{q.current=!1,L(!1),requestAnimationFrame(()=>{let ge=R.current;if(!ge||ge.disabled||!se.current)return;let rt=ge.getRootNode(),kt=qd(rt)?rt.activeElement:null,Mt=kt?.getAttribute("data-testid");if(!(kt&&kt!==ge&&Mt!==A.composerSend&&Mt!==A.composerStop)){if(kg(rt)){let ut=rt.host.ownerDocument;if(!ut.hasFocus())return;let sn=ut.activeElement;if(sn&&sn!==rt.host&&sn!==ut.body)return}ge.focus({preventScroll:!0})}})}}function fe(){let M=b.trim();if(!M&&C.length===0||!d||!Se||q.current||_)return;U();let X=C;Ye(J=>[...J,{id:vt(),text:M,attachments:X}]),Pe(""),E(J=>J!==X?J:(Q.current=[],[])),R.current?.focus({preventScroll:!0})}D(()=>{he&&(B.current=!1)},[he]),D(()=>{let M=Y[0];if(!M||!c||he||B.current||Z||_||!d)return;let X=setTimeout(()=>{B.current=!0,P(M.text,M.attachments,M.id).then(J=>{if(J){Ae(M.id);return}B.current=!1})},300);return()=>clearTimeout(X)},[d,c,_,P,he,Y,Ae,Z]);function Ee(M){M.key!=="Enter"||M.shiftKey||M.isComposing||(M.preventDefault(),Se&&(b.trim()||C.length>0)?fe():Be?k():ne())}function Me(M){let X=M.target;if(!d||q.current||_){X.value="";return}let J=la(X.files,C,e.attachments);J.accepted.length>0&&(Wn.info("attach (file picker)",{count:J.accepted.length,totalBytes:Gn(J.accepted)}),r.emit("attach",{count:J.accepted.length,totalBytes:Gn(J.accepted)}),E(ge=>[...ge,...J.accepted])),X.value=""}function ke(M){!d||q.current||_||(Wn.info("removeAttachment",{id:M}),r.emit("removeAttachment",{id:M}),E(X=>{let J=X.find(ge=>ge.id===M);return J&&jn(J),X.filter(ge=>ge.id!==M)}))}function nt(){if(z){v();return}if(!d||!Re.isSupported||q.current||_)return;let M=++$e.current;oe.current=performance.now(),Wn.info("voiceStart"),r.emit("voiceStart",void 0),F(!0),n.play("voiceStart"),Re.start((X,J)=>{$e.current!==M||!se.current||W.current||q.current||!J||Pe(ge=>`${ge}${X} `)},()=>{$e.current!==M||!se.current||(F(!1),St("debug"))})}let me=Sg[e.composer.sendButton.icon],lt=!!(b.trim()||C.length>0);return l("div",{class:`${Xe}-composer`,"data-testid":A.composer,children:[Y.length>0?l("div",{class:`${Xe}-message-queue`,"aria-label":h.queueMessage,"data-testid":A.messageQueue,children:Y.map(M=>l("div",{class:`${Xe}-attachment-chip ${Xe}-queued-message`,"data-testid":`${A.queuedMessage}-${M.id}`,children:[l("span",{class:`${Xe}-attachment-name ${Xe}-queued-text`,children:M.text||M.attachments.map(X=>X.name).join(", ")}),l("button",{type:"button",class:`${Xe}-attachment-remove`,onClick:()=>Ae(M.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${A.queuedMessageRemove}-${M.id}`,children:l(It,{})})]},M.id))}):null,C.length>0?l("div",{class:`${Xe}-attachments`,children:C.map(M=>l(zd,{attachment:M,onRemove:()=>ke(M.id),disabled:ee},M.id))}):null,l("div",{class:`${Xe}-composer-row`,children:[l("div",{class:`${Xe}-composer-actions`,children:[Fe?l("button",{type:"button",class:`${Xe}-icon-btn`,onClick:()=>ue.current?.click(),disabled:ee,"aria-label":h.attach,"data-testid":A.composerAttach,children:l(id,{})}):null,Re.isSupported?l("button",{type:"button",class:`${Xe}-icon-btn`,onClick:nt,disabled:ee,"aria-label":z?h.micStop:h.micStart,"aria-pressed":z,"data-recording":z?"true":void 0,"data-testid":A.composerVoice,children:l(sd,{})}):null]}),l("textarea",{ref:R,name:"message",class:`${Xe}-textarea`,rows:1,value:b,placeholder:h.composerPlaceholder,onInput:M=>Pe(M.currentTarget.value),onKeyDown:Ee,disabled:ee,"aria-label":h.composerPlaceholder,"data-testid":A.composerInput}),Se&<?l("button",{type:"button",class:`${Xe}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:fe,disabled:ee,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":A.composerSend,children:l(me,{})}):null,Be?l("button",{type:"button",class:`${Xe}-send`,onClick:k,disabled:ee,"aria-label":h.stop,"data-testid":A.composerStop,children:l(ad,{})}):null,!Be&&(!Se||!lt)?l("button",{type:"button",class:`${Xe}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ne()},disabled:ee||!b.trim()&&C.length===0,"aria-label":h.send,"data-testid":A.composerSend,children:l(me,{})}):null,p&&m==="ai-agent"&&g?l("button",{type:"button",class:`${Xe}-icon-btn`,onClick:g,disabled:ee||!f,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":A.operatorRequest,children:l(Xi,{})}):null]}),l("input",{ref:ue,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:Me,disabled:ee,class:`${Xe}-sr-only`,"data-testid":A.composerFileInput})]})}var wg=T.cssPrefix;function Vd({visible:e,strings:t}){return e?l("div",{class:`${wg}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}function ca({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=H(!1);return D(()=>{if(n){o(!1);return}let i=e.current;if(!i)return;let a=0;function s(_){a+=1,_.dataTransfer?.types.includes("Files")&&(_.preventDefault(),o(!0))}function c(){a-=1,!(a>0)&&(a=0,o(!1))}function u(_){_.dataTransfer?.types.includes("Files")&&_.preventDefault()}function d(_){a=0,o(!1),_.dataTransfer&&(_.preventDefault(),t(_.dataTransfer.items))}return i.addEventListener("dragenter",s),i.addEventListener("dragleave",c),i.addEventListener("dragover",u),i.addEventListener("drop",d),()=>{i.removeEventListener("dragenter",s),i.removeEventListener("dragleave",c),i.removeEventListener("dragover",u),i.removeEventListener("drop",d)}},[e,n,t]),{visible:n?!1:r}}function jd({itemCount:e,initialFocusIndex:t}){let[n,r]=H(!1),o=$(null),i=$(null),[a,s]=H(-1),c=N(()=>{r(!1),s(-1),o.current?.focus()},[]),u=N(()=>r(p=>!p),[]);D(()=>{if(!n)return;function p(f){let m=i.current,g=o.current;if(!m||!g)return;let P=f.composedPath();P.includes(m)||P.includes(g)||(r(!1),s(-1))}return document.addEventListener("click",p,!0),()=>document.removeEventListener("click",p,!0)},[n]),D(()=>{if(!n||e===0)return;let p=t?.()??0,f=p<0||p>=e?0:p;s(f)},[n,e,t]),D(()=>{if(!n||a<0)return;i.current?.querySelectorAll("[role='menuitem']")?.[a]?.focus()},[n,a]);let d=N(p=>{(p.key==="ArrowDown"||p.key==="Enter"||p.key===" ")&&(p.preventDefault(),r(!0))},[]),_=N(p=>{if(e!==0)switch(p.key){case"Escape":p.preventDefault(),c();return;case"ArrowDown":p.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":p.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":p.preventDefault(),s(0);return;case"End":p.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:a,triggerRef:o,menuRef:i,toggle:u,close:c,onTriggerKey:d,onMenuKey:_}}function Wd({items:e,triggerLabel:t}){let n=T.cssPrefix,r=jd({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function i(s,c){return s.onSelectValue?.(c)}function a(s,c){let u=c.segments;if(!u?.length)return;let d=Math.max(0,u.findIndex(p=>p.value===c.value)),_=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")_=(d+1)%u.length;else if(s.key==="ArrowLeft")_=(d-1+u.length)%u.length;else return;s.preventDefault(),s.stopPropagation(),i(c,u[_].value)}return l("div",{class:`${n}-menu-wrap`,children:[l("button",{ref:r.triggerRef,type:"button",class:`${n}-icon-btn`,"aria-label":t,"aria-haspopup":"menu","aria-expanded":r.open,title:t,onClick:r.toggle,onKeyDown:r.onTriggerKey,children:l(fd,{})}),r.open?l("div",{ref:r.menuRef,class:`${n}-menu`,role:"menu","aria-label":t,onKeyDown:r.onMenuKey,tabIndex:-1,children:e.map(s=>s.segments?l("div",{role:"menuitem",class:`${n}-menu-item ${n}-menu-item-segmented`,"aria-label":s.label,tabIndex:-1,onKeyDown:c=>a(c,s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),l("span",{class:`${n}-segmented`,role:"group","aria-label":s.label,children:s.segments.map(c=>{let u=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":u,class:`${n}-segment`,"data-on":u?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${A.langSegment}-${c.value}`,onClick:()=>i(s,c.value),children:c.label},c.value)})})]},s.id):l("button",{type:"button",role:"menuitem",class:`${n}-menu-item`,"aria-pressed":s.type==="switch"?s.on:void 0,disabled:s.disabled,onClick:()=>o(s),children:[s.icon?l("span",{class:`${n}-menu-icon`,children:s.icon}):null,l("span",{class:`${n}-menu-label`,children:s.label}),s.type==="switch"&&s.on?l("span",{class:`${n}-menu-check`,"aria-hidden":"true",children:l(bn,{})}):null]},s.id))}):null]})}var ns=T.cssPrefix;function Cg(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 Rg={normal:"large",large:"small",small:"normal"};function Ig(e){return e==="light"?l(Cd,{}):e==="dark"?l(Rd,{}):l(Id,{})}function Tg(e){return(e.split("-")[0]??e).toUpperCase()}function Ag(e,t){let n;try{n=new URL(e,window.location.href)}catch{return}if(!(n.protocol!=="http:"&&n.protocol!=="https:"))return t.conversationId&&n.searchParams.set("chat",t.conversationId),n.searchParams.set("widgetId",t.widgetId),t.publicKey&&n.searchParams.set("public_key",t.publicKey),n.searchParams.set("ai_agent_deployment_id",t.aiAgentDeploymentId),n.href}function Ot({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:i,onClear:a,onExpand:s,onFullscreen:c,onSoundToggle:u}=e,{onToggleHistory:d,onLocaleChange:_,onThemeChange:p,onTextSizeChange:f}=e,m=n.strings,g=n.mode,P=t==="chat",k=ht(()=>o.mutedSig.value).value,S=new Set(n.actions);function h(L){return S.has(L)}let b=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function y(L){return b?!1:Vn(L,g,r)}let C=n.themeMode,E={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark},Y=n.textSize,j={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},O=[];if(P&&h("clear")&&O.push({id:"clear",icon:l(Pd,{}),label:m.newConversation,onSelect:a}),h("expand")&&y("expand")){let L=r==="expanded";O.push({id:"expand",icon:L?l(cd,{}):l(ld,{}),label:L?m.collapse:m.expand,type:"switch",on:L,onSelect:s})}if(h("fullscreen")&&y("fullscreen")){let L=r==="fullscreen";O.push({id:"fullscreen",icon:L?l(ud,{}):l(dd,{}),label:L?m.exitFullscreen:m.fullscreen,type:"switch",on:L,onSelect:c})}let B=n.popOutUrl,z=n.aiAgentDeploymentId;h("popOut")&&B&&z&&Vn("popOut",g,r)&&O.push({id:"popOut",icon:l(pd,{}),label:m.popOut,onSelect:()=>{let L=Ag(B,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:z});L&&window.open(L,"_blank","noopener,noreferrer")}}),P&&h("sound")&&O.push({id:"sound",icon:k?l(gd,{}):l(md,{}),label:k?m.soundOff:m.soundOn,type:"switch",on:!k,onSelect:u}),h("theme")&&O.push({id:"theme",icon:Ig(C),label:`${m.theme}: ${E[C]}`,onSelect:()=>p(Cg(C)),keepOpen:!0}),h("textSize")&&O.push({id:"textSize",icon:l(vd,{}),label:`${m.textSize}: ${j[Y]}`,onSelect:()=>f(Rg[Y]),keepOpen:!0}),h("language")&&n.availableLocales.length>1&&O.push({id:"language",icon:l(yd,{}),label:m.language,segments:n.availableLocales.map(L=>({value:L,label:Tg(L),lang:L})),value:n.locale,onSelectValue:_});let F=!!i&&aa(g,r,n.actions),Z=P&&h("history");return l("div",{class:`${ns}-header-actions`,children:[Z?l("button",{type:"button",class:`${ns}-icon-btn`,onClick:d,"aria-label":m.history,title:m.history,"data-testid":A.actionHistory,children:l(bd,{})}):null,O.length>0?l(Wd,{items:O,triggerLabel:m.moreActions}):null,F?l("button",{type:"button",class:`${ns}-icon-btn`,onClick:i,"aria-label":m.close,title:m.close,"data-testid":A.actionClose,children:l(It,{})}):null]})}var Eg=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,Mg=/^https?:\/\/[^\s.]+\.[^\s]+$/i,Lg=/^[+]?[\d\s().-]{6,}$/;function Kn(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function Og(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function Ng(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let a=Og(t);return r&&a===0?n.formRequired:a===0?void 0:o?.minSelections!=null&&a<o.minSelections?Kn(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&a>o.maxSelections?Kn(n.formChooseAtMost,{max:o.maxSelections}):void 0}let i=typeof t=="string"?t.trim():"";if(!i)return r?n.formRequired:void 0;switch(e.type){case"email":if(!Eg.test(i))return n.formInvalidEmail;break;case"url":if(!Mg.test(i))return n.formInvalidUrl;break;case"tel":if(!Lg.test(i))return n.formInvalidTel;break;case"number":{let a=Number(i);if(!Number.isFinite(a))return n.formInvalidNumber;if(o?.min!=null&&a<o.min)return Kn(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&a>o.max)return Kn(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&i.length<o.minLength)return Kn(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&i.length>o.maxLength)return Kn(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(i))return n.formPatternMismatch}catch{}}function Gd(e,t,n){let r={};for(let o of e){let i=Ng(o,t[o.name],n);i&&(r[o.name]=i)}return r}function Kd(e){let t={};for(let[n,r]of Object.entries(e)){let o=Array.isArray(r)?r.join(", "):r;o.trim()&&(t[n]=o.trim())}return t}var Ue=T.cssPrefix,da="__other__";function $r({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:i,footerHint:a,submitOnEnter:s,disabled:c,initialValues:u,hideActions:d,fieldTypeLabels:_,rootTestId:p,submitTestId:f,skipTestId:m}){let[g,P]=H(()=>({...Fg(e),...u})),[k,S]=H({}),[h,b]=H({});function y(O){h[O]&&b(B=>({...B,[O]:""}))}function C(O,B){P(z=>({...z,[O]:B})),y(O)}function E(O,B){S(z=>({...z,[O]:B})),y(O)}function Y(O){if(O.preventDefault(),c)return;let B=Ug(e,g,k),z=Gd(e,B,t);if(Object.keys(z).length>0){b(z);return}r(Kd(B))}function j(O){!s||O.key!=="Enter"||O.shiftKey||O.isComposing||!O.target||!("tagName"in O.target)||O.target.tagName!=="TEXTAREA"||Y(O)}return l("form",{class:`${Ue}-form`,onSubmit:Y,onKeyDown:j,"data-testid":p,noValidate:!0,children:[e.map(O=>l($g,{field:O,value:g[O.name],otherText:k[O.name]??"",error:h[O.name],disabled:c,typeLabel:_?.[O.name],strings:t,onChange:B=>C(O.name,B),onOtherChange:B=>E(O.name,B)},O.name)),d?null:l("div",{class:`${Ue}-form-actions`,children:[a?l("span",{class:`${Ue}-form-hint`,children:a}):null,o&&i?l("button",{type:"button",class:`${Ue}-form-skip`,onClick:i,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ue}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function $g({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:i,strings:a,onChange:s,onOtherChange:c}){let u=it(A.formField,e.name),d=Dg({field:e,value:t,otherText:n,disabled:o,strings:a,onChange:s,onOtherChange:c,fieldTid:u});return l("label",{class:`${Ue}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ue}-field-head`,children:[l("span",{class:`${Ue}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ue}-field-req`,"aria-hidden":"true",children:" *"}):null]}),i?l("span",{class:`${Ue}-field-type`,children:i}):null]}),d,e.validationHint&&!r?l("span",{class:`${Ue}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ue}-field-error`,role:"alert",children:r}):null]})}function Dg(e){let{field:t,value:n,otherText:r,disabled:o,strings:i,onChange:a,onOtherChange:s,fieldTid:c}=e,u=typeof n=="string"?n:"";switch(t.type){case"textarea":return l("textarea",{class:`${Ue}-field-input`,rows:3,value:u,placeholder:t.placeholder,disabled:o,onInput:_=>a(_.currentTarget.value),"data-testid":c});case"select":return l("select",{class:`${Ue}-field-input`,value:u,disabled:o,onChange:_=>a(_.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(_=>l("option",{value:_.value,children:_.label??_.value},_.value))]});case"radio":{let _=t.allowOther&&u===da;return l("div",{class:`${Ue}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(p=>l("label",{class:`${Ue}-choice`,children:[l("input",{type:"radio",name:`${Ue}-${t.name}`,checked:u===p.value,disabled:o,onChange:()=>a(p.value)}),l("span",{children:p.label??p.value})]},p.value)),t.allowOther?l("label",{class:`${Ue}-choice`,children:[l("input",{type:"radio",name:`${Ue}-${t.name}`,checked:u===da,disabled:o,onChange:()=>a(da)}),l("span",{children:i.formOther})]}):null,_?l("input",{class:`${Ue}-field-input`,value:r,placeholder:t.placeholder??i.formOtherPlaceholder,disabled:o,onInput:p=>s(p.currentTarget.value)}):null]})}case"checkbox":return l("label",{class:`${Ue}-choice`,children:[l("input",{type:"checkbox",checked:u==="true",disabled:o,onChange:_=>a(_.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let p=function(f,m){return a(m?[..._,f]:_.filter(g=>g!==f))};var d=p;let _=Array.isArray(n)?n:[];return l("div",{class:`${Ue}-field-choices`,"data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ue}-choice`,children:[l("input",{type:"checkbox",checked:_.includes(f.value),disabled:o,onChange:m=>p(f.value,m.currentTarget.checked)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ue}-field-input`,rows:2,value:r,placeholder:t.placeholder??i.formOtherPlaceholder,disabled:o,onInput:f=>s(f.currentTarget.value)}):null]})}default:return l("input",{...Bg(t.type),class:`${Ue}-field-input`,value:u,placeholder:t.placeholder,disabled:o,onInput:_=>a(_.currentTarget.value),"data-testid":c})}}function Bg(e){switch(e){case"number":return{type:e};case"email":return{type:e};case"tel":return{type:e};case"url":return{type:e};case"date":case"time":return{type:e};default:return{type:"text"}}}function Fg(e){let t={};for(let n of e)n.defaultValue!=null&&(t[n.name]=n.type==="multiselect"?n.defaultValue.split(",").map(r=>r.trim()).filter(Boolean):n.defaultValue);return t}function Ug(e,t,n){let r={...t};for(let o of e){let i=n[o.name]?.trim();if(o.type==="radio"&&o.allowOther&&t[o.name]===da)r[o.name]=i??"";else if(o.type==="multiselect"&&i){let a=i.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...a]}}return r}var Nt=T.cssPrefix;function rs({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Nt}-form-gate`,"data-testid":A.formGate,children:[e.title?l("h3",{class:`${Nt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Nt}-form-gate-desc`,children:e.description}):null,l($r,{fields:e.fields,strings:t,submitLabel:e.submitLabel??t.formSubmit,onSubmit:n,skipLabel:e.skippable?t.formSkip:void 0,onSkip:e.skippable?r:void 0,submitTestId:A.formSubmit,skipTestId:A.formSkip})]})}function Qd({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,i=e.title?l(we,{children:[l("span",{children:e.title}),l("span",{class:`${Nt}-sr-only`,children:o})]}):l("span",{children:o}),a=e.form?.reviewable??!1,s=!r&&a&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let u=function(d){return e.form?.fields.find(_=>_.name===d)?.label??d};var c=u;return l("details",{class:`${Nt}-form-done`,"data-outcome":e.outcome,"data-testid":A.formDone,children:[l("summary",{class:`${Nt}-form-done-summary`,"data-testid":A.formDoneToggle,children:[l(bn,{}),i,l(Hn,{})]}),l("dl",{class:`${Nt}-form-answers`,"data-testid":A.formAnswers,children:Object.entries(s).map(([d,_])=>l("div",{class:`${Nt}-form-answer`,children:[l("dt",{children:u(d)}),l("dd",{children:_})]},d))})]})}return l("div",{class:`${Nt}-form-done`,"data-outcome":e.outcome,"data-testid":A.formDone,role:"status",children:[r?l(hd,{}):l(bn,{}),i,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Nt}-form-done-fill`,"data-testid":A.formFill,onClick:n,children:t.formFillOut}):null]})}var Yd=Object.assign;function Hg(e,t){for(var n in e)if(n!="__source"&&e[n]!==t[n])return!0;for(var r in t)if(r!="__source"&&!(r in e))return!0;return!1}var Vg=/^(-|f[lo].*[^se]$|g.{5,}[^ps]$|z|o[pr]|(W.{5})?[lL]i.*(t|mp)$|an|(bo|s).{4}Im|sca|m.{6}[ds]|ta|c.*[st]$|wido|ini)/;function Zd(e,t){function n(o){var i=this.props.ref;return i!=o.ref&&i&&(typeof i=="function"?i(null):i.current=null),t?!t(this.props,o)||i!=o.ref:Hg(this.props,o)}function r(o){return this.shouldComponentUpdate=n,An(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var jg=Symbol.for("react.element"),Wg=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(?!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,Gg=/[A-Z0-9]/g,Kg=typeof document<"u";var Qg=function(e){return/fil|che|rad/.test(e)};Ct.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Ct.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Xd=be.event;be.event=function(e){return Xd&&(e=Xd(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var Yg={configurable:!0,get:function(){return this.class}},Jd=be.vnode;be.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,i=r.type,a={},s=i.indexOf("-")==-1;for(var c in o){var u=o[c];if(!(c=="value"&&"defaultValue"in o&&u==null||Kg&&c=="children"&&i=="noscript"||c=="class"||c=="className")){if(c=="style"&&typeof u=="object"){var d=void 0;for(var _ in u)typeof u[_]!="number"||Vg.test(_)||(d||(d=u=Yd({},u)),u[_]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&u===!0)u="";else if(c=="translate"&&u==="no")u=!1;else if(c[0]=="o"&&c[1]=="n"){var p=c.toLowerCase();p=="ondoubleclick"?c="ondblclick":p!="onchange"||i!="input"&&i!="textarea"||Qg(o.type)?p=="onfocus"?c="onfocusin":p=="onblur"&&(c="onfocusout"):p=c="oninput",p=="oninput"&&a[c=p]&&(c="oninputCapture")}else s&&Wg.test(c)?c=c.replace(Gg,"-$&").toLowerCase():u===null&&(u=void 0);a[c]=u}}i=="select"&&(a.multiple&&Array.isArray(a.value)&&(a.value=oo(o.children).forEach(function(f){f.props.selected=a.value.indexOf(f.props.value)!=-1})),a.defaultValue!=null&&(a.value=oo(o.children).forEach(function(f){f.props.selected=a.multiple?a.defaultValue.indexOf(f.props.value)!=-1:a.defaultValue==f.props.value}))),o.class&&!o.className?(a.class=o.class,Object.defineProperty(a,"className",Yg)):o.className&&(a.class=a.className=o.className),r.props=a})(e);else if(typeof e.type=="function"&&("ref"in e.props&&"prototype"in e.type&&e.type.prototype.render&&(e.ref=e.props.ref,delete e.props.ref),e.type.defaultProps)){var t=Yd({},e.props);for(var n in e.type.defaultProps)t[n]===void 0&&(t[n]=e.type.defaultProps[n]);e.props=t}e.ref&&!("ref"in e.props)&&Object.defineProperty(e.props,"ref",{value:e.ref,configurable:!0,writable:!0}),e.$$typeof=jg,Jd&&Jd(e)};function ua(e){return e?(e.startsWith("tool:")?e.slice(5):e)==="ask-user-questions":!1}var Tt=T.cssPrefix;function as(e){return e.startsWith("tool:")||e.startsWith("tool-")?e.slice(5):e}function pa(e,t){let n=e==="output-available"||e==="output-error"||e==="output-denied",r=e==="approval-responded"||t?.approved!==void 0;return{terminal:n,responded:r,decided:n||r}}function is({status:e,icon:t,label:n}){return l("span",{class:`${Tt}-toolui-badge ${Tt}-toolui-status`,"data-status":e,children:[l("span",{class:`${Tt}-toolui-status-icon`,children:t}),n]})}function Xg(e,t){return e==="output-error"?"error":e==="output-denied"||t?.approved===!1?"denied":e==="output-available"?"completed":e==="approval-responded"||t?.approved===!0?"responded":e==="approval-requested"?"awaiting":"running"}function ss(e,t,n={}){return n.submitted?"responded":ev(Xg(e,t),n.superseded,n.live??!0)}function Jg({status:e}){return e==="denied"||e==="error"||e==="superseded"?l(ta,{}):e==="completed"||e==="responded"?l(ea,{}):l(Ld,{})}function Zg(e,t){switch(e){case"awaiting":return t.statusAwaiting;case"responded":return t.statusResponded;case"completed":return t.statusCompleted;case"denied":return t.statusDenied;case"error":return t.statusError;case"superseded":return t.statusSuperseded;default:return t.statusRunning}}function ev(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function tv({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:i=!1}){let a=ss(e,t,{superseded:r,live:o,submitted:i});return l(is,{status:a,icon:l(Jg,{status:a}),label:Zg(a,n)})}function nv({name:e,state:t,approval:n,strings:r,superseded:o,live:i,submitted:a}){return l(we,{children:[l("span",{class:`${Tt}-toolui-name-pill`,children:[l(Md,{}),l("span",{class:`${Tt}-toolui-name-text`,children:e})]}),l(tv,{state:t,approval:n,strings:r,superseded:o,live:i,submitted:a}),l("span",{class:`${Tt}-toolui-chevron`,children:l(yn,{})})]})}function _a({part:e,strings:t,testid:n,superseded:r,live:o,submitted:i}){let a=de(()=>Ce(()=>e.inputSig.value),[e]),s=de(()=>Ce(()=>e.outputSig.value),[e]),c=de(()=>Ce(()=>e.errorSig.value),[e]),u=de(()=>Ce(()=>e.stateSig.value),[e]),d=de(()=>Ce(()=>e.approvalSig.value),[e]);return l("details",{class:`${Tt}-toolui ${Tt}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${Tt}-toolui-head`,children:l(nv,{name:as(e.toolName),state:u.value,approval:d.value,strings:t,superseded:r,live:o,submitted:i})}),l(os,{label:t.toolParameters,value:a.value}),s.value!==void 0?l(os,{label:t.toolResult,value:s.value}):null,c.value?l(os,{label:t.statusError,value:c.value,error:!0}):null]})}function os({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":fa(ls(t));return r?l("div",{class:`${Tt}-toolui-section`,children:[l("span",{class:`${Tt}-toolui-label`,children:e}),l("pre",{class:`${Tt}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function ls(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function fa(e){if(e==null)return"";try{let t=typeof e=="string"?e:JSON.stringify(e,null,2);return!t||t==="{}"||t==="[]"||t==='""'?"":t.length>800?`${t.slice(0,800)}\u2026`:t}catch{return""}}function eu(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function tu(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function rv(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function nu(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,i=e.responseMode==="buffered"&&t,a=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:i,reasoningVisible:n,working:a,showStreamDots:rv({streaming:t,bufferedHold:i,reasoningVisible:n,working:a}),emptyReply:r,hidden:o}}function ru(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:i,decided:a}=pa(n,r),s=t.continuationStreaming===!0&&!a,c=t.superseded&&!a&&!s;return{pill:ss(n,r,{superseded:c,live:t.live,submitted:s}),state:n,terminal:o,decided:a||s,showApproveReject:!a&&!t.superseded&&!s,showAnswered:i&&!o&&!c,showSubmitted:s,showEdit:i&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}function ma({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=ao}){let o=$(null);return Pt(()=>{let i=o.current;if(!i)return;i.classList.add(`${T.cssPrefix}-md`),i.replaceChildren();let a=n?zi(i,{cssPrefix:T.cssPrefix,strings:r}):void 0,s=yr(a??Pr(i)),c=0,u=Ut(()=>{let p=e.value,f=t.value;p.length<c&&(a?.dispose(),i.replaceChildren(),a=n?zi(i,{cssPrefix:T.cssPrefix,strings:r}):void 0,s=yr(a??Pr(i)),c=0);let m=p.slice(c);m&&et(s,m),c=p.length,f&&(Eo(s),a?.finish())}),d=new MutationObserver(p=>{for(let f of p)for(let m of f.addedNodes){if(!(m instanceof HTMLElement))continue;let g=m.matches?.("a")?[m]:[...m.querySelectorAll?.("a")??[]];for(let P of g)ou(P)}});d.observe(i,{childList:!0,subtree:!0});for(let p of i.querySelectorAll("a"))ou(p);function _(p){let f=p.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(p.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return i.addEventListener("click",_),()=>{u(),a?.dispose(),d.disconnect(),i.removeEventListener("click",_)}},[e,t,n,r]),l("div",{ref:o})}function au({text:e}){let t=de(()=>ie(e),[e]),n=de(()=>ie(!0),[]);return l(ma,{textSig:t,doneSig:n})}function ou(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 ga=T.cssPrefix;function iu({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,i]=H(t);D(()=>i(t),[e,t]);function a(s){let c=o===s?null:s;i(c),r(e,c)}return l("div",{class:`${ga}-feedback`,role:"group","data-testid":A.messageFeedback,children:[l("button",{type:"button",class:`${ga}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>a("up"),"data-testid":A.feedbackUp,children:l(Ad,{})}),l("button",{type:"button",class:`${ga}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>a("down"),"data-testid":A.feedbackDown,children:l(Ed,{})}),l("span",{class:`${ga}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var Qn=T.cssPrefix;function su({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${Qn}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":A.source,children:[l("span",{class:`${Qn}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${Qn}-source-label`,children:n})]}):l("span",{class:`${Qn}-source`,"data-testid":A.source,children:[l("span",{class:`${Qn}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${Qn}-source-label`,children:n})]})}var xt=T.cssPrefix;function lu({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:i,onEdit:a}){let s=de(()=>Ce(()=>e.approvalSig.value),[e]),c=de(()=>Ce(()=>ru(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:u,showApproveReject:d,showAnswered:_,showSubmitted:p,showEdit:f,skipped:m}=c,g=as(e.toolName),P=c.answeredApproved,k=e.toolCallId,S=l(we,{children:[l("p",{class:`${xt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",g)}),l("p",{class:`${xt}-toolui-subtle`,children:t.approvalBody})]});p?S=l("p",{class:`${xt}-toolui-subtle`,children:t.approvalSubmitting}):_&&P!==!1?S=l(we,{children:[l("p",{class:`${xt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",P?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${xt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${xt}-toolui-subtle`,children:t.approvalSubmitting})]}):_&&(S=l(we,{}));let h=d||p||f||_&&P!==!1;return l("div",{class:`${xt}-toolui-group`,"data-testid":c.decided?A.toolDecision:A.toolApproval,children:[l(_a,{part:e,strings:t,superseded:m,submitted:p}),m||u||!h?null:l("div",{class:`${xt}-toolui ${xt}-toolui-body`,children:[S,d?l("div",{class:`${xt}-toolui-actions`,children:[l("button",{type:"button",class:`${xt}-form-skip`,disabled:!n,onClick:()=>i(k,!1),"data-testid":A.toolReject,children:t.reject}),l("button",{type:"button",class:`${xt}-form-submit`,disabled:!n,onClick:()=>i(k,!0),"data-testid":A.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${xt}-toolui-actions`,children:l("button",{type:"button",class:`${xt}-form-skip`,onClick:()=>a(k),"data-testid":A.toolEdit,children:t.edit})}):null]})]})}var ov=["text","email","phone","number","date","single-select","multi-select","boolean"];function cu(e){return e!==null&&typeof e=="object"}function du(e){let t=cu(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(av).filter(o=>o!==null);return{intro:va(t.intro),questions:r}}function av(e,t){if(!cu(e))return null;let n=ov.find(r=>r===e.type)??"text";return{key:va(e.key)??`q${t+1}`,question:va(e.question)??"Please provide the missing information.",type:n,options:Array.isArray(e.options)?e.options.filter(r=>typeof r=="string"&&r.trim().length>0):void 0,required:typeof e.required=="boolean"?e.required:void 0,helpText:va(e.helpText)}}function iv(e){switch(e){case"text":return"textarea";case"phone":return"tel";case"single-select":case"boolean":return"radio";case"multi-select":return"multiselect";default:return e}}function cs(e,t,n){return e.questions.map(r=>{let o=iv(r.type),i=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(a=>({value:a,label:a}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:i.length>0?i:void 0,validationHint:r.helpText}})}function va(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Je=T.cssPrefix;function sv({skipped:e,submitted:t,strings:n}){return e?{status:"superseded",statusLabel:n.inputSkipped}:t?{status:"responded",statusLabel:n.statusResponded}:{status:"completed",statusLabel:n.inputAnswered}}var lv={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function uu(e,t){let n={};for(let r of e)n[r.key]=t[lv[r.type]];return n}function pu({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:i,onEdit:a}){let s=de(()=>Ce(()=>e.stateSig.value),[e]).value,c=de(()=>Ce(()=>e.approvalSig.value),[e]).value,u=de(()=>Ce(()=>du(e.inputSig.value)),[e]).value,{terminal:d,decided:_}=pa(s,c),p=_&&c?.approved===!0,f=o&&!_,m=!_&&!r&&!f,g=!m&&!p&&!f,P=p&&n&&!d,k=u.questions,[S,h]=H(null),y=S??(m||p||f),[C,E]=H(!1),Y=k.length>1?Qi:Lr,j=m?t.inputRequired:t.inputBadge,O=f?l("p",{class:`${Je}-toolui-subtle`,children:t.approvalSubmitting}):m?l(cv,{req:u,strings:t,active:n,resolve:(F,Z)=>i(e.toolCallId,Z,F)}):C?l($r,{fields:cs(u,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:uu(k,t),initialValues:p?fv(k,c?.reason):void 0}):l(dv,{questions:k,answers:p?_v(c?.reason):{},strings:t}),{status:B,statusLabel:z}=sv({skipped:g,submitted:f,strings:t});return l("details",{class:`${Je}-toolui ${Je}-toolui-collapsible${r?` ${Je}-toolui-stale`:""}`,open:y,onToggle:F=>{let Z=F.currentTarget.open;Z!==y&&h(Z)},"data-testid":m?A.toolAskQuestions:A.toolDecision,children:[l("summary",{class:`${Je}-toolui-head`,children:[l("span",{class:`${Je}-toolui-q-pill`,children:[l(Y,{}),j]}),l("span",{class:`${Je}-toolui-head-end`,children:[m?null:l(is,{status:B,icon:g?l(ta,{}):l(ea,{}),label:z}),l("span",{class:`${Je}-toolui-chevron`,children:l(yn,{})})]})]}),l("div",{class:`${Je}-toolui-collapse-body`,children:[u.intro?l("div",{class:`${Je}-toolui-desc`,children:u.intro}):null,O,m||f?null:l("div",{class:`${Je}-toolui-footer`,children:[l("button",{type:"button",class:`${Je}-toolui-options-toggle`,onClick:()=>E(F=>!F),"data-testid":A.toolAskOptions,children:[l("span",{class:`${Je}-toolui-options-chevron${C?` ${Je}-open`:""}`,children:l(yn,{})}),C?t.hideOptions:t.showOptions]}),P?l("button",{type:"button",class:`${Je}-form-skip`,onClick:()=>a(e.toolCallId),"data-testid":A.toolEdit,children:t.edit}):null]})]})]})}function cv({req:e,strings:t,active:n,resolve:r}){let o=cs(e,t.confirmYes,t.confirmNo),i=e.questions.length===1&&e.questions[0]?.type==="text";return l($r,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:i?t.inputSubmitHint:void 0,onSubmit:a=>r(pv(e.questions,a),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:i,fieldTypeLabels:uu(e.questions,t),submitTestId:A.toolInputSubmit,skipTestId:A.toolInputSkip})}function dv({questions:e,answers:t,strings:n}){return l("div",{class:`${Je}-toolui-summary`,"data-testid":A.toolAskSummary,children:e.map(r=>l("div",{class:`${Je}-field`,children:[l("span",{class:`${Je}-field-head`,children:l("span",{class:`${Je}-field-label`,children:[r.question,r.required?l("span",{class:`${Je}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Je}-toolui-answer`,children:uv(r,t[r.key],n)||"\u2014"})]},r.key))})}function uv(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function pv(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let i=r.type==="multi-select"?o.split(",").map(a=>a.trim()).filter(Boolean):o;return[{key:r.key,value:i}]});return JSON.stringify({answers:n})}function _u(e){if(!e)return{};let n=(()=>{try{return JSON.parse(e)}catch{return}})()?.answers;if(!Array.isArray(n))return{};let r={};for(let o of n)if(o&&typeof o=="object"&&"key"in o){let{key:i,value:a}=o;if(typeof i!="string")continue;typeof a=="string"?r[i]=a:Array.isArray(a)&&(r[i]=a.filter(s=>typeof s=="string"))}return r}function _v(e){let t=_u(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function fv(e,t){let n=_u(t),r={};for(let o of e){let i=n[o.key];i!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(i)?i:[i]:r[o.key]=Array.isArray(i)?i[0]??"":i)}return r}function fu({part:e,strings:t,live:n}){let r=de(()=>Ce(()=>e.inputSig.value),[e]),o=de(()=>Ce(()=>e.outputSig.value),[e]),i=de(()=>Ce(()=>e.errorSig.value),[e]);return de(()=>Ce(()=>!!fa(r.value)||!!i.value||!!fa(ls(o.value))),[r,o,i]).value?l(_a,{part:e,strings:t,testid:A.toolCall,live:n}):null}var st=T.cssPrefix,mu=Zd(mv);function mv({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:i,showSources:a,interactive:s=!1,superseded:c=!1,tool:u,onRetry:d,enableMessageFeedback:_=!1,onFeedback:p}){let m=de(()=>Ce(()=>e.partsSig.value),[e]).value,g=de(()=>Ce(()=>gn(e)),[e]),P=de(()=>Ce(()=>Kc(e)),[e]),k=de(()=>Ce(()=>eu(e)),[e]),S=de(()=>Ce(()=>o&&tu(e)),[e,o]),h=t==="streaming",b=e.role==="assistant"&&h,y=nu({streaming:b,responseMode:r,reasoningVisible:S.value,hasAnswerText:k.value,emptyReply:g.value,hidden:P.value}),{bufferedHold:C,working:E,showStreamDots:Y}=y;if(y.hidden)return null;let j=vv(e.createdAt),O=e.role==="assistant"||e.role==="operator",B=_&&!!p&&!!e.serverMessageId&&O&&!h&&t!=="error"&&!g.value,z=h?"":m.filter(L=>L.kind==="text").map(L=>e.role==="assistant"?jo(L.textSig.peek()):L.textSig.peek()).join(`
|
|
59
|
+
|
|
60
|
+
`).trim(),F=!h&&t!=="error"&&!g.value&&z.length>0,Z=B||F;return l("div",{class:`${st}-bubble-row`,"data-role":e.role,"data-testid":it(A.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${st}-bubble-col`,children:[l("div",{class:`${st}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${st}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${st}-bubble-body`,children:[C?l(Sv,{label:n.loading}):m.map((L,q)=>l(hv,{part:L,generativeUi:e.role==="assistant",active:E,live:b,strings:n,showReasoning:o,showToolCalls:i,showSources:a,interactive:s&&t==="complete"&&(L.kind!=="tool"||Go(e,q)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:u},`${Pv(L)}#${q}`)),Y&&l(xv,{}),t==="error"||g.value?l("div",{class:`${st}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),d?l("button",{type:"button",class:`${st}-error-retry`,onClick:()=>d(e),"data-testid":A.messageRetry,children:n.errorRetry}):null]}):null]})]}),j||Z?l("div",{class:`${st}-bubble-meta`,children:[j?l("time",{class:`${st}-bubble-time`,dateTime:j.iso,title:j.full,children:j.short}):null,Z?l("div",{class:`${st}-bubble-actions`,children:[B&&e.serverMessageId?l(iu,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:p}):null,F?l(gv,{text:z,strings:n}):null]}):null]}):null]})})}function gv({text:e,strings:t}){let[n,r]=H(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let i=n?t.copied:t.copy;return l("button",{type:"button",class:`${st}-msg-action`,"data-active":n?"true":void 0,"aria-label":i,title:i,onClick:o,"data-testid":A.messageCopy,children:n?l(bn,{}):l(Td,{})})}function vv(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 hv({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:i,showToolCalls:a,showSources:s,interactive:c,superseded:u,continuationStreaming:d,tool:_}){switch(e.kind){case"step-start":return null;case"text":return l(ma,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return i?l(yv,{part:e,active:n,strings:o}):null;case"tool":return l(bv,{part:e,strings:o,showToolCalls:a,interactive:c,superseded:u,continuationStreaming:d,live:r,tool:_});case"file":return e.mediaType.startsWith("image/")?l("img",{src:e.url,alt:"",loading:"lazy"}):l("a",{href:e.url,target:"_blank",rel:"noreferrer noopener",children:e.url});case"source":return s?l(su,{part:e,strings:o}):null}}function bv({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:i,live:a,tool:s}){let c=de(()=>Ce(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?ua(e.toolName)?l(pu,{part:e,strings:t,active:r,superseded:o,continuationStreaming:i,onDecision:s.onDecision,onEdit:s.onEdit}):l(lu,{part:e,strings:t,active:r,superseded:o,continuationStreaming:i,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(fu,{part:e,strings:t,live:a}):null}function yv({part:e,active:t,strings:n}){return l("details",{class:`${st}-reasoning`,"data-testid":A.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${st}-reasoning-summary`,children:l("span",{class:`${st}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${st}-reasoning-body`,children:l(ma,{textSig:e.textSig,doneSig:e.doneSig})})]})}function Pv(e){switch(e.kind){case"text":case"reasoning":case"step-start":return`${e.kind}:${e.id}`;case"tool":return`tool:${e.toolCallId}`;case"file":return`file:${e.url}`;case"source":return`source:${e.sourceId}`}}function xv(){return l("span",{class:`${st}-typing`,"data-testid":A.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function Sv({label:e}){return l("span",{class:`${st}-loading`,role:"status",children:[l("span",{class:`${st}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${st}-loading-label`,children:e})]})}var nn=T.cssPrefix,ds=120,kv=350;function gu({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:i,enableMessageFeedback:a,onFeedback:s,loading:c,onLoadPreviousMessages:u,idle:d,controlMode:_="ai-agent",tool:p,onRetry:f,form:m,formMarkers:g,onFillForm:P}){let k=$(null),S=ht(()=>e.value),[h,b]=H(!1),[y,C]=H(!1),E=$(!1),Y=$(!1),[j,O]=H(),B=$(!1),z=$(!1),F=$(!1),Z=$(0);function L(){return F.current||performance.now()-Z.current<kv}let q=$(0);function R(v){let U=v.scrollHeight-v.clientHeight>1;v.dataset.fadeTop=U&&v.scrollTop>1?"true":"false",v.dataset.fadeBottom=U&&v.scrollHeight-v.scrollTop-v.clientHeight>1?"true":"false"}function ue(v){return b(v.scrollHeight-v.scrollTop-v.clientHeight>ds*2)}function oe(v){q.current=performance.now(),v.scrollTop=v.scrollHeight,R(v)}function $e(v,U){oe(v);let Q=U,ne=0;function fe(){z.current||L()||(oe(v),--Q>0&&(ne=requestAnimationFrame(fe)))}return U>0&&(ne=requestAnimationFrame(fe)),()=>cancelAnimationFrame(ne)}function te(v,U){let Q,ne,fe,Ee=-1;function Me(){Q.disconnect(),ne.disconnect(),clearTimeout(fe)}function ke(){if(z.current||L()||Ee>=0&&v.scrollTop<Ee-4)return Me();oe(v),Ee=v.scrollTop}return Q=new ResizeObserver(ke),ne=new MutationObserver(ke),ke(),Q.observe(v),ne.observe(v,{childList:!0,subtree:!0,characterData:!0}),fe=setTimeout(Me,U),Me}let se=S.value[0]?.id;Pt(()=>{let v=k.current;if(v&&S.value.length!==0&&!Y.current&&(B.current=!0,!!S.value.some(U=>U.role==="user")))return te(v,300)},[se]);let W=$(0);D(()=>{let v=k.current,U=S.value,Q=W.current;if(W.current=U.length,!v||!B.current||Y.current)return;if(U.slice(Q).some(fe=>fe.role==="user"))return z.current=!1,$e(v,3);if(!U.some(fe=>fe.role==="user")||z.current||L())return;v.scrollHeight-v.scrollTop-v.clientHeight<ds&&oe(v)},[S.value.length]);let ee=$(null);D(()=>{let v=k.current,U=S.value.at(-1),Q=ee.current;if(ee.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!v&&B.current&&!(!U||U.id!==Q?.id||Q.streaming||U.status!=="streaming"))return z.current=!1,$e(v,3)},[S.value]),D(()=>{let v=k.current;if(!v)return;let U=S.value.at(-1);if(!U||U.status!=="streaming"&&!S.value.some(fe=>fe.role==="user"))return;let Q=()=>{if(z.current||L())return;v.scrollHeight-v.scrollTop-v.clientHeight<ds*2&&oe(v)};if(U.status!=="streaming")return te(v,300);Q();let ne=new MutationObserver(Q);return ne.observe(v,{childList:!0,subtree:!0,characterData:!0}),()=>ne.disconnect()},[S.value]);let Be=m?.form.id,xe=!!m&&(g??[]).some(v=>v.formId===m.form.id);Pt(()=>{let v=k.current;!v||!Be||z.current||S.value.some(U=>U.role==="user")&&(xe?v.querySelector(`[data-testid="${A.formGate}"]`)?.scrollIntoView({block:"nearest"}):oe(v))},[Be,xe]),D(()=>{let v=k.current;if(!v)return;let U=()=>{ue(v),R(v),performance.now()-q.current>150&&(z.current=v.scrollHeight-v.scrollTop-v.clientHeight>8)};function Q(){z.current=!0}function ne(me){me.deltaY<0&&Q()}let fe=0;function Ee(me){fe=me.touches[0]?.clientY??0,F.current=!0}function Me(me){(me.touches[0]?.clientY??0)>fe+4&&Q()}function ke(){F.current=!1,Z.current=performance.now()}function nt(){F.current=!0}return v.addEventListener("scroll",U,{passive:!0}),v.addEventListener("wheel",ne,{passive:!0}),v.addEventListener("touchstart",Ee,{passive:!0}),v.addEventListener("touchmove",Me,{passive:!0}),v.addEventListener("touchend",ke,{passive:!0}),v.addEventListener("touchcancel",ke,{passive:!0}),v.addEventListener("pointerdown",nt,{passive:!0}),window.addEventListener("pointerup",ke,{passive:!0}),window.addEventListener("pointercancel",ke,{passive:!0}),ue(v),()=>{v.removeEventListener("scroll",U),v.removeEventListener("wheel",ne),v.removeEventListener("touchstart",Ee),v.removeEventListener("touchmove",Me),v.removeEventListener("touchend",ke),v.removeEventListener("touchcancel",ke),v.removeEventListener("pointerdown",nt),window.removeEventListener("pointerup",ke),window.removeEventListener("pointercancel",ke)}},[]);function he(){let v=k.current;v&&(z.current=!1,oe(v))}let Se=S.value.filter(v=>!v.ephemeral),Ye=Se[0],Ae=Ye?.serverMessageId??Ye?.id,Pe=!!(u&&Se.length>=yi&&Ae!==j);async function Fe(){if(!u||E.current)return;let v=k.current,U=v?.scrollHeight??0,Q=v?.scrollTop??0;E.current=!0,Y.current=!0,C(!0);try{let ne=await u();ne===!1&&Ae&&O(Ae),ne&&v&&(await new Promise(fe=>requestAnimationFrame(()=>requestAnimationFrame(()=>fe()))),v.scrollTop=Q+v.scrollHeight-U,R(v),ue(v))}finally{Y.current=!1,E.current=!1,C(!1)}}let pe=[],Re="",je=S.value.at(-1)?.id,Oe=[...g??[]].toSorted((v,U)=>(v.createdAt??1/0)-(U.createdAt??1/0));function dt(v){return m&&v.formId===m.form.id?l(rs,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${v.formId}`):l(Qd,{marker:v,strings:t,onFill:!m&&P?()=>P(v.formId):void 0},v.key)}function St(v){for(let U=Oe[0];U?.createdAt!==void 0&&!(v!==void 0&&U.createdAt>v);U=Oe[0])Oe.shift(),pe.push(dt(U))}for(let v of S.value){if(v.role==="assistant"&&v.id!==je&&gn(v))continue;St(v.createdAt);let U=wv(v.createdAt);U&&U!==Re&&(pe.push(l("div",{class:`${nn}-date-divider`,children:l("span",{class:`${nn}-date-pill`,title:Cv(v.createdAt),children:Rv(v.createdAt,t)})},`day:${U}`)),Re=U);let ne=v.retryAction!==void 0||v.role==="assistant"&&v.id===je?Yo(S.value,v):void 0,fe=ne!==void 0&&(ne.kind!=="continue-assistant"||_==="ai-agent");pe.push(l(mu,{message:v,status:v.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:i,interactive:!!d&&_==="ai-agent"&&v.id===je,superseded:v.id!==je,tool:p,onRetry:d&&fe&&(v.role==="user"||v.id===je)?f:void 0,enableMessageFeedback:a,onFeedback:s},v.id))}for(let v of Oe)pe.push(dt(v));return l("div",{class:`${nn}-list-wrap`,children:[l("div",{ref:k,class:`${nn}-list ${nn}-list--fade`,role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&S.value.length===0?l("div",{class:`${nn}-list-loading`,role:"status",children:t.conversationLoading}):null,Pe?l("div",{class:`${nn}-load-previous`,children:l("button",{type:"button",onClick:Fe,disabled:y,"aria-busy":y,"data-testid":A.loadPreviousMessages,children:t.loadPreviousMessages})}):null,pe,m&&!xe?l(rs,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),h?l("button",{type:"button",class:`${nn}-jump`,onClick:he,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":A.scrollToBottom,children:l(yn,{})}):null]})}function wv(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function Cv(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Rv(e,t){let n=new Date(e);function r(i){return new Date(i.getFullYear(),i.getMonth(),i.getDate()).getTime()}let o=Math.round((r(new Date)-r(n))/864e5);return o<=0?t.dateToday:o===1?t.dateYesterday:o<7?n.toLocaleDateString(void 0,{weekday:"long"}):n.toLocaleDateString(void 0,{month:"long",day:"numeric",year:"numeric"})}var Iv=["today","yesterday","lastWeek","older"];function Tv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((vu(e)-vu(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function hu(e,t){let n=new Map;for(let r of t){let o=Tv(e,r.lastMessageAt),i=n.get(o);i?i.push(r):n.set(o,[r])}return Iv.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function vu(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var bu=le.scope("history"),Av=3,Ev=6,Mv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function yu(e,t){let n=t.type!=="upsert"||t.activity===!0;if(t.type==="snapshot"&&t.result.pagination.page===1&&e.pagination.page>1){let o=zt(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let u=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:u,totalPages:Math.ceil(u/t.result.pagination.limit)}}}let i=new Set(o.map(u=>u.conversationId)),a=e.conversations.slice(t.result.pagination.limit).filter(u=>!i.has(u.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...a],pagination:c}}let r=zt(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Lv(e,t,n){let r=Date.parse(e);return Number.isFinite(r)?new Date(r).toDateString()===new Date(t).toDateString()?new Intl.DateTimeFormat(n,{hour:"numeric",minute:"2-digit"}).format(r):t-r<10080*60*1e3?new Intl.DateTimeFormat(n,{weekday:"short"}).format(r):new Intl.DateTimeFormat(n,{month:"short",day:"numeric"}).format(r):""}function ha({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:i}){let a=T.cssPrefix,s=e.peekConversations({limit:50}),[c,u]=H(s?"loaded":"loading"),[d,_]=H(s),[p,f]=H(!1),m=$(void 0),g=d?.conversations??[],P=d?.pagination;D(()=>{let y=!1,C=!0,E=[],Y=e.subscribeConversationChanges(O=>{C&&E.push(O),_(B=>B&&yu(B,O))});m.current=void 0,f(!1);let j=e.peekConversations({limit:50});return _(j),u(j?"loaded":"loading"),e.listConversations({limit:50}).then(O=>{if(y)return;let B=O;for(let z of E)B=yu(B,z);E=[],C=!1,_(B),u("loaded"),r.saveHistoryCount(B.conversations.length)}).catch(O=>{y||(E=[],C=!1,bu.warn("listConversations failed",{err:O}),u("error"))}),()=>{y=!0,Y(),m.current=void 0}},[e,r,n]);async function k(){if(m.current||!P?.hasNext)return;let y={};m.current=y,f(!0);try{let C=await e.listConversations({page:P.page+1,limit:P.limit});if(m.current!==y)return;_(E=>{if(!E)return E;let Y=new Set(E.conversations.map(B=>B.conversationId)),j=C.conversations.filter(B=>Y.has(B.conversationId)?!1:(Y.add(B.conversationId),!0)),O={conversations:[...E.conversations,...j],pagination:C.pagination};return r.saveHistoryCount(O.conversations.length),O})}catch(C){if(m.current!==y)return;bu.warn("listConversations page failed",{err:C,page:P.page+1})}finally{m.current===y&&(m.current=void 0,f(!1))}}let S=i?l("div",{class:`${a}-history-footer`,children:l("button",{type:"button",class:`${a}-history-new`,onClick:i,"data-testid":A.sidebarNewConversation,children:[l(td,{}),t.newConversation]})}):null;if(c==="loading"){let y=Math.min(r.loadHistoryCount()??Av,Ev);return l(we,{children:[l("div",{class:`${a}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${a}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${a}-history-heading`,children:l("span",{class:`${a}-skeleton ${a}-skeleton-heading`})}),l("div",{class:`${a}-history-card`,children:Array.from({length:Math.max(1,y)},(C,E)=>l("div",{class:`${a}-history-item ${a}-history-item-skeleton`,children:[l("span",{class:`${a}-history-avatar ${a}-skeleton`}),l("span",{class:`${a}-history-body`,children:[l("span",{class:`${a}-history-row`,children:[l("span",{class:`${a}-history-title`,children:l("span",{class:`${a}-skeleton ${a}-skeleton-title`})}),l("span",{class:`${a}-history-time`,children:l("span",{class:`${a}-skeleton ${a}-skeleton-time`})})]}),l("span",{class:`${a}-history-row`,children:l("span",{class:`${a}-history-preview`,children:l("span",{class:`${a}-skeleton ${a}-skeleton-preview`})})})]})]},E))})]})}),S]})}if(c==="error"||g.length===0)return l(we,{children:[l("div",{class:`${a}-history-empty`,children:t.historyEmpty}),S]});let h=Date.now(),b=hu(h,g);return l(we,{children:[l("div",{class:`${a}-history`,role:"list",children:[b.map(y=>l("div",{class:`${a}-history-group`,children:[l("div",{class:`${a}-history-heading`,children:t[Mv[y.bucket]]}),l("div",{class:`${a}-history-card`,children:y.conversations.map(C=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${a}-history-item`,onClick:()=>o(C),"data-closed":C.canContinue?void 0:"true","data-unread":C.hasUnread?"true":void 0,"data-testid":it(A.historyItem,C.conversationId),children:[l("span",{class:`${a}-history-avatar`,"aria-hidden":"true",children:l(Yi,{})}),l("span",{class:`${a}-history-body`,children:[l("span",{class:`${a}-history-row`,children:[l("span",{class:`${a}-history-title`,children:C.title}),l("span",{class:`${a}-history-time`,children:Lv(C.lastMessageAt,h,n)})]}),l("span",{class:`${a}-history-row`,children:[l("span",{class:`${a}-history-preview`,children:C.preview??(C.canContinue?t.historyContinue:t.conversationClosed)}),C.hasUnread?l("span",{class:`${a}-history-dot`}):null]})]})]})},C.conversationId))})]},y.bucket)),P?.hasNext?l("div",{class:`${a}-history-more`,children:l("button",{type:"button",onClick:k,disabled:p,"aria-busy":p,"data-testid":A.historyLoadMore,children:t.loadMoreConversations})}):null]}),S]})}var Pu=T.cssPrefix;function xu({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${Pu}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${Pu}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":it(A.suggestion,o),children:r.label},r.id))})}var Qe=T.cssPrefix;function Su(e){let{options:t,onClose:n}=e,r=t.strings,o=$(null);D(()=>{let u=o.current;if(!u)return;let d=ia(u);function _(p){p.key==="Escape"&&n?.()}return u.addEventListener("keydown",_),()=>{d(),u.removeEventListener("keydown",_)}},[n]);let i=e.composerApiRef,a=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,s=N(u=>{a&&i.current?.attachFromDrop(u)},[i,a]),{visible:c}=ca({containerRef:o,onDrop:s,disabled:!a});return oa(o.current,t.mode==="modal"),l("div",{ref:o,class:`${Qe}-panel`,role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":A.panel,children:[l(us,{...e,containerEl:o.current,dragOver:c}),l(ps,{poweredBy:e.options.poweredBy})]})}function us(e){let{options:t,transport:n,feedback:r,bus:o,persistence:i,conversationId:a,composerKey:s,panelSize:c,view:u,canSend:d,isStreaming:_,isMemoryCompacting:p,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:g,controlMode:P,assignedOperatorInitials:k,operatorAvailable:S,operatorRequestEnabled:h,onRequestOperator:b,onCancelOperatorRequest:y,loadingMessages:C,onLoadPreviousMessages:E,messagesSig:Y,agent:j,suggestions:O,initialWidgetSize:B,onClose:z,onBack:F,onClear:Z,onToggleHistory:L,onSelectHistoryConversation:q,onNewConversation:R,onWidgetSizeChange:ue,onSend:oe,onStop:$e,onSuggestion:te,activeForm:se,formMarkers:W,onFormSubmit:ee,onFormSkip:Be,onFormFill:xe,tool:he,onRetry:Se,onMessageFeedback:Ye,containerEl:Ae,dragOver:Pe,composerApiRef:Fe}=e,pe=t.strings,Re=ht(()=>Y.value.some(Oe=>!Oe.ephemeral&&Oe.role!=="system")).value,je;return se?je=null:d?je=l(we,{children:[P&&P!=="ai-agent"?l($v,{controlMode:P,operatorInitials:k,operatorAvailable:S,onCancelOperatorRequest:y,strings:pe}):null,p&&P==="ai-agent"?l("div",{class:`${Qe}-loading ${Qe}-compaction-status`,role:"status","data-testid":A.compactionStatus,children:[l("span",{class:`${Qe}-loading-spinner`,"aria-hidden":"true"}),pe.compactingContext]}):null,!_&&!p&&P==="ai-agent"&&l(xu,{suggestions:O,onPick:te,disabled:g}),l(Hd,{options:t,transport:n,feedback:r,bus:o,persistence:i,conversationId:a,isStreaming:_,isMemoryCompacting:p,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&u==="chat",isPreparing:g,operatorRequestEnabled:h,canRequestOperator:Re,controlMode:P,onRequestOperator:b,onSend:oe,onStop:$e,apiRef:Fe},s)]}):je=l(Nv,{label:pe.conversationClosed,ctaLabel:pe.startNewConversation,onNewConversation:Z}),l(we,{children:[u==="history"?l(Ov,{strings:pe,onBack:L,onClose:z,showClose:aa(t.mode,c,t.actions)}):l("header",{class:`${Qe}-header`,"data-testid":A.panelHeader,children:[F?l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:F,"aria-label":pe.moduleBack,title:pe.moduleBack,children:l(Mr,{})}):null,j?l(Fd,{agent:j,strings:pe}):l("h1",{children:pe.panelTitle}),l(Ot,{panelProps:e,variant:"chat"})]}),u==="history"?l(ha,{transport:n,strings:pe,locale:t.locale,persistence:i,onSelect:q,onNewConversation:R}):l(we,{children:[l(Vd,{visible:Pe,strings:pe}),l(gu,{messagesSig:Y,strings:pe,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:Ye,loading:C,onLoadPreviousMessages:E,idle:!_&&!g&&d&&!se,controlMode:P,tool:he,onRetry:Se,form:se?{form:se,onSubmit:ee,onSkip:Be}:null,formMarkers:W,onFillForm:xe}),je,l(Bv,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(ra,{panelEl:Ae,resize:t.size.resize,position:t.position,initialSize:B,onSizeChange:ue,strings:pe}):null]})}function Ov({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${Qe}-header`,children:[l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(Mr,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${Qe}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(It,{})}):null]})}function Nv({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${Qe}-readonly-banner`,role:"note",children:[l("span",{class:`${Qe}-readonly-label`,children:e}),l("button",{type:"button",class:`${Qe}-readonly-cta`,onClick:n,children:t})]})}function $v({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let i=Dv(e,t,n,o);return l("div",{class:`${Qe}-operator-banner`,role:"status","data-mode":e,"data-testid":A.operatorBanner,children:[l("span",{class:`${Qe}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${Qe}-operator-label`,children:i}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${Qe}-cancel-operator-request`,"data-testid":A.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Dv(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function Bv({disclaimer:e}){return e?l("div",{class:`${Qe}-composer-footer`,children:l("div",{class:`${Qe}-disclaimer`,children:e})}):null}function ps({poweredBy:e}){return e?l("div",{class:`${Qe}-poweredby-bar`,children:l(Fv,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Fv({logoUrl:e,text:t,href:n}){let r=l(we,{children:[e?l("img",{class:`${Qe}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${Qe}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${Qe}-poweredby`,children:r})}function ku(e){let t=$(e);t.current=e;let n=$(null);return n.current??(n.current=Uv(t)),n.current}function Uv(e){let t=ie(null),n=new Set;function r(c){return`${e.current.conversationId()??""}:${c}`}function o(c){return c.frequency==="always"?!1:c.frequency==="conversation"?n.has(r(c.id)):c.id in e.current.persistence.loadFormsDone()}function i(c,u){if(t.value)return;let d=e.current;if(c==="manual"){let _=d.forms.list.find(p=>p.id===u);_&&(t.value={form:_,trigger:"manual"});return}for(let _ of d.forms.byTrigger[c]??[]){let p=_.triggers.find(f=>f.kind===c);if(!(!p||!zv(p,d)||o(_)||!qv(_,d))){t.value={form:_,trigger:c};return}}}function a(c,u){let d=t.value;if(!d)return;t.value=null;let{form:_,trigger:p}=d;_.frequency==="conversation"?n.add(r(_.id)):_.frequency!=="always"&&e.current.persistence.saveFormDone(_.id),e.current.onComplete(_,p,c,u)}function s(){let c=t.value;if(!c)return;let u=e.current.forms.list.find(d=>d.id===c.form.id);u&&u!==c.form&&(t.value={form:u,trigger:c.trigger})}return{activeForm:t,fire:i,refresh:s,complete:c=>a(c,!1),skip:()=>a({},!0)}}function zv(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function qv(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(i=>o[i]!==void 0&&o[i]!==""))return!1}if(n.pageArea&&!(Array.isArray(n.pageArea)?n.pageArea:[n.pageArea]).includes(t.pageArea()??""))return!1;let r=t.messageCount();return!(n.minMessages!=null&&r<n.minMessages||n.maxMessages!=null&&r>n.maxMessages)}function wu(e){let t=T.cssPrefix,{site:n,blocks:r,strings:o,collapsed:i}=e,a=r?.navigation??[],s=r?.linkCards??[],c=i?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":i?"true":"false","data-testid":A.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Hv,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":i?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":A.sidebarToggle,children:l(Vv,{collapsed:i})})]}),i?null:l(we,{children:[a.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(jv,{items:a})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(Wv,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(ha,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Hv({site:e}){let t=T.cssPrefix;if(e?.logo?.url){let n=e.logo.alt??e.title??"Logo";return l("picture",{children:[e.logoDark?.url?l("source",{srcset:e.logoDark.url,media:"(prefers-color-scheme: dark)"}):null,l("img",{class:`${t}-sidebar-logo`,src:e.logo.url,alt:n})]})}return l("div",{class:`${t}-sidebar-title`,children:e?.title??T.name})}function Vv({collapsed:e}){return l("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","aria-hidden":"true",children:e?l("polyline",{points:"9 6 15 12 9 18"}):l("polyline",{points:"15 6 9 12 15 18"})})}function jv({items:e}){let t=T.cssPrefix;return l("ul",{class:`${t}-sidebar-nav`,children:e.map(n=>l("li",{children:l("a",{class:`${t}-sidebar-nav-item`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[n.icon?l("span",{class:`${t}-sidebar-nav-icon`,"data-icon":n.icon}):null,l("span",{class:`${t}-sidebar-nav-label`,children:n.label})]})},n.id??n.label))})}function Wv({items:e}){let t=T.cssPrefix;return l("div",{class:`${t}-sidebar-cards`,children:e.map(n=>l("a",{class:`${t}-sidebar-card`,href:n.href,target:n.href?"_blank":void 0,rel:n.href?"noreferrer":void 0,children:[l("div",{class:`${t}-sidebar-card-label`,children:n.label}),n.description?l("div",{class:`${t}-sidebar-card-desc`,children:n.description}):null]},n.id??n.label))})}var Cu=T.cssPrefix;function Ru(e){return l("main",{class:`${Cu}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(wu,{site:e.site,blocks:e.blocks,transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,showConversations:e.showConversations,onSelectConversation:e.onSelectConversation,onNewConversation:e.onNewConversation,collapsed:e.sidebarCollapsed,onToggleCollapsed:e.onToggleSidebarCollapsed}),l("section",{class:`${Cu}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}function Iu(e){return Object.fromEntries(e.map(t=>[t,[]]))}function _s(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function Tu(e,t,n){let r=[...new Set(t)],o=_s(r,e,""),i=ie({activeTab:o,stacks:Iu(r)});return{sig:i,reconcile(a,s){let c=[...new Set(a)],u=i.value,d=_s(c,u.activeTab,s),_=Object.fromEntries(c.map(f=>[f,u.stacks[f]??[]])),p=d===u.activeTab&&c.length===Object.keys(u.stacks).length&&c.every(f=>u.stacks[f]===_[f]);r=c,!p&&(i.value={activeTab:d,stacks:_},d!==u.activeTab&&d&&n?.(d))},switchTab(a){!(a in i.value.stacks)||i.value.activeTab===a||(i.value={...i.value,activeTab:a},n?.(a))},push(a){let s=i.value,c=s.stacks[s.activeTab]??[];i.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,a]}}},pop(){let a=i.value,s=a.stacks[a.activeTab]??[];s.length!==0&&(i.value={...a,stacks:{...a.stacks,[a.activeTab]:s.slice(0,-1)}})},reset(a){i.value={activeTab:_s(r,a,""),stacks:Iu(r)}}}}function Au(e){return e.stacks[e.activeTab]??[]}function Eu(e){return Au(e).at(-1)}function Mu(e){return Au(e).length===0}var Lu={Icon:Or};var rn=T.cssPrefix;function ba({title:e,actions:t}){return l("header",{class:`${rn}-back-header`,"data-variant":"title",children:[l("span",{class:`${rn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${rn}-back-title`,children:e}),t??l("span",{class:`${rn}-back-spacer`,"aria-hidden":"true"})]})}function ya({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${rn}-back-header`,"data-testid":o,children:[l("button",{type:"button",class:`${rn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(Mr,{})}),l("h1",{class:`${rn}-back-title`,children:e}),r??l("span",{class:`${rn}-back-spacer`,"aria-hidden":"true"})]})}function xn(e,t){return e instanceof at&&e.status===429?t.errorRateLimited:t.errorGeneric}var Yn=T.cssPrefix;function Ou({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${Yn}-home-search`,onClick:t,"data-testid":A.homeSearch,children:[l("span",{class:`${Yn}-home-search-text`,children:e}),l("span",{class:`${Yn}-home-search-icon`,"aria-hidden":"true",children:l(Ji,{})})]})}function Nu({placeholder:e,value:t,onInput:n}){return l("div",{class:`${Yn}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${Yn}-home-search-input`,placeholder:e,value:t,onInput:r=>n(r.currentTarget.value),"data-testid":A.helpSearch}),l("span",{class:`${Yn}-home-search-icon`,"aria-hidden":"true",children:l(Ji,{})})]})}var Dr=T.cssPrefix;function Pa({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${Dr}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${Dr}-list-row-body`,children:[l("span",{class:`${Dr}-list-row-title`,children:e}),t?l("span",{class:`${Dr}-list-row-sub`,children:t}):null]}),l("span",{class:`${Dr}-list-row-chevron`,"aria-hidden":"true",children:l(Hn,{})})]})}var $u=T.cssPrefix;function At({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${$u}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${$u}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var Sn=T.cssPrefix,Gv=le.scope("help");function Kv(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function Qv(e){let t=new Map;for(let n of e){let r=n.categories?.[0]??"";(t.get(r)??t.set(r,[]).get(r)).push(n)}return[...t.entries()]}function Du(e,t){let n=t.toLowerCase(),r=n.indexOf(e);if(r!==-1)return 100-Math.min(r,99);let o=0;for(let i of e){if(o=n.indexOf(i,o),o===-1)return 0;o+=1}return 1}function Yv(e,t){let n=t.toLowerCase().trim();return n?e.map(r=>({item:r,score:Math.max(Du(n,r.title)*2,Du(n,r.description??""))})).filter(r=>r.score>0).toSorted((r,o)=>o.score-r.score).map(r=>r.item):[]}function Bu({article:e,nav:t}){return l(Pa,{title:e.title,subtitle:e.description,onClick:()=>Kv(t,e),testid:it(A.helpArticle,e.id)})}function Xv({transport:e,strings:t,config:n,nav:r,bus:o,panelProps:i}){let a=n.contentTags,[s,c]=H("loading"),[u,d]=H(t.errorGeneric),[_,p]=H([]),[f,m]=H(""),[g,P]=H(0);D(()=>{let h=!1;return c("loading"),e.listContent({tags:a,sortBy:"order",limit:100}).then(b=>{if(h)return;let y=b.items??[];p(y),c("loaded"),o.emit("contentView",{section:"help",tags:a?.join(","),count:y.length})}).catch(b=>{h||(Gv.warn("listContent (help) failed",{err:b}),d(xn(b,t)),c("error"))}),()=>{h=!0}},[e,a,g,o]);let k=de(()=>Yv(_,f),[_,f]);D(()=>{let h=f.trim();if(!h)return;let b=setTimeout(()=>o.emit("contentSearch",{queryLength:h.length,hitCount:k.length}),600);return()=>clearTimeout(b)},[f,k,o]);function S(){return f.trim().length>0?k.length===0?l(At,{message:t.helpSearchEmpty,strings:t}):l("div",{class:`${Sn}-help-card`,children:k.map(h=>l(Bu,{article:h,nav:r},h.id))}):s==="loading"?l(At,{message:t.helpLoading,strings:t}):s==="error"?l(At,{tone:"error",message:u,onRetry:()=>P(h=>h+1),strings:t}):_.length===0?l(At,{message:t.helpEmpty,strings:t}):Qv(_).map(([h,b])=>l("section",{class:`${Sn}-help-group`,children:[h?l("h2",{class:`${Sn}-help-section-title`,children:h}):null,l("div",{class:`${Sn}-help-card`,children:b.map(y=>l(Bu,{article:y,nav:r},y.id))})]},h))}return l("div",{class:`${Sn}-module`,children:[l(ba,{title:t.helpTitle,actions:l(Ot,{panelProps:i,variant:"plain"})}),l("div",{class:`${Sn}-module-pad`,children:l(Nu,{placeholder:t.helpSearchPlaceholder,value:f,onInput:m})}),l("div",{class:`${Sn}-help-list`,children:S()})]})}var Fu={Icon:Lr,Root:e=>l(Xv,{...e})};var Uu=T.cssPrefix;function fs({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${Uu}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${Uu}-home-card`,"data-testid":n,children:t})}var ze=T.cssPrefix,zu=le.scope("home");function Jv(e){let t=e.options.userContext?.name,n=e.config.greetingText?_t(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}}function Zv(e,t){return t.url?e.push({kind:"iframe",url:t.url,title:t.title}):e.push({kind:"content",id:t.id,title:t.title})}function qu(e,t){return zt(e,t,t.type!=="upsert"||t.activity===!0)}function eh(e){let{transport:t,strings:n,config:r,nav:o,bus:i,panelProps:a}=e,[s,c]=H(null),[u,d]=H([]),_=r.contentTags?.join(","),p=e.options.modules.list.some(S=>S.layout==="chat");D(()=>{if(r.showRecentConversations===!1)return;let S=!1,h=!0,b=[],y=t.subscribeConversationChanges(C=>{h&&b.push(C),c(E=>qu(E?[E]:[],C)[0]??null)});return t.listConversations({limit:p?50:1}).then(C=>{if(S)return;let E=b.reduce(qu,C.conversations);b=[],h=!1,c(E[0]??null)}).catch(C=>{S||(b=[],h=!1,zu.warn("listConversations (home) failed",{err:C}))}),()=>{S=!0,y()}},[t,r.showRecentConversations,p]),D(()=>{if(!r.contentTags?.length)return;let S=!1;return t.listContent({tags:r.contentTags,limit:6}).then(h=>{if(S)return;let b=h.items??[];d(b),i.emit("contentView",{section:"home",tags:_,count:b.length})}).catch(h=>!S&&zu.warn("listContent (home) failed",{err:h})),()=>{S=!0}},[t,_,i]);let f=Jv(e),m=r.userAvatars??[],g=r.status,P=g?.text?_t(n,g.text):n.homeStatus,k=r.contentBlockTitle?_t(n,r.contentBlockTitle):n.homeContentTitle;return l("div",{class:`${ze}-module ${ze}-home`,"data-testid":A.homeView,children:l("div",{class:`${ze}-home-scroll`,children:[l("div",{class:`${ze}-home-hero`,children:[l("div",{class:`${ze}-home-hero-top`,children:[r.brandName?l("span",{class:`${ze}-home-brand`,"data-testid":A.homeBrand,children:r.brandName}):l("span",{class:`${ze}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ze}-home-hero-actions`,children:[m.length>0?l("div",{class:`${ze}-home-avatars`,children:m.map(S=>l("span",{class:`${ze}-home-avatar`,title:S.role?`${S.name} \xB7 ${S.role}`:S.name,children:S.avatar?l("img",{src:S.avatar,alt:"",loading:"lazy"}):l("span",{children:sa(S.name)})},S.name))}):null,l(Ot,{panelProps:a,variant:"plain"})]})]}),r.showGreeting!==!1?l(we,{children:[l("h1",{class:`${ze}-home-greeting`,"data-testid":A.homeGreeting,children:f.title}),f.subtitle?l("p",{class:`${ze}-home-lead`,children:f.subtitle}):null]}):null]}),l("div",{class:`${ze}-home-cards`,children:[r.showSearchBar!==!1?l(Ou,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,s?l(fs,{onClick:()=>o.selectConversation(s),testid:A.homeRecent,children:l("div",{class:`${ze}-home-recent-row`,"data-unread":s.hasUnread?"true":void 0,children:[l("span",{class:`${ze}-home-recent-avatar`,"aria-hidden":"true",children:l(Or,{})}),l("span",{class:`${ze}-home-recent-body`,children:[l("span",{class:`${ze}-home-recent-title`,children:s.title}),s.preview?l("span",{class:`${ze}-home-recent-preview`,children:s.preview}):null]}),s.hasUnread?l("span",{class:`${ze}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,g?l(fs,{onClick:g.url?()=>o.push({kind:"iframe",url:g.url,title:P}):void 0,children:l("div",{class:`${ze}-home-status`,"data-level":g.level??"operational",children:[l("span",{class:`${ze}-home-status-icon`,"aria-hidden":"true",children:l(Sd,{})}),l("span",{class:`${ze}-home-status-text`,children:P})]})}):null,u.length>0?l("section",{class:`${ze}-home-content`,children:[l("div",{class:`${ze}-home-content-title`,children:k}),l("div",{class:`${ze}-home-content-list`,children:u.map(S=>l(Pa,{title:S.title,subtitle:S.description,onClick:()=>Zv(o,S),testid:it(A.homeContentRow,S.id)},S.id))})]}):null]})]})})}var Hu={Icon:kd,Root:e=>l(eh,{...e})};var on=T.cssPrefix,th=le.scope("news");function nh({transport:e,strings:t,config:n,nav:r,bus:o,panelProps:i}){let a=n.contentTags,[s,c]=H("loading"),[u,d]=H(t.errorGeneric),[_,p]=H([]),[f,m]=H(0);D(()=>{let P=!1;return c("loading"),e.listContent({tags:a,sortBy:"publishedAt",sortOrder:"desc"}).then(k=>{if(P)return;let S=k.items??[];p(S),c("loaded"),o.emit("contentView",{section:"news",tags:a?.join(","),count:S.length})}).catch(k=>{P||(th.warn("listContent (news) failed",{err:k}),d(xn(k,t)),c("error"))}),()=>{P=!0}},[e,a,f,o]);function g(){return s==="loading"?l(At,{message:t.newsLoading,strings:t}):s==="error"?l(At,{tone:"error",message:u,onRetry:()=>m(P=>P+1),strings:t}):_.length===0?l(At,{message:t.newsEmpty,strings:t}):l("div",{class:`${on}-news-list`,children:_.map(P=>l("button",{type:"button",class:`${on}-news-card`,onClick:()=>r.push({kind:"content",id:P.id,title:P.title}),"data-testid":it(A.newsItem,P.id),children:[P.image?l("img",{class:`${on}-news-hero`,src:P.image,alt:"",loading:"lazy"}):null,l("span",{class:`${on}-news-body`,children:[l("span",{class:`${on}-news-title`,children:P.title}),P.description?l("span",{class:`${on}-news-summary`,children:P.description}):null]})]},P.id))})}return l("div",{class:`${on}-module`,children:[l(ba,{title:t.newsTitle,actions:l(Ot,{panelProps:i,variant:"plain"})}),l("div",{class:`${on}-module-scroll`,children:g()})]})}var Vu={Icon:wd,Root:e=>l(nh,{...e})};var xa={chat:Lu,home:Hu,help:Fu,news:Vu};var Br=T.cssPrefix;function ju({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${Br}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(i=>{let a=xa[i.layout].Icon,s=i.id===t,c=i.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${Br}-tab`,onClick:()=>o(i.id),"data-testid":it(A.tab,i.id),children:[l("span",{class:`${Br}-tab-icon`,"aria-hidden":"true",children:[l(a,{}),c?l("span",{class:`${Br}-tab-badge`,"data-testid":A.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${Br}-tab-label`,children:_t(n,i.label)})]},i.id)})})}var Wu=T.cssPrefix,rh="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Gu({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${Wu}-module`,children:[l(ya,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${Wu}-content-frame`,src:e,title:t||"content",sandbox:rh,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var Fr=T.cssPrefix,oh=le.scope("content"),ah=5e3;function Ku({id:e,title:t,transport:n,strings:r,bus:o,onBack:i,actions:a}){let[s,c]=H(null),[u,d]=H(!1),[_,p]=H(0),f=N(()=>{d(!1),c(null),p(P=>P+1)},[]);D(()=>{let P=!1;return n.listContent({ids:[e],limit:1}).then(k=>{if(P)return;let S=k.items[0];S?(c(S),o.emit("contentOpen",{contentId:e,tags:S.tags?.length?S.tags.join(","):void 0})):d(!0)}).catch(k=>{P||(oh.warn("listContent (reader) failed",{err:k}),d(!0))}),()=>{P=!0}},[n,e,_,o]),D(()=>{if(!s)return;let P=setTimeout(()=>o.emit("contentRead",{contentId:e}),ah);return()=>clearTimeout(P)},[s,e,o]);let m=N(P=>{let S=P.target?.closest?.("a")?.getAttribute("href")??"";S&&!S.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function g(){return u?l(At,{tone:"error",message:r.errorGeneric,onRetry:f,strings:r}):s===null?l(At,{message:r.contentLoading,strings:r}):l("article",{class:`${Fr}-content`,"data-testid":A.contentView,onClick:m,children:[s.image?l("img",{class:`${Fr}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${Fr}-content-subtitle`,children:s.description}):null,l(au,{text:s.content??""})]})}return l("div",{class:`${Fr}-module`,children:[l(ya,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:i,actions:a,testid:A.backHeader}),l("div",{class:`${Fr}-module-scroll`,"data-testid":A.contentScroll,children:g()})]})}var Sa=T.cssPrefix;function Qu({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,onSelectConversation:i,onStartNewConversation:a,onSetPanelSize:s}){let c=e.options,u=c.strings,d=$(null),_=$(new Set);D(()=>{let F=d.current;if(!F)return;let Z=ia(F);function L(q){q.key==="Escape"&&e.onClose?.()}return F.addEventListener("keydown",L),()=>{Z(),F.removeEventListener("keydown",L)}},[e.onClose]);let p=ht(()=>n.sig.value).value,f=Eu(p),m=c.modules.byId[p.activeTab],g=e.composerActive&&m?.layout==="chat"&&f===void 0,P=e.composerApiRef,k=g&&e.view==="chat"&&e.canSend&&!e.activeForm&&!e.sendPreparing&&e.options.features.fileUpload,S=N(F=>{k&&P.current?.attachFromDrop(F)},[P,k]),{visible:h}=ca({containerRef:d,onDrop:S,disabled:!k});oa(d.current,c.mode==="modal");let b=f?.kind==="iframe"||f?.kind==="content",y=t.length>1&&(Mu(p)||!b),C=$(null);D(()=>{if(b&&C.current===null)C.current=e.panelSize,e.panelSize==="normal"&&s("expanded");else if(!b&&C.current!==null){let F=C.current;C.current=null,s(F)}},[b]);let E={push:F=>n.push(F),pop:()=>n.pop(),switchTab:F=>n.switchTab(F),switchToLayout:F=>{let Z=t.find(L=>L.layout===F);Z&&n.switchTab(Z.id)},selectConversation:i,startNewConversation:a};function Y(F){return{options:c,transport:e.transport,strings:u,config:F,nav:E,bus:r,panelProps:e}}let j=l(Ot,{panelProps:e,variant:"plain"});m&&_.current.add(m.id);let O=t.filter(F=>_.current.has(F.id));function B(F){if(F.layout==="chat")return l(us,{...e,composerActive:g,containerEl:d.current,dragOver:h});let Z=xa[F.layout].Root;return Z?l(Z,{...Y(F)}):null}function z(){return f?.kind==="iframe"?l(Gu,{url:f.url,title:f.title,strings:u,onBack:()=>n.pop(),actions:j}):f?.kind==="content"?l(Ku,{id:f.id,title:f.title,transport:e.transport,strings:u,bus:r,onBack:()=>n.pop(),actions:j}):null}return l("div",{ref:d,class:`${Sa}-panel ${Sa}-messenger`,role:"dialog","aria-modal":"false","aria-label":u.panelTitle,style:{position:"relative"},"data-testid":A.messengerHome,children:[l("div",{class:`${Sa}-messenger-body`,children:[O.map(F=>l("div",{class:`${Sa}-messenger-pane`,hidden:b||F.id!==m?.id,children:B(F)},F.id)),z()]}),y?l(ju,{modules:t,activeTab:p.activeTab,strings:u,hasUnread:o,onSelect:F=>n.switchTab(F)}):null,l(ps,{poweredBy:c.poweredBy}),c.size.resize?.enabled&&!(m?.layout==="chat"&&!f)?l(ra,{panelEl:d.current,resize:c.size.resize,position:c.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:u}):null]})}var Ur=T.cssPrefix;function Yu({strings:e,onClose:t}){return l("div",{class:`${Ur}-panel ${Ur}-modules-empty`,role:"dialog","aria-label":e.panelTitle,"data-testid":A.modulesEmpty,children:[t?l("button",{type:"button",class:`${Ur}-icon-btn ${Ur}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(It,{})}):null,l("p",{class:`${Ur}-modules-empty-text`,children:e.modulesEmpty})]})}function Xn(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}var ms=le.scope("hitl");function Xu(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:i,humanInLoop:a}=e,s=$(t);s.current=t;let c=N((p,f,m)=>{if(s.current||n.value!=="ai-agent")return!1;let g=r.value.at(-1),P=g?.partsSig.value.findIndex(S=>S.kind==="tool"&&S.toolCallId===p)??-1,k=g?.partsSig.value[P];return!g||k?.kind!=="tool"?(ms.warn("decideTool: tool part not found",{toolCallId:p}),!1):g.status!=="complete"||!Go(g,P)||!f(k)?!1:(m(k),g.partsSig.value=[...g.partsSig.value],vn(g)&&(g.status="streaming",g.retryAction={kind:"continue-assistant",messageId:g.serverMessageId??g.id},g.awaitingContinuation=!0,r.value=[...r.value],o({continueExisting:!0})),!0)},[n,r,o]),u=N((p,f,m)=>{let g=!1;if(c(p,k=>k.stateSig.value==="approval-requested",k=>{g=ua(k.toolName);let S=k.approvalSig.value?.id??p;k.approvalSig.value={id:S,approved:f,reason:m},k.stateSig.value="approval-responded"})){if(g){ms.info("toolResult",{toolCallId:p}),i.emit("toolResult",{toolCallId:p});return}ms.info("toolDecision",{toolCallId:p,approved:f}),i.emit("toolDecision",{toolCallId:p,approved:f})}},[i,c]),d=N(p=>{c(p,f=>f.stateSig.value==="approval-responded"&&f.approvalSig.value?.approved!==void 0,f=>{let m=f.approvalSig.value?.id??p;f.approvalSig.value={id:m},f.stateSig.value="approval-requested"})},[c]);return{toolInteraction:de(()=>({humanInLoop:a,onDecision:u,onEdit:d}),[a,u,d])}}function Ju({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,i]=H(()=>r?!1:t.loadCalloutDismissed(n));D(()=>{i(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let a=N(()=>{i(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:a}}function Zu(e){let{transport:t,conversationIdSig:n}=e,r=wt("ai-agent"),o=wt(void 0),i=wt(void 0),a=$(void 0),s=N(_=>{let p=_.controlRevision,f=a.current;f&&f.conversationId===n.value&&p<f.revision||(a.current={conversationId:n.value,revision:p},r.value=_.controlMode,o.value=_.assignedOperatorInitials,_.controlMode!=="awaiting-operator"?i.value=void 0:_.operatorAvailable!==void 0&&(i.value=_.operatorAvailable))},[n,r,o,i]),c=N(_=>{if(_.type!=="data-control-state")return;let p=oc(_.data);p&&s(p)},[s]),u=N(async()=>{let _=n.value,p=await t.requestOperator();p&&n.value===_&&s(p)},[t,n,s]),d=N(async()=>{let _=n.value,p=await t.cancelOperatorRequest();p&&n.value===_&&s(p)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:i,applyControlState:s,adoptControlStateChunk:c,requestOperator:u,cancelOperatorRequest:d}}var ka=T.cssPrefix,ep=`--${ka}-visual-viewport-height`,tp=`--${ka}-visual-viewport-top`;function np(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:i,setIsOpen:a}=e;Pt(()=>{go(t,wo(n,r,o))},[t,o,r,n]),Pt(()=>{if(!o||!i)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,u=t.shadowRoot?.querySelector(`.${ka}-anchor`);if(!s||!c||!u)return;let d=()=>{u.style.setProperty(ep,`${c.height}px`),u.style.setProperty(tp,`${c.offsetTop}px`)},_=0,p=()=>{s.cancelAnimationFrame(_),_=s.requestAnimationFrame(()=>{_=s.requestAnimationFrame(d)})};return d(),c.addEventListener("resize",p),c.addEventListener("scroll",p),()=>{s.cancelAnimationFrame(_),c.removeEventListener("resize",p),c.removeEventListener("scroll",p),u.style.removeProperty(ep),u.style.removeProperty(tp)}},[t,o,i]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(d=>d instanceof HTMLElement&&d.classList.contains(`${ka}-panel`))||a(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,a]),D(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&a(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,a])}var gs=le.scope("reducer"),wa=class{constructor(t,n){ve(this,"messagesSig",t);ve(this,"onReconcileNeeded",n);ve(this,"active",null);ve(this,"openTextParts",new Map);ve(this,"partSeq",0);ve(this,"replay",null)}attach(t){this.active=t,this.openTextParts.clear()}detach(){this.active=null,this.replay=null,this.openTextParts.clear()}beginReplay(t,n){let r=Ht();r.id=t.id;let o=kn(t)||hn(t)&&(t.status!=="streaming"||vn(t)),i=t.status==="streaming"&&vn(t)&&Tr(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:i,liveCatchUp:t.status==="streaming"&&!o},this.attach(r),this.apply(n)}refreshReplayBaseline(){let t=this.replay;if(!t)return null;let n=t.shadow.serverMessageId??t.baseline.serverMessageId,r=this.messagesSig.value,o=r.at(-1),i=o===t.baseline||o?.id===t.baseline.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t.baseline)??r.find(s=>s.id===t.baseline.id||n!==void 0&&s.serverMessageId===n);if(!i)return this.detach(),null;if(i===t.baseline)return t;let a=t.baseline;return t.baseline=i,rp(a,i),t.liveCatchUp&&kn(t.shadow)&&(i.status==="streaming"||hn(i))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=kn(i)||hn(i)&&(i.status!=="streaming"||vn(i)),t.continuationTailReplay=i.status==="streaming"&&vn(i)&&Tr(i),t.liveCatchUp=i.status==="streaming"&&!t.probeContinuation,t)}refreshActive(){let t=this.active;if(!t)return null;let n=t.serverMessageId,r=this.messagesSig.value,o=r.at(-1),i=o===t||o?.id===t.id||n!==void 0&&o?.serverMessageId===n?o:r.find(s=>s===t)??r.find(s=>s.id===t.id||n!==void 0&&s.serverMessageId===n);if(!i)return this.detach(),null;if(i===t)return t;rp(t,i);let a=kn(t)&&hn(i);return i.status!=="streaming"&&!a?(this.detach(),null):(this.replay={baseline:i,shadow:t,chunks:[],probeContinuation:!1,continuationTailReplay:!1,liveCatchUp:!0},t)}promoteReplay(){let{baseline:t,shadow:n}=this.replay;return Rt(()=>{t.role=n.role,t.serverMessageId=n.serverMessageId,t.operatorInitials=n.operatorInitials,t.status=n.status,n.canceled&&(t.canceled=!0),t.finishReason=n.finishReason,t.errorText=n.errorText,t.suggestions=n.suggestions??t.suggestions,t.partsSig.value=n.partsSig.value,this.messagesSig.value=[...this.messagesSig.value]}),this.replay=null,this.active=t,t}promoteContinuation(t=!1){let{baseline:n,chunks:r}=this.replay,o=Ko(n);return this.replay=null,Rt(()=>{if(t){let i=n.partsSig.value.findLastIndex(a=>a.kind==="tool");n.partsSig.value=n.partsSig.value.slice(0,i+1)}n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n);for(let i of r)this.apply(i);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=Ko(n);return this.replay=null,Rt(()=>{n.awaitingContinuation=!1,n.status="streaming",n.finishReason=void 0,n.errorText=void 0,n.suggestions=void 0,this.attach(n),this.apply(t),n.continuationStreaming=r||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}applyResume(t){if(t.type==="start"){let o=(this.replay?.baseline??this.active)?.serverMessageId;o!==void 0&&t.messageId!==void 0&&o!==t.messageId&&this.onReconcileNeeded?.({messageId:o}),this.detach();let i=t.messageId,a=i!==void 0?this.messagesSig.value.find(d=>d.serverMessageId===i||d.id===i):void 0;if(a!==void 0)return t.messageMetadata?.senderRole==="visitor"&&a.role==="user"&&(a.status==="pending"||a.status==="error")&&(a.serverMessageId=i,a.status="complete",a.errorText=void 0,a.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(a,t),null;let s=t.messageMetadata?.senderRole,c=this.messagesSig.value.at(-1);if(s===void 0&&c?.role==="assistant"&&c.status==="streaming"&&c.serverMessageId===void 0&&!Et(c))return this.attach(c),this.apply(t),null;let u=Ht();return this.attach(u),this.messagesSig.value=[...this.messagesSig.value,u],this.apply(t),null}if(this.replay){let r=this.refreshReplayBaseline();if(!r)return null;r.chunks.push(t),t.type==="data-control-state"&&(r.baseline.operatorRoutedTurn=t.data.controlMode!=="ai-agent"),this.apply(t);let{baseline:o,shadow:i,probeContinuation:a,continuationTailReplay:s,liveCatchUp:c}=r,u=t.type==="finish"||t.type==="error"||t.type==="abort";if(a){if(!lh(o,i,t))return u&&(ph(o,i)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let _=kn(o)&&u?this.settleOwnedContinuation(t):this.promoteContinuation();return u?(_.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:_.serverMessageId??_.id}):_.continuationStreaming=!1),this.detach(),_):null}if(s&&sh(o,i)){let _=this.promoteContinuation(!0);return u?(this.detach(),_):null}if(!c)return u&&this.detach(),null;if(u&&!Et(o)&&Et(i)){let _=this.promoteReplay();return this.detach(),_}if(!ih(o,i))return u&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let d=this.promoteReplay();return u?(this.detach(),d):null}let n=this.refreshActive();if(!n)return null;if(this.replay)return this.applyResume(t);if(this.apply(t),t.type==="finish"||t.type==="error"||t.type==="abort"){let r=n;return r.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:r.serverMessageId??r.id}):r.continuationStreaming=!1),this.detach(),r}return null}ensureTextPart(t,n,r){let o=`${n}:${r}`,i=this.openTextParts.get(o);if(i)return i;let a={kind:n,id:`${r}#${this.partSeq++}`,textSig:ie(""),doneSig:ie(!1)};return this.openTextParts.set(o,a),zr(t,a),a}apply(t){let n=this.active;if(n)switch(t.type){case"start":{t.messageId&&(n.serverMessageId=t.messageId);let r=t.messageMetadata;r?.senderRole==="operator"?(n.role="operator",r.operatorInitials&&(n.operatorInitials=r.operatorInitials)):r?.senderRole==="visitor"&&(n.role="user");return}case"finish-step":this.openTextParts.clear();return;case"start-step":zr(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":gs.debug("finish",{reason:t.finishReason,canContinue:t.canContinue}),n.status="complete",n.retryAction=void 0,t.finishReason&&(n.finishReason=t.finishReason),this.bumpDone(n);return;case"error":gs.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":gs.debug("stream abort chunk (canceled)"),n.status="complete",n.canceled=!0,n.retryAction=void 0,this.bumpDone(n);return;case"text-start":this.ensureTextPart(n,"text",t.id);return;case"text-delta":{let r=this.ensureTextPart(n,"text",t.id);r.textSig.value+=t.delta;return}case"text-end":this.ensureTextPart(n,"text",t.id).doneSig.value=!0;return;case"reasoning-start":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!1;return;case"reasoning-delta":{let r=this.ensureTextPart(n,"reasoning",t.id);r.textSig.value+=t.delta;return}case"reasoning-end":this.ensureTextPart(n,"reasoning",t.id).doneSig.value=!0;return;case"tool-input-start":case"tool-input-delta":case"tool-input-available":case"tool-input-error":case"tool-output-available":case"tool-output-error":case"tool-output-denied":case"tool-approval-request":_h(n,t);return;case"file":zr(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":op(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":op(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Ro(t.data);return;case"data-control-state":n.operatorRoutedTurn=t.data.controlMode!=="ai-agent";return;case"data-memory-compaction-state":return;default:{let r=t}}}bumpDone(t){Rt(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},vs={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function kn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function rp(e,t){e.canceled&&(t.canceled=!0),!(!kn(e)||t.status!=="streaming"&&!hn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function ih(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,i)=>ap(o,r[i]))}function sh(e,t){let n=e.partsSig.value,r=n.findLastIndex(s=>s.kind==="tool"),o=new Set(n.slice(0,r+1).flatMap(s=>s.kind==="tool"?[s.toolCallId]:[])),i=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),a=n.slice(r+1);return i.length<a.length?!1:a.every((s,c)=>ap(s,i[c]))}function ap(e,t){switch(e.kind){case"text":case"reasoning":return t?.kind===e.kind&&t.textSig.value.startsWith(e.textSig.value);case"step-start":return t?.kind==="step-start";case"tool":{if(t?.kind!=="tool"||t.toolCallId!==e.toolCallId||!Qo(t.toolName,e.toolName)||vs[t.stateSig.value]<vs[e.stateSig.value])return!1;let n=e.approvalSig.value?.approved;return n===void 0||t.approvalSig.value?.approved===n}case"file":return t?.kind==="file"&&t.url===e.url&&t.mediaType===e.mediaType;case"source":return t?.kind==="source"&&t.sourceId===e.sourceId&&t.url===e.url&&t.title===e.title&&t.filename===e.filename&&t.mediaType===e.mediaType;default:return e}}function lh(e,t,n){return ch(e,n)||!dh(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:Tr(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function ch(e,t){if(t.type!=="tool-output-available"&&t.type!=="tool-output-error"&&t.type!=="tool-output-denied")return!1;let n=e.partsSig.value.find(r=>r.kind==="tool"&&r.toolCallId===t.toolCallId);return n!==void 0&&vs[n.stateSig.value]<4}function dh(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,i)=>n.every((a,s)=>uh(r[i+s],a)))}function uh(e,t){switch(t.kind){case"text":case"reasoning":return e?.kind===t.kind&&e.textSig.value.startsWith(t.textSig.value);case"step-start":return e?.kind==="step-start";case"tool":return e?.kind==="tool"&&e.toolCallId===t.toolCallId&&(t.toolName==="tool"||Qo(e.toolName,t.toolName));case"file":return e?.kind==="file"&&e.url===t.url&&e.mediaType===t.mediaType;case"source":return e?.kind==="source"&&e.sourceId===t.sourceId&&e.url===t.url&&e.title===t.title&&e.filename===t.filename&&e.mediaType===t.mediaType;default:return t}}function ph(e,t){if(kn(e)||!hn(e))return!1;let n=new Set(e.partsSig.value.filter(o=>o.kind==="tool").map(o=>o.toolCallId));return!t.partsSig.value.some(o=>o.kind==="tool"&&n.has(o.toolCallId))}function an(e,t,n,r){let o=e.partsSig.value.find(a=>a.kind==="tool"&&a.toolCallId===t);if(o)return r&&(o.dynamic=!0),o;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,inputPartialSig:ie(""),inputSig:ie(void 0),outputSig:ie(void 0),errorSig:ie(void 0),stateSig:ie("input-streaming"),approvalSig:ie(void 0)};return zr(e,i),i}function zr(e,t){e.partsSig.value=[...e.partsSig.value,t]}function op(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||zr(e,t)}function _h(e,t){switch(t.type){case"tool-input-start":an(e,t.toolCallId,t.toolName,t.dynamic);return;case"tool-input-delta":{let n=an(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=an(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=an(e,t.toolCallId,t.toolName,t.dynamic);n.inputSig.value=t.input,n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-approval-request":{let n=an(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=an(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=an(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=an(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function ip(e){let t=1e3,n=!1,r=!1,o=!1;function i(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let a,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;a=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():i()})}catch{}if(e.signal.aborted||(!n&&a===void 0&&(r=!0,i()),s==="unavailable"))return;a!==void 0&&e.now()-a>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var fh=120;function sp(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:i,transport:a,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:u,settleSuggestions:d,recordConversationReply:_,transcriptRecoverySig:p,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:g,runCancellation:P,canContinueRef:k,setCanSend:S,feedback:h,bus:b,loadInitialThread:y,shouldReconcileOnConnect:C}=e,E=$(0);D(()=>{if(!t||!n||!r.value)return;let Y=r.value,j=new AbortController,O=v=>{},B=new wa(o,v=>O(v));a.primeIdentity(s,Y);let z=!1,F=!1,Z,L=!1,q,R=0,ue=k.current,oe,$e,te=Date.now(),se,W=!1,ee=!1;function Be(v,U,Q){if(!Et(v))return;let ne=o.value.findLast(Ee=>!Ee.ephemeral),fe=v.serverMessageId??v.id;if(!(ne&&(ne.serverMessageId??ne.id)!==fe))return Wo(o.value,v,Y,i.current.strings.newConversation,U,Q)}function xe(v,U,Q,ne){let fe=Be(v,U,ne);if(!fe)return;let Me=`${v.serverMessageId??v.id}:${Q}:${fe.preview??""}`;Me!==$e&&($e=Me,a.publishConversation({...fe,hasUnread:!0},!0))}let he;function Se(){he&&(clearTimeout(he.timer),he=void 0)}function Ye(){let v=he;if(!v)return;clearTimeout(v.timer),he=void 0;let U=o.value.find(Q=>(Q.serverMessageId??Q.id)===v.replyId);U?.role!=="assistant"&&U?.role!=="operator"||xe(U,v.canContinue,v.generation,v.activityAt)}function Ae(v,U,Q,ne){Se(),he={replyId:v.serverMessageId??v.id,canContinue:U,generation:Q,activityAt:ne,timer:setTimeout(Ye,fh)}}function Pe(v,U,Q,ne=Date.now(),fe=!0){Se();let Ee=Be(v,U,ne);if(!Ee)return;let ke=`${v.serverMessageId??v.id}:${Q}`;ke!==oe&&(oe=ke,_(Ee),fe&&se&&(W=!0))}function Fe(v,U){(v||!P.localSendRef.current)&&P.settle(U),v&&g()}function pe(v,U=[],Q=!1,ne,fe=ue,Ee=R,Me=Date.now(),ke=!0){let nt=i.current;if(v.canceled){Pe(v,fe,Ee,Me,ke),Fe(Q,ne);return}let me=!0,lt=v.status==="error";switch(Qc(v,lt)){case"drop":o.value=o.value.filter(M=>M!==v),me=!1;break;case"complete-operator-routed":v.status="complete",Q&&(h.play("messageReceived"),Xn(b,nt,"assistant",Ke(v)));break;case"error":{if(v.status="error",v.errorText=nt.strings.errorGeneric,Q){h.play("error");let M=new Error(lt?"stream error chunk":"empty reply");b.emit("error",M),nt.onError?.(M)}break}case"complete":v.status="complete",Q&&(h.play("messageReceived"),Xn(b,nt,"assistant",Ke(v))),d(v,U);break}me&&Pe(v,fe,Ee,Me,ke),Fe(Q,ne)}function Re(v){if(j.signal.aborted||r.value!==Y)return;if(c(v),u?.(v),v.type==="start"){Ye();let M=v.messageId===void 0?void 0:o.value.find(J=>J.serverMessageId===v.messageId||J.id===v.messageId);L=M!==void 0&&M.status!=="streaming";let X=q?.senderRole==="visitor"?q.messageId:void 0;if(q={messageId:v.messageId,senderRole:v.messageMetadata?.senderRole},R+=1,te=Date.now(),$e=void 0,z=v.messageMetadata?.senderRole===void 0,F=!1,Z=z?v.messageMetadata?.runId:void 0,z){let J=v.messageId!==void 0&&o.value.some(Mt=>Mt.serverMessageId===v.messageId||Mt.id===v.messageId),ge=o.value.at(-1),rt=v.messageId!==void 0&&(ge?.serverMessageId===v.messageId||ge?.id===v.messageId),kt=P.localSendRef.current&&(!J||rt)&&ge?.role==="assistant"&&ge.status==="streaming"&&(rt||ge.serverMessageId===void 0&&ge.partsSig.value.length===0);F=P.captureStart(Y,v,kt,X)}}let U=z&&(v.type==="finish"||v.type==="error"||v.type==="abort"),Q=U?Z:void 0,ne=U&&(F||P.ownsLocalRun(Q)),fe=R,Ee=L;v.type==="finish"&&v.canContinue!==void 0&&(ue=v.canContinue);let Me=ue;U&&(z=!1,F=!1,Z=void 0);let ke=B.applyResume(v),nt=q?.messageId,me=nt===void 0?void 0:o.value.find(M=>M.serverMessageId===nt||M.id===nt);L&&q?.senderRole!=="visitor"&&(ke!==null||me?.status==="streaming")&&(L=!1,Ee=!1);let lt=!L&&(me?.role==="assistant"||me?.role==="operator");if(v.type==="text-delta"&<&&Ae(me,ue,R,te),v.type==="text-end"&&(Se(),lt&&xe(me,ue,R,te)),v.type==="finish"&&v.canContinue===!1&&S(!1),!ke){U&&(ne||!P.localSendRef.current)&&P.settle(Q);return}if(ke.role==="operator"){Ee||(h.play("messageReceived"),Xn(b,i.current,"operator",Ke(ke))),Pe(ke,Me,fe,te),L=!1,U&&(ne||!P.localSendRef.current)&&P.settle(Q);return}ke.role==="assistant"&&(pe(ke,[],ne,Q,Me,fe,te),L=!1)}async function je(v){let U=R,Q=await a.loadConversation(Y,v?{ids:[v]}:void 0).catch(()=>null);if(j.signal.aborted||r.value!==Y||!Q)return!1;Q.controlState&&c({type:"data-control-state",data:Q.controlState});let ne=o.value.at(-1),fe=U===R&&(v===void 0||ne!==void 0&&(ne.serverMessageId===v||ne.id===v));if(Q.messages.length===0)return!0;fe&&(ue=Q.canContinue,S(ue));let Ee=o.value,Me=v===void 0?Ee.at(-1):Ee.find(J=>J.serverMessageId===v||J.id===v),{messages:ke,changed:nt}=Ar(Ee,en(Q.messages));if(!nt)return!0;o.value=ke;let me=v===void 0?ke.at(-1):ke.find(J=>J.serverMessageId===v||J.id===v),lt=Me!==void 0&&me!==void 0&&(Me.id===me.id||Me.serverMessageId!==void 0&&Me.serverMessageId===me.serverMessageId),M=me!==void 0&&me.status!=="streaming"&&(!lt||Me?.status==="streaming"),X=lt&&Me?.status==="streaming"?Date.now():me?.createdAt;return fe&&M&&me.role==="assistant"?pe(me,me.suggestions??[],P.localSendRef.current,void 0,Q.canContinue,U,X,!1):fe&&M&&me.role==="operator"?Pe(me,Q.canContinue,U,X,!1):fe&&me?.role==="assistant"&&me.status!=="streaming"&&d(me,me.suggestions??[]),!0}let Oe=new Set;O=({messageId:v})=>{if(Oe.has(v)||!o.value.some(Q=>Q.serverMessageId===v||Q.id===v))return;Oe.add(v);function U(){return Oe.delete(v)}je(v).then(U,U)};function dt(v=!1){if(j.signal.aborted||r.value!==Y){W=!1;return}if(se){W=!0;return}let U=v?y(Y)??(C()?je():void 0):je();if(!U)return;f(Y),se=U;function Q(ne=!1){if(se===U){if(se=void 0,W){W=!1,dt();return}ne&&m(Y)}}U.then(Q,()=>Q(!1))}let St=p.subscribe(v=>{v<=E.current||(E.current=v,ee&&dt())});return ip({signal:j.signal,now:()=>performance.now(),sleep:v=>vr(v,j.signal),connect:v=>a.connectResumeStream({signal:j.signal,onChunk:Re,onConnected:v}),onInitialBoundaryReady:()=>{ee=!0,dt(!0)},backfill:()=>dt()}),()=>{j.abort(),Se(),St(),B.detach()}},[t,n,r,r.value,s,a,c,u,d,_,p,f,m,g,P,k,S,o,b,h,y,C])}var mh=32;function lp(e){let{transport:t,setStreaming:n}=e,r=$(void 0),o=$(void 0),i=$(!1),a=$(void 0),s=$(!1),c=$(new Map),u=$(new Set),d=N((y,C)=>{let E=`${y}:${C}`;a.current!==E&&(a.current=E,t.cancelTurn(y,C))},[t]),_=N(y=>{r.current=void 0,o.current=y,i.current=!1,a.current=void 0,s.current=!0,n(!0)},[n]),p=N((y,C)=>{c.current.set(y,{messageId:C})},[]),f=N(y=>{y!==void 0&&(u.current.add(y),u.current.size>mh&&u.current.delete(u.current.values().next().value)),!(y!==void 0&&r.current?.runId!==y)&&(r.current=void 0,o.current=void 0,i.current=!1,s.current=!1,n(!1))},[n]),m=N((y,C)=>o.current!==y?C.runId&&r.current?.runId===C.runId?(r.current={conversationId:C.conversationId,runId:C.runId},i.current&&d(C.conversationId,C.runId),!0):!1:(o.current=void 0,C.runId?(r.current={conversationId:C.conversationId,runId:C.runId},n(!0),i.current&&d(C.conversationId,C.runId),!0):(f(),!0)),[d,n,f]),g=N((y,C)=>{let E=c.current.get(y);return E?(c.current.delete(y),!C.runId||u.current.has(C.runId)?!0:E.runId!==void 0?(E.runId!==C.runId||r.current?.runId===C.runId&&(r.current={conversationId:C.conversationId,runId:C.runId},i.current&&d(C.conversationId,C.runId)),!0):(s.current||o.current||(r.current={conversationId:C.conversationId,runId:C.runId},o.current=void 0,i.current=!1,a.current=void 0,s.current=!0,n(!0)),!0)):!1},[d,n]),P=N(y=>o.current!==y?!1:(f(),!0),[f]),k=N(y=>{let C=c.current.get(y);return C?(c.current.delete(y),C.runId===void 0):!1},[]),S=N((y,C,E,Y)=>{let j=C.messageMetadata?.runId;if(C.messageMetadata?.senderRole!==void 0||typeof j!="string"||!j||u.current.has(j))return!1;if(r.current?.runId===j)return s.current;if(s.current)return r.current||!E?!1:(o.current=void 0,r.current={conversationId:y,runId:j},n(!0),i.current&&d(y,j),!0);let B=[...c.current.values()].filter(z=>z.runId===void 0).find(z=>z.messageId===Y);return B?(B.runId=j,r.current={conversationId:y,runId:j},o.current=void 0,i.current=!1,a.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:y,runId:j},n(!0),i.current&&d(y,j),s.current)},[d,n]),h=N(y=>typeof y=="string"&&r.current?.runId===y&&s.current,[]),b=N(()=>{let y=r.current;if(y)return i.current=!0,d(y.conversationId,y.runId),!0;let C=o.current;return C?(i.current=!0,C.then(E=>{E.runId&&d(E.conversationId,E.runId)}).catch(()=>{}),!0):!1},[d]);return de(()=>({localSendRef:s,begin:_,beginRouted:p,acceptAck:m,acceptRoutedAck:g,reject:P,rejectRouted:k,captureStart:S,ownsLocalRun:h,settle:f,stop:b}),[m,g,_,p,S,h,P,k,f,b])}var gh=le.scope("send");function dp(e,t,n,r,o,i=!0){e.publishConversation({...Wo(t,n,r,o,i),hasUnread:!1},!0)}function up(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function pp(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Et(t)))}function qr(e,t,n,r,o){let i=pp(t);i?.role!=="user"||!up(i,n)||dp(e,t,i,r,o)}function cp(e){return!(e instanceof at)||e.code==="network"||e.status===void 0||e.status===202?!0:e.status===408||e.status===425||e.status===429||e.status>=500&&e.status<600}function _p(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:i,feedback:a,persistence:s,visitorId:c,adoptConversationId:u,applyControlState:d,setCanSend:_,settleSuggestions:p,runCancellation:f}=e,m=N(()=>{let k=r.value??vt();return r.value||(r.value=k,s.saveConversationId(k)),k},[r,s]),g=N(async({continueExisting:k,turn:S})=>{let h=m(),b=n.value.at(-1),y=S?[S]:Hc(n.value,k),C=y[0],E=hi({messages:y.map(ji),conversationId:h,visitorId:c,userPrefs:s.loadUserPrefs()}),Y=t.sendTurn(E);f.begin(Y);try{let j=await Y;if(r.value!==h||!f.acceptAck(Y,j))return!1;if(u(j.conversationId),j.runId&&C?.role==="user"&&qr(t,n.value,C,j.conversationId,o.strings.newConversation),!j.runId){let O=await t.loadConversation(j.conversationId).catch(()=>null);if(r.value!==j.conversationId)return!0;if(O){O.controlState&&d(O.controlState),_(O.canContinue);let B=en(O.messages),{messages:z,changed:F}=Ar(n.value,B);F&&(n.value=z);let Z=B.findLast(R=>!R.ephemeral&&R.role!=="system"),L=pp(n.value);L&&Z&&up(L,Z)&&dp(t,n.value,L,j.conversationId,o.strings.newConversation,O.canContinue);let q=b?n.value.find(R=>R.id===b.id&&R.role==="assistant"&&R.status!=="streaming"):void 0;q&&p(q,q.suggestions??[]),!k&&b?.role==="assistant"&&n.value.includes(b)&&b.serverMessageId===void 0&&!Et(b)&&(n.value=n.value.filter(R=>R!==b))}else b?.role==="assistant"&&n.value.includes(b)&&(b.status="error",b.errorText=o.strings.errorGeneric,k?b.retryAction={kind:"continue-assistant",messageId:b.serverMessageId??b.id}:b.retryAction=C?.role==="user"?{kind:"resend-user",messageId:C.id}:null,n.value=[...n.value])}return!0}catch(j){if(r.value!==h)return!1;if(!f.reject(Y))return C?.role==="user"&&qr(t,n.value,C,h,o.strings.newConversation),!0;let O=xn(j,o.strings),B=cp(j),z=S?.role==="assistant"?S:n.value.at(-1);if(k&&z?.role==="assistant"&&j instanceof at&&j.status===409){let F=z.serverMessageId??z.id,Z=await t.loadConversation(h,{ids:[F]}).catch(()=>null);if(r.value!==h)return!1;if(Z){Z.controlState&&d(Z.controlState),_(Z.canContinue);let L=en(Z.messages),q=L.find(R=>(R.serverMessageId??R.id)===F);if(q&&Gc(z,q)){let{messages:R,changed:ue}=Ar(n.value,L),oe=R.find($e=>($e.serverMessageId??$e.id)===F);if(ue&&oe&&oe!==z)return oe.awaitingContinuation=!1,oe.continuationStreaming=void 0,oe.retryAction=null,n.value=R,oe.status!=="streaming"&&p(oe,oe.suggestions??[]),!0}}if(!n.value.includes(z)||z.status!=="streaming")return!1;z.continuationStreaming=!0}if(k&&z?.role==="assistant")z.status="error",z.errorText=O,z.retryAction=B?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(b?.role==="assistant"&&n.value.includes(b)){b.status="error",b.errorText=O;let F=y[0];b.retryAction=B&&F?.role==="user"?{kind:"resend-user",messageId:F.id}:null,n.value=[...n.value]}else{let F=Ht();F.status="error",F.errorText=O;let Z=y[0];F.retryAction=B&&Z?.role==="user"?{kind:"resend-user",messageId:Z.id}:null,n.value=[...n.value,F]}return a.play("error"),i.emit("error",j),o.onError?.(j),!1}},[t,n,o,i,a,s,c,u,d,_,p,m,f]),P=N(async k=>{let S=m();k.status="pending",k.errorText=void 0,k.retryAction=void 0,n.value.includes(k)&&(n.value=[...n.value]);let h=hi({messages:[ji(k)],conversationId:S,visitorId:c,userPrefs:s.loadUserPrefs()}),b=t.sendTurn(h);f.beginRouted(b,k.id);try{let y=await b;return r.value!==S?(f.rejectRouted(b),!1):f.acceptRoutedAck(b,y)?(u(y.conversationId),qr(t,n.value,k,y.conversationId,o.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value])),!0):!1}catch(y){let C=f.rejectRouted(b);if(r.value!==S)return!1;if(!C)return qr(t,n.value,k,S,o.strings.newConversation),k.status==="pending"&&(k.status="complete",n.value.includes(k)&&(n.value=[...n.value])),!0;if(k.status!=="pending")return qr(t,n.value,k,S,o.strings.newConversation),!0;gh.debug("operator-routed send failed",{error:y});let E=y instanceof Error?y:new Error(String(y));return k.status="error",k.errorText=xn(y,o.strings),k.retryAction=cp(y)?{kind:"resend-user",messageId:k.id}:null,n.value.includes(k)&&(n.value=[...n.value]),a.play("error"),i.emit("error",E),o.onError?.(E),!1}},[t,n,o,i,a,s,c,u,m,f]);return{sendAiTurn:g,sendRoutedTurn:P}}var vh=le.scope("unread");function fp(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:i,conversationReady:a}=e,s=wt(!1),c=wt(0),u=$([]),d=$(void 0),_=$(!1),p=N(()=>{let y=r.value,C=o.current()&&d.current===y?y:void 0;s.value=u.current.some(E=>E.hasUnread&&E.conversationId!==C)},[r,s,o]),f=N(y=>{let C=r.value,E=u.current.find(B=>B.conversationId===C),Y=zt(u.current,y),j=Y.find(B=>B.conversationId===C),O=y.type==="snapshot"&&C!==void 0&&j?.hasUnread===!0&&d.current===C&&E!==void 0&&E.lastMessageAt!==j.lastMessageAt;O&&(d.current=void 0),u.current=Y,p(),O&&(c.value+=1)},[r,p,c]),m=N(()=>{if(p(),!o.current())return;let y=r.value;if(!y||d.current!==y)return;let C=u.current.find(E=>E.conversationId===y);C?.hasUnread&&t.markRead(y,C.lastMessageAt)},[r,o,p,t]),g=N(y=>{r.value===y&&(d.current=void 0,p())},[r,p]),P=N(y=>{r.value===y&&(d.current=y,m())},[r,m]),k=N(y=>d.current===y,[]),S=N((y=!1)=>{n.modules.list.some(C=>C.layout==="chat")&&(_.current||(_.current=!0,t.listConversations({limit:50},y).then(C=>{y||f({type:"snapshot",result:C,requestedRevision:0}),m()}).catch(C=>vh.debug("refreshUnread failed (non-fatal)",{err:C})).finally(()=>{_.current=!1})))},[f,m,n.modules,t]),h=N(y=>{let C=y.conversationId,E=o.current()&&r.value===C&&d.current===C,Y=u.current.find(O=>O.conversationId===C),j=E&&(Y?.lastMessageAt!==y.lastMessageAt||Y.hasUnread);t.publishConversation({...y,hasUnread:!E},!0),j&&t.markRead(C,y.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(f),[f,t]);let b=$(!1);return D(()=>{!i||!a||b.current||(b.current=!0,S())},[i,a,S]),D(()=>{if(!i)return;function y(){document.visibilityState==="visible"&&(m(),S(!0))}return document.addEventListener("visibilitychange",y),()=>document.removeEventListener("visibilitychange",y)},[i,m,S]),{hasUnreadSig:s,transcriptRecoverySig:c,markVisibleConversationRead:m,beginConversationTranscript:g,commitConversationTranscript:P,isConversationTranscriptCommitted:k,recordConversationReply:h}}var Hr=le.scope("settings");function mp(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:i,bus:a}=e,s=n.loadUserPrefs(),[c,u]=H(()=>s.locale??t.locale),[d,_]=H(()=>s.themeMode??t.themeMode),[p,f]=H(()=>s.textSize??t.textSize),m=N(b=>{n.patchUserPrefs(b),r.saveUserPrefs(n.loadUserPrefs()).catch(y=>Hr.warn("saveUserPrefs failed",{err:y}))},[n,r]);D(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),D(()=>{i.dataset.theme=d},[i,d,t]),D(()=>{i.dataset.textSize=p},[i,p,t]),D(()=>{let b=!0;return o.mutedSig.subscribe(y=>{if(b){b=!1;return}m({soundMuted:y})})},[o,m]);let g=On(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(g)},[r,g]),D(()=>{i.dir=Ys(g)?"rtl":"ltr"},[i,g]),D(()=>{g!==c&&u(g)},[g,c]);let P=N(b=>{Hr.info("localeChange",{locale:b}),u(b),m({locale:b}),a.emit("localeChange",b)},[m,a]),k=N(b=>{Hr.info("themeChange",{mode:b}),_(b),i.dataset.theme=b,m({themeMode:b}),a.emit("themeChange",b)},[i,m,a]),S=N(b=>{Hr.info("textSizeChange",{size:b}),f(b),i.dataset.textSize=b,m({textSize:b}),a.emit("textSizeChange",b)},[i,m,a]),h=N(()=>{o.toggleMuted();let b=o.mutedSig.value;Hr.info("soundToggle",{muted:b}),a.emit("soundToggle",{muted:b})},[o,a]);return{activeLocale:c,activeThemeMode:d,activeTextSize:p,effectiveLocale:g,setActiveLocale:u,setActiveThemeMode:_,setActiveTextSize:f,patchAndSync:m,handleLocaleChange:P,handleThemeChange:k,handleTextSizeChange:S,handleSoundToggle:h}}var Le=le.scope("app"),Ca=T.cssPrefix;function gp(e,t){return qc({...e,text:_t(t,e.text)})}function vp({options:e,hostElement:t,bus:n}){let r=e.aiAgentDeploymentId;if(!r)throw new Error("aiAgentDeploymentId is required");let[o]=H(()=>Nn(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=H(()=>o.getVisitorId()),a=o.loadUserPrefs(),s=wt(o.loadConversationId()),c=$(s.value!==void 0),u=wt(s.value??""),d=wt([]),[_,p]=H(!1),f=$(void 0),[m,g]=H([]);function P(){let x=e.modules.list,I=new Set(x.map(K=>K.id)),re=o.loadActiveModule();return re&&I.has(re)?re:x[0]?.id??""}function k(){return e.modules.list.find(x=>x.layout==="chat")?.id}function S(){let x=k();return x?e.modules.list.length===1?!0:b.sig.value.activeTab===x:!1}let h=$(void 0);if(!h.current){let x=e.modules.list.map(re=>re.id),I=o.loadActiveModule()??x[0]??"";h.current=Tu(I,I?[...x,I]:x,re=>o.saveActiveModule(re))}let b=h.current,y=ht(()=>b.sig.value.activeTab).value,C=ht(()=>s.value).value,[E,Y]=H(!1),[j,O]=H(null),[B,z]=H(!1),F=e.mode==="standalone"||e.mode==="inline",Z=$(gr(e,Fn(),o.loadPanelOpen(),o.loadPanelSize())),[L,q]=H(Z.current.panelOpen),[R,ue]=H(Z.current.panelOpen),oe=$(void 0),$e=$(void 0),te=$(!1),se=$(void 0);D(()=>{L&&ue(!0)},[L]);let W=$(!1),[ee,Be]=H(!1),{dismissed:xe,dismissCallout:he}=Ju({callout:e.launcher.callout,persistence:o}),Se=e.launcher.callout?.persistent??!0,Ye=N(()=>{Le.info("calloutDismiss"),n.emit("calloutDismiss",void 0),he()},[n,he]),[Ae,Pe]=H(Z.current.panelSize),Fe=$(!1),[pe,Re]=H("chat"),je=$(()=>!1);je.current=()=>L&&pe==="chat"&&!document.hidden&&S();let[Oe,dt]=H(!0),St=$(Oe);St.current=Oe;let[v,U]=H(!1),Q=$(v);Q.current=v;let ne=$(null),[fe,Ee]=H(!1),[Me,ke]=H(null),[nt,me]=H([]),lt=$(e.strings),M=$(e);M.current=e;let[X,J]=H(void 0),[ge,rt]=H(void 0),[kt,Mt]=H(()=>o.loadSidebarCollapsed()??!1),[ut,sn]=H({}),[ye]=H(()=>new To({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:Yl({publicKey:e.publicKey,aiAgentDeploymentId:r,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints})),[yt]=H(()=>new Zo(e.sound,e.haptics)),jt=lp({transport:ye,setStreaming:U}),{activeLocale:Vr,activeThemeMode:bs,activeTextSize:ys,effectiveLocale:wn,setActiveLocale:kp,setActiveThemeMode:wp,setActiveTextSize:Cp,patchAndSync:Ps,handleLocaleChange:Rp,handleThemeChange:Ip,handleTextSizeChange:Tp,handleSoundToggle:Ap}=mp({options:e,persistence:o,transport:ye,feedback:yt,hostElement:t,bus:n}),{controlModeSig:Lt,assignedOperatorInitialsSig:Ep,operatorAvailableSig:Mp,applyControlState:Jn,adoptControlStateChunk:Lp,requestOperator:Op,cancelOperatorRequest:Np}=Zu({transport:ye,conversationIdSig:s}),Wt=wt(new Map),$p=N(x=>{if(x.type!=="data-memory-compaction-state")return;let I=s.value;if(!I)return;let re=ac(x.data);if(!re)return;let K=Wt.value.get(I);if(K&&(re.postFinishSequence<K.postFinishSequence||re.postFinishSequence===K.postFinishSequence&&(K.status==="ready"||K.status===re.status)))return;let _e=new Map(Wt.value);_e.set(I,re),Wt.value=_e},[s,Wt]),{hasUnreadSig:Dp,transcriptRecoverySig:Bp,markVisibleConversationRead:xs,beginConversationTranscript:Aa,commitConversationTranscript:Cn,isConversationTranscriptCommitted:Ss,recordConversationReply:Fp}=fp({transport:ye,options:e,conversationIdSig:s,isConversationVisibleRef:je,activated:R,conversationReady:E});D(()=>{xs()},[y,L,pe,C,xs]),D(()=>{yt.update(e.sound,e.haptics)},[yt,e.sound,e.haptics]),D(()=>()=>yt.destroy(),[yt]),D(()=>{Fe.current||!e.size.initialSize||(Fe.current=!0,!o.loadPanelSize()&&Pe(vi(e.mode,e.size,Fn())))},[e.mode,e.size,o]),D(()=>{if(!E||W.current)return;W.current=!0;let x=gr(e,Fn(),o.loadPanelOpen(),o.loadPanelSize());q(x.panelOpen),Pe(x.panelSize)},[E,e,o]);let Ea=$(null);D(()=>{E&&b.reconcile(e.modules.list.map(x=>x.id),P())},[E,e.modules.list,b]);let jr=N(x=>{!x||x.length===0||(d.value=x.map(I=>gp(I,lt.current)))},[d]),Ma=$(null),Wr=N(async x=>{try{let{formSubmissions:I}=await(x?ye.bootstrap(x):Ma.current??ye.bootstrap()),re=new Map;return I.forEach((K,_e)=>re.set(K.formId,_e)),I.filter((K,_e)=>!K.skipped||re.get(K.formId)===_e).map((K,_e)=>({key:`wire:${K.formId}:${K.createdAt??_e}`,formId:K.formId,outcome:K.skipped?"skipped":"submitted",createdAt:tc(K.createdAt),values:K.values}))}catch(I){return Le.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[ye]),Zn=$(0),$t=$(0),La=N(x=>{if(x===s.value)return;let I=s.value;$t.current++,p(!1),I&&(o.saveDraft(x,o.loadDraft(I)),o.saveDraft(I,""),o.saveMessageQueue(x,o.loadMessageQueue(I)),o.saveMessageQueue(I,[])),s.value=x,o.saveConversationId(x),ye.primeIdentity(void 0,x),Le.info("conversation rebound",{previous:I,current:x}),I&&n.emit("conversationRebound",{previous:I,current:x})},[n,s,o,ye]),Gr=N((x,I)=>{let re=[...x.map(G=>G.createdAt),...I.map(G=>G.createdAt)].filter(G=>G!==void 0),K=(re.length?Math.min(...re):Date.now())-1;return[...(se.current?.messages??[]).map(G=>{let ce=gp(G,lt.current);return ce.createdAt=K,ce}),...x]},[]),ks=N(async x=>{let I=$t.current;function re(){return I!==$t.current||s.value!==x}$e.current===x&&($e.current=void 0),p(!0);try{let[K,_e]=await Promise.all([ye.loadConversation(x),Wr()]);if(re())return!1;let G=en(K.messages);g(_e);let ce=Gr(Ki(G,d.value),_e);if(d.value=ce,$e.current=ce.some(De=>De.role==="user")?void 0:x,G.length>0||K.controlState!==void 0){dt(K.canContinue),K.controlState&&Jn(K.controlState);let De=G.findLast(pt=>pt.role==="assistant"&&!pt.ephemeral);me(De?.suggestions??[])}return!0}catch(K){return re()||(Le.warn("loadThread failed; keeping conversation active",{err:K,conversationId:x}),n.emit("error",K),M.current.onError?.(K)),!1}finally{re()||p(!1)}},[ye,Wr,d,s,Gr,n]),Up=N(x=>{if(oe.current===x)return oe.current=void 0,ks(x)},[ks]),zp=N(()=>{if(f.current)return Promise.resolve(void 0);let x=s.value,I=d.value.find(ce=>ce.serverMessageId!==void 0),re=I?.serverMessageId,K=I?new Date(I.createdAt).toISOString():void 0;if(!x||!re||!K)return Promise.resolve(void 0);let _e=$t.current,G={};return f.current=G,(async()=>{try{let ce=await ye.loadConversation(x,{beforeId:re,beforeCreatedAt:K});if(f.current!==G||$t.current!==_e||s.value!==x)return;if(ce.messages.length===0)return!1;let Ne=ce.messages.map(Vi),De=d.value,pt=jc(De,Ne);if(pt!==De){let Dt=Math.min(...Ne.map(gt=>gt.createdAt??1/0),...m.map(gt=>gt.createdAt??1/0));if(Number.isFinite(Dt))for(let gt of De){if(!gt.ephemeral)break;(gt.createdAt??1/0)>=Dt&&(gt.createdAt=Dt-1)}d.value=pt}return!0}catch(ce){if(f.current!==G||$t.current!==_e||s.value!==x)return;Le.warn("load previous messages failed",{err:ce,conversationId:x,beforeId:re}),n.emit("error",ce),e.onError?.(ce);return}finally{f.current===G&&(f.current=void 0)}})()},[n,s,m,d,e,ye]),er=N(async({newConversation:x})=>{let I=++Zn.current;function re(){return I!==Zn.current}let K=s.value,_e=x||!K?vt():K;_e!==K&&($t.current++,p(!1),Rt(()=>{s.value=_e,u.value=_e}),o.saveConversationId(_e)),ye.primeIdentity(i,_e);let G;try{G=await ye.handshake({visitorId:i,conversationId:_e,userPrefs:o.loadUserPrefs(),locale:Vr})}catch(De){if(re())return;n.emit("error",De),e.onError?.(De),x||Y(!0);return}if(re())return;G.conversationId!==_e&&La(G.conversationId),ke(G.agent),e.mode==="page"&&(G.site&&Kl(G.site)?J(G.site):G.site&&Le.warn("invalid site config, using fallback",{site:G.site}),G.blocks&&Ql(G.blocks)?rt(G.blocks):G.blocks&&Le.warn("invalid blocks config, using fallback",{blocks:G.blocks}));let ce=li(G.userPrefs);if(Object.keys(ce).length>0&&!x&&(o.saveUserPrefs(ce),ce.locale&&kp(ce.locale),ce.soundMuted!==void 0&&yt.setMuted(ce.soundMuted),ce.themeMode&&wp(ce.themeMode),ce.textSize&&Cp(ce.textSize)),se.current=G.welcome,x||n.emit("handshake",G),G.welcome?.suggestions){let De=lt.current;me(G.welcome.suggestions.map(pt=>({...pt,label:_t(De,pt.label),...pt.text===void 0?{}:{text:_t(De,pt.text)}})))}let Ne=!x&&K&&G.conversationId===K;c.current=!!Ne,Ne?te.current||(oe.current=G.conversationId):($e.current=G.conversationId,jr(G.welcome?.messages),Cn(G.conversationId)),x||Y(!0)},[ye,i,o,e,n,s,u,yt,jr,Vr,La,Cn]),tr=JSON.stringify(e.userContext??null),qp=JSON.stringify(e.pageContext??null),Hp=JSON.stringify(ut);D(()=>{let x=Object.keys(ut).length?{...ut,...e.userContext}:e.userContext;ye.setContext(x,hh(e.pageContext))},[ye,tr,qp,Hp]);let ws=N((x,I=[])=>me(x.suggestions??I),[]);D(()=>(ye.primeIdentity(i,s.value),er({newConversation:!1}),()=>{Zn.current++,$t.current++}),[]),D(()=>{!R||!E||te.current||(te.current=!0,Ma.current=ye.bootstrap(),(async()=>{try{let x=await Ma.current;O(ir((x??{forms:[]}).forms,wn))}catch(x){Le.debug("bootstrap failed \u2014 treating as no forms",{err:x})}finally{z(!0)}})(),oe.current===s.value&&p(!0))},[R,E]);let nr=$(null);D(()=>{if(!R||!E||(nr.current??(nr.current=wn),nr.current===wn))return;nr.current=wn;let x=!1;return ye.bootstrap().then(I=>{x||O(ir((I??{forms:[]}).forms,wn))}).catch(I=>Le.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{x=!0}},[R,E,wn,ye]);let Cs=$(tr);D(()=>{!E||Cs.current===tr||(Cs.current=tr,er({newConversation:!1}))},[tr,E,er]),np({hostElement:t,mode:e.mode,panelSize:Ae,isOpen:L,surfaceReady:E,setIsOpen:q});let{sendAiTurn:Gt,sendRoutedTurn:Rn}=_p({transport:ye,messagesSig:d,conversationIdSig:s,options:e,bus:n,feedback:yt,persistence:o,visitorId:i,adoptConversationId:La,applyControlState:Jn,setCanSend:dt,settleSuggestions:ws,runCancellation:jt}),{toolInteraction:Vp}=Xu({streaming:v,controlModeSig:Lt,messagesSig:d,sendAiTurn:Gt,bus:n,humanInLoop:e.features.humanInLoop}),jp=N((x,I)=>{let re=d.value.find(K=>K.serverMessageId===x);re&&(re.feedback=I),Le.info("messageFeedback",{messageId:x,value:I}),n.emit("messageFeedback",{messageId:x,value:I}),ye.submitFeedback({messageId:x,value:I})},[n,d,ye]);function Wp(){return d.value.reduce((x,I)=>x+(I.role==="user"?1:0),0)}let In=e.forms.list.length>0?e.forms:j??e.forms,Ve=ku({forms:In,persistence:o,userContext:()=>e.userContext,messageCount:Wp,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>s.value,onComplete:(x,I,re,K)=>{Le.info("formSubmit",{formId:x.id,trigger:I,skipped:K}),n.emit("formSubmit",{formId:x.id,values:re,skipped:K}),g(G=>{let Ne=G.find(De=>De.formId===x.id&&De.outcome==="skipped")?.createdAt??Date.now();return[...G.filter(De=>!(De.formId===x.id&&De.outcome==="skipped")),{key:`local:${x.id}:${Ne}`,formId:x.id,outcome:K?"skipped":"submitted",createdAt:Ne,...K?{}:{values:re}}]});let _e=s.value??vt();s.value||(s.value=_e,o.saveConversationId(_e),ye.primeIdentity(void 0,_e)),!K&&x.mirrorToContext&&sn(G=>({...G,...re})),ye.submitForm({formId:x.id,conversationId:_e,trigger:I,values:re,skipped:K})}}),Kr=ht(()=>Ve.activeForm.value),Gp=N(()=>Ve.fire("after-messages"),[Ve]),Kp=N(()=>c.current||d.value.some(x=>!x.ephemeral&&x.role==="user"),[d]);sp({activated:R,conversationReady:E,conversationIdSig:s,messagesSig:d,optionsRef:M,transport:ye,visitorId:i,adoptControlStateChunk:Lp,adoptMemoryCompactionStateChunk:$p,settleSuggestions:ws,recordConversationReply:Fp,transcriptRecoverySig:Bp,beginConversationTranscript:Aa,commitConversationTranscript:Cn,onReplyLanded:Gp,runCancellation:jt,canContinueRef:St,setCanSend:dt,feedback:yt,bus:n,loadInitialThread:Up,shouldReconcileOnConnect:Kp}),D(()=>{Ve.refresh()},[In,Ve]);let Rs=e.pageContext?.area?String(e.pageContext.area):void 0,Qp=ht(()=>d.value.length);D(()=>{E&&B&&Ve.fire("pre-chat")},[E,B,Ve]),D(()=>{B&&!Oe&&Ve.fire("conversation-closed")},[B,Oe,Ve]),D(()=>{E&&B&&Rs&&Ve.fire("page-area")},[E,B,Rs,Ve]);let Oa=de(()=>{let x=In.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return x.length?Math.min(...x)*1e3:0},[In]);D(()=>{if(!Oa||!L)return;let x=setTimeout(()=>Ve.fire("idle"),Oa);return()=>clearTimeout(x)},[Oa,L,Ve,Qp.value]);let Is=N(async(x,I,re)=>{if(ne.current)return!1;let K=s.value,_e=K?Wt.value.get(K):void 0,G=Lt.value!=="ai-agent";if(!G&&_e?.status==="compacting"||(Le.info("send",{textLen:x.length,attachments:I.length,streaming:Q.current,routedToOperator:G}),Q.current&&!G))return!1;let ce=new AbortController,Ne={conversationId:K,controller:ce};ne.current=Ne,Ee(!0);try{yt.unlock();let De=await yh(ye,I,ce.signal,Kt=>{ce.signal.aborted||(Le.warn("upload failed",{err:Kt}),n.emit("error",Kt),e.onError?.(Kt))});if(ce.signal.aborted||s.value!==K||!St.current||Ve.activeForm.value)return!1;let pt=K?Wt.value.get(K):void 0,Dt=Lt.value!=="ai-agent";if(!Dt&&pt?.status==="compacting"||Q.current&&!Dt||!x&&De.length===0)return!1;n.emit("send",{text:x,attachmentCount:I.length}),nt.length>0&&me([]),yt.play("messageSent");let gt=Hi(x,De,re);return Xn(n,e,"user",x),Dt?(d.value=[...d.value,gt],re?await Rn(gt):(Rn(gt),!0)):(d.value=[...d.value,gt,Ht()],re?await Gt({continueExisting:!1}):(Gt({continueExisting:!1}),!0))}finally{ne.current===Ne&&(ne.current=null,Ee(!1))}},[ye,n,e,nt.length,d,s,Wt,Gt,Rn,Lt]),Ts=s.value,Yp=(Ts?Wt.value.get(Ts):void 0)?.status==="compacting",As=Lt.value==="ai-agent",Es=ht(()=>{let x=d.value.at(-1);return x?.role==="assistant"&&x.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),Ms=ht(()=>d.value.some(x=>x.retryAction?.kind==="resend-user"||x.retryAction?.kind==="continue-assistant"));Pt(()=>{let x=s.value;return()=>{let I=ne.current;!I||I.conversationId!==x||(ne.current=null,Ee(!1),I.controller.abort())}},[s.value]),D(()=>{Oe&&!Kr.value||ne.current?.controller.abort()},[Kr.value,Oe]);let Xp=N(()=>{if(!jt.stop())return;Le.info("stop"),n.emit("stop",void 0);let x=d.value.at(-1);x&&x.role!=="user"&&x.status==="streaming"&&(x.canceled=!0,d.value=[...d.value])},[jt,n,d]),Jp=N(x=>{if(v)return;let I=d.value,re=Yo(I,x);if(re)switch(Le.info("retry",{kind:re.kind,messageId:re.messageId}),re.kind){case"continue-assistant":{if(Lt.value!=="ai-agent"||x.role!=="assistant"||(x.serverMessageId??x.id)!==re.messageId)return;x.status="streaming",x.errorText=void 0,x.retryAction=void 0,x.awaitingContinuation=!0,d.value=[...I],Gt({continueExisting:!0,turn:x});return}case"resend-user":{let K=I.find(ce=>ce.role==="user"&&ce.id===re.messageId);if(!K)return;let _e=ce=>{ce&&Ea.current?.acceptQueuedMessage(re.messageId)};if(K.status="complete",K.errorText=void 0,K.retryAction=void 0,Lt.value!=="ai-agent"){d.value=x.role==="assistant"?I.filter(ce=>ce!==x):[...I],Rn(K).then(_e);return}let G=Ht();d.value=x.role==="assistant"?I.map(ce=>ce===x?G:ce):[...I,G],Gt({continueExisting:!1,turn:K}).then(_e);return}case"repeat-user":{let K=I.find(Ne=>Ne.role==="user"&&Ne.id===re.messageId);if(!K)return;let _e=Hi(Ke(K),K.attachments?.map(Ne=>({...Ne}))??[]),G=new Set(_e.attachments?.flatMap(Ne=>Ne.url?[Ne.url]:[])??[]),ce=K.partsSig.value.flatMap(Ne=>Ne.kind==="file"&&!G.has(Ne.url)?[{...Ne}]:[]);if(ce.length>0&&(_e.partsSig.value=[..._e.partsSig.value,...ce]),Lt.value!=="ai-agent"){d.value=[...I,_e],Rn(_e);return}d.value=[...I,_e,Ht()],Gt({continueExisting:!1,turn:_e});return}default:return re}},[v,d,Lt,Gt,Rn]),rr=N(()=>{if(Bd(e.mode,Ae)==="exit-fullscreen"){Le.info("close \u2192 exit-fullscreen",{mode:e.mode}),Pe("normal"),n.emit("fullscreen",!1);return}Le.info("close \u2192 panel closed",{mode:e.mode}),Ve.fire("panel-close"),q(!1),o.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,o,Ae,Ve]),Na=N(()=>{Le.info("open",{mode:e.mode}),yt.unlock(),Be(!0),q(!0),o.savePanelOpen(!0),!xe&&!Se&&Ye(),setTimeout(()=>Be(!1),bh),n.emit("open",void 0),e.onOpen?.()},[n,e,yt,o,xe,Se,Ye]),$a=N(()=>{let x=d.value.some(I=>I.role==="user");if($e.current===s.value&&!x&&Oe&&s.value){Le.info("clear \u2192 reusing empty conversation",{conversationId:s.value}),d.value.length===0&&jr(se.current?.messages);return}Le.info("clear \u2192 new conversation",{wasStreaming:v}),n.emit("clear",void 0),jt.settle(),c.current=!1,oe.current=void 0,$e.current=void 0,Rt(()=>{d.value=[],s.value=void 0,Jn({controlMode:"ai-agent",controlRevision:0})}),o.clearConversation(),dt(!0),g([]),me([]),er({newConversation:!0})},[v,d,s,o,er,n,Oe,jr,jt,Jn]),Da=N(()=>{$a(),Re("chat");let x=e.modules.list.find(I=>I.layout==="chat")?.id;x&&b.switchTab(x)},[$a,b,e]),Ba=N(()=>{let x=Ae==="expanded"?"normal":"expanded";Le.info("expand",{from:Ae,expanded:x==="expanded"}),Pe(x),o.savePanelSize(x),n.emit("expand",x==="expanded")},[n,Ae,o]),Fa=N(()=>{let x=Ae==="fullscreen"?"normal":"fullscreen";Le.info("fullscreen",{from:Ae,fullscreen:x==="fullscreen"}),Pe(x),o.savePanelSize(x),n.emit("fullscreen",x==="fullscreen")},[n,Ae,o]),Zp=N(()=>{Re(x=>{let I=x==="history"?"chat":"history";return Le.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),e_=N(()=>{Mt(x=>{let I=!x;return Le.info("sidebarToggle",{collapsed:I}),o.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[o,n]),t_=N(x=>{Le.info("resize",x),Ps({widgetSize:x}),n.emit("resize",x)},[Ps,n]),n_=N(async x=>{let I=x.conversationId;if(I===s.value&&Ss(I)){Le.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),ye.publishConversation(x),Re("chat");let G=k();G&&b.switchTab(G),Cn(I);return}let K=++Zn.current;$t.current++,p(!1);function _e(){return K!==Zn.current}Le.info("selectConversation",{conversationId:I,wasStreaming:v}),n.emit("selectConversation",{conversationId:I}),ye.publishConversation(x);try{let[G,ce]=await Promise.all([ye.loadConversation(I),Wr(I)]);if(_e())return;jt.settle(),c.current=!0,oe.current=void 0;let Ne=en(G.messages),De=G.conversationId!==s.value,pt=De?Ne:Ki(Ne,d.value);$e.current=pt.some(Kt=>Kt.role==="user")?void 0:G.conversationId,Rt(()=>{d.value=Gr(pt,ce),De&&(u.value=G.conversationId),s.value=G.conversationId}),g(ce),o.saveConversationId(G.conversationId),ye.primeIdentity(i,G.conversationId),dt(G.canContinue),G.controlState&&Jn(G.controlState);let Dt=pt.findLast(Kt=>Kt.role==="assistant"&&!Kt.ephemeral);me(Dt?.suggestions??[]),De?Aa(G.conversationId):Cn(G.conversationId),Re("chat");let gt=k();gt&&b.switchTab(gt)}catch(G){if(_e())return;n.emit("error",G),e.onError?.(G)}},[ye,d,s,u,n,e,o,Wr,Gr,v,i,jt,Aa,Cn,Ss,b]),Qr=$(null),Ls=N(x=>{typeof x=="string"&&(B?Ve.fire("manual",x):Qr.current=x)},[B,Ve]);D(()=>{!B||!Qr.current||(Ve.fire("manual",Qr.current),Qr.current=null)},[B,Ve]);let Tn=$({handleOpen:Na,handleClose:rr,handleExpand:Ba,handleFullscreen:Fa,openForm:Ls});Tn.current={handleOpen:Na,handleClose:rr,handleExpand:Ba,handleFullscreen:Fa,openForm:Ls},Pt(()=>pl(t,{open:()=>Tn.current.handleOpen(),close:()=>Tn.current.handleClose(),expand:()=>Tn.current.handleExpand(),fullscreen:()=>Tn.current.handleFullscreen(),openForm:x=>Tn.current.openForm(x)}),[t]);let ct=de(()=>ii(e,Vr,bs,ys),[e,Vr,bs,ys]);lt.current=ct.strings;let r_=de(()=>m.map(x=>{let I=In.list.find(re=>re.id===x.formId);return{...x,title:I?.title,form:I}}),[m,In]);function Ua(x){n_(x)}let Os={options:ct,transport:ye,feedback:yt,bus:n,persistence:o,conversationId:s.value??"",composerKey:u.value,composerApiRef:Ea,view:pe,canSend:Oe,isStreaming:v,isMemoryCompacting:Yp,canReleaseQueuedMessages:E&&!_&&!Kr.value&&(!As||!Es.value&&!Ms.value),queueManualMessages:As&&(Es.value||Ms.value),sendPreparing:fe,composerActive:ct.mode==="page"||ct.mode==="inline"||ct.mode==="standalone"||L,controlMode:Lt.value,assignedOperatorInitials:Ep.value,operatorAvailable:Mp.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:Op,onCancelOperatorRequest:Np,loadingMessages:_,onLoadPreviousMessages:zp,messagesSig:d,agent:Me,suggestions:nt,initialWidgetSize:a.widgetSize??null,onClose:rr,onClear:$a,onExpand:Ba,onFullscreen:Fa,onSoundToggle:Ap,onToggleHistory:Zp,onSelectHistoryConversation:Ua,onNewConversation:Da,onLocaleChange:Rp,onThemeChange:Ip,onTextSizeChange:Tp,onWidgetSizeChange:t_,onSend:Is,onStop:Xp,onSuggestion:x=>{if(ne.current)return;let I=x.text??x.label;Le.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?Is(I,[]):Ea.current?.fill(I)},activeForm:Kr.value?.form??null,formMarkers:r_,onFormSubmit:Ve.complete,onFormSkip:Ve.skip,onFormFill:x=>Ve.fire("manual",x),tool:Vp,onRetry:Jp,onMessageFeedback:jp};if(!E)return null;let or=ct.modules.list;function za(x){let I=Vn("close",ct.mode,x);return or.length===0?l(Yu,{strings:ct.strings,onClose:I?rr:void 0}):or.length===1&&or[0]?.layout==="chat"?l(Su,{...Os,panelSize:x}):l(Qu,{panelProps:{...Os,panelSize:x,onClose:I?rr:void 0},enabledModules:or,nav:b,bus:n,hasUnread:Dp.value,onSelectConversation:Ua,onStartNewConversation:Da,onSetPanelSize:Pe})}if(e.mode==="page"){let x=or.some(I=>I.layout==="chat");return l("div",{class:`${Ca}-anchor`,children:l(Ru,{site:X,blocks:ge,transport:ye,strings:ct.strings,locale:ct.locale,persistence:o,showConversations:x,onSelectConversation:Ua,onNewConversation:Da,sidebarCollapsed:kt,onToggleSidebarCollapsed:e_,children:za("fullscreen")})})}if(F){let x=e.mode==="standalone"?"fullscreen":Ae;return l("div",{class:`${Ca}-anchor`,children:za(x)})}let Ns=e.mode==="drawer",$s=!(e.mode==="modal")&&!e.launcher.hidden&&(!L||ee),Ds=$s&&!ee&&!xe&&!Ns?ct.launcher.callout:null;return l("div",{class:`${Ca}-anchor`,"data-launcher-size":ct.launcher.size,children:[L||R?l("div",{class:`${Ca}-surface`,hidden:!L,children:za(Ae)}):null,$s?l(Nd,{onToggle:Na,launcher:ct.launcher,strings:ct.strings,leaving:ee,edgeTab:Ns}):null,Ds?l($d,{callout:Ds,launcherPosition:ct.position,strings:ct.strings,closeLabel:ct.strings.close,onDismiss:Ye}):null]})}function hh(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var bh=120;async function yh(e,t,n,r){return(await Promise.all(t.map(async i=>{try{let{id:a,url:s}=await e.uploadFile(i.file,n);return{id:a,name:i.name,mediaType:i.mediaType,size:i.size,url:s}}catch(a){r(a);return}}))).filter(i=>i!==void 0)}var Ph=le.scope("error-boundary"),Ra=class extends Ct{constructor(){super(...arguments);ve(this,"state",{crashed:!1})}componentDidCatch(n,r){Ph.error("widget render crashed",{error:n,componentStack:r?.componentStack}),this.setState({crashed:!0}),this.props.onError(n,r?.componentStack)}render(){return this.state.crashed?this.props.fallback:this.props.children}};var xh="1",Sh=60,kh=2e3,hp={open:()=>{},close:()=>{},expand:e=>({on:e}),fullscreen:e=>({on:e}),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}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,tags:e.tags,count:e.count}),contentOpen:e=>({contentId:e.contentId,tags:e.tags}),contentSearch:e=>({qlen:e.queryLength,hits:e.hitCount}),contentRead:e=>({contentId:e.contentId}),contentLinkClick:e=>({contentId:e.contentId}),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 wh(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Ch(){return location.origin+location.pathname}function Rh(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function bp(e,t){let n=Math.random(),r=0,o=0,i=new Set;function a(c,u){let{tracking:d,publicKey:_,aiAgentDeploymentId:p,mode:f,themeMode:m}=t.getOptions();if(!d.enabled||wh()||n>=d.sampleRate)return;let g=performance.now();if(g-r>6e4&&(r=g,o=0),++o>Sh)return;let P=new URLSearchParams;P.set("v",xh),P.set("_ev",En),P.set("e",c),d.token&&P.set("tk",d.token),_&&P.set("pk",_),p&&P.set("dep",p),P.set("vid",t.getVisitorId());let k=t.getConversationId();k&&P.set("cid",k),P.set("url",Ch());let S=Rh();S&&P.set("ref",S),P.set("sw",String(screen.width)),P.set("sh",String(screen.height)),P.set("vw",String(innerWidth)),P.set("vh",String(innerHeight)),P.set("dpr",String(devicePixelRatio)),P.set("lang",navigator.language);try{P.set("tz",Intl.DateTimeFormat().resolvedOptions().timeZone)}catch{}if(P.set("m",f),P.set("th",m),u)for(let[C,E]of Object.entries(u))E!==void 0&&P.set(C,String(E));P.set("ts",String(Date.now()));let h=`${d.endpoint}?${P}`;if(h.length>kh)return;let b=new Image(1,1);i.add(b);function y(){return i.delete(b)}b.addEventListener("load",y,{once:!0}),b.addEventListener("error",y,{once:!0}),b.src=h}let s=Object.keys(hp).map(c=>e.on(c,u=>a(c,hp[c]?.(u))));return()=>{for(let c of s)c();i.clear()}}function yp(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:i}=e,a=e.initialRaw,s,c=Ln(a),u=!0;function d(){c=Ln(s?si(a,s):a)}function _(){Pl(n,lr(c.mode));let m=o.loadUserPrefs().themeMode;xl(n,m?{...c,themeMode:m}:c),u&&(go(n,Ia(c)),u=!1)}function p(){_(),Xt(An(Ra,{onError:i},An(vp,{bus:t,hostElement:n,options:c})),r)}t.on("handshake",m=>{m.config&&(m.config.storageVersion&&o.rememberStorageVersion(m.config.storageVersion),s=m.config,d(),p())});let f=bp(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});return{getOptions:()=>c,getUserOptions:()=>a,render:p,setUserOptions:m=>{a=m,d(),p()},patchUserOptions:m=>{a={...a,...m},d(),p()},destroy:()=>f()}}function Ia(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=Nn(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=gr(e,Fn(),t.loadPanelOpen(),t.loadPanelSize());return wo(e.mode,r,n)}var Ih=le.scope("hooks"),Ta="*",hs=new Set;function Pp(e,t,n){let r={widgetId:e,event:t,listener:n};return hs.add(r),()=>{hs.delete(r)}}function Th(e,t,n){let r=[...hs];for(let o of r)if(Ah(o.widgetId,e.widgetId)&&!(o.event!==Ta&&o.event!==t))try{o.listener(e,t,n)}catch(i){Ih.warn("hook listener threw",{event:t,error:i})}}function xp(e,t){let n=[];for(let r of Eh)n.push(t.on(r,o=>{Th(e,r,o)}));return()=>{for(let r of n)r()}}function Ah(e,t){return e===Ta||e===t}var Eh=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound"];var Vt=new Map;function Sp(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&uo(e.debug);let t=le.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Ln(e),r=n.widgetId,o=Vt.get(r);o&&(t.debug("destroy existing instance at slot",{widgetId:r}),o.destroy());let i=Ia(n),a=n.iframe?wl({position:lr(n.mode)},n.position,i,n.mode,e.target??null):mo({position:lr(n.mode),target:e.target??null});a.hostElement.dataset.widgetId=r;let s=new ho,c=Nn(r,n.storage,n.aiAgentDeploymentId);function u(g){s.emit("error",g),d.getOptions().onError?.(g)}let d=yp({bus:s,host:a.hostElement,appRoot:a.appRoot,persistence:c,initialRaw:e,reportError:u});d.render();let _=a.hostElement,p=null;function f(g){g.debug!==void 0&&uo(g.debug),d.patchUserOptions(g)}let m={widgetId:r,open:()=>sr(_,"open"),close:()=>sr(_,"close"),expand:()=>sr(_,"expand"),openForm:g=>sr(_,"openForm",g),on:(g,P)=>s.on(g,P),update:g=>{t.debug("update",{patch:g}),f(g)},setUserContext:g=>{t.debug("setUserContext",{keys:Object.keys(g)}),f({userContext:{...d.getUserOptions().userContext,...g}})},clearUserContext:()=>{t.debug("clearUserContext"),f({userContext:void 0})},setPageContext:g=>{t.debug("setPageContext",{keys:Object.keys(g)}),f({pageContext:{...d.getUserOptions().pageContext,...g}})},clearPageContext:()=>{t.debug("clearPageContext"),f({pageContext:void 0})},setDebug:g=>{uo(g),t.info("debug level set",{level:ei()})},debugLevel:()=>ei(),onLog:g=>nl(g),destroy:()=>{t.info("destroy",{widgetId:r}),p?.(),d.destroy(),s.clear(),Xt(null,a.appRoot),a.destroy(),Vt.get(r)===m&&Vt.delete(r)}};return p=xp(m,s),Vt.set(r,m),m}function Mh(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=Vt.get(t);return n?(n.update(e),n):Sp(e)}function Lh(e){if(e!==void 0){Vt.get(e)?.destroy();return}let t=[...Vt.values()];for(let n of t)n.destroy()}function Oh(e="default"){return Vt.get(e)??null}function Nh(){return[...Vt.values()]}function $h(e,t,n){return Pp(e,t,n)}var Dh=En,Bh=T;
|
|
42
61
|
//# sourceMappingURL=elements.cjs.js.map
|