@helpai/elements 1.13.0 → 1.13.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/elements.cjs.js CHANGED
@@ -1,14 +1,14 @@
1
- "use strict";var Lo=Object.defineProperty;var qf=Object.getOwnPropertyDescriptor;var zf=Object.getOwnPropertyNames;var jf=Object.prototype.hasOwnProperty;var Vf=(e,t,n)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wf=(e,t)=>{for(var n in t)Lo(e,n,{get:t[n],enumerable:!0})},Gf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zf(t))!jf.call(e,o)&&o!==n&&Lo(e,o,{get:()=>t[o],enumerable:!(r=qf(t,o))||r.enumerable});return e};var Kf=e=>Gf(Lo({},"__esModule",{value:!0}),e);var ce=(e,t,n)=>Vf(e,typeof t!="symbol"?t+"":t,n);var cP={};Wf(cP,{HOOK_WILDCARD:()=>gi,brand:()=>lP,destroy:()=>rP,getAllInstances:()=>aP,getInstance:()=>oP,hook:()=>iP,init:()=>nP,mount:()=>of,resolveInitialHostMode:()=>mi,version:()=>sP});module.exports=Kf(cP);var pe,Kl,Li,fn,Ai,Do,Ql,$o,Xl,Oi,Mi,Qf,Or=Symbol.for("pv"),Fo={},Bo=[],Xf=/^m(i|n|o|s|text|space)$/,Uo=Array.isArray,$i=Bo.slice,En=Object.assign;function In(e){e&&e.parentNode&&e.remove()}function gn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?$i.call(arguments,2):n),Lr(e,i,r,o,null)}function Lr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Or,__v:o||++Kl,__i:-1,__u:0};return!o&&pe.vnode&&pe.vnode(a),a}function de(e){return e.children}function Dt(e,t){this.props=e,this.context=t,this.__g=0}function mn(e,t){if(t==null)return e.__&&mn(e.__,e.__i+1);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:mn(e)}function Jl(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Jl(e)}function Wl(e){(8&e.__g||(e.__g|=8,fn.push(e),Do++))&&Ai==pe.debounceRendering||((Ai=pe.debounceRendering)||queueMicrotask)(Yl)}function Yl(){var e,t,n,r,o,a,i,s,c;try{for(t=1;fn.length;)fn.length>t&&fn.sort(Ql),e=fn.shift(),t=fn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=En({constructor:Or},o)).__v=o.__v+1,pe.vnode&&pe.vnode(r),Di(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||mn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,nc(i,r,s),o.__=o.__e=null,r.__e!=a&&Jl(r)))}finally{(Do=fn.length)&&(Ai||queueMicrotask)(Yl)}}function Zl(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,v,S,P=r.__k||Bo,y=t.length;for(c=Jf(n,t,P,c,y),d=0;d<y;d++)(f=n.__k[d])!=null&&(u=~f.__i&&P[f.__i]||Fo,f.__i=d,S=Di(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&Fi(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),v=v||m,4&f.__u?(c=ec(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&S!==void 0?c=S:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=v,c}function Jf(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,v=m,S=0,P=0,y=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor===String?i=y[a]=Lr(null,i):Uo(i)?i=y[a]=Lr(de,{children:i}):i.constructor===Or&&i.__b?i=y[a]=Lr(i.type,i.props,i.key,i.ref,i.__v):y[a]=i,c=a+S,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=Yf(i,n,c,v))&&(v--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?S--:p==c+1?S++:p!=c&&(p>c?S--:S++,P=1)):(~p||(o>m?S--:o<m&&S++),typeof i.type!="function"&&(i.__u|=4))):y[a]=null;if(P){for(_=[],d=[],a=0;a<o;a++)if((i=y[a])&&16&i.__u){for(S=0,u=_.length;S<u;)_[f=S+u>>1]<i.__i?S=f+1:u=f;_[S]=i.__i,d[a]=S+1}for(S=_.length;a--;)d[a]&&(d[a]==S?S--:y[a].__u|=4)}if(v)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=mn(s)),Bi(s,s));return r}function ec(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=ec(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=mn(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function Ho(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(Uo(e)?e.some(function(n){Ho(n,t)}):t.push(e)),t}function Yf(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function Gl(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function Oo(e,t,n,r,o){var a,i;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||Gl(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||Gl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=Mi[t]||(Mi[t]=Zf(t)),(e.__a||(e.__a={}))[t]=Oi,a=t!=(t=t.replace(Xl,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function Zf(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[$o]==null)t[$o]=Oi++;else if(t[$o]<this.__a[e])return;return n(pe.event?pe.event(t):t)}}}function Di(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,S,P,y,C,h,g,k,w,T,E,M,L,O=t.type;if(t.constructor!==Or)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=Ni(_,a):a.push(_),s=a[0]||s),(_=pe.__b)&&_(t);e:if(typeof O=="function"){u=i.length;try{if(P=t.props,y=(_=O.prototype)&&_.render,C=(_=O.contextType)&&r[_.__c],h=_?C?C.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(y?t.__c=f=new O(P,h):(t.__c=f=new Dt(P,h),f.constructor=O,f.render=tm),C&&C.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),y&&(f.__s||(f.__s=f.state),O.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=En({},f.__s)),En(f.__s,O.getDerivedStateFromProps(P,f.__s)))),m=f.props,v=f.state,f.__v=t,n.__c){if(P!==m&&y&&!O.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(P,h),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(P,f.__s,h)===!1){t.__v!=n.__v&&(f.props=P,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Bo.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=mn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(P,f.__s,h),y&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,v,S)})}else y&&!O.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),y&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=h,f.props=P,f.__P=e,f.__g&=-5,g=pe.__r,k=0,y)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),Bo.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++k<25);f.state=f.__s,f.getChildContext&&(r=En({},r,f.getChildContext())),y&&n.__c&&f.getSnapshotBeforeUpdate&&(S=f.getSnapshotBeforeUpdate(m,v)),w=_&&_.type===de&&_.key==null?_.props.children:_,P.__P&&(_=s,o=(e=P.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(z){z&&Bi(z,z)}),n.__k=null),s=n.__k?mn(n,0):null),s=Zl(e,Uo(w)?w:[w],t,n,r,o,a,i,s,c,p),P.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(In),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(z){if(i.length=u,t.__v=null,c||a)if(z.then){if(T=0,t.__u|=128|c,a){for(~(M=a.indexOf(s||void 0))||(M=a.length);(L=a[M-1])&&L.nodeType==8;)M--;for(;M<a.length;M++)if(L=a[M]){if(a[M]=null,L.nodeType==8){if(L.data.startsWith("$s"))T++||(E=L);else if(T&&L.data.startsWith("/$s")&&!--T)break}else if(!T)break}}if(!E){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;E=s}(_=Ni(E=t.__c.__z||(t.__c.__z=E)))?(t.__e=E,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(In);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),z.then||tc(t),pe.__e(z,t,n)}}else s=t.__e=em(n.__e,t,n,r,o,a,i,c,p,e);return(_=pe.diffed)&&_(t),s}function Ni(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function tc(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(tc))}function nc(e,t,n){for(var r=0;r<n.length;)Fi(n[r++],n[r++],n[r++]);pe.__c&&pe.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){pe.__e(a,o.__v)}})}function em(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,v,S,P,y,C=n.props||Fo,h=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(_=0;_<a.length;_++)if((m=a[_])&&(g?m.localName==g:m.nodeType==3)){e=m,a[_]=null;break}}if(!e){if(P=p.ownerDocument||document,!g)return P.createTextNode(h);e=P.createElementNS(o,g,h.is&&h),s&&(pe.__m&&pe.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&h.defaultValue!=null?null:a&&$i.call(p.childNodes),!s&&a)for(C={},_=0;_<e.attributes.length;_++)C[(m=e.attributes[_]).name]=m.value;for(_ in C)m=C[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in h||_=="value"&&"defaultValue"in h||_=="checked"&&"defaultChecked"in h||Oo(e,_,null,m,o);for(_ in y=1&n.__u,h)m=h[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?v=m:_=="checked"?S=m:s&&typeof m!="function"||!(C[_]!==m||y&&m!=null)||Oo(e,_,m,C[_],o);d?(s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),(g=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&Xf.test(g))&&(o="http://www.w3.org/1999/xhtml"),Zl(p,Uo(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&mn(n,0),s,c),a&&a.some(In)),s&&g!="textarea"||(_="value",g=="progress"&&v==null?e.removeAttribute(_):v==null||v===e[_]&&(g!="progress"||v)||Oo(e,_,v,C[_],o),_="checked",S!=null&&S!=e[_]&&Oo(e,_,S,C[_],o))}else C===h||s&&e.data==h||(e.data=h);return e}function Fi(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){pe.__e(o,n)}}function Bi(e,t,n){var r,o,a,i;if(pe.unmount&&pe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Fi(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){pe.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Bi(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=Ni(r,a=[]))&&(r==e.__e&&a.some(In),In(o),In(r)),(r=e.__e)&&(n||In(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function tm(e,t,n){return this.constructor(e,n)}function hn(e,t){var n,r,o,a;pe.__&&pe.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Lr(de,{children:[e]}),o=[],a=[],Di(t,t.__k,r||Fo,Fo,t.namespaceURI,r?null:t.firstChild?$i.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),nc(o,t.__k,a),t.__k.props.children=null}pe={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw Do=0,e}},Kl=0,Li=function(e){return e!=null&&e.constructor===Or},Dt.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=En({},this.state)),typeof e=="function"&&(e=e(En({},n),this.props)),e&&(En(n,e),this.__v&&(t&&this.__k.push(t),Wl(this)))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Wl(this))},Dt.prototype.render=de,fn=[],Do=0,Ql=function(e,t){return e.__v.__b-t.__v.__b},$o=Symbol(),Xl=/(PointerCapture)$|Capture$/i,Oi=0,Mi={},Qf=0;function Ui(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function rc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function oc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function ac(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let _=new Map((p.options??[]).map(d=>[d.value,d]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(d=>{let u=_.get(d.value);return u?{...d,label:u.label??d.label,description:u.description??d.description}:d})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var qo={attach:"Attach files",file:"File",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 a person",connectingOperator:"Connecting you to a person\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.",visualPartial:"Some parts of 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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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",statusIncomplete:"Not completed",toolStepsFailed:"{count} failed"},nm={attach:"Joindre des fichiers",file:"Fichier",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 une personne",connectingOperator:"Mise en relation avec une personne\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.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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",statusIncomplete:"Non termin\xE9",toolStepsFailed:"{count} en \xE9chec"},rm={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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",statusIncomplete:"\u0644\u0645 \u064A\u0643\u062A\u0645\u0644",toolStepsFailed:"\u0641\u0634\u0644 {count}"},om={attach:"Adjuntar archivos",file:"Archivo",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 una persona",connectingOperator:"Conect\xE1ndote con una persona\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.",visualPartial:"No se pudieron mostrar algunas partes de 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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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",statusIncomplete:"No completado",toolStepsFailed:"{count} con error"},am={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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",statusIncomplete:"\u05DC\u05D0 \u05D4\u05D5\u05E9\u05DC\u05DD",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5"},im={en:qo,fr:nm,ar:rm,es:om,he:am};function zo(e,t){let n=ic(e),r=jo(t),o=n==="en"?{}:im[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...qo,...o,...i,...a}}function ic(e){return(e.split("-")[0]??"en").toLowerCase()}var sm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function sc(e){return sm.has(ic(e))}function bt(e,t){return e[t]??t}function jo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var A={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 Hi=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{}}},Vo=new Hi;var Wo={maxBytes:10485760,maxCount:10,accept:"*/*"},lc={voice:"local"},cc={list:[],byTrigger:{}},qi={enabled:!0,sampleRate:1},Go={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Yn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},uc={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"]},zi={enabled:!0,volume:.3,events:void 0},dc={enabled:!0,events:void 0},pc=[{label:"tabConversations",layout:"chat"}];var Wi=["off","error","warn","info","debug","trace"],Gi=A.cssPrefix,_c=`${Gi}.debug`,lm=`__${A.global}_DEBUG__`,cm=`${Gi}-debug`,Ko=2,ji=null;function um(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(cm);if(e!==null){let t=Vi(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(_c);if(e){let t=Vi(e);if(t>=0)return t}}catch{}return Reflect.get(window,lm)?4:2}function Vi(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=Wi.findIndex(n=>n===e);if(t>=0)return t}return-1}function Qo(e){let t=Vi(e);if(!(t<0)){Ko=t;try{window.localStorage?.setItem(_c,Wi[t]??"off")}catch{}}}function Ki(){return Wi[Ko]??"warn"}Ko=um();function fc(e){let t=`[${Gi}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(Ko<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),ji))try{ji({level:a,scope:e,message:i,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=>fc(`${e}:${r}`)}}var ne=fc("core");function mc(e){ji=e}var An=ne.scope("context"),dm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),gc=50,Qi=1024,pm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Xi(e){return hc(e,"userContext",!0)}function Ji(e){return hc(e,"pageContext",!1)}function hc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){An.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(dm.has(a)){An.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=gc){An.warn(`${t} truncated at ${gc} keys \u2014 dropped "${a}"`);continue}let s=_m(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!pm.test(r.email)&&(An.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function _m(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){An.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Qi?(An.warn(`truncated ${e}.${t} to ${Qi} chars`),r.slice(0,Qi)):r}An.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function Zn(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=fm(t.theme),d=n.mode??"floating",u=mm(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=er(o.locale??u,f,u),v=(t.baseUrl??A.defaultBaseUrl).replace(/\/$/,""),S=(t.agentApiBaseUrl??`${v}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${v}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:v,agentApiBaseUrl:S,dataApiBaseUrl:P,userContext:Xi(t.userContext),pageContext:Ji(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,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??lc.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:$r(t.forms,m),endpoints:{upload:t.endpoints?.upload??Go.upload,transcribe:t.endpoints?.transcribe??Go.transcribe,submitForm:t.endpoints?.submitForm??Go.submitForm},attachments:{accept:t.composer?.attachments?.accept??Wo.accept,maxBytes:t.composer?.attachments?.maxBytes??Wo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Wo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:gm(d,s.actions,c.enabled),size:n.size??{},launcher:km(t.launcher),sound:hm(a.sound),haptics:vm(a.haptics),strings:zo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:ym(i.poweredBy),composer:Pm(t.composer),modules:xm(t.modules,c.enabled),tracking:bm(t.tracking,P),history:c,storage:t.storage??Vo,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function fm(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function mm(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function er(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function gm(e,t,n){let r=t??uc[e];return n?r:r.filter(o=>o!=="history")}function hm(e){return{enabled:e?.enabled??zi.enabled,volume:e?.volume??zi.volume,events:e?.events}}function vm(e){return{enabled:e?.enabled??dc.enabled,events:e?.events}}function bm(e,t){let n=e?.sampleRate??qi.sampleRate;return{enabled:e?.enabled??qi.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 ym(e){let n={...{text:`Powered by ${A.displayName}`,href:A.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Pm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function xm(e,t){let n=e??pc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function $r(e,t){var a;if(!e?.length)return cc;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=ac(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(Sm).filter(_=>_!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,blocking:s.blocking??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function Sm(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 km(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??Yn.variant,size:e?.size??Yn.size,label:e?.label??Yn.label,icon:e?.icon??Yn.icon,hidden:e?.hidden??Yn.hidden,callout:t}}function Yi(e,t,n,r){let o=er(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=zo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var wm=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function Zi(e,t){if(!t)return e;let n={...e};for(let a of wm){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=vc(i,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 a=vc(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=Cm(s,i)),n.i18n=a}return n}function vc(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 Cm(e,t){if(!e)return t;if(!t)return e;let n=jo(e),r=jo(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var Tm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function tn(e){return e!=="false"}var Rm=[["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]],Im=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",tn]],Em=[["width","width"],["height","height"]],Am=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",tn],["show-reasoning","showReasoning",tn],["show-tool-calls","showToolCalls",tn],["show-sources","showSources",tn],["disable-message-feedback","disableMessageFeedback",tn],["auto-send-suggestions","autoSendSuggestions",tn],["pop-out-url","popOutUrl"]],Mm=[["locale","locale"]],OP=new Set(Tm);var Nm=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",tn]],Lm=[["features-disable-file-upload","disableFileUpload",tn],["features-voice","voice",e=>e]],Om=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],$m=[["user-id","id"],["user-email","email"],["user-name","name"]],Dm=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Fm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Bm=[Rm,Im,Em,Am,Mm,Nm,Lm,Om,$m,Dm],Um=new Set(["iframe","start-minimized"]),Hm=[...Bm.flatMap(e=>e.map(([t])=>t).filter(t=>!Um.has(t))),...Fm];var bc=ne.scope("track"),qm=64,zm=256,jm=10;function yc(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>qm){bc.warn("track: ignored an event without a name of 1\u201364 characters",{name:e});return}let r=Object.fromEntries(Object.entries(typeof t=="object"&&t!==null?t:{}).filter(o=>typeof o[1]=="string"||typeof o[1]=="boolean"||Number.isFinite(o[1])));return JSON.stringify(r).length>zm?(bc.warn("track: sent the event without its data, which is over 256 characters",{name:n}),{name:n}):Object.keys(r).length>0?{name:n,data:r}:{name:n}}function Pc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>jm&&t.shift()}),t}function Ct(){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,Vm(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 Vm(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 nn=ne.scope("persistence");function tr(e,t=Vo,n){let r=n?`${e}.${n}`:e,o=`${A.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${A.cssPrefix}.${r}${i}`,c=`${A.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,v=`${s}.activeModule`,S=`${s}.seenNewsId`,P=`${s}.historyCount`,y=`${s}.formsDone`,C={getVisitorId(){let h=t.get(c);if(h)return h;let g=Ct();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(h){nn.trace("saveConversationId",{id:h,scope:r}),h?t.set(p,h):t.remove(p)},loadDraft(h){return t.get(`${s}.draft.${h}`)??""},saveDraft(h,g){let k=`${s}.draft.${h}`;g?t.set(k,g):t.remove(k)},loadMessageQueue(h){let g=t.get(`${s}.messageQueue.${h}`);if(!g)return[];try{let k=JSON.parse(g);return!Array.isArray(k)||!k.every(Wm)?[]:k}catch(k){return nn.warn("loadMessageQueue parse failed",{error:k}),[]}},saveMessageQueue(h,g){let k=`${s}.messageQueue.${h}`;if(g.length===0){t.remove(k);return}try{t.set(k,JSON.stringify(g))}catch(w){nn.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let h=t.get(_);if(!h)return{};try{return es(JSON.parse(h))}catch(g){return nn.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(h){try{t.set(_,JSON.stringify(h))}catch(g){nn.warn("saveUserPrefs serialise failed",{error:g})}},patchUserPrefs(h){let g=C.loadUserPrefs();C.saveUserPrefs({...g,...h})},loadPanelOpen(){let h=t.get(d);return h==="1"?!0:h==="0"?!1:null},savePanelOpen(h){t.set(d,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 g=t.get(f);return!!g&&g===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(v)||null},saveActiveModule(h){t.set(v,h)},loadSeenNewsId(){return t.get(S)||null},saveSeenNewsId(h){t.set(S,h)},loadHistoryCount(){let h=t.get(P);if(!h)return null;let g=Number.parseInt(h,10);return Number.isFinite(g)&&g>=0?g:null},saveHistoryCount(h){t.set(P,String(h))},loadFormsDone(){let h=t.get(y);if(!h)return{};try{let g=JSON.parse(h);return Xo(g)?Object.fromEntries(Object.entries(g).filter(k=>typeof k[1]=="number")):{}}catch(g){return nn.warn("loadFormsDone parse failed",{error:g}),{}}},saveFormDone(h){try{let g=C.loadFormsDone();g[h]=Date.now(),t.set(y,JSON.stringify(g))}catch(g){nn.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(h){h&&h!==t.get(o)&&(nn.debug("rememberStorageVersion (force-reset on next load)",{version:h}),t.set(o,h))},clearConversation(){t.remove(p)},reset(){let h=t.get(p);h&&(t.remove(`${s}.draft.${h}`),t.remove(`${s}.messageQueue.${h}`));for(let g of[c,p,_,d,u,f,m,v,S,P,y])t.remove(g);nn.info("reset: forgot the visitor",{scope:r})}};return C}function Xo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wm(e){return Xo(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function es(e){if(!Xo(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),Xo(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var nr="1.13.0";var Gm="1",xc=60,Km=2e3,Sc={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}),hostEvent:e=>({name:e.name,data:e.data&&JSON.stringify(e.data)}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 Qm(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Xm(){return location.origin+location.pathname}function Jm(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function kc(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(_,d){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:v,themeMode:S}=t.getOptions();if(!u.enabled||Qm()||n>=u.sampleRate)return;let P=performance.now();if(P-r>6e4&&(r=P,o=0),++o>xc)return;let y=new URLSearchParams;y.set("v",Gm),y.set("_ev",nr),y.set("e",_),u.token&&y.set("tk",u.token),f&&y.set("pk",f),m&&y.set("dep",m),y.set("vid",t.getVisitorId());let C=t.getConversationId();C&&y.set("cid",C),y.set("url",Xm());let h=Jm();h&&y.set("ref",h),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",v),y.set("th",S),d)for(let[T,E]of Object.entries(d))E!==void 0&&y.set(T,String(E));y.set("ts",String(Date.now()));let g=`${u.endpoint}?${y}`;if(g.length>Km)return;let k=new Image(1,1);a.add(k);function w(){return a.delete(k)}k.addEventListener("load",w,{once:!0}),k.addEventListener("error",w,{once:!0}),k.src=g}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<xc&&s.push([_,d]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(_,d)}let p=Object.keys(Sc).map(_=>e.on(_,d=>c(_,Sc[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var wc=`.__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-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__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}
1
+ "use strict";var Lo=Object.defineProperty;var qf=Object.getOwnPropertyDescriptor;var zf=Object.getOwnPropertyNames;var jf=Object.prototype.hasOwnProperty;var Vf=(e,t,n)=>t in e?Lo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var Wf=(e,t)=>{for(var n in t)Lo(e,n,{get:t[n],enumerable:!0})},Gf=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of zf(t))!jf.call(e,o)&&o!==n&&Lo(e,o,{get:()=>t[o],enumerable:!(r=qf(t,o))||r.enumerable});return e};var Kf=e=>Gf(Lo({},"__esModule",{value:!0}),e);var ce=(e,t,n)=>Vf(e,typeof t!="symbol"?t+"":t,n);var pP={};Wf(pP,{HOOK_WILDCARD:()=>gi,brand:()=>dP,destroy:()=>iP,getAllInstances:()=>lP,getInstance:()=>sP,hook:()=>cP,init:()=>aP,mount:()=>of,resolveInitialHostMode:()=>mi,version:()=>uP});module.exports=Kf(pP);var pe,Kl,Li,mn,Ai,Do,Ql,$o,Xl,Oi,Mi,Qf,Or=Symbol.for("pv"),Fo={},Bo=[],Xf=/^m(i|n|o|s|text|space)$/,Uo=Array.isArray,$i=Bo.slice,An=Object.assign;function En(e){e&&e.parentNode&&e.remove()}function vn(e,t,n){var r,o,a,i={},s=arguments.length;for(a in t)a=="key"?r=t[a]:a=="ref"&&typeof e!="function"?o=t[a]:i[a]=t[a];return s>2&&(i.children=s>3?$i.call(arguments,2):n),Lr(e,i,r,o,null)}function Lr(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Or,__v:o||++Kl,__i:-1,__u:0};return!o&&pe.vnode&&pe.vnode(a),a}function de(e){return e.children}function Dt(e,t){this.props=e,this.context=t,this.__g=0}function gn(e,t){if(t==null)return e.__&&gn(e.__,e.__i+1);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:gn(e)}function Jl(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Jl(e)}function Wl(e){(8&e.__g||(e.__g|=8,mn.push(e),Do++))&&Ai==pe.debounceRendering||((Ai=pe.debounceRendering)||queueMicrotask)(Yl)}function Yl(){var e,t,n,r,o,a,i,s,c;try{for(t=1;mn.length;)mn.length>t&&mn.sort(Ql),e=mn.shift(),t=mn.length,8&e.__g&&(r=void 0,o=void 0,a=(o=(n=e).__v).__e,i=[],s=[],(c=n.__P)&&((r=An({constructor:Or},o)).__v=o.__v+1,pe.vnode&&pe.vnode(r),Di(c,r,o,n.__n,c.namespaceURI,32&o.__u?[a]:null,i,a||gn(o),32&o.__u,s),r.__v=o.__v,r.__.__k[r.__i]=r,nc(i,r,s),o.__=o.__e=null,r.__e!=a&&Jl(r)))}finally{(Do=mn.length)&&(Ai||queueMicrotask)(Yl)}}function Zl(e,t,n,r,o,a,i,s,c,p,_){var d,u,f,m,h,S,P=r.__k||Bo,y=t.length;for(c=Jf(n,t,P,c,y),d=0;d<y;d++)(f=n.__k[d])!=null&&(u=~f.__i&&P[f.__i]||Fo,f.__i=d,S=Di(e,f,u,o,a,i,s,c,p,_),m=f.__e,(u.ref!=f.ref||8&u.__u)&&(u.ref&&Fi(u.ref,null,f,u),f.ref&&_.push(f.ref,f.__c||m,f)),h=h||m,4&f.__u?(c=ec(f,c,e,!u.__v),u.__e&&(u.__e=null)):typeof f.type=="function"&&S!==void 0?c=S:m&&(c=m.nextSibling),f.__u&=-21);return n.__e=h,c}function Jf(e,t,n,r,o){var a,i,s,c,p,_,d,u,f,m=n.length,h=m,S=0,P=0,y=e.__k=Array(o);for(a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(typeof i!="object"||i.constructor===String?i=y[a]=Lr(null,i):Uo(i)?i=y[a]=Lr(de,{children:i}):i.constructor===Or&&i.__b?i=y[a]=Lr(i.type,i.props,i.key,i.ref,i.__v):y[a]=i,c=a+S,i.__=e,i.__b=e.__b+1,s=null,~(p=i.__i=Yf(i,n,c,h))&&(h--,(s=n[p])&&(s.__u|=2)),s&&s.__v?(i.__u|=16,p==c-1?S--:p==c+1?S++:p!=c&&(p>c?S--:S++,P=1)):(~p||(o>m?S--:o<m&&S++),typeof i.type!="function"&&(i.__u|=4))):y[a]=null;if(P){for(_=[],d=[],a=0;a<o;a++)if((i=y[a])&&16&i.__u){for(S=0,u=_.length;S<u;)_[f=S+u>>1]<i.__i?S=f+1:u=f;_[S]=i.__i,d[a]=S+1}for(S=_.length;a--;)d[a]&&(d[a]==S?S--:y[a].__u|=4)}if(h)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=gn(s)),Bi(s,s));return r}function ec(e,t,n,r){var o,a,i,s;if(typeof e.type=="function"){if(e.props.__P)return t;if(o=e.__k)for(a=0;a<o.length;a++)o[a]&&(o[a].__=e,t=ec(o[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=gn(e))&&!t.parentNode&&(t=null),i=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(i!=s&&(!r&&n.moveBefore&&i.parentNode?n.moveBefore(i,t):n.insertBefore(i,t||null)),t=i;(t=t&&t.nextSibling)&&t.nodeType==8&&!t.data.startsWith("$s"););return t}function Ho(e,t){return t=t||[],e!=null&&typeof e!="boolean"&&(Uo(e)?e.some(function(n){Ho(n,t)}):t.push(e)),t}function Yf(e,t,n,r){var o,a=e.key,i=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&i==s.type)return n;if(r>(c?1:0)){for(o=n-1;o>=0;o--)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o;for(o=n+1;o<t.length;o++)if((s=t[o])&&!(2&s.__u)&&a==s.key&&i==s.type)return o}return-1}function Gl(e,t,n){n==null&&(n=""),t[0]=="-"?e.setProperty(t,n):e[t]=n}function Oo(e,t,n,r,o){var a,i;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||Gl(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||Gl(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")(e.__e||(e.__e={}))[t]=n,n&&r||(i=Mi[t]||(Mi[t]=Zf(t)),(e.__a||(e.__a={}))[t]=Oi,a=t!=(t=t.replace(Xl,"$1")),(t=t.slice(2))[0]<"a"&&(t=t.toLowerCase()),n?e.addEventListener(t,i,a):e.removeEventListener(t,i,a));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{return void(e[t]=n??"")}catch{}if(typeof n=="function")return;n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n)}}function Zf(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[$o]==null)t[$o]=Oi++;else if(t[$o]<this.__a[e])return;return n(pe.event?pe.event(t):t)}}}function Di(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,h,S,P,y,C,v,g,k,w,T,E,M,L,O=t.type;if(t.constructor!==Or)return null;128&n.__u&&(c=32&n.__u,_=n.__c.__z)&&(t.__u|=c,d=a=[],_.nodeType==8?s=Ni(_,a):a.push(_),s=a[0]||s),(_=pe.__b)&&_(t);e:if(typeof O=="function"){u=i.length;try{if(P=t.props,y=(_=O.prototype)&&_.render,C=(_=O.contextType)&&r[_.__c],v=_?C?C.props.value:_.__:r,(f=n.__c)?(t.__c=f,2&f.__g&&(f.__g|=1)):(y?t.__c=f=new O(P,v):(t.__c=f=new Dt(P,v),f.constructor=O,f.render=tm),C&&C.sub(f),f.state||(f.state={}),f.__n=r,f.__g|=8,f.__h=[],f.__k=[]),y&&(f.__s||(f.__s=f.state),O.getDerivedStateFromProps&&(f.__s==f.state&&(f.__s=An({},f.__s)),An(f.__s,O.getDerivedStateFromProps(P,f.__s)))),m=f.props,h=f.state,f.__v=t,n.__c){if(P!==m&&y&&!O.getDerivedStateFromProps&&f.componentWillReceiveProps&&f.componentWillReceiveProps(P,v),t.__v==n.__v&&!(8&f.__g)||!(4&f.__g)&&f.shouldComponentUpdate&&f.shouldComponentUpdate(P,f.__s,v)===!1){t.__v!=n.__v&&(f.props=P,f.state=f.__s,f.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(z){z&&(z.__=t)}),Bo.push.apply(f.__h,f.__k),f.__k=[],f.__h.length&&i.push(f),s=gn(n);break e}f.componentWillUpdate&&f.componentWillUpdate(P,f.__s,v),y&&f.componentDidUpdate&&f.__h.push(function(){f.componentDidUpdate(m,h,S)})}else y&&!O.getDerivedStateFromProps&&f.componentWillMount&&f.componentWillMount(),y&&f.componentDidMount&&f.__h.push(f.componentDidMount);if(f.context=v,f.props=P,f.__P=e,f.__g&=-5,g=pe.__r,k=0,y)f.state=f.__s,f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),Bo.push.apply(f.__h,f.__k),f.__k=[];else do f.__g&=-9,g&&g(t),_=f.render(f.props,f.state,f.context),f.state=f.__s;while(8&f.__g&&++k<25);f.state=f.__s,f.getChildContext&&(r=An({},r,f.getChildContext())),y&&n.__c&&f.getSnapshotBeforeUpdate&&(S=f.getSnapshotBeforeUpdate(m,h)),w=_&&_.type===de&&_.key==null?_.props.children:_,P.__P&&(_=s,o=(e=P.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(z){z&&Bi(z,z)}),n.__k=null),s=n.__k?gn(n,0):null),s=Zl(e,Uo(w)?w:[w],t,n,r,o,a,i,s,c,p),P.__P&&(t.__e=null,s=_),t.__u&=-161,d&&d.some(En),f.__h.length&&i.push(f),1&f.__g&&(f.__g&=-4)}catch(z){if(i.length=u,t.__v=null,c||a)if(z.then){if(T=0,t.__u|=128|c,a){for(~(M=a.indexOf(s||void 0))||(M=a.length);(L=a[M-1])&&L.nodeType==8;)M--;for(;M<a.length;M++)if(L=a[M]){if(a[M]=null,L.nodeType==8){if(L.data.startsWith("$s"))T++||(E=L);else if(T&&L.data.startsWith("/$s")&&!--T)break}else if(!T)break}}if(!E){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;E=s}(_=Ni(E=t.__c.__z||(t.__c.__z=E)))?(t.__e=E,s=_):t.__e=s,s=s&&s.nextSibling}else a&&a.some(En);else t.__e=n.__e;t.__k||(t.__k=n.__k||[]),z.then||tc(t),pe.__e(z,t,n)}}else s=t.__e=em(n.__e,t,n,r,o,a,i,c,p,e);return(_=pe.diffed)&&_(t),s}function Ni(e,t){if(e&&e.nodeType==8&&e.data.startsWith("$s"))for(var n=1;e=e.nextSibling;){if(e.nodeType==8){if(e.data.startsWith("$s"))n++;else if(e.data.startsWith("/$s")&&!--n)return e}t&&t.push(e)}}function tc(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(tc))}function nc(e,t,n){for(var r=0;r<n.length;)Fi(n[r++],n[r++],n[r++]);pe.__c&&pe.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){pe.__e(a,o.__v)}})}function em(e,t,n,r,o,a,i,s,c,p){var _,d,u,f,m,h,S,P,y,C=n.props||Fo,v=t.props,g=t.type;if(g=="svg"?o="http://www.w3.org/2000/svg":g=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a){for(_=0;_<a.length;_++)if((m=a[_])&&(g?m.localName==g:m.nodeType==3)){e=m,a[_]=null;break}}if(!e){if(P=p.ownerDocument||document,!g)return P.createTextNode(v);e=P.createElementNS(o,g,v.is&&v),s&&(pe.__m&&pe.__m(t,a),s=!1),a=null}if(g){if(p=g=="template"?e.content:e,a=g=="textarea"&&v.defaultValue!=null?null:a&&$i.call(p.childNodes),!s&&a)for(C={},_=0;_<e.attributes.length;_++)C[(m=e.attributes[_]).name]=m.value;for(_ in C)m=C[_],_=="dangerouslySetInnerHTML"?u=m:_=="children"||_ in v||_=="value"&&"defaultValue"in v||_=="checked"&&"defaultChecked"in v||Oo(e,_,null,m,o);for(_ in y=1&n.__u,v)m=v[_],_=="children"?f=m:_=="dangerouslySetInnerHTML"?d=m:_=="value"?h=m:_=="checked"?S=m:s&&typeof m!="function"||!(C[_]!==m||y&&m!=null)||Oo(e,_,m,C[_],o);d?(s||u&&(d.__html==u.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(u&&(e.textContent=""),(g=="foreignObject"||o=="http://www.w3.org/1998/Math/MathML"&&Xf.test(g))&&(o="http://www.w3.org/1999/xhtml"),Zl(p,Uo(f)?f:[f],t,n,r,o,a,i,a?a[0]:n.__k&&gn(n,0),s,c),a&&a.some(En)),s&&g!="textarea"||(_="value",g=="progress"&&h==null?e.removeAttribute(_):h==null||h===e[_]&&(g!="progress"||h)||Oo(e,_,h,C[_],o),_="checked",S!=null&&S!=e[_]&&Oo(e,_,S,C[_],o))}else C===v||s&&e.data==v||(e.data=v);return e}function Fi(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){pe.__e(o,n)}}function Bi(e,t,n){var r,o,a,i;if(pe.unmount&&pe.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Fi(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(s){pe.__e(s,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Bi(r[i],t,typeof e.type!="function"||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(o=Ni(r,a=[]))&&(r==e.__e&&a.some(En),En(o),En(r)),(r=e.__e)&&(n||En(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function tm(e,t,n){return this.constructor(e,n)}function hn(e,t){var n,r,o,a;pe.__&&pe.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=Lr(de,{children:[e]}),o=[],a=[],Di(t,t.__k,r||Fo,Fo,t.namespaceURI,r?null:t.firstChild?$i.call(t.childNodes):null,o,r?r.__e:t.firstChild,n,a),nc(o,t.__k,a),t.__k.props.children=null}pe={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!(1&o.__g)){o.__g|=4;try{if((i=(a=o.constructor)&&a.getDerivedStateFromError)&&o.setState(a.getDerivedStateFromError(e)),o.componentDidCatch&&(o.componentDidCatch(e,r||{}),i=1),i&&8&o.__g)return void(o.__g|=2)}catch(s){e=s}}throw Do=0,e}},Kl=0,Li=function(e){return e!=null&&e.constructor===Or},Dt.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=An({},this.state)),typeof e=="function"&&(e=e(An({},n),this.props)),e&&(An(n,e),this.__v&&(t&&this.__k.push(t),Wl(this)))},Dt.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),Wl(this))},Dt.prototype.render=de,mn=[],Do=0,Ql=function(e,t){return e.__v.__b-t.__v.__b},$o=Symbol(),Xl=/(PointerCapture)$|Capture$/i,Oi=0,Mi={},Qf=0;function Ui(e,t){if(!(!e?.length||!t))return e.find(n=>n.locale===t)}function rc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description,content:a.content??o.content}:o}function oc(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);return a?{...o,title:a.title??o.title,description:a.description??o.description}:o}function ac(e,t){let{translations:n,defaultLocale:r,...o}=e,a=Ui(n,t);if(!a)return o;let i=new Map((a.fields??[]).map(c=>[c.name,c])),s=o.fields.map(c=>{let p=i.get(c.name);if(!p)return c;let _=new Map((p.options??[]).map(d=>[d.value,d]));return{...c,label:p.label??c.label,placeholder:p.placeholder??c.placeholder,validationHint:p.validationHint??c.validationHint,options:c.options?.map(d=>{let u=_.get(d.value);return u?{...d,label:u.label??d.label,description:u.description??d.description}:d})}});return{...o,title:a.title??o.title,description:a.description??o.description,submitLabel:a.submitLabel??o.submitLabel,fields:s}}var qo={attach:"Attach files",file:"File",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 a person",connectingOperator:"Connecting you to a person\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.",visualPartial:"Some parts of 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",contentHelpful:"Was this helpful?",homeGreeting:"How can we help?",homeGreetingNamed:"Hi {name} \u{1F44B}",homeGreetingLead:"How can we help?",homeSearchPlaceholder:"Search for help",homeAskPlaceholder:"Ask a question\u2026",homeWhatsNew:"What's new",homeContentTitle:"Popular articles",homeStatus:"Status",helpTitle:"Help",helpSearchPlaceholder:"Search for help",helpEmpty:"No help articles yet",helpLoading:"Loading help\u2026",helpSearchEmpty:"No results for \u201C{query}\u201D",helpShowMore:"Show more",newsTitle:"News",newsEmpty:"No news yet",newsLoading:"Loading news\u2026",newsBack:"Back to news",newsPublishedAt:"Published {date}",newsShowMore:"Show more",newsUnseen:"New post",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",statusIncomplete:"Not completed",toolStepsFailed:"{count} failed"},nm={attach:"Joindre des fichiers",file:"Fichier",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 une personne",connectingOperator:"Mise en relation avec une personne\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.",visualPartial:"Certaines parties de ce visuel n\u2019ont pas pu \xEAtre affich\xE9es.",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",contentHelpful:"Cela vous a-t-il aid\xE9 ?",homeGreeting:"Comment pouvons-nous vous aider ?",homeGreetingNamed:"Bonjour {name} \u{1F44B}",homeGreetingLead:"Comment pouvons-nous vous aider ?",homeSearchPlaceholder:"Rechercher de l'aide",homeAskPlaceholder:"Posez une question\u2026",homeWhatsNew:"Nouveaut\xE9s",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 pour \xAB\xA0{query}\xA0\xBB",helpShowMore:"Afficher plus",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}",newsShowMore:"Afficher plus",newsUnseen:"Nouvelle publication",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",statusIncomplete:"Non termin\xE9",toolStepsFailed:"{count} en \xE9chec"},rm={attach:"\u0625\u0631\u0641\u0627\u0642 \u0645\u0644\u0641\u0627\u062A",file:"\u0645\u0644\u0641",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 \u0634\u062E\u0635",connectingOperator:"\u062C\u0627\u0631\u064D \u062A\u0648\u0635\u064A\u0644\u0643 \u0628\u0634\u062E\u0635\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.",visualPartial:"\u062A\u0639\u0630\u0631 \u0639\u0631\u0636 \u0628\u0639\u0636 \u0623\u062C\u0632\u0627\u0621 \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",contentHelpful:"\u0647\u0644 \u0643\u0627\u0646 \u0647\u0630\u0627 \u0645\u0641\u064A\u062F\u064B\u0627\u061F",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",homeAskPlaceholder:"\u0627\u0637\u0631\u062D \u0633\u0624\u0627\u0644\u0627\u064B\u2026",homeWhatsNew:"\u0645\u0627 \u0627\u0644\u062C\u062F\u064A\u062F",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 \u0646\u062A\u0627\u0626\u062C \u0644\u0640 \xAB{query}\xBB",helpShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",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}",newsShowMore:"\u0639\u0631\u0636 \u0627\u0644\u0645\u0632\u064A\u062F",newsUnseen:"\u0645\u0646\u0634\u0648\u0631 \u062C\u062F\u064A\u062F",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",statusIncomplete:"\u0644\u0645 \u064A\u0643\u062A\u0645\u0644",toolStepsFailed:"\u0641\u0634\u0644 {count}"},om={attach:"Adjuntar archivos",file:"Archivo",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 una persona",connectingOperator:"Conect\xE1ndote con una persona\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.",visualPartial:"No se pudieron mostrar algunas partes de 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",contentHelpful:"\xBFTe result\xF3 \xFAtil?",homeGreeting:"\xBFC\xF3mo podemos ayudarte?",homeGreetingNamed:"Hola, {name} \u{1F44B}",homeGreetingLead:"\xBFC\xF3mo podemos ayudarte?",homeSearchPlaceholder:"Buscar ayuda",homeAskPlaceholder:"Haz una pregunta\u2026",homeWhatsNew:"Lo nuevo",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:"Sin resultados para \xAB{query}\xBB",helpShowMore:"Mostrar m\xE1s",newsTitle:"Novedades",newsEmpty:"A\xFAn no hay novedades",newsLoading:"Cargando novedades\u2026",newsBack:"Volver a novedades",newsPublishedAt:"Publicado el {date}",newsShowMore:"Mostrar m\xE1s",newsUnseen:"Publicaci\xF3n nueva",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",statusIncomplete:"No completado",toolStepsFailed:"{count} con error"},am={attach:"\u05E6\u05D9\u05E8\u05D5\u05E3 \u05E7\u05D1\u05E6\u05D9\u05DD",file:"\u05E7\u05D5\u05D1\u05E5",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\u05D5 \u05E2\u05DD \u05D0\u05D3\u05DD",connectingOperator:"\u05DE\u05D7\u05D1\u05E8\u05D9\u05DD \u05D0\u05D5\u05EA\u05DA \u05DC\u05D0\u05D3\u05DD\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.",visualPartial:"\u05DC\u05D0 \u05E0\u05D9\u05EA\u05DF \u05D4\u05D9\u05D4 \u05DC\u05D4\u05E6\u05D9\u05D2 \u05D7\u05DC\u05E7\u05D9\u05DD \u05DE\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",contentHelpful:"\u05D4\u05D0\u05DD \u05D6\u05D4 \u05E2\u05D6\u05E8?",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",homeAskPlaceholder:"\u05E9\u05D0\u05DC\u05D5 \u05E9\u05D0\u05DC\u05D4\u2026",homeWhatsNew:"\u05DE\u05D4 \u05D7\u05D3\u05E9",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:"\u05D0\u05D9\u05DF \u05EA\u05D5\u05E6\u05D0\u05D5\u05EA \u05E2\u05D1\u05D5\u05E8 \u201E{query}\u201D",helpShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",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}",newsShowMore:"\u05D4\u05E6\u05D2\u05EA \u05E2\u05D5\u05D3",newsUnseen:"\u05E4\u05D5\u05E1\u05D8 \u05D7\u05D3\u05E9",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",statusIncomplete:"\u05DC\u05D0 \u05D4\u05D5\u05E9\u05DC\u05DD",toolStepsFailed:"{count} \u05E0\u05DB\u05E9\u05DC\u05D5"},im={en:qo,fr:nm,ar:rm,es:om,he:am};function zo(e,t){let n=ic(e),r=jo(t),o=n==="en"?{}:im[n]??{},a=r?t[n]??{}:t??{},i=r?t.en??{}:{};return{...qo,...o,...i,...a}}function ic(e){return(e.split("-")[0]??"en").toLowerCase()}var sm=new Set(["ar","he","iw","fa","ur","ps","sd","ug","yi","dv","ckb","ks","nqo","prs","syr"]);function sc(e){return sm.has(ic(e))}function bt(e,t){return e[t]??t}function jo(e){if(!e)return!1;for(let t of Object.values(e))if(t&&typeof t=="object")return!0;return!1}var A={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 Hi=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{}}},Vo=new Hi;var Wo={maxBytes:10485760,maxCount:10,accept:"*/*"},lc={voice:"local"},cc={list:[],byTrigger:{}},qi={enabled:!0,sampleRate:1},Go={upload:"/pai/upload-file",transcribe:"/pai/transcribe-audio",submitForm:"/pai/submit-form"},Zn={variant:"circle",size:"md",label:void 0,icon:"chat",hidden:!1},uc={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"]},zi={enabled:!0,volume:.3,events:void 0},dc={enabled:!0,events:void 0},pc=[{label:"tabConversations",layout:"chat"}];var Wi=["off","error","warn","info","debug","trace"],Gi=A.cssPrefix,_c=`${Gi}.debug`,lm=`__${A.global}_DEBUG__`,cm=`${Gi}-debug`,Ko=2,ji=null;function um(){if(typeof window>"u")return 2;try{let e=new URLSearchParams(window.location.search).get(cm);if(e!==null){let t=Vi(e);if(t>=0)return t}}catch{}try{let e=window.localStorage?.getItem(_c);if(e){let t=Vi(e);if(t>=0)return t}}catch{}return Reflect.get(window,lm)?4:2}function Vi(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=Wi.findIndex(n=>n===e);if(t>=0)return t}return-1}function Qo(e){let t=Vi(e);if(!(t<0)){Ko=t;try{window.localStorage?.setItem(_c,Wi[t]??"off")}catch{}}}function Ki(){return Wi[Ko]??"warn"}Ko=um();function fc(e){let t=`[${Gi}:${e}]`;function n(r,o,a){return(i,s)=>{if(!(Ko<r)&&(s===void 0?console[o](t,i):console[o](t,i,s),ji))try{ji({level:a,scope:e,message:i,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=>fc(`${e}:${r}`)}}var ne=fc("core");function mc(e){ji=e}var Mn=ne.scope("context"),dm=new Set(["visitorId","conversationId","jwt","token","authorization","password"]),gc=50,Qi=1024,pm=/^[^\s@]+@[^\s@]+\.[^\s@]+$/;function Xi(e){return vc(e,"userContext",!0)}function Ji(e){return vc(e,"pageContext",!1)}function vc(e,t,n){if(e==null)return;if(typeof e!="object"||Array.isArray(e)){Mn.warn(`ignored ${t} \u2014 expected an object`,{type:Array.isArray(e)?"array":typeof e});return}let r={},o=0;for(let[a,i]of Object.entries(e)){if(dm.has(a)){Mn.warn(`dropped reserved ${t} key "${a}" \u2014 managed by the widget, not host-settable`);continue}if(i==null)continue;if(o>=gc){Mn.warn(`${t} truncated at ${gc} keys \u2014 dropped "${a}"`);continue}let s=_m(t,a,i);s!==void 0&&(r[a]=s,o++)}return n&&typeof r.email=="string"&&!pm.test(r.email)&&(Mn.warn("dropped malformed context field",{field:`${t}.email`,reason:"invalid format"}),delete r.email),Object.keys(r).length>0?r:void 0}function _m(e,t,n){if(typeof n=="boolean")return n;if(typeof n=="number"){if(!Number.isFinite(n)){Mn.warn(`dropped non-finite ${e}.${t}`);return}return n}if(typeof n=="string"){let r=n.trim();return r===""?void 0:r.length>Qi?(Mn.warn(`truncated ${e}.${t} to ${Qi} chars`),r.slice(0,Qi)):r}Mn.warn(`dropped ${e}.${t} \u2014 only string/number/boolean values are allowed`,{type:typeof n})}function er(e){let t=e!==null&&typeof e=="object"?e:{},n=t.presentation??{},r=t.behavior??{},o=t.i18n??{},a=t.feedback??{},i=t.footer??{},s=t.header??{},c={enabled:t.history?.enabled??!0},{themeMode:p,themeOverrides:_}=fm(t.theme),d=n.mode??"floating",u=mm(o.defaultLocale),f=o.availableLocales??[o.locale??u],m=tr(o.locale??u,f,u),h=(t.baseUrl??A.defaultBaseUrl).replace(/\/$/,""),S=(t.agentApiBaseUrl??`${h}/api/agent`).replace(/\/$/,""),P=(t.dataApiBaseUrl??`${h}/api/data`).replace(/\/$/,"");return{widgetId:t.widgetId??"default",publicKey:t.publicKey,aiAgentDeploymentId:t.aiAgentDeploymentId,baseUrl:h,agentApiBaseUrl:S,dataApiBaseUrl:P,userContext:Xi(t.userContext),pageContext:Ji(t.pageContext),position:n.position??"bottom-right",themeMode:p,textSize:"normal",themeOverrides:_,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??lc.voice,fileUpload:!(t.features?.disableFileUpload??!1),humanInLoop:!(t.features?.disableHumanInLoop??!1),operatorRequest:t.features?.enableOperatorRequest===!0},forms:$r(t.forms,m),endpoints:{upload:t.endpoints?.upload??Go.upload,transcribe:t.endpoints?.transcribe??Go.transcribe,submitForm:t.endpoints?.submitForm??Go.submitForm},attachments:{accept:t.composer?.attachments?.accept??Wo.accept,maxBytes:t.composer?.attachments?.maxBytes??Wo.maxBytes,maxCount:t.composer?.attachments?.maxCount??Wo.maxCount},locale:m,defaultLocale:u,availableLocales:f,startMinimized:r.startMinimized??!0,actions:gm(d,s.actions,c.enabled),size:n.size??{},launcher:km(t.launcher),sound:vm(a.sound),haptics:hm(a.haptics),strings:zo(m,o.strings),stringsOverride:o.strings,composerDisclaimer:i.composerDisclaimer??"",poweredBy:ym(i.poweredBy),composer:Pm(t.composer),modules:xm(t.modules,c.enabled),tracking:bm(t.tracking,P),history:c,storage:t.storage??Vo,userToken:t.userToken,tools:t.tools,onMessage:t.onMessage,onOpen:t.onOpen,onClose:t.onClose,onError:t.onError}}function fm(e){if(typeof e=="string")return{themeMode:e,themeOverrides:{}};if(!e||typeof e!="object")return{themeMode:"auto",themeOverrides:{}};let{mode:t,...n}=e;return{themeMode:t??"auto",themeOverrides:n}}function mm(e){return e&&e!=="auto"?e:globalThis.navigator?.language||"en"}function tr(e,t,n){return t.length<=1||t.includes(e)?e:t.includes(n)?n:t[0]??e}function gm(e,t,n){let r=t??uc[e];return n?r:r.filter(o=>o!=="history")}function vm(e){return{enabled:e?.enabled??zi.enabled,volume:e?.volume??zi.volume,events:e?.events}}function hm(e){return{enabled:e?.enabled??dc.enabled,events:e?.events}}function bm(e,t){let n=e?.sampleRate??qi.sampleRate;return{enabled:e?.enabled??qi.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 ym(e){let n={...{text:`Powered by ${A.displayName}`,href:A.siteUrl},...e};return!!(n.text||n.logoUrl)?n:null}function Pm(e){let t=e?.sendButton;return{sendButton:{shape:t?.shape??"circle",icon:t?.icon??"arrowUp",variant:t?.variant??"filled"}}}function xm(e,t){let n=e??pc,r=new Set,o=[];for(let i of n.slice(0,4)){if(!i?.label||!i?.layout)continue;let s=i.contentCollectionIds?.filter(Boolean),c=i.id??s?.[0]??i.layout;for(;r.has(c);)c=`${c}-${o.length}`;r.add(c);let p={id:c,label:i.label,layout:i.layout};s?.length&&(p.contentCollectionIds=s),i.layout==="home"&&(p.brandName=i.brandName,p.greetingText=i.greetingText,p.showGreeting=!(i.hideGreeting??!1),p.showSearchBar=!(i.hideSearchBar??!1),p.showRecentConversations=t&&!(i.hideRecentConversations??!1),i.userAvatars?.length&&(p.userAvatars=i.userAvatars),i.status&&(p.status=i.status),p.contentBlockTitle=i.contentBlockTitle),o.push(p)}let a=Object.fromEntries(o.map(i=>[i.id,i]));return{list:o,byId:a}}function $r(e,t){var a;if(!e?.length)return cc;let n=[],r=new Set;for(let i of e){if(!i?.id||r.has(i.id))continue;let s=ac(i,t),c=(s.fields??[]).filter(_=>!!(_?.name&&_.label&&_.type)),p=(Array.isArray(s.on)?s.on:[s.on]).map(Sm).filter(_=>_!==null);c.length===0||p.length===0||(r.add(s.id),n.push({id:s.id,triggers:p,when:s.when,fields:c,title:s.title,description:s.description,submitLabel:s.submitLabel,skippable:s.skippable??!1,blocking:s.blocking??!1,frequency:s.frequency??"once",mirrorToContext:s.mirrorToContext??!0,reopenable:s.reopenable??!0,reviewable:s.reviewable??!0}))}let o={};for(let i of n)for(let s of i.triggers)(o[a=s.kind]??(o[a]=[])).push(i);return{list:n,byTrigger:o}}function Sm(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 km(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??Zn.variant,size:e?.size??Zn.size,label:e?.label??Zn.label,icon:e?.icon??Zn.icon,hidden:e?.hidden??Zn.hidden,callout:t}}function Yi(e,t,n,r){let o=tr(t,e.availableLocales,e.defaultLocale);if(o===e.locale&&n===e.themeMode&&r===e.textSize)return e;let a={...e};return o!==e.locale&&(a.locale=o,a.strings=zo(o,e.stringsOverride)),n!==e.themeMode&&(a.themeMode=n),r!==e.textSize&&(a.textSize=r),a}var wm=["presentation","behavior","theme","launcher","header","composer","feedback","i18n","footer","features","tracking","endpoints","history"];function Zi(e,t){if(!t)return e;let n={...e};for(let a of wm){let i=t[a];if(i===void 0)continue;let s=e[a];if(a==="theme"){s===void 0?n[a]=i:typeof s=="string"&&typeof i=="object"&&i!==null&&(n[a]={...i,mode:s});continue}a!=="i18n"&&(n[a]=hc(i,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 a=hc(o??{},r);o?.availableLocales!==void 0&&(a.availableLocales=o.availableLocales),o?.defaultLocale!==void 0&&(a.defaultLocale=o.defaultLocale);let i=r?.strings,s=o?.strings;(i||s)&&(a.strings=Cm(s,i)),n.i18n=a}return n}function hc(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 Cm(e,t){if(!e)return t;if(!t)return e;let n=jo(e),r=jo(t);if(!n&&!r)return{...e,...t};let o={},a=n?e:{en:e},i=r?t:{en:t};for(let[s,c]of Object.entries(a))o[s]={...c};for(let[s,c]of Object.entries(i))o[s]={...o[s],...c};return o}var Tm=["clear","expand","fullscreen","popOut","sound","history","language","theme","textSize","close"];function tn(e){return e!=="false"}var Rm=[["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]],Im=[["mode","mode",e=>e],["position","position",e=>e],["iframe","iframe",tn]],Em=[["width","width"],["height","height"]],Am=[["response-mode","responseMode",e=>e],["start-minimized","startMinimized",tn],["show-reasoning","showReasoning",tn],["show-tool-calls","showToolCalls",tn],["show-sources","showSources",tn],["disable-message-feedback","disableMessageFeedback",tn],["auto-send-suggestions","autoSendSuggestions",tn],["pop-out-url","popOutUrl"]],Mm=[["locale","locale"]],FP=new Set(Tm);var Nm=[["launcher-variant","variant",e=>e],["launcher-size","size",e=>e],["launcher-icon","icon"],["launcher-hidden","hidden",tn]],Lm=[["features-disable-file-upload","disableFileUpload",tn],["features-voice","voice",e=>e]],Om=[["endpoint-upload","upload"],["endpoint-transcribe","transcribe"]],$m=[["user-id","id"],["user-email","email"],["user-name","name"]],Dm=[["page-area","area"],["page-url","url"],["page-path","path"],["page-title","title"]],Fm=["launcher-label","callout-text","callout-delay","actions","user-context","page-context"],Bm=[Rm,Im,Em,Am,Mm,Nm,Lm,Om,$m,Dm],Um=new Set(["iframe","start-minimized"]),Hm=[...Bm.flatMap(e=>e.map(([t])=>t).filter(t=>!Um.has(t))),...Fm];var bc=ne.scope("track"),qm=64,zm=256,jm=10;function yc(e,t){let n=typeof e=="string"?e.trim():"";if(!n||n.length>qm){bc.warn("track: ignored an event without a name of 1\u201364 characters",{name:e});return}let r=Object.fromEntries(Object.entries(typeof t=="object"&&t!==null?t:{}).filter(o=>typeof o[1]=="string"||typeof o[1]=="boolean"||Number.isFinite(o[1])));return JSON.stringify(r).length>zm?(bc.warn("track: sent the event without its data, which is over 256 characters",{name:n}),{name:n}):Object.keys(r).length>0?{name:n,data:r}:{name:n}}function Pc(e){let t=[];return e.on("hostEvent",n=>{t.push({...n,at:Date.now()}),t.length>jm&&t.shift()}),t}function Ct(){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,Vm(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 Vm(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 nn=ne.scope("persistence");function nr(e,t=Vo,n){let r=n?`${e}.${n}`:e,o=`${A.cssPrefix}.storageVersion`,a=t.get(o)??void 0,i=a?`.v${a}`:"",s=`${A.cssPrefix}.${r}${i}`,c=`${A.cssPrefix}${i}.visitorId`,p=`${s}.conversationId`,_=`${s}.userPrefs`,d=`${s}.panelOpen`,u=`${s}.panelSize`,f=`${s}.calloutDismissed`,m=`${s}.sidebarCollapsed`,h=`${s}.activeModule`,S=`${s}.seenNewsId`,P=`${s}.historyCount`,y=`${s}.formsDone`,C={getVisitorId(){let v=t.get(c);if(v)return v;let g=Ct();return t.set(c,g),g},loadConversationId(){return t.get(p)??void 0},saveConversationId(v){nn.trace("saveConversationId",{id:v,scope:r}),v?t.set(p,v):t.remove(p)},loadDraft(v){return t.get(`${s}.draft.${v}`)??""},saveDraft(v,g){let k=`${s}.draft.${v}`;g?t.set(k,g):t.remove(k)},loadMessageQueue(v){let g=t.get(`${s}.messageQueue.${v}`);if(!g)return[];try{let k=JSON.parse(g);return!Array.isArray(k)||!k.every(Wm)?[]:k}catch(k){return nn.warn("loadMessageQueue parse failed",{error:k}),[]}},saveMessageQueue(v,g){let k=`${s}.messageQueue.${v}`;if(g.length===0){t.remove(k);return}try{t.set(k,JSON.stringify(g))}catch(w){nn.warn("saveMessageQueue serialise failed",{error:w})}},loadUserPrefs(){let v=t.get(_);if(!v)return{};try{return es(JSON.parse(v))}catch(g){return nn.warn("loadUserPrefs parse failed",{error:g}),{}}},saveUserPrefs(v){try{t.set(_,JSON.stringify(v))}catch(g){nn.warn("saveUserPrefs serialise failed",{error:g})}},patchUserPrefs(v){let g=C.loadUserPrefs();C.saveUserPrefs({...g,...v})},loadPanelOpen(){let v=t.get(d);return v==="1"?!0:v==="0"?!1:null},savePanelOpen(v){t.set(d,v?"1":"0")},loadPanelSize(){let v=t.get(u);return v==="normal"||v==="expanded"||v==="fullscreen"?v:null},savePanelSize(v){t.set(u,v)},loadCalloutDismissed(v){if(!v)return!1;let g=t.get(f);return!!g&&g===v},saveCalloutDismissed(v){v?t.set(f,v):t.remove(f)},loadSidebarCollapsed(){let v=t.get(m);return v==="1"?!0:v==="0"?!1:null},saveSidebarCollapsed(v){t.set(m,v?"1":"0")},loadActiveModule(){return t.get(h)||null},saveActiveModule(v){t.set(h,v)},loadSeenNewsId(){return t.get(S)||null},saveSeenNewsId(v){t.set(S,v)},loadHistoryCount(){let v=t.get(P);if(!v)return null;let g=Number.parseInt(v,10);return Number.isFinite(g)&&g>=0?g:null},saveHistoryCount(v){t.set(P,String(v))},loadFormsDone(){let v=t.get(y);if(!v)return{};try{let g=JSON.parse(v);return Xo(g)?Object.fromEntries(Object.entries(g).filter(k=>typeof k[1]=="number")):{}}catch(g){return nn.warn("loadFormsDone parse failed",{error:g}),{}}},saveFormDone(v){try{let g=C.loadFormsDone();g[v]=Date.now(),t.set(y,JSON.stringify(g))}catch(g){nn.warn("saveFormDone serialise failed",{error:g})}},rememberStorageVersion(v){v&&v!==t.get(o)&&(nn.debug("rememberStorageVersion (force-reset on next load)",{version:v}),t.set(o,v))},clearConversation(){t.remove(p)},reset(){let v=t.get(p);v&&(t.remove(`${s}.draft.${v}`),t.remove(`${s}.messageQueue.${v}`));for(let g of[c,p,_,d,u,f,m,h,S,P,y])t.remove(g);nn.info("reset: forgot the visitor",{scope:r})}};return C}function Xo(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Wm(e){return Xo(e)&&typeof e.id=="string"&&e.id.length>0&&typeof e.text=="string"}function es(e){if(!Xo(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),Xo(e.widgetSize)&&typeof e.widgetSize.width=="number"&&typeof e.widgetSize.height=="number"&&(t.widgetSize={width:e.widgetSize.width,height:e.widgetSize.height}),t}var rr="1.13.1";var Gm="1",xc=60,Km=2e3,Sc={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}),hostEvent:e=>({name:e.name,data:e.data&&JSON.stringify(e.data)}),messageFeedback:e=>({value:e.value??"none"}),contentView:e=>({section:e.section,count:e.count}),contentOpen:e=>({contentId:e.contentId,contentCollectionId:e.contentCollectionId}),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 Qm(){let e=navigator;return e.globalPrivacyControl===!0||e.doNotTrack==="1"}function Xm(){return location.origin+location.pathname}function Jm(){try{return document.referrer?new URL(document.referrer).origin:""}catch{return""}}function kc(e,t){let n=Math.random(),r=0,o=0,a=new Set;function i(_,d){let{tracking:u,publicKey:f,aiAgentDeploymentId:m,mode:h,themeMode:S}=t.getOptions();if(!u.enabled||Qm()||n>=u.sampleRate)return;let P=performance.now();if(P-r>6e4&&(r=P,o=0),++o>xc)return;let y=new URLSearchParams;y.set("v",Gm),y.set("_ev",rr),y.set("e",_),u.token&&y.set("tk",u.token),f&&y.set("pk",f),m&&y.set("dep",m),y.set("vid",t.getVisitorId());let C=t.getConversationId();C&&y.set("cid",C),y.set("url",Xm());let v=Jm();v&&y.set("ref",v),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",h),y.set("th",S),d)for(let[T,E]of Object.entries(d))E!==void 0&&y.set(T,String(E));y.set("ts",String(Date.now()));let g=`${u.endpoint}?${y}`;if(g.length>Km)return;let k=new Image(1,1);a.add(k);function w(){return a.delete(k)}k.addEventListener("load",w,{once:!0}),k.addEventListener("error",w,{once:!0}),k.src=g}let s=[];function c(_,d){if(s&&_!=="handshake"){s.length<xc&&s.push([_,d]);return}let u=s??[];s=void 0;for(let[f,m]of u)i(f,m);i(_,d)}let p=Object.keys(Sc).map(_=>e.on(_,d=>c(_,Sc[_]?.(d))));return()=>{for(let _ of p)_();a.clear()}}var wc=`.__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-grid-container{container:__P__-generative-ui-grid / inline-size;min-width:0}.__P__-generative-ui-grid{display:grid;grid-template-columns:minmax(0,1fr);align-items:start;gap:16px}.__P__-generative-ui-cell{display:grid;align-content:start;min-width:0;gap:16px}@container __P__-generative-ui-grid (min-width: 496px){.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(2,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="2"],[data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="2"],[data-span="3"],[data-span="4"]){grid-column:span 2}}@container __P__-generative-ui-grid (min-width: 752px){.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"]){grid-template-columns:repeat(3,minmax(0,1fr))}.__P__-generative-ui-grid:is([data-columns="3"],[data-columns="4"])>.__P__-generative-ui-cell:is([data-span="3"],[data-span="4"]){grid-column:span 3}}@container __P__-generative-ui-grid (min-width: 1008px){.__P__-generative-ui-grid[data-columns="4"]{grid-template-columns:repeat(4,minmax(0,1fr))}.__P__-generative-ui-grid[data-columns="4"]>.__P__-generative-ui-cell[data-span="4"]{grid-column:span 4}}.__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
2
  `;var Cc=`: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;border-radius:var(--__P__-radius-md)}: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}}
3
- `;var Tc=`.__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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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;position:relative;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 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__-file-image,.__P__-file-chip{margin-block:var(--__P__-space-1);border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{margin:var(--__P__-space-1) 0 var(--__P__-space-2);font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;min-width:0;padding:var(--__P__-space-1) 0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label{display:flex;flex:1;align-items:center;gap:var(--__P__-space-1);min-width:0;overflow:hidden;white-space:nowrap}.__P__-steps-name{display:inline-flex;align-items:center;gap:var(--__P__-space-1);min-width:0}.__P__-steps-name-text,.__P__-steps-row-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-count,.__P__-steps-failed{flex-shrink:0;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-head .__P__-toolui-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;padding-inline-start:var(--__P__-space-2);border-inline-start:2px solid var(--__P__-border);list-style:none}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-name{flex-shrink:0;color:var(--__P__-fg);font-weight:500}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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__-toolui-status[data-status=incomplete]{--__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}
3
+ `;var Tc=`.__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:var(--__P__-radius-md);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);flex-shrink:0}.__P__-agent-avatar img{width:100%;height:100%;border-radius:inherit;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;position:relative;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 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__-file-image,.__P__-file-chip{margin-block:var(--__P__-space-1);border-radius:var(--__P__-radius-sm);color:inherit;text-decoration:none}.__P__-file-image{display:block;width:fit-content;max-width:min(100%,240px);overflow:hidden}.__P__-file-image img{max-height:240px;object-fit:cover}.__P__-file-chip{display:flex;align-items:center;gap:var(--__P__-space-2);max-width:min(100%,280px);padding:var(--__P__-space-2);border:1px solid color-mix(in srgb,currentColor 18%,transparent);background:color-mix(in srgb,currentColor 5%,transparent);transition:background var(--__P__-dur-base) var(--__P__-ease)}.__P__-file-chip:hover{background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-image:focus-visible,.__P__-file-chip:focus-visible{outline:2px solid currentColor;outline-offset:2px}.__P__-file-chip-icon{flex:none;display:grid;place-items:center;width:32px;height:32px;border-radius:var(--__P__-radius-sm);background:color-mix(in srgb,currentColor 10%,transparent)}.__P__-file-chip-text{display:grid;min-width:0;line-height:1.35}.__P__-file-chip-name{font-weight:500;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.__P__-file-chip-meta{font-size:var(--__P__-text-xs);opacity:.75}.__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__-steps{margin:var(--__P__-space-1) 0 var(--__P__-space-2);font-size:var(--__P__-text-sm)}.__P__-steps-head,.__P__-steps-row-head{display:flex;align-items:center;gap:var(--__P__-space-2);width:100%;min-width:0;padding:var(--__P__-space-1) 0;border:0;background:none;color:var(--__P__-fg-muted);font:inherit;text-align:start;cursor:pointer;-webkit-tap-highlight-color:transparent}.__P__-steps-head:hover,.__P__-steps-row-head:hover{color:var(--__P__-fg)}.__P__-steps-head:focus-visible,.__P__-steps-row-head:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px;border-radius:var(--__P__-radius-sm)}.__P__-steps-icon,.__P__-steps-row-icon{display:inline-flex;flex-shrink:0;align-items:center;justify-content:center;width:16px;height:16px}.__P__-steps-icon svg,.__P__-steps-row-icon svg{width:14px;height:14px}.__P__-steps-label{display:flex;flex:1;align-items:center;gap:var(--__P__-space-1);min-width:0;overflow:hidden;white-space:nowrap}.__P__-steps-name{display:inline-flex;align-items:center;gap:var(--__P__-space-1);min-width:0}.__P__-steps-name-text,.__P__-steps-row-summary{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.__P__-steps-count,.__P__-steps-failed,.__P__-steps-denied{flex-shrink:0;font-variant-numeric:tabular-nums}.__P__-steps-failed{color:var(--__P__-danger-text)}.__P__-steps-denied{color:var(--__P__-fg-muted)}.__P__-steps-head .__P__-toolui-chevron[data-open=true]{transform:rotate(180deg)}.__P__-steps-list{display:flex;flex-direction:column;gap:var(--__P__-space-1);margin:var(--__P__-space-1) 0 0;padding:0;padding-inline-start:var(--__P__-space-2);border-inline-start:2px solid var(--__P__-border);list-style:none}.__P__-steps-row[data-status=error] .__P__-steps-row-icon{color:var(--__P__-danger-text)}.__P__-steps-row-name{flex-shrink:0;color:var(--__P__-fg);font-weight:500}.__P__-steps-row-body{display:flex;flex-direction:column;gap:var(--__P__-space-2);margin:var(--__P__-space-1) 0 var(--__P__-space-2)}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md)}.__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__-help-more{justify-content:center;color:var(--__P__-accent-fg);font-weight:600}.__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)}@media(hover:hover){.__P__-tab:hover{background:var(--__P__-hover)}}.__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:var(--__P__-radius-md);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:var(--__P__-radius-md);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;line-height:1.45}.__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__-home-ask{padding-block:6px;padding-inline-end:6px}.__P__-home-ask .__P__-send{width:32px;height:32px;flex-shrink:0}.__P__-home-ask .__P__-send[data-shape=pill]{width:auto;padding:0 14px}.__P__-home-ask .__P__-send svg{width:16px;height:16px}.__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-vote{display:flex;align-items:center;flex-wrap:wrap;gap:var(--__P__-space-2);padding-top:var(--__P__-space-3);border-top:1px solid var(--__P__-border)}.__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;line-height:1.45;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);overflow:hidden;background:var(--__P__-surface);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-meta{display:flex;flex-wrap:wrap;align-items:center;gap:6px;color:var(--__P__-fg-muted);font-size:var(--__P__-text-sm)}.__P__-news-tag{padding:1px 8px;border-radius:6px;background:var(--__P__-hover);color:var(--__P__-fg);font-size:calc(12px * var(--__P__-text-scale));white-space:nowrap}.__P__-news-more{display:flex;align-items:center;justify-content:center;gap:var(--__P__-space-2);width:100%;min-height:44px;border:1px solid var(--__P__-border);border-radius:var(--__P__-radius);background:var(--__P__-surface);color:var(--__P__-accent-fg);font-weight:600}.__P__-news-more:hover{background:var(--__P__-bg-elevated)}.__P__-news-more:focus-visible{outline:2px solid var(--__P__-focus);outline-offset:2px}.__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__-toolui-status[data-status=incomplete]{--__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-fields{display:grid;grid-template-columns:auto minmax(0,1fr);gap:2px var(--__P__-space-2);margin:0;font-size:var(--__P__-text-xs);line-height:1.5}.__P__-toolui-fields>div{display:contents}.__P__-toolui-fields dt{color:var(--__P__-fg-muted)}.__P__-toolui-fields dd{margin:0;min-width:0;overflow:hidden;color:var(--__P__-fg);font-family:var(--__P__-font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);text-overflow:ellipsis;white-space:nowrap}.__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
4
  `;var Rc=`*,*: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}
5
5
  `;var Ic=`: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}}
6
6
  `;var rg="helpai",og="#5B5BD6",ag="#FFFFFF",ig="12px",sg="Inter, system-ui, -apple-system, 'Segoe UI', sans-serif",ns=[Ic,Rc,Tc,wc,Cc].join(`
7
- `).replace(/__P__/g,rg).replaceAll("__BRAND_ACCENT_TEXT__",ag).replaceAll("__BRAND_ACCENT__",og).replaceAll("__BRAND_RADIUS__",ig).replaceAll("__BRAND_FONT__",sg);var Ac=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Ec(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Ac){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function rr(e=document){let t=Ec(e.documentElement)??Ec(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mc(e,t=document){let n=rr(t);e(n);function r(){let s=rr(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Ac]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var lg=ne.scope("mount"),Nc=new WeakMap,Lc={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 Oc(e,t){e.style.cssText=Lc[t]}function Dr(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Jo(e={}){let t=e.position??"flow";lg.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${A.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",A.id),r.style.cssText=Lc[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,cg);let a=r.ownerDocument;if(!ug(o,a)){let s=a.createElement("style");s.textContent=ns,o.appendChild(s)}let i=document.createElement("div");return i.className=`${A.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function cg(e){let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function ug(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Nc.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(ns),Nc.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function dg(e,t){let n=A.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 pg(e,t){e.dataset.theme=t==="host"?rr():t}function _g(e,t){let n=A.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 fg(e,t){e.dataset.position=t}function Yo(e,t){e.dataset.mode=t}function $c(e,t){pg(e,t.themeMode),dg(e,t.themeOverrides),fg(e,t.position),_g(e,t.size)}var or,tt,rs,Dc,os=Object.is,Br=0,Wc=[],as=[],Qe=pe,Fc=Qe.__b,Bc=Qe.__r,Uc=Qe.diffed,Hc=Qe.__c,qc=Qe.unmount,zc=Qe.__;function Zo(e,t){Qe.__h&&Qe.__h(tt,e,Br||t),Br=0;var n=tt.__H||(tt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return Br=1,Gc(Kc,e)}function Gc(e,t,n){var r=Zo(or++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Kc(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);os(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=tt,!tt.__f)){tt.__f=!0;var o=tt.shouldComponentUpdate;tt.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,_=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,os(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function D(e,t){var n=Zo(or++,3);!Qe.__s&&ss(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,tt.__H.__h.push(n))}function Tt(e,t){var n=Zo(or++,4);!Qe.__s&&ss(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,tt.__h.push(n))}function F(e){return Br=5,ue(function(){return{current:e}},[])}function ue(e,t){var n=Zo(or++,7);return ss(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function $(e,t){return Br=8,ue(function(){return e},t)}function mg(){var e;do{for(;e=as.shift();)try{Fr(e)}catch(n){Qe.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=Wc.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Fr),t.__h.some(is),t.__h=[]}catch(n){t.__h=[],Qe.__e(n,e.__v)}}}while(as.length)}Qe.__b=function(e){tt=null,Fc&&Fc(e)},Qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),zc&&zc(e,t)},Qe.__r=function(e){Bc&&Bc(e),or=0;var t=(tt=e.__c).__H;t&&(rs==tt?tt.__h=[]:(t.__h.some(Fr),t.__h.some(is),or=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),rs=tt},Qe.diffed=function(e){Uc&&Uc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Vc(Wc.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),rs=tt=null},Qe.__c=function(e,t){t.some(function(n){try{n.__h.some(Fr),n.__h=n.__h.filter(function(r){return!r.__||is(r)})}catch(r){n.__h=[function(){throw r}]}}),Hc&&Hc(e,t)},Qe.unmount=function(e){qc&&qc(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,Vc(as.push(o))}else Fr(o)}catch(a){t=a}}),r.__H=void 0,t&&Qe.__e(t,r.__v))};var jc=typeof requestAnimationFrame=="function";function gg(e){var t,n=function(){clearTimeout(r),jc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);jc&&(t=requestAnimationFrame(n))}function Vc(e){e!=1&&Dc==Qe.requestAnimationFrame||((Dc=Qe.requestAnimationFrame)||gg)(mg)}function Fr(e){var t=tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),tt=t}function is(e){var t=tt;e.__c=e.__(),tt=t}function ss(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!os(n,e[r])})}function Kc(e,t){return typeof t=="function"?t(e):t}var hg=Symbol.for("preact-signals");function ra(){if(rn>1)rn--;else{var e,t=!1;for((function(){var o=ta;for(ta=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();Hr!==void 0;){var n=Hr;for(Hr=void 0,ea++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Xc(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(ea=0,rn--,t)throw e}}function Ft(e){if(rn>0)return e();ls=++vg,rn++;try{return e()}finally{ra()}}var Ur,$e=void 0;function qr(e){var t=$e,n=Ur;$e=void 0,Ur=void 0;try{return e()}finally{$e=t,Ur=n}}var Hr=void 0,rn=0,ea=0,vg=0,ls=0,ta=void 0,na=0;function Qc(e){if($e!==void 0){var t=e.n;if(t===void 0||t.t!==$e)return t={i:0,S:e,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:t},$e.s!==void 0&&($e.s.n=t),$e.s=t,e.n=t,32&$e.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=$e.s,t.n=void 0,$e.s.n=t,$e.s=t),t}}function st(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}st.prototype.brand=hg;st.prototype.h=function(){return!0};st.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:qr(function(){var r;(r=t.W)==null||r.call(t)}))};st.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&&qr(function(){var o;(o=t.Z)==null||o.call(t)}))}};st.prototype.subscribe=function(e){var t=this;return jt(function(){var n=t.value;qr(function(){return e(n)})},{name:"sub"})};st.prototype.valueOf=function(){return this.value};st.prototype.toString=function(){return this.value+""};st.prototype.toJSON=function(){return this.value};st.prototype.peek=function(){var e=this;return qr(function(){return e.value})};Object.defineProperty(st.prototype,"value",{get:function(){var e=Qc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ea>100)throw new Error("Cycle detected");(function(n){rn!==0&&ea===0&&n.l!==ls&&(n.l=ls,ta={S:n,v:n.v,i:n.i,o:ta})})(this),this.v=e,this.i++,na++,rn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ra()}}}});function se(e,t){return new st(e,t)}function Xc(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 Jc(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 Yc(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 Mn(e,t){st.call(this,void 0,t),this.x=e,this.s=void 0,this.g=na-1,this.f=4}Mn.prototype=new st;Mn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===na))return!0;if(this.g=na,this.f|=1,this.i>0&&!Xc(this))return this.f&=-2,!0;var e=$e;try{Jc(this),$e=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 $e=e,Yc(this),this.f&=-2,!0};Mn.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)}st.prototype.S.call(this,e)};Mn.prototype.U=function(e){if(this.t!==void 0&&(st.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)}};Mn.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(Mn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Qc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Se(e,t){return new Mn(e,t)}function Zc(e){var t=e.j;if(e.j=void 0,typeof t=="function"){rn++;var n=$e;$e=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,cs(e),r}finally{$e=n,ra()}}}function cs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Zc(e)}function bg(e){if($e!==this)throw new Error("Out-of-order effect");Yc(this),$e=e,this.f&=-2;try{8&this.f&&cs(this)}finally{ra()}}function ar(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ur&&Ur.push(this)}ar.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.j=t)}finally{e()}};ar.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Zc(this),Jc(this),rn++;var e=$e;return $e=this,bg.bind(this,e)};ar.prototype.N=function(){2&this.f||(this.f|=2,this.u=Hr,Hr=this)};ar.prototype.d=function(){this.f|=8,1&this.f||cs(this)};ar.prototype.dispose=function(){this.d()};function jt(e,t){var n=new ar(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var eu,jr,oa,yg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var tu=[];jt(function(){eu=this.N})();function ir(e,t){pe[e]=t.bind(null,pe[e]||function(){})}function zr(e){if(oa){var t=oa;oa=void 0,t()}oa=e&&e.S()}function nu(e){var t=this,n=e.data,r=Mt(n);r.name="ReactiveDom",r.value=n;var o=ue(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=Se(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=Se(function(){return!Array.isArray(p.value)&&!Li(p.value)}),d=jt(function(){if(this.N=ru,_.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){d(),u.call(this)},[_,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}nu.displayName="ReactiveTextNode";Object.defineProperties(st.prototype,{constructor:{configurable:!0,value:gn(de,null).constructor},type:{configurable:!0,value:nu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});ir("__b",function(e,t){if(zr(),jr=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof st&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});ir("__r",function(e,t){if(e(t),t.type!==de){zr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return jt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;yg&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),jr=r,zr(n)}});ir("__e",function(e,t,n,r){zr(),jr=void 0,e(t,n,r)});ir("diffed",function(e,t){zr(),jr=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],_=r[c];p===void 0?(p=Pg(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function Pg(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=se(n);return{o:function(i,s){a.value=i,r=s},d:jt(function(){this.N=ru;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}ir("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 a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var _=p.__$u;_&&(p.__$u=void 0,_.d())}}e(t)});ir("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Dt.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 a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Mt(e,t){return ue(function(){return se(e,t)},[])}function Rt(e,t){var n=F(e);return n.current=e,jr.__$f|=4,ue(function(){return Se(function(){return n.current()},t)},[])}var xg=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Sg(){Ft(function(){for(var e;e=tu.shift();)eu.call(e)})}function ru(){tu.push(this)===1&&(pe.requestAnimationFrame||xg)(Sg)}var kg="x-public-key",wg="x-ai-agent-deployment-id";function ou(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[wg]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??kg]=e.publicKey),t}}}var Cg=new Set(["home","chats","help","news"]);function au(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!Cg.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function aa(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function Vr(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function iu(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function su(e){return`${A.cssPrefix}:${e}`}function Lt(e,t,n){e.dispatchEvent(new CustomEvent(su(t),{detail:n}))}function lu(e,t){let r=Object.entries(t).map(([o,a])=>{let i=su(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}function ia(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function cu(e){let t=new URL(e),n=A.cssPrefix,r=`${A.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=ia(o,n),s=ia(i.rest,r),c=ia(a,n),p=ia(c.rest,r),_=i.value??c.value,d=(s.value??p.value)?.trim()||void 0;if(!(_===void 0&&d===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:_===void 0?void 0:aa(_),...d?{ask:d}:{},url:t.toString()}}var Wr={open:!1,ready:!1,unread:0},sa=class{constructor(){ce(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 uu=ne.scope("feedback:audio"),la=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){uu.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,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),_=o+s*a;p.gain.setValueAtTime(1e-4,_),p.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),p.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(p).connect(r),c.start(_),c.stop(_+a+.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 a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(uu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var du={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},pu={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 vn=null,ca=0;function Tg(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Rg(){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=`__${A.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 _u(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Tg())try{navigator.vibrate(e);return}catch{}if(vn??(vn=Rg()),!!vn)try{vn.label.click()}catch{}}}function fu(){ca++;let e=!1;return()=>{e||(e=!0,ca=Math.max(0,ca-1),ca===0&&vn&&(vn.input.remove(),vn.label.remove(),vn=null))}}var Ig=ne.scope("feedback"),Eg=100,ua=class{constructor(t,n){ce(this,"mutedSig",se(!1));ce(this,"audio",new la);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=fu(),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<Eg}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Ig.warn("audio play failed",{err:o,url:n}));return}let r=pu[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?du[t]:n;_u(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}};function mu(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function gu(e){return mu(e)}function hu(e){return!(!mu(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var Ag=Symbol.for("pv"),Mg=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Ag,__v:--Mg,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),pe.vnode&&pe.vnode(p),p}var ps=1,bu=2,Gr=4,yu=8,Pu=16;function Ng(e){switch(e){case ps:return"href";case bu:return"src";case Gr:return"class";case yu:return"checked";case Pu:return"start"}}var Lg=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}},Og=Lg;var vu=24;function sr(e){let t=new Uint32Array(vu);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(vu),indent:"",indent_len:0,table_state:0}}function Kr(e){e.pending.length>0&&Xe(e,`
8
- `)}function ke(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 ze(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 Ce(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&ze(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function $g(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Nn(e,t){for(e.fence_start=0;e.len>t;)ze(e)}function da(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;)ze(e);return t}function us(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?(Nn(e,e.blockquote_idx),Ce(e,t),!0):(Nn(e,n),!1):(Nn(e,r),Ce(e,t),!0)}function ds(e,t){Ce(e,25),e.spaces[e.len]=e.indent_len+t,on(e),e.token=103}function on(e){e.indent="",e.indent_len=0,e.pending=""}function _s(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 Dg(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 Fg(e){return _s(e)||Dg(e)}function Xe(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=da(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&Xe(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`
9
- `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){ze(e),on(e),e.pending=n;continue}Nn(e,e.blockquote_idx),on(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" ":da(e,e.indent_len),Ce(e,Og(e.pending.length)),on(e);continue}break;case">":{let a=$g(e,20,e.blockquote_idx+1);a===-1?(Nn(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ce(e,20)):e.blockquote_idx=a,on(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`
7
+ `).replace(/__P__/g,rg).replaceAll("__BRAND_ACCENT_TEXT__",ag).replaceAll("__BRAND_ACCENT__",og).replaceAll("__BRAND_RADIUS__",ig).replaceAll("__BRAND_FONT__",sg);var Ac=["data-theme","data-color-scheme","data-mode","data-bs-theme"];function Ec(e){if(e){if(e.classList.contains("dark"))return"dark";if(e.classList.contains("light"))return"light";for(let t of Ac){let n=e.getAttribute(t);if(n==="dark"||n==="light")return n}}}function or(e=document){let t=Ec(e.documentElement)??Ec(e.body);if(t)return t;let n=getComputedStyle(e.documentElement).colorScheme.trim();return n==="dark"||n==="light"?n:typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Mc(e,t=document){let n=or(t);e(n);function r(){let s=or(t);s!==n&&(n=s,e(s))}let o=new MutationObserver(r),a={attributes:!0,attributeFilter:["class","style",...Ac]};o.observe(t.documentElement,a),t.body&&o.observe(t.body,a);let i=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)"):void 0;return i?.addEventListener("change",r),()=>{o.disconnect(),i?.removeEventListener("change",r)}}var lg=ne.scope("mount"),Nc=new WeakMap,Lc={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 Oc(e,t){e.style.cssText=Lc[t]}function Dr(e){return e==="floating"||e==="modal"||e==="drawer"?"floating":e==="standalone"||e==="page"?"viewport":"flow"}function Jo(e={}){let t=e.position??"flow";lg.debug("createShadowMount",{position:t,hasTarget:!!e.target,hasHost:!!e.existingHost});let n=`${A.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",A.id),r.style.cssText=Lc[t];let o=r.shadowRoot??r.attachShadow({mode:"open"});for(let s of["keydown","keypress","keyup"])o.addEventListener(s,cg);let a=r.ownerDocument;if(!ug(o,a)){let s=a.createElement("style");s.textContent=ns,o.appendChild(s)}let i=document.createElement("div");return i.className=`${A.cssPrefix}-app`,o.appendChild(i),{appRoot:i,destroy:()=>r.remove(),hostElement:r,shadowRoot:o}}function cg(e){let t=e.composedPath()[0];t instanceof HTMLElement&&(t.isContentEditable||t.tagName==="INPUT"||t.tagName==="TEXTAREA"||t.tagName==="SELECT")&&e.stopPropagation()}function ug(e,t){if(!("adoptedStyleSheets"in e))return!1;let n=t.defaultView;if(!n||typeof n.CSSStyleSheet!="function")return!1;let r=Nc.get(t);if(!r)try{r=new n.CSSStyleSheet,r.replaceSync(ns),Nc.set(t,r)}catch{return!1}try{return e.adoptedStyleSheets=[r],!0}catch{return!1}}function dg(e,t){let n=A.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 pg(e,t){e.dataset.theme=t==="host"?or():t}function _g(e,t){let n=A.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 fg(e,t){e.dataset.position=t}function Yo(e,t){e.dataset.mode=t}function $c(e,t){pg(e,t.themeMode),dg(e,t.themeOverrides),fg(e,t.position),_g(e,t.size)}var ar,tt,rs,Dc,os=Object.is,Br=0,Wc=[],as=[],Qe=pe,Fc=Qe.__b,Bc=Qe.__r,Uc=Qe.diffed,Hc=Qe.__c,qc=Qe.unmount,zc=Qe.__;function Zo(e,t){Qe.__h&&Qe.__h(tt,e,Br||t),Br=0;var n=tt.__H||(tt.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function H(e){return Br=1,Gc(Kc,e)}function Gc(e,t,n){var r=Zo(ar++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Kc(void 0,t),function(a){var i=r.__N?r.__N[0]:r.__[0],s=r.t(i,a);os(i,s)||(r.__N=[s,r.__[1]],r.__c.setState({}))}],r.__c=tt,!tt.__f)){tt.__f=!0;var o=tt.shouldComponentUpdate;tt.shouldComponentUpdate=function(a,i,s){var c=this.__H;if(!c)return!0;var p=!1,_=this.props!=a;if(c.__.some(function(u){u.__N&&(p=!0,os(u.__[0],u.__N[0])||(_=!0))}),o){var d=o.call(this,a,i,s);return p?d||_:d}return!p||_}}return r.__}function D(e,t){var n=Zo(ar++,3);!Qe.__s&&ss(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,tt.__H.__h.push(n))}function Tt(e,t){var n=Zo(ar++,4);!Qe.__s&&ss(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,tt.__h.push(n))}function F(e){return Br=5,ue(function(){return{current:e}},[])}function ue(e,t){var n=Zo(ar++,7);return ss(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function $(e,t){return Br=8,ue(function(){return e},t)}function mg(){var e;do{for(;e=as.shift();)try{Fr(e)}catch(n){Qe.__e(n,{__:(e=e.__P)&&e.__v})}for(;e=Wc.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Fr),t.__h.some(is),t.__h=[]}catch(n){t.__h=[],Qe.__e(n,e.__v)}}}while(as.length)}Qe.__b=function(e){tt=null,Fc&&Fc(e)},Qe.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),zc&&zc(e,t)},Qe.__r=function(e){Bc&&Bc(e),ar=0;var t=(tt=e.__c).__H;t&&(rs==tt?tt.__h=[]:(t.__h.some(Fr),t.__h.some(is),ar=0),t.__h=[],t.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})),rs=tt},Qe.diffed=function(e){Uc&&Uc(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&Vc(Wc.push(t)),t.__H.__.some(function(n){n.u&&(n.__H=n.u)})),rs=tt=null},Qe.__c=function(e,t){t.some(function(n){try{n.__h.some(Fr),n.__h=n.__h.filter(function(r){return!r.__||is(r)})}catch(r){n.__h=[function(){throw r}]}}),Hc&&Hc(e,t)},Qe.unmount=function(e){qc&&qc(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,Vc(as.push(o))}else Fr(o)}catch(a){t=a}}),r.__H=void 0,t&&Qe.__e(t,r.__v))};var jc=typeof requestAnimationFrame=="function";function gg(e){var t,n=function(){clearTimeout(r),jc&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);jc&&(t=requestAnimationFrame(n))}function Vc(e){e!=1&&Dc==Qe.requestAnimationFrame||((Dc=Qe.requestAnimationFrame)||gg)(mg)}function Fr(e){var t=tt,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),tt=t}function is(e){var t=tt;e.__c=e.__(),tt=t}function ss(e,t){return!e||e.length!=t.length||t.some(function(n,r){return!os(n,e[r])})}function Kc(e,t){return typeof t=="function"?t(e):t}var vg=Symbol.for("preact-signals");function ra(){if(rn>1)rn--;else{var e,t=!1;for((function(){var o=ta;for(ta=void 0;o!==void 0;){var a=o.S;if(a.v===o.v)for(var i=a.t;i!==void 0;i=i.x)i.i===o.i&&(i.i=a.i);o=o.o}})();Hr!==void 0;){var n=Hr;for(Hr=void 0,ea++;n!==void 0;){var r=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Xc(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(ea=0,rn--,t)throw e}}function Ft(e){if(rn>0)return e();ls=++hg,rn++;try{return e()}finally{ra()}}var Ur,$e=void 0;function qr(e){var t=$e,n=Ur;$e=void 0,Ur=void 0;try{return e()}finally{$e=t,Ur=n}}var Hr=void 0,rn=0,ea=0,hg=0,ls=0,ta=void 0,na=0;function Qc(e){if($e!==void 0){var t=e.n;if(t===void 0||t.t!==$e)return t={i:0,S:e,p:$e.s,n:void 0,t:$e,e:void 0,x:void 0,r:t},$e.s!==void 0&&($e.s.n=t),$e.s=t,e.n=t,32&$e.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=$e.s,t.n=void 0,$e.s.n=t,$e.s=t),t}}function st(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}st.prototype.brand=vg;st.prototype.h=function(){return!0};st.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:qr(function(){var r;(r=t.W)==null||r.call(t)}))};st.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&&qr(function(){var o;(o=t.Z)==null||o.call(t)}))}};st.prototype.subscribe=function(e){var t=this;return jt(function(){var n=t.value;qr(function(){return e(n)})},{name:"sub"})};st.prototype.valueOf=function(){return this.value};st.prototype.toString=function(){return this.value+""};st.prototype.toJSON=function(){return this.value};st.prototype.peek=function(){var e=this;return qr(function(){return e.value})};Object.defineProperty(st.prototype,"value",{get:function(){var e=Qc(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ea>100)throw new Error("Cycle detected");(function(n){rn!==0&&ea===0&&n.l!==ls&&(n.l=ls,ta={S:n,v:n.v,i:n.i,o:ta})})(this),this.v=e,this.i++,na++,rn++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{ra()}}}});function se(e,t){return new st(e,t)}function Xc(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 Jc(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 Yc(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 Nn(e,t){st.call(this,void 0,t),this.x=e,this.s=void 0,this.g=na-1,this.f=4}Nn.prototype=new st;Nn.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===na))return!0;if(this.g=na,this.f|=1,this.i>0&&!Xc(this))return this.f&=-2,!0;var e=$e;try{Jc(this),$e=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 $e=e,Yc(this),this.f&=-2,!0};Nn.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)}st.prototype.S.call(this,e)};Nn.prototype.U=function(e){if(this.t!==void 0&&(st.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)}};Nn.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(Nn.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=Qc(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function Se(e,t){return new Nn(e,t)}function Zc(e){var t=e.j;if(e.j=void 0,typeof t=="function"){rn++;var n=$e;$e=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,cs(e),r}finally{$e=n,ra()}}}function cs(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,Zc(e)}function bg(e){if($e!==this)throw new Error("Out-of-order effect");Yc(this),$e=e,this.f&=-2;try{8&this.f&&cs(this)}finally{ra()}}function ir(e,t){this.x=e,this.j=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=t?.name,Ur&&Ur.push(this)}ir.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.j=t)}finally{e()}};ir.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,Zc(this),Jc(this),rn++;var e=$e;return $e=this,bg.bind(this,e)};ir.prototype.N=function(){2&this.f||(this.f|=2,this.u=Hr,Hr=this)};ir.prototype.d=function(){this.f|=8,1&this.f||cs(this)};ir.prototype.dispose=function(){this.d()};function jt(e,t){var n=new ir(e,t);try{n.c()}catch(o){throw n.d(),o}var r=n.d.bind(n);return r[Symbol.dispose]=r,r}var eu,jr,oa,yg=typeof window<"u"&&!!window.__PREACT_SIGNALS_DEVTOOLS__;var tu=[];jt(function(){eu=this.N})();function sr(e,t){pe[e]=t.bind(null,pe[e]||function(){})}function zr(e){if(oa){var t=oa;oa=void 0,t()}oa=e&&e.S()}function nu(e){var t=this,n=e.data,r=Nt(n);r.name="ReactiveDom",r.value=n;var o=ue(function(){for(var s=t,c=t.__v;c=c.__;)if(c.__c){c.__c.__$f|=4;break}var p=Se(function(){var f=r.value.value;return f===0?0:f===!0?"":f||""}),_=Se(function(){return!Array.isArray(p.value)&&!Li(p.value)}),d=jt(function(){if(this.N=ru,_.value){var f=p.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=f)}}),u=t.__$u.d;return t.__$u.d=function(){d(),u.call(this)},[_,p]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}nu.displayName="ReactiveTextNode";Object.defineProperties(st.prototype,{constructor:{configurable:!0,value:vn(de,null).constructor},type:{configurable:!0,value:nu},props:{configurable:!0,get:function(){var e=this;return{data:{get value(){return e.value}}}}},__b:{configurable:!0,value:1}});sr("__b",function(e,t){if(zr(),jr=void 0,typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof st&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)});sr("__r",function(e,t){if(e(t),t.type!==de){zr();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=(function(o,a){var i;return jt(function(){i=this},{name:a}),i.c=o,i})((function(o){return function(){var a;yg&&((a=this.y)==null||a.call(this)),o.__$f|=1,o.setState({})}})(r),typeof t.type=="function"?t.type.displayName||t.type.name:""))),jr=r,zr(n)}});sr("__e",function(e,t,n,r){zr(),jr=void 0,e(t,n,r)});sr("diffed",function(e,t){zr(),jr=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props,a=n.U;if(a)for(var i in a){var s=a[i];s===void 0||r&&i in r||(s.d(),a[i]=void 0)}if(r){a||(a={},n.U=a);for(var c in r){var p=a[c],_=r[c];p===void 0?(p=Pg(n,c,_,o),a[c]=p):p.o(_,o)}}}e(t)});function Pg(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=se(n);return{o:function(i,s){a.value=i,r=s},d:jt(function(){this.N=ru;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i!=null&&(i!==!1||t[4]==="-")?e.setAttribute(t,i):e.removeAttribute(t))})}}sr("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 a=r[o];a&&a.d()}}}var i=t.__np;if(i){var s=t.props;for(var c in i)s[c]=i[c]}t.__np=void 0}else{var p=t.__c;if(p){p.__$f|=8;var _=p.__$u;_&&(p.__$u=void 0,_.d())}}e(t)});sr("__h",function(e,t,n,r){r<3&&(t.__$f|=2),e(t,n,r)});Dt.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 a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function Nt(e,t){return ue(function(){return se(e,t)},[])}function Rt(e,t){var n=F(e);return n.current=e,jr.__$f|=4,ue(function(){return Se(function(){return n.current()},t)},[])}var xg=function(e){queueMicrotask(function(){queueMicrotask(e)})};function Sg(){Ft(function(){for(var e;e=tu.shift();)eu.call(e)})}function ru(){tu.push(this)===1&&(pe.requestAnimationFrame||xg)(Sg)}var kg="x-public-key",wg="x-ai-agent-deployment-id";function ou(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");return{headers(){let t={[wg]:e.aiAgentDeploymentId};return e.publicKey&&(t[e.publicKeyHeader??kg]=e.publicKey),t}}}var Cg=new Set(["home","chats","help","news"]);function au(e){return typeof e!="object"||e===null||!("to"in e)||typeof e.to!="string"||!Cg.has(e.to)?!1:!("id"in e)||e.id===void 0||typeof e.id=="string"}function aa(e){let[t="",...n]=e.trim().split("/");if(t===""||t==="open")return;let r=n.join("/");return r?{to:t,id:r}:{to:t}}function Vr(e,t){return{text:e,send:typeof t=="object"&&t!==null&&"send"in t&&t.send===!0}}function iu(e){if(typeof e!="object"||e===null||!("text"in e)||typeof e.text!="string")return;let t=e.text.trim();return t?{text:t,send:"send"in e&&e.send===!0}:void 0}function su(e){return`${A.cssPrefix}:${e}`}function Lt(e,t,n){e.dispatchEvent(new CustomEvent(su(t),{detail:n}))}function lu(e,t){let r=Object.entries(t).map(([o,a])=>{let i=su(o);function s(c){return a(c.detail)}return e.addEventListener(i,s),[i,s]});return()=>{for(let[o,a]of r)e.removeEventListener(o,a)}}function ia(e,t){let n=[],r;for(let o of e){let a=new URLSearchParams(o);a.has(t)?r??(r=a.get(t)??""):n.push(o)}return{value:r,rest:n}}function cu(e){let t=new URL(e),n=A.cssPrefix,r=`${A.cssPrefix}-ask`,o=t.search.slice(1).split("&").filter(Boolean),a=t.hash.slice(1).split("&").filter(Boolean),i=ia(o,n),s=ia(i.rest,r),c=ia(a,n),p=ia(c.rest,r),_=i.value??c.value,d=(s.value??p.value)?.trim()||void 0;if(!(_===void 0&&d===void 0))return t.search=s.rest.join("&"),t.hash=p.rest.join("&"),{target:_===void 0?void 0:aa(_),...d?{ask:d}:{},url:t.toString()}}var Wr={open:!1,ready:!1,unread:0},sa=class{constructor(){ce(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 uu=ne.scope("feedback:audio"),la=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){uu.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,a=t.noteMs/1e3;t.notes.forEach((i,s)=>{let c=n.createOscillator();c.type=t.type,c.frequency.value=i;let p=n.createGain(),_=o+s*a;p.gain.setValueAtTime(1e-4,_),p.gain.exponentialRampToValueAtTime(t.peakGain,_+.005),p.gain.exponentialRampToValueAtTime(1e-4,_+a),c.connect(p).connect(r),c.start(_),c.stop(_+a+.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 a=n.createBufferSource();a.buffer=o,a.connect(r),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 r=this.ctx,o=fetch(t).then(a=>a.ok?a.arrayBuffer():Promise.reject(new Error(`fetch ${a.status}`))).then(a=>r.decodeAudioData(a)).then(a=>(this.buffers.set(t,a),a)).catch(a=>(uu.warn("audio fetch/decode failed",{url:t,err:a}),this.buffers.delete(t),null));return this.buffers.set(t,o),o}};var du={messageReceived:10,messageSent:0,error:[20,40,20],voiceStart:10,voiceStop:0},pu={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 bn=null,ca=0;function Tg(){return typeof navigator<"u"&&typeof navigator.vibrate=="function"}function Rg(){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=`__${A.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 _u(e){if(!(e===0||Array.isArray(e)&&e.every(t=>t===0))){if(Tg())try{navigator.vibrate(e);return}catch{}if(bn??(bn=Rg()),!!bn)try{bn.label.click()}catch{}}}function fu(){ca++;let e=!1;return()=>{e||(e=!0,ca=Math.max(0,ca-1),ca===0&&bn&&(bn.input.remove(),bn.label.remove(),bn=null))}}var Ig=ne.scope("feedback"),Eg=100,ua=class{constructor(t,n){ce(this,"mutedSig",se(!1));ce(this,"audio",new la);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=fu(),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<Eg}playSound(t){let n=this.sound.events?.[t];if(n===!1)return;if(typeof n=="string"){this.audio.playUrl(n).catch(o=>Ig.warn("audio play failed",{err:o,url:n}));return}let r=pu[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?du[t]:n;_u(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}};function mu(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function gu(e){return mu(e)}function vu(e){return!(!mu(e)||e.navigation!==void 0&&!Array.isArray(e.navigation)||e.linkCards!==void 0&&!Array.isArray(e.linkCards))}var Ag=Symbol.for("pv"),Mg=0;function l(e,t,n,r,o,a){t||(t={});var i,s,c=t;if("ref"in c&&typeof e!="function")for(s in c={},t)s=="ref"?i=t[s]:c[s]=t[s];var p={type:e,props:c,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:Ag,__v:--Mg,__i:-1,__u:0};return(o||a)&&(p.__source=o,p.__self=a),pe.vnode&&pe.vnode(p),p}var ps=1,bu=2,Gr=4,yu=8,Pu=16;function Ng(e){switch(e){case ps:return"href";case bu:return"src";case Gr:return"class";case yu:return"checked";case Pu:return"start"}}var Lg=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}},Og=Lg;var hu=24;function lr(e){let t=new Uint32Array(hu);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(hu),indent:"",indent_len:0,table_state:0}}function Kr(e){e.pending.length>0&&Xe(e,`
8
+ `)}function ke(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 ze(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 Ce(e,t){(e.tokens[e.len]===24||e.tokens[e.len]===23)&&t!==25&&ze(e),e.len+=1,e.tokens[e.len]=t,e.token=t,e.renderer.add_token(e.renderer.data,t)}function $g(e,t,n){for(;n<=e.len;){if(e.tokens[n]===t)return n;n+=1}return-1}function Ln(e,t){for(e.fence_start=0;e.len>t;)ze(e)}function da(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;)ze(e);return t}function us(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?(Ln(e,e.blockquote_idx),Ce(e,t),!0):(Ln(e,n),!1):(Ln(e,r),Ce(e,t),!0)}function ds(e,t){Ce(e,25),e.spaces[e.len]=e.indent_len+t,on(e),e.token=103}function on(e){e.indent="",e.indent_len=0,e.pending=""}function _s(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 Dg(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 Fg(e){return _s(e)||Dg(e)}function Xe(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=da(e,e.indent_len);e.indent_len=0,e.token=e.tokens[e.len],o>0&&Xe(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`
9
+ `:if(console.assert(e.pending.length===1),e.tokens[e.len]===25&&e.token===21){ze(e),on(e),e.pending=n;continue}Ln(e,e.blockquote_idx),on(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" ":da(e,e.indent_len),Ce(e,Og(e.pending.length)),on(e);continue}break;case">":{let a=$g(e,20,e.blockquote_idx+1);a===-1?(Ln(e,e.blockquote_idx),e.blockquote_idx+=1,e.fence_start=0,Ce(e,20)):e.blockquote_idx=a,on(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`
10
10
  `:if(e.hr_chars<3)break;da(e,e.indent_len),e.renderer.add_token(e.renderer.data,22),e.renderer.end_token(e.renderer.data),on(e),e.hr_chars=0;continue}e.hr_chars=0}if(e.pending[0]!=="_"&&e.pending[1]===" "){us(e,23),ds(e,2),Xe(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):(Ce(e,2),on(e),e.fence_start=0,Xe(e,r));continue;case`
11
- `:{da(e,e.indent_len),Ce(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Gr,e.pending.slice(e.fence_start)),on(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;us(e,23),ds(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;us(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Pu,e.pending.slice(0,-1)),ds(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||_s(a)){e.pending=r;continue}}break;case"|":Nn(e,e.blockquote_idx),Ce(e,27),Ce(e,28),e.pending="",Xe(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 a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}o=e.indent.slice(a)+r,Ce(e,9)}else Ce(e,2);on(e),Xe(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
11
+ `:{da(e,e.indent_len),Ce(e,10),e.pending.length>e.fence_start&&e.renderer.set_attr(e.renderer.data,Gr,e.pending.slice(e.fence_start)),on(e),e.token=101;continue}default:e.pending=r;continue}case"+":if(n!==" ")break;us(e,23),ds(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;us(e,24)&&e.pending!=="1."&&e.renderer.set_attr(e.renderer.data,Pu,e.pending.slice(0,-1)),ds(e,e.pending.length+1);continue}else{let a=n.charCodeAt(0);if(a===46||_s(a)){e.pending=r;continue}}break;case"|":Ln(e,e.blockquote_idx),Ce(e,27),Ce(e,28),e.pending="",Xe(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 a=0;for(;a<4;a+=1)if(e.indent[a]===" "){a=a+1;break}o=e.indent.slice(a)+r,Ce(e,9)}else Ce(e,2);on(e),Xe(e,o);continue;case 27:if(e.table_state===1)switch(n){case"-":case" ":case"|":case":":e.pending=r;continue;case`
12
12
  `:e.table_state=2,e.pending="";continue;default:ze(e),e.table_state=0;break}else switch(e.pending){case"|":Ce(e,28),e.pending="",Xe(e,n);continue;case`
13
13
  `:ze(e),e.pending="",e.table_state=0,Xe(e,n);continue}break;case 28:switch(e.pending){case"":break;case"|":Ce(e,29),ze(e),e.pending="",Xe(e,n);continue;case`
14
14
  `:ze(e),e.table_state=Math.min(e.table_state+1,2),e.pending="",Xe(e,n);continue;default:Ce(e,29),Xe(e,n);continue}break;case 29:if(e.pending==="|"){ke(e),ze(e),e.pending="",Xe(e,n);continue}break;case 9:switch(r){case`
@@ -28,37 +28,37 @@
28
28
  `?(ke(e),Ce(e,30),e.pending=""):(e.token=e.tokens[e.len],e.pending[0]==="\\"?e.text+="[":e.text+="$$",e.pending="",Xe(e,n));continue;case 30:if(r==="\\]"||r==="$$"){ke(e),ze(e),e.pending="";continue}break;case 31:if(r==="\\)"||e.pending[0]==="$"){ke(e),ze(e),n===")"?e.pending="":e.pending=n;continue}break;case 102:r==="http://"||r==="https://"?(ke(e),Ce(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],Xe(e,n));continue;case 17:case 19:if(e.pending==="]"){ke(e),n==="("?e.pending=r:(ze(e),e.pending=n);continue}if(e.pending[0]==="]"&&e.pending[1]==="("){if(n===")"){let a=e.token===17?ps:bu,i=e.pending.slice(2);e.renderer.set_attr(e.renderer.data,a,i),ze(e),e.pending=""}else e.pending+=n;continue}break;case 18:n===" "||n===`
29
29
  `||n==="\\"?(e.renderer.set_attr(e.renderer.data,ps,e.pending),ke(e),ze(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===">"){ke(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),Xe(e,n);continue}switch(e.pending[0]){case"\\":if(e.token===19||e.token===30||e.token===31)break;switch(n){case"(":ke(e),Ce(e,31),e.pending="";continue;case"[":e.token=105,e.pending=r;continue;case`
30
30
  `:e.pending=n;continue;default:let o=n.charCodeAt(0);e.pending="",e.text+=_s(o)||o>=65&&o<=90||o>=97&&o<=122?r:n;continue}case`
31
- `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:ke(e),Nn(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:ke(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){ke(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,ke(e),Ce(e,11),e.text=n===" "||n===`
31
+ `:switch(e.token){case 19:case 30:case 31:break;case 3:case 4:case 5:case 6:case 7:case 8:ke(e),Ln(e,e.blockquote_idx),e.blockquote_idx=0,e.pending=n;continue;default:ke(e),e.pending=n,e.token=21,e.blockquote_idx=0;continue}break;case"<":if(e.token!==19&&e.token!==30&&e.token!==31){ke(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,ke(e),Ce(e,11),e.text=n===" "||n===`
32
32
  `?"":n,e.pending="");continue;case"_":case"*":{if(e.token===19||e.token===30||e.token===31||e.token===14)break;let o=12,a=14,i=e.pending[0];if(i==="_"&&(o=13,a=15),e.pending.length===1){if(i===n){e.pending=r;continue}if(n!==" "&&n!==`
33
33
  `){ke(e),Ce(e,o),e.pending=n;continue}}else{if(i===n){ke(e),Ce(e,a),Ce(e,o),e.pending="";continue}if(n!==" "&&n!==`
34
34
  `){ke(e),Ce(e,a),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!==`
35
- `){ke(e),Ce(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(Fg(n.charCodeAt(0)))break;ke(e),Ce(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ke(e),Ce(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ke(e),Ce(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}ke(e)}function Qr(e){return{add_token:Bg,end_token:fs,add_text:ms,set_attr:gs,data:{nodes:[e,,,,,],index:0}}}function Bg(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 fs(e){e.index-=1}function ms(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function gs(e,t,n){e.nodes[e.index].setAttribute(Ng(t),n)}var lr={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},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},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}}}};var Su=Xr;var Ug={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},Hg={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function rt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=rt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return rt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return rt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=d===s}else var p=!0;if(p){if(e.statementId!==void 0){let d=s;if(typeof e.statementId!="string")return rt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=d===s}else var p=!0;if(p)if(e.props!==void 0){let d=e.props,u=s;if(s===u)if(d&&typeof d=="object"&&!Array.isArray(d)){let m;if(d.text===void 0&&(m="text"))return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let v=s;for(let S in d)if(S!=="text"){return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S}}],!1;break}if(v===s&&d.text!==void 0&&typeof d.text!="string")return rt.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return rt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return rt.errors=i,s===0}rt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return Je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.title===void 0&&(v="title")||u.body===void 0&&(v="body"))return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let S=s;for(let P in u)if(!(P==="title"||P==="body")){return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(S===s){if(u.title!==void 0){let P=s;if(typeof u.title!="string")return Je.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.body!==void 0){let P=s;if(typeof u.body!="string")return Je.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}else return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Je.errors=i,s===0}Je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let v;if(u.label===void 0&&(v="label")||u.value===void 0&&(v="value")||u.detail===void 0&&(v="detail"))return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:v}}],!1;{let S=s;for(let P in u)if(!(P==="label"||P==="value"||P==="detail")){return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(S===s){if(u.label!==void 0){let P=s;if(typeof u.label!="string")return je.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_){if(u.value!==void 0){let P=s;if(typeof u.value!="string")return je.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.detail!==void 0){let P=s;if(typeof u.detail!="string")return je.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}}else return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return je.errors=i,s===0}je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Me(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Me.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Me.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Table")return Me.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return Me.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,S=s;if(s===S)if(v&&typeof v=="object"&&!Array.isArray(v)){let y;if(v.title===void 0&&(y="title")||v.columns===void 0&&(y="columns")||v.rows===void 0&&(y="rows"))return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let h in v)if(!(h==="title"||h==="columns"||h==="rows")){return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.title!==void 0){let h=s;if(typeof v.title!="string")return Me.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=h===s}else var _=!0;if(_){if(v.columns!==void 0){let h=v.columns,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let T=0;T<w;T++){let E=s;if(typeof h[T]!="string")return Me.errors=[{instancePath:t+"/props/columns/"+T,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=E===s;if(!d)break}}else return Me.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0;if(_)if(v.rows!==void 0){let h=v.rows,g=s;if(s===g)if(Array.isArray(h)){var u=!0;let w=h.length;for(let T=0;T<w;T++){let E=h[T],M=s;if(s===M)if(Array.isArray(E)){var f=!0;let O=E.length;for(let z=0;z<O;z++){let V=s;if(typeof E[z]!="string")return Me.errors=[{instancePath:t+"/props/rows/"+T+"/"+z,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===s;if(!f)break}}else return Me.errors=[{instancePath:t+"/props/rows/"+T,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=M===s;if(!u)break}}else return Me.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}}else return Me.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return Me.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Me.errors=i,s===0}Me.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var qg={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{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}},required:["typeName","statementId","props"]};function Ie(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ie.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Ie.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Ie.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Ie.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,v=s;if(s===v)if(m&&typeof m=="object"&&!Array.isArray(m)){let P;if(m.title===void 0&&(P="title")||m.type===void 0&&(P="type")||m.data===void 0&&(P="data"))return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let y=s;for(let C in m)if(!(C==="title"||C==="type"||C==="data")){return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C}}],!1;break}if(y===s){if(m.title!==void 0){let C=s;if(typeof m.title!="string")return Ie.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=C===s}else var _=!0;if(_){if(m.type!==void 0){let C=m.type,h=s;if(typeof C!="string")return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(C==="bar"||C==="line"))return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:qg.properties.props.properties.type.enum}}],!1;var _=h===s}else var _=!0;if(_)if(m.data!==void 0){let C=m.data,h=s;if(s===h)if(Array.isArray(C)){var d=!0;let k=C.length;for(let w=0;w<k;w++){let T=C[w],E=s;if(s===E)if(T&&typeof T=="object"&&!Array.isArray(T)){let L;if(T.label===void 0&&(L="label")||T.value===void 0&&(L="value"))return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:L}}],!1;{let O=s;for(let z in T)if(!(z==="label"||z==="value")){return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z}}],!1;break}if(O===s){if(T.label!==void 0){let z=s;if(typeof T.label!="string")return Ie.errors=[{instancePath:t+"/props/data/"+w+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=z===s}else var u=!0;if(u)if(T.value!==void 0){let z=T.value,V=s;if(!(typeof z=="number"&&isFinite(z)))return Ie.errors=[{instancePath:t+"/props/data/"+w+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=V===s}else var u=!0}}}else return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=E===s;if(!d)break}}else return Ie.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var _=h===s}else var _=!0}}}}else return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=v===s}else var p=!0}}else return Ie.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ie.errors=i,s===0}Ie.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function nt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=nt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return nt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Cell")return nt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return nt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,S=s;if(s===S)if(v&&typeof v=="object"&&!Array.isArray(v)){let y;if(v.children===void 0&&(y="children"))return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let h in v)if(!(h==="children"||h==="span")){return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var _=!0;let k=h.length;for(let w=0;w<k;w++){let T=h[w],E=s,M=s,L=!1,O=s;rt(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var u=O===s;if(L=L||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let z=s;Je(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var u=z===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;je(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var u=V===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let K=s;Me(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var u=K===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let te=s;Ie(T,{instancePath:t+"/props/children/"+w,parentData:h,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var u=te===s;if(L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),L)s=M,i!==null&&(M?i.length=M:i=null);else{let Y={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[Y]:i.push(Y),s++,nt.errors=i,!1}var _=E===s;if(!_)break}}else return nt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=g===s}else var f=!0;if(f)if(v.span!==void 0){let h=v.span,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Hg.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return nt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return nt.errors=i,s===0}nt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function mt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=mt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return mt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let v=s;if(e.typeName!=="Grid")return mt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=v===s}else var p=!0;if(p){if(e.statementId!==void 0){let v=s;if(typeof e.statementId!="string")return mt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=v===s}else var p=!0;if(p)if(e.props!==void 0){let v=e.props,S=s;if(s===S)if(v&&typeof v=="object"&&!Array.isArray(v)){let y;if(v.columns===void 0&&(y="columns")||v.children===void 0&&(y="children"))return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let h in v)if(!(h==="columns"||h==="children")){return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:h}}],!1;break}if(C===s){if(v.columns!==void 0){let h=v.columns,g=s;if(!(typeof h=="number"&&!(h%1)&&!isNaN(h)&&isFinite(h)))return mt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(h===1||h===2||h===3||h===4))return mt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:Ug.properties.props.properties.columns.enum}}],!1;var _=g===s}else var _=!0;if(_)if(v.children!==void 0){let h=v.children,g=s;if(s===g)if(Array.isArray(h)){var d=!0;let w=h.length;for(let T=0;T<w;T++){let E=h[T],M=s,L=s,O=!1,z=s;nt(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var f=z===s;if(O=O||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;rt(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var f=V===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let K=s;Je(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var f=K===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let te=s;je(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var f=te===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let G=s;Me(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var f=G===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let Y=s;Ie(E,{instancePath:t+"/props/children/"+T,parentData:h,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var f=Y===s;if(O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),O)s=L,i!==null&&(L?i.length=L:i=null);else{let _e={instancePath:t+"/props/children/"+T,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[_e]:i.push(_e),s++,mt.errors=i,!1}var d=M===s;if(!d)break}}else return mt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}else return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return mt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return mt.errors=i,s===0}mt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Xr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Xr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;mt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?mt.errors:i.concat(mt.errors),s=i.length);var C=d===s;if(_=_||C,C){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;nt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var C=f===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;rt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var C=m===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let v=s;Je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var C=v===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let S=s;je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var C=S===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=s;Me(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Me.errors:i.concat(Me.errors),s=i.length);var C=P===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let y=s;Ie(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var C=y===s;if(_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),_)s=p,i!==null&&(p?i.length=p:i=null);else{let h={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[h]:i.push(h),s++,Xr.errors=i,!1}return Xr.errors=i,c.props=u,s===0}Xr.evaluated={dynamicProps:!0,dynamicItems:!1};function ku(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 zg=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function Ln(e){return!e||typeof e!="object"||Array.isArray(e)?!1:zg.has(e.k)}function Jr(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 pa(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(pa)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,pa(n)])}:{k:"Null"}}function _a(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=_a(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=_a(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var fa=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}]]),wu={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},bn={Query:"Query",Mutation:"Mutation"};function Yr(e){return e?.callDefs??fa}function Zr(e){return fa.has(e)}function cr(e){return e in bn}var R;(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"})(R||(R={}));var jg=1,Cu=2,Tu=3,hs=4,eo=5,vs=6,ma=7,Ru=8,Vg=9;function ga(e){let t=0,n=()=>e[t]??{t:R.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case R.Question:return jg;case R.Or:return Cu;case R.And:return Tu;case R.EqEq:case R.NotEq:return hs;case R.Greater:case R.Less:case R.GreaterEq:case R.LessEq:return eo;case R.Plus:case R.Minus:return vs;case R.Star:case R.Slash:case R.Percent:return ma;case R.Dot:case R.LBrack:return Vg;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===R.Str)return r(),{k:"Str",v:u.v};if(u.t===R.Num)return r(),{k:"Num",v:u.v};if(u.t===R.True)return r(),{k:"Bool",v:!0};if(u.t===R.False)return r(),{k:"Bool",v:!1};if(u.t===R.Null)return r(),{k:"Null"};if(u.t===R.LBrack)return _();if(u.t===R.LBrace)return d();if(u.t===R.StateVar){let f=u.v;if(r(),n().t===R.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===R.Type){let f=u.v;return e[t+1]?.t===R.LParen&&(!Zr(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===R.BuiltinCall){if(e[t+1]?.t===R.LParen){let f=p();return f.k==="Comp"&&!Zr(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===R.Ident)return r(),{k:"Ref",n:u.v};if(u.t===R.Not)return r(),{k:"UnaryOp",op:"!",operand:i(Ru)};if(u.t===R.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(Ru)};if(u.t===R.LParen){r();let f=i(0);return o(R.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===R.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(vs)};if(f.t===R.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(vs)};if(f.t===R.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(ma)};if(f.t===R.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(ma)};if(f.t===R.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(ma)};if(f.t===R.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(hs)};if(f.t===R.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(hs)};if(f.t===R.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(eo)};if(f.t===R.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(eo)};if(f.t===R.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(eo)};if(f.t===R.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(eo)};if(f.t===R.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(Tu)};if(f.t===R.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(Cu)};if(f.t===R.Question){r();let m=i(0);o(R.Colon);let v=i(0);return{k:"Ternary",cond:u,then:m,else:v}}if(f.t===R.Dot){r();let m=n(),v=m.t===R.Ident||m.t===R.Type||m.t===R.Str||m.t===R.Num?(r(),String(m.v)):m.t===R.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:v}}if(f.t===R.LBrack){r();let m=i(0);return o(R.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(R.LParen);let f=[];for(;n().t!==R.RParen&&n().t!==R.EOF;)f.push(i(0)),n().t===R.Comma&&r();return o(R.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==R.RBrack&&n().t!==R.EOF;)u.push(i(0)),n().t===R.Comma&&r();return o(R.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==R.RBrace&&n().t!==R.EOF;){let f=n(),m=f.t===R.Ident||f.t===R.Str||f.t===R.Type||f.t===R.Num?(r(),String(f.v)):f.t===R.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(R.Colon),u.push([m,i(0)]),n().t===R.Comma&&r()}return o(R.RBrace),{k:"Obj",entries:u}}return i(0)}function ha(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===`
35
+ `){ke(e),Ce(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(Fg(n.charCodeAt(0)))break;ke(e),Ce(e,31),e.pending=n;continue}break;case"[":if(e.token!==19&&e.token!==17&&e.token!==30&&e.token!==31&&n!=="]"){ke(e),Ce(e,17),e.pending=n;continue}break;case"!":if(e.token!==19&&n==="["){ke(e),Ce(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}ke(e)}function Qr(e){return{add_token:Bg,end_token:fs,add_text:ms,set_attr:gs,data:{nodes:[e,,,,,],index:0}}}function Bg(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 fs(e){e.index-=1}function ms(e,t){e.nodes[e.index].appendChild(document.createTextNode(t))}function gs(e,t,n){e.nodes[e.index].setAttribute(Ng(t),n)}var cr={root:"Root",schema:{$schema:"https://json-schema.org/draft/2020-12/schema",type:"object",properties:{Root:{$ref:"#/$defs/Root"},Grid:{$ref:"#/$defs/Grid"},Cell:{$ref:"#/$defs/Cell"},Text:{$ref:"#/$defs/Text"},Card:{$ref:"#/$defs/Card"},Metric:{$ref:"#/$defs/Metric"},Table:{$ref:"#/$defs/Table"},Chart:{$ref:"#/$defs/Chart"}},required:["Root","Grid","Cell","Text","Card","Metric","Table","Chart"],additionalProperties:!1,$defs:{Root:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Grid"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["children"],additionalProperties:!1},Grid:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1},Cell:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1},Text:{type:"object",properties:{text:{type:"string"}},required:["text"],additionalProperties:!1},Card:{type:"object",properties:{title:{type:"string"},body:{type:"string"}},required:["title","body"],additionalProperties:!1},Metric:{type:"object",properties:{label:{type:"string"},value:{type:"string"},detail:{type:"string"}},required:["label","value","detail"],additionalProperties:!1},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},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}}}};var Su=Xr;var Ug={type:"object",properties:{typeName:{const:"Grid"},statementId:{type:"string"},props:{type:"object",properties:{columns:{type:"integer",enum:[1,2,3,4],default:1},children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Cell"},{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}}},required:["columns","children"],additionalProperties:!1}},required:["typeName","statementId","props"]},Hg={type:"object",properties:{typeName:{const:"Cell"},statementId:{type:"string"},props:{type:"object",properties:{children:{type:"array",items:{anyOf:[{$ref:"#/$defs/Text"},{$ref:"#/$defs/Card"},{$ref:"#/$defs/Metric"},{$ref:"#/$defs/Table"},{$ref:"#/$defs/Chart"}]}},span:{type:"integer",enum:[1,2,3,4],default:1}},required:["children"],additionalProperties:!1}},required:["typeName","statementId","props"]};function rt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=rt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let _;if(e.typeName===void 0&&(_="typeName")||e.statementId===void 0&&(_="statementId")||e.props===void 0&&(_="props"))return rt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:_}}],!1;if(e.typeName!==void 0){let d=s;if(e.typeName!=="Text")return rt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Text"}}],!1;var p=d===s}else var p=!0;if(p){if(e.statementId!==void 0){let d=s;if(typeof e.statementId!="string")return rt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=d===s}else var p=!0;if(p)if(e.props!==void 0){let d=e.props,u=s;if(s===u)if(d&&typeof d=="object"&&!Array.isArray(d)){let m;if(d.text===void 0&&(m="text"))return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:m}}],!1;{let h=s;for(let S in d)if(S!=="text"){return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:S}}],!1;break}if(h===s&&d.text!==void 0&&typeof d.text!="string")return rt.errors=[{instancePath:t+"/props/text",schemaPath:"#/properties/props/properties/text/type",keyword:"type",params:{type:"string"}}],!1}}else return rt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=u===s}else var p=!0}}else return rt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return rt.errors=i,s===0}rt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return Je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Card")return Je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Card"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return Je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let h;if(u.title===void 0&&(h="title")||u.body===void 0&&(h="body"))return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:h}}],!1;{let S=s;for(let P in u)if(!(P==="title"||P==="body")){return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(S===s){if(u.title!==void 0){let P=s;if(typeof u.title!="string")return Je.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.body!==void 0){let P=s;if(typeof u.body!="string")return Je.errors=[{instancePath:t+"/props/body",schemaPath:"#/properties/props/properties/body/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}else return Je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return Je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Je.errors=i,s===0}Je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function je(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=je.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let d;if(e.typeName===void 0&&(d="typeName")||e.statementId===void 0&&(d="statementId")||e.props===void 0&&(d="props"))return je.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:d}}],!1;if(e.typeName!==void 0){let u=s;if(e.typeName!=="Metric")return je.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Metric"}}],!1;var p=u===s}else var p=!0;if(p){if(e.statementId!==void 0){let u=s;if(typeof e.statementId!="string")return je.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=u===s}else var p=!0;if(p)if(e.props!==void 0){let u=e.props,f=s;if(s===f)if(u&&typeof u=="object"&&!Array.isArray(u)){let h;if(u.label===void 0&&(h="label")||u.value===void 0&&(h="value")||u.detail===void 0&&(h="detail"))return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:h}}],!1;{let S=s;for(let P in u)if(!(P==="label"||P==="value"||P==="detail")){return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:P}}],!1;break}if(S===s){if(u.label!==void 0){let P=s;if(typeof u.label!="string")return je.errors=[{instancePath:t+"/props/label",schemaPath:"#/properties/props/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_){if(u.value!==void 0){let P=s;if(typeof u.value!="string")return je.errors=[{instancePath:t+"/props/value",schemaPath:"#/properties/props/properties/value/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0;if(_)if(u.detail!==void 0){let P=s;if(typeof u.detail!="string")return je.errors=[{instancePath:t+"/props/detail",schemaPath:"#/properties/props/properties/detail/type",keyword:"type",params:{type:"string"}}],!1;var _=P===s}else var _=!0}}}}else return je.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=f===s}else var p=!0}}else return je.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return je.errors=i,s===0}je.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Ne(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ne.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return Ne.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Table")return Ne.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Table"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return Ne.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,S=s;if(s===S)if(h&&typeof h=="object"&&!Array.isArray(h)){let y;if(h.title===void 0&&(y="title")||h.columns===void 0&&(y="columns")||h.rows===void 0&&(y="rows"))return Ne.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let v in h)if(!(v==="title"||v==="columns"||v==="rows")){return Ne.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v}}],!1;break}if(C===s){if(h.title!==void 0){let v=s;if(typeof h.title!="string")return Ne.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=v===s}else var _=!0;if(_){if(h.columns!==void 0){let v=h.columns,g=s;if(s===g)if(Array.isArray(v)){var d=!0;let w=v.length;for(let T=0;T<w;T++){let E=s;if(typeof v[T]!="string")return Ne.errors=[{instancePath:t+"/props/columns/"+T,schemaPath:"#/properties/props/properties/columns/items/type",keyword:"type",params:{type:"string"}}],!1;var d=E===s;if(!d)break}}else return Ne.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0;if(_)if(h.rows!==void 0){let v=h.rows,g=s;if(s===g)if(Array.isArray(v)){var u=!0;let w=v.length;for(let T=0;T<w;T++){let E=v[T],M=s;if(s===M)if(Array.isArray(E)){var f=!0;let O=E.length;for(let z=0;z<O;z++){let V=s;if(typeof E[z]!="string")return Ne.errors=[{instancePath:t+"/props/rows/"+T+"/"+z,schemaPath:"#/properties/props/properties/rows/items/items/type",keyword:"type",params:{type:"string"}}],!1;var f=V===s;if(!f)break}}else return Ne.errors=[{instancePath:t+"/props/rows/"+T,schemaPath:"#/properties/props/properties/rows/items/type",keyword:"type",params:{type:"array"}}],!1;var u=M===s;if(!u)break}}else return Ne.errors=[{instancePath:t+"/props/rows",schemaPath:"#/properties/props/properties/rows/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}}else return Ne.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return Ne.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ne.errors=i,s===0}Ne.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};var qg={type:"object",properties:{typeName:{const:"Chart"},statementId:{type:"string"},props:{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}},required:["typeName","statementId","props"]};function Ie(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Ie.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let f;if(e.typeName===void 0&&(f="typeName")||e.statementId===void 0&&(f="statementId")||e.props===void 0&&(f="props"))return Ie.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:f}}],!1;if(e.typeName!==void 0){let m=s;if(e.typeName!=="Chart")return Ie.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Chart"}}],!1;var p=m===s}else var p=!0;if(p){if(e.statementId!==void 0){let m=s;if(typeof e.statementId!="string")return Ie.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=m===s}else var p=!0;if(p)if(e.props!==void 0){let m=e.props,h=s;if(s===h)if(m&&typeof m=="object"&&!Array.isArray(m)){let P;if(m.title===void 0&&(P="title")||m.type===void 0&&(P="type")||m.data===void 0&&(P="data"))return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:P}}],!1;{let y=s;for(let C in m)if(!(C==="title"||C==="type"||C==="data")){return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:C}}],!1;break}if(y===s){if(m.title!==void 0){let C=s;if(typeof m.title!="string")return Ie.errors=[{instancePath:t+"/props/title",schemaPath:"#/properties/props/properties/title/type",keyword:"type",params:{type:"string"}}],!1;var _=C===s}else var _=!0;if(_){if(m.type!==void 0){let C=m.type,v=s;if(typeof C!="string")return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/type",keyword:"type",params:{type:"string"}}],!1;if(!(C==="bar"||C==="line"))return Ie.errors=[{instancePath:t+"/props/type",schemaPath:"#/properties/props/properties/type/enum",keyword:"enum",params:{allowedValues:qg.properties.props.properties.type.enum}}],!1;var _=v===s}else var _=!0;if(_)if(m.data!==void 0){let C=m.data,v=s;if(s===v)if(Array.isArray(C)){var d=!0;let k=C.length;for(let w=0;w<k;w++){let T=C[w],E=s;if(s===E)if(T&&typeof T=="object"&&!Array.isArray(T)){let L;if(T.label===void 0&&(L="label")||T.value===void 0&&(L="value"))return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/required",keyword:"required",params:{missingProperty:L}}],!1;{let O=s;for(let z in T)if(!(z==="label"||z==="value")){return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:z}}],!1;break}if(O===s){if(T.label!==void 0){let z=s;if(typeof T.label!="string")return Ie.errors=[{instancePath:t+"/props/data/"+w+"/label",schemaPath:"#/properties/props/properties/data/items/properties/label/type",keyword:"type",params:{type:"string"}}],!1;var u=z===s}else var u=!0;if(u)if(T.value!==void 0){let z=T.value,V=s;if(!(typeof z=="number"&&isFinite(z)))return Ie.errors=[{instancePath:t+"/props/data/"+w+"/value",schemaPath:"#/properties/props/properties/data/items/properties/value/type",keyword:"type",params:{type:"number"}}],!1;var u=V===s}else var u=!0}}}else return Ie.errors=[{instancePath:t+"/props/data/"+w,schemaPath:"#/properties/props/properties/data/items/type",keyword:"type",params:{type:"object"}}],!1;var d=E===s;if(!d)break}}else return Ie.errors=[{instancePath:t+"/props/data",schemaPath:"#/properties/props/properties/data/type",keyword:"type",params:{type:"array"}}],!1;var _=v===s}else var _=!0}}}}else return Ie.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=h===s}else var p=!0}}else return Ie.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return Ie.errors=i,s===0}Ie.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function nt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=nt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return nt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Cell")return nt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Cell"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return nt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,S=s;if(s===S)if(h&&typeof h=="object"&&!Array.isArray(h)){let y;if(h.children===void 0&&(y="children"))return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let v in h)if(!(v==="children"||v==="span")){return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v}}],!1;break}if(C===s){if(h.children!==void 0){let v=h.children,g=s;if(s===g)if(Array.isArray(v)){var _=!0;let k=v.length;for(let w=0;w<k;w++){let T=v[w],E=s,M=s,L=!1,O=s;rt(T,{instancePath:t+"/props/children/"+w,parentData:v,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var u=O===s;if(L=L||u,u){var d={};d.typeName=!0,d.statementId=!0,d.props=!0}let z=s;Je(T,{instancePath:t+"/props/children/"+w,parentData:v,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var u=z===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let V=s;je(T,{instancePath:t+"/props/children/"+w,parentData:v,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var u=V===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let K=s;Ne(T,{instancePath:t+"/props/children/"+w,parentData:v,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var u=K===s;L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0);let te=s;Ie(T,{instancePath:t+"/props/children/"+w,parentData:v,parentDataProperty:w,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var u=te===s;if(L=L||u,u&&d!==!0&&(d=d||{},d.typeName=!0,d.statementId=!0,d.props=!0),L)s=M,i!==null&&(M?i.length=M:i=null);else{let Y={instancePath:t+"/props/children/"+w,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[Y]:i.push(Y),s++,nt.errors=i,!1}var _=E===s;if(!_)break}}else return nt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var f=g===s}else var f=!0;if(f)if(h.span!==void 0){let v=h.span,g=s;if(!(typeof v=="number"&&!(v%1)&&!isNaN(v)&&isFinite(v)))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/type",keyword:"type",params:{type:"integer"}}],!1;if(!(v===1||v===2||v===3||v===4))return nt.errors=[{instancePath:t+"/props/span",schemaPath:"#/properties/props/properties/span/enum",keyword:"enum",params:{allowedValues:Hg.properties.props.properties.span.enum}}],!1;var f=g===s}else var f=!0}}}else return nt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return nt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return nt.errors=i,s===0}nt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function mt(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=mt.evaluated;if(c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0),s===0)if(e&&typeof e=="object"&&!Array.isArray(e)){let m;if(e.typeName===void 0&&(m="typeName")||e.statementId===void 0&&(m="statementId")||e.props===void 0&&(m="props"))return mt.errors=[{instancePath:t,schemaPath:"#/required",keyword:"required",params:{missingProperty:m}}],!1;if(e.typeName!==void 0){let h=s;if(e.typeName!=="Grid")return mt.errors=[{instancePath:t+"/typeName",schemaPath:"#/properties/typeName/const",keyword:"const",params:{allowedValue:"Grid"}}],!1;var p=h===s}else var p=!0;if(p){if(e.statementId!==void 0){let h=s;if(typeof e.statementId!="string")return mt.errors=[{instancePath:t+"/statementId",schemaPath:"#/properties/statementId/type",keyword:"type",params:{type:"string"}}],!1;var p=h===s}else var p=!0;if(p)if(e.props!==void 0){let h=e.props,S=s;if(s===S)if(h&&typeof h=="object"&&!Array.isArray(h)){let y;if(h.columns===void 0&&(y="columns")||h.children===void 0&&(y="children"))return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/required",keyword:"required",params:{missingProperty:y}}],!1;{let C=s;for(let v in h)if(!(v==="columns"||v==="children")){return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/additionalProperties",keyword:"additionalProperties",params:{additionalProperty:v}}],!1;break}if(C===s){if(h.columns!==void 0){let v=h.columns,g=s;if(!(typeof v=="number"&&!(v%1)&&!isNaN(v)&&isFinite(v)))return mt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/type",keyword:"type",params:{type:"integer"}}],!1;if(!(v===1||v===2||v===3||v===4))return mt.errors=[{instancePath:t+"/props/columns",schemaPath:"#/properties/props/properties/columns/enum",keyword:"enum",params:{allowedValues:Ug.properties.props.properties.columns.enum}}],!1;var _=g===s}else var _=!0;if(_)if(h.children!==void 0){let v=h.children,g=s;if(s===g)if(Array.isArray(v)){var d=!0;let w=v.length;for(let T=0;T<w;T++){let E=v[T],M=s,L=s,O=!1,z=s;nt(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var f=z===s;if(O=O||f,f){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let V=s;rt(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var f=V===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let K=s;Je(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var f=K===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let te=s;je(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var f=te===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let G=s;Ne(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var f=G===s;O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let Y=s;Ie(E,{instancePath:t+"/props/children/"+T,parentData:v,parentDataProperty:T,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var f=Y===s;if(O=O||f,f&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),O)s=L,i!==null&&(L?i.length=L:i=null);else{let _e={instancePath:t+"/props/children/"+T,schemaPath:"#/properties/props/properties/children/items/anyOf",keyword:"anyOf",params:{}};return i===null?i=[_e]:i.push(_e),s++,mt.errors=i,!1}var d=M===s;if(!d)break}}else return mt.errors=[{instancePath:t+"/props/children",schemaPath:"#/properties/props/properties/children/type",keyword:"type",params:{type:"array"}}],!1;var _=g===s}else var _=!0}}}else return mt.errors=[{instancePath:t+"/props",schemaPath:"#/properties/props/type",keyword:"type",params:{type:"object"}}],!1;var p=S===s}else var p=!0}}else return mt.errors=[{instancePath:t,schemaPath:"#/type",keyword:"type",params:{type:"object"}}],!1;return mt.errors=i,s===0}mt.evaluated={props:{typeName:!0,statementId:!0,props:!0},dynamicProps:!1,dynamicItems:!1};function Xr(e,{instancePath:t="",parentData:n,parentDataProperty:r,rootData:o=e,dynamicAnchors:a={}}={}){let i=null,s=0,c=Xr.evaluated;c.dynamicProps&&(c.props=void 0),c.dynamicItems&&(c.items=void 0);let p=s,_=!1,d=s;mt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?mt.errors:i.concat(mt.errors),s=i.length);var C=d===s;if(_=_||C,C){var u={};u.typeName=!0,u.statementId=!0,u.props=!0}let f=s;nt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?nt.errors:i.concat(nt.errors),s=i.length);var C=f===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let m=s;rt(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?rt.errors:i.concat(rt.errors),s=i.length);var C=m===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let h=s;Je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Je.errors:i.concat(Je.errors),s=i.length);var C=h===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let S=s;je(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?je.errors:i.concat(je.errors),s=i.length);var C=S===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let P=s;Ne(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ne.errors:i.concat(Ne.errors),s=i.length);var C=P===s;_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0);let y=s;Ie(e,{instancePath:t,parentData:n,parentDataProperty:r,rootData:o,dynamicAnchors:a})||(i=i===null?Ie.errors:i.concat(Ie.errors),s=i.length);var C=y===s;if(_=_||C,C&&u!==!0&&(u=u||{},u.typeName=!0,u.statementId=!0,u.props=!0),_)s=p,i!==null&&(p?i.length=p:i=null);else{let v={instancePath:t,schemaPath:"#/anyOf",keyword:"anyOf",params:{}};return i===null?i=[v]:i.push(v),s++,Xr.errors=i,!1}return Xr.errors=i,c.props=u,s===0}Xr.evaluated={dynamicProps:!0,dynamicItems:!1};function ku(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 zg=new Set(["Comp","Ref","StateRef","RuntimeRef","BinOp","UnaryOp","Ternary","Member","Index","Assign","Str","Num","Bool","Null","Arr","Obj","Ph"]);function On(e){return!e||typeof e!="object"||Array.isArray(e)?!1:zg.has(e.k)}function Jr(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 pa(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(pa)}:typeof e=="object"?{k:"Obj",entries:Object.entries(e).map(([t,n])=>[t,pa(n)])}:{k:"Null"}}function _a(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=_a(n);if(!r)return;t.push(r.v)}return{v:t}}case"Obj":{let t={};for(let[n,r]of e.entries){let o=_a(r);if(!o)return;t[n]=o.v}return{v:t}}default:return}}var fa=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}]]),wu={ActionExpression:!0,OpenUrl:!0,ToAssistant:!0},yn={Query:"Query",Mutation:"Mutation"};function Yr(e){return e?.callDefs??fa}function Zr(e){return fa.has(e)}function ur(e){return e in yn}var R;(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"})(R||(R={}));var jg=1,Cu=2,Tu=3,vs=4,eo=5,hs=6,ma=7,Ru=8,Vg=9;function ga(e){let t=0,n=()=>e[t]??{t:R.EOF},r=()=>{let u=n();return t++,u},o=u=>{n().t===u&&t++};function a(u){switch(u.t){case R.Question:return jg;case R.Or:return Cu;case R.And:return Tu;case R.EqEq:case R.NotEq:return vs;case R.Greater:case R.Less:case R.GreaterEq:case R.LessEq:return eo;case R.Plus:case R.Minus:return hs;case R.Star:case R.Slash:case R.Percent:return ma;case R.Dot:case R.LBrack:return Vg;default:return 0}}function i(u=0){let f=s();for(;a(n())>u;)f=c(f);return f}function s(){let u=n();if(u.t===R.Str)return r(),{k:"Str",v:u.v};if(u.t===R.Num)return r(),{k:"Num",v:u.v};if(u.t===R.True)return r(),{k:"Bool",v:!0};if(u.t===R.False)return r(),{k:"Bool",v:!1};if(u.t===R.Null)return r(),{k:"Null"};if(u.t===R.LBrack)return _();if(u.t===R.LBrace)return d();if(u.t===R.StateVar){let f=u.v;if(r(),n().t===R.Equals){r();let m=i(0);return{k:"Assign",target:f,value:m}}return{k:"StateRef",n:f}}if(u.t===R.Type){let f=u.v;return e[t+1]?.t===R.LParen&&(!Zr(f)||f==="Action")?p():(r(),{k:"Ref",n:f})}if(u.t===R.BuiltinCall){if(e[t+1]?.t===R.LParen){let f=p();return f.k==="Comp"&&!Zr(f.name)&&(f.fn=!0),f}return r(),{k:"Ref",n:u.v}}if(u.t===R.Ident)return r(),{k:"Ref",n:u.v};if(u.t===R.Not)return r(),{k:"UnaryOp",op:"!",operand:i(Ru)};if(u.t===R.Minus)return r(),{k:"UnaryOp",op:"-",operand:i(Ru)};if(u.t===R.LParen){r();let f=i(0);return o(R.RParen),f}return r(),{k:"Null"}}function c(u){let f=n();if(f.t===R.Plus)return r(),{k:"BinOp",op:"+",left:u,right:i(hs)};if(f.t===R.Minus)return r(),{k:"BinOp",op:"-",left:u,right:i(hs)};if(f.t===R.Star)return r(),{k:"BinOp",op:"*",left:u,right:i(ma)};if(f.t===R.Slash)return r(),{k:"BinOp",op:"/",left:u,right:i(ma)};if(f.t===R.Percent)return r(),{k:"BinOp",op:"%",left:u,right:i(ma)};if(f.t===R.EqEq)return r(),{k:"BinOp",op:"==",left:u,right:i(vs)};if(f.t===R.NotEq)return r(),{k:"BinOp",op:"!=",left:u,right:i(vs)};if(f.t===R.Greater)return r(),{k:"BinOp",op:">",left:u,right:i(eo)};if(f.t===R.Less)return r(),{k:"BinOp",op:"<",left:u,right:i(eo)};if(f.t===R.GreaterEq)return r(),{k:"BinOp",op:">=",left:u,right:i(eo)};if(f.t===R.LessEq)return r(),{k:"BinOp",op:"<=",left:u,right:i(eo)};if(f.t===R.And)return r(),{k:"BinOp",op:"&&",left:u,right:i(Tu)};if(f.t===R.Or)return r(),{k:"BinOp",op:"||",left:u,right:i(Cu)};if(f.t===R.Question){r();let m=i(0);o(R.Colon);let h=i(0);return{k:"Ternary",cond:u,then:m,else:h}}if(f.t===R.Dot){r();let m=n(),h=m.t===R.Ident||m.t===R.Type||m.t===R.Str||m.t===R.Num?(r(),String(m.v)):m.t===R.StateVar?(r(),m.v.replace(/^\$/,"")):(r(),"?");return{k:"Member",obj:u,field:h}}if(f.t===R.LBrack){r();let m=i(0);return o(R.RBrack),{k:"Index",obj:u,index:m}}return u}function p(){let u=n().v;r(),o(R.LParen);let f=[];for(;n().t!==R.RParen&&n().t!==R.EOF;)f.push(i(0)),n().t===R.Comma&&r();return o(R.RParen),{k:"Comp",name:u,args:f}}function _(){r();let u=[];for(;n().t!==R.RBrack&&n().t!==R.EOF;)u.push(i(0)),n().t===R.Comma&&r();return o(R.RBrack),{k:"Arr",els:u}}function d(){r();let u=[];for(;n().t!==R.RBrace&&n().t!==R.EOF;){let f=n(),m=f.t===R.Ident||f.t===R.Str||f.t===R.Type||f.t===R.Num?(r(),String(f.v)):f.t===R.StateVar?(r(),f.v.replace(/^\$/,"")):(r(),"?");o(R.Colon),u.push([m,i(0)]),n().t===R.Comma&&r()}return o(R.RBrace),{k:"Obj",entries:u}}return i(0)}function va(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===`
36
36
  `){t.push({t:R.Newline}),n++;continue}if(o==="("){t.push({t:R.LParen}),n++;continue}if(o===")"){t.push({t:R.RParen}),n++;continue}if(o==="["){t.push({t:R.LBrack}),n++;continue}if(o==="]"){t.push({t:R.RBrack}),n++;continue}if(o==="{"){t.push({t:R.LBrace}),n++;continue}if(o==="}"){t.push({t:R.RBrace}),n++;continue}if(o===","){t.push({t:R.Comma}),n++;continue}if(o===":"){t.push({t:R.Colon}),n++;continue}if(o==="="){n+1<r&&e[n+1]==="="?(t.push({t:R.EqEq}),n+=2):(t.push({t:R.Equals}),n++);continue}if(o==="!"){n+1<r&&e[n+1]==="="?(t.push({t:R.NotEq}),n+=2):(t.push({t:R.Not}),n++);continue}if(o===">"){n+1<r&&e[n+1]==="="?(t.push({t:R.GreaterEq}),n+=2):(t.push({t:R.Greater}),n++);continue}if(o==="<"){n+1<r&&e[n+1]==="="?(t.push({t:R.LessEq}),n+=2):(t.push({t:R.Less}),n++);continue}if(o==="&"){n+1<r&&e[n+1]==="&"?(t.push({t:R.And}),n+=2):(t.push({t:R.And}),n++);continue}if(o==="|"){n+1<r&&e[n+1]==="|"?(t.push({t:R.Or}),n+=2):(t.push({t:R.Or}),n++);continue}if(o==="."){t.push({t:R.Dot}),n++;continue}if(o==="?"){t.push({t:R.Question}),n++;continue}if(o==="+"){t.push({t:R.Plus}),n++;continue}if(o==="*"){t.push({t:R.Star}),n++;continue}if(o==="/"){t.push({t:R.Slash}),n++;continue}if(o==="%"){t.push({t:R.Percent}),n++;continue}if(o==='"'){let c=n;n++;let p=!1;for(;n<r;)if(e[n]==="\\")n+=2;else if(e[n]==='"'){n++,p=!0;break}else n++;let _=e.slice(c,n);try{let d=p?_:_+'"';t.push({t:R.Str,v:JSON.parse(d)})}catch{let d=_.replace(/^"|"$/g,"");t.push({t:R.Str,v:d})}continue}if(o==="'"){n++;let c="",p=!1;for(;n<r;)if(e[n]==="\\"){if(n++,n<r){let _=e[n];_==="'"?c+="'":_==="\\"?c+="\\":_==="n"?c+=`
37
- `:_==="t"?c+=" ":c+=_,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:R.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===R.Num||c.t===R.Str||c.t===R.Ident||c.t===R.Type||c.t===R.RParen||c.t===R.RBrack||c.t===R.True||c.t===R.False||c.t===R.Null||c.t===R.StateVar||c.t===R.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:R.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){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:R.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:R.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 p=e.slice(c,n);if(p==="true"){t.push({t:R.True});continue}if(p==="false"){t.push({t:R.False});continue}if(p==="null"){t.push({t:R.Null});continue}let _=o>="A"&&o<="Z"?R.Type:R.Ident;t.push({t:_,v:p});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:R.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:R.EOF}),t}function Kt(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 Iu;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Iu||(Iu={}));var Wg={},Gg=[];function va(e){return Array.isArray(e)?"array":typeof e}function Eu(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Au(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function Mu(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 ba(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function bs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Eu(t);if(n)return n;let r=Mu(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 ys(e,t){let n=t.map(r=>{let o=bs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Kg(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:va(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:va(e)}:null}function Qg(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;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 Be(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Qg(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var yt=Symbol("invalid");function ya(e,t){return t!==void 0?t:e?yt:void 0}function Xg(e,t,n,r,o){return Au(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Be(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function Nu(e){return(e.anyOf??e.oneOf??[e]).map(Eu)}function Jg(e,t){let n=Nu(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Yg(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"object",actual:va(e)}),yt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Wg,c=Array.isArray(t.required)?t.required:Gg,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=ba(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Be(o,n,`${r}/${_}`,{code:d?"null-required":"missing-required"}),p=!0}}for(let _ of Object.keys(s)){if(!(_ in a))continue;let d=s[_],u=to(a[_],d,n,`${r}/${_}`,o);if(u===yt&&(u=ya(c.includes(_),ba(d)),u===yt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?yt:i??a}function Zg(e,t,n,r,o){if(!Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"array",actual:va(e)}),yt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=to(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==yt&&i.push(c)}return i??e}function eh(e,t,n,r,o){let a=Mu(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Kg(e,a);return i?(Be(o,n,r,{code:"type-mismatch",...i}),!0):!1}function to(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||Ln(e))return e;if(Kt(e))return Xg(e,a,n,r,o)?yt:e;if(Au(a))return Jg(a,o)?(Be(o,n,r,{code:"type-mismatch",expected:Nu(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),yt):e;let i=a.type;return i==="object"?Yg(e,a,n,r,o):i==="array"?Zg(e,a,n,r,o):eh(e,a,n,r,o)?yt:e}function Pa(e){if(e==null||typeof e!="object")return!1;if(Ln(e))return!0;if(Array.isArray(e))return e.some(Pa);if(Kt(e))return Object.values(e.props).some(Pa);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(Pa)}function Lu(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"&&cr(r.name)){let a=r.name===bn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?On(r,t):Ps(r,t);return n==="value"&&Kt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function xa(e,t){return Yr(t.cat).has(e)||cr(e)}function xs(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Ou(e,t,n,r){let{params:o}=n;t.length>o.length&&Be(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=xs(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?_a(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Be(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:ys(e,o)}),i=!0;continue}let d=to(_.v,c.schema,e,`/${c.name}`,r);d===yt&&(d=ya(c.required,c.defaultValue)),d===yt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=pa(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function $u(e,t,n){let r=e.args.map(n),o=Yr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?xs(r,o.params):Ou(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Ss(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Jr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=Yr(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Ou(i.name,i.args,s,t);i.mappedProps=c??xs(i.args,s.params)});t.currentStatementId=r}function Du(e,t,n){let r=Yr(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:Pt(c,t,i));return{...e,args:s}}function Pt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Lu(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!xa(e.name,t))return Be(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Du(e,t,n);if(r)return r;if(xa(e.name,t))return $u(e,t,i=>Pt(i,t,n));let o=e.args.map(i=>Pt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return Be(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>Pt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,Pt(o,t,n)])};case"BinOp":return{...e,left:Pt(e.left,t,n),right:Pt(e.right,t,n)};case"UnaryOp":return{...e,operand:Pt(e.operand,t,n)};case"Ternary":return{...e,cond:Pt(e.cond,t,n),then:Pt(e.then,t,n),else:Pt(e.else,t,n)};case"Member":return{...e,obj:Pt(e.obj,t,n)};case"Index":return{...e,obj:Pt(e.obj,t,n),index:Pt(e.index,t,n)};case"Assign":return{...e,value:Pt(e.value,t,n)};default:return e}}function Ps(e,t){return Pt(e,t,new Set)}function On(e,t){switch(e.k){case"Ref":return Lu(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"){t.prunedValues++;continue}let o=On(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=On(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!xa(n,t))return Be(t,n,"",{code:"unknown-function"}),null;if(cr(n))return Be(t,n,"",{code:"inline-reserved"}),null;if(xa(n,t)){let s=Du(e,t,new Set);return s||$u(e,t,c=>Ps(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let _=o.params[p],d=t.prunedValues,u=On(r[p],t);if(t.prunedValues>d&&Be(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Be(t,n,`/${_.name}`,{code:"type-mismatch",expected:bs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=to(u,_.schema,n,`/${_.name}`,t);f===yt&&(f=ya(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===yt?s=!0:f===void 0&&delete a[_.name]),f!==yt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Be(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(_=>_.defaultValue!==void 0?(Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:ys(n,o.params)});return null}}if(s)return null}else return Be(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>Pa(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return ku(e)?Ps(e,t):e}}function ks(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];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 a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function Sa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===R.Newline;)n++;if(n>=e.length||e[n].t===R.EOF)break;let r=e[n];if(r.t!==R.Ident&&r.t!==R.Type&&r.t!==R.StateVar){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==R.Equals){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==R.EOF;){let p=e[n].t;if(p===R.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===R.Newline;)_++;let d=_<e.length?e[_].t:R.EOF;if(d===R.Question||d===R.Colon&&c>0){n++;continue}break}if(p===R.Newline){n++;continue}p===R.LParen||p===R.LBrack||p===R.LBrace?s++:(p===R.RParen||p===R.RBrack||p===R.RBrace)&&s>0?s--:p===R.Question&&s===0?c++:p===R.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function wa(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Uu(e){if(!Ln(e))return[];let t=new Set;return Jr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Cs(e,t){if(t.k==="Comp"&&t.name===bn.Query){let n=Uu(t.args[1]);return{kind:"query",id:e.id,call:{callee:bn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===bn.Mutation?{kind:"mutation",id:e.id,call:{callee:bn.Mutation,args:t.args},expr:t}:e.idTokenType===R.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function th(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=On(i.init,t);break;case"query":Ss(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":Ss(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of Uu(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var Fu="root";function Rs(e){return e?.k==="Comp"&&!e.fn&&!Zr(e.name)&&!cr(e.name)}function nh(e,t){if(e.has(Fu))return{id:Fu,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Rs(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function rh(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Rs(e)}function oh(e){let t=!1;return Jr(e,n=>{Rs(n)&&(t=!0)}),t}function ka(e,t,n,r,o,a,i){let s=nh(e,a),c=new Map;for(let[h,g]of e)c.set(h,g.kind==="state"?g.init:g.expr);let p=[],_=[],d=new Set;for(let[h,g]of e)h!==s?.id&&(g.kind==="state"||g.kind==="query"||g.kind==="mutation"||d.add(h));let u={syms:c,cat:o,errors:_,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:d},f=null,m;if(s){let h=On(c.get(s.id),u);Kt(h)?(f=h,f.statementId=s.id):Ln(h)&&oh(h)&&(m=h)}let{stateDeclarations:v,queryStatements:S,mutationStatements:P}=th(t,u,i);u.currentStatementId=s?.id;let y=a??"";s?!f&&!m&&!rh(c.get(s.id),c)?Be(u,y,"",{code:"no-root",reason:"not-component"}):s.fallback&&Be(u,y,"",{code:"no-root",reason:f?"fallback":"missing"}):Be(u,y,"",{code:"no-root",reason:"missing"});let C=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:C,statementCount:r,errors:_},stateDeclarations:v,queryStatements:S,mutationStatements:P}}function Bu(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 ah(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Bu(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]!==`
37
+ `:_==="t"?c+=" ":c+=_,n++}}else if(e[n]==="'"){n++,p=!0;break}else c+=e[n],n++;t.push({t:R.Str,v:c});continue}if(o==="-"){let c=t.length>0?t[t.length-1]:null;if(!(!(c!=null&&(c.t===R.Num||c.t===R.Str||c.t===R.Ident||c.t===R.Type||c.t===R.RParen||c.t===R.RBrack||c.t===R.True||c.t===R.False||c.t===R.Null||c.t===R.StateVar||c.t===R.BuiltinCall))&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9")){t.push({t:R.Minus}),n++;continue}}let a=o>="0"&&o<="9",i=o==="-"&&n+1<r&&e[n+1]>="0"&&e[n+1]<="9";if(a||i){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:R.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:R.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 p=e.slice(c,n);if(p==="true"){t.push({t:R.True});continue}if(p==="false"){t.push({t:R.False});continue}if(p==="null"){t.push({t:R.Null});continue}let _=o>="A"&&o<="Z"?R.Type:R.Ident;t.push({t:_,v:p});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:R.BuiltinCall,v:e.slice(c,n)});continue}n++}return t.push({t:R.EOF}),t}function Kt(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 Iu;(function(e){e.ContinueConversation="continue_conversation",e.OpenUrl="open_url"})(Iu||(Iu={}));var Wg={},Gg=[];function ha(e){return Array.isArray(e)?"array":typeof e}function Eu(e){return typeof e.$ref=="string"?e.$ref.split("/").pop():void 0}function Au(e){return"$ref"in e||"anyOf"in e||"oneOf"in e||"allOf"in e}function Mu(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 ba(e){if(!(!e||typeof e!="object"||Array.isArray(e)))return e.default}function bs(e){if(!e||typeof e!="object"||Array.isArray(e))return;let t=e,n=Eu(t);if(n)return n;let r=Mu(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 ys(e,t){let n=t.map(r=>{let o=bs(r.schema),a=r.required?`${r.name}*`:r.name;return o?`${a}: ${o}`:a}).join(", ");return`${e}(${n})`}function Kg(e,t){let n=typeof e;return t.enumValues?t.enumValues.includes(e)?null:{expected:`one of [${t.enumValues.map(r=>JSON.stringify(r)).join(", ")}]`,actual:ha(e)}:t.expectedType&&t.expectedType!==n?{expected:t.expectedType,actual:ha(e)}:null}function Qg(e,t,n){switch(n.code){case"type-mismatch":return`field "${t}" expects ${n.expected} but got ${n.actual}`;case"pruned-value":return`field "${t}" lost an unresolved or invalid value`;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 Be(e,t,n,r){e.errors.push({code:r.code,component:t,path:n,message:Qg(t,n,r),statementId:e.currentStatementId,...r.code==="no-root"&&r.reason==="fallback"&&{severity:"warning"}})}var yt=Symbol("invalid");function ya(e,t){return t!==void 0?t:e?yt:void 0}function Xg(e,t,n,r,o){return Au(t)?!1:typeof t.type=="string"||Array.isArray(t.enum)||"const"in t?(Be(o,n,r,{code:"type-mismatch",expected:typeof t.type=="string"?t.type:"a literal value",actual:`component "${e.typeName}"`}),!0):!1}function Nu(e){return(e.anyOf??e.oneOf??[e]).map(Eu)}function Jg(e,t){let n=Nu(e);return n.length>0&&n.every(r=>r!==void 0&&t.cat?.has(r))}function Yg(e,t,n,r,o){if(typeof e!="object"||Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"object",actual:ha(e)}),yt;let a=e,i,s=t.properties&&typeof t.properties=="object"?t.properties:Wg,c=Array.isArray(t.required)?t.required:Gg,p=!1;if(!o.partial)for(let _ of c){let d=_ in a;if(!d||a[_]==null){let u=ba(s[_]);if(u!==void 0){(i??(i={...a}))[_]=u;continue}Be(o,n,`${r}/${_}`,{code:d?"null-required":"missing-required"}),p=!0}}for(let _ of Object.keys(s)){if(!(_ in a))continue;let d=s[_],u=to(a[_],d,n,`${r}/${_}`,o);if(u===yt&&(u=ya(c.includes(_),ba(d)),u===yt)){p=!0;continue}u!==a[_]&&(i??(i={...a}),u===void 0?delete i[_]:i[_]=u)}return p?yt:i??a}function Zg(e,t,n,r,o){if(!Array.isArray(e))return Be(o,n,r,{code:"type-mismatch",expected:"array",actual:ha(e)}),yt;let a=t.items;if(!a||typeof a!="object"||Array.isArray(a))return e;let i;for(let s=0;s<e.length;s++){let c=to(e[s],a,n,`${r}/${s}`,o);c!==e[s]&&!i&&(i=e.slice(0,s)),i&&c!==yt&&i.push(c)}return i??e}function ev(e,t,n,r,o){let a=Mu(t);if(a.expectedType==null&&a.enumValues==null||a.enumValues&&o.partial)return!1;let i=Kg(e,a);return i?(Be(o,n,r,{code:"type-mismatch",...i}),!0):!1}function to(e,t,n,r,o){if(!t||typeof t!="object"||Array.isArray(t))return e;let a=t;if(e==null||On(e))return e;if(Kt(e))return Xg(e,a,n,r,o)?yt:e;if(Au(a))return Jg(a,o)?(Be(o,n,r,{code:"type-mismatch",expected:Nu(a).join(" | "),actual:Array.isArray(e)?"array":typeof e=="object"?"plain object":typeof e}),yt):e;let i=a.type;return i==="object"?Yg(e,a,n,r,o):i==="array"?Zg(e,a,n,r,o):ev(e,a,n,r,o)?yt:e}function Pa(e){if(e==null||typeof e!="object")return!1;if(On(e))return!0;if(Array.isArray(e))return e.some(Pa);if(Kt(e))return Object.values(e.props).some(Pa);let t=e;return Array.isArray(t.steps)?!0:Object.values(t).some(Pa)}function Lu(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"&&ur(r.name)){let a=r.name===yn.Mutation?"mutation":"query";return{k:"RuntimeRef",n:e,refType:a}}t.visited.add(e);let o=t.currentStatementId;t.currentStatementId=e;try{let a=n==="value"?$n(r,t):Ps(r,t);return n==="value"&&Kt(a)&&(a.statementId=e),a}finally{t.currentStatementId=o,t.visited.delete(e)}}function xa(e,t){return Yr(t.cat).has(e)||ur(e)}function xs(e,t){let n={};for(let r=0;r<t.length&&r<e.length;r++)n[t[r].name]=e[r];return n}function Ou(e,t,n,r){let{params:o}=n;t.length>o.length&&Be(r,e,"",{code:"excess-args",declared:o.length,got:t.length});let a=xs(t,o),i=!1,s=r.errors.length;for(let c of o){let p=a[c.name],_=p?_a(p):{v:void 0};if(!_)continue;if(_.v==null){if(!c.required||c.defaultValue!==void 0)continue;Be(r,e,`/${c.name}`,{code:p?"null-required":"missing-required",signature:ys(e,o)}),i=!0;continue}let d=to(_.v,c.schema,e,`/${c.name}`,r);d===yt&&(d=ya(c.required,c.defaultValue)),d===yt?i=!0:d===void 0?delete a[c.name]:d!==_.v&&(a[c.name]=pa(d))}return n.kind==="action"&&r.errors.length>s&&(i=!0),i?null:a}function $u(e,t,n){let r=e.args.map(n),o=Yr(t.cat).get(e.name);if(!o||o.lazy)return{...e,args:r};let a=o.builtin?xs(r,o.params):Ou(e.name,r,o,t);return a?{...e,args:r,mappedProps:a}:o.kind==="action"?{k:"Comp",name:"Action",args:[{k:"Arr",els:[]}]}:{k:"Null"}}function Ss(e,t,n){let r=t.currentStatementId;t.currentStatementId=n;let o=new Set;for(let a of e)Jr(a,i=>{if(i.k!=="Comp"||o.has(i))return;o.add(i);let s=Yr(t.cat).get(i.name);if(!s||s.lazy)return;let c=s.builtin?null:Ou(i.name,i.args,s,t);i.mappedProps=c??xs(i.args,s.params)});t.currentStatementId=r}function Du(e,t,n){let r=Yr(t.cat).get(e.name);if(r?.kind!=="function"||!r.lazy||e.args.length<3)return null;let o=e.args[1],a=o.k==="Ref"?o.n:o.k==="Str"?o.v:null;if(!a)return null;let i=new Set(n);i.add(a);let s=e.args.map((c,p)=>p===1?c:Pt(c,t,i));return{...e,args:s}}function Pt(e,t,n){switch(e.k){case"Ref":return n.has(e.n)?e:Lu(e.n,t,"expr");case"Ph":return e;case"Comp":{if(e.fn&&!xa(e.name,t))return Be(t,e.name,"",{code:"unknown-function"}),{k:"Null"};let r=Du(e,t,n);if(r)return r;if(xa(e.name,t))return $u(e,t,i=>Pt(i,t,n));let o=e.args.map(i=>Pt(i,t,n)),a=t.cat?.get(e.name);if(a){let i={};for(let s=0;s<a.params.length&&s<o.length;s++)i[a.params[s].name]=o[s];return{...e,args:o,mappedProps:i}}return Be(t,e.name,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),{...e,args:o}}case"Arr":return{...e,els:e.els.map(r=>Pt(r,t,n))};case"Obj":return{...e,entries:e.entries.map(([r,o])=>[r,Pt(o,t,n)])};case"BinOp":return{...e,left:Pt(e.left,t,n),right:Pt(e.right,t,n)};case"UnaryOp":return{...e,operand:Pt(e.operand,t,n)};case"Ternary":return{...e,cond:Pt(e.cond,t,n),then:Pt(e.then,t,n),else:Pt(e.else,t,n)};case"Member":return{...e,obj:Pt(e.obj,t,n)};case"Index":return{...e,obj:Pt(e.obj,t,n),index:Pt(e.index,t,n)};case"Assign":return{...e,value:Pt(e.value,t,n)};default:return e}}function Ps(e,t){return Pt(e,t,new Set)}function $n(e,t){switch(e.k){case"Ref":return Lu(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"){t.prunedValues++;continue}let o=$n(r,t);if(o===null&&(r.k==="Comp"||r.k==="Ref")){t.prunedValues++;continue}n.push(o)}return n}case"Obj":{let n={};for(let[r,o]of e.entries)n[r]=$n(o,t);return n}case"Comp":{let{name:n,args:r}=e;if(e.fn&&!xa(n,t))return Be(t,n,"",{code:"unknown-function"}),null;if(ur(n))return Be(t,n,"",{code:"inline-reserved"}),null;if(xa(n,t)){let s=Du(e,t,new Set);return s||$u(e,t,c=>Ps(c,t))}let o=t.cat?.get(n),a={};if(o){let s=!1;for(let p=0;p<o.params.length&&p<r.length;p++){let _=o.params[p],d=t.prunedValues,u=$n(r[p],t);if(t.prunedValues>d&&Be(t,n,`/${_.name}`,{code:"pruned-value"}),a[_.name]=u,_.schema===void 0)continue;if(u==null&&_.defaultValue!==void 0){Be(t,n,`/${_.name}`,{code:"type-mismatch",expected:bs(_.schema)??"a defined value",actual:u===null?"null":"undefined"}),a[_.name]=_.defaultValue,t.prunedValues=d;continue}let f=to(u,_.schema,n,`/${_.name}`,t);f===yt&&(f=ya(_.required,_.defaultValue),_.defaultValue!==void 0&&(t.prunedValues=d),f===yt?s=!0:f===void 0&&delete a[_.name]),f!==yt&&f!==void 0&&(a[_.name]=f)}r.length>o.params.length&&Be(t,n,"",{code:"excess-args",declared:o.params.length,got:r.length});let c=o.params.filter(p=>p.required&&(!(p.name in a)||a[p.name]===null));if(c.length){let p=c.filter(_=>_.defaultValue!==void 0?(Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required"}),a[_.name]=_.defaultValue,!1):!0);if(p.length){for(let _ of p)Be(t,n,`/${_.name}`,{code:_.name in a?"null-required":"missing-required",signature:ys(n,o.params)});return null}}if(s)return null}else return Be(t,n,"",{code:"unknown-component",available:t.cat&&[...t.cat.keys()]}),null;let i=Object.values(a).some(s=>Pa(s));return{type:"element",typeName:n,props:a,partial:t.partial,hasDynamicProps:i}}default:return ku(e)?Ps(e,t):e}}function ks(e){let t=[],n=!1,r=!1;for(let i=0;i<e.length;i++){let s=e[i];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 a=e;n&&(r&&(a+="\\"),a+=n);for(let i=t.length-1;i>=0;i--)a+=t[i]==="("?")":t[i]==="["?"]":"}";return{text:a,wasIncomplete:!0}}function Sa(e){let t=[],n=0;for(;n<e.length;){for(;n<e.length&&e[n].t===R.Newline;)n++;if(n>=e.length||e[n].t===R.EOF)break;let r=e[n];if(r.t!==R.Ident&&r.t!==R.Type&&r.t!==R.StateVar){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}let o=r.v,a=r.t;if(n++,n>=e.length||e[n].t!==R.Equals){for(;n<e.length&&e[n].t!==R.Newline&&e[n].t!==R.EOF;)n++;continue}n++;let i=[],s=0,c=0;for(;n<e.length&&e[n].t!==R.EOF;){let p=e[n].t;if(p===R.Newline&&s<=0&&c<=0){let _=n+1;for(;_<e.length&&e[_].t===R.Newline;)_++;let d=_<e.length?e[_].t:R.EOF;if(d===R.Question||d===R.Colon&&c>0){n++;continue}break}if(p===R.Newline){n++;continue}p===R.LParen||p===R.LBrack||p===R.LBrace?s++:(p===R.RParen||p===R.RBrack||p===R.RBrace)&&s>0?s--:p===R.Question&&s===0?c++:p===R.Colon&&s===0&&c>0&&c--,i.push(e[n++])}i.length&&t.push({id:o,idTokenType:a,tokens:i})}return t}function wa(e=!0){return{root:null,meta:{incomplete:e,unresolved:[],orphaned:[],statementCount:0,errors:[]},stateDeclarations:{},queryStatements:[],mutationStatements:[]}}function Uu(e){if(!On(e))return[];let t=new Set;return Jr(e,n=>{n.k==="StateRef"&&t.add(n.n)}),[...t]}function Cs(e,t){if(t.k==="Comp"&&t.name===yn.Query){let n=Uu(t.args[1]);return{kind:"query",id:e.id,call:{callee:yn.Query,args:t.args},expr:t,deps:n.length>0?n:void 0}}return t.k==="Comp"&&t.name===yn.Mutation?{kind:"mutation",id:e.id,call:{callee:yn.Mutation,args:t.args},expr:t}:e.idTokenType===R.StateVar?{kind:"state",id:e.id,init:t}:{kind:"value",id:e.id,expr:t}}function tv(e,t,n){let r={},o=[],a=[];for(let i of e)switch(i.kind){case"state":r[i.id]=$n(i.init,t);break;case"query":Ss(i.call.args,t,i.id),o.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null,defaultsAST:i.call.args[2]??null,refreshAST:i.call.args[3]??null,deps:i.deps,complete:!0});break;case"mutation":Ss(i.call.args,t,i.id),a.push({statementId:i.id,toolAST:i.call.args[0]??null,argsAST:i.call.args[1]??null});break}for(let i of e){let s=i.kind==="state"?[i.init]:i.kind==="value"?[i.expr]:i.kind==="query"||i.kind==="mutation"?i.call.args:[];for(let c of s)for(let p of Uu(c))p===n?.name&&n.stmts.has(i)||p in r||(r[p]=null)}return{stateDeclarations:r,queryStatements:o,mutationStatements:a}}var Fu="root";function Rs(e){return e?.k==="Comp"&&!e.fn&&!Zr(e.name)&&!ur(e.name)}function nv(e,t){if(e.has(Fu))return{id:Fu,fallback:!1};for(let n of e.values())if(n.kind==="value"&&Rs(n.expr)&&n.expr.name===t)return{id:n.id,fallback:!0};return null}function rv(e,t){let n=new Set;for(;e?.k==="Ref"&&!n.has(e.n);)n.add(e.n),e=t.get(e.n);return Rs(e)}function ov(e){let t=!1;return Jr(e,n=>{Rs(n)&&(t=!0)}),t}function ka(e,t,n,r,o,a,i){let s=nv(e,a),c=new Map;for(let[v,g]of e)c.set(v,g.kind==="state"?g.init:g.expr);let p=[],_=[],d=new Set;for(let[v,g]of e)v!==s?.id&&(g.kind==="state"||g.kind==="query"||g.kind==="mutation"||d.add(v));let u={syms:c,cat:o,errors:_,unres:p,prunedValues:0,visited:new Set,partial:n,currentStatementId:s?.id,unreached:d},f=null,m;if(s){let v=$n(c.get(s.id),u);Kt(v)?(f=v,f.statementId=s.id):On(v)&&ov(v)&&(m=v)}let{stateDeclarations:h,queryStatements:S,mutationStatements:P}=tv(t,u,i);u.currentStatementId=s?.id;let y=a??"";s?!f&&!m&&!rv(c.get(s.id),c)?Be(u,y,"",{code:"no-root",reason:"not-component"}):s.fallback&&Be(u,y,"",{code:"no-root",reason:f?"fallback":"missing"}):Be(u,y,"",{code:"no-root",reason:"missing"});let C=s?[...d]:[];return{root:f,...m?{rootExpression:m}:{},meta:{incomplete:n,unresolved:p,orphaned:C,statementCount:r,errors:_},stateDeclarations:h,queryStatements:S,mutationStatements:P}}function Bu(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 av(e){let t=[],n=0;for(;n<e.length;){let r=-1;for(;n<e.length;){let s=Bu(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]!==`
38
38
  `;)o++;if(o>=e.length){t.push(e.slice(r+3).replace(/^[^\n]*\n?/,"")),n=e.length;break}o++;let a=-1,i=o;for(;i<e.length;){let s=Bu(e,i);if(s>i){i=s;continue}if(e[i]==="`"&&i+1<e.length&&e[i+1]==="`"&&i+2<e.length&&e[i+2]==="`"){a=i;break}i++}a!==-1?(t.push(e.slice(o,a)),n=a+3):(t.push(e.slice(o)),n=e.length)}if(t.length>0)return t.join(`
39
39
  `);if(e.startsWith("```")){let r=3;for(;r<e.length&&e[r]!==`
40
- `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function ih(e){let t=!1;return e.split(`
40
+ `;)r++;let o=r<e.length?r+1:3,a=e.slice(o),i=a.lastIndexOf("```");return i!==-1?a.slice(0,i):a}return e}function iv(e){let t=!1;return e.split(`
41
41
  `).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(`
42
- `)}function Hu(e){return ih(ah(e.trim())).trim()}function qu(e,t,n){let r=Hu(e);if(!r)return wa();let{text:o,wasIncomplete:a}=ks(r),i=Sa(ha(o));if(!i.length)return wa(a);let s=new Map;for(let p of i){let _=ga(p.tokens),d=Cs(p,_);s.set(p.id,d)}let c=[...s.values()];return ka(s,c,a,s.size,t,n)}function zu(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of Sa(ha(f))){let v=ga(m.tokens),S=Cs(m,v);a.set(m.id,S),i++}}function c(){let u=Hu(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,v=!1,S=o;for(let P=o;P<r.length;P++){let y=r[P];if(v){v=!1;continue}if(y==="\\"&&m){v=!0;continue}if(m){y===m&&(m=!1);continue}if(y==='"'||y==="'"){m=y;continue}if(y==="("||y==="["||y==="{")u++;else if(y===")"||y==="]"||y==="}")u=Math.max(0,u-1);else if(y==="?"&&u===0)f++;else if(y===":"&&u===0&&f>0)f--;else if(y===`
42
+ `)}function Hu(e){return iv(av(e.trim())).trim()}function qu(e,t,n){let r=Hu(e);if(!r)return wa();let{text:o,wasIncomplete:a}=ks(r),i=Sa(va(o));if(!i.length)return wa(a);let s=new Map;for(let p of i){let _=ga(p.tokens),d=Cs(p,_);s.set(p.id,d)}let c=[...s.values()];return ka(s,c,a,s.size,t,n)}function zu(e,t){let n="",r="",o=0,a=new Map,i=0;function s(u){let f=u.trim();if(f)for(let m of Sa(va(f))){let h=ga(m.tokens),S=Cs(m,h);a.set(m.id,S),i++}}function c(){let u=Hu(n);u.startsWith(r.slice(0,o))||(o=0,a.clear(),i=0),r=u}function p(){let u=0,f=0,m=!1,h=!1,S=o;for(let P=o;P<r.length;P++){let y=r[P];if(h){h=!1;continue}if(y==="\\"&&m){h=!0;continue}if(m){y===m&&(m=!1);continue}if(y==='"'||y==="'"){m=y;continue}if(y==="("||y==="["||y==="{")u++;else if(y===")"||y==="]"||y==="}")u=Math.max(0,u-1);else if(y==="?"&&u===0)f++;else if(y===":"&&u===0&&f>0)f--;else if(y===`
43
43
  `&&u<=0&&f<=0){let C=P+1;for(;C<r.length&&(r[C]===" "||r[C]===" "||r[C]==="\r"||r[C]===`
44
- `);)C++;if(C<r.length&&(r[C]==="?"||r[C]===":"&&f>0))continue;let h=r.slice(S,P).trim();h&&s(h),S=P+1,o=P+1}}return S}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?wa():ka(a,[...a.values()],!1,i,e,t);let{text:v,wasIncomplete:S}=ks(m),P=Sa(ha(v));if(!P.length)return i===0?wa(S):ka(a,[...a.values()],S,i,e,t);let y=new Map(a),C=new Set;for(let w of P){if(a.has(w.id)&&S)continue;let T=ga(w.tokens),E=Cs(w,T);y.set(w.id,E),C.add(E)}let h=u?void 0:/\$\w+$/.exec(n)?.[0],g=h&&m.endsWith(h)&&!new RegExp(`\\${h}(?!\\w)`).test(m.slice(0,-h.length))?h:void 0,k=[...y.values()];return ka(y,k,S,i+P.length,e,t,g?{name:g,stmts:C}:void 0)}function d(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,_(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&d();let m=u.slice(n.length);return m&&(n+=m),_(f)},getResult:_}}function Ts(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Ts(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=Ts(i,t),o||(o=r[a]!==i);return o?r:e}function ws(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:ba(n[o]),schema:t.size?Ts(n[o],t):n[o]}))}function ju(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(wu),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:ws(a,r)});t.callDefs=new Map(fa);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:ws(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:ws(a.params,r)});return t}var Vu=ju(lr.schema),sh={parse(e){return qu(e,Vu,lr.root)}};function Wu(){return zu(Vu,lr.root)}function Is(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,v){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:v,statementId:f.statementId}),a=!0}function s(f,m,v){if(!Kt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${v}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${v}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(y=>y.statementId===f.statementId&&y.severity!=="warning"))return;let S=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((y,C)=>{let h=s(y,f,C);return h?[h]:[]}):void 0,P=S?{...f,props:{...f.props,children:S}}:f;if(!Su(P)){i(f,"","Component does not match the catalog");return}if(P.typeName==="Table"&&P.props.rows.some(y=>y.length!==P.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(S?.length!==0&&!((P.typeName==="Chart"||P.typeName==="Table")&&(t||e.meta.incomplete)))return P}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Kt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let v=s(f,c,m);return v&&v.typeName!=="Cell"?[v]:[]}):[],_=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");_&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==lr.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==lr.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!d&&(a||e.meta.incomplete);return!t&&(d||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:d,partial:u,diagnostics:o}),{elements:d?[]:p,error:d,partial:u,diagnostics:o}}function Gu(e){return Is(sh.parse(e),!1).elements.flatMap(Ku).join(`
44
+ `);)C++;if(C<r.length&&(r[C]==="?"||r[C]===":"&&f>0))continue;let v=r.slice(S,P).trim();v&&s(v),S=P+1,o=P+1}}return S}function _(u=!1){c();let f=p(),m=r.slice(f).trim();if(!m)return i===0?wa():ka(a,[...a.values()],!1,i,e,t);let{text:h,wasIncomplete:S}=ks(m),P=Sa(va(h));if(!P.length)return i===0?wa(S):ka(a,[...a.values()],S,i,e,t);let y=new Map(a),C=new Set;for(let w of P){if(a.has(w.id)&&S)continue;let T=ga(w.tokens),E=Cs(w,T);y.set(w.id,E),C.add(E)}let v=u?void 0:/\$\w+$/.exec(n)?.[0],g=v&&m.endsWith(v)&&!new RegExp(`\\${v}(?!\\w)`).test(m.slice(0,-v.length))?v:void 0,k=[...y.values()];return ka(y,k,S,i+P.length,e,t,g?{name:g,stmts:C}:void 0)}function d(){n="",r="",o=0,a.clear(),i=0}return{push(u,f){return n+=u,_(f)},set(u,f){(u.length<n.length||!u.startsWith(n))&&d();let m=u.slice(n.length);return m&&(n+=m),_(f)},getResult:_}}function Ts(e,t){if(!e||typeof e!="object")return e;let n=e.$ref;if(typeof n=="string")return t.has(n)?Ts(t.get(n),t):e;let r=Array.isArray(e)?[...e]:{...e},o=!1;for(let[a,i]of Object.entries(r))r[a]=Ts(i,t),o||(o=r[a]!==i);return o?r:e}function ws(e,t){let n=e.properties??{},r=e.required??[];return Object.keys(n).map(o=>({name:o,required:r.includes(o),defaultValue:ba(n[o]),schema:t.size?Ts(n[o],t):n[o]}))}function ju(e){let t=new Map,n=e.properties&&new Set(Object.keys(e.properties)),r=new Map;for(let o of[...Object.keys(wu),...Object.keys(e.actions??{})]){let a=e.$defs?.[o];a&&!n?.has(o)&&r.set(`#/$defs/${o}`,a)}for(let[o,a]of Object.entries(e.$defs??{}))(n?!n.has(o):r.has(`#/$defs/${o}`))||t.set(o,{params:ws(a,r)});t.callDefs=new Map(fa);for(let[o,a]of Object.entries(e.functions??{}))t.callDefs.set(o,{kind:"function",params:ws(a.params,r)});for(let[o,a]of Object.entries(e.actions??{}))t.callDefs.set(o,{kind:"action",params:ws(a.params,r)});return t}var Vu=ju(cr.schema),sv={parse(e){return qu(e,Vu,cr.root)}};function Wu(){return zu(Vu,cr.root)}function Is(e,t){let n=e.root?.props.children,r=new Set,o=e.meta,a=e.meta.errors.some(f=>f.severity!=="warning"&&!(f.component==="Grid"&&f.path==="/columns"||f.component==="Cell"&&f.path==="/span"));function i(f,m,h){o===e.meta&&(o={...e.meta,errors:[...e.meta.errors]}),o.errors.push({code:"type-mismatch",component:f.typeName,path:m,message:h,statementId:f.statementId}),a=!0}function s(f,m,h){if(!Kt(f)||typeof f.statementId!="string"||r.has(f.statementId)){i(m,`/children/${h}`,"Child must be a valid, uniquely named component");return}if(f.typeName==="Root"||f.typeName==="Grid"&&m.typeName!=="Root"||f.typeName==="Cell"&&m.typeName==="Cell"){i(m,`/children/${h}`,"Component is not allowed at this nesting level");return}if(r.add(f.statementId),(f.typeName==="Chart"||f.typeName==="Table")&&e.meta.errors.some(y=>y.statementId===f.statementId&&y.severity!=="warning"))return;let S=(f.typeName==="Grid"||f.typeName==="Cell")&&Array.isArray(f.props.children)?f.props.children.flatMap((y,C)=>{let v=s(y,f,C);return v?[v]:[]}):void 0,P=S?{...f,props:{...f.props,children:S}}:f;if(!Su(P)){i(f,"","Component does not match the catalog");return}if(P.typeName==="Table"&&P.props.rows.some(y=>y.length!==P.props.columns.length)){i(f,"/rows","Every table row must contain one value per column");return}if(S?.length!==0&&!((P.typeName==="Chart"||P.typeName==="Table")&&(t||e.meta.incomplete)))return P}let c=e.root,p=c&&Array.isArray(n)?n.flatMap((f,m)=>{if(Kt(f)&&f.typeName==="Cell")return i(c,`/children/${m}`,"Cell must be inside a Grid"),[];let h=s(f,c,m);return h&&h.typeName!=="Cell"?[h]:[]}):[],_=c?.hasDynamicProps===!0||e.queryStatements.length>0||e.mutationStatements.length>0||Object.keys(e.stateDeclarations).length>0||e.meta.errors.some(f=>f.code==="unknown-function"||f.code==="inline-reserved");_&&c&&i(c,"","Executable content is not supported by the static catalog"),c&&c.typeName!==cr.root&&i(c,"","The block must use the catalog root component");let d=_||c!==null&&c.typeName!==cr.root||!t&&(!Array.isArray(n)||p.length===0),u=!t&&!d&&(a||e.meta.incomplete);return!t&&(d||o.errors.length>0||o.unresolved.length>0||o.incomplete)&&console.warn("Generative UI diagnostics",{error:d,partial:u,diagnostics:o}),{elements:d?[]:p,error:d,partial:u,diagnostics:o}}function Gu(e){return Is(sv.parse(e),!1).elements.flatMap(Ku).join(`
45
45
 
46
46
  `)}function Ku(e){return e.typeName==="Grid"||e.typeName==="Cell"?e.props.children.flatMap(Ku):e.typeName==="Text"?[e.props.text]:e.typeName==="Card"?[`${e.props.title}
47
47
  ${e.props.body}`]:e.typeName==="Metric"?[[e.props.label,e.props.value,e.props.detail].filter(Boolean).join(`
48
48
  `)]:e.typeName==="Table"?[[e.props.title,e.props.columns.join(" "),...e.props.rows.map(t=>t.join(" "))].join(`
49
49
  `)]:[[e.props.title,...e.props.data.map(t=>`${t.label}: ${t.value}`)].join(`
50
- `)]}function As(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Qr(e),set_attr(a,i,s){if(i!==Gr||s!=="openui"||a.index!==1)return gs(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:se(""),doneSig:se(!1)},r.push(c),hn(l(ch,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:ms(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),fs(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)hn(null,a);r.length=0,o=void 0}}}function ch({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ue(()=>{let a=Wu();return Se(()=>Is(a.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(a=>l(Es,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function Es({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(Es,{element:r,cssPrefix:t},r.statementId)):l(Es,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(uh,{element:e,cssPrefix:t})}}function uh({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,a=148+n/o*136,i=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:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),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 Ca(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Gu(i.source)+(e[p-1]===`
50
+ `)]}function As(e,{cssPrefix:t,strings:n}){let r=[],o;return{...Qr(e),set_attr(a,i,s){if(i!==Gr||s!=="openui"||a.index!==1)return gs(a,i,s);let c=document.createElement("div");a.nodes[a.index]?.parentElement?.replaceWith(c),o={textSig:se(""),doneSig:se(!1)},r.push(c),hn(l(cv,{cssPrefix:t,textSig:o.textSig,doneSig:o.doneSig,strings:n}),c)},add_text(a,i){o?o.textSig.value=o.textSig.peek()+i:ms(a,i)},end_token(a){o&&(o.doneSig.value=!0,o=void 0),fs(a)},finish(){o&&(o.doneSig.value=!0)},dispose(){for(let a of r)hn(null,a);r.length=0,o=void 0}}}function cv({textSig:e,doneSig:t,cssPrefix:n,strings:r}){let o=ue(()=>{let a=Wu();return Se(()=>Is(a.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(a=>l(Es,{element:a,cssPrefix:n},a.statementId)),o.value.partial&&l("p",{role:"status",children:r.visualPartial}),o.value.elements.length===0&&!t.value?l("span",{role:"status",children:r.visualPreparing}):null]})}function Es({element:e,cssPrefix:t}){if(e.typeName==="Grid")return l("div",{class:`${t}-generative-ui-grid-container`,children:l("div",{class:`${t}-generative-ui-grid`,"data-columns":e.props.columns,children:e.props.children.map(n=>l("div",{class:`${t}-generative-ui-cell`,"data-span":n.typeName==="Cell"?n.props.span??1:1,children:n.typeName==="Cell"?n.props.children.map(r=>l(Es,{element:r,cssPrefix:t},r.statementId)):l(Es,{element:n,cssPrefix:t})},n.statementId))})});switch(e.typeName){case"Text":return l("p",{children:e.props.text});case"Card":return l("section",{children:[l("strong",{children:e.props.title}),l("p",{children:e.props.body})]});case"Metric":return l("section",{children:[l("strong",{children:e.props.label}),l("span",{class:`${t}-generative-ui-metric`,children:e.props.value}),e.props.detail&&l("p",{children:e.props.detail})]});case"Table":return l("section",{children:l("div",{class:`${t}-generative-ui-table`,children:l("table",{children:[l("caption",{children:e.props.title}),l("thead",{children:l("tr",{children:e.props.columns.map((n,r)=>l("th",{scope:"col",children:n},r))})}),l("tbody",{children:e.props.rows.map((n,r)=>l("tr",{children:n.map((o,a)=>l("td",{children:o},a))},r))})]})})});case"Chart":return l(uv,{element:e,cssPrefix:t})}}function uv({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,a=148+n/o*136,i=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:a,y2:a}),e.props.type==="line"&&l("polyline",{points:i.map(s=>`${s.x},${s.y}`).join(" "),fill:"none",stroke:"currentColor","stroke-width":3}),i.map((s,c)=>e.props.type==="bar"?l("rect",{x:s.x-96/e.props.data.length,y:Math.min(s.y,a),width:192/e.props.data.length,height:Math.abs(s.y-a),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 Ca(e){if(!e.includes("```openui"))return e;let t="",n=0,r=0,o=0,a=0,i;function s(p){i?.language==="openui"&&(t+=e.slice(n,i.start)+Gu(i.source)+(e[p-1]===`
51
51
  `?`
52
- `:""),n=p),i=void 0}let c=sr({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===Gr&&(i.language=d)},add_text(p,_){i&&(i.source+=_)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)Xe(c,e.charAt(r)),e[r]===`
53
- `&&(o=r+1);return Kr(c),i&&s(e.length),t+e.slice(n)}function Qu(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function dh(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function Xu(e){return e.startsWith("tool-")?e.slice(5):e}var lt={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},Ms="context";function Ta(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ju(e){if(!Ta(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 Yu(e){if(!Ta(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 Ra(e){let t=Ta(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Ta(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function Ns(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:_h(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),e.clientTools?.length&&(n.clientTools=e.clientTools),n}function ph(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function _h(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&ph(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:dh(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),n.toolMetadata&&(r.toolMetadata=n.toolMetadata),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}function Os(e,t,n=Ct()){let r=e?[{kind:"text",id:"t0",textSig:se(e),doneSig:se(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:se(r)}}function an(){return{id:Ct(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:se([])}}function ed(e){let t=Ct();return fh({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function fh(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:se(e.parts.map(Ph))}}function mh(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function $s(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:se(o.text),doneSig:se(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:se(o.text),doneSig:se(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}: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:Xu(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:se(""),inputSig:se(o.input),outputSig:se(o.output),errorSig:se(o.errorText),stateSig:se(o.state),approvalSig:se(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"?Ra(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:mh(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:se(n)}}function gh(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 hh(e){return e.role==="assistant"&&e.status==="streaming"&&gh(e)}function yn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!hh(n)).map($s)}function td(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function Ds(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(xh)}}function Ve(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Ia(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?Ca(Ve(_)):Ve(_)).replace(/\s+/g," ").trim().slice(0,d)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function Vt(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function vh(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Fs(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function ur(e){return e.kind==="tool"}function nd(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function no(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(nd)}function Fn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(ur);return t.length>0&&t.every(n=>Fs(n.stateSig.value))}function Bn(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!no(e)}function Ea(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||nd(n))}function Aa(e){return e.partsSig.value.some(t=>ur(t)&&!Fs(t.stateSig.value))}function rd(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.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(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function $n(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 od(e,t,n,r){if(!Bs(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&Ve(s).length>=Ve(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&Ve(i).length>=Ve(e).length)}function Bs(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function bh(e,t){let n=new Map(t.partsSig.value.filter(ur).filter(a=>Fs(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!ur(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?i.inputSig:a.inputSig,d=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function Us(e,t){let n=t.filter(d=>!d.ephemeral&&(d.status==="streaming"||d.status==="pending"||d.status==="error"||d.retryAction!==void 0||(d.attachments?.length??0)>0||Vt(d))),r=new Map;for(let d of n)r.set(d.id,d),d.serverMessageId!==void 0&&r.set(d.serverMessageId,d);let o=new Set,a=[],i=e.map(d=>{let u=(d.serverMessageId!==void 0?r.get(d.serverMessageId):void 0)??r.get(d.id);return u===void 0?(a.push(d),d):(o.add(u),u.role!==d.role?d:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?$n(u,d):u.status==="streaming"||Ve(u).length>=Ve(d).length?(bh(u,d),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):$n(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(Bs),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=od(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=$n(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function ro(e,t){let n=new Map(t.filter(d=>d.serverMessageId!==void 0).map(d=>[d.serverMessageId,d])),r=new Map;t.forEach((d,u)=>{r.set(d.id,u),d.serverMessageId!==void 0&&r.set(d.serverMessageId,u)});let o=new Set(e.flatMap(d=>[d.serverMessageId,d.id].filter(u=>u!==void 0))),a=!1,i=e.map(d=>{let u=n.get(d.serverMessageId??d.id);if(u===void 0||u.role!==d.role)return d;if(d.role==="user"&&d.serverMessageId===void 0)return a=!0,$n(d,u);if(d.serverMessageId===void 0)return d;let f=Ve(u),m=Ve(d),v=u.status!=="streaming"&&f.length>=m.length&&Ls(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||v)return a=!0,$n(d,u);if(d.status==="streaming"&&u.status!=="streaming"&&yh(d,u)){if(d.continuationStreaming&&Aa(u))return d;if(!Ls(u,d))return a=!0,$n(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(Bs),p=i[c],_=od(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Ve(_).length>=Ve(p).length&&($n(p,_),i[c]=_,s.splice(s.indexOf(_),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let d of s){let u=r.get(d.serverMessageId??d.id),f=!1,m=i.findIndex(v=>{let S=r.get(v.serverMessageId??v.id);return u===void 0?!1:S===void 0?f:S>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function ad(e,t){if(e.role!==t.role)return!1;let n=Ve(t),r=Ve(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||Ls(e,t)}function yh(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&Ma(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function Ma(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Zu={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ls(e,t){let n=new Map(e.partsSig.value.filter(ur).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(ur).some(r=>{let o=n.get(r.toolCallId);if(!o||Zu[r.stateSig.value]>Zu[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Dn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Vt(e)}function Na(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"&&!Dn(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 id(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!vh(e)}function sd(e,t){return e.operatorRoutedTurn?Dn(e)?"drop":"complete-operator-routed":t||Dn(e)?"error":"complete"}function Ph(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:se(e.text),doneSig:se(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:se(e.inputPartial),inputSig:se(e.input),outputSig:se(e.output),errorSig:se(e.error),stateSig:se(e.state),approvalSig:se(e.approval)}:e}function xh(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,toolMetadata:e.toolMetadata,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}function Un(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}function Sh(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 ld(e){return e&&Object.keys(e).length>0?e:void 0}function Hs(e,t,n=[]){let r=ld(e),o=ld(t),a=Date.now();for(let i=n.length;;i-=1){let s=n.slice(n.length-i).map(({name:_,data:d,at:u})=>({name:_,data:d,secondsAgo:Math.round((a-u)/1e3)})),c=s.length>0?{...o,recentEvents:s}:o;if(!r&&!c)return;let p=Sh(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var ct=class extends Error{constructor(n,r,o,a){super(n);ce(this,"code",r);ce(this,"status",o);ce(this,"cause",a);this.name="StreamError"}};var cd=ne.scope("parser");async function*ud(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new ct(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of kh(e,t)){let o=wh(r,n);if(o==="done")return;o&&(yield o)}}async function*kh(e,t){if(!e.body)throw new ct("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:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
52
+ `:""),n=p),i=void 0}let c=lr({data:void 0,add_token(p,_){a+=1,_===10&&a===1&&(i={start:o,source:"",language:""})},set_attr(p,_,d){i&&_===Gr&&(i.language=d)},add_text(p,_){i&&(i.source+=_)},end_token(){i&&s(Math.min(r+1,e.length)),a-=1}});for(;r<e.length;r++)Xe(c,e.charAt(r)),e[r]===`
53
+ `&&(o=r+1);return Kr(c),i&&s(e.length),t+e.slice(n)}function Qu(e){if(!e)return;let t=Date.parse(e);return Number.isFinite(t)?t:void 0}function dv(e){return`tool-${e.startsWith("tool:")?e.slice(5):e}`}function Xu(e){return e.startsWith("tool-")?e.slice(5):e}var lt={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",contentCollections:"/pai/content/collection/list",contentVoteSet:"/pai/content/vote/set",submitForm:"/pai/submit-form"},Ms="context";function Ta(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ju(e){if(!Ta(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 Yu(e){if(!Ta(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 Ra(e){let t=Ta(e)?e.suggestions:void 0;if(!Array.isArray(t))return[];let n=[];for(let r of t){if(!Ta(r))continue;let{id:o,label:a,text:i}=r;typeof a!="string"||!a||n.push({id:typeof o=="string"&&o?o:`s${n.length}`,label:a,text:typeof i=="string"&&i?i:a})}return n}function Ns(e){let n={messages:e.messages.map(r=>({id:r.serverMessageId??r.id,parts:_v(r),role:r.role})),conversationId:e.conversationId,responseType:"ack"};return e.visitorId&&(n.visitorId=e.visitorId),e.userPrefs&&(n.userPrefs=e.userPrefs),e.clientTools?.length&&(n.clientTools=e.clientTools),n}function pv(e){return e.state==="output-available"||e.state==="output-error"||e.state==="output-denied"||e.approval?.approved!==void 0}function _v(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,filename:n.filename,fileId:n.fileId,fileSize:n.fileSize}),n.kind==="tool"&&pv(n)){let r=n.dynamic?{type:"dynamic-tool",toolName:n.toolName,toolCallId:n.toolCallId,state:n.state}:{type:dv(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),n.toolMetadata&&(r.toolMetadata=n.toolMetadata),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}function Os(e,t,n=Ct()){let r=e?[{kind:"text",id:"t0",textSig:se(e),doneSig:se(!0)}]:[];return{id:n,role:"user",createdAt:Date.now(),status:"complete",attachments:t,partsSig:se(r)}}function sn(){return{id:Ct(),role:"assistant",createdAt:Date.now(),status:"streaming",partsSig:se([])}}function ed(e){let t=Ct();return fv({id:t,role:e.role,createdAt:Date.now(),status:"complete",ephemeral:!0,parts:[{kind:"text",id:`${t}-t0`,text:e.text,done:!0}]})}function fv(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:se(e.parts.map(xv))}}function mv(e){return e.status==="failed"?"error":e.role==="assistant"&&e.status==="streaming"?"streaming":"complete"}function $s(e){let t=new Set,n=e.parts.map((o,a)=>o.type==="text"?{kind:"text",id:`${e.id}-t${a}`,textSig:se(o.text),doneSig:se(!0)}:o.type==="reasoning"?{kind:"reasoning",id:`${e.id}-r${a}`,textSig:se(o.text),doneSig:se(o.state!=="streaming")}:o.type==="step-start"?{kind:"step-start",id:`${e.id}-ss${a}`}:o.type==="file"?{kind:"file",url:o.url,mediaType:o.mediaType,filename:o.filename,fileId:o.fileId,fileSize:o.fileSize}: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:Xu(o.type),dynamic:o.type==="dynamic-tool"?!0:void 0,toolMetadata:o.toolMetadata,inputPartialSig:se(""),inputSig:se(o.input),outputSig:se(o.output),errorSig:se(o.errorText),stateSig:se(o.state),approvalSig:se(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"?Ra(r.data):void 0,serverMessageId:e.id,createdAt:Date.parse(e.createdAt),status:mv(e),canceled:e.status==="canceled",feedback:e.feedback??null,partsSig:se(n)}}function gv(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 vv(e){return e.role==="assistant"&&e.status==="streaming"&&gv(e)}function Pn(e){let t=e.length-1;return e.filter((n,r)=>r===t||!vv(n)).map($s)}function td(e,t){let n=!t&&e.at(-1)?.role==="assistant"?-2:-1,r=e.at(n);return!r||r.ephemeral?[]:[r]}function Ds(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(Sv)}}function Ve(e){let t="";for(let n of e.partsSig.value)n.kind==="text"&&(t+=n.textSig.value);return t}function Ia(e,t,n,r,o,a=t.createdAt){let i=e.find(_=>_.role==="user"&&!_.ephemeral);function s(_,d){return(_.role==="assistant"?Ca(Ve(_)):Ve(_)).replace(/\s+/g," ").trim().slice(0,d)}let c=i?s(i,80):"",p=s(t,120);return{conversationId:n,title:c||r,lastMessageAt:new Date(a).toISOString(),preview:p||void 0,canContinue:o}}function Vt(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file"||t.kind==="source")}function hv(e){return Ve(e).trim()!==""?!0:e.partsSig.value.some(t=>t.kind==="tool"||t.kind==="file")}function Fs(e){return e==="approval-responded"||e==="output-available"||e==="output-denied"||e==="output-error"}function an(e){return e.kind==="tool"}function nd(e){return e.kind==="text"&&e.textSig.value.trim()!==""||e.kind==="file"}function no(e){let t=e.partsSig.value,n=t.findLastIndex(r=>r.kind==="tool");return t.slice(n+1).some(nd)}function Bn(e){if(e.role!=="assistant")return!1;let t=e.partsSig.value.filter(an);return t.length>0&&t.every(n=>Fs(n.stateSig.value))}function Un(e){return e.role!=="assistant"?!1:e.partsSig.value.some(t=>t.kind==="tool")&&!no(e)}function Ea(e,t){return!e.partsSig.value.slice(t+1).some(n=>n.kind==="step-start"||nd(n))}function Aa(e){return e.partsSig.value.some(t=>an(t)&&!Fs(t.stateSig.value))}function rd(e,t){if(t.length===0)return e;let n=new Set;for(let i of e)n.add(i.id),i.serverMessageId&&n.add(i.serverMessageId);let r=t.filter(i=>{let s=[i.id,i.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(i=>!i.ephemeral),a=o<0?e.length:o;return[...e.slice(0,a),...r,...e.slice(a)]}function Dn(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 od(e,t,n,r){if(!Bs(e))return;if(t.length===0){let i=Math.max(...r.values());return n.find(s=>s.role==="assistant"&&r.get(s.serverMessageId??s.id)===i&&Ve(s).length>=Ve(e).length)}let o=t.at(-1);if(o?.role!=="user")return;let a=r.get(o.serverMessageId??o.id);if(a!==void 0)return n.find(i=>i.role==="assistant"&&r.get(i.serverMessageId??i.id)===a+1&&Ve(i).length>=Ve(e).length)}function Bs(e){return e?.role==="assistant"&&e.status==="streaming"&&e.serverMessageId===void 0}function bv(e,t){let n=e.partsSig.value,r=t.partsSig.value,o=new Map(r.flatMap((c,p)=>an(c)?[[c.toolCallId,p]]:[])),a=n.findIndex(c=>an(c)&&o.has(c.toolCallId)),i=n[a];if(i===void 0||!an(i))return;let s=(o.get(i.toolCallId)??0)-a;s>0&&(e.partsSig.value=[...r.slice(0,s),...n])}function yv(e,t){let n=new Map(t.partsSig.value.filter(an).filter(a=>Fs(a.stateSig.value)).map(a=>[a.toolCallId,a]));if(n.size===0)return;let r=!1,o=e.partsSig.value.map(a=>{if(!an(a))return a;let i=n.get(a.toolCallId);if(!i)return a;let s=a.approvalSig.value,c=i.approvalSig.value,p=s===void 0||s.approved===void 0&&c?.approved!==void 0?i.approvalSig:a.approvalSig,_=a.inputSig.value===void 0?i.inputSig:a.inputSig,d=a.toolName==="tool"?i.toolName:a.toolName,u=a.dynamic??i.dynamic,f=a.toolMetadata??i.toolMetadata;return p===a.approvalSig&&_===a.inputSig&&d===a.toolName&&u===a.dynamic&&f===a.toolMetadata?a:(r=!0,{...a,toolName:d,dynamic:u,toolMetadata:f,inputSig:_,approvalSig:p})});r&&(e.partsSig.value=o)}function Us(e,t){let n=t.filter(d=>!d.ephemeral&&(d.status==="streaming"||d.status==="pending"||d.status==="error"||d.retryAction!==void 0||(d.attachments?.length??0)>0||Vt(d))),r=new Map;for(let d of n)r.set(d.id,d),d.serverMessageId!==void 0&&r.set(d.serverMessageId,d);let o=new Set,a=[],i=e.map(d=>{let u=(d.serverMessageId!==void 0?r.get(d.serverMessageId):void 0)??r.get(d.id);return u===void 0?(a.push(d),d):(o.add(u),u.role!==d.role?d:u.role==="user"&&u.serverMessageId===void 0&&(u.status==="pending"||u.status==="error")?Dn(u,d):u.status==="streaming"||Ve(u).length>=Ve(d).length?(bv(u,d),yv(u,d),u.suggestions??(u.suggestions=d.suggestions),u.feedback===void 0&&(u.feedback=d.feedback),d.canceled&&(u.canceled=!0),u):Dn(u,d))}),s=n.filter(d=>!o.has(d)),c=s.findLast(Bs),p=new Map;e.forEach((d,u)=>{p.set(d.id,u),d.serverMessageId!==void 0&&p.set(d.serverMessageId,u)});let _=od(c,c?n.slice(0,n.indexOf(c)):[],a,p);if(c&&_){let d=i.indexOf(_);d>=0&&(i[d]=Dn(c,_)),s=s.filter(u=>u!==c)}return[...i,...s]}function ro(e,t){let n=new Map(t.filter(d=>d.serverMessageId!==void 0).map(d=>[d.serverMessageId,d])),r=new Map;t.forEach((d,u)=>{r.set(d.id,u),d.serverMessageId!==void 0&&r.set(d.serverMessageId,u)});let o=new Set(e.flatMap(d=>[d.serverMessageId,d.id].filter(u=>u!==void 0))),a=!1,i=e.map(d=>{let u=n.get(d.serverMessageId??d.id);if(u===void 0||u.role!==d.role)return d;if(d.role==="user"&&d.serverMessageId===void 0)return a=!0,Dn(d,u);if(d.serverMessageId===void 0)return d;let f=Ve(u),m=Ve(d),h=u.status!=="streaming"&&f.length>=m.length&&Ls(d,u);if(f.length>m.length||f===m&&u.partsSig.value.length>d.partsSig.value.length||h)return a=!0,Dn(d,u);if(d.status==="streaming"&&u.status!=="streaming"&&Pv(d,u)){if(d.continuationStreaming&&Aa(u))return d;if(!Ls(u,d))return a=!0,Dn(d,u)}return d}),s=[...n.values()].filter(d=>!o.has(d.serverMessageId)),c=i.findLastIndex(Bs),p=i[c],_=od(p,i.slice(0,c),s,r);if(p!==void 0&&_!==void 0&&Ve(_).length>=Ve(p).length&&(Dn(p,_),i[c]=_,s.splice(s.indexOf(_),1),a=!0),s.length===0)return{messages:a?i:e,changed:a};for(let d of s){let u=r.get(d.serverMessageId??d.id),f=!1,m=i.findIndex(h=>{let S=r.get(h.serverMessageId??h.id);return u===void 0?!1:S===void 0?f:S>u?!0:(f=!0,!1)});m===-1?i.push(d):i.splice(m,0,d)}return{messages:i,changed:!0}}function ad(e,t){if(e.role!==t.role)return!1;let n=Ve(t),r=Ve(e);return n.length>r.length||t.partsSig.value.length>e.partsSig.value.length||Ls(e,t)}function Pv(e,t){let n=e.partsSig.value,r=t.partsSig.value;return n.length!==r.length?!1:n.every((o,a)=>{let i=r[a];switch(o.kind){case"text":return i?.kind==="text"&&i.textSig.value===o.textSig.value;case"reasoning":return i?.kind==="reasoning"&&i.textSig.value===o.textSig.value;case"step-start":return i?.kind==="step-start";case"tool":return i?.kind==="tool"&&i.toolCallId===o.toolCallId&&Ma(i.toolName,o.toolName);case"file":return i?.kind==="file"&&i.url===o.url&&i.mediaType===o.mediaType;case"source":return i?.kind==="source"&&i.sourceId===o.sourceId&&i.url===o.url&&i.title===o.title&&i.filename===o.filename&&i.mediaType===o.mediaType;default:return o}})}function Ma(e,t){let n=e.startsWith("tool:")?e.slice(5):e,r=t.startsWith("tool:")?t.slice(5):t;return n===r}var Zu={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Ls(e,t){let n=new Map(e.partsSig.value.filter(an).map(r=>[r.toolCallId,r]));return t.partsSig.value.filter(an).some(r=>{let o=n.get(r.toolCallId);if(!o||Zu[r.stateSig.value]>Zu[o.stateSig.value])return!0;let a=r.approvalSig.value?.approved;return a!==void 0&&a!==o.approvalSig.value?.approved})}function Fn(e){return e.role==="assistant"&&e.status!=="streaming"&&!Vt(e)}function Na(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"&&!Fn(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 id(e){return e.canceled===!0&&e.role==="assistant"&&e.status!=="streaming"&&!hv(e)}function sd(e,t){return e.operatorRoutedTurn?Fn(e)?"drop":"complete-operator-routed":t||Fn(e)?"error":"complete"}function xv(e){return e.kind==="text"||e.kind==="reasoning"?{kind:e.kind,id:e.id,textSig:se(e.text),doneSig:se(e.done)}:e.kind==="tool"?{kind:"tool",toolCallId:e.toolCallId,toolName:e.toolName,dynamic:e.dynamic,toolMetadata:e.toolMetadata,inputPartialSig:se(e.inputPartial),inputSig:se(e.input),outputSig:se(e.output),errorSig:se(e.error),stateSig:se(e.state),approvalSig:se(e.approval)}:e}function Sv(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,toolMetadata:e.toolMetadata,inputPartial:e.inputPartialSig.value,input:e.inputSig.value,output:e.outputSig.value,error:e.errorSig.value,state:e.stateSig.value,approval:e.approvalSig.value}:e}function Hn(e,t){return new Promise(n=>{if(t?.aborted)return n();let r=setTimeout(a,e);function o(){return a()}t?.addEventListener("abort",o,{once:!0});function a(){clearTimeout(r),t?.removeEventListener("abort",o),n()}})}function kv(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 ld(e){return e&&Object.keys(e).length>0?e:void 0}function Hs(e,t,n=[]){let r=ld(e),o=ld(t),a=Date.now();for(let i=n.length;;i-=1){let s=n.slice(n.length-i).map(({name:_,data:d,at:u})=>({name:_,data:d,secondsAgo:Math.round((a-u)/1e3)})),c=s.length>0?{...o,recentEvents:s}:o;if(!r&&!c)return;let p=kv(JSON.stringify({...r&&{user:r},...c&&{page:c}}));if(p.length<=8192||i===0)return p}}var ct=class extends Error{constructor(n,r,o,a){super(n);ce(this,"code",r);ce(this,"status",o);ce(this,"cause",a);this.name="StreamError"}};var cd=ne.scope("parser");async function*ud(e,t,n){if(!e.ok){let r=await e.text().catch(()=>"");throw new ct(`server responded ${e.status}: ${r.slice(0,200)}`,"server",e.status)}for await(let r of wv(e,t)){let o=Cv(r,n);if(o==="done")return;o&&(yield o)}}async function*wv(e,t){if(!e.body)throw new ct("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:a}=await n.read();if(o){let s=r.trim();s&&(yield s);return}r+=a;let i;for(;(i=r.indexOf(`
54
54
 
55
- `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function wh(e,t){let n="",r;for(let o of e.split(`
55
+ `))!==-1;){let s=r.slice(0,i);r=r.slice(i+2),yield s}}}finally{n.releaseLock()}}function Cv(e,t){let n="",r;for(let o of e.split(`
56
56
  `))if(o!==""){if(o.startsWith(":")){t?.(o.slice(1).trim());continue}if(o.startsWith("data:")){let a=o.slice(5).replace(/^ /,"");n=n?`${n}
57
- ${a}`:a;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 cd.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw cd.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new ct("invalid SSE frame","network",void 0,o)}}var Ae=ne.scope("transport"),Ch="x-user-token",dd=6e4,Th=1e4,qs=50,gd=new WeakMap;function dr(e){return gd.get(e)}function oo(e,t){return gd.set(e,t),e}function pd(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Rh(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 sn(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(dr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>dr(s).activityRevision-dr(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=dr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?oo({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}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],a=dr(o);if(pd(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?oo({...c,hasUnread:!1},s):c):(oo(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?dr(o):void 0;if(pd(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&Rh(o,c)?(oo(o,s),e):(oo(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,_)=>_===r?c:p):[...e,c])}default:return t}}var _d=3,Ih=400,Eh=3e4,Ah=6e4,Mh=1e4,Nh=6e4,Lh=15e3,Oh=1024*1024,fd=new Set([408,425,429,500,502,503,504]);function md(e){return Ih*2**e+Math.floor(Math.random()*250)}function $h(e){return Nh+Math.ceil(e/Oh)*Lh}function Dh(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 ao=class{constructor(t){ce(this,"ttlMs",t);ce(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(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};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)}},La=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,"userTokenSource");ce(this,"userToken");ce(this,"userTokenRequest");ce(this,"conversationsCache",new ao(Th));ce(this,"contentCache",new ao(dd));ce(this,"contentCollectionsCache",new ao(dd))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:nr};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Hs(this.userContext,this.pageContext);return n&&(t[Ms]=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){Ae.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(lt.handshake,t,"handshake");return Ae.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){Ae.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,$h(t.size));return Ae.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ae.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Fh(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ae.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 a=o.pagination.page===1,i=o.conversations.some(d=>d.conversationId===t.conversationId),s=sn(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,_=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:_,hasNext:o.pagination.page<_}}});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 a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(lt.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 a=new URL(this.url(lt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(qs)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.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 a=sn(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(lt.markRead,{conversationId:t},"markRead",!0)}catch(o){Ae.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.requestOperator,{},"requestOperator")).controlState}catch(t){Ae.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ae.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(lt.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>rc(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(lt.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(lt.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>oc(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(lt.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(lt.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??lt.submitForm}async submitForm(t){Ae.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){Ae.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ae.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(lt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ae.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){Ae.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[Ms]:Hs(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<Ah;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(lt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(lt.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new ct(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status);let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new ct("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!Bh(s))throw new ct("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,Eh)}catch(a){throw a instanceof ct?a:new ct("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ae.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(lt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(lt.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ae.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(),Mh);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ae.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||fd.has(i.status)?(Ae.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ae.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ae.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ae.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of ud(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ae.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(lt.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=_d)throw new ct(`${n} failed: network error`,"network",void 0,i);Ae.debug("request network error \u2014 retrying",{label:n,attempt:r}),await Un(md(r));continue}if(o.ok||!fd.has(o.status)||r>=_d)return o;let a=Dh(o.headers)??md(r);Ae.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await Un(a)}}async assertOk(t,n){if(!t.ok)throw new ct(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{Ae.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[Ch]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ae.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 Fh(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 Bh(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)}function pr(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 Oa(e,t,n){return pr("close",e,t)?n.includes("close"):!1}function hd(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function _r(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function vd(e){let t=F(e);t.current=e;let n=F(null);return n.current??(n.current=Uh(t)),n.current}function Uh(e){let t=se(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 a(c,p){if(t.value)return;let _=e.current;if(c==="manual"){let d=_.forms.list.find(u=>u.id===p);d&&(t.value={form:d,trigger:"manual"});return}for(let d of _.forms.byTrigger[c]??[]){let u=d.triggers.find(f=>f.kind===c);if(!(!u||!Hh(u,_)||o(d)||!qh(d,_))){t.value={form:d,trigger:c};return}}}function i(c,p){let _=t.value;if(!_)return;t.value=null;let{form:d,trigger:u}=_;d.frequency==="conversation"?n.add(r(d.id)):d.frequency!=="always"&&e.current.persistence.saveFormDone(d.id),e.current.onComplete(d,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(_=>_.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function Hh(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function qh(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))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 bd(e){return Object.fromEntries(e.map(t=>[t,[]]))}function zs(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function yd(e,t,n){let r=[...new Set(t)],o=zs(r,e,""),a=se({activeTab:o,stacks:bd(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=zs(c,p.activeTab,s),d=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=_===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===d[f]);r=c,!u&&(a.value={activeTab:_,stacks:d},_!==p.activeTab&&_&&n?.(_))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:zs(r,i,""),stacks:bd(r)}}}}function Pd(e){return e.stacks[e.activeTab]??[]}function xd(e){return Pd(e).at(-1)}function Sd(e){return Pd(e).length===0}function $a(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 zh=900,jh=640;function js(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<jh?"fullscreen":n>=(t.autoSizeBreakpoint??zh)?"expanded":"normal"}function io(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:js(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function fr(){return typeof window>"u"?0:window.innerWidth}var re={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},so=`${A.cssPrefix}-icon-dir`;function Vs(){return l("svg",{...re,"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 Bt(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function kd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function wd(){return l("svg",{...re,class:so,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function Cd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function Td(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function mr(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function Rd(){return l("svg",{...re,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Id(){return l("svg",{...re,"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 Ed(){return l("svg",{...re,"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 Ad(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function Md(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function Nd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function Ld(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Od(){return l("svg",{...re,"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",{...re,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function Dd(){return l("svg",{...re,"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 Fd(){return l("svg",{...re,"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 Bd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Ud(){return l("svg",{...re,"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",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function Hn(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function qd(){return l("svg",{...re,"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 zd(){return l("svg",{...re,"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 lo(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function jd(){return l("svg",{...re,"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 ln(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Da(){return l("svg",{...re,"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 Vh(){return l("svg",{...re,"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 Ws(){return l("svg",{...re,"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 co(){return l("svg",{...re,"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 Wh(){return l("svg",{...re,"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 Gh(){return l("svg",{...re,"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 Gs(){return l("svg",{...re,"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 Kh(){return l("svg",{...re,"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 Ks(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Vd(){return l("svg",{...re,"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 Wd(){return l("svg",{...re,"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 Fa(){return l("svg",{...re,"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 uo(){return l("svg",{...re,"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 Gd(){return l("svg",{...re,"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 Kd(){return l("svg",{...re,"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 Qd(){return l("svg",{...re,"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 Qh(){return l("svg",{...re,"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 Xh(){return l("svg",{...re,"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 Jh(){return l("svg",{...re,"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 Yh(){return l("svg",{...re,"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 Xd(){return l("svg",{...re,"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 Jd(){return l("svg",{...re,"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 Yd(){return l("svg",{...re,"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 Ba(){return l("svg",{...re,"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 Zd(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function gr(){return l("svg",{...re,"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 hr(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var ep={chat:Vs,message:Ws,bubbles:uo,spark:Vh,wand:Wh,bot:Gh,help:co,lifebuoy:Kh,headset:Gs,search:Qh,sparkles:Xh,concierge:Jh,wave:Yh};var q=A.cssPrefix,N={launcher:`${q}-launcher`,callout:`${q}-callout`,calloutDismiss:`${q}-callout-dismiss`,panel:`${q}-panel`,panelHeader:`${q}-panel-header`,resizeGrip:`${q}-resize-grip`,scrollToBottom:`${q}-scroll-to-bottom`,loadPreviousMessages:`${q}-load-previous-messages`,actionHistory:`${q}-action-history`,actionClose:`${q}-action-close`,langSegment:`${q}-lang-segment`,composer:`${q}-composer`,composerInput:`${q}-composer-input`,composerSend:`${q}-composer-send`,composerStop:`${q}-composer-stop`,compactionStatus:`${q}-compaction-status`,messageQueue:`${q}-message-queue`,queuedMessage:`${q}-queued-message`,queuedMessageRemove:`${q}-queued-message-remove`,composerAttach:`${q}-composer-attach`,composerFileInput:`${q}-composer-file-input`,composerVoice:`${q}-composer-voice`,attachmentChip:`${q}-attachment-chip`,attachmentRemove:`${q}-attachment-remove`,suggestion:`${q}-suggestion`,messageBubble:`${q}-message`,messageRetry:`${q}-message-retry`,messageFile:`${q}-message-file`,messageFeedback:`${q}-message-feedback`,feedbackUp:`${q}-feedback-up`,feedbackDown:`${q}-feedback-down`,messageCopy:`${q}-message-copy`,historyPane:`${q}-history-pane`,historyBack:`${q}-history-back`,historyItem:`${q}-history-item`,historyLoadMore:`${q}-history-load-more`,sidebar:`${q}-sidebar`,sidebarToggle:`${q}-sidebar-toggle`,sidebarNewConversation:`${q}-sidebar-new-conversation`,sidebarItem:`${q}-sidebar-item`,messengerHome:`${q}-messenger-home`,modulesEmpty:`${q}-modules-empty`,tab:`${q}-tab`,tabBadge:`${q}-tab-badge`,homeView:`${q}-home-view`,homeGreeting:`${q}-home-greeting`,homeBrand:`${q}-home-brand`,backHeader:`${q}-back-header`,contentView:`${q}-content-view`,contentScroll:`${q}-content-scroll`,homeSearch:`${q}-home-search`,helpSearch:`${q}-help-search`,homeRecent:`${q}-home-recent`,homeAsk:`${q}-home-ask`,homeWhatsNew:`${q}-home-whats-new`,homeContentRow:`${q}-home-content-row`,helpArticle:`${q}-help-article`,newsItem:`${q}-news-item`,newsMore:`${q}-news-more`,formGate:`${q}-form-gate`,formDone:`${q}-form-done`,formDoneToggle:`${q}-form-done-toggle`,formAnswers:`${q}-form-answers`,formFill:`${q}-form-fill`,formSubmit:`${q}-form-submit`,formSkip:`${q}-form-skip`,formField:`${q}-form-field`,toolAskQuestions:`${q}-tool-ask-questions`,toolInputSubmit:`${q}-tool-input-submit`,toolInputSkip:`${q}-tool-input-skip`,toolApproval:`${q}-tool-approval`,toolApprove:`${q}-tool-approve`,toolReject:`${q}-tool-reject`,toolEdit:`${q}-tool-edit`,toolDecision:`${q}-tool-decision`,typingDots:`${q}-typing-dots`,reasoning:`${q}-reasoning`,toolAskSummary:`${q}-ask-questions-summary`,toolAskOptions:`${q}-ask-questions-options-toggle`,toolCall:`${q}-tool-call`,toolSteps:`${q}-tool-steps`,toolStep:`${q}-tool-step`,source:`${q}-source`,operatorRequest:`${q}-operator-request`,operatorBanner:`${q}-operator-banner`,cancelOperatorRequest:`${q}-cancel-operator-request`};function ut(e,t){return`${e}-${t}`}var Ua=A.cssPrefix;function tp({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Ua}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":N.launcher,onClick:e,"aria-label":n.launcherOpen,children:[Zh(t.icon),a?l("span",{class:`${Ua}-fab-label`,children:bt(n,t.label??"")}):null]})}function Zh(e){let t=ep[e];return t?l(t,{}):l(ev,{source:e})}function ev({source:e}){return l("span",{ref:t=>{t&&tv(t,e)},"aria-hidden":"true"})}function tv(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 np({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=H(!1);return D(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),D(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Ua}-callout`,role:"status","data-shape":e.shape,"data-position":nv(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":N.callout,children:[l("span",{children:bt(n,e.text)}),l("button",{type:"button",class:`${Ua}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":N.calloutDismiss,children:l(Bt,{})})]}):null}function nv(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var rv='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Ha(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(rv)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var Pn=A.cssPrefix;function qa({title:e,actions:t}){return l("header",{class:`${Pn}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${Pn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${Pn}-back-title`,children:e}),t??l("span",{class:`${Pn}-back-spacer`,"aria-hidden":"true"})]})}function za({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${Pn}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${Pn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(lo,{})}),l("h1",{class:`${Pn}-back-title`,children:e}),r??l("span",{class:`${Pn}-back-spacer`,"aria-hidden":"true"})]})}function vr({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=qo}){let o=F(null);return Tt(()=>{let a=o.current;if(!a)return;a.classList.add(`${A.cssPrefix}-md`),a.replaceChildren();let i=n?As(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=sr(i??Qr(a)),c=0,p=jt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?As(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=sr(i??Qr(a)),c=0);let m=u.slice(c);m&&Xe(s,m),c=u.length,f&&(Kr(s),i?.finish())}),_=new MutationObserver(()=>rp(a));_.observe(a,{childList:!0,subtree:!0}),rp(a);function d(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",d),()=>{p(),i?.dispose(),_.disconnect(),a.removeEventListener("click",d)}},[e,t,n,r]),l("div",{ref:o})}function ap({text:e}){let t=ue(()=>se(e),[e]),n=ue(()=>se(!0),[]);return l(vr,{textSig:t,doneSig:n})}var fv=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function ip(e){let t=0,n="";return e.replace(fv,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
57
+ ${a}`:a;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 cd.trace("chunk",{type:o.type,eventId:r}),{chunk:o,eventId:r}}catch(o){throw cd.trace("frame parse failed",{errorType:o instanceof Error?o.name:typeof o,payloadLength:n.length}),new ct("invalid SSE frame","network",void 0,o)}}var Ae=ne.scope("transport"),Tv="x-user-token",dd=6e4,Rv=1e4,qs=50,gd=new WeakMap;function dr(e){return gd.get(e)}function oo(e,t){return gd.set(e,t),e}function pd(e){return Math.max(e?.upsertRevision??0,e?.read?.revision??0)}function Iv(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 ln(e,t,n=!0){switch(t.type){case"snapshot":{let r=new Map(e.map(i=>[i.conversationId,i])),o=e.filter(i=>(dr(i)?.activityRevision??0)>t.requestedRevision).toSorted((i,s)=>dr(s).activityRevision-dr(i).activityRevision),a=new Set(o.map(i=>i.conversationId));return[...o,...t.result.conversations.filter(i=>!a.has(i.conversationId)).map(i=>{let s=r.get(i.conversationId);if(!s)return i;let c=dr(s);return(c?.upsertRevision??0)>t.requestedRevision?s:c?.read&&!s.hasUnread&&c.read.lastMessageAt===i.lastMessageAt?oo({...i,hasUnread:!1},{upsertRevision:0,read:c.read}):i})]}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],a=dr(o);if(pd(a)>t.revision)return e;let i=t.lastMessageAt??o.lastMessageAt,s={upsertRevision:a?.upsertRevision??0,...a?.activityRevision===void 0?{}:{activityRevision:a.activityRevision},read:{revision:t.revision,...i?{lastMessageAt:i}:{}}};return o.hasUnread?e.map((c,p)=>p===r?oo({...c,hasUnread:!1},s):c):(oo(o,s),e)}case"upsert":{let r=e.findIndex(p=>p.conversationId===t.conversation.conversationId);if(r<0&&!n)return e;let o=r<0?void 0:e[r],a=o?dr(o):void 0;if(pd(a)>t.revision)return e;let i=t.activity?t.revision:a?.activityRevision,s={upsertRevision:t.revision,...i===void 0?{}:{activityRevision:i},...!t.conversation.hasUnread&&a?.read?{read:a.read}:{}},c=o?{...o,...t.conversation,title:o.title}:{...t.conversation};return o&&Iv(o,c)?(oo(o,s),e):(oo(c,s),t.activity?[c,...e.filter(p=>p.conversationId!==c.conversationId)]:o?e.map((p,_)=>_===r?c:p):[...e,c])}default:return t}}var _d=3,Ev=400,Av=3e4,Mv=6e4,Nv=1e4,Lv=6e4,Ov=15e3,$v=1024*1024,fd=new Set([408,425,429,500,502,503,504]);function md(e){return Ev*2**e+Math.floor(Math.random()*250)}function Dv(e){return Lv+Math.ceil(e/$v)*Ov}function Fv(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 ao=class{constructor(t){ce(this,"ttlMs",t);ce(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(a=>(o.value=a,a)).catch(a=>{throw this.map.get(t)===o&&this.map.delete(t),a})};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)}},La=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,"userTokenSource");ce(this,"userToken");ce(this,"userTokenRequest");ce(this,"conversationsCache",new ao(Rv));ce(this,"contentCache",new ao(dd));ce(this,"contentCollectionsCache",new ao(dd))}setUserToken(t){this.userTokenSource=t,this.userToken=typeof t=="string"&&t||void 0,this.userTokenRequest=typeof t=="function"?this.fetchUserToken():void 0}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:rr};this.visitorId&&(t.visitorId=this.visitorId),this.conversationId&&(t.conversationId=this.conversationId),this.locale&&(t.locale=this.locale);let n=Hs(this.userContext,this.pageContext);return n&&(t[Ms]=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){Ae.debug("handshake \u2192",{visitorId:t.visitorId,conversationId:t.conversationId,locale:t.locale}),this.userTokenRequest&&await this.userTokenRequest;let n=await this.postJson(lt.handshake,t,"handshake");return Ae.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){Ae.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,Dv(t.size));return Ae.debug("uploadFile \u2190",{id:o.id,url:o.url}),o}async transcribe(t,n="audio/webm"){Ae.debug("transcribe \u2192",{size:t.size,mimeType:n});let r=new FormData;r.append("audio",t,`voice.${Bv(n)}`),r.append("mimeType",n);let o=await this.postForm(this.transcribePath,r,"transcribe");return Ae.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 a=o.pagination.page===1,i=o.conversations.some(d=>d.conversationId===t.conversationId),s=ln(o.conversations,r,a&&n),c=a&&s.length>o.pagination.limit?s.slice(0,o.pagination.limit):s;if(!a||!n||i||o.pagination.hasNext)return c===o.conversations?o:{...o,conversations:c};let p=Math.max(o.pagination.total,o.conversations.length)+1,_=Math.ceil(p/o.pagination.limit);return{...o,conversations:c,pagination:{...o.pagination,total:p,totalPages:_,hasNext:o.pagination.page<_}}});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 a=this.conversationsCache.getOrFetch(r,()=>this.fetchConversations(t));return n?a.then(i=>{let s={type:"snapshot",result:i,requestedRevision:o};for(let c of this.conversationListeners)c(s);return i}):a}async fetchConversations(t){let n=new URL(this.url(lt.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 a=new URL(this.url(lt.listMessages));a.searchParams.set("conversationId",t),a.searchParams.set("limit",String(qs)),n.length>0&&a.searchParams.set("ids",n.join(",")),r&&a.searchParams.set("beforeId",r),o&&a.searchParams.set("beforeCreatedAt",o);let i=await this.getJson(a.toString(),"loadConversation");return{...i,messages:i.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 a=ln(o.conversations,r);return a===o.conversations?o:{...o,conversations:a}});for(let o of this.conversationListeners)o(r);try{await this.postJson(lt.markRead,{conversationId:t},"markRead",!0)}catch(o){Ae.debug("markRead failed (non-fatal)",{err:o})}}async requestOperator(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.requestOperator,{},"requestOperator")).controlState}catch(t){Ae.debug("requestOperator failed (non-fatal)",{err:t});return}}async cancelOperatorRequest(){if(!(!this.visitorId||!this.conversationId))try{return(await this.postJson(lt.cancelOperatorRequest,{},"cancelOperatorRequest")).controlState}catch(t){Ae.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(lt.content));for(let[a,i]of Object.entries(t))i!==void 0&&n.searchParams.set(a,Array.isArray(i)?i.join(","):String(i));let r=await this.getJson(n.toString(),"listContent"),o=r.items?.map(a=>rc(a,this.locale))??[];return{...r,items:o}}async setContentVote(t){try{await this.postJson(this.dataUrl(lt.contentVoteSet),t,"setContentVote")}catch{}}listContentCollections(t){return this.contentCollectionsCache.getOrFetch(this.localeCacheKey({ids:t}),()=>this.fetchContentCollections(t))}async fetchContentCollections(t){let n=new URL(this.dataUrl(lt.contentCollections));return t.length&&n.searchParams.set("ids",t.join(",")),{items:(await this.getJson(n.toString(),"listContentCollections")).items?.map(o=>oc(o,this.locale))??[]}}async bootstrap(t){let n=new URL(this.dataUrl(lt.bootstrap));t&&n.searchParams.set("conversationId",t);let r=await this.getJson(n.toString(),"bootstrap"),o=r.forms??[],a=r.formSubmissions??[];return{forms:o,formSubmissions:a}}async saveUserPrefs(t){return this.postJson(lt.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??lt.submitForm}async submitForm(t){Ae.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){Ae.debug("submitForm failed (non-fatal)",{err:n})}}async submitFeedback(t){Ae.debug("submitFeedback \u2192",{messageId:t.messageId,value:t.value});try{await this.postJson(lt.messageFeedback,{messageId:t.messageId,set:{feedback:t.value}},"submitFeedback")}catch(n){Ae.debug("submitFeedback failed (non-fatal)",{err:n})}}async sendTurn(t,n={}){Ae.debug("message \u2192",{conversationId:t.conversationId,visitorId:t.visitorId,messageCount:t.messages.length});let r=JSON.stringify({...this.withEnvelope(t),[Ms]:Hs(this.userContext,this.pageContext,this.opts.recentHostEvents)}),o=n.keepalive===!0&&new Blob([r]).size<Mv;try{return await this.runWithAbort(async a=>{let i=await this.withFreshUserToken(()=>this.fetchImpl(this.url(lt.streamMessage),{method:"POST",credentials:"omit",headers:{accept:"application/json","content-type":"application/json",...this.headersFor(this.url(lt.streamMessage))},body:r,keepalive:o,signal:a}));if(i.status!==202)throw new ct(`sendTurn failed: expected 202, received ${i.status}`,"server",i.status);let s;try{s=await i.json()}catch(c){throw a?.aborted?c:new ct("sendTurn failed: invalid acknowledgement","server",i.status,c)}if(!Uv(s))throw new ct("sendTurn failed: invalid acknowledgement","server",i.status);return s},void 0,Av)}catch(a){throw a instanceof ct?a:new ct("sendTurn failed: network error","network",void 0,a)}}cancelTurn(t,n){!this.visitorId||!t||!n||(Ae.debug("cancel stream",{conversationId:t,runId:n,visitorId:this.visitorId}),this.fetchImpl(this.url(lt.cancelStream),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(lt.cancelStream))},body:JSON.stringify(this.withEnvelope({conversationId:t,runId:n})),keepalive:!0}).catch(r=>Ae.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(),Nv);function a(){clearTimeout(o),t.signal.removeEventListener("abort",r)}let i;try{this.userTokenRequest&&await this.userTokenRequest,i=await this.fetchImpl(this.resumeUrl(),{method:"GET",credentials:"omit",headers:{accept:"text/event-stream",...this.headersFor(this.resumeUrl())},signal:n.signal})}catch(c){return a(),t.signal.aborted||Ae.debug("resume-stream fetch failed \u2014 reconnecting",{err:c}),"held"}if(!i.ok)return a(),i.status===401&&typeof this.userTokenSource=="function"?(await this.fetchUserToken(),"held"):i.status===409||fd.has(i.status)?(Ae.debug("resume-stream \u2192 transient response; reconnecting",{status:i.status}),"held"):(Ae.debug("resume-stream \u2192 endpoint unavailable",{status:i.status}),"unavailable");if(!i.body)return a(),Ae.debug("resume-stream \u2192 bodyless response; stopping",{status:i.status}),"unavailable";if(!(i.headers.get("content-type")??"").includes("text/event-stream"))return a(),Ae.debug("resume-stream \u2192 non-SSE response; stopping"),"unavailable";let s=!1;try{for await(let{chunk:c}of ud(i,n.signal,p=>{s||p!=="connected"||(s=!0,clearTimeout(o),t.onConnected())})){if(t.signal.aborted)return"held";t.onChunk(c)}}catch(c){if(t.signal.aborted)return"held";Ae.debug("resume-stream segment dropped \u2014 reconnecting",{err:c})}finally{a()}return"held"}resumeUrl(){return this.withEnvelopeQuery(lt.streamResume)}async postJson(t,n,r,o=!1){let a=await this.fetchWithRetry(()=>[this.url(t),{method:"POST",credentials:"omit",headers:{"content-type":"application/json",...this.headersFor(this.url(t))},body:JSON.stringify(this.withEnvelope(n)),...o?{keepalive:!0}:{}}],r);return this.assertOk(a,r)}async postForm(t,n,r,o,a){return this.runWithAbort(async i=>{let s=await this.withFreshUserToken(()=>this.fetchImpl(this.url(t),{method:"POST",credentials:"omit",headers:this.headersFor(this.url(t)),body:this.appendEnvelope(n),signal:i}));return this.assertOk(s,r)},o,a)}async runWithAbort(t,n,r){if(!n&&r===void 0)return t();let o=new AbortController;function a(){return o.abort(n?.reason)}n?.aborted?a():n?.addEventListener("abort",a,{once:!0});let i=r===void 0?void 0:setTimeout(()=>o.abort(),r);try{return await t(o.signal)}finally{i!==void 0&&clearTimeout(i),n?.removeEventListener("abort",a)}}async getJson(t,n){let r=await this.fetchWithRetry(()=>[this.withEnvelopeQuery(t),{method:"GET",credentials:"omit",headers:{accept:"application/json",...this.headersFor(this.url(t))}}],n);return this.assertOk(r,n)}async fetchWithRetry(t,n){for(let r=0;;r++){let o;try{o=await this.withFreshUserToken(()=>this.fetchImpl(...t()))}catch(i){if(r>=_d)throw new ct(`${n} failed: network error`,"network",void 0,i);Ae.debug("request network error \u2014 retrying",{label:n,attempt:r}),await Hn(md(r));continue}if(o.ok||!fd.has(o.status)||r>=_d)return o;let a=Fv(o.headers)??md(r);Ae.debug("request retryable status \u2014 retrying",{label:n,status:o.status,attempt:r,wait:a}),await Hn(a)}}async assertOk(t,n){if(!t.ok)throw new ct(`${n} failed: ${t.status}`,"server",t.status);return await t.json()}fetchUserToken(){let t=this.userTokenSource;if(typeof t!="function")return Promise.resolve();let n=Promise.resolve().then(t).then(r=>{this.userTokenSource===t&&(this.userToken=r||void 0)},r=>{Ae.warn("userToken function failed; continuing as an anonymous visitor",{err:r})});return this.userTokenRequest=n,n}headersFor(t){let n=!/^https?:\/\//i.test(t)||t.startsWith(`${this.opts.agentApiBaseUrl}/`);return{...this.opts.auth.headers(),...n&&this.userToken?{[Tv]:this.userToken}:{}}}async withFreshUserToken(t){let n=await t();return n.status!==401||!this.userTokenSource?n:typeof this.userTokenSource!="function"?(Ae.warn("userToken rejected as invalid or expired; pass a function so the widget can fetch a fresh one"),n):(await this.fetchUserToken(),t())}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 Bv(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 Uv(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)}function pr(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 Oa(e,t,n){return pr("close",e,t)?n.includes("close"):!1}function vd(e,t){return e==="inline"&&t==="fullscreen"?"exit-fullscreen":"close"}function _r(e,t,n,r){let o={role:n,text:r};e.emit("message",o),t.onMessage?.(o)}function hd(e){let t=F(e);t.current=e;let n=F(null);return n.current??(n.current=Hv(t)),n.current}function Hv(e){let t=se(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 a(c,p){if(t.value)return;let _=e.current;if(c==="manual"){let d=_.forms.list.find(u=>u.id===p);d&&(t.value={form:d,trigger:"manual"});return}for(let d of _.forms.byTrigger[c]??[]){let u=d.triggers.find(f=>f.kind===c);if(!(!u||!qv(u,_)||o(d)||!zv(d,_))){t.value={form:d,trigger:c};return}}}function i(c,p){let _=t.value;if(!_)return;t.value=null;let{form:d,trigger:u}=_;d.frequency==="conversation"?n.add(r(d.id)):d.frequency!=="always"&&e.current.persistence.saveFormDone(d.id),e.current.onComplete(d,u,c,p)}function s(){let c=t.value;if(!c)return;let p=e.current.forms.list.find(_=>_.id===c.form.id);p&&p!==c.form&&(t.value={form:p,trigger:c.trigger})}return{activeForm:t,fire:a,refresh:s,complete:c=>i(c,!1),skip:()=>i({},!0)}}function qv(e,t){return e.kind==="after-messages"?t.messageCount()>=Number(e.param??0):e.kind==="page-area"?t.pageArea()===e.param:!0}function zv(e,t){let n=e.when;if(!n)return!0;if(n.missingContext?.length){let o=t.userContext()??{};if(n.missingContext.some(a=>o[a]!==void 0&&o[a]!==""))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 bd(e){return Object.fromEntries(e.map(t=>[t,[]]))}function zs(e,t,n){return e.includes(t)?t:e.includes(n)?n:e[0]??""}function yd(e,t,n){let r=[...new Set(t)],o=zs(r,e,""),a=se({activeTab:o,stacks:bd(r)});return{sig:a,reconcile(i,s){let c=[...new Set(i)],p=a.value,_=zs(c,p.activeTab,s),d=Object.fromEntries(c.map(f=>[f,p.stacks[f]??[]])),u=_===p.activeTab&&c.length===Object.keys(p.stacks).length&&c.every(f=>p.stacks[f]===d[f]);r=c,!u&&(a.value={activeTab:_,stacks:d},_!==p.activeTab&&_&&n?.(_))},switchTab(i){!(i in a.value.stacks)||a.value.activeTab===i||(a.value={...a.value,activeTab:i},n?.(i))},open(i,s){let c=a.value;i in c.stacks&&(a.value={activeTab:i,stacks:{...c.stacks,[i]:s?[s]:[]}},c.activeTab!==i&&n?.(i))},push(i){let s=a.value,c=s.stacks[s.activeTab]??[];a.value={...s,stacks:{...s.stacks,[s.activeTab]:[...c,i]}}},pop(){let i=a.value,s=i.stacks[i.activeTab]??[];s.length!==0&&(a.value={...i,stacks:{...i.stacks,[i.activeTab]:s.slice(0,-1)}})},reset(i){a.value={activeTab:zs(r,i,""),stacks:bd(r)}}}}function Pd(e){return e.stacks[e.activeTab]??[]}function xd(e){return Pd(e).at(-1)}function Sd(e){return Pd(e).length===0}function $a(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 jv=900,Vv=640;function js(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<Vv?"fullscreen":n>=(t.autoSizeBreakpoint??jv)?"expanded":"normal"}function io(e,t,n,r=null){let a=e.mode==="inline"||e.mode==="standalone"||e.mode==="page"||(n??!e.startMinimized),s=e.mode!=="standalone"&&e.mode!=="page"&&e.mode!=="inline"&&r?r:js(e.mode,e.size,t);return{panelOpen:a,panelSize:s}}function fr(){return typeof window>"u"?0:window.innerWidth}var re={fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,viewBox:"0 0 24 24"},so=`${A.cssPrefix}-icon-dir`;function Vs(){return l("svg",{...re,"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 Bt(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M18 6 6 18M6 6l12 12"})})}function kd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 5v14M5 12h14"})})}function wd(){return l("svg",{...re,class:so,"aria-hidden":"true",children:[l("path",{d:"m22 2-7 20-4-9-9-4Z"}),l("path",{d:"M22 2 11 13"})]})}function Cd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M12 19V5M5 12l7-7 7 7"})})}function Td(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"M3 20V4l18 8-18 8Z"})})}function mr(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"m9 18 6-6-6-6"})})}function Rd(){return l("svg",{...re,"aria-hidden":"true",children:l("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"})})}function Id(){return l("svg",{...re,"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 Ed(){return l("svg",{...re,"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 Ad(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 8V3h5M21 8V3h-5M3 16v5h5M21 16v5h-5"})})}function Md(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M8 3v5H3M16 3v5h5M8 21v-5H3M16 21v-5h5"})})}function Nd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M3 3h7v2H5v5H3zM21 3h-7v2h5v5h2zM3 21h7v-2H5v-5H3zM21 21h-7v-2h5v-5h2z"})})}function Ld(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M10 3v5H3M14 3v5h7M10 21v-5H3M14 21v-5h7"})})}function Od(){return l("svg",{...re,"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",{...re,"aria-hidden":"true",viewBox:"0 0 10 10",children:l("path",{d:"M9 1L1 9M9 5L5 9M9 9H9",strokeWidth:"1.5"})})}function Dd(){return l("svg",{...re,"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 Fd(){return l("svg",{...re,"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 Bd(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M11 5 6 9H2v6h4l5 4zM22 9l-6 6M16 9l6 6"})})}function Ud(){return l("svg",{...re,"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",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"m5 6 6 6-6 6M13 6l6 6-6 6"})})}function qn(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"M20 6 9 17l-5-5"})})}function qd(){return l("svg",{...re,"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 zd(){return l("svg",{...re,"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 lo(){return l("svg",{...re,class:so,"aria-hidden":"true",children:l("path",{d:"M19 12H5M12 19l-7-7 7-7"})})}function jd(){return l("svg",{...re,"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 cn(){return l("svg",{...re,"aria-hidden":"true",children:l("path",{d:"m6 9 6 6 6-6"})})}function Da(){return l("svg",{...re,"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 Wv(){return l("svg",{...re,"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 Ws(){return l("svg",{...re,"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 co(){return l("svg",{...re,"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 Gv(){return l("svg",{...re,"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 Kv(){return l("svg",{...re,"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 Gs(){return l("svg",{...re,"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 Qv(){return l("svg",{...re,"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 Ks(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"11",cy:"11",r:"7"}),l("path",{d:"m21 21-4.3-4.3"})]})}function Vd(){return l("svg",{...re,"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 Wd(){return l("svg",{...re,"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 Fa(){return l("svg",{...re,"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 uo(){return l("svg",{...re,"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 Gd(){return l("svg",{...re,"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 Kd(){return l("svg",{...re,"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 Qd(){return l("svg",{...re,"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 Xv(){return l("svg",{...re,"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 Jv(){return l("svg",{...re,"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 Yv(){return l("svg",{...re,"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 Zv(){return l("svg",{...re,"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 Xd(){return l("svg",{...re,"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 Jd(){return l("svg",{...re,"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 Yd(){return l("svg",{...re,"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 Ba(){return l("svg",{...re,"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 Zd(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"M12 7v5l3 2"})]})}function gr(){return l("svg",{...re,"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 vr(){return l("svg",{...re,"aria-hidden":"true",children:[l("circle",{cx:"12",cy:"12",r:"9"}),l("path",{d:"m15 9-6 6M9 9l6 6"})]})}var ep={chat:Vs,message:Ws,bubbles:uo,spark:Wv,wand:Gv,bot:Kv,help:co,lifebuoy:Qv,headset:Gs,search:Xv,sparkles:Jv,concierge:Yv,wave:Zv};var q=A.cssPrefix,N={launcher:`${q}-launcher`,callout:`${q}-callout`,calloutDismiss:`${q}-callout-dismiss`,panel:`${q}-panel`,panelHeader:`${q}-panel-header`,resizeGrip:`${q}-resize-grip`,scrollToBottom:`${q}-scroll-to-bottom`,loadPreviousMessages:`${q}-load-previous-messages`,actionHistory:`${q}-action-history`,actionClose:`${q}-action-close`,langSegment:`${q}-lang-segment`,composer:`${q}-composer`,composerInput:`${q}-composer-input`,composerSend:`${q}-composer-send`,composerStop:`${q}-composer-stop`,compactionStatus:`${q}-compaction-status`,messageQueue:`${q}-message-queue`,queuedMessage:`${q}-queued-message`,queuedMessageRemove:`${q}-queued-message-remove`,composerAttach:`${q}-composer-attach`,composerFileInput:`${q}-composer-file-input`,composerVoice:`${q}-composer-voice`,attachmentChip:`${q}-attachment-chip`,attachmentRemove:`${q}-attachment-remove`,suggestion:`${q}-suggestion`,messageBubble:`${q}-message`,messageRetry:`${q}-message-retry`,messageFile:`${q}-message-file`,messageFeedback:`${q}-message-feedback`,feedbackUp:`${q}-feedback-up`,feedbackDown:`${q}-feedback-down`,messageCopy:`${q}-message-copy`,historyPane:`${q}-history-pane`,historyBack:`${q}-history-back`,historyItem:`${q}-history-item`,historyLoadMore:`${q}-history-load-more`,sidebar:`${q}-sidebar`,sidebarToggle:`${q}-sidebar-toggle`,sidebarNewConversation:`${q}-sidebar-new-conversation`,sidebarItem:`${q}-sidebar-item`,messengerHome:`${q}-messenger-home`,modulesEmpty:`${q}-modules-empty`,tab:`${q}-tab`,tabBadge:`${q}-tab-badge`,homeView:`${q}-home-view`,homeGreeting:`${q}-home-greeting`,homeBrand:`${q}-home-brand`,backHeader:`${q}-back-header`,contentView:`${q}-content-view`,contentScroll:`${q}-content-scroll`,homeSearch:`${q}-home-search`,helpSearch:`${q}-help-search`,homeRecent:`${q}-home-recent`,homeAsk:`${q}-home-ask`,homeWhatsNew:`${q}-home-whats-new`,homeContentRow:`${q}-home-content-row`,helpArticle:`${q}-help-article`,newsItem:`${q}-news-item`,newsMore:`${q}-news-more`,formGate:`${q}-form-gate`,formDone:`${q}-form-done`,formDoneToggle:`${q}-form-done-toggle`,formAnswers:`${q}-form-answers`,formFill:`${q}-form-fill`,formSubmit:`${q}-form-submit`,formSkip:`${q}-form-skip`,formField:`${q}-form-field`,toolAskQuestions:`${q}-tool-ask-questions`,toolInputSubmit:`${q}-tool-input-submit`,toolInputSkip:`${q}-tool-input-skip`,toolApproval:`${q}-tool-approval`,toolApprovalFields:`${q}-tool-approval-fields`,toolApprove:`${q}-tool-approve`,toolReject:`${q}-tool-reject`,toolEdit:`${q}-tool-edit`,toolDecision:`${q}-tool-decision`,typingDots:`${q}-typing-dots`,reasoning:`${q}-reasoning`,toolAskSummary:`${q}-ask-questions-summary`,toolAskOptions:`${q}-ask-questions-options-toggle`,toolCall:`${q}-tool-call`,toolSteps:`${q}-tool-steps`,toolStep:`${q}-tool-step`,source:`${q}-source`,operatorRequest:`${q}-operator-request`,operatorBanner:`${q}-operator-banner`,cancelOperatorRequest:`${q}-cancel-operator-request`};function ut(e,t){return`${e}-${t}`}var Ua=A.cssPrefix;function tp({onToggle:e,launcher:t,strings:n,leaving:r,edgeTab:o}){let a=t.variant!=="circle"&&!!t.label;return l("button",{type:"button",class:`${Ua}-fab`,part:"launcher","data-variant":t.variant,"data-size":t.size,"data-edge-tab":o?"true":void 0,"data-leaving":r?"true":void 0,"data-testid":N.launcher,onClick:e,"aria-label":n.launcherOpen,children:[eh(t.icon),a?l("span",{class:`${Ua}-fab-label`,children:bt(n,t.label??"")}):null]})}function eh(e){let t=ep[e];return t?l(t,{}):l(th,{source:e})}function th({source:e}){return l("span",{ref:t=>{t&&nh(t,e)},"aria-hidden":"true"})}function nh(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 np({callout:e,launcherPosition:t,strings:n,closeLabel:r,onDismiss:o}){let[a,i]=H(!1);return D(()=>{let s=setTimeout(()=>i(!0),e.delayMs);return()=>clearTimeout(s)},[e.delayMs]),D(()=>{if(!a||e.autoDismissMs<=0)return;let s=setTimeout(o,e.autoDismissMs);return()=>clearTimeout(s)},[a,e.autoDismissMs,o]),a?l("div",{class:`${Ua}-callout`,role:"status","data-shape":e.shape,"data-position":rh(e.position,t),"data-animated":e.animated?"true":void 0,"data-testid":N.callout,children:[l("span",{children:bt(n,e.text)}),l("button",{type:"button",class:`${Ua}-callout-close`,onClick:o,"aria-label":r,title:r,"data-testid":N.calloutDismiss,children:l(Bt,{})})]}):null}function rh(e,t){let n=t.endsWith("-right"),r=t.startsWith("bottom-");return e==="vertical"?r?"top":"bottom":n?"left":"right"}var oh='a[href],button:not([disabled]),textarea:not([disabled]),input:not([disabled]):not([type="hidden"]),select:not([disabled]),[tabindex]:not([tabindex="-1"])';function Ha(e){function t(n){if(n.key!=="Tab")return;let r=[...e.querySelectorAll(oh)].filter(s=>s.offsetParent!==null||s===document.activeElement);if(r.length===0){n.preventDefault();return}let o=r[0],a=r[r.length-1];if(!o||!a)return;let i=e.getRootNode().activeElement;n.shiftKey&&i===o?(n.preventDefault(),a.focus()):!n.shiftKey&&i===a&&(n.preventDefault(),o.focus())}return e.addEventListener("keydown",t),()=>e.removeEventListener("keydown",t)}var xn=A.cssPrefix;function qa({title:e,actions:t}){return l("header",{class:`${xn}-back-header`,part:"header","data-variant":"title",children:[l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"}),l("h1",{class:`${xn}-back-title`,children:e}),t??l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"})]})}function za({title:e,backLabel:t,onBack:n,actions:r,testid:o}){return l("header",{class:`${xn}-back-header`,part:"header","data-testid":o,children:[l("button",{type:"button",class:`${xn}-icon-btn`,onClick:n,"aria-label":t,title:t,children:l(lo,{})}),l("h1",{class:`${xn}-back-title`,children:e}),r??l("span",{class:`${xn}-back-spacer`,"aria-hidden":"true"})]})}function hr({textSig:e,doneSig:t,generativeUi:n=!1,strings:r=qo}){let o=F(null);return Tt(()=>{let a=o.current;if(!a)return;a.classList.add(`${A.cssPrefix}-md`),a.replaceChildren();let i=n?As(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=lr(i??Qr(a)),c=0,p=jt(()=>{let u=e.value,f=t.value;u.length<c&&(i?.dispose(),a.replaceChildren(),i=n?As(a,{cssPrefix:A.cssPrefix,strings:r}):void 0,s=lr(i??Qr(a)),c=0);let m=u.slice(c);m&&Xe(s,m),c=u.length,f&&(Kr(s),i?.finish())}),_=new MutationObserver(()=>rp(a));_.observe(a,{childList:!0,subtree:!0}),rp(a);function d(u){let f=u.target?.closest?.("a");if(!f||!(f instanceof HTMLAnchorElement))return;let m=f.getAttribute("href")??"";!m||m.startsWith("#")||(u.preventDefault(),window.open(m,"_blank","noopener,noreferrer"))}return a.addEventListener("click",d),()=>{p(),i?.dispose(),_.disconnect(),a.removeEventListener("click",d)}},[e,t,n,r]),l("div",{ref:o})}function ap({text:e}){let t=ue(()=>se(e),[e]),n=ue(()=>se(!0),[]);return l(hr,{textSig:t,doneSig:n})}var mh=/<(\/?)(?:(Note|Info|Tip|Warning|Danger|Check|Callout)|Tabs?|Steps?|AccordionGroup|Accordion|Expandable|Columns|CardGroup|Card|Frame|CodeGroup|Badge|Icon|Video|Embed|ParamField|ResponseField)\b((?:"[^"]*"|'[^']*'|[^>"'])*?)(\/?)>|(^|\n)([ \t]*)(```[^]*?(?:\n[ \t]*```|$))?/g;function ip(e){let t=0,n="";return e.replace(mh,(r,o,a,i,s,c,p,_)=>{if(o===void 0)return t?c+(_?.split(`
58
58
  ${p}`).join(`
59
59
  `)??n):r;if(o)return t--,a&&(n=n.slice(2)),a?`
60
- ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,v,S,P)=>d[v]=P);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
- ${n}`:"")})}function rp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var op=new Set([11,12,13,14,15,16,17,18,19,31]);function ja(e){let t="",n=[],r=sr({data:void 0,add_token:(o,a)=>{n.push(a),op.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!op.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return Xe(r,e),Kr(r),t.replace(/\s+/g," ").trim()}var sp=A.cssPrefix;function Ot({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${sp}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${sp}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var xn=A.cssPrefix,mv=ne.scope("content"),gv=5e3;function lp({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=H(null),[p,_]=H(!1),[d,u]=H(!1),[f,m]=H(0),[v,S]=H(null),P=$(()=>{u(!1),c(null),m(g=>g+1)},[]);D(()=>{let g=!1,k=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),k]).then(([w,T])=>{if(g)return;let E=w.items[0];E?(c(E),_(T?.items.find(M=>M.id===E.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:E.contentCollectionId})):u(!0)}).catch(w=>{g||(mv.warn("listContent (reader) failed",{err:w}),u(!0))}),()=>{g=!0}},[n,e,f,o]),D(()=>{if(!s)return;let g=setTimeout(()=>o.emit("contentRead",{contentId:e}),gv);return()=>clearTimeout(g)},[s,e,o]);let y=$(g=>{let w=g.target?.closest?.("a")?.getAttribute("href")??"";w&&!w.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function C(g){S(e),n.setContentVote({contentId:e,value:g})}function h(){return d?l(Ot,{tone:"error",message:r.errorGeneric,onRetry:P,strings:r}):s===null?l(Ot,{message:r.contentLoading,strings:r}):l("article",{class:`${xn}-content`,"data-testid":N.contentView,onClick:y,children:[s.image?l("img",{class:`${xn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${xn}-content-subtitle`,children:s.description}):null,l(ap,{text:ip(s.content??"")}),p?l("div",{class:`${xn}-content-vote`,"aria-live":"polite",children:v===e?r.feedbackThanks:l(de,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${xn}-module-retry`,onClick:()=>C(1),children:r.confirmYes}),l("button",{type:"button",class:`${xn}-module-retry`,onClick:()=>C(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${xn}-module`,children:[l(za,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:N.backHeader}),l("div",{class:`${xn}-module-scroll`,"data-testid":N.contentScroll,children:h()})]})}function cp({itemCount:e,initialFocusIndex:t}){let[n,r]=H(!1),o=F(null),a=F(null),[i,s]=H(-1),c=$(()=>{r(!1),s(-1),o.current?.focus()},[]),p=$(()=>r(u=>!u),[]);D(()=>{if(!n)return;function u(f){let m=a.current,v=o.current;if(!m||!v)return;let S=f.composedPath();S.includes(m)||S.includes(v)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),D(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),D(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=$(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=$(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:_,onMenuKey:d}}function up({items:e,triggerLabel:t}){let n=A.cssPrefix,r=cp({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let _=Math.max(0,p.findIndex(u=>u.value===c.value)),d=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")d=(_+1)%p.length;else if(s.key==="ArrowLeft")d=(_-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[d].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(Dd,{})}),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=>i(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 p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${N.langSegment}-${c.value}`,onClick:()=>a(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(Hn,{})}):null]},s.id))}):null]})}var Qs=A.cssPrefix;function hv(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?rr()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var vv={normal:"large",large:"small",small:"normal"};function bv(e){return e==="light"?l(Gd,{}):e==="dark"?l(Kd,{}):l(Qd,{})}function yv(e){return(e.split("-")[0]??e).toUpperCase()}function Pv(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 Qt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:_,onLocaleChange:d,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,v=n.mode,S=t==="chat",P=Rt(()=>o.mutedSig.value).value,y=new Set(n.actions);function C(K){return y.has(K)}let h=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(K){return h?!1:pr(K,v,r)}let k=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},T=n.textSize,E={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},M=[];if(S&&C("clear")&&M.push({id:"clear",icon:l(jd,{}),label:m.newConversation,onSelect:i}),C("expand")&&g("expand")){let K=r==="expanded";M.push({id:"expand",icon:K?l(Md,{}):l(Ad,{}),label:K?m.collapse:m.expand,type:"switch",on:K,onSelect:s})}if(C("fullscreen")&&g("fullscreen")){let K=r==="fullscreen";M.push({id:"fullscreen",icon:K?l(Ld,{}):l(Nd,{}),label:K?m.exitFullscreen:m.fullscreen,type:"switch",on:K,onSelect:c})}let L=n.popOutUrl,O=n.aiAgentDeploymentId;C("popOut")&&L&&O&&pr("popOut",v,r)&&M.push({id:"popOut",icon:l(Od,{}),label:m.popOut,onSelect:()=>{let K=Pv(L,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:O});K&&window.open(K,"_blank","noopener,noreferrer")}}),S&&C("sound")&&M.push({id:"sound",icon:P?l(Bd,{}):l(Fd,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:p}),C("theme")&&M.push({id:"theme",icon:bv(k),label:`${m.theme}: ${w[k]}`,onSelect:()=>u(hv(k)),keepOpen:!0}),C("textSize")&&M.push({id:"textSize",icon:l(Ud,{}),label:`${m.textSize}: ${E[T]}`,onSelect:()=>f(vv[T]),keepOpen:!0}),C("language")&&n.availableLocales.length>1&&M.push({id:"language",icon:l(zd,{}),label:m.language,segments:n.availableLocales.map(K=>({value:K,label:yv(K),lang:K})),value:n.locale,onSelectValue:d});let z=!!a&&Oa(v,r,n.actions),V=S&&C("history");return l("div",{class:`${Qs}-header-actions`,children:[V?l("button",{type:"button",class:`${Qs}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":N.actionHistory,children:l(qd,{})}):null,M.length>0?l(up,{items:M,triggerLabel:m.moreActions}):null,z?l("button",{type:"button",class:`${Qs}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":N.actionClose,children:l(Bt,{})}):null]})}var dp={Icon:uo};function qn(e,t){return e instanceof ct&&e.status===429?t.errorRateLimited:t.errorGeneric}var br=A.cssPrefix;function pp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${br}-home-search`,onClick:t,"data-testid":N.homeSearch,children:[l("span",{class:`${br}-home-search-text`,children:e}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(Ks,{})})]})}function _p({placeholder:e,value:t,onInput:n}){return l("div",{class:`${br}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${br}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":N.helpSearch}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(Ks,{})})]})}var po=A.cssPrefix;function Va({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${po}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${po}-list-row-body`,children:[l("span",{class:`${po}-list-row-title`,children:e}),t?l("span",{class:`${po}-list-row-sub`,children:t}):null]}),l("span",{class:`${po}-list-row-chevron`,"aria-hidden":"true",children:l(mr,{})})]})}var Xt=A.cssPrefix,xv=ne.scope("help"),Sv=20,kv=300;function wv(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function fp({transport:e,strings:t,bus:n},r,o){let[a,i]=H(),s=F(void 0);function c(p){if(!r?.length)return;let _={};s.current=_,i(d=>({search:o,items:[],collections:[],...d,pagination:p>1?d?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:Sv,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([d,u])=>{s.current===_&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],...d.items],collections:u?.items??f?.collections??[],pagination:d.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:d.pagination.total}):n.emit("contentView",{section:"help",count:d.items.length})))}).catch(d=>{s.current===_&&(xv.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:qn(d,t)}))})}return D(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function Cv(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=H(""),[c,p]=H(""),_=fp(e,a),d=fp(e,c?a:void 0,c),[u,f]=i.trim()?d:_;D(()=>{let v=setTimeout(()=>p(i.trim()),kv);return()=>clearTimeout(v)},[i]);function m(){if(!a?.length)return l(Ot,{message:t.helpEmpty,strings:t});let v=u?.error?l(Ot,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return v&&!u?.pagination?v:!u||!u.pagination&&!u.items.length?l(Ot,{message:t.helpLoading,strings:t}):u.items.length?l(de,{children:[wv(u.items,a,u.collections).map(S=>l("section",{class:`${Xt}-help-group`,children:[S.title?l("h2",{class:`${Xt}-help-section-title`,children:S.title}):null,l("div",{class:`${Xt}-help-card`,children:S.rows.map(P=>l(Va,{title:P.title,subtitle:P.description,onClick:()=>r.push(P.url?{kind:"iframe",url:P.url,title:P.title}:{kind:"content",id:P.id,title:P.title}),testid:ut(N.helpArticle,P.id)},P.id))})]},S.id)),v,u.pagination?.hasNext&&!v?l("div",{children:l("div",{class:`${Xt}-help-card`,children:l("button",{type:"button",class:`${Xt}-list-row ${Xt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Xt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Ot,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Xt}-module`,children:[l(qa,{title:t.helpTitle,actions:l(Qt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Xt}-module-pad`,children:l(_p,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Xt}-help-list`,children:m()})]})}var mp={Icon:co,Root:e=>l(Cv,{...e})};var gp=ne.scope("attachments");function Wa(e,t,n){let r=Rv(e),o=[],a=[],i=Av(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=Tv(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(Ev(p)),s+=p.size,c+=1}return(o.length||a.length)&&gp.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function yr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){gp.debug("revokeObjectURL failed",{error:t})}}function Tv(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Mv(e,o)?null:"mime"}function Rv(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Iv(t)).filter(t=>t!==null):[]}function Iv(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Ev(e){return{file:e,id:Ct(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function Av(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 Mv(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var _o=A.cssPrefix;function hp({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${_o}-attachment-chip`,title:e.name,"data-testid":ut(N.attachmentChip,e.id),children:[r?l("img",{class:`${_o}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${_o}-attachment-thumb`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${_o}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${_o}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":ut(N.attachmentRemove,e.id),children:l(Bt,{})})]})}var Xs={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Js(e,t,n){return e==="disabled"?Xs:e==="server"?$v(n):Nv(t)}function Nv(e){let t=Lv();if(!t)return Xs;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",d=>{if(r!==s||n!==c)return;let u=d,f="",m=!1;for(let v=u.resultIndex;v<u.results.length;v++){let S=u.results[v];S&&(f+=S[0].transcript,S.isFinal&&(m=!0))}o(f,m)});function _(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function Lv(){return window.SpeechRecognition??window.webkitSpeechRecognition}var Ov=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function $v(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Xs;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let _=Dv(),d=new MediaRecorder(p,_?{mimeType:_}:void 0);c.recorder=d,d.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),d.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),d.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function Dv(){for(let e of Ov)if(MediaRecorder.isTypeSupported(e))return e}var Ye=A.cssPrefix,Pr=ne.scope("composer");function xr(e){return e.reduce((t,n)=>t+n.size,0)}var Ys={arrowUp:Cd,paperPlane:wd,send:Td,chevron:mr};function vp(e){return"activeElement"in e}function Fv(e){return"host"in e&&"activeElement"in e}function bp({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,pageToolRunning:s=!1,isMemoryCompacting:c=!1,canReleaseQueuedMessages:p=!0,queueManualMessages:_=!1,active:d=!0,isPreparing:u=!1,operatorRequestEnabled:f,canRequestOperator:m=!1,controlMode:v="ai-agent",onRequestOperator:S,onSend:P,onStop:y,apiRef:C}){let h=e.strings,[g,k]=H(()=>o.loadDraft(a)),[w,T]=H([]),[E,M]=H(()=>o.loadMessageQueue(a).map(B=>({id:B.id,text:B.text,attachments:[]}))),L=F(E),O=F(!1),[z,V]=H(!1),[K,te]=H(!1),G=F(!1),Y=F(null),De=F(null),_e=F(null),Te=F(0),et=F(a);et.current=a;let Ue=F(d);Ue.current=d;let gt=F(u);gt.current=u;let Ge=K||u||!d,ht=i&&v==="ai-agent",dt=ht||c&&v==="ai-agent",St=v==="ai-agent"&&(dt||_||E.length>0),kt=$(B=>{M(Q=>{let ee=B(Q);return o.saveMessageQueue(et.current,ee.filter(me=>me.attachments.length===0).map(({id:me,text:it})=>({id:me,text:it}))),L.current=ee,ee})},[o]),Ee=$(B=>{kt(Q=>(Q.find(ee=>ee.id===B)?.attachments.forEach(yr),Q.filter(ee=>ee.id!==B)))},[kt]),He=$(B=>{k(Q=>{let ee=typeof B=="function"?B(Q):B;return ee===Q?Q:(o.saveDraft(et.current,ee),ee)})},[o]),ye=e.features.fileUpload,ot=e.features.voice,[ve,vt]=H(()=>Js(ot,e.locale,(B,Q)=>t.transcribe(B,Q))),Ke=F(ve);Ke.current=ve;let $t=F({mode:ot,locale:e.locale,transport:t});D(()=>{let B=$t.current;B.mode===ot&&B.locale===e.locale&&B.transport===t||($t.current={mode:ot,locale:e.locale,transport:t},Te.current++,Ke.current.cancel(),_e.current=null,V(!1),vt(Js(ot,e.locale,(Q,ee)=>t.transcribe(Q,ee))))},[e.locale,ot,t]),Tt(()=>()=>{Te.current++,ve.cancel()},[ve]);let b=$(B=>{let Q=_e.current;if(Q===null)return!1;let ee=Math.round(performance.now()-Q);return Pr[B]("voiceStop",{durationMs:ee}),r.emit("voiceStop",{durationMs:ee}),_e.current=null,!0},[r]),U=$(()=>{_e.current!==null&&(ve.stop(),V(!1),b("info")&&n.play("voiceStop"))},[b,n,ve]),J=$(()=>{Te.current++,ve.cancel(),V(!1),b("info")&&n.play("voiceStop")},[b,n,ve]);D(()=>{(u||!d)&&J()},[d,J,u]),D(()=>{let B=Y.current;if(!B)return;let Q=B.getRootNode(),ee=vp(Q)?Q.activeElement:null;ee&&B.closest(`.${Ye}-panel`)?.contains(ee)||B.focus({preventScroll:!0})},[]),D(()=>{let B=Y.current;if(!B)return;if(g.length===0){B.style.height="";return}B.style.height="auto";let Q=getComputedStyle(B),ee=Number.parseFloat(Q.getPropertyValue(`--${Ye}-textarea-base-height`)),me=Number.parseFloat(Q.borderTopWidth)+Number.parseFloat(Q.borderBottomWidth),it=Math.min(B.scrollHeight+me,Number.parseFloat(Q.maxHeight)),zt=Number.parseFloat(Q.fontSize)*.7;B.style.height=`${it<ee+zt?ee:it}px`},[g]);let Z=F(w);Z.current=w,D(()=>()=>{Z.current.forEach(yr);for(let B of L.current)B.attachments.forEach(yr)},[]),Tt(()=>{if(C)return C.current={attachFromDrop:B=>{if(!ye||!Ue.current||G.current||gt.current)return;let Q=Wa(B,Z.current,e.attachments);Q.accepted.length!==0&&(Pr.info("attach (drop)",{count:Q.accepted.length,totalBytes:xr(Q.accepted)}),r.emit("attach",{count:Q.accepted.length,totalBytes:xr(Q.accepted)}),T(ee=>[...ee,...Q.accepted]))},fill:B=>{if(!Ue.current||G.current||gt.current)return;He(B);let Q=Y.current;Q&&(Q.focus({preventScroll:!0}),requestAnimationFrame(()=>Q.setSelectionRange(Q.value.length,Q.value.length)))},acceptQueuedMessage:Ee},()=>{C.current&&(C.current=null)}},[C,ye,u,e.attachments,Ee,He]),D(()=>{let B=Y.current;if(!B)return;let Q=B.closest(`.${Ye}-panel`);if(!Q)return;let ee=me=>{if(!Ue.current||G.current||gt.current)return;let it=me.clipboardData;if(!it)return;let zt=me.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(zt&&zt!==B)return;if(ye){let Et=Wa(it.items,Z.current,e.attachments);if(Et.accepted.length>0){me.preventDefault(),Pr.info("attach (paste)",{count:Et.accepted.length,totalBytes:xr(Et.accepted)}),r.emit("attach",{count:Et.accepted.length,totalBytes:xr(Et.accepted)}),T(le=>[...le,...Et.accepted]);return}}if(zt===B)return;let Yt=it.getData("text/plain");Yt&&(me.preventDefault(),He(Et=>Et+Yt),B.focus())};return Q.addEventListener("paste",ee),()=>Q.removeEventListener("paste",ee)},[ye,e.attachments,He]);async function ae(){let B=g.trim();if(!B&&w.length===0||!d||ht||G.current||u)return;J(),G.current=!0,te(!0);let Q=g,ee=w;try{await P(B,ee)&&(He(me=>me===Q?"":me),T(me=>me!==ee?me:(ee.forEach(yr),Z.current=[],[])))}finally{G.current=!1,te(!1),requestAnimationFrame(()=>{let me=Y.current;if(!me||me.disabled||!Ue.current)return;let it=me.getRootNode(),zt=vp(it)?it.activeElement:null,Yt=zt?.getAttribute("data-testid");if(!(zt&&zt!==me&&Yt!==N.composerSend&&Yt!==N.composerStop)){if(Fv(it)){let Et=it.host.ownerDocument;if(!Et.hasFocus())return;let le=Et.activeElement;if(le&&le!==it.host&&le!==Et.body)return}me.focus({preventScroll:!0})}})}}function Re(){let B=g.trim();if(!B&&w.length===0||!d||!St||G.current||u)return;J();let Q=w;kt(ee=>[...ee,{id:Ct(),text:B,attachments:Q}]),He(""),T(ee=>ee!==Q?ee:(Z.current=[],[])),Y.current?.focus({preventScroll:!0})}D(()=>{dt&&(O.current=!1)},[dt]),D(()=>{let B=E[0];if(!B||!p||dt||O.current||K||u||!d)return;let Q=setTimeout(()=>{O.current=!0,P(B.text,B.attachments,B.id).then(ee=>{if(ee){Ee(B.id);return}O.current=!1})},300);return()=>clearTimeout(Q)},[d,p,u,P,dt,E,Ee,K]);function Pe(B){B.key!=="Enter"||B.shiftKey||B.isComposing||(B.preventDefault(),St&&(g.trim()||w.length>0)?Re():ht?y():ae())}function he(B){let Q=B.target;if(!d||G.current||u){Q.value="";return}let ee=Wa(Q.files,w,e.attachments);ee.accepted.length>0&&(Pr.info("attach (file picker)",{count:ee.accepted.length,totalBytes:xr(ee.accepted)}),r.emit("attach",{count:ee.accepted.length,totalBytes:xr(ee.accepted)}),T(me=>[...me,...ee.accepted])),Q.value=""}function _t(B){!d||G.current||u||(Pr.info("removeAttachment",{id:B}),r.emit("removeAttachment",{id:B}),T(Q=>{let ee=Q.find(me=>me.id===B);return ee&&yr(ee),Q.filter(me=>me.id!==B)}))}function fe(){if(z){U();return}if(!d||!ve.isSupported||G.current||u)return;let B=++Te.current;_e.current=performance.now(),Pr.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),ve.start((Q,ee)=>{Te.current!==B||!Ue.current||gt.current||G.current||!ee||He(me=>`${me}${Q} `)},()=>{Te.current!==B||!Ue.current||(V(!1),b("debug"))})}let at=Ys[e.composer.sendButton.icon],qe=!!(g.trim()||w.length>0),qt=ht||s&&!qe;return l("div",{class:`${Ye}-composer`,part:"composer","data-testid":N.composer,children:[E.length>0?l("div",{class:`${Ye}-message-queue`,"aria-label":h.queueMessage,"data-testid":N.messageQueue,children:E.map(B=>l("div",{class:`${Ye}-attachment-chip ${Ye}-queued-message`,"data-testid":`${N.queuedMessage}-${B.id}`,children:[l("span",{class:`${Ye}-attachment-name ${Ye}-queued-text`,children:B.text||B.attachments.map(Q=>Q.name).join(", ")}),l("button",{type:"button",class:`${Ye}-attachment-remove`,onClick:()=>Ee(B.id),"aria-label":h.removeQueuedMessage,title:h.removeQueuedMessage,"data-testid":`${N.queuedMessageRemove}-${B.id}`,children:l(Bt,{})})]},B.id))}):null,w.length>0?l("div",{class:`${Ye}-attachments`,children:w.map(B=>l(hp,{attachment:B,onRemove:()=>_t(B.id),disabled:Ge},B.id))}):null,l("div",{class:`${Ye}-composer-row`,children:[l("div",{class:`${Ye}-composer-actions`,children:[ye?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:()=>De.current?.click(),disabled:Ge,"aria-label":h.attach,"data-testid":N.composerAttach,children:l(Id,{})}):null,ve.isSupported?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:fe,disabled:Ge,"aria-label":z?h.micStop:h.micStart,"aria-pressed":z,"data-recording":z?"true":void 0,"data-testid":N.composerVoice,children:l(Ed,{})}):null]}),l("textarea",{ref:Y,name:"message",class:`${Ye}-textarea`,rows:1,value:g,placeholder:h.composerPlaceholder,onInput:B=>He(B.currentTarget.value),onKeyDown:Pe,disabled:Ge,"aria-label":h.composerPlaceholder,"data-testid":N.composerInput}),St&&qe?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:Re,disabled:Ge,"aria-label":h.queueMessage,title:h.queueMessage,"data-testid":N.composerSend,children:l(at,{})}):null,qt?l("button",{type:"button",class:`${Ye}-send`,onClick:y,disabled:Ge,"aria-label":h.stop,"data-testid":N.composerStop,children:l(Rd,{})}):null,!qt&&(!St||!qe)?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ae()},disabled:Ge||!g.trim()&&w.length===0,"aria-label":h.send,"data-testid":N.composerSend,children:l(at,{})}):null,f&&v==="ai-agent"&&S?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:S,disabled:Ge||!m,"aria-label":h.talkToOperator,title:h.talkToOperator,"data-testid":N.operatorRequest,children:l(Gs,{})}):null]}),l("input",{ref:De,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:he,disabled:Ge,class:`${Ye}-sr-only`,"data-testid":N.composerFileInput})]})}var yp=A.cssPrefix;function Ga({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${yp}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${yp}-home-card`,"data-testid":n,children:t})}function Ka(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ut=A.cssPrefix,Bv=ne.scope("news"),Uv=10;function Zs(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function Hv({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=H({items:[],loading:!0}),d=F(void 0);function u(S){if(!c?.length)return;let P={};d.current=P,_(y=>({...y,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:S,limit:Uv}).then(y=>{if(d.current!==P||(_(h=>({items:S>1?[...h.items,...y.items]:y.items,pagination:y.pagination,loading:!1})),S>1))return;a.emit("contentView",{section:"news",count:y.items.length});let C=y.items[0];C&&s.markSeen(C.id)}).catch(y=>{d.current===P&&(Bv.warn("listContent (news) failed",{err:y,page:S}),_(C=>({...C,loading:!1,error:qn(y,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}D(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(S){let P=Zs(S.publishedAt,e.locale);return l("button",{type:"button",class:`${Ut}-news-card`,onClick:()=>o.push({kind:"content",id:S.id,title:S.title}),"data-testid":ut(N.newsItem,S.id),children:[S.image?l("img",{class:`${Ut}-news-hero`,src:S.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ut}-news-body`,children:[l("span",{class:`${Ut}-news-title`,children:S.title}),P||S.tags?.length?l("span",{class:`${Ut}-news-meta`,children:[P?l("time",{dateTime:S.publishedAt,children:P}):null,S.tags?.map(y=>l("span",{class:`${Ut}-news-tag`,children:y},y))]}):null,S.description?l("span",{class:`${Ut}-news-summary`,children:S.description}):null]})]},S.id)}function v(){if(!c?.length)return l(Ot,{message:n.newsEmpty,strings:n});let S=p.error?l(Ot,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return S&&!p.pagination?S:p.pagination?p.items.length?l("div",{class:`${Ut}-news-list`,children:[p.items.map(m),S,p.pagination.hasNext&&!S?l("button",{type:"button",class:`${Ut}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":N.newsMore,children:[p.loading?l("span",{class:`${Ut}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Ot,{message:n.newsEmpty,strings:n}):l(Ot,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ut}-module`,children:[l(qa,{title:n.newsTitle,actions:l(Qt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ut}-module-scroll`,children:v()})]})}var Pp={Icon:Fa,Root:e=>l(Hv,{...e})};var ge=A.cssPrefix,xp=ne.scope("home");function qv(e){let t=e.options.userContext?.name,n=e.config.greetingText?bt(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return 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 jv({options:e,onAsk:t}){let[n,r]=H(""),{sendButton:o}=e.composer,a=Ys[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ge}-home-search ${ge}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":N.homeAsk,children:[l("input",{type:"text",class:`${ge}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${ge}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function Sp(e,t){return sn(e,t,t.type!=="upsert"||t.activity===!0)}function Vv(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=H(null),[_,d]=H([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(g=>g.layout==="chat");D(()=>{if(r.showRecentConversations===!1)return;let g=!1,k=!0,w=[],T=t.subscribeConversationChanges(E=>{k&&w.push(E),p(M=>Sp(M?[M]:[],E)[0]??null)});return t.listConversations({limit:f?50:1}).then(E=>{if(g)return;let M=w.reduce(Sp,E.conversations);w=[],k=!1,p(M[0]??null)}).catch(E=>{g||(w=[],k=!1,xp.warn("listConversations (home) failed",{err:E}))}),()=>{g=!0,T()}},[t,r.showRecentConversations,f]),D(()=>{if(!r.contentCollectionIds?.length)return;let g=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(k=>{g||(d(k.items),a.emit("contentView",{section:"home",count:k.items.length}))}).catch(k=>!g&&xp.warn("listContent (home) failed",{err:k})),()=>{g=!0}},[t,u,a]);let m=qv(e),v=r.userAvatars??[],S=r.status,P=S?.text?bt(n,S.text):n.homeStatus,y=r.contentBlockTitle?bt(n,r.contentBlockTitle):n.homeContentTitle,C=s.item,h=Zs(C?.publishedAt,e.options.locale);return l("div",{class:`${ge}-module ${ge}-home`,"data-testid":N.homeView,children:l("div",{class:`${ge}-home-scroll`,children:[l("div",{class:`${ge}-home-hero`,children:[l("div",{class:`${ge}-home-hero-top`,children:[r.brandName?l("span",{class:`${ge}-home-brand`,"data-testid":N.homeBrand,children:r.brandName}):l("span",{class:`${ge}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ge}-home-hero-actions`,children:[v.length>0?l("div",{class:`${ge}-home-avatars`,children:v.map(g=>l("span",{class:`${ge}-home-avatar`,title:g.role?`${g.name} \xB7 ${g.role}`:g.name,children:g.avatar?l("img",{src:g.avatar,alt:"",loading:"lazy"}):l("span",{children:Ka(g.name)})},g.name))}):null,l(Qt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(de,{children:[l("h1",{class:`${ge}-home-greeting`,"data-testid":N.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ge}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ge}-home-cards`,children:[f?l(jv,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(pp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,C?l(Ga,{onClick:()=>{s.markSeen(C.id),o.push({kind:"content",id:C.id,title:C.title})},testid:N.homeWhatsNew,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(Fa,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ge}-home-recent-preview`,children:h?`${C.title} \xB7 ${h}`:C.title})]}),s.unseen?l("span",{class:`${ge}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(Ga,{onClick:()=>o.selectConversation(c),testid:N.homeRecent,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(uo,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ge}-home-recent-preview`,children:ja(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ge}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,S?l(Ga,{onClick:S.url?()=>o.push({kind:"iframe",url:S.url,title:P}):void 0,children:l("div",{class:`${ge}-home-status`,"data-level":S.level??"operational",children:[l("span",{class:`${ge}-home-status-icon`,"aria-hidden":"true",children:l(Vd,{})}),l("span",{class:`${ge}-home-status-text`,children:P})]})}):null,_.length>0?l("section",{class:`${ge}-home-content`,children:[l("div",{class:`${ge}-home-content-title`,children:y}),l("div",{class:`${ge}-home-content-list`,children:_.map(g=>l(Va,{title:g.title,subtitle:g.description,onClick:()=>zv(o,g),testid:ut(N.homeContentRow,g.id)},g.id))})]}):null]})]})})}var kp={Icon:Wd,Root:e=>l(Vv,{...e})};var Qa={chat:dp,home:kp,help:mp,news:Pp};var fo=A.cssPrefix;function wp({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${fo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Qa[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${fo}-tab`,onClick:()=>o(a.id),"data-testid":ut(N.tab,a.id),children:[l("span",{class:`${fo}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${fo}-tab-badge`,"data-testid":N.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${fo}-tab-label`,children:bt(n,a.label)})]},a.id)})})}var Cp=A.cssPrefix,Wv="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Tp({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${Cp}-module`,children:[l(za,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${Cp}-content-frame`,src:e,title:t||"content",sandbox:Wv,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var el=A.cssPrefix;function Rp({agent:e,strings:t}){let n=e.status??"online",r=bt(t,e.name),o=e.title?bt(t,e.title):null;return l("div",{class:`${el}-agent`,children:[l("div",{class:`${el}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:Ka(r)})}),l("div",{class:`${el}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var Gv=["today","yesterday","lastWeek","older"];function Kv(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((Ip(e)-Ip(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function Ep(e,t){let n=new Map;for(let r of t){let o=Kv(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return Gv.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function Ip(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Ap=ne.scope("history"),Qv=3,Xv=6,Jv={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Mp(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=sn(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=sn(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Yv(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 Xa({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=A.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=H(s?"loaded":"loading"),[_,d]=H(s),[u,f]=H(!1),m=F(void 0),v=_?.conversations??[],S=_?.pagination;D(()=>{let g=!1,k=!0,w=[],T=e.subscribeConversationChanges(M=>{k&&w.push(M),d(L=>L&&Mp(L,M))});m.current=void 0,f(!1);let E=e.peekConversations({limit:50});return d(E),p(E?"loaded":"loading"),e.listConversations({limit:50}).then(M=>{if(g)return;let L=M;for(let O of w)L=Mp(L,O);w=[],k=!1,d(L),p("loaded"),r.saveHistoryCount(L.conversations.length)}).catch(M=>{g||(w=[],k=!1,Ap.warn("listConversations failed",{err:M}),p("error"))}),()=>{g=!0,T(),m.current=void 0}},[e,r,n]);async function P(){if(m.current||!S?.hasNext)return;let g={};m.current=g,f(!0);try{let k=await e.listConversations({page:S.page+1,limit:S.limit});if(m.current!==g)return;d(w=>{if(!w)return w;let T=new Set(w.conversations.map(L=>L.conversationId)),E=k.conversations.filter(L=>T.has(L.conversationId)?!1:(T.add(L.conversationId),!0)),M={conversations:[...w.conversations,...E],pagination:k.pagination};return r.saveHistoryCount(M.conversations.length),M})}catch(k){if(m.current!==g)return;Ap.warn("listConversations page failed",{err:k,page:S.page+1})}finally{m.current===g&&(m.current=void 0,f(!1))}}let y=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":N.sidebarNewConversation,children:[l(kd,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Qv,Xv);return l(de,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,g)},(k,w)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},w))})]})}),y]})}if(c==="error"||v.length===0)return l(de,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),y]});let C=Date.now(),h=Ep(C,v);return l(de,{children:[l("div",{class:`${i}-history`,role:"list",children:[h.map(g=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[Jv[g.bucket]]}),l("div",{class:`${i}-history-card`,children:g.conversations.map(k=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(k),"data-closed":k.canContinue?void 0:"true","data-unread":k.hasUnread?"true":void 0,"data-testid":ut(N.historyItem,k.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(Ws,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:k.title}),l("span",{class:`${i}-history-time`,children:Yv(k.lastMessageAt,C,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:k.preview&&ja(k.preview)||(k.canContinue?t.historyContinue:t.conversationClosed)}),k.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},k.conversationId))})]},g.bucket)),S?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:P,disabled:u,"aria-busy":u,"data-testid":N.historyLoadMore,children:t.loadMoreConversations})}):null]}),y]})}var Zv=A.cssPrefix;function Np({visible:e,strings:t}){return e?l("div",{class:`${Zv}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var eb=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,tb=/^https?:\/\/[^\s.]+\.[^\s]+$/i,nb=/^[+]?[\d\s().-]{6,}$/;function Sr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function rb(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function ob(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=rb(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?Sr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?Sr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!eb.test(a))return n.formInvalidEmail;break;case"url":if(!tb.test(a))return n.formInvalidUrl;break;case"tel":if(!nb.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return Sr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return Sr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return Sr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return Sr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function Lp(e,t,n){let r={};for(let o of e){let a=ob(o,t[o.name],n);a&&(r[o.name]=a)}return r}function Op(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 Ne=A.cssPrefix,mo="__other__";function go({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:_,fieldTypeLabels:d,rootTestId:u,submitTestId:f,skipTestId:m}){let[v,S]=H(()=>({...lb(e),...p})),[P,y]=H({}),[C,h]=H({});function g(M){C[M]&&h(L=>({...L,[M]:""}))}function k(M,L){S(O=>({...O,[M]:L})),g(M)}function w(M,L){y(O=>({...O,[M]:L})),g(M)}function T(M){if(M.preventDefault(),c)return;let L=cb(e,v,P),O=Lp(e,L,t);if(Object.keys(O).length>0){h(O);return}r(Op(L))}function E(M){!s||M.key!=="Enter"||M.shiftKey||M.isComposing||!M.target||!("tagName"in M.target)||M.target.tagName!=="TEXTAREA"||T(M)}return l("form",{class:`${Ne}-form`,onSubmit:T,onKeyDown:E,"data-testid":u,noValidate:!0,children:[e.map(M=>l(ab,{field:M,value:v[M.name],otherText:P[M.name]??"",error:C[M.name],disabled:c,typeLabel:d?.[M.name],strings:t,onChange:L=>k(M.name,L),onOtherChange:L=>w(M.name,L)},M.name)),_?null:l("div",{class:`${Ne}-form-actions`,children:[i?l("span",{class:`${Ne}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Ne}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Ne}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function ab({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=ut(N.formField,e.name),_=ib({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Ne}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Ne}-field-head`,children:[l("span",{class:`${Ne}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Ne}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Ne}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${Ne}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Ne}-field-error`,role:"alert",children:r}):null]})}function ib(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===mo?l("input",{class:`${Ne}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${Ne}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(de,{children:[l("select",{class:`${Ne}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:mo,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${Ne}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${Ne}-choice`,children:[l("input",{type:"radio",name:`${Ne}-${t.name}`,checked:p===mo,disabled:o,onChange:()=>i(mo)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(v,S){return i(S?[...f,v]:f.filter(P=>P!==v))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${Ne}-field-choices`,"data-testid":c,children:[(t.options??[]).map(v=>l("label",{class:`${Ne}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(v.value),disabled:o,onChange:S=>m(v.value,S.currentTarget.checked)}),l("span",{children:v.label??v.value})]},v.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Ne}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:v=>s(v.currentTarget.value)}):null]})}default:return l("input",{...sb(t.type),class:`${Ne}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function sb(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 lb(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 cb(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===mo)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var Jt=A.cssPrefix;function tl({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Jt}-form-gate`,"data-testid":N.formGate,children:[e.title?l("h3",{class:`${Jt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Jt}-form-gate-desc`,children:e.description}):null,l(go,{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:N.formSubmit,skipTestId:N.formSkip})]})}function $p({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(de,{children:[l("span",{children:e.title}),l("span",{class:`${Jt}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(_){return e.form?.fields.find(d=>d.name===_)?.label??_};var c=p;return l("details",{class:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,children:[l("summary",{class:`${Jt}-form-done-summary`,"data-testid":N.formDoneToggle,children:[l(Hn,{}),a,l(mr,{})]}),l("dl",{class:`${Jt}-form-answers`,"data-testid":N.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Jt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,role:"status",children:[r?l(Hd,{}):l(Hn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Jt}-form-done-fill`,"data-testid":N.formFill,onClick:n,children:t.formFillOut}):null]})}var Dp=Object.assign;function pb(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 _b=/^(-|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|asp|fill|st)/;function Up(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:pb(this.props,o)}function r(o){return this.shouldComponentUpdate=n,gn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var fb=Symbol.for("react.element"),mb=/^(?: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]/,gb=/[A-Z0-9]/g,hb=typeof document<"u";var vb=function(e){return/fil|che|rad/.test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Fp=pe.event;pe.event=function(e){return Fp&&(e=Fp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var bb={configurable:!0,get:function(){return this.class}},Bp=pe.vnode;pe.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||hb&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var _=void 0;for(var d in p)typeof p[d]!="number"||_b.test(d)||(_||(_=p=Dp({},p)),p[d]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||vb(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&mb.test(c)?c=c.replace(gb,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Ho(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=Ho(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",bb)):o.className&&(i.class=i.className=o.className),r.props=i})(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=Dp({},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=fb,Bp&&Bp(e)};var Ja=A.cssPrefix;function Hp({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=H(t);D(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${Ja}-feedback`,role:"group","data-testid":N.messageFeedback,children:[l("button",{type:"button",class:`${Ja}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":N.feedbackUp,children:l(Jd,{})}),l("button",{type:"button",class:`${Ja}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":N.feedbackDown,children:l(Yd,{})}),l("span",{class:`${Ja}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var yb=new Set(["hidden","submit","button","reset","image","file","password"]);function zp(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function Pb(e){return!zp(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&yb.has(e.type))}function xb(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function Sb(e,t){let n=xb(e),r=n?{description:n}:{};return e instanceof HTMLSelectElement?{...r,type:"string",enum:[...e.options].map(o=>o.value)}:e instanceof HTMLTextAreaElement?{...r,type:"string"}:e.type==="checkbox"?{...r,type:"boolean"}:e.type==="radio"?{...r,type:"string",enum:t}:e.type==="number"||e.type==="range"?{...r,type:"number"}:{...r,type:"string"}}function kb(e,t){Object.getOwnPropertyDescriptor(Reflect.getPrototypeOf(e)??e,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function qp(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function wb(e,t){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked!==(t===!0||t==="true")&&e.click();return}if(e instanceof HTMLInputElement&&e.type==="radio"){e.value===qp(t)&&!e.checked&&e.click();return}kb(e,qp(t))}function Cb(e,t,n){var i;let r=[...e.elements].filter(Pb),o={},a=new Set;for(let s of r){let c=r.flatMap(p=>p instanceof HTMLInputElement&&p.type==="radio"&&p.name===s.name?[p.value]:[]);o[i=s.name]??(o[i]=Sb(s,c)),s.required&&a.add(s.name)}return{name:t,description:n,inputSchema:{type:"object",properties:o,...a.size>0?{required:[...a]}:{}},execute(s){let c=typeof s=="object"&&s!==null?Object.entries(s):[];for(let[_,d]of c)for(let u of r)u.name===_&&wb(u,d);if(!e.hasAttribute("toolautosubmit"))return"Filled in the form. The visitor still needs to check it and press its submit button.";let p=[...new Set([...e.elements].flatMap(_=>zp(_)&&_.name&&!_.checkValidity()?[_.name]:[]))];return p.length>0?`Filled in the form, but it can't be submitted yet: ${p.join(", ")} still needs the visitor. Ask them to complete it and press the submit button.`:(setTimeout(()=>e.requestSubmit(),0),"Filled in the form and submitted it.")}}}function jp(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[Cb(e,t,n)]:[]})}var Vp=`${A.cssPrefix}.page-tools`,Tb=20,Rb=50;function Ya(e){return typeof e=="object"&&e!==null}function Ib(e){return Ya(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Ya(e.outcome))}function Eb(e){let t=e?JSON.parse(e):void 0;if(!Ya(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Ya(t.calls)?t.calls:{}).filter(o=>Ib(o[1])));return{sent:n,calls:r}}var rl={sent:[],calls:{}};function ho(){try{rl=Eb(sessionStorage.getItem(Vp))}catch{}return rl}function nl(e){rl=e;try{sessionStorage.setItem(Vp,JSON.stringify(e))}catch{}}var It={markSent(e){let t=ho();nl({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-Tb)})},sentHere(e){return ho().sent.includes(e)},get(e){return ho().calls[e]},set(e,t){let n=ho(),r=Object.entries(n.calls).filter(([o])=>o!==e);nl({...n,calls:Object.fromEntries([...r,[e,t]].slice(-Rb))})},clear(e){let t=ho();e.some(n=>n in t.calls)&&nl({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};var Xp=ne.scope("page-tools"),Wp="site__",Gp=3e4,Ab=1e3,Kp=Symbol.for(`${A.cssPrefix}.page-tools`),al={state:"output-error",errorText:"The page reloaded before this finished, so it may or may not have taken effect. Check with the visitor before trying it again."},Jp="The visitor stopped this before it finished.";function Sn(e){return typeof e=="object"&&e!==null}function Mb(e){return Sn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function vo(){let e=Reflect.get(globalThis,Kp);if(Mb(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,Kp,t),t}function Yp(e,t){let n=Sn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=vo().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function Qp(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function Zp(e){if(!Sn(e)||typeof e.name!="string"||!Qp(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:Qp(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...Sn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:Sn(e.annotations)&&e.annotations.consequentialHint===!0}}function ol(e){return e.flatMap(t=>{let n=Zp(t),r=Sn(t)?t.execute:void 0;return!n||typeof r!="function"?(Xp.warn("skipped a tool without a name or an execute function",t),[]):[{...n,run:(o,a)=>Reflect.apply(r,t,[o,{signal:a}])}]})}async function Nb(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!Sn(e)||typeof e.getTools!="function"||typeof e.executeTool!="function")return[];let t=e.getTools,n=e.executeTool,r=await Promise.race([Promise.resolve().then(()=>Reflect.apply(t,e,[])),Un(Ab).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=Zp(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function Za(e=[]){let t=ol(jp()),n=new Set(t.map(a=>a.name)),o=[...(await Nb()).filter(a=>!n.has(a.name)),...t,...ol(e),...ol(vo().registered)];return new Map(o.map(a=>[a.name,a]))}function il(e){return[...e.values()].map(({name:t,description:n,inputSchema:r,consequential:o})=>o?{name:t,description:n,inputSchema:r,annotations:{consequentialHint:!0}}:{name:t,description:n,inputSchema:r})}function Wt(e){return e?.execution==="client"}function bo(e){return e.startsWith(Wp)?e.slice(Wp.length):e}function Lb(e){if(e===void 0||typeof e=="function"||typeof e=="symbol")return null;let t=new WeakSet,n=JSON.stringify(e,(r,o)=>{if(typeof o=="bigint")return o.toString();if(!(typeof o=="function"||typeof o=="symbol"))return o instanceof Node?`[${o.nodeName.toLowerCase()}]`:Sn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Gp?{truncated:!0,preview:n.slice(0,Gp)}:JSON.parse(n)}async function Ob(e){let t=bo(e.toolName),n=(await Za(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:Lb(r)})).catch(r=>(Xp.warn("a page tool failed",{name:t,error:r}),{state:"output-error",errorText:(r instanceof Error?r.message:String(r)).slice(0,1e3)||"The page tool failed."})):{state:"output-error",errorText:`This page doesn't offer "${t}" right now; the visitor may have moved on. Tell them, or continue without it.`}}function e_(e){let{toolCallId:t}=e,n=It.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=vo(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return It.set(t,{state:"finished",outcome:al}),e.onSettled("interrupted",0),Promise.resolve(al);let a=new AbortController,i=performance.now();It.set(t,{state:"running"});let s=Ob({...e,signal:a.signal}).then(c=>(r.delete(t),It.get(t)?.state!=="running"||(It.set(t,{state:"finished",outcome:c}),e.onSettled(c.state==="output-available"?"completed":"failed",Math.round(performance.now()-i))),c));return r.set(t,{outcome:s,controller:a}),s}function ei(e){return e===al.errorText||e===Jp}function sl(e){return It.set(e,{state:"stopped"}),vo().runs.get(e)?.controller.abort(),Jp}function t_(e){It.clear([e]),vo().runs.get(e)?.controller.abort()}var Ht=A.cssPrefix;function ll(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function kr(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${ll(e.slice(0,t))} \xB7 ${ll(n)}`:e}function ti(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?ll(n):kr(e)}function ni(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 ul({status:e,icon:t,label:n}){return l("span",{class:`${Ht}-toolui-badge ${Ht}-toolui-status`,"data-status":e,children:[l("span",{class:`${Ht}-toolui-status-icon`,children:t}),n]})}function $b(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 wr(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":Bb($b(e,t),n.superseded,n.live??!0)}function Db({status:e}){return e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(hr,{}):e==="completed"||e==="responded"?l(gr,{}):l(Zd,{})}function Fb(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;case"incomplete":return t.statusIncomplete;default:return t.statusRunning}}function Bb(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function Ub({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1}){let s=wr(e,t,{superseded:r,live:o,submitted:a,incomplete:i});return l(ul,{status:s,icon:l(Db,{status:s}),label:Fb(s,n)})}function Hb({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}){return l(de,{children:[l("span",{class:`${Ht}-toolui-name-pill`,children:[l(Ba,{}),l("span",{class:`${Ht}-toolui-name-text`,children:e})]}),l(Ub,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}),l("span",{class:`${Ht}-toolui-chevron`,children:l(ln,{})})]})}function ri({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i}){let s=ue(()=>Se(()=>e.inputSig.value),[e]),c=ue(()=>Se(()=>e.outputSig.value),[e]),p=ue(()=>Se(()=>e.errorSig.value),[e]),_=ue(()=>Se(()=>e.stateSig.value),[e]),d=ue(()=>Se(()=>e.approvalSig.value),[e]),u=ue(()=>Se(()=>Wt(e.toolMetadata)&&ei(e.errorSig.value)),[e]),f=i===!0||u.value;return l("details",{class:`${Ht}-toolui ${Ht}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${Ht}-toolui-head`,children:l(Hb,{name:kr(e.toolName),state:_.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a,incomplete:f})}),l(zn,{label:t.toolParameters,value:s.value}),c.value!==void 0?l(zn,{label:t.toolResult,value:c.value}):null,p.value&&!f?l(zn,{label:t.statusError,value:p.value,error:!0}):null]})}function zn({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":cl(n_(t));return r?l("div",{class:`${Ht}-toolui-section`,children:[l("span",{class:`${Ht}-toolui-label`,children:e}),l("pre",{class:`${Ht}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function oi(e){return!!cl(e.inputSig.value)||!!e.errorSig.value||!!cl(n_(e.outputSig.value))}function n_(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function cl(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 r_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function o_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function qb(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function a_(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:qb({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function i_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=ni(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:wr(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Wt(e.toolMetadata)&&ei(e.errorSig.value)}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var Cr=A.cssPrefix;function s_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${Cr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":N.source,children:[l("span",{class:`${Cr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${Cr}-source-label`,children:n})]}):l("span",{class:`${Cr}-source`,"data-testid":N.source,children:[l("span",{class:`${Cr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${Cr}-source-label`,children:n})]})}var Nt=A.cssPrefix;function l_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.approvalSig.value),[e]),c=ue(()=>Se(()=>i_(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:p,showApproveReject:_,showAnswered:d,showSubmitted:u,showEdit:f,skipped:m}=c,v=kr(e.toolName),S=c.answeredApproved,P=e.toolCallId,y=l(de,{children:[l("p",{class:`${Nt}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",v)}),l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalBody})]});u?y=l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalSubmitting}):d&&S!==!1?y=l(de,{children:[l("p",{class:`${Nt}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",S?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${Nt}-toolui-subtle`,children:t.approvalSubmitting})]}):d&&(y=l(de,{}));let C=_||u||f||d&&S!==!1;return l("div",{class:`${Nt}-toolui-group`,"data-testid":c.decided?N.toolDecision:N.toolApproval,children:[l(ri,{part:e,strings:t,superseded:m,submitted:u}),m||p||!C?null:l("div",{class:`${Nt}-toolui ${Nt}-toolui-body`,children:[y,_?l("div",{class:`${Nt}-toolui-actions`,children:[l("button",{type:"button",class:`${Nt}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":N.toolReject,children:t.reject}),l("button",{type:"button",class:`${Nt}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":N.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${Nt}-toolui-actions`,children:l("button",{type:"button",class:`${Nt}-form-skip`,onClick:()=>i(P),"data-testid":N.toolEdit,children:t.edit})}):null]})]})}var zb=["text","email","phone","number","date","single-select","multi-select","boolean"];function c_(e){return e!==null&&typeof e=="object"}function u_(e){let t=c_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(jb).filter(o=>o!==null);return{intro:ai(t.intro),questions:r}}function jb(e,t){if(!c_(e))return null;let n=zb.find(r=>r===e.type)??"text";return{key:ai(e.key)??`q${t+1}`,question:ai(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:ai(e.helpText)}}function Vb(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 dl(e,t,n){return e.questions.map(r=>{let o=Vb(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function ai(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Ze=A.cssPrefix;function Wb({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 Gb={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function d_(e,t){let n={};for(let r of e)n[r.key]=t[Gb[r.type]];return n}function p_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.stateSig.value),[e]).value,c=ue(()=>Se(()=>e.approvalSig.value),[e]).value,p=ue(()=>Se(()=>u_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=ni(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,v=!m&&!u&&!f,S=u&&n&&!_,P=p.questions,[y,C]=H(null),g=y??(m||u||f),[k,w]=H(!1),T=P.length>1?Vs:co,E=m?t.inputRequired:t.inputBadge,M=f?l("p",{class:`${Ze}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Kb,{req:p,strings:t,active:n,resolve:(z,V)=>a(e.toolCallId,V,z)}):k?l(go,{fields:dl(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:d_(P,t),initialValues:u?Zb(P,c?.reason):void 0}):l(Qb,{questions:P,answers:u?Yb(c?.reason):{},strings:t}),{status:L,statusLabel:O}=Wb({skipped:v,submitted:f,strings:t});return l("details",{class:`${Ze}-toolui ${Ze}-toolui-collapsible${r?` ${Ze}-toolui-stale`:""}`,open:g,onToggle:z=>{let V=z.currentTarget.open;V!==g&&C(V)},"data-testid":m?N.toolAskQuestions:N.toolDecision,children:[l("summary",{class:`${Ze}-toolui-head`,children:[l("span",{class:`${Ze}-toolui-q-pill`,children:[l(T,{}),E]}),l("span",{class:`${Ze}-toolui-head-end`,children:[m?null:l(ul,{status:L,icon:v?l(hr,{}):l(gr,{}),label:O}),l("span",{class:`${Ze}-toolui-chevron`,children:l(ln,{})})]})]}),l("div",{class:`${Ze}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Ze}-toolui-desc`,children:p.intro}):null,M,m||f?null:l("div",{class:`${Ze}-toolui-footer`,children:[l("button",{type:"button",class:`${Ze}-toolui-options-toggle`,onClick:()=>w(z=>!z),"data-testid":N.toolAskOptions,children:[l("span",{class:`${Ze}-toolui-options-chevron${k?` ${Ze}-open`:""}`,children:l(ln,{})}),k?t.hideOptions:t.showOptions]}),S?l("button",{type:"button",class:`${Ze}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":N.toolEdit,children:t.edit}):null]})]})]})}function Kb({req:e,strings:t,active:n,resolve:r}){let o=dl(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(go,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(Jb(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:d_(e.questions,t),submitTestId:N.toolInputSubmit,skipTestId:N.toolInputSkip})}function Qb({questions:e,answers:t,strings:n}){return l("div",{class:`${Ze}-toolui-summary`,"data-testid":N.toolAskSummary,children:e.map(r=>l("div",{class:`${Ze}-field`,children:[l("span",{class:`${Ze}-field-head`,children:l("span",{class:`${Ze}-field-label`,children:[r.question,r.required?l("span",{class:`${Ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Ze}-toolui-answer`,children:Xb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Xb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function Jb(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function __(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:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function Yb(e){let t=__(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function Zb(e,t){let n=__(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function f_({part:e,strings:t,live:n,superseded:r}){let o=Wt(e.toolMetadata);if(!ue(()=>Se(()=>oi(e)),[e]).value&&!o)return null;let i=e.outputSig.value===void 0&&!e.errorSig.value;return l(ri,{part:e,strings:t,testid:N.toolCall,live:n||o&&!r,incomplete:o&&r&&i})}var Le=A.cssPrefix;function m_(e){return e.kind==="tool"&&e.approvalSig.value===void 0&&!e.toolMetadata?.card&&!Wt(e.toolMetadata)}function g_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||m_(o)&&oi(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||m_(o)||n.push({kind:"part",part:o,index:r})}return n}function ey(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function h_({parts:e,strings:t,live:n,running:r}){let[o,a]=H(!1),i=e.filter(d=>d.kind==="tool"),s=i.filter(d=>wr(d.stateSig.value,d.approvalSig.value,{live:n})==="error").length,c=new Map;for(let d of i)c.set(ti(d.toolName),(c.get(ti(d.toolName))??0)+1);let p=e.at(-1),_=p?.kind==="tool"?`${ti(p.toolName)}\u2026`:t.thinking;return l("div",{class:`${Le}-steps`,"data-testid":N.toolSteps,"data-running":r?"true":void 0,children:[l("button",{type:"button",class:`${Le}-steps-head`,"aria-expanded":o,onClick:()=>a(!o),children:[l("span",{class:`${Le}-steps-icon`,"aria-hidden":"true",children:r?l("span",{class:`${Le}-loading-spinner`}):l(Ba,{})}),l("span",{class:`${Le}-steps-label`,children:r?_:[...c].map(([d,u],f)=>l("span",{class:`${Le}-steps-name`,children:[f>0?l("span",{"aria-hidden":"true",children:"\xB7"}):null,l("span",{class:`${Le}-steps-name-text`,children:d}),u>1?l("span",{class:`${Le}-steps-count`,children:["\xD7",u]}):null]},d))}),!r&&s>0?l("span",{class:`${Le}-steps-failed`,children:t.toolStepsFailed.replace("{count}",String(s))}):null,l("span",{class:`${Le}-toolui-chevron`,"data-open":o?"true":void 0,children:l(ln,{})})]}),l("span",{class:`${Le}-sr-only`,role:"status",children:r?_:""}),o?l("ol",{class:`${Le}-steps-list`,children:e.map((d,u)=>d.kind==="tool"?l(ty,{part:d,strings:t,live:n},d.toolCallId):l(ry,{part:d,strings:t},`${d.id}#${u}`))}):null]})}function ty({part:e,strings:t,live:n}){let[r,o]=H(!1),a=wr(e.stateSig.value,e.approvalSig.value,{live:n}),i=ey(e.inputSig.value);return l("li",{class:`${Le}-steps-row`,"data-testid":N.toolStep,"data-status":a,children:[l("button",{type:"button",class:`${Le}-steps-row-head`,"aria-expanded":r,onClick:()=>o(!r),children:[l("span",{class:`${Le}-steps-row-icon`,"aria-hidden":"true",children:l(ny,{status:a})}),l("span",{class:`${Le}-steps-row-name`,children:kr(e.toolName)}),i?l("span",{class:`${Le}-steps-row-summary`,children:i}):null,a==="error"?l("span",{class:`${Le}-steps-failed`,children:t.statusError}):null]}),r?l("div",{class:`${Le}-steps-row-body`,children:[l(zn,{label:t.toolParameters,value:e.inputSig.value}),e.outputSig.value!==void 0?l(zn,{label:t.toolResult,value:e.outputSig.value}):null,e.errorSig.value?l(zn,{label:t.statusError,value:e.errorSig.value,error:!0}):null]}):null]})}function ny({status:e}){return e==="running"?l("span",{class:`${Le}-loading-spinner`}):e==="error"?l(hr,{}):l(gr,{})}function ry({part:e,strings:t}){let[n,r]=H(!1);return l("li",{class:`${Le}-steps-row`,"data-status":"thought",children:[l("button",{type:"button",class:`${Le}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:l("span",{class:`${Le}-steps-row-name`,children:t.thoughts})}),n?l("div",{class:`${Le}-steps-row-body ${Le}-reasoning-body`,children:l(vr,{textSig:e.textSig,doneSig:e.doneSig})}):null]})}var Oe=A.cssPrefix,v_=Up(oy);function oy({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:_,enableMessageFeedback:d=!1,onFeedback:u}){let m=[...ue(()=>Se(()=>e.partsSig.value),[e]).value];for(let G of e.attachments??[])!G.url||m.some(Y=>Y.kind==="file"&&Y.url===G.url)||m.push({kind:"file",url:G.url,mediaType:G.mediaType,filename:G.name,fileId:G.id,fileSize:G.size});let v=ue(()=>Se(()=>Dn(e)),[e]),S=ue(()=>Se(()=>id(e)),[e]),P=ue(()=>Se(()=>r_(e)),[e]),y=ue(()=>Se(()=>o&&o_(e)),[e,o]),C=t==="streaming",h=e.role==="assistant"&&C,g=a_({streaming:h,responseMode:r,reasoningVisible:y.value,hasAnswerText:P.value,emptyReply:v.value,hidden:S.value}),{bufferedHold:k,working:w,showStreamDots:T}=g;if(g.hidden)return null;let E=iy(e.createdAt),M=e.role==="assistant"||e.role==="operator",L=d&&!!u&&!!e.serverMessageId&&M&&!C&&t!=="error"&&!v.value,O=C?"":m.filter(G=>G.kind==="text").map(G=>e.role==="assistant"?Ca(G.textSig.peek()):G.textSig.peek()).join(`
60
+ ${n}`:"";s||(t++,a&&(n+="> "));let d={};i.replace(/(\w+)=(["'])(.*?)\2/g,(m,h,S,P)=>d[h]=P);let u=d.href??d.src,f=d.title??d.path??d.query??d.body??d.header??d.name??u;return(a?"> ":"")+(f?`**${u?`[${f}](${u})`:f}**${d.type?` \`${d.type}\``:""}
61
+ ${n}`:"")})}function rp(e){for(let t of e.querySelectorAll("a")){let n=t.getAttribute("href")??"";!n||n.startsWith("#")||(t.target="_blank",t.rel="noopener noreferrer")}}var op=new Set([11,12,13,14,15,16,17,18,19,31]);function ja(e){let t="",n=[],r=lr({data:void 0,add_token:(o,a)=>{n.push(a),op.has(a)||(t+=" ")},end_token:()=>{let o=n.pop();o!==void 0&&!op.has(o)&&(t+=" ")},add_text:(o,a)=>{t+=a},set_attr:()=>{}});return Xe(r,e),Kr(r),t.replace(/\s+/g," ").trim()}var sp=A.cssPrefix;function Ot({tone:e="info",message:t,onRetry:n,strings:r}){return l("div",{class:`${sp}-module-empty`,role:e==="error"?"alert":"status","aria-live":"polite",children:[l("span",{children:t}),n?l("button",{type:"button",class:`${sp}-module-retry`,onClick:n,children:r.errorRetry}):null]})}var Sn=A.cssPrefix,gh=ne.scope("content"),vh=5e3;function lp({id:e,title:t,transport:n,strings:r,bus:o,onBack:a,actions:i}){let[s,c]=H(null),[p,_]=H(!1),[d,u]=H(!1),[f,m]=H(0),[h,S]=H(null),P=$(()=>{u(!1),c(null),m(g=>g+1)},[]);D(()=>{let g=!1,k=n.listContentCollections([]).catch(()=>{});return Promise.all([n.listContent({ids:[e],limit:1}),k]).then(([w,T])=>{if(g)return;let E=w.items[0];E?(c(E),_(T?.items.find(M=>M.id===E.contentCollectionId)?.settings?.voteAccess==="portal"),o.emit("contentOpen",{contentId:e,contentCollectionId:E.contentCollectionId})):u(!0)}).catch(w=>{g||(gh.warn("listContent (reader) failed",{err:w}),u(!0))}),()=>{g=!0}},[n,e,f,o]),D(()=>{if(!s)return;let g=setTimeout(()=>o.emit("contentRead",{contentId:e}),vh);return()=>clearTimeout(g)},[s,e,o]);let y=$(g=>{let w=g.target?.closest?.("a")?.getAttribute("href")??"";w&&!w.startsWith("#")&&o.emit("contentLinkClick",{contentId:e})},[o,e]);function C(g){S(e),n.setContentVote({contentId:e,value:g})}function v(){return d?l(Ot,{tone:"error",message:r.errorGeneric,onRetry:P,strings:r}):s===null?l(Ot,{message:r.contentLoading,strings:r}):l("article",{class:`${Sn}-content`,"data-testid":N.contentView,onClick:y,children:[s.image?l("img",{class:`${Sn}-content-hero`,src:s.image,alt:"",loading:"lazy"}):null,s.description?l("p",{class:`${Sn}-content-subtitle`,children:s.description}):null,l(ap,{text:ip(s.content??"")}),p?l("div",{class:`${Sn}-content-vote`,"aria-live":"polite",children:h===e?r.feedbackThanks:l(de,{children:[l("span",{children:r.contentHelpful}),l("button",{type:"button",class:`${Sn}-module-retry`,onClick:()=>C(1),children:r.confirmYes}),l("button",{type:"button",class:`${Sn}-module-retry`,onClick:()=>C(0),children:r.confirmNo})]})}):null]})}return l("div",{class:`${Sn}-module`,children:[l(za,{title:s?.title||t||r.moduleBack,backLabel:r.moduleBack,onBack:a,actions:i,testid:N.backHeader}),l("div",{class:`${Sn}-module-scroll`,"data-testid":N.contentScroll,children:v()})]})}function cp({itemCount:e,initialFocusIndex:t}){let[n,r]=H(!1),o=F(null),a=F(null),[i,s]=H(-1),c=$(()=>{r(!1),s(-1),o.current?.focus()},[]),p=$(()=>r(u=>!u),[]);D(()=>{if(!n)return;function u(f){let m=a.current,h=o.current;if(!m||!h)return;let S=f.composedPath();S.includes(m)||S.includes(h)||(r(!1),s(-1))}return document.addEventListener("click",u,!0),()=>document.removeEventListener("click",u,!0)},[n]),D(()=>{if(!n||e===0)return;let u=t?.()??0,f=u<0||u>=e?0:u;s(f)},[n,e,t]),D(()=>{if(!n||i<0)return;a.current?.querySelectorAll("[role='menuitem']")?.[i]?.focus()},[n,i]);let _=$(u=>{(u.key==="ArrowDown"||u.key==="Enter"||u.key===" ")&&(u.preventDefault(),r(!0))},[]),d=$(u=>{if(e!==0)switch(u.key){case"Escape":u.preventDefault(),c();return;case"ArrowDown":u.preventDefault(),s(f=>(f+1)%e);return;case"ArrowUp":u.preventDefault(),s(f=>(f-1+e)%e);return;case"Home":u.preventDefault(),s(0);return;case"End":u.preventDefault(),s(e-1)}},[e,c]);return{open:n,focusIndex:i,triggerRef:o,menuRef:a,toggle:p,close:c,onTriggerKey:_,onMenuKey:d}}function up({items:e,triggerLabel:t}){let n=A.cssPrefix,r=cp({itemCount:e.length});function o(s){s.disabled||(s.onSelect?.(),s.keepOpen||r.close())}function a(s,c){return s.onSelectValue?.(c)}function i(s,c){let p=c.segments;if(!p?.length)return;let _=Math.max(0,p.findIndex(u=>u.value===c.value)),d=-1;if(s.key==="ArrowRight"||s.key==="Enter"||s.key===" ")d=(_+1)%p.length;else if(s.key==="ArrowLeft")d=(_-1+p.length)%p.length;else return;s.preventDefault(),s.stopPropagation(),a(c,p[d].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(Dd,{})}),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=>i(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 p=c.value===s.value;return l("button",{type:"button",role:"menuitemradio","aria-checked":p,class:`${n}-segment`,"data-on":p?"true":void 0,lang:c.lang,title:c.value,tabIndex:-1,"data-testid":`${N.langSegment}-${c.value}`,onClick:()=>a(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(qn,{})}):null]},s.id))}):null]})}var Qs=A.cssPrefix;function hh(e){let t=typeof matchMedia=="function"?matchMedia("(prefers-color-scheme: dark)").matches:!0;return e==="host"?or()==="dark"?"light":"dark":e==="auto"?t?"light":"dark":t?e==="light"?"dark":"auto":e==="dark"?"light":"auto"}var bh={normal:"large",large:"small",small:"normal"};function yh(e){return e==="light"?l(Gd,{}):e==="dark"?l(Kd,{}):l(Qd,{})}function Ph(e){return(e.split("-")[0]??e).toUpperCase()}function xh(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 Qt({panelProps:e,variant:t}){let{options:n,panelSize:r,feedback:o,onClose:a,onClear:i,onExpand:s,onFullscreen:c,onSoundToggle:p}=e,{onToggleHistory:_,onLocaleChange:d,onThemeChange:u,onTextSizeChange:f}=e,m=n.strings,h=n.mode,S=t==="chat",P=Rt(()=>o.mutedSig.value).value,y=new Set(n.actions);function C(K){return y.has(K)}let v=typeof matchMedia=="function"&&matchMedia("(max-width: 640px)").matches;function g(K){return v?!1:pr(K,h,r)}let k=n.themeMode,w={auto:m.themeAuto,light:m.themeLight,dark:m.themeDark,host:m.themeAuto},T=n.textSize,E={small:m.textSizeSmall,normal:m.textSizeNormal,large:m.textSizeLarge},M=[];if(S&&C("clear")&&M.push({id:"clear",icon:l(jd,{}),label:m.newConversation,onSelect:i}),C("expand")&&g("expand")){let K=r==="expanded";M.push({id:"expand",icon:K?l(Md,{}):l(Ad,{}),label:K?m.collapse:m.expand,type:"switch",on:K,onSelect:s})}if(C("fullscreen")&&g("fullscreen")){let K=r==="fullscreen";M.push({id:"fullscreen",icon:K?l(Ld,{}):l(Nd,{}),label:K?m.exitFullscreen:m.fullscreen,type:"switch",on:K,onSelect:c})}let L=n.popOutUrl,O=n.aiAgentDeploymentId;C("popOut")&&L&&O&&pr("popOut",h,r)&&M.push({id:"popOut",icon:l(Od,{}),label:m.popOut,onSelect:()=>{let K=xh(L,{conversationId:e.conversationId,widgetId:n.widgetId,publicKey:n.publicKey,aiAgentDeploymentId:O});K&&window.open(K,"_blank","noopener,noreferrer")}}),S&&C("sound")&&M.push({id:"sound",icon:P?l(Bd,{}):l(Fd,{}),label:P?m.soundOff:m.soundOn,type:"switch",on:!P,onSelect:p}),C("theme")&&M.push({id:"theme",icon:yh(k),label:`${m.theme}: ${w[k]}`,onSelect:()=>u(hh(k)),keepOpen:!0}),C("textSize")&&M.push({id:"textSize",icon:l(Ud,{}),label:`${m.textSize}: ${E[T]}`,onSelect:()=>f(bh[T]),keepOpen:!0}),C("language")&&n.availableLocales.length>1&&M.push({id:"language",icon:l(zd,{}),label:m.language,segments:n.availableLocales.map(K=>({value:K,label:Ph(K),lang:K})),value:n.locale,onSelectValue:d});let z=!!a&&Oa(h,r,n.actions),V=S&&C("history");return l("div",{class:`${Qs}-header-actions`,children:[V?l("button",{type:"button",class:`${Qs}-icon-btn`,onClick:_,"aria-label":m.history,title:m.history,"data-testid":N.actionHistory,children:l(qd,{})}):null,M.length>0?l(up,{items:M,triggerLabel:m.moreActions}):null,z?l("button",{type:"button",class:`${Qs}-icon-btn`,onClick:a,"aria-label":m.close,title:m.close,"data-testid":N.actionClose,children:l(Bt,{})}):null]})}var dp={Icon:uo};function zn(e,t){return e instanceof ct&&e.status===429?t.errorRateLimited:t.errorGeneric}var br=A.cssPrefix;function pp({placeholder:e,onActivate:t}){return l("button",{type:"button",class:`${br}-home-search`,onClick:t,"data-testid":N.homeSearch,children:[l("span",{class:`${br}-home-search-text`,children:e}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(Ks,{})})]})}function _p({placeholder:e,value:t,onInput:n}){return l("div",{class:`${br}-home-search`,"data-input":"true",children:[l("input",{type:"search",class:`${br}-home-search-input`,placeholder:e,value:t,maxLength:200,onInput:r=>n(r.currentTarget.value),"data-testid":N.helpSearch}),l("span",{class:`${br}-home-search-icon`,"aria-hidden":"true",children:l(Ks,{})})]})}var po=A.cssPrefix;function Va({title:e,subtitle:t,onClick:n,testid:r}){return l("button",{type:"button",class:`${po}-list-row`,onClick:n,"data-testid":r,children:[l("span",{class:`${po}-list-row-body`,children:[l("span",{class:`${po}-list-row-title`,children:e}),t?l("span",{class:`${po}-list-row-sub`,children:t}):null]}),l("span",{class:`${po}-list-row-chevron`,"aria-hidden":"true",children:l(mr,{})})]})}var Xt=A.cssPrefix,Sh=ne.scope("help"),kh=20,wh=300;function Ch(e,t,n){let r=new Map(n.map(o=>[o.id,o.title]));return t.map(o=>({id:o,title:r.get(o),rows:e.filter(a=>a.contentCollectionId===o)})).filter(o=>o.rows.length>0)}function fp({transport:e,strings:t,bus:n},r,o){let[a,i]=H(),s=F(void 0);function c(p){if(!r?.length)return;let _={};s.current=_,i(d=>({search:o,items:[],collections:[],...d,pagination:p>1?d?.pagination:void 0,loading:!0,error:void 0})),Promise.all([e.listContent({contentCollectionIds:r,sortBy:"order",page:p,limit:kh,search:o}),p>1?void 0:e.listContentCollections(r)]).then(([d,u])=>{s.current===_&&(i(f=>({search:o,items:[...p>1?f?.items??[]:[],...d.items],collections:u?.items??f?.collections??[],pagination:d.pagination,loading:!1})),!(p>1)&&(o?n.emit("contentSearch",{queryLength:o.length,hitCount:d.pagination.total}):n.emit("contentView",{section:"help",count:d.items.length})))}).catch(d=>{s.current===_&&(Sh.warn("listContent (help) failed",{err:d,page:p}),i(u=>u&&{...u,loading:!1,error:zn(d,t)}))})}return D(()=>{if(!r?.length){i(void 0);return}return c(1),()=>{s.current=void 0}},[e,r,o]),[a,()=>!a?.loading&&c((a?.pagination?.page??0)+1)]}function Th(e){let{strings:t,config:n,nav:r,panelProps:o}=e,a=n.contentCollectionIds,[i,s]=H(""),[c,p]=H(""),_=fp(e,a),d=fp(e,c?a:void 0,c),[u,f]=i.trim()?d:_;D(()=>{let h=setTimeout(()=>p(i.trim()),wh);return()=>clearTimeout(h)},[i]);function m(){if(!a?.length)return l(Ot,{message:t.helpEmpty,strings:t});let h=u?.error?l(Ot,{tone:"error",message:u.error,onRetry:f,strings:t}):null;return h&&!u?.pagination?h:!u||!u.pagination&&!u.items.length?l(Ot,{message:t.helpLoading,strings:t}):u.items.length?l(de,{children:[Ch(u.items,a,u.collections).map(S=>l("section",{class:`${Xt}-help-group`,children:[S.title?l("h2",{class:`${Xt}-help-section-title`,children:S.title}):null,l("div",{class:`${Xt}-help-card`,children:S.rows.map(P=>l(Va,{title:P.title,subtitle:P.description,onClick:()=>r.push(P.url?{kind:"iframe",url:P.url,title:P.title}:{kind:"content",id:P.id,title:P.title}),testid:ut(N.helpArticle,P.id)},P.id))})]},S.id)),h,u.pagination?.hasNext&&!h?l("div",{children:l("div",{class:`${Xt}-help-card`,children:l("button",{type:"button",class:`${Xt}-list-row ${Xt}-help-more`,onClick:f,"aria-busy":u.loading,children:[u.loading?l("span",{class:`${Xt}-loading-spinner`,"aria-hidden":"true"}):null,t.helpShowMore]})})}):null]}):l(Ot,{message:u.search?t.helpSearchEmpty.replace("{query}",u.search):t.helpEmpty,strings:t})}return l("div",{class:`${Xt}-module`,children:[l(qa,{title:t.helpTitle,actions:l(Qt,{panelProps:o,variant:"plain"})}),l("div",{class:`${Xt}-module-pad`,children:l(_p,{placeholder:t.helpSearchPlaceholder,value:i,onInput:s})}),l("div",{class:`${Xt}-help-list`,children:m()})]})}var mp={Icon:co,Root:e=>l(Th,{...e})};var gp=ne.scope("attachments");function Wa(e,t,n){let r=Ih(e),o=[],a=[],i=Mh(n.accept),s=t.reduce((p,_)=>p+_.size,0),c=t.length;for(let p of r){let _=Rh(p,c,s,n,i);if(_){a.push({file:p,reason:_});continue}o.push(Ah(p)),s+=p.size,c+=1}return(o.length||a.length)&&gp.debug("ingest",{accepted:o.length,rejected:a.map(p=>({name:p.file.name,reason:p.reason}))}),{accepted:o,rejected:a}}function yr(e){try{URL.revokeObjectURL(e.previewUrl)}catch(t){gp.debug("revokeObjectURL failed",{error:t})}}function Rh(e,t,n,r,o){return t>=r.maxCount?"count":n+e.size>r.maxBytes?"bytes":Nh(e,o)?null:"mime"}function Ih(e){return e?Array.isArray(e)?e.filter(t=>t instanceof File):[...e].map(t=>t instanceof File?t:Eh(t)).filter(t=>t!==null):[]}function Eh(e){let t=e;return!t?.getAsFile||t.kind!=="file"?null:t.getAsFile()}function Ah(e){return{file:e,id:Ct(),mediaType:e.type||"application/octet-stream",name:e.name||"pasted-file",previewUrl:URL.createObjectURL(e),size:e.size}}function Mh(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 Nh(e,t){if(t.length===0)return!0;let[n="*",r="*"]=(e.type||"").toLowerCase().split("/"),o=(e.name||"").toLowerCase();return t.some(a=>a.kind==="ext"?o.endsWith(a.ext):a.type==="image"&&a.subtype==="*"&&/\.(heic|heif|avif|bmp|tif|tiff)$/.test(o)?!0:(a.type==="*"||a.type===n)&&(a.subtype==="*"||a.subtype===r))}var _o=A.cssPrefix;function vp({attachment:e,onRemove:t,disabled:n=!1}){let r=/^image\/(jpeg|png|gif|webp|avif|bmp|x-ms-bmp|svg\+xml)$/i.test(e.mediaType);return l("span",{class:`${_o}-attachment-chip`,title:e.name,"data-testid":ut(N.attachmentChip,e.id),children:[r?l("img",{class:`${_o}-attachment-thumb`,src:e.previewUrl,alt:""}):l("span",{class:`${_o}-attachment-thumb`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${_o}-attachment-name`,children:e.name}),l("button",{type:"button",class:`${_o}-attachment-remove`,onClick:t,disabled:n,"aria-label":`Remove ${e.name}`,"data-testid":ut(N.attachmentRemove,e.id),children:l(Bt,{})})]})}var Xs={isSupported:!1,start:()=>{},stop:()=>{},cancel:()=>{}};function Js(e,t,n){return e==="disabled"?Xs:e==="server"?Dh(n):Lh(t)}function Lh(e){let t=Oh();if(!t)return Xs;let n=null,r=0;return{isSupported:!0,start(o,a){let i=n,s=++r;n=null,i?.abort();let c=new t;n=c,c.continuous=!0,c.interimResults=!0,c.lang=e;let p=!1;c.addEventListener("result",d=>{if(r!==s||n!==c)return;let u=d,f="",m=!1;for(let h=u.resultIndex;h<u.results.length;h++){let S=u.results[h];S&&(f+=S[0].transcript,S.isFinal&&(m=!0))}o(f,m)});function _(){p||r!==s||n!==c||(p=!0,n=null,a())}c.addEventListener("end",_),c.addEventListener("error",_);try{c.start()}catch{_()}},stop(){n?.stop()},cancel(){r++;let o=n;n=null,o?.abort()}}}function Oh(){return window.SpeechRecognition??window.webkitSpeechRecognition}var $h=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/mp4"];function Dh(e){if(typeof MediaRecorder>"u"||!navigator?.mediaDevices?.getUserMedia)return Xs;let t=0,n=null;function r(i){for(let s of i.stream?.getTracks()??[])s.stop();i.stream=null}function o(){t++;let i=n;n=null,i&&(r(i),i.recorder?.state!=="inactive"&&i.recorder?.stop())}async function a(i){if(i.finishing)return;i.finishing=!0;let s=i.recorder?.mimeType??"audio/webm";r(i);let c=new Blob(i.chunks,{type:s});i.chunks=[];try{let{text:p}=await e(c,s);n===i&&t===i.generation&&p&&i.onText(p,!0)}catch{}finally{n===i&&t===i.generation&&(n=null,i.onEnd())}}return{isSupported:!0,async start(i,s){o();let c={generation:t,recorder:null,stream:null,chunks:[],onText:i,onEnd:s,finishing:!1};n=c;try{let p=await navigator.mediaDevices.getUserMedia({audio:!0});if(n!==c||t!==c.generation){for(let u of p.getTracks())u.stop();return}c.stream=p;let _=Fh(),d=new MediaRecorder(p,_?{mimeType:_}:void 0);c.recorder=d,d.addEventListener("dataavailable",u=>{n===c&&t===c.generation&&u.data.size>0&&c.chunks.push(u.data)}),d.addEventListener("stop",()=>{n===c&&t===c.generation&&a(c)}),d.start()}catch{r(c),n===c&&t===c.generation&&(n=null,s())}},stop(){let i=n;if(i){if(!i.recorder){o();return}i.recorder.state!=="inactive"&&i.recorder.stop()}},cancel(){o()}}}function Fh(){for(let e of $h)if(MediaRecorder.isTypeSupported(e))return e}var Ye=A.cssPrefix,Pr=ne.scope("composer");function xr(e){return e.reduce((t,n)=>t+n.size,0)}var Ys={arrowUp:Cd,paperPlane:wd,send:Td,chevron:mr};function hp(e){return"activeElement"in e}function Bh(e){return"host"in e&&"activeElement"in e}function bp({options:e,transport:t,feedback:n,bus:r,persistence:o,conversationId:a,isStreaming:i,pageToolRunning:s=!1,isMemoryCompacting:c=!1,canReleaseQueuedMessages:p=!0,queueManualMessages:_=!1,active:d=!0,isPreparing:u=!1,operatorRequestEnabled:f,canRequestOperator:m=!1,controlMode:h="ai-agent",onRequestOperator:S,onSend:P,onStop:y,apiRef:C}){let v=e.strings,[g,k]=H(()=>o.loadDraft(a)),[w,T]=H([]),[E,M]=H(()=>o.loadMessageQueue(a).map(B=>({id:B.id,text:B.text,attachments:[]}))),L=F(E),O=F(!1),[z,V]=H(!1),[K,te]=H(!1),G=F(!1),Y=F(null),De=F(null),_e=F(null),Te=F(0),et=F(a);et.current=a;let Ue=F(d);Ue.current=d;let gt=F(u);gt.current=u;let Ge=K||u||!d,vt=i&&h==="ai-agent",dt=vt||c&&h==="ai-agent",St=h==="ai-agent"&&(dt||_||E.length>0),kt=$(B=>{M(Q=>{let ee=B(Q);return o.saveMessageQueue(et.current,ee.filter(me=>me.attachments.length===0).map(({id:me,text:it})=>({id:me,text:it}))),L.current=ee,ee})},[o]),Ee=$(B=>{kt(Q=>(Q.find(ee=>ee.id===B)?.attachments.forEach(yr),Q.filter(ee=>ee.id!==B)))},[kt]),He=$(B=>{k(Q=>{let ee=typeof B=="function"?B(Q):B;return ee===Q?Q:(o.saveDraft(et.current,ee),ee)})},[o]),ye=e.features.fileUpload,ot=e.features.voice,[he,ht]=H(()=>Js(ot,e.locale,(B,Q)=>t.transcribe(B,Q))),Ke=F(he);Ke.current=he;let $t=F({mode:ot,locale:e.locale,transport:t});D(()=>{let B=$t.current;B.mode===ot&&B.locale===e.locale&&B.transport===t||($t.current={mode:ot,locale:e.locale,transport:t},Te.current++,Ke.current.cancel(),_e.current=null,V(!1),ht(Js(ot,e.locale,(Q,ee)=>t.transcribe(Q,ee))))},[e.locale,ot,t]),Tt(()=>()=>{Te.current++,he.cancel()},[he]);let b=$(B=>{let Q=_e.current;if(Q===null)return!1;let ee=Math.round(performance.now()-Q);return Pr[B]("voiceStop",{durationMs:ee}),r.emit("voiceStop",{durationMs:ee}),_e.current=null,!0},[r]),U=$(()=>{_e.current!==null&&(he.stop(),V(!1),b("info")&&n.play("voiceStop"))},[b,n,he]),J=$(()=>{Te.current++,he.cancel(),V(!1),b("info")&&n.play("voiceStop")},[b,n,he]);D(()=>{(u||!d)&&J()},[d,J,u]),D(()=>{let B=Y.current;if(!B)return;let Q=B.getRootNode(),ee=hp(Q)?Q.activeElement:null;ee&&B.closest(`.${Ye}-panel`)?.contains(ee)||B.focus({preventScroll:!0})},[]),D(()=>{let B=Y.current;if(!B)return;if(g.length===0){B.style.height="";return}B.style.height="auto";let Q=getComputedStyle(B),ee=Number.parseFloat(Q.getPropertyValue(`--${Ye}-textarea-base-height`)),me=Number.parseFloat(Q.borderTopWidth)+Number.parseFloat(Q.borderBottomWidth),it=Math.min(B.scrollHeight+me,Number.parseFloat(Q.maxHeight)),zt=Number.parseFloat(Q.fontSize)*.7;B.style.height=`${it<ee+zt?ee:it}px`},[g]);let Z=F(w);Z.current=w,D(()=>()=>{Z.current.forEach(yr);for(let B of L.current)B.attachments.forEach(yr)},[]),Tt(()=>{if(C)return C.current={attachFromDrop:B=>{if(!ye||!Ue.current||G.current||gt.current)return;let Q=Wa(B,Z.current,e.attachments);Q.accepted.length!==0&&(Pr.info("attach (drop)",{count:Q.accepted.length,totalBytes:xr(Q.accepted)}),r.emit("attach",{count:Q.accepted.length,totalBytes:xr(Q.accepted)}),T(ee=>[...ee,...Q.accepted]))},fill:B=>{if(!Ue.current||G.current||gt.current)return;He(B);let Q=Y.current;Q&&(Q.focus({preventScroll:!0}),requestAnimationFrame(()=>Q.setSelectionRange(Q.value.length,Q.value.length)))},acceptQueuedMessage:Ee},()=>{C.current&&(C.current=null)}},[C,ye,u,e.attachments,Ee,He]),D(()=>{let B=Y.current;if(!B)return;let Q=B.closest(`.${Ye}-panel`);if(!Q)return;let ee=me=>{if(!Ue.current||G.current||gt.current)return;let it=me.clipboardData;if(!it)return;let zt=me.target?.closest?.("input, textarea, [contenteditable]:not([contenteditable='false'])");if(zt&&zt!==B)return;if(ye){let At=Wa(it.items,Z.current,e.attachments);if(At.accepted.length>0){me.preventDefault(),Pr.info("attach (paste)",{count:At.accepted.length,totalBytes:xr(At.accepted)}),r.emit("attach",{count:At.accepted.length,totalBytes:xr(At.accepted)}),T(le=>[...le,...At.accepted]);return}}if(zt===B)return;let Yt=it.getData("text/plain");Yt&&(me.preventDefault(),He(At=>At+Yt),B.focus())};return Q.addEventListener("paste",ee),()=>Q.removeEventListener("paste",ee)},[ye,e.attachments,He]);async function ae(){let B=g.trim();if(!B&&w.length===0||!d||vt||G.current||u)return;J(),G.current=!0,te(!0);let Q=g,ee=w;try{await P(B,ee)&&(He(me=>me===Q?"":me),T(me=>me!==ee?me:(ee.forEach(yr),Z.current=[],[])))}finally{G.current=!1,te(!1),requestAnimationFrame(()=>{let me=Y.current;if(!me||me.disabled||!Ue.current)return;let it=me.getRootNode(),zt=hp(it)?it.activeElement:null,Yt=zt?.getAttribute("data-testid");if(!(zt&&zt!==me&&Yt!==N.composerSend&&Yt!==N.composerStop)){if(Bh(it)){let At=it.host.ownerDocument;if(!At.hasFocus())return;let le=At.activeElement;if(le&&le!==it.host&&le!==At.body)return}me.focus({preventScroll:!0})}})}}function Re(){let B=g.trim();if(!B&&w.length===0||!d||!St||G.current||u)return;J();let Q=w;kt(ee=>[...ee,{id:Ct(),text:B,attachments:Q}]),He(""),T(ee=>ee!==Q?ee:(Z.current=[],[])),Y.current?.focus({preventScroll:!0})}D(()=>{dt&&(O.current=!1)},[dt]),D(()=>{let B=E[0];if(!B||!p||dt||O.current||K||u||!d)return;let Q=setTimeout(()=>{O.current=!0,P(B.text,B.attachments,B.id).then(ee=>{if(ee){Ee(B.id);return}O.current=!1})},300);return()=>clearTimeout(Q)},[d,p,u,P,dt,E,Ee,K]);function Pe(B){B.key!=="Enter"||B.shiftKey||B.isComposing||(B.preventDefault(),St&&(g.trim()||w.length>0)?Re():vt?y():ae())}function ve(B){let Q=B.target;if(!d||G.current||u){Q.value="";return}let ee=Wa(Q.files,w,e.attachments);ee.accepted.length>0&&(Pr.info("attach (file picker)",{count:ee.accepted.length,totalBytes:xr(ee.accepted)}),r.emit("attach",{count:ee.accepted.length,totalBytes:xr(ee.accepted)}),T(me=>[...me,...ee.accepted])),Q.value=""}function _t(B){!d||G.current||u||(Pr.info("removeAttachment",{id:B}),r.emit("removeAttachment",{id:B}),T(Q=>{let ee=Q.find(me=>me.id===B);return ee&&yr(ee),Q.filter(me=>me.id!==B)}))}function fe(){if(z){U();return}if(!d||!he.isSupported||G.current||u)return;let B=++Te.current;_e.current=performance.now(),Pr.info("voiceStart"),r.emit("voiceStart",void 0),V(!0),n.play("voiceStart"),he.start((Q,ee)=>{Te.current!==B||!Ue.current||gt.current||G.current||!ee||He(me=>`${me}${Q} `)},()=>{Te.current!==B||!Ue.current||(V(!1),b("debug"))})}let at=Ys[e.composer.sendButton.icon],qe=!!(g.trim()||w.length>0),qt=vt||s&&!qe;return l("div",{class:`${Ye}-composer`,part:"composer","data-testid":N.composer,children:[E.length>0?l("div",{class:`${Ye}-message-queue`,"aria-label":v.queueMessage,"data-testid":N.messageQueue,children:E.map(B=>l("div",{class:`${Ye}-attachment-chip ${Ye}-queued-message`,"data-testid":`${N.queuedMessage}-${B.id}`,children:[l("span",{class:`${Ye}-attachment-name ${Ye}-queued-text`,children:B.text||B.attachments.map(Q=>Q.name).join(", ")}),l("button",{type:"button",class:`${Ye}-attachment-remove`,onClick:()=>Ee(B.id),"aria-label":v.removeQueuedMessage,title:v.removeQueuedMessage,"data-testid":`${N.queuedMessageRemove}-${B.id}`,children:l(Bt,{})})]},B.id))}):null,w.length>0?l("div",{class:`${Ye}-attachments`,children:w.map(B=>l(vp,{attachment:B,onRemove:()=>_t(B.id),disabled:Ge},B.id))}):null,l("div",{class:`${Ye}-composer-row`,children:[l("div",{class:`${Ye}-composer-actions`,children:[ye?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:()=>De.current?.click(),disabled:Ge,"aria-label":v.attach,"data-testid":N.composerAttach,children:l(Id,{})}):null,he.isSupported?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:fe,disabled:Ge,"aria-label":z?v.micStop:v.micStart,"aria-pressed":z,"data-recording":z?"true":void 0,"data-testid":N.composerVoice,children:l(Ed,{})}):null]}),l("textarea",{ref:Y,name:"message",class:`${Ye}-textarea`,rows:1,value:g,placeholder:v.composerPlaceholder,onInput:B=>He(B.currentTarget.value),onKeyDown:Pe,disabled:Ge,"aria-label":v.composerPlaceholder,"data-testid":N.composerInput}),St&&qe?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:Re,disabled:Ge,"aria-label":v.queueMessage,title:v.queueMessage,"data-testid":N.composerSend,children:l(at,{})}):null,qt?l("button",{type:"button",class:`${Ye}-send`,onClick:y,disabled:Ge,"aria-label":v.stop,"data-testid":N.composerStop,children:l(Rd,{})}):null,!qt&&(!St||!qe)?l("button",{type:"button",class:`${Ye}-send`,"data-shape":e.composer.sendButton.shape,"data-variant":e.composer.sendButton.variant,onClick:()=>{ae()},disabled:Ge||!g.trim()&&w.length===0,"aria-label":v.send,"data-testid":N.composerSend,children:l(at,{})}):null,f&&h==="ai-agent"&&S?l("button",{type:"button",class:`${Ye}-icon-btn`,onClick:S,disabled:Ge||!m,"aria-label":v.talkToOperator,title:v.talkToOperator,"data-testid":N.operatorRequest,children:l(Gs,{})}):null]}),l("input",{ref:De,name:"attachments",type:"file",multiple:!0,accept:e.attachments.accept,onChange:ve,disabled:Ge,class:`${Ye}-sr-only`,"data-testid":N.composerFileInput})]})}var yp=A.cssPrefix;function Ga({onClick:e,children:t,testid:n}){return e?l("button",{type:"button",class:`${yp}-home-card`,"data-interactive":"true",onClick:e,"data-testid":n,children:t}):l("div",{class:`${yp}-home-card`,"data-testid":n,children:t})}function Ka(e){return e.trim().split(/\s+/).slice(0,2).map(t=>t.charAt(0).toUpperCase()).join("")}var Ut=A.cssPrefix,Uh=ne.scope("news"),Hh=10;function Zs(e,t){let n=e?new Date(e):void 0;if(!(!n||Number.isNaN(n.getTime())))return new Intl.DateTimeFormat(t,{dateStyle:"medium"}).format(n)}function qh({options:e,transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}){let c=r.contentCollectionIds,[p,_]=H({items:[],loading:!0}),d=F(void 0);function u(S){if(!c?.length)return;let P={};d.current=P,_(y=>({...y,loading:!0,error:void 0})),t.listContent({contentCollectionIds:c,sortBy:"publishedAt",sortOrder:"desc",page:S,limit:Hh}).then(y=>{if(d.current!==P||(_(v=>({items:S>1?[...v.items,...y.items]:y.items,pagination:y.pagination,loading:!1})),S>1))return;a.emit("contentView",{section:"news",count:y.items.length});let C=y.items[0];C&&s.markSeen(C.id)}).catch(y=>{d.current===P&&(Uh.warn("listContent (news) failed",{err:y,page:S}),_(C=>({...C,loading:!1,error:zn(y,n)})))})}function f(){p.loading||u((p.pagination?.page??0)+1)}D(()=>(_({items:[],loading:!0}),u(1),()=>{d.current=void 0}),[t,c]);function m(S){let P=Zs(S.publishedAt,e.locale);return l("button",{type:"button",class:`${Ut}-news-card`,onClick:()=>o.push({kind:"content",id:S.id,title:S.title}),"data-testid":ut(N.newsItem,S.id),children:[S.image?l("img",{class:`${Ut}-news-hero`,src:S.image,alt:"",loading:"lazy"}):null,l("span",{class:`${Ut}-news-body`,children:[l("span",{class:`${Ut}-news-title`,children:S.title}),P||S.tags?.length?l("span",{class:`${Ut}-news-meta`,children:[P?l("time",{dateTime:S.publishedAt,children:P}):null,S.tags?.map(y=>l("span",{class:`${Ut}-news-tag`,children:y},y))]}):null,S.description?l("span",{class:`${Ut}-news-summary`,children:S.description}):null]})]},S.id)}function h(){if(!c?.length)return l(Ot,{message:n.newsEmpty,strings:n});let S=p.error?l(Ot,{tone:"error",message:p.error,onRetry:f,strings:n}):null;return S&&!p.pagination?S:p.pagination?p.items.length?l("div",{class:`${Ut}-news-list`,children:[p.items.map(m),S,p.pagination.hasNext&&!S?l("button",{type:"button",class:`${Ut}-news-more`,onClick:f,"aria-busy":p.loading,"data-testid":N.newsMore,children:[p.loading?l("span",{class:`${Ut}-loading-spinner`,"aria-hidden":"true"}):null,n.newsShowMore]}):null]}):l(Ot,{message:n.newsEmpty,strings:n}):l(Ot,{message:n.newsLoading,strings:n})}return l("div",{class:`${Ut}-module`,children:[l(qa,{title:n.newsTitle,actions:l(Qt,{panelProps:i,variant:"plain"})}),l("div",{class:`${Ut}-module-scroll`,children:h()})]})}var Pp={Icon:Fa,Root:e=>l(qh,{...e})};var ge=A.cssPrefix,xp=ne.scope("home");function zh(e){let t=e.options.userContext?.name,n=e.config.greetingText?bt(e.strings,e.config.greetingText):void 0;if(n){let r=t?n.replace("{name}",t):n.replace(/\s*\{name\}\s*/," ").trim(),o=e.strings.homeGreetingLead;return{title:r,subtitle:r.toLowerCase()===o.toLowerCase()?void 0:o}}return t?{title:e.strings.homeGreetingNamed.replace("{name}",t),subtitle:e.strings.homeGreetingLead}:{title:e.strings.homeGreeting}}function jh(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 Vh({options:e,onAsk:t}){let[n,r]=H(""),{sendButton:o}=e.composer,a=Ys[o.icon];function i(s){s.preventDefault();let c=n.trim();c&&(r(""),t(c))}return l("form",{class:`${ge}-home-search ${ge}-home-ask`,"data-input":"true",onSubmit:i,"data-testid":N.homeAsk,children:[l("input",{type:"text",class:`${ge}-home-search-input`,placeholder:e.strings.homeAskPlaceholder,"aria-label":e.strings.homeAskPlaceholder,value:n,enterKeyHint:"send",onInput:s=>r(s.currentTarget.value)}),l("button",{type:"submit",class:`${ge}-send`,"data-shape":o.shape,"data-variant":o.variant,disabled:!n.trim(),"aria-label":e.strings.send,children:l(a,{})})]})}function Sp(e,t){return ln(e,t,t.type!=="upsert"||t.activity===!0)}function Wh(e){let{transport:t,strings:n,config:r,nav:o,bus:a,panelProps:i,latestNews:s}=e,[c,p]=H(null),[_,d]=H([]),u=r.contentCollectionIds?.join(","),f=e.options.modules.list.some(g=>g.layout==="chat");D(()=>{if(r.showRecentConversations===!1)return;let g=!1,k=!0,w=[],T=t.subscribeConversationChanges(E=>{k&&w.push(E),p(M=>Sp(M?[M]:[],E)[0]??null)});return t.listConversations({limit:f?50:1}).then(E=>{if(g)return;let M=w.reduce(Sp,E.conversations);w=[],k=!1,p(M[0]??null)}).catch(E=>{g||(w=[],k=!1,xp.warn("listConversations (home) failed",{err:E}))}),()=>{g=!0,T()}},[t,r.showRecentConversations,f]),D(()=>{if(!r.contentCollectionIds?.length)return;let g=!1;return t.listContent({contentCollectionIds:r.contentCollectionIds,pinned:!0,limit:6}).then(k=>{g||(d(k.items),a.emit("contentView",{section:"home",count:k.items.length}))}).catch(k=>!g&&xp.warn("listContent (home) failed",{err:k})),()=>{g=!0}},[t,u,a]);let m=zh(e),h=r.userAvatars??[],S=r.status,P=S?.text?bt(n,S.text):n.homeStatus,y=r.contentBlockTitle?bt(n,r.contentBlockTitle):n.homeContentTitle,C=s.item,v=Zs(C?.publishedAt,e.options.locale);return l("div",{class:`${ge}-module ${ge}-home`,"data-testid":N.homeView,children:l("div",{class:`${ge}-home-scroll`,children:[l("div",{class:`${ge}-home-hero`,children:[l("div",{class:`${ge}-home-hero-top`,children:[r.brandName?l("span",{class:`${ge}-home-brand`,"data-testid":N.homeBrand,children:r.brandName}):l("span",{class:`${ge}-home-brand-spacer`,"aria-hidden":"true"}),l("div",{class:`${ge}-home-hero-actions`,children:[h.length>0?l("div",{class:`${ge}-home-avatars`,children:h.map(g=>l("span",{class:`${ge}-home-avatar`,title:g.role?`${g.name} \xB7 ${g.role}`:g.name,children:g.avatar?l("img",{src:g.avatar,alt:"",loading:"lazy"}):l("span",{children:Ka(g.name)})},g.name))}):null,l(Qt,{panelProps:i,variant:"plain"})]})]}),r.showGreeting!==!1?l(de,{children:[l("h1",{class:`${ge}-home-greeting`,"data-testid":N.homeGreeting,children:m.title}),m.subtitle?l("p",{class:`${ge}-home-lead`,children:m.subtitle}):null]}):null]}),l("div",{class:`${ge}-home-cards`,children:[f?l(Vh,{options:e.options,onAsk:g=>o.startNewConversation(g)}):null,r.showSearchBar!==!1?l(pp,{placeholder:n.homeSearchPlaceholder,onActivate:()=>o.switchToLayout("help")}):null,C?l(Ga,{onClick:()=>{s.markSeen(C.id),o.push({kind:"content",id:C.id,title:C.title})},testid:N.homeWhatsNew,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":s.unseen?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(Fa,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:n.homeWhatsNew}),l("span",{class:`${ge}-home-recent-preview`,children:v?`${C.title} \xB7 ${v}`:C.title})]}),s.unseen?l("span",{class:`${ge}-home-recent-dot`,role:"img","aria-label":n.newsUnseen}):null]})}):null,c?l(Ga,{onClick:()=>o.selectConversation(c),testid:N.homeRecent,children:l("div",{class:`${ge}-home-recent-row`,"data-unread":c.hasUnread?"true":void 0,children:[l("span",{class:`${ge}-home-recent-avatar`,"aria-hidden":"true",children:l(uo,{})}),l("span",{class:`${ge}-home-recent-body`,children:[l("span",{class:`${ge}-home-recent-title`,children:c.title}),c.preview?l("span",{class:`${ge}-home-recent-preview`,children:ja(c.preview)}):null]}),c.hasUnread?l("span",{class:`${ge}-home-recent-dot`,"aria-label":"Unread"}):null]})}):null,S?l(Ga,{onClick:S.url?()=>o.push({kind:"iframe",url:S.url,title:P}):void 0,children:l("div",{class:`${ge}-home-status`,"data-level":S.level??"operational",children:[l("span",{class:`${ge}-home-status-icon`,"aria-hidden":"true",children:l(Vd,{})}),l("span",{class:`${ge}-home-status-text`,children:P})]})}):null,_.length>0?l("section",{class:`${ge}-home-content`,children:[l("div",{class:`${ge}-home-content-title`,children:y}),l("div",{class:`${ge}-home-content-list`,children:_.map(g=>l(Va,{title:g.title,subtitle:g.description,onClick:()=>jh(o,g),testid:ut(N.homeContentRow,g.id)},g.id))})]}):null]})]})})}var kp={Icon:Wd,Root:e=>l(Wh,{...e})};var Qa={chat:dp,home:kp,help:mp,news:Pp};var fo=A.cssPrefix;function wp({modules:e,activeTab:t,strings:n,hasUnread:r,onSelect:o}){return l("nav",{class:`${fo}-tabbar`,role:"tablist","aria-label":n.panelTitle,children:e.map(a=>{let i=Qa[a.layout].Icon,s=a.id===t,c=a.layout==="chat"&&r;return l("button",{type:"button",role:"tab","aria-selected":s,class:`${fo}-tab`,onClick:()=>o(a.id),"data-testid":ut(N.tab,a.id),children:[l("span",{class:`${fo}-tab-icon`,"aria-hidden":"true",children:[l(i,{}),c?l("span",{class:`${fo}-tab-badge`,"data-testid":N.tabBadge,"aria-label":"Unread"}):null]}),l("span",{class:`${fo}-tab-label`,children:bt(n,a.label)})]},a.id)})})}var Cp=A.cssPrefix,Gh="allow-scripts allow-forms allow-popups allow-popups-to-escape-sandbox allow-downloads";function Tp({url:e,title:t,strings:n,onBack:r,actions:o}){return l("div",{class:`${Cp}-module`,children:[l(za,{title:t||n.moduleBack,backLabel:n.moduleBack,onBack:r,actions:o}),l("iframe",{class:`${Cp}-content-frame`,src:e,title:t||"content",sandbox:Gh,referrerpolicy:"no-referrer",loading:"lazy",allow:"fullscreen"})]})}var el=A.cssPrefix;function Rp({agent:e,strings:t}){let n=e.status??"online",r=bt(t,e.name),o=e.title?bt(t,e.title):null;return l("div",{class:`${el}-agent`,children:[l("div",{class:`${el}-agent-avatar`,"data-status":n,children:e.avatar?l("img",{src:e.avatar,alt:""}):l("span",{children:Ka(r)})}),l("div",{class:`${el}-agent-meta`,children:[l("strong",{children:r}),o?l("span",{children:o}):null]})]})}var Kh=["today","yesterday","lastWeek","older"];function Qh(e,t){let n=Date.parse(t);if(!Number.isFinite(n))return"older";let r=Math.floor((Ip(e)-Ip(n))/(1440*60*1e3));return r<=0?"today":r===1?"yesterday":r<7?"lastWeek":"older"}function Ep(e,t){let n=new Map;for(let r of t){let o=Qh(e,r.lastMessageAt),a=n.get(o);a?a.push(r):n.set(o,[r])}return Kh.filter(r=>n.has(r)).map(r=>({bucket:r,conversations:n.get(r)}))}function Ip(e){let t=new Date(e);return t.setUTCHours(0,0,0,0),t.getTime()}var Ap=ne.scope("history"),Xh=3,Jh=6,Yh={today:"dateToday",yesterday:"dateYesterday",lastWeek:"dateLastWeek",older:"dateOlder"};function Mp(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=ln(e.conversations.slice(0,t.result.pagination.limit),t,n);if(t.result.conversations.length===0){if(o.length===0)return t.result;let p=Math.max(t.result.pagination.total,o.length);return{...t.result,conversations:o,pagination:{...t.result.pagination,total:p,totalPages:Math.ceil(p/t.result.pagination.limit)}}}let a=new Set(o.map(p=>p.conversationId)),i=e.conversations.slice(t.result.pagination.limit).filter(p=>!a.has(p.conversationId)),s=e.pagination.page,c={...t.result.pagination,page:s,hasPrev:s>1,hasNext:s<t.result.pagination.totalPages};return{conversations:[...o,...i],pagination:c}}let r=ln(e.conversations,t,n);return r===e.conversations?e:{...t.type==="snapshot"?t.result:e,conversations:r}}function Zh(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 Xa({transport:e,strings:t,locale:n,persistence:r,onSelect:o,onNewConversation:a}){let i=A.cssPrefix,s=e.peekConversations({limit:50}),[c,p]=H(s?"loaded":"loading"),[_,d]=H(s),[u,f]=H(!1),m=F(void 0),h=_?.conversations??[],S=_?.pagination;D(()=>{let g=!1,k=!0,w=[],T=e.subscribeConversationChanges(M=>{k&&w.push(M),d(L=>L&&Mp(L,M))});m.current=void 0,f(!1);let E=e.peekConversations({limit:50});return d(E),p(E?"loaded":"loading"),e.listConversations({limit:50}).then(M=>{if(g)return;let L=M;for(let O of w)L=Mp(L,O);w=[],k=!1,d(L),p("loaded"),r.saveHistoryCount(L.conversations.length)}).catch(M=>{g||(w=[],k=!1,Ap.warn("listConversations failed",{err:M}),p("error"))}),()=>{g=!0,T(),m.current=void 0}},[e,r,n]);async function P(){if(m.current||!S?.hasNext)return;let g={};m.current=g,f(!0);try{let k=await e.listConversations({page:S.page+1,limit:S.limit});if(m.current!==g)return;d(w=>{if(!w)return w;let T=new Set(w.conversations.map(L=>L.conversationId)),E=k.conversations.filter(L=>T.has(L.conversationId)?!1:(T.add(L.conversationId),!0)),M={conversations:[...w.conversations,...E],pagination:k.pagination};return r.saveHistoryCount(M.conversations.length),M})}catch(k){if(m.current!==g)return;Ap.warn("listConversations page failed",{err:k,page:S.page+1})}finally{m.current===g&&(m.current=void 0,f(!1))}}let y=a?l("div",{class:`${i}-history-footer`,children:l("button",{type:"button",class:`${i}-history-new`,onClick:a,"data-testid":N.sidebarNewConversation,children:[l(kd,{}),t.newConversation]})}):null;if(c==="loading"){let g=Math.min(r.loadHistoryCount()??Xh,Jh);return l(de,{children:[l("div",{class:`${i}-history`,"aria-busy":"true","aria-label":t.historyLoading,children:l("div",{class:`${i}-history-group`,"aria-hidden":"true",children:[l("div",{class:`${i}-history-heading`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-heading`})}),l("div",{class:`${i}-history-card`,children:Array.from({length:Math.max(1,g)},(k,w)=>l("div",{class:`${i}-history-item ${i}-history-item-skeleton`,children:[l("span",{class:`${i}-history-avatar ${i}-skeleton`}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-title`})}),l("span",{class:`${i}-history-time`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-time`})})]}),l("span",{class:`${i}-history-row`,children:l("span",{class:`${i}-history-preview`,children:l("span",{class:`${i}-skeleton ${i}-skeleton-preview`})})})]})]},w))})]})}),y]})}if(c==="error"||h.length===0)return l(de,{children:[l("div",{class:`${i}-history-empty`,children:t.historyEmpty}),y]});let C=Date.now(),v=Ep(C,h);return l(de,{children:[l("div",{class:`${i}-history`,role:"list",children:[v.map(g=>l("div",{class:`${i}-history-group`,children:[l("div",{class:`${i}-history-heading`,children:t[Yh[g.bucket]]}),l("div",{class:`${i}-history-card`,children:g.conversations.map(k=>l("div",{role:"listitem",children:l("button",{type:"button",class:`${i}-history-item`,onClick:()=>o(k),"data-closed":k.canContinue?void 0:"true","data-unread":k.hasUnread?"true":void 0,"data-testid":ut(N.historyItem,k.conversationId),children:[l("span",{class:`${i}-history-avatar`,"aria-hidden":"true",children:l(Ws,{})}),l("span",{class:`${i}-history-body`,children:[l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-title`,children:k.title}),l("span",{class:`${i}-history-time`,children:Zh(k.lastMessageAt,C,n)})]}),l("span",{class:`${i}-history-row`,children:[l("span",{class:`${i}-history-preview`,children:k.preview&&ja(k.preview)||(k.canContinue?t.historyContinue:t.conversationClosed)}),k.hasUnread?l("span",{class:`${i}-history-dot`}):null]})]})]})},k.conversationId))})]},g.bucket)),S?.hasNext?l("div",{class:`${i}-history-more`,children:l("button",{type:"button",onClick:P,disabled:u,"aria-busy":u,"data-testid":N.historyLoadMore,children:t.loadMoreConversations})}):null]}),y]})}var eb=A.cssPrefix;function Np({visible:e,strings:t}){return e?l("div",{class:`${eb}-dropzone`,role:"status","aria-live":"polite",children:t.dropZone}):null}var tb=/^[^\s@]+@[^\s@]+\.[^\s@]+$/,nb=/^https?:\/\/[^\s.]+\.[^\s]+$/i,rb=/^[+]?[\d\s().-]{6,}$/;function Sr(e,t){return e.replace(/\{(\w+)\}/g,(n,r)=>String(t[r]??`{${r}}`))}function ob(e){return Array.isArray(e)?e.length:e?.trim()?1:0}function ab(e,t,n){let r=e.required??!0,o=e.validation;if(e.type==="multiselect"){let i=ob(t);return r&&i===0?n.formRequired:i===0?void 0:o?.minSelections!=null&&i<o.minSelections?Sr(n.formChooseAtLeast,{min:o.minSelections}):o?.maxSelections!=null&&i>o.maxSelections?Sr(n.formChooseAtMost,{max:o.maxSelections}):void 0}let a=typeof t=="string"?t.trim():"";if(!a)return r?n.formRequired:void 0;switch(e.type){case"email":if(!tb.test(a))return n.formInvalidEmail;break;case"url":if(!nb.test(a))return n.formInvalidUrl;break;case"tel":if(!rb.test(a))return n.formInvalidTel;break;case"number":{let i=Number(a);if(!Number.isFinite(i))return n.formInvalidNumber;if(o?.min!=null&&i<o.min)return Sr(n.formNumberTooSmall,{min:o.min});if(o?.max!=null&&i>o.max)return Sr(n.formNumberTooLarge,{max:o.max});break}default:break}if(o?.minLength!=null&&a.length<o.minLength)return Sr(n.formTooShort,{min:o.minLength});if(o?.maxLength!=null&&a.length>o.maxLength)return Sr(n.formTooLong,{max:o.maxLength});if(o?.pattern)try{if(!new RegExp(o.pattern).test(a))return n.formPatternMismatch}catch{}}function Lp(e,t,n){let r={};for(let o of e){let a=ab(o,t[o.name],n);a&&(r[o.name]=a)}return r}function Op(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 Le=A.cssPrefix,mo="__other__";function go({fields:e,strings:t,submitLabel:n,onSubmit:r,skipLabel:o,onSkip:a,footerHint:i,submitOnEnter:s,disabled:c,initialValues:p,hideActions:_,fieldTypeLabels:d,rootTestId:u,submitTestId:f,skipTestId:m}){let[h,S]=H(()=>({...cb(e),...p})),[P,y]=H({}),[C,v]=H({});function g(M){C[M]&&v(L=>({...L,[M]:""}))}function k(M,L){S(O=>({...O,[M]:L})),g(M)}function w(M,L){y(O=>({...O,[M]:L})),g(M)}function T(M){if(M.preventDefault(),c)return;let L=ub(e,h,P),O=Lp(e,L,t);if(Object.keys(O).length>0){v(O);return}r(Op(L))}function E(M){!s||M.key!=="Enter"||M.shiftKey||M.isComposing||!M.target||!("tagName"in M.target)||M.target.tagName!=="TEXTAREA"||T(M)}return l("form",{class:`${Le}-form`,onSubmit:T,onKeyDown:E,"data-testid":u,noValidate:!0,children:[e.map(M=>l(ib,{field:M,value:h[M.name],otherText:P[M.name]??"",error:C[M.name],disabled:c,typeLabel:d?.[M.name],strings:t,onChange:L=>k(M.name,L),onOtherChange:L=>w(M.name,L)},M.name)),_?null:l("div",{class:`${Le}-form-actions`,children:[i?l("span",{class:`${Le}-form-hint`,children:i}):null,o&&a?l("button",{type:"button",class:`${Le}-form-skip`,onClick:a,disabled:c,"data-testid":m,children:o}):null,l("button",{type:"submit",class:`${Le}-form-submit`,disabled:c,"data-testid":f,children:n})]})]})}function ib({field:e,value:t,otherText:n,error:r,disabled:o,typeLabel:a,strings:i,onChange:s,onOtherChange:c}){let p=ut(N.formField,e.name),_=sb({field:e,value:t,otherText:n,disabled:o,strings:i,onChange:s,onOtherChange:c,fieldTid:p});return l("label",{class:`${Le}-field`,"data-field":e.name,"data-invalid":r?"true":void 0,children:[l("span",{class:`${Le}-field-head`,children:[l("span",{class:`${Le}-field-label`,children:[e.label,e.required??!0?l("span",{class:`${Le}-field-req`,"aria-hidden":"true",children:" *"}):null]}),a?l("span",{class:`${Le}-field-type`,children:a}):null]}),_,e.validationHint&&!r?l("span",{class:`${Le}-field-hint`,children:e.validationHint}):null,r?l("span",{class:`${Le}-field-error`,role:"alert",children:r}):null]})}function sb(e){let{field:t,value:n,otherText:r,disabled:o,strings:a,onChange:i,onOtherChange:s,fieldTid:c}=e,p=typeof n=="string"?n:"",_=t.type==="select"?a.formOtherPlaceholder:t.placeholder??a.formOtherPlaceholder,d=t.allowOther&&p===mo?l("input",{class:`${Le}-field-input`,value:r,placeholder:_,disabled:o,onInput:f=>s(f.currentTarget.value)}):null;switch(t.type){case"textarea":return l("textarea",{class:`${Le}-field-input`,rows:3,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c});case"select":return l(de,{children:[l("select",{class:`${Le}-field-input`,value:p,disabled:o,onChange:f=>i(f.currentTarget.value),"data-testid":c,children:[l("option",{value:"",children:t.placeholder??"\u2014"}),(t.options??[]).map(f=>l("option",{value:f.value,children:f.label??f.value},f.value)),t.allowOther?l("option",{value:mo,children:a.formOther}):null]}),d]});case"radio":return l("div",{class:`${Le}-field-choices`,role:"radiogroup","data-testid":c,children:[(t.options??[]).map(f=>l("label",{class:`${Le}-choice`,children:[l("input",{type:"radio",name:`${Le}-${t.name}`,checked:p===f.value,disabled:o,onChange:()=>i(f.value)}),l("span",{children:f.label??f.value})]},f.value)),t.allowOther?l("label",{class:`${Le}-choice`,children:[l("input",{type:"radio",name:`${Le}-${t.name}`,checked:p===mo,disabled:o,onChange:()=>i(mo)}),l("span",{children:a.formOther})]}):null,d]});case"checkbox":return l("label",{class:`${Le}-choice`,children:[l("input",{type:"checkbox",checked:p==="true",disabled:o,onChange:f=>i(f.currentTarget.checked?"true":""),"data-testid":c}),l("span",{children:t.placeholder??t.label})]});case"multiselect":{let m=function(h,S){return i(S?[...f,h]:f.filter(P=>P!==h))};var u=m;let f=Array.isArray(n)?n:[];return l("div",{class:`${Le}-field-choices`,"data-testid":c,children:[(t.options??[]).map(h=>l("label",{class:`${Le}-choice`,children:[l("input",{type:"checkbox",checked:f.includes(h.value),disabled:o,onChange:S=>m(h.value,S.currentTarget.checked)}),l("span",{children:h.label??h.value})]},h.value)),t.allowOther||(t.options??[]).length===0?l("textarea",{class:`${Le}-field-input`,rows:2,value:r,placeholder:t.placeholder??a.formOtherPlaceholder,disabled:o,onInput:h=>s(h.currentTarget.value)}):null]})}default:return l("input",{...lb(t.type),class:`${Le}-field-input`,value:p,placeholder:t.placeholder,disabled:o,onInput:f=>i(f.currentTarget.value),"data-testid":c})}}function lb(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 cb(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 ub(e,t,n){let r={...t};for(let o of e){let a=n[o.name]?.trim();if((o.type==="radio"||o.type==="select")&&o.allowOther&&t[o.name]===mo)r[o.name]=a??"";else if(o.type==="multiselect"&&a){let i=a.split(/[,\n;]+/).map(c=>c.trim()).filter(Boolean),s=t[o.name];r[o.name]=[...Array.isArray(s)?s:[],...i]}}return r}var Jt=A.cssPrefix;function tl({form:e,strings:t,onSubmit:n,onSkip:r}){return l("div",{class:`${Jt}-form-gate`,"data-testid":N.formGate,children:[e.title?l("h3",{class:`${Jt}-form-gate-title`,children:e.title}):null,e.description?l("p",{class:`${Jt}-form-gate-desc`,children:e.description}):null,l(go,{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:N.formSubmit,skipTestId:N.formSkip})]})}function $p({marker:e,strings:t,onFill:n}){let r=e.outcome==="skipped",o=r?t.formSkipped:t.formSubmitted,a=e.title?l(de,{children:[l("span",{children:e.title}),l("span",{class:`${Jt}-sr-only`,children:o})]}):l("span",{children:o}),i=e.form?.reviewable??!1,s=!r&&i&&e.values&&Object.keys(e.values).length>0?e.values:null;if(s){let p=function(_){return e.form?.fields.find(d=>d.name===_)?.label??_};var c=p;return l("details",{class:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,children:[l("summary",{class:`${Jt}-form-done-summary`,"data-testid":N.formDoneToggle,children:[l(qn,{}),a,l(mr,{})]}),l("dl",{class:`${Jt}-form-answers`,"data-testid":N.formAnswers,children:Object.entries(s).map(([_,d])=>l("div",{class:`${Jt}-form-answer`,children:[l("dt",{children:p(_)}),l("dd",{children:d})]},_))})]})}return l("div",{class:`${Jt}-form-done`,"data-outcome":e.outcome,"data-testid":N.formDone,role:"status",children:[r?l(Hd,{}):l(qn,{}),a,r&&e.form?.reopenable&&n?l("button",{type:"button",class:`${Jt}-form-done-fill`,"data-testid":N.formFill,onClick:n,children:t.formFillOut}):null]})}var Dp=Object.assign;function _b(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 fb=/^(-|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|asp|fill|st)/;function Up(e,t){function n(o){var a=this.props.ref;return a!=o.ref&&a&&(typeof a=="function"?a(null):a.current=null),t?!t(this.props,o)||a!=o.ref:_b(this.props,o)}function r(o){return this.shouldComponentUpdate=n,vn(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.type=e,r}var mb=Symbol.for("react.element"),gb=/^(?: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]/,vb=/[A-Z0-9]/g,hb=typeof document<"u";var bb=function(e){return/fil|che|rad/.test(e)};Dt.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(Dt.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Fp=pe.event;pe.event=function(e){return Fp&&(e=Fp(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var yb={configurable:!0,get:function(){return this.class}},Bp=pe.vnode;pe.vnode=function(e){if(typeof e.type=="string")(function(r){var o=r.props,a=r.type,i={},s=a.indexOf("-")==-1;for(var c in o){var p=o[c];if(!(c=="value"&&"defaultValue"in o&&p==null||hb&&c=="children"&&a=="noscript"||c=="class"||c=="className")){if(c=="style"&&p&&p.constructor==Object){var _=void 0;for(var d in p)typeof p[d]!="number"||fb.test(d)||(_||(_=p=Dp({},p)),p[d]+="px")}else if(c=="defaultValue"&&"value"in o&&o.value==null)c="value";else if(c=="download"&&p===!0)p="";else if(c=="translate"&&p==="no")p=!1;else if(c[0]=="o"&&c[1]=="n"){var u=c.toLowerCase();u=="ondoubleclick"?c="ondblclick":u!="onchange"||a!="input"&&a!="textarea"||bb(o.type)?u=="onfocus"?c="onfocusin":u=="onblur"&&(c="onfocusout"):u=c="oninput",u=="oninput"&&i[c=u]&&(c="oninputCapture")}else s&&gb.test(c)?c=c.replace(vb,"-$&").toLowerCase():p===null&&(p=void 0);i[c]=p}}a=="select"&&(i.multiple&&Array.isArray(i.value)&&(i.value=Ho(o.children).forEach(function(f){f.props.selected=i.value.indexOf(f.props.value)!=-1})),i.defaultValue!=null&&(i.value=Ho(o.children).forEach(function(f){f.props.selected=i.multiple?i.defaultValue.indexOf(f.props.value)!=-1:i.defaultValue==f.props.value}))),o.class&&!o.className?(i.class=o.class,Object.defineProperty(i,"className",yb)):o.className&&(i.class=i.className=o.className),r.props=i})(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=Dp({},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=mb,Bp&&Bp(e)};var Ja=A.cssPrefix;function Hp({messageId:e,initial:t,strings:n,onFeedback:r}){let[o,a]=H(t);D(()=>a(t),[e,t]);function i(s){let c=o===s?null:s;a(c),r(e,c)}return l("div",{class:`${Ja}-feedback`,role:"group","data-testid":N.messageFeedback,children:[l("button",{type:"button",class:`${Ja}-msg-action`,"data-active":o==="up"?"true":void 0,"aria-pressed":o==="up","aria-label":n.feedbackUp,title:n.feedbackUp,onClick:()=>i("up"),"data-testid":N.feedbackUp,children:l(Jd,{})}),l("button",{type:"button",class:`${Ja}-msg-action`,"data-active":o==="down"?"true":void 0,"aria-pressed":o==="down","aria-label":n.feedbackDown,title:n.feedbackDown,onClick:()=>i("down"),"data-testid":N.feedbackDown,children:l(Yd,{})}),l("span",{class:`${Ja}-sr-only`,role:"status","aria-live":"polite",children:o?n.feedbackThanks:""})]})}var Pb=new Set(["hidden","submit","button","reset","image","file","password"]);function zp(e){return e instanceof HTMLInputElement||e instanceof HTMLSelectElement||e instanceof HTMLTextAreaElement}function xb(e){return!zp(e)||e.name===""||e.disabled?!1:!(e instanceof HTMLInputElement&&Pb.has(e.type))}function Sb(e){let t=e.labels?.[0]?.textContent?.trim();return e.getAttribute("toolparamdescription")??(t||e.getAttribute("aria-description"))??void 0}function kb(e,t){let n=Sb(e),r=n?{description:n}:{};return e instanceof HTMLSelectElement?{...r,type:"string",enum:[...e.options].map(o=>o.value)}:e instanceof HTMLTextAreaElement?{...r,type:"string"}:e.type==="checkbox"?{...r,type:"boolean"}:e.type==="radio"?{...r,type:"string",enum:t}:e.type==="number"||e.type==="range"?{...r,type:"number"}:{...r,type:"string"}}function wb(e,t){Object.getOwnPropertyDescriptor(Reflect.getPrototypeOf(e)??e,"value")?.set?.call(e,t),e.dispatchEvent(new Event("input",{bubbles:!0})),e.dispatchEvent(new Event("change",{bubbles:!0}))}function qp(e){return e==null?"":typeof e=="string"?e:JSON.stringify(e)}function Cb(e,t){if(e instanceof HTMLInputElement&&e.type==="checkbox"){e.checked!==(t===!0||t==="true")&&e.click();return}if(e instanceof HTMLInputElement&&e.type==="radio"){e.value===qp(t)&&!e.checked&&e.click();return}wb(e,qp(t))}function Tb(e,t,n){var i;let r=[...e.elements].filter(xb),o={},a=new Set;for(let s of r){let c=r.flatMap(p=>p instanceof HTMLInputElement&&p.type==="radio"&&p.name===s.name?[p.value]:[]);o[i=s.name]??(o[i]=kb(s,c)),s.required&&a.add(s.name)}return{name:t,description:n,inputSchema:{type:"object",properties:o,...a.size>0?{required:[...a]}:{}},execute(s){let c=typeof s=="object"&&s!==null?Object.entries(s):[];for(let[_,d]of c)for(let u of r)u.name===_&&Cb(u,d);if(!e.hasAttribute("toolautosubmit"))return"Filled in the form. The visitor still needs to check it and press its submit button.";let p=[...new Set([...e.elements].flatMap(_=>zp(_)&&_.name&&!_.checkValidity()?[_.name]:[]))];return p.length>0?`Filled in the form, but it can't be submitted yet: ${p.join(", ")} still needs the visitor. Ask them to complete it and press the submit button.`:(setTimeout(()=>e.requestSubmit(),0),"Filled in the form and submitted it.")}}}function jp(){return[...document.querySelectorAll("form[toolname][tooldescription]")].flatMap(e=>{let t=e.getAttribute("toolname")?.trim()??"",n=e.getAttribute("tooldescription")?.trim()??"";return t&&n?[Tb(e,t,n)]:[]})}var Vp=`${A.cssPrefix}.page-tools`,Rb=20,Ib=50;function Ya(e){return typeof e=="object"&&e!==null}function Eb(e){return Ya(e)&&(e.state==="running"||e.state==="stopped"||e.state==="finished"&&Ya(e.outcome))}function Ab(e){let t=e?JSON.parse(e):void 0;if(!Ya(t))return{sent:[],calls:{}};let n=Array.isArray(t.sent)?t.sent.filter(o=>typeof o=="string"):[],r=Object.fromEntries(Object.entries(Ya(t.calls)?t.calls:{}).filter(o=>Eb(o[1])));return{sent:n,calls:r}}var rl={sent:[],calls:{}};function vo(){try{rl=Ab(sessionStorage.getItem(Vp))}catch{}return rl}function nl(e){rl=e;try{sessionStorage.setItem(Vp,JSON.stringify(e))}catch{}}var It={markSent(e){let t=vo();nl({...t,sent:[...t.sent.filter(n=>n!==e),e].slice(-Rb)})},sentHere(e){return vo().sent.includes(e)},get(e){return vo().calls[e]},set(e,t){let n=vo(),r=Object.entries(n.calls).filter(([o])=>o!==e);nl({...n,calls:Object.fromEntries([...r,[e,t]].slice(-Ib))})},clear(e){let t=vo();e.some(n=>n in t.calls)&&nl({...t,calls:Object.fromEntries(Object.entries(t.calls).filter(([n])=>!e.includes(n)))})}};var Xp=ne.scope("page-tools"),Wp="site__",Gp=3e4,Mb=1e3,Kp=Symbol.for(`${A.cssPrefix}.page-tools`),al={state:"output-error",errorText:"The page reloaded before this finished, so it may or may not have taken effect. Check with the visitor before trying it again."},Jp="The visitor stopped this before it finished.";function kn(e){return typeof e=="object"&&e!==null}function Nb(e){return kn(e)&&Array.isArray(e.registered)&&e.runs instanceof Map}function ho(){let e=Reflect.get(globalThis,Kp);if(Nb(e))return e;let t={registered:[],runs:new Map};return Reflect.set(globalThis,Kp,t),t}function Yp(e,t){let n=kn(t)&&t.signal instanceof AbortSignal?t.signal:void 0;if(n?.aborted)return;let r=ho().registered;r.push(e);function o(){let a=r.indexOf(e);a>=0&&r.splice(a,1)}n?.addEventListener("abort",o,{once:!0})}function Qp(e){return e.replace(/[^A-Za-z0-9_-]/g,"_").slice(0,58)}function Zp(e){if(!kn(e)||typeof e.name!="string"||!Qp(e.name))return;let t=[e.description,e.title].find(n=>typeof n=="string"&&n.trim()!=="")??e.name;return{name:Qp(e.name),description:t.trim().slice(0,1024),inputSchema:{properties:{},...kn(e.inputSchema)?e.inputSchema:{},type:"object"},consequential:kn(e.annotations)&&e.annotations.consequentialHint===!0}}function ol(e){return e.flatMap(t=>{let n=Zp(t),r=kn(t)?t.execute:void 0;return!n||typeof r!="function"?(Xp.warn("skipped a tool without a name or an execute function",t),[]):[{...n,run:(o,a)=>Reflect.apply(r,t,[o,{signal:a}])}]})}async function Lb(){let e=Reflect.get(document,"modelContext")??Reflect.get(navigator,"modelContext");if(!kn(e)||typeof e.getTools!="function"||typeof e.executeTool!="function")return[];let t=e.getTools,n=e.executeTool,r=await Promise.race([Promise.resolve().then(()=>Reflect.apply(t,e,[])),Hn(Mb).then(()=>[])]).catch(()=>[]);return(Array.isArray(r)?r:[]).flatMap(o=>{let a=Zp(o);return a?[{...a,run:(i,s)=>Reflect.apply(n,e,[o,i,{signal:s}])}]:[]})}async function Za(e=[]){let t=ol(jp()),n=new Set(t.map(a=>a.name)),o=[...(await Lb()).filter(a=>!n.has(a.name)),...t,...ol(e),...ol(ho().registered)];return new Map(o.map(a=>[a.name,a]))}function il(e){return[...e.values()].map(({name:t,description:n,inputSchema:r,consequential:o})=>o?{name:t,description:n,inputSchema:r,annotations:{consequentialHint:!0}}:{name:t,description:n,inputSchema:r})}function Wt(e){return e?.execution==="client"}function bo(e){return e.startsWith(Wp)?e.slice(Wp.length):e}function Ob(e){if(e===void 0||typeof e=="function"||typeof e=="symbol")return null;let t=new WeakSet,n=JSON.stringify(e,(r,o)=>{if(typeof o=="bigint")return o.toString();if(!(typeof o=="function"||typeof o=="symbol"))return o instanceof Node?`[${o.nodeName.toLowerCase()}]`:kn(o)?t.has(o)?"[circular]":(t.add(o),o):o});return n.length>Gp?{truncated:!0,preview:n.slice(0,Gp)}:JSON.parse(n)}async function $b(e){let t=bo(e.toolName),n=(await Za(e.optionTools)).get(t);return n?Promise.resolve().then(()=>n.run(e.input,e.signal)).then(r=>({state:"output-available",output:Ob(r)})).catch(r=>(Xp.warn("a page tool failed",{name:t,error:r}),{state:"output-error",errorText:(r instanceof Error?r.message:String(r)).slice(0,1e3)||"The page tool failed."})):{state:"output-error",errorText:`This page doesn't offer "${t}" right now; the visitor may have moved on. Tell them, or continue without it.`}}function e_(e){let{toolCallId:t}=e,n=It.get(t);if(n?.state==="finished")return Promise.resolve(n.outcome);let{runs:r}=ho(),o=r.get(t);if(o)return o.outcome;if(n?.state==="running")return It.set(t,{state:"finished",outcome:al}),e.onSettled("interrupted",0),Promise.resolve(al);let a=new AbortController,i=performance.now();It.set(t,{state:"running"});let s=$b({...e,signal:a.signal}).then(c=>(r.delete(t),It.get(t)?.state!=="running"||(It.set(t,{state:"finished",outcome:c}),e.onSettled(c.state==="output-available"?"completed":"failed",Math.round(performance.now()-i))),c));return r.set(t,{outcome:s,controller:a}),s}function ei(e){return e===al.errorText||e===Jp}function sl(e){return It.set(e,{state:"stopped"}),ho().runs.get(e)?.controller.abort(),Jp}function t_(e){It.clear([e]),ho().runs.get(e)?.controller.abort()}var Ht=A.cssPrefix;function ll(e){let t=e.replace(/([a-z0-9])([A-Z])/g,"$1 $2").replace(/[_-]+/g," ").trim().toLowerCase();return t.charAt(0).toUpperCase()+t.slice(1)}function kr(e){if(e.startsWith("tool:")||e.startsWith("tool-"))return e.slice(5);let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?`${ll(e.slice(0,t))} \xB7 ${ll(n)}`:e}function ti(e){let t=e.indexOf("__"),n=e.slice(t+2);return t>0&&n?ll(n):kr(e)}function ni(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 ul({status:e,icon:t,label:n}){return l("span",{class:`${Ht}-toolui-badge ${Ht}-toolui-status`,"data-status":e,children:[l("span",{class:`${Ht}-toolui-status-icon`,children:t}),n]})}function Db(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 wr(e,t,n={}){return n.submitted?"responded":n.incomplete?"incomplete":Ub(Db(e,t),n.superseded,n.live??!0)}function Fb({status:e}){return e==="denied"||e==="error"||e==="superseded"||e==="incomplete"?l(vr,{}):e==="completed"||e==="responded"?l(gr,{}):l(Zd,{})}function Bb(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;case"incomplete":return t.statusIncomplete;default:return t.statusRunning}}function Ub(e,t,n){return t&&(e==="awaiting"||e==="running")?"superseded":!n&&e==="running"?"error":e}function Hb({state:e,approval:t,strings:n,superseded:r,live:o=!0,submitted:a=!1,incomplete:i=!1}){let s=wr(e,t,{superseded:r,live:o,submitted:a,incomplete:i});return l(ul,{status:s,icon:l(Fb,{status:s}),label:Bb(s,n)})}function qb({name:e,state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}){return l(de,{children:[l("span",{class:`${Ht}-toolui-name-pill`,children:[l(Ba,{}),l("span",{class:`${Ht}-toolui-name-text`,children:e})]}),l(Hb,{state:t,approval:n,strings:r,superseded:o,live:a,submitted:i,incomplete:s}),l("span",{class:`${Ht}-toolui-chevron`,children:l(cn,{})})]})}function ri({part:e,strings:t,testid:n,superseded:r,live:o,submitted:a,incomplete:i}){let s=ue(()=>Se(()=>e.inputSig.value),[e]),c=ue(()=>Se(()=>e.outputSig.value),[e]),p=ue(()=>Se(()=>e.errorSig.value),[e]),_=ue(()=>Se(()=>e.stateSig.value),[e]),d=ue(()=>Se(()=>e.approvalSig.value),[e]),u=ue(()=>Se(()=>Wt(e.toolMetadata)&&ei(e.errorSig.value)),[e]),f=i===!0||u.value;return l("details",{class:`${Ht}-toolui ${Ht}-toolui-collapsible`,"data-testid":n,children:[l("summary",{class:`${Ht}-toolui-head`,children:l(qb,{name:kr(e.toolName),state:_.value,approval:d.value,strings:t,superseded:r,live:o,submitted:a,incomplete:f})}),l(jn,{label:t.toolParameters,value:s.value}),c.value!==void 0?l(jn,{label:t.toolResult,value:c.value}):null,p.value&&!f?l(jn,{label:t.statusError,value:p.value,error:!0}):null]})}function jn({label:e,value:t,error:n}){let r=n?typeof t=="string"?t:"":cl(n_(t));return r?l("div",{class:`${Ht}-toolui-section`,children:[l("span",{class:`${Ht}-toolui-label`,children:e}),l("pre",{class:`${Ht}-toolui-code`,"data-error":n?"true":void 0,children:r})]}):null}function oi(e){return!!cl(e.inputSig.value)||!!e.errorSig.value||!!cl(n_(e.outputSig.value))}function n_(e){if(e&&typeof e=="object"){let t=e;if(t.storage==="tool-result-ref"&&"summary"in t)return t.summary}return e}function cl(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 r_(e){return e.partsSig.value.some(t=>t.kind==="text"&&t.textSig.value.length>0)}function o_(e){return e.partsSig.value.some(t=>t.kind==="reasoning")}function zb(e){return e.streaming&&!e.bufferedHold&&!(e.reasoningVisible&&e.working)}function a_(e){let{streaming:t,reasoningVisible:n,emptyReply:r,hidden:o}=e,a=e.responseMode==="buffered"&&t,i=t&&!e.hasAnswerText;return{streaming:t,bufferedHold:a,reasoningVisible:n,working:i,showStreamDots:zb({streaming:t,bufferedHold:a,reasoningVisible:n,working:i}),emptyReply:r,hidden:o}}function i_(e,t){let n=e.stateSig.value,r=e.approvalSig.value,{terminal:o,responded:a,decided:i}=ni(n,r),s=t.continuationStreaming===!0&&!i,c=t.superseded&&!i&&!s;return{pill:wr(n,r,{superseded:c,live:t.live,submitted:s,incomplete:Wt(e.toolMetadata)&&ei(e.errorSig.value)}),state:n,terminal:o,decided:i||s,showApproveReject:!i&&!t.superseded&&!s,showAnswered:a&&!o&&!c,showSubmitted:s,showEdit:a&&t.active&&!o,skipped:c,answeredApproved:r?.approved}}var Cr=A.cssPrefix;function s_({part:e,strings:t}){let n=e.title||e.filename||e.url||t.sources;return e.url?l("a",{class:`${Cr}-source`,href:e.url,target:"_blank",rel:"noreferrer noopener","data-testid":N.source,children:[l("span",{class:`${Cr}-source-icon`,"aria-hidden":"true",children:"\u{1F517}"}),l("span",{class:`${Cr}-source-label`,children:n})]}):l("span",{class:`${Cr}-source`,"data-testid":N.source,children:[l("span",{class:`${Cr}-source-icon`,"aria-hidden":"true",children:"\u{1F4C4}"}),l("span",{class:`${Cr}-source-label`,children:n})]})}var Et=A.cssPrefix,jb=4;function Vb(e){return!e||typeof e!="object"||Array.isArray(e)?[]:Object.entries(e).flatMap(([t,n])=>typeof n=="string"?n.trim()?[{key:t,value:n.trim()}]:[]:typeof n=="number"||typeof n=="boolean"?[{key:t,value:String(n)}]:[]).slice(0,jb)}function l_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.approvalSig.value),[e]),c=ue(()=>Se(()=>i_(e,{active:n,superseded:r,continuationStreaming:o})),[e,n,r,o]).value,{terminal:p,showApproveReject:_,showAnswered:d,showSubmitted:u,showEdit:f,skipped:m}=c,h=kr(e.toolName),S=c.answeredApproved,P=e.toolCallId,y=Vb(e.inputSig.value),C=l(de,{children:[l("p",{class:`${Et}-toolui-prompt`,children:t.approvalPrompt.replace("{tool}",h)}),y.length>0?l("dl",{class:`${Et}-toolui-fields`,"data-testid":N.toolApprovalFields,children:y.map(({key:g,value:k})=>l("div",{children:[l("dt",{children:g}),l("dd",{title:k,children:k})]},g))}):null,l("p",{class:`${Et}-toolui-subtle`,children:t.approvalBody})]});u?C=l("p",{class:`${Et}-toolui-subtle`,children:t.approvalSubmitting}):d&&S!==!1?C=l(de,{children:[l("p",{class:`${Et}-toolui-prompt`,children:[t.approvalYourResponse.replace("{decision}",S?t.approve:t.reject),s.value?.reason?` \u2014 ${s.value.reason}`:""]}),f?l("p",{class:`${Et}-toolui-subtle`,children:t.approvalEditHint}):null,f?null:l("p",{class:`${Et}-toolui-subtle`,children:t.approvalSubmitting})]}):d&&(C=l(de,{}));let v=_||u||f||d&&S!==!1;return l("div",{class:`${Et}-toolui-group`,"data-testid":c.decided?N.toolDecision:N.toolApproval,children:[l(ri,{part:e,strings:t,superseded:m,submitted:u}),m||p||!v?null:l("div",{class:`${Et}-toolui ${Et}-toolui-body`,children:[C,_?l("div",{class:`${Et}-toolui-actions`,children:[l("button",{type:"button",class:`${Et}-form-skip`,disabled:!n,onClick:()=>a(P,!1),"data-testid":N.toolReject,children:t.reject}),l("button",{type:"button",class:`${Et}-form-submit`,disabled:!n,onClick:()=>a(P,!0),"data-testid":N.toolApprove,children:t.approve})]}):null,f?l("div",{class:`${Et}-toolui-actions`,children:l("button",{type:"button",class:`${Et}-form-skip`,onClick:()=>i(P),"data-testid":N.toolEdit,children:t.edit})}):null]})]})}var Wb=["text","email","phone","number","date","single-select","multi-select","boolean"];function c_(e){return e!==null&&typeof e=="object"}function u_(e){let t=c_(e)?e:{},r=(Array.isArray(t.questions)?t.questions:[]).map(Gb).filter(o=>o!==null);return{intro:ai(t.intro),questions:r}}function Gb(e,t){if(!c_(e))return null;let n=Wb.find(r=>r===e.type)??"text";return{key:ai(e.key)??`q${t+1}`,question:ai(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:ai(e.helpText)}}function Kb(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 dl(e,t,n){return e.questions.map(r=>{let o=Kb(r.type),a=r.type==="boolean"?[{value:"yes",label:t},{value:"no",label:n}]:(r.options??[]).map(i=>({value:i,label:i}));return{name:r.key,label:r.question,type:o,required:r.required??!1,options:a.length>0?a:void 0,validationHint:r.helpText}})}function ai(e){return typeof e=="string"&&e.trim()?e.trim():void 0}var Ze=A.cssPrefix;function Qb({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 Xb={text:"qtypeText",email:"qtypeEmail",phone:"qtypePhone",number:"qtypeNumber",date:"qtypeDate","single-select":"qtypeChooseOne","multi-select":"qtypeChooseAny",boolean:"qtypeBoolean"};function d_(e,t){let n={};for(let r of e)n[r.key]=t[Xb[r.type]];return n}function p_({part:e,strings:t,active:n,superseded:r=!1,continuationStreaming:o=!1,onDecision:a,onEdit:i}){let s=ue(()=>Se(()=>e.stateSig.value),[e]).value,c=ue(()=>Se(()=>e.approvalSig.value),[e]).value,p=ue(()=>Se(()=>u_(e.inputSig.value)),[e]).value,{terminal:_,decided:d}=ni(s,c),u=d&&c?.approved===!0,f=o&&!d,m=!d&&!r&&!f,h=!m&&!u&&!f,S=u&&n&&!_,P=p.questions,[y,C]=H(null),g=y??(m||u||f),[k,w]=H(!1),T=P.length>1?Vs:co,E=m?t.inputRequired:t.inputBadge,M=f?l("p",{class:`${Ze}-toolui-subtle`,children:t.approvalSubmitting}):m?l(Jb,{req:p,strings:t,active:n,resolve:(z,V)=>a(e.toolCallId,V,z)}):k?l(go,{fields:dl(p,t.confirmYes,t.confirmNo),strings:t,submitLabel:t.inputSubmit,onSubmit:()=>{},disabled:!0,hideActions:!0,fieldTypeLabels:d_(P,t),initialValues:u?ny(P,c?.reason):void 0}):l(Yb,{questions:P,answers:u?ty(c?.reason):{},strings:t}),{status:L,statusLabel:O}=Qb({skipped:h,submitted:f,strings:t});return l("details",{class:`${Ze}-toolui ${Ze}-toolui-collapsible${r?` ${Ze}-toolui-stale`:""}`,open:g,onToggle:z=>{let V=z.currentTarget.open;V!==g&&C(V)},"data-testid":m?N.toolAskQuestions:N.toolDecision,children:[l("summary",{class:`${Ze}-toolui-head`,children:[l("span",{class:`${Ze}-toolui-q-pill`,children:[l(T,{}),E]}),l("span",{class:`${Ze}-toolui-head-end`,children:[m?null:l(ul,{status:L,icon:h?l(vr,{}):l(gr,{}),label:O}),l("span",{class:`${Ze}-toolui-chevron`,children:l(cn,{})})]})]}),l("div",{class:`${Ze}-toolui-collapse-body`,children:[p.intro?l("div",{class:`${Ze}-toolui-desc`,children:p.intro}):null,M,m||f?null:l("div",{class:`${Ze}-toolui-footer`,children:[l("button",{type:"button",class:`${Ze}-toolui-options-toggle`,onClick:()=>w(z=>!z),"data-testid":N.toolAskOptions,children:[l("span",{class:`${Ze}-toolui-options-chevron${k?` ${Ze}-open`:""}`,children:l(cn,{})}),k?t.hideOptions:t.showOptions]}),S?l("button",{type:"button",class:`${Ze}-form-skip`,onClick:()=>i(e.toolCallId),"data-testid":N.toolEdit,children:t.edit}):null]})]})]})}function Jb({req:e,strings:t,active:n,resolve:r}){let o=dl(e,t.confirmYes,t.confirmNo),a=e.questions.length===1&&e.questions[0]?.type==="text";return l(go,{fields:o,strings:t,disabled:!n,submitLabel:t.inputSubmit,footerHint:a?t.inputSubmitHint:void 0,onSubmit:i=>r(ey(e.questions,i),!0),skipLabel:t.inputSkip,onSkip:()=>r(void 0,!1),submitOnEnter:a,fieldTypeLabels:d_(e.questions,t),submitTestId:N.toolInputSubmit,skipTestId:N.toolInputSkip})}function Yb({questions:e,answers:t,strings:n}){return l("div",{class:`${Ze}-toolui-summary`,"data-testid":N.toolAskSummary,children:e.map(r=>l("div",{class:`${Ze}-field`,children:[l("span",{class:`${Ze}-field-head`,children:l("span",{class:`${Ze}-field-label`,children:[r.question,r.required?l("span",{class:`${Ze}-field-req`,"aria-hidden":"true",children:" *"}):null]})}),l("p",{class:`${Ze}-toolui-answer`,children:Zb(r,t[r.key],n)||"\u2014"})]},r.key))})}function Zb(e,t,n){return e.type!=="boolean"?t??"":t==="yes"?n.confirmYes:t==="no"?n.confirmNo:t??""}function ey(e,t){let n=e.flatMap(r=>{let o=t[r.key];if(o==null||o.trim()==="")return[];let a=r.type==="multi-select"?o.split(",").map(i=>i.trim()).filter(Boolean):o;return[{key:r.key,value:a}]});return JSON.stringify({answers:n})}function __(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:a,value:i}=o;if(typeof a!="string")continue;typeof i=="string"?r[a]=i:Array.isArray(i)&&(r[a]=i.filter(s=>typeof s=="string"))}return r}function ty(e){let t=__(e),n={};for(let[r,o]of Object.entries(t))n[r]=Array.isArray(o)?o.join(", "):o;return n}function ny(e,t){let n=__(t),r={};for(let o of e){let a=n[o.key];a!==void 0&&(o.type==="multi-select"?r[o.key]=Array.isArray(a)?a:[a]:r[o.key]=Array.isArray(a)?a[0]??"":a)}return r}function f_({part:e,strings:t,live:n,superseded:r}){let o=Wt(e.toolMetadata);if(!ue(()=>Se(()=>oi(e)),[e]).value&&!o)return null;let i=e.outputSig.value===void 0&&!e.errorSig.value;return l(ri,{part:e,strings:t,testid:N.toolCall,live:n||o&&!r,incomplete:o&&r&&i})}var Me=A.cssPrefix;function m_(e){if(e.kind!=="tool")return!1;let t=e.stateSig.value;return t!=="approval-requested"&&t!=="approval-responded"&&!e.toolMetadata?.card&&!Wt(e.toolMetadata)}function g_(e,t){let n=[];for(let[r,o]of e.entries()){let a=n.at(-1);if(o.kind==="reasoning"&&t.showReasoning||m_(o)&&oi(o)){a?.kind==="steps"?(a.parts.push(o),a.indices.push(r)):n.push({kind:"steps",parts:[o],indices:[r]});continue}o.kind==="step-start"||o.kind==="reasoning"||o.kind==="source"&&!t.showSources||m_(o)||n.push({kind:"part",part:o,index:r})}return n}function ry(e){if(!(!e||typeof e!="object"))return Object.values(e).find(t=>typeof t=="string"&&t.trim().length>0)?.trim()}function v_({parts:e,strings:t,live:n,running:r}){let[o,a]=H(!1),i=e.filter(d=>d.kind==="tool"),s=i.filter(d=>wr(d.stateSig.value,d.approvalSig.value,{live:n})==="error").length,c=new Map;for(let d of i)c.set(ti(d.toolName),(c.get(ti(d.toolName))??0)+1);let p=e.at(-1),_=p?.kind==="tool"?`${ti(p.toolName)}\u2026`:t.thinking;return l("div",{class:`${Me}-steps`,"data-testid":N.toolSteps,"data-running":r?"true":void 0,children:[l("button",{type:"button",class:`${Me}-steps-head`,"aria-expanded":o,onClick:()=>a(!o),children:[l("span",{class:`${Me}-steps-icon`,"aria-hidden":"true",children:r?l("span",{class:`${Me}-loading-spinner`}):l(Ba,{})}),l("span",{class:`${Me}-steps-label`,children:r?_:[...c].map(([d,u],f)=>l("span",{class:`${Me}-steps-name`,children:[f>0?l("span",{"aria-hidden":"true",children:"\xB7"}):null,l("span",{class:`${Me}-steps-name-text`,children:d}),u>1?l("span",{class:`${Me}-steps-count`,children:["\xD7",u]}):null]},d))}),!r&&s>0?l("span",{class:`${Me}-steps-failed`,children:t.toolStepsFailed.replace("{count}",String(s))}):null,l("span",{class:`${Me}-toolui-chevron`,"data-open":o?"true":void 0,children:l(cn,{})})]}),l("span",{class:`${Me}-sr-only`,role:"status",children:r?_:""}),o?l("ol",{class:`${Me}-steps-list`,children:e.map((d,u)=>d.kind==="tool"?l(oy,{part:d,strings:t,live:n},d.toolCallId):l(iy,{part:d,strings:t},`${d.id}#${u}`))}):null]})}function oy({part:e,strings:t,live:n}){let[r,o]=H(!1),a=wr(e.stateSig.value,e.approvalSig.value,{live:n}),i=ry(e.inputSig.value);return l("li",{class:`${Me}-steps-row`,"data-testid":N.toolStep,"data-status":a,children:[l("button",{type:"button",class:`${Me}-steps-row-head`,"aria-expanded":r,onClick:()=>o(!r),children:[l("span",{class:`${Me}-steps-row-icon`,"aria-hidden":"true",children:l(ay,{status:a})}),l("span",{class:`${Me}-steps-row-name`,children:kr(e.toolName)}),i?l("span",{class:`${Me}-steps-row-summary`,children:i}):null,a==="error"?l("span",{class:`${Me}-steps-failed`,children:t.statusError}):null,a==="denied"?l("span",{class:`${Me}-steps-denied`,children:t.statusDenied}):null]}),r?l("div",{class:`${Me}-steps-row-body`,children:[l(jn,{label:t.toolParameters,value:e.inputSig.value}),e.outputSig.value!==void 0?l(jn,{label:t.toolResult,value:e.outputSig.value}):null,e.errorSig.value?l(jn,{label:t.statusError,value:e.errorSig.value,error:!0}):null]}):null]})}function ay({status:e}){return e==="running"?l("span",{class:`${Me}-loading-spinner`}):e==="error"||e==="denied"?l(vr,{}):l(gr,{})}function iy({part:e,strings:t}){let[n,r]=H(!1);return l("li",{class:`${Me}-steps-row`,"data-status":"thought",children:[l("button",{type:"button",class:`${Me}-steps-row-head`,"aria-expanded":n,onClick:()=>r(!n),children:l("span",{class:`${Me}-steps-row-name`,children:t.thoughts})}),n?l("div",{class:`${Me}-steps-row-body ${Me}-reasoning-body`,children:l(hr,{textSig:e.textSig,doneSig:e.doneSig})}):null]})}var Oe=A.cssPrefix,h_=Up(sy);function sy({message:e,status:t,strings:n,responseMode:r,showReasoning:o,showToolCalls:a,showSources:i,interactive:s=!1,superseded:c=!1,tool:p,onRetry:_,enableMessageFeedback:d=!1,onFeedback:u}){let m=[...ue(()=>Se(()=>e.partsSig.value),[e]).value];for(let G of e.attachments??[])!G.url||m.some(Y=>Y.kind==="file"&&Y.url===G.url)||m.push({kind:"file",url:G.url,mediaType:G.mediaType,filename:G.name,fileId:G.id,fileSize:G.size});let h=ue(()=>Se(()=>Fn(e)),[e]),S=ue(()=>Se(()=>id(e)),[e]),P=ue(()=>Se(()=>r_(e)),[e]),y=ue(()=>Se(()=>o&&o_(e)),[e,o]),C=t==="streaming",v=e.role==="assistant"&&C,g=a_({streaming:v,responseMode:r,reasoningVisible:y.value,hasAnswerText:P.value,emptyReply:h.value,hidden:S.value}),{bufferedHold:k,working:w,showStreamDots:T}=g;if(g.hidden)return null;let E=cy(e.createdAt),M=e.role==="assistant"||e.role==="operator",L=d&&!!u&&!!e.serverMessageId&&M&&!C&&t!=="error"&&!h.value,O=C?"":m.filter(G=>G.kind==="text").map(G=>e.role==="assistant"?Ca(G.textSig.peek()):G.textSig.peek()).join(`
62
62
 
63
- `).trim(),z=!C&&t!=="error"&&!v.value&&O.length>0,V=a?g_(m,{showReasoning:o,showSources:i}):m.map((G,Y)=>({kind:"part",part:G,index:Y}));function K(G,Y){return l(sy,{part:G,generativeUi:e.role==="assistant",active:w,live:h,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(G.kind!=="tool"||Ea(e,Y)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${py(G)}#${Y}`)}let te=L||z;return l("div",{class:`${Oe}-bubble-row`,"data-role":e.role,"data-testid":ut(N.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Oe}-bubble-col`,children:[l("div",{class:`${Oe}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Oe}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Oe}-bubble-body`,children:[k?l(fy,{label:n.loading}):V.flatMap((G,Y)=>G.kind==="part"?[K(G.part,G.index)]:G.parts.some(De=>De.kind==="tool")?[l(h_,{parts:G.parts,strings:n,live:h,running:h&&Y===V.length-1},`steps#${G.indices[0]}`)]:G.parts.map((De,_e)=>K(De,G.indices[_e]??_e))),T&&l(_y,{}),t==="error"||v.value?l("div",{class:`${Oe}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),_?l("button",{type:"button",class:`${Oe}-error-retry`,onClick:()=>_(e),"data-testid":N.messageRetry,children:n.errorRetry}):null]}):null]})]}),E||te?l("div",{class:`${Oe}-bubble-meta`,children:[E?l("time",{class:`${Oe}-bubble-time`,dateTime:E.iso,title:E.full,children:E.short}):null,te?l("div",{class:`${Oe}-bubble-actions`,children:[L&&e.serverMessageId?l(Hp,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,z?l(ay,{text:O,strings:n}):null]}):null]}):null]})})}function ay({text:e,strings:t}){let[n,r]=H(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${Oe}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":N.messageCopy,children:n?l(Hn,{}):l(Xd,{})})}function iy(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 sy({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:a,showToolCalls:i,showSources:s,interactive:c,superseded:p,continuationStreaming:_,tool:d}){switch(e.kind){case"step-start":return null;case"text":return l(vr,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l(dy,{part:e,active:n,strings:o}):null;case"tool":return l(uy,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:_,live:r,tool:d});case"file":return l(ly,{part:e,strings:o});case"source":return s?l(s_,{part:e,strings:o}):null}}function ly({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Oe}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:cy(e.fileSize);return l("a",{class:`${Oe}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:[l("span",{class:`${Oe}-file-chip-icon`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${Oe}-file-chip-text`,children:[l("span",{class:`${Oe}-file-chip-name`,children:n}),l("span",{class:`${Oe}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function cy(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function uy({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ue(()=>Se(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?e.toolMetadata?.card==="questions"?l(p_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(l_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(f_,{part:e,strings:t,live:i,superseded:o}):null}function dy({part:e,active:t,strings:n}){return l("details",{class:`${Oe}-reasoning`,"data-testid":N.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${Oe}-reasoning-summary`,children:l("span",{class:`${Oe}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${Oe}-reasoning-body`,children:l(vr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function py(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 _y(){return l("span",{class:`${Oe}-typing`,"data-testid":N.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function fy({label:e}){return l("span",{class:`${Oe}-loading`,role:"status",children:[l("span",{class:`${Oe}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Oe}-loading-label`,children:e})]})}var kn=A.cssPrefix,pl=120,my=350;function b_({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,enableMessageFeedback:i,onFeedback:s,loading:c,onLoadPreviousMessages:p,idle:_,controlMode:d="ai-agent",tool:u,onRetry:f,form:m,formMarkers:v,onFillForm:S}){let P=F(null),y=Rt(()=>e.value),[C,h]=H(!1),[g,k]=H(!1),w=F(!1),T=F(!1),[E,M]=H(),L=F(!1),O=F(!1),z=F(!1),V=F(0);function K(){return z.current||performance.now()-V.current<my}let te=F(0);function G(b){let U=b.scrollHeight-b.clientHeight>1;b.dataset.fadeTop=U&&b.scrollTop>1?"true":"false",b.dataset.fadeBottom=U&&b.scrollHeight-b.scrollTop-b.clientHeight>1?"true":"false"}function Y(b){return h(b.scrollHeight-b.scrollTop-b.clientHeight>pl*2)}function De(b){te.current=performance.now(),b.scrollTop=b.scrollHeight,G(b)}function _e(b,U){De(b);let J=U,Z=0;function ae(){O.current||K()||(De(b),--J>0&&(Z=requestAnimationFrame(ae)))}return U>0&&(Z=requestAnimationFrame(ae)),()=>cancelAnimationFrame(Z)}function Te(b,U){let J,Z,ae,Re=-1;function Pe(){J.disconnect(),Z.disconnect(),clearTimeout(ae)}function he(){if(O.current||K()||Re>=0&&b.scrollTop<Re-4)return Pe();De(b),Re=b.scrollTop}return J=new ResizeObserver(he),Z=new MutationObserver(he),he(),J.observe(b),Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),ae=setTimeout(Pe,U),Pe}let et=y.value[0]?.id;Tt(()=>{let b=P.current;if(b&&y.value.length!==0&&!T.current&&(L.current=!0,!!y.value.some(U=>U.role==="user")))return Te(b,300)},[et]);let Ue=F(0);D(()=>{let b=P.current,U=y.value,J=Ue.current;if(Ue.current=U.length,!b||!L.current||T.current)return;if(U.slice(J).some(ae=>ae.role==="user"))return O.current=!1,_e(b,3);if(!U.some(ae=>ae.role==="user")||O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<pl&&De(b)},[y.value.length]);let gt=F(null);D(()=>{let b=P.current,U=y.value.at(-1),J=gt.current;if(gt.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!b&&L.current&&!(!U||U.id!==J?.id||J.streaming||U.status!=="streaming"))return O.current=!1,_e(b,3)},[y.value]),D(()=>{let b=P.current;if(!b)return;let U=y.value.at(-1);if(!U||U.status!=="streaming"&&!y.value.some(ae=>ae.role==="user"))return;let J=()=>{if(O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<pl*2&&De(b)};if(U.status!=="streaming")return Te(b,300);J();let Z=new MutationObserver(J);return Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>Z.disconnect()},[y.value]);let Ge=m?.form.id,ht=!!m&&(v??[]).some(b=>b.formId===m.form.id);Tt(()=>{let b=P.current;!b||!Ge||O.current||y.value.some(U=>U.role==="user")&&(ht?b.querySelector(`[data-testid="${N.formGate}"]`)?.scrollIntoView({block:"nearest"}):De(b))},[Ge,ht]),D(()=>{let b=P.current;if(!b)return;let U=()=>{Y(b),G(b),performance.now()-te.current>150&&(O.current=b.scrollHeight-b.scrollTop-b.clientHeight>8)};function J(){O.current=!0}function Z(fe){fe.deltaY<0&&J()}let ae=0;function Re(fe){ae=fe.touches[0]?.clientY??0,z.current=!0}function Pe(fe){(fe.touches[0]?.clientY??0)>ae+4&&J()}function he(){z.current=!1,V.current=performance.now()}function _t(){z.current=!0}return b.addEventListener("scroll",U,{passive:!0}),b.addEventListener("wheel",Z,{passive:!0}),b.addEventListener("touchstart",Re,{passive:!0}),b.addEventListener("touchmove",Pe,{passive:!0}),b.addEventListener("touchend",he,{passive:!0}),b.addEventListener("touchcancel",he,{passive:!0}),b.addEventListener("pointerdown",_t,{passive:!0}),window.addEventListener("pointerup",he,{passive:!0}),window.addEventListener("pointercancel",he,{passive:!0}),Y(b),()=>{b.removeEventListener("scroll",U),b.removeEventListener("wheel",Z),b.removeEventListener("touchstart",Re),b.removeEventListener("touchmove",Pe),b.removeEventListener("touchend",he),b.removeEventListener("touchcancel",he),b.removeEventListener("pointerdown",_t),window.removeEventListener("pointerup",he),window.removeEventListener("pointercancel",he)}},[]);function xt(){let b=P.current;b&&(O.current=!1,De(b))}let dt=y.value.filter(b=>!b.ephemeral),St=dt[0],kt=St?.serverMessageId??St?.id,Ee=!!(p&&dt.length>=qs&&kt!==E);async function He(){if(!p||w.current)return;let b=P.current,U=b?.scrollHeight??0,J=b?.scrollTop??0;w.current=!0,T.current=!0,k(!0);try{let Z=await p();Z===!1&&kt&&M(kt),Z&&b&&(await new Promise(ae=>requestAnimationFrame(()=>requestAnimationFrame(()=>ae()))),b.scrollTop=J+b.scrollHeight-U,G(b),Y(b))}finally{T.current=!1,w.current=!1,k(!1)}}let ye=[],ot="",ve=y.value.at(-1)?.id,vt=[...v??[]].toSorted((b,U)=>(b.createdAt??1/0)-(U.createdAt??1/0));function Ke(b){return m&&b.formId===m.form.id?l(tl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${b.formId}`):l($p,{marker:b,strings:t,onFill:!m&&S?()=>S(b.formId):void 0},b.key)}function $t(b){for(let U=vt[0];U?.createdAt!==void 0&&!(b!==void 0&&U.createdAt>b);U=vt[0])vt.shift(),ye.push(Ke(U))}for(let b of y.value){if(b.role==="assistant"&&b.id!==ve&&Dn(b))continue;$t(b.createdAt);let U=gy(b.createdAt);U&&U!==ot&&(ye.push(l("div",{class:`${kn}-date-divider`,children:l("span",{class:`${kn}-date-pill`,title:hy(b.createdAt),children:vy(b.createdAt,t)})},`day:${U}`)),ot=U);let Z=b.retryAction!==void 0||b.role==="assistant"&&b.id===ve?Na(y.value,b):void 0,ae=Z!==void 0&&(Z.kind!=="continue-assistant"||d==="ai-agent");ye.push(l(v_,{message:b,status:b.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!_&&d==="ai-agent"&&b.id===ve,superseded:b.id!==ve,tool:u,onRetry:_&&ae&&(b.role==="user"||b.id===ve)?f:void 0,enableMessageFeedback:i,onFeedback:s},b.id))}for(let b of vt)ye.push(Ke(b));return l("div",{class:`${kn}-list-wrap`,children:[l("div",{ref:P,class:`${kn}-list ${kn}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&y.value.length===0?l("div",{class:`${kn}-list-loading`,role:"status",children:t.conversationLoading}):null,Ee?l("div",{class:`${kn}-load-previous`,children:l("button",{type:"button",onClick:He,disabled:g,"aria-busy":g,"data-testid":N.loadPreviousMessages,children:t.loadPreviousMessages})}):null,ye,m&&!ht?l(tl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),C?l("button",{type:"button",class:`${kn}-jump`,onClick:xt,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":N.scrollToBottom,children:l(ln,{})}):null]})}function gy(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function hy(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function vy(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.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"})}function ii({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=A.cssPrefix,s=F(null);if(D(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),_=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function d(m){if(!e)return;let v=m.currentTarget,S=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:S.width,startH:S.height,dirX:p?-1:1,dirY:c?1:-1},v.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;let S=(m.clientX-v.startX)*v.dirX,P=(m.clientY-v.startY)*v.dirY;e.style.setProperty(`--${i}-widget-w`,`${v.startW+S}px`),e.style.setProperty(`--${i}-widget-h`,`${v.startH+P}px`)}function f(m){let v=s.current;if(!v||m.pointerId!==v.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let S=e.getBoundingClientRect();o({width:Math.round(S.width),height:Math.round(S.height)}),s.current=null}return l("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":N.resizeGrip,children:l($d,{})})}var y_=A.cssPrefix;function P_({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${y_}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${y_}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":ut(N.suggestion,o),children:r.label},r.id))})}var jn=A.cssPrefix,by=`.${jn}-header, .${jn}-back-header, .${jn}-home-hero`,yy='button, a, input, textarea, select, [role="tab"], [contenteditable]',x_=56;function si(e,t){D(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(by)||p.closest(yy))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${jn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${jn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-x_,maxY:(window.innerHeight+_.height)/2-x_},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),_=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${jn}-modal-dx`,`${p}px`),e.style.setProperty(`--${jn}-modal-dy`,`${_}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function li({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=H(!1);return D(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(d){i+=1,d.dataTransfer?.types.includes("Files")&&(d.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(d){d.dataTransfer?.types.includes("Files")&&d.preventDefault()}function _(d){i=0,o(!1),d.dataTransfer&&(d.preventDefault(),t(d.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:r}}var We=A.cssPrefix;function S_(e){let{options:t,onClose:n}=e,r=t.strings,o=F(null);D(()=>{let p=o.current;if(!p)return;let _=Ha(p);function d(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",d),()=>{_(),p.removeEventListener("keydown",d)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=$(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=li({containerRef:o,onDrop:s,disabled:!i});return si(o.current,t.mode==="modal"),l("div",{ref:o,class:`${We}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":N.panel,children:[l(_l,{...e,containerEl:o.current,dragOver:c}),l(fl,{poweredBy:e.options.poweredBy})]})}function _l(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:_,isStreaming:d,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:v,controlMode:S,assignedOperatorInitials:P,operatorAvailable:y,operatorRequestEnabled:C,onRequestOperator:h,onCancelOperatorRequest:g,loadingMessages:k,onLoadPreviousMessages:w,messagesSig:T,agent:E,suggestions:M,initialWidgetSize:L,onClose:O,onBack:z,onClear:V,onToggleHistory:K,onSelectHistoryConversation:te,onNewConversation:G,onWidgetSizeChange:Y,onSend:De,onStop:_e,onSuggestion:Te,activeForm:et,formMarkers:Ue,onFormSubmit:gt,onFormSkip:Ge,onFormFill:ht,tool:xt,onRetry:dt,onMessageFeedback:St,containerEl:kt,dragOver:Ee,composerApiRef:He}=e,ye=t.strings,ot=Rt(()=>T.value.some(vt=>!vt.ephemeral&&vt.role!=="system")).value,ve;return et?.blocking?ve=null:_?ve=l(de,{children:[S&&S!=="ai-agent"?l(Sy,{controlMode:S,operatorInitials:P,operatorAvailable:y,onCancelOperatorRequest:g,strings:ye}):null,u&&S==="ai-agent"?l("div",{class:`${We}-loading ${We}-compaction-status`,role:"status","data-testid":N.compactionStatus,children:[l("span",{class:`${We}-loading-spinner`,"aria-hidden":"true"}),ye.compactingContext]}):null,!d&&!u&&S==="ai-agent"&&l(P_,{suggestions:M,onPick:Te,disabled:v}),l(bp,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:d,pageToolRunning:e.pageToolRunning,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:v,operatorRequestEnabled:C,canRequestOperator:ot,controlMode:S,onRequestOperator:h,onSend:De,onStop:_e,apiRef:He},s)]}):ve=l(xy,{label:ye.conversationClosed,ctaLabel:ye.startNewConversation,onNewConversation:V}),l(de,{children:[p==="history"?l(Py,{strings:ye,onBack:K,onClose:O,showClose:Oa(t.mode,c,t.actions)}):l("header",{class:`${We}-header`,part:"header","data-testid":N.panelHeader,children:[z?l("button",{type:"button",class:`${We}-icon-btn`,onClick:z,"aria-label":ye.moduleBack,title:ye.moduleBack,children:l(lo,{})}):null,E?l(Rp,{agent:E,strings:ye}):l("h1",{children:ye.panelTitle}),l(Qt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Xa,{transport:n,strings:ye,locale:t.locale,persistence:a,onSelect:te,onNewConversation:G}):l(de,{children:[l(Np,{visible:Ee,strings:ye}),l(b_,{messagesSig:T,strings:ye,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:St,loading:k,onLoadPreviousMessages:w,idle:!d&&!v&&_&&!et?.blocking,controlMode:S,tool:xt,onRetry:dt,form:et?{form:et,onSubmit:gt,onSkip:Ge}:null,formMarkers:Ue,onFillForm:ht}),ve,l(wy,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(ii,{panelEl:kt,resize:t.size.resize,position:t.position,initialSize:L,onSizeChange:Y,strings:ye}):null]})}function Py({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${We}-header`,part:"header",children:[l("button",{type:"button",class:`${We}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(lo,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${We}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null]})}function xy({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${We}-readonly-banner`,role:"note",children:[l("span",{class:`${We}-readonly-label`,children:e}),l("button",{type:"button",class:`${We}-readonly-cta`,onClick:n,children:t})]})}function Sy({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=ky(e,t,n,o);return l("div",{class:`${We}-operator-banner`,role:"status","data-mode":e,"data-testid":N.operatorBanner,children:[l("span",{class:`${We}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${We}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${We}-cancel-operator-request`,"data-testid":N.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function ky(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function wy({disclaimer:e}){return e?l("div",{class:`${We}-composer-footer`,children:l("div",{class:`${We}-disclaimer`,children:e})}):null}function fl({poweredBy:e}){return e?l("div",{class:`${We}-poweredby-bar`,children:l(Cy,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Cy({logoUrl:e,text:t,href:n}){let r=l(de,{children:[e?l("img",{class:`${We}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${We}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${We}-poweredby`,children:r})}var ci=A.cssPrefix;function k_({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,_=p.strings,d=F(null),u=F(new Set);D(()=>{let V=d.current;if(!V)return;let K=Ha(V);function te(G){G.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",te),()=>{K(),V.removeEventListener("keydown",te)}},[e.onClose]);let f=Rt(()=>n.sig.value).value,m=xd(f),v=p.modules.byId[f.activeTab],S=e.composerActive&&v?.layout==="chat"&&m===void 0,P=e.composerApiRef,y=S&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,C=$(V=>{y&&P.current?.attachFromDrop(V)},[P,y]),{visible:h}=li({containerRef:d,onDrop:C,disabled:!y});si(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",k=t.length>1&&(Sd(f)||!g),w=F(null);D(()=>{if(g&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&w.current!==null){let V=w.current;w.current=null,c(V)}},[g]);let T={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let K=t.find(te=>te.layout===V);K&&n.switchTab(K.id)},selectConversation:i,startNewConversation:s};function E(V){return{options:p,transport:e.transport,strings:_,config:V,nav:T,bus:r,panelProps:e,latestNews:a}}let M=l(Qt,{panelProps:e,variant:"plain"});v&&u.current.add(v.id);let L=t.filter(V=>u.current.has(V.id));function O(V){if(V.layout==="chat")return l(_l,{...e,composerActive:S,containerEl:d.current,dragOver:h});let K=Qa[V.layout].Root;return K?l(K,{...E(V)}):null}function z(){return m?.kind==="iframe"?l(Tp,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:M}):m?.kind==="content"?l(lp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:M}):null}return l("div",{ref:d,class:`${ci}-panel ${ci}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":N.messengerHome,children:[l("div",{class:`${ci}-messenger-body`,children:[L.map(V=>l("div",{class:`${ci}-messenger-pane`,hidden:g||V.id!==v?.id,children:O(V)},V.id)),z()]}),k?l(wp,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(fl,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(v?.layout==="chat"&&!m)?l(ii,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var yo=A.cssPrefix;function w_({strings:e,onClose:t}){return l("div",{class:`${yo}-panel ${yo}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":N.modulesEmpty,children:[t?l("button",{type:"button",class:`${yo}-icon-btn ${yo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null,l("p",{class:`${yo}-modules-empty-text`,children:e.modulesEmpty})]})}function C_(e){let t=A.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":N.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Ty,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":N.sidebarToggle,children:l(Ry,{collapsed:a})})]}),a?null:l(de,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(Iy,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(Ey,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Xa,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Ty({site:e}){let t=A.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??A.name})}function Ry({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 Iy({items:e}){let t=A.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 Ey({items:e}){let t=A.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 T_=A.cssPrefix;function R_(e){return l("main",{class:`${T_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(C_,{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:`${T_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var Po=ne.scope("hitl");function ui(e){return e.kind==="tool"&&Wt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function I_(e,t){t.errorSig.value=sl(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function Ay(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&It.sentHere(n.id)}function E_(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=F(t);c.current=t;let p=F(s);p.current=s;let _=F(new Map),[d,u]=H(!1),f=$((h,g,k)=>{if(c.current||n.value!=="ai-agent")return!1;let w=r.value.at(-1),T=w?.partsSig.value.findIndex(L=>L.kind==="tool"&&L.toolCallId===h)??-1,E=w?.partsSig.value[T];if(!w||E?.kind!=="tool")return Po.warn("decideTool: tool part not found",{toolCallId:h}),!1;if(w.status!=="complete"||!Ea(w,T)||!g(E))return!1;if(k(E),w.partsSig.value=[...w.partsSig.value],!Fn(w)||w.partsSig.value.some(ui))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let M=w.partsSig.value.flatMap(L=>L.kind==="tool"?[L.toolCallId]:[]);return o({continueExisting:!0}).then(L=>L&&It.clear(M)),!0},[n,r,o]),m=$((h,g)=>{let{toolCallId:k,toolName:w}=g;_.current.has(k)||(_.current.set(k,h),u(!0),e_({toolCallId:k,toolName:w,input:g.inputSig.value,optionTools:p.current??[],onSettled:(T,E)=>{Po.info("toolResult",{toolCallId:k,status:T}),a.emit("toolResult",{toolCallId:k,name:bo(w),status:T,durationMs:E})}}).then(T=>{_.current.delete(k)&&(u(_.current.size>0),f(k,ui,E=>{T.state==="output-available"?E.outputSig.value=T.output:E.errorSig.value=T.errorText,E.stateSig.value=T.state}))}))},[a,f]),v=$(()=>{let h=r.value;for(let[w,T]of _.current){let E=h.findIndex(M=>M.id===T);E<0||E===h.length-1||(_.current.delete(w),t_(w),u(_.current.size>0))}let g=h.at(-1);if(c.current||g?.role!=="assistant"||g.status!=="complete")return;let k=g.partsSig.value.filter(w=>ui(w)&&w.stateSig.value==="input-available");if(!(k.length===0||!Ay(h,g)))for(let w of k)It.get(w.toolCallId)?.state==="stopped"?I_(g,w):m(g.id,w)},[r,m]);D(()=>v(),[t,v]),D(()=>r.subscribe(()=>v()),[r,v]);let S=$((h,g,k)=>{let w=!1,T;if(!f(h,L=>L.stateSig.value==="approval-requested",L=>{Wt(L.toolMetadata)&&(T=L),w=L.toolMetadata?.card==="questions";let O=L.approvalSig.value?.id??h;L.approvalSig.value={id:O,approved:g,reason:k},L.stateSig.value="approval-responded"}))return;let M=r.value.at(-1);if(T&&g&&M&&m(M.id,T),T&&!g&&a.emit("toolResult",{toolCallId:h,name:bo(T.toolName),status:"declined",durationMs:0}),w){Po.info("toolResult",{toolCallId:h}),a.emit("toolResult",{toolCallId:h});return}Po.info("toolDecision",{toolCallId:h,approved:g}),a.emit("toolDecision",{toolCallId:h,approved:g})},[a,f,r,m]),P=$(h=>{f(h,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!ui(g),g=>{let k=g.approvalSig.value?.id??h;g.approvalSig.value={id:k},g.stateSig.value="approval-requested"})},[f]),y=ue(()=>({humanInLoop:i,onDecision:S,onEdit:P}),[i,S,P]),C=$(()=>{let h=r.value.at(-1);for(let g of _.current.keys()){let k=h?.partsSig.value.find(w=>w.kind==="tool"&&w.toolCallId===g);h&&k?I_(h,k):sl(g),Po.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:k?bo(k.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:y,pageToolsRunning:d,stopPageTools:C}}var My=ne.scope("latest-news");function A_({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=H(),[c,p]=H(()=>n.loadSeenNewsId());D(()=>{if(!r||!o?.length)return;let d=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{d||s(u.items[0])}).catch(u=>My.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=$(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function M_({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=H(()=>r?!1:t.loadCalloutDismissed(n));D(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=$(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function N_(e){let{transport:t,conversationIdSig:n}=e,r=Mt("ai-agent"),o=Mt(void 0),a=Mt(void 0),i=F(void 0),s=$(d=>{let u=d.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=d.controlMode,o.value=d.assignedOperatorInitials,d.controlMode!=="awaiting-operator"?a.value=void 0:d.operatorAvailable!==void 0&&(a.value=d.operatorAvailable))},[n,r,o,a]),c=$(d=>{if(d.type!=="data-control-state")return;let u=Ju(d.data);u&&s(u)},[s]),p=$(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=$(async()=>{let d=n.value,u=await t.cancelOperatorRequest();u&&n.value===d&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:_}}var di=A.cssPrefix,L_=`--${di}-visual-viewport-height`,O_=`--${di}-visual-viewport-top`;function $_(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Tt(()=>{Yo(t,$a(n,r,o))},[t,o,r,n]),Tt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${di}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(L_,`${c.height}px`),p.style.setProperty(O_,`${c.offsetTop}px`)},d=0,u=()=>{s.cancelAnimationFrame(d),d=s.requestAnimationFrame(()=>{d=s.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(d),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(L_),p.style.removeProperty(O_)}},[t,o,a]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${di}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),D(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var ml=ne.scope("reducer"),pi=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 r=an();r.id=t.id;let o=Vn(t)||Bn(t)&&(t.status!=="streaming"||Fn(t)),a=t.status==="streaming"&&Fn(t)&&no(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,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),a=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(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,D_(i,a),t.liveCatchUp&&Vn(t.shadow)&&(a.status==="streaming"||Bn(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=Vn(a)||Bn(a)&&(a.status!=="streaming"||Fn(a)),t.continuationTailReplay=a.status==="streaming"&&Fn(a)&&no(a),t.liveCatchUp=a.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),a=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(!a)return this.detach(),null;if(a===t)return t;D_(t,a);let i=Vn(t)&&Bn(a);return a.status!=="streaming"&&!i?(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 Ft(()=>{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=Aa(n);return this.replay=null,Ft(()=>{if(t){let a=n.partsSig.value.findLastIndex(i=>i.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 r)this.apply(a);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=Aa(n);return this.replay=null,Ft(()=>{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 a=t.messageId,i=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,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&&!Vt(c))return this.attach(c),this.apply(t),null;let p=an();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],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:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!Oy(o,a,t))return p&&(By(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let d=Vn(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(d.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:d.serverMessageId??d.id}):d.continuationStreaming=!1),this.detach(),d):null}if(s&&Ly(o,a)){let d=this.promoteContinuation(!0);return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Vt(o)&&Vt(a)){let d=this.promoteReplay();return this.detach(),d}if(!Ny(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let _=this.promoteReplay();return p?(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 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}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:se(""),doneSig:se(!1)};return this.openTextParts.set(o,i),xo(t,i),i}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":xo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":ml.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":ml.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":ml.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":Uy(n,t);return;case"file":xo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":F_(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":F_(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Ra(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){Ft(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},gl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Vn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function D_(e,t){e.canceled&&(t.canceled=!0),!(!Vn(e)||t.status!=="streaming"&&!Bn(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function Ny(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>B_(o,r[a]))}function Ly(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]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>B_(s,a[c]))}function B_(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||!Ma(t.toolName,e.toolName)||gl[t.stateSig.value]<gl[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 Oy(e,t,n){return $y(e,n)||!Dy(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:no(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function $y(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&&gl[n.stateSig.value]<4}function Dy(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>Fy(r[a+s],i)))}function Fy(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"||Ma(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 By(e,t){if(Vn(e)||!Bn(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 wn(e,t,n,r,o){let a=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(a)return r&&(a.dynamic=!0),a.toolMetadata??(a.toolMetadata=o),a;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,toolMetadata:o,inputPartialSig:se(""),inputSig:se(void 0),outputSig:se(void 0),errorSig:se(void 0),stateSig:se("input-streaming"),approvalSig:se(void 0)};return xo(e,i),i}function xo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function F_(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||xo(e,t)}function Uy(e,t){switch(t.type){case"tool-input-start":wn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=wn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=wn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=wn(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=wn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=wn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=wn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=wn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function U_(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var Hy=120;function H_(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:_,recordConversationReply:d,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:v,runCancellation:S,canContinueRef:P,setCanSend:y,feedback:C,bus:h,loadInitialThread:g,shouldReconcileOnConnect:k}=e,w=F(0);D(()=>{if(!t||!n||!r.value)return;let T=r.value,E=new AbortController,M=b=>{},L=new pi(o,b=>M(b));i.primeIdentity(s,T);let O=!1,z=!1,V,K=!1,te,G=0,Y=P.current,De,_e,Te=Date.now(),et,Ue=!1,gt=!1;function Ge(b,U,J){if(!Vt(b))return;let Z=o.value.findLast(Re=>!Re.ephemeral),ae=b.serverMessageId??b.id;if(!(Z&&(Z.serverMessageId??Z.id)!==ae))return Ia(o.value,b,T,a.current.strings.newConversation,U,J)}function ht(b,U,J,Z){let ae=Ge(b,U,Z);if(!ae)return;let Pe=`${b.serverMessageId??b.id}:${J}:${ae.preview??""}`;Pe!==_e&&(_e=Pe,i.publishConversation({...ae,hasUnread:!0},!0))}let xt;function dt(){xt&&(clearTimeout(xt.timer),xt=void 0)}function St(){let b=xt;if(!b)return;clearTimeout(b.timer),xt=void 0;let U=o.value.find(J=>(J.serverMessageId??J.id)===b.replyId);U?.role!=="assistant"&&U?.role!=="operator"||ht(U,b.canContinue,b.generation,b.activityAt)}function kt(b,U,J,Z){dt(),xt={replyId:b.serverMessageId??b.id,canContinue:U,generation:J,activityAt:Z,timer:setTimeout(St,Hy)}}function Ee(b,U,J,Z=Date.now(),ae=!0){dt();let Re=Ge(b,U,Z);if(!Re)return;let he=`${b.serverMessageId??b.id}:${J}`;he!==De&&(De=he,d(Re),ae&&et&&(Ue=!0))}function He(b,U){(b||!S.localSendRef.current)&&S.settle(U),b&&v()}function ye(b,U=[],J=!1,Z,ae=Y,Re=G,Pe=Date.now(),he=!0){let _t=a.current;if(b.canceled){Ee(b,ae,Re,Pe,he),He(J,Z);return}let fe=!0,at=b.status==="error";switch(sd(b,at)){case"drop":o.value=o.value.filter(qe=>qe!==b),fe=!1;break;case"complete-operator-routed":b.status="complete",J&&(C.play("messageReceived"),_r(h,_t,"assistant",Ve(b)));break;case"error":{if(b.status="error",b.errorText=_t.strings.errorGeneric,J){C.play("error");let qe=new Error(at?"stream error chunk":"empty reply");h.emit("error",qe),_t.onError?.(qe)}break}case"complete":b.status="complete",J&&(C.play("messageReceived"),_r(h,_t,"assistant",Ve(b))),_(b,U);break}fe&&Ee(b,ae,Re,Pe,he),He(J,Z)}function ot(b){if(E.signal.aborted||r.value!==T)return;if(c(b),p?.(b),b.type==="start"){St();let qe=b.messageId===void 0?void 0:o.value.find(B=>B.serverMessageId===b.messageId||B.id===b.messageId);K=qe!==void 0&&qe.status!=="streaming";let qt=te?.senderRole==="visitor"?te.messageId:void 0;if(te={messageId:b.messageId,senderRole:b.messageMetadata?.senderRole},G+=1,Te=Date.now(),_e=void 0,O=b.messageMetadata?.senderRole===void 0,z=!1,V=O?b.messageMetadata?.runId:void 0,O){let B=b.messageId!==void 0&&o.value.some(it=>it.serverMessageId===b.messageId||it.id===b.messageId),Q=o.value.at(-1),ee=b.messageId!==void 0&&(Q?.serverMessageId===b.messageId||Q?.id===b.messageId),me=S.localSendRef.current&&(!B||ee)&&Q?.role==="assistant"&&Q.status==="streaming"&&(ee||Q.serverMessageId===void 0&&Q.partsSig.value.length===0);z=S.captureStart(T,b,me,qt)}}let U=O&&(b.type==="finish"||b.type==="error"||b.type==="abort"),J=U?V:void 0,Z=U&&(z||S.ownsLocalRun(J)),ae=G,Re=K;b.type==="finish"&&b.canContinue!==void 0&&(Y=b.canContinue);let Pe=Y;U&&(O=!1,z=!1,V=void 0);let he=L.applyResume(b),_t=te?.messageId,fe=_t===void 0?void 0:o.value.find(qe=>qe.serverMessageId===_t||qe.id===_t);K&&te?.senderRole!=="visitor"&&(he!==null||fe?.status==="streaming")&&(K=!1,Re=!1);let at=!K&&(fe?.role==="assistant"||fe?.role==="operator");if(b.type==="text-delta"&&at&&kt(fe,Y,G,Te),b.type==="text-end"&&(dt(),at&&ht(fe,Y,G,Te)),b.type==="finish"&&b.canContinue===!1&&y(!1),!he){U&&(Z||!S.localSendRef.current)&&S.settle(J);return}if(he.role==="operator"){Re||(C.play("messageReceived"),_r(h,a.current,"operator",Ve(he))),Ee(he,Pe,ae,Te),K=!1,U&&(Z||!S.localSendRef.current)&&S.settle(J);return}he.role==="assistant"&&(ye(he,[],Z,J,Pe,ae,Te),K=!1)}async function ve(b){let U=G,J=await i.loadConversation(T,b?{ids:[b]}:void 0).catch(()=>null);if(E.signal.aborted||r.value!==T||!J)return!1;J.controlState&&c({type:"data-control-state",data:J.controlState});let Z=o.value.at(-1),ae=U===G&&(b===void 0||Z!==void 0&&(Z.serverMessageId===b||Z.id===b));if(J.messages.length===0)return!0;ae&&(Y=J.canContinue,y(Y));let Re=o.value,Pe=b===void 0?Re.at(-1):Re.find(B=>B.serverMessageId===b||B.id===b),{messages:he,changed:_t}=ro(Re,yn(J.messages));if(!_t)return!0;o.value=he;let fe=b===void 0?he.at(-1):he.find(B=>B.serverMessageId===b||B.id===b),at=Pe!==void 0&&fe!==void 0&&(Pe.id===fe.id||Pe.serverMessageId!==void 0&&Pe.serverMessageId===fe.serverMessageId),qe=fe!==void 0&&fe.status!=="streaming"&&(!at||Pe?.status==="streaming"),qt=at&&Pe?.status==="streaming"?Date.now():fe?.createdAt;return ae&&qe&&fe.role==="assistant"?ye(fe,fe.suggestions??[],S.localSendRef.current,void 0,J.canContinue,U,qt,!1):ae&&qe&&fe.role==="operator"?Ee(fe,J.canContinue,U,qt,!1):ae&&fe?.role==="assistant"&&fe.status!=="streaming"&&_(fe,fe.suggestions??[]),!0}let vt=new Set;M=({messageId:b})=>{if(vt.has(b)||!o.value.some(J=>J.serverMessageId===b||J.id===b))return;vt.add(b);function U(){return vt.delete(b)}ve(b).then(U,U)};function Ke(b=!1){if(E.signal.aborted||r.value!==T){Ue=!1;return}if(et){Ue=!0;return}let U=b?g(T)??(k()?ve():void 0):ve();if(!U)return;f(T),et=U;function J(Z=!1){if(et===U){if(et=void 0,Ue){Ue=!1,Ke();return}Z&&m(T)}}U.then(J,()=>J(!1))}let $t=u.subscribe(b=>{b<=w.current||(w.current=b,gt&&Ke())});return U_({signal:E.signal,now:()=>performance.now(),sleep:b=>Un(b,E.signal),connect:b=>i.connectResumeStream({signal:E.signal,onChunk:ot,onConnected:b}),onInitialBoundaryReady:()=>{gt=!0,Ke(!0)},backfill:()=>Ke()}),()=>{E.abort(),dt(),$t(),L.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,v,S,P,y,o,h,C,g,k])}var qy=32;function q_(e){let{transport:t,setStreaming:n}=e,r=F(void 0),o=F(void 0),a=F(!1),i=F(void 0),s=F(!1),c=F(new Map),p=F(new Set),_=$((g,k)=>{let w=`${g}:${k}`;i.current!==w&&(i.current=w,t.cancelTurn(g,k))},[t]),d=$(g=>{r.current=void 0,o.current=g,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=$((g,k)=>{c.current.set(g,{messageId:k})},[]),f=$(g=>{g!==void 0&&(p.current.add(g),p.current.size>qy&&p.current.delete(p.current.values().next().value)),!(g!==void 0&&r.current?.runId!==g)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=$((g,k)=>o.current!==g?k.runId&&r.current?.runId===k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId),!0):!1:(o.current=void 0,k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},n(!0),a.current&&_(k.conversationId,k.runId),!0):(f(),!0)),[_,n,f]),v=$((g,k)=>{let w=c.current.get(g);return w?(c.current.delete(g),!k.runId||p.current.has(k.runId)?!0:w.runId!==void 0?(w.runId!==k.runId||r.current?.runId===k.runId&&(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId)),!0):(s.current||o.current||(r.current={conversationId:k.conversationId,runId:k.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),S=$(g=>o.current!==g?!1:(f(),!0),[f]),P=$(g=>{let k=c.current.get(g);return k?(c.current.delete(g),k.runId===void 0):!1},[]),y=$((g,k,w,T)=>{let E=k.messageMetadata?.runId;if(k.messageMetadata?.senderRole!==void 0||typeof E!="string"||!E||p.current.has(E))return!1;if(r.current?.runId===E)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:g,runId:E},n(!0),a.current&&_(g,E),!0);let L=[...c.current.values()].filter(O=>O.runId===void 0).find(O=>O.messageId===T);return L?(L.runId=E,r.current={conversationId:g,runId:E},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:g,runId:E},n(!0),a.current&&_(g,E),s.current)},[_,n]),C=$(g=>typeof g=="string"&&r.current?.runId===g&&s.current,[]),h=$(()=>{let g=r.current;if(g)return a.current=!0,_(g.conversationId,g.runId),!0;let k=o.current;return k?(a.current=!0,k.then(w=>{w.runId&&_(w.conversationId,w.runId)}).catch(()=>{}),!0):!1},[_]);return ue(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:v,reject:S,rejectRouted:P,captureStart:y,ownsLocalRun:C,settle:f,stop:h}),[m,v,d,u,y,C,S,P,f,h])}var zy=ne.scope("send");function j_(e,t,n,r,o,a=!0){e.publishConversation({...Ia(t,n,r,o,a),hasUnread:!1},!0)}function V_(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function W_(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Vt(t)))}function So(e,t,n,r,o){let a=W_(t);a?.role!=="user"||!V_(a,n)||j_(e,t,a,r,o)}function z_(e){return!(e instanceof ct)||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 G_(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:_,setCanSend:d,settleSuggestions:u,runCancellation:f}=e,m=$(()=>{let P=r.value??Ct();return r.value||(r.value=P,s.saveConversationId(P)),P},[r,s]),v=$(async({continueExisting:P,turn:y})=>{let C=m(),h=n.value.at(-1),g=y?[y]:td(n.value,P),k=g[0];k?.role==="user"&&It.markSent(k.id);let w=g.map(Ds),T=s.loadUserPrefs(),E=Za(o.tools).then(M=>t.sendTurn(Ns({messages:w,conversationId:C,visitorId:c,userPrefs:T,clientTools:il(M)}),{keepalive:P}));f.begin(E);try{let M=await E;if(r.value!==C||!f.acceptAck(E,M))return!1;if(p(M.conversationId),M.runId&&k?.role==="user"&&So(t,n.value,k,M.conversationId,o.strings.newConversation),!M.runId){let L=await t.loadConversation(M.conversationId).catch(()=>null);if(r.value!==M.conversationId)return!0;if(L){L.controlState&&_(L.controlState),d(L.canContinue);let O=yn(L.messages),{messages:z,changed:V}=ro(n.value,O);V&&(n.value=z);let K=O.findLast(Y=>!Y.ephemeral&&Y.role!=="system"),te=W_(n.value);te&&K&&V_(te,K)&&j_(t,n.value,te,M.conversationId,o.strings.newConversation,L.canContinue);let G=h?n.value.find(Y=>Y.id===h.id&&Y.role==="assistant"&&Y.status!=="streaming"):void 0;G&&u(G,G.suggestions??[]),!P&&h?.role==="assistant"&&n.value.includes(h)&&h.serverMessageId===void 0&&!Vt(h)&&(n.value=n.value.filter(Y=>Y!==h))}else h?.role==="assistant"&&n.value.includes(h)&&(h.status="error",h.errorText=o.strings.errorGeneric,P?h.retryAction={kind:"continue-assistant",messageId:h.serverMessageId??h.id}:h.retryAction=k?.role==="user"?{kind:"resend-user",messageId:k.id}:null,n.value=[...n.value])}return!0}catch(M){if(r.value!==C)return!1;if(!f.reject(E))return k?.role==="user"&&So(t,n.value,k,C,o.strings.newConversation),!0;let L=qn(M,o.strings),O=z_(M),z=y?.role==="assistant"?y:n.value.at(-1);if(P&&z?.role==="assistant"&&M instanceof ct&&M.status===409){let V=z.serverMessageId??z.id,K=await t.loadConversation(C,{ids:[V]}).catch(()=>null);if(r.value!==C)return!1;if(K){K.controlState&&_(K.controlState),d(K.canContinue);let te=yn(K.messages),G=te.find(Y=>(Y.serverMessageId??Y.id)===V);if(G&&ad(z,G)){let{messages:Y,changed:De}=ro(n.value,te),_e=Y.find(Te=>(Te.serverMessageId??Te.id)===V);if(De&&_e&&_e!==z)return _e.awaitingContinuation=!1,_e.continuationStreaming=void 0,_e.retryAction=null,n.value=Y,_e.status!=="streaming"&&u(_e,_e.suggestions??[]),!0}}if(!n.value.includes(z)||z.status!=="streaming")return!1;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=L,z.retryAction=O?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(h?.role==="assistant"&&n.value.includes(h)){h.status="error",h.errorText=L;let V=g[0];h.retryAction=O&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=an();V.status="error",V.errorText=L;let K=g[0];V.retryAction=O&&K?.role==="user"?{kind:"resend-user",messageId:K.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",M),o.onError?.(M),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),S=$(async P=>{let y=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]),It.markSent(P.id);let C=[Ds(P)],h=s.loadUserPrefs(),g=Za(o.tools).then(k=>t.sendTurn(Ns({messages:C,conversationId:y,visitorId:c,userPrefs:h,clientTools:il(k)})));f.beginRouted(g,P.id);try{let k=await g;return r.value!==y?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,k)?(p(k.conversationId),So(t,n.value,P,k.conversationId,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0):!1}catch(k){let w=f.rejectRouted(g);if(r.value!==y)return!1;if(!w)return So(t,n.value,P,y,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0;if(P.status!=="pending")return So(t,n.value,P,y,o.strings.newConversation),!0;zy.debug("operator-routed send failed",{error:k});let T=k instanceof Error?k:new Error(String(k));return P.status="error",P.errorText=qn(k,o.strings),P.retryAction=z_(k)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(n.value=[...n.value]),i.play("error"),a.emit("error",T),o.onError?.(T),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:v,sendRoutedTurn:S}}var jy=ne.scope("unread");function K_(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Mt(!1),c=Mt(0),p=Mt(0),_=F([]),d=F(void 0),u=F(!1),f=$(()=>{let k=r.value,w=o.current()&&d.current===k?k:void 0,T=_.current.filter(E=>E.hasUnread&&E.conversationId!==w).length;c.value=T,s.value=T>0},[r,s,c,o]),m=$(k=>{let w=r.value,T=_.current.find(O=>O.conversationId===w),E=sn(_.current,k),M=E.find(O=>O.conversationId===w),L=k.type==="snapshot"&&w!==void 0&&M?.hasUnread===!0&&d.current===w&&T!==void 0&&T.lastMessageAt!==M.lastMessageAt;L&&(d.current=void 0),_.current=E,f(),L&&(p.value+=1)},[r,f,p]),v=$(()=>{if(f(),!o.current())return;let k=r.value;if(!k||d.current!==k)return;let w=_.current.find(T=>T.conversationId===k);w?.hasUnread&&t.markRead(k,w.lastMessageAt)},[r,o,f,t]),S=$(k=>{r.value===k&&(d.current=void 0,f())},[r,f]),P=$(k=>{r.value===k&&(d.current=k,v())},[r,v]),y=$(k=>d.current===k,[]),C=$((k=!1)=>{!n.history.enabled||!n.modules.list.some(w=>w.layout==="chat")||u.current||(u.current=!0,t.listConversations({limit:50},k).then(w=>{k||m({type:"snapshot",result:w,requestedRevision:0}),v()}).catch(w=>jy.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1}))},[m,v,n.history.enabled,n.modules,t]),h=$(k=>{let w=k.conversationId,T=o.current()&&r.value===w&&d.current===w,E=_.current.find(L=>L.conversationId===w),M=T&&(E?.lastMessageAt!==k.lastMessageAt||E.hasUnread);t.publishConversation({...k,hasUnread:!T},!0),M&&t.markRead(w,k.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(m),[m,t]);let g=F(!1);return D(()=>{!a||!i||g.current||(g.current=!0,C())},[a,i,C]),D(()=>{if(!a)return;function k(){document.visibilityState==="visible"&&(v(),C(!0))}return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[a,v,C]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:v,beginConversationTranscript:S,commitConversationTranscript:P,isConversationTranscriptCommitted:y,recordConversationReply:h}}var ko=ne.scope("settings");function Q_(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=H(()=>s.locale??t.locale),[_,d]=H(s.themeMode),u=_??t.themeMode,[f,m]=H(()=>s.textSize??t.textSize),v=$(g=>{n.patchUserPrefs(g),r.saveUserPrefs(n.loadUserPrefs()).catch(k=>ko.warn("saveUserPrefs failed",{err:k}))},[n,r]);D(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),D(()=>{if(u!=="host"){a.dataset.theme=u;return}return Mc(g=>{a.dataset.theme=g})},[a,u,t]),D(()=>{a.dataset.textSize=f},[a,f,t]),D(()=>{let g=!0;return o.mutedSig.subscribe(k=>{if(g){g=!1;return}v({soundMuted:k})})},[o,v]);let S=er(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(S)},[r,S]),D(()=>{a.dir=sc(S)?"rtl":"ltr"},[a,S]),D(()=>{S!==c&&p(S)},[S,c]);let P=$(g=>{ko.info("localeChange",{locale:g}),p(g),v({locale:g}),i.emit("localeChange",g)},[v,i]),y=$(g=>{ko.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,v({themeMode:g}),i.emit("themeChange",g)},[a,v,i]),C=$(g=>{ko.info("textSizeChange",{size:g}),m(g),a.dataset.textSize=g,v({textSize:g}),i.emit("textSizeChange",g)},[a,v,i]),h=$(()=>{o.toggleMuted();let g=o.mutedSig.value;ko.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:S,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:v,handleLocaleChange:P,handleThemeChange:y,handleTextSizeChange:C,handleSoundToggle:h}}var be=ne.scope("app"),_i=A.cssPrefix,Vy={home:"home",chats:"chat",help:"help",news:"news"};function X_(e,t){return ed({...e,text:bt(t,e.text)})}function J_({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=H(()=>tr(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=H(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Mt(a.loadConversationId()),p=F(c.value!==void 0),_=Mt(c.value??""),d=Mt([]),[u,f]=H(!1),m=F(void 0),[v,S]=H([]);function P(){let x=e.modules.list,I=new Set(x.map(j=>j.id)),X=a.loadActiveModule();return X&&I.has(X)?X:x[0]?.id??""}function y(){return e.modules.list.find(x=>x.layout==="chat")?.id}function C(){let x=y();return x?e.modules.list.length===1?!0:g.sig.value.activeTab===x:!1}let h=F(void 0);if(!h.current){let x=e.modules.list.map(X=>X.id),I=a.loadActiveModule()??x[0]??"";h.current=yd(I,I?[...x,I]:x,X=>a.saveActiveModule(X))}let g=h.current,k=Rt(()=>g.sig.value.activeTab).value,w=Rt(()=>c.value).value,[T,E]=H(!1),[M,L]=H(null),[O,z]=H(!1),V=e.mode==="standalone"||e.mode==="inline",K=F(io(e,fr(),a.loadPanelOpen(),a.loadPanelSize())),[te,G]=H(K.current.panelOpen),[Y,De]=H(K.current.panelOpen),_e=F(void 0),Te=F(void 0),et=F(!1),Ue=F(void 0);D(()=>{te&&De(!0)},[te]);let gt=F(!1),[Ge,ht]=H(!1),{dismissed:xt,dismissCallout:dt}=M_({callout:e.launcher.callout,persistence:a}),St=e.launcher.callout?.persistent??!0,kt=$(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),dt()},[n,dt]),[Ee,He]=H(K.current.panelSize),ye=F(!1),[ot,ve]=H("chat"),vt=F(()=>!1);vt.current=()=>te&&ot==="chat"&&!document.hidden&&C();let[Ke,$t]=H(!0),b=F(Ke);b.current=Ke;let[U,J]=H(!1),Z=F(U);Z.current=U;let ae=F(null),[Re,Pe]=H(!1),[he,_t]=H(null),[fe,at]=H([]),qe=F(e.strings),qt=F(e);qt.current=e;let[B,Q]=H(void 0),[ee,me]=H(void 0),[it,zt]=H(()=>a.loadSidebarCollapsed()??!1),[Yt,Et]=H({}),[le]=H(()=>new La({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:ou({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[At]=H(()=>new ua(e.sound,e.haptics)),un=q_({transport:le,setStreaming:J}),{activeLocale:wo,activeThemeMode:vl,activeTextSize:bl,effectiveLocale:Wn,setActiveLocale:af,setActiveThemeMode:sf,setActiveTextSize:lf,patchAndSync:yl,handleLocaleChange:cf,handleThemeChange:uf,handleTextSizeChange:df,handleSoundToggle:pf}=Q_({options:e,persistence:a,transport:le,feedback:At,hostElement:t,bus:n}),{controlModeSig:Gt,assignedOperatorInitialsSig:_f,operatorAvailableSig:ff,applyControlState:Tr,adoptControlStateChunk:mf,requestOperator:gf,cancelOperatorRequest:hf}=N_({transport:le,conversationIdSig:c}),dn=Mt(new Map),vf=$(x=>{if(x.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let X=Yu(x.data);if(!X)return;let j=dn.value.get(I);if(j&&(X.postFinishSequence<j.postFinishSequence||X.postFinishSequence===j.postFinishSequence&&(j.status==="ready"||j.status===X.status)))return;let oe=new Map(dn.value);oe.set(I,X),dn.value=oe},[c,dn]),{hasUnreadSig:bf,unreadCountSig:Pl,transcriptRecoverySig:yf,markVisibleConversationRead:xl,beginConversationTranscript:vi,commitConversationTranscript:Gn,isConversationTranscriptCommitted:Sl,recordConversationReply:Pf}=K_({transport:le,options:e,conversationIdSig:c,isConversationVisibleRef:vt,activated:Y,conversationReady:T}),xf=te&&e.modules.byId[k]?.layout==="home",Sf=A_({transport:le,options:e,persistence:a,enabled:T&&xf});D(()=>{xl()},[k,te,ot,w,xl]),D(()=>{At.update(e.sound,e.haptics)},[At,e.sound,e.haptics]),D(()=>()=>At.destroy(),[At]),D(()=>{ye.current||!e.size.initialSize||(ye.current=!0,!a.loadPanelSize()&&He(js(e.mode,e.size,fr())))},[e.mode,e.size,a]),D(()=>{if(!T||gt.current)return;gt.current=!0;let x=io(e,fr(),a.loadPanelOpen(),a.loadPanelSize());G(x.panelOpen),He(x.panelSize)},[T,e,a]);let Kn=F(null);D(()=>{T&&g.reconcile(e.modules.list.map(x=>x.id),P())},[T,e.modules.list,g]);let Co=$(x=>{!x||x.length===0||(d.value=x.map(I=>X_(I,qe.current)))},[d]),bi=F(null),To=$(async x=>{try{let{formSubmissions:I}=await(x?le.bootstrap(x):bi.current??le.bootstrap()),X=new Map;return I.forEach((j,oe)=>X.set(j.formId,oe)),I.filter((j,oe)=>!j.skipped||X.get(j.formId)===oe).map((j,oe)=>({key:`wire:${j.formId}:${j.createdAt??oe}`,formId:j.formId,outcome:j.skipped?"skipped":"submitted",createdAt:Qu(j.createdAt),values:j.values}))}catch(I){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[le]),Rr=F(0),Zt=F(0),yi=$(x=>{if(x===c.value)return;let I=c.value;Zt.current++,f(!1),I&&(a.saveDraft(x,a.loadDraft(I)),a.saveDraft(I,""),a.saveMessageQueue(x,a.loadMessageQueue(I)),a.saveMessageQueue(I,[])),c.value=x,a.saveConversationId(x),le.primeIdentity(void 0,x),be.info("conversation rebound",{previous:I,current:x}),I&&n.emit("conversationRebound",{previous:I,current:x})},[n,c,a,le]),Ro=$((x,I)=>{let X=[...x.map(W=>W.createdAt),...I.map(W=>W.createdAt)].filter(W=>W!==void 0),j=(X.length?Math.min(...X):Date.now())-1;return[...(Ue.current?.messages??[]).map(W=>{let ie=X_(W,qe.current);return ie.createdAt=j,ie}),...x]},[]),kl=$(async x=>{let I=Zt.current;function X(){return I!==Zt.current||c.value!==x}Te.current===x&&(Te.current=void 0),f(!0);try{let[j,oe]=await Promise.all([le.loadConversation(x),To()]);if(X())return!1;let W=yn(j.messages);S(oe);let ie=Ro(Us(W,d.value),oe);if(d.value=ie,Te.current=ie.some(we=>we.role==="user")?void 0:x,W.length>0||j.controlState!==void 0){$t(j.canContinue),j.controlState&&Tr(j.controlState);let we=W.findLast(pt=>pt.role==="assistant"&&!pt.ephemeral);at(we?.suggestions??[])}return!0}catch(j){return X()||(be.warn("loadThread failed; keeping conversation active",{err:j,conversationId:x}),n.emit("error",j),qt.current.onError?.(j)),!1}finally{X()||f(!1)}},[le,To,d,c,Ro,n]),kf=$(x=>{if(_e.current===x)return _e.current=void 0,kl(x)},[kl]),wf=$(()=>{if(m.current)return Promise.resolve(void 0);let x=c.value,I=d.value.find(ie=>ie.serverMessageId!==void 0),X=I?.serverMessageId,j=I?new Date(I.createdAt).toISOString():void 0;if(!x||!X||!j)return Promise.resolve(void 0);let oe=Zt.current,W={};return m.current=W,(async()=>{try{let ie=await le.loadConversation(x,{beforeId:X,beforeCreatedAt:j});if(m.current!==W||Zt.current!==oe||c.value!==x)return;if(ie.messages.length===0)return!1;let xe=ie.messages.map($s),we=d.value,pt=rd(we,xe);if(pt!==we){let en=Math.min(...xe.map(wt=>wt.createdAt??1/0),...v.map(wt=>wt.createdAt??1/0));if(Number.isFinite(en))for(let wt of we){if(!wt.ephemeral)break;(wt.createdAt??1/0)>=en&&(wt.createdAt=en-1)}d.value=pt}return!0}catch(ie){if(m.current!==W||Zt.current!==oe||c.value!==x)return;be.warn("load previous messages failed",{err:ie,conversationId:x,beforeId:X}),n.emit("error",ie),e.onError?.(ie);return}finally{m.current===W&&(m.current=void 0)}})()},[n,c,v,d,e,le]),Ir=$(async({newConversation:x})=>{let I=++Rr.current;function X(){return I!==Rr.current}let j=c.value,oe=x||!j?Ct():j;oe!==j&&(Zt.current++,f(!1),Ft(()=>{c.value=oe,_.value=oe}),a.saveConversationId(oe)),le.primeIdentity(i,oe);let W;try{W=await le.handshake({visitorId:i,conversationId:oe,userPrefs:a.loadUserPrefs(),locale:wo})}catch(we){if(X())return;n.emit("error",we),e.onError?.(we),x||E(!0);return}if(X())return;W.conversationId!==oe&&yi(W.conversationId),_t(W.agent),W.site&&gu(W.site)?Q(W.site):W.site&&be.warn("invalid site config, using fallback",{site:W.site}),W.blocks&&hu(W.blocks)?me(W.blocks):W.blocks&&be.warn("invalid blocks config, using fallback",{blocks:W.blocks});let ie=es(W.userPrefs);if(Object.keys(ie).length>0&&!x&&(a.saveUserPrefs(ie),ie.locale&&af(ie.locale),ie.soundMuted!==void 0&&At.setMuted(ie.soundMuted),ie.themeMode&&sf(ie.themeMode),ie.textSize&&lf(ie.textSize)),Ue.current=W.welcome,x||n.emit("handshake",W),W.welcome?.suggestions){let we=qe.current;at(W.welcome.suggestions.map(pt=>({...pt,label:bt(we,pt.label),...pt.text===void 0?{}:{text:bt(we,pt.text)}})))}let xe=!x&&j&&W.conversationId===j;p.current=!!xe,xe?et.current||(_e.current=W.conversationId):(Te.current=W.conversationId,Co(W.welcome?.messages),Gn(W.conversationId)),x||E(!0)},[le,i,a,e,n,c,_,At,Co,wo,yi,Gn]),Er=JSON.stringify(e.userContext??null),Cf=JSON.stringify(e.pageContext??null),Tf=JSON.stringify(Yt);D(()=>{let x=Object.keys(Yt).length?{...Yt,...e.userContext}:e.userContext;le.setContext(x,Wy(e.pageContext))},[le,Er,Cf,Tf]),D(()=>le.setUserToken(e.userToken),[le,e.userToken]);let wl=$((x,I=[])=>at(x.suggestions??I),[]);D(()=>(le.primeIdentity(i,c.value),Ir({newConversation:!1}),()=>{Rr.current++,Zt.current++}),[]),D(()=>{!Y||!T||et.current||(et.current=!0,bi.current=le.bootstrap(),(async()=>{try{let x=await bi.current;L($r((x??{forms:[]}).forms,Wn))}catch(x){be.debug("bootstrap failed \u2014 treating as no forms",{err:x})}finally{z(!0)}})(),_e.current===c.value&&f(!0))},[Y,T]);let Ar=F(null);D(()=>{if(!Y||!T||(Ar.current??(Ar.current=Wn),Ar.current===Wn))return;Ar.current=Wn;let x=!1;return le.bootstrap().then(I=>{x||L($r((I??{forms:[]}).forms,Wn))}).catch(I=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{x=!0}},[Y,T,Wn,le]);let Cl=F(Er);D(()=>{!T||Cl.current===Er||(Cl.current=Er,Ir({newConversation:!1}))},[Er,T,Ir]),$_({hostElement:t,mode:e.mode,panelSize:Ee,isOpen:te,surfaceReady:T,setIsOpen:G});let{sendAiTurn:pn,sendRoutedTurn:Qn}=G_({transport:le,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:At,persistence:a,visitorId:i,adoptConversationId:yi,applyControlState:Tr,setCanSend:$t,settleSuggestions:wl,runCancellation:un}),{toolInteraction:Rf,pageToolsRunning:Pi,stopPageTools:Tl}=E_({streaming:U,controlModeSig:Gt,messagesSig:d,sendAiTurn:pn,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),If=$((x,I)=>{let X=d.value.find(j=>j.serverMessageId===x);X&&(X.feedback=I),be.info("messageFeedback",{messageId:x,value:I}),n.emit("messageFeedback",{messageId:x,value:I}),le.submitFeedback({messageId:x,value:I})},[n,d,le]);function Ef(){return d.value.reduce((x,I)=>x+(I.role==="user"?1:0),0)}let Xn=e.forms.list.length>0?e.forms:M??e.forms,Fe=vd({forms:Xn,persistence:a,userContext:()=>e.userContext,messageCount:Ef,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(x,I,X,j)=>{be.info("formSubmit",{formId:x.id,trigger:I,skipped:j}),n.emit("formSubmit",{formId:x.id,values:X,skipped:j}),S(W=>{let xe=W.find(we=>we.formId===x.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...W.filter(we=>!(we.formId===x.id&&we.outcome==="skipped")),{key:`local:${x.id}:${xe}`,formId:x.id,outcome:j?"skipped":"submitted",createdAt:xe,...j?{}:{values:X}}]});let oe=c.value??Ct();c.value||(c.value=oe,a.saveConversationId(oe),le.primeIdentity(void 0,oe)),!j&&x.mirrorToContext&&Et(W=>({...W,...X})),le.submitForm({formId:x.id,conversationId:oe,trigger:I,values:X,skipped:j})}}),Rl=Rt(()=>Fe.activeForm.value),Io=Rl.value?.form.blocking??!1,Af=$(()=>Fe.fire("after-messages"),[Fe]),Mf=$(()=>p.current||d.value.some(x=>!x.ephemeral&&x.role==="user"),[d]);H_({activated:Y,conversationReady:T,conversationIdSig:c,messagesSig:d,optionsRef:qt,transport:le,visitorId:i,adoptControlStateChunk:mf,adoptMemoryCompactionStateChunk:vf,settleSuggestions:wl,recordConversationReply:Pf,transcriptRecoverySig:yf,beginConversationTranscript:vi,commitConversationTranscript:Gn,onReplyLanded:Af,runCancellation:un,canContinueRef:b,setCanSend:$t,feedback:At,bus:n,loadInitialThread:kf,shouldReconcileOnConnect:Mf}),D(()=>{Fe.refresh()},[Xn,Fe]);let Il=e.pageContext?.area?String(e.pageContext.area):void 0,Nf=Rt(()=>d.value.length),Eo=F(null);D(()=>{!O||!Eo.current||(Fe.fire("manual",Eo.current),Eo.current=null)},[O,Fe]),D(()=>{T&&O&&Fe.fire("pre-chat")},[T,O,Fe]),D(()=>{O&&!Ke&&Fe.fire("conversation-closed")},[O,Ke,Fe]),D(()=>{T&&O&&Il&&Fe.fire("page-area")},[T,O,Il,Fe]);let xi=ue(()=>{let x=Xn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return x.length?Math.min(...x)*1e3:0},[Xn]);D(()=>{if(!xi||!te)return;let x=setTimeout(()=>Fe.fire("idle"),xi);return()=>clearTimeout(x)},[xi,te,Fe,Nf.value]);let Jn=$(async(x,I,X)=>{if(ae.current)return!1;let j=c.value,oe=j?dn.value.get(j):void 0,W=Gt.value!=="ai-agent";if(!W&&oe?.status==="compacting"||(be.info("send",{textLen:x.length,attachments:I.length,streaming:Z.current,routedToOperator:W}),Z.current&&!W))return!1;let ie=new AbortController,xe={conversationId:j,controller:ie};ae.current=xe,Pe(!0);try{At.unlock();let we=await Ky(le,I,ie.signal,_n=>{ie.signal.aborted||(be.warn("upload failed",{err:_n}),n.emit("error",_n),e.onError?.(_n))});if(ie.signal.aborted||c.value!==j||!b.current||Fe.activeForm.value?.form.blocking)return!1;let pt=j?dn.value.get(j):void 0,en=Gt.value!=="ai-agent";if(!en&&pt?.status==="compacting"||Z.current&&!en||!x&&we.length===0)return!1;n.emit("send",{text:x,attachmentCount:I.length}),fe.length>0&&at([]),At.play("messageSent");let wt=Os(x,we,X);return _r(n,e,"user",x),en?(d.value=[...d.value,wt],X?await Qn(wt):(Qn(wt),!0)):(d.value=[...d.value,wt,an()],X?await pn({continueExisting:!1}):(pn({continueExisting:!1}),!0))}finally{ae.current===xe&&(ae.current=null,Pe(!1))}},[le,n,e,fe.length,d,c,dn,pn,Qn,Gt]),El=F(Jn);El.current=Jn;let Al=c.value,Ml=(Al?dn.value.get(Al):void 0)?.status==="compacting",Si=Gt.value==="ai-agent",Nl=Rt(()=>{let x=d.value.at(-1);return x?.role==="assistant"&&x.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),Ll=Rt(()=>d.value.some(x=>x.retryAction?.kind==="resend-user"||x.retryAction?.kind==="continue-assistant"));Tt(()=>{let x=c.value;return()=>{let I=ae.current;!I||I.conversationId!==x||(ae.current=null,Pe(!1),I.controller.abort())}},[c.value]),D(()=>{Ke&&!Io||ae.current?.controller.abort()},[Io,Ke]);let Lf=$(()=>{if(Pi){be.info("stop page tools"),n.emit("stop",void 0),Tl();return}if(!un.stop())return;be.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])},[un,n,d,Pi,Tl]),Of=$(x=>{if(U)return;let I=d.value,X=Na(I,x);if(X)switch(be.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(Gt.value!=="ai-agent"||x.role!=="assistant"||(x.serverMessageId??x.id)!==X.messageId)return;x.status="streaming",x.errorText=void 0,x.retryAction=void 0,x.awaitingContinuation=!0,d.value=[...I],pn({continueExisting:!0,turn:x});return}case"resend-user":{let j=I.find(ie=>ie.role==="user"&&ie.id===X.messageId);if(!j)return;let oe=ie=>{ie&&Kn.current?.acceptQueuedMessage(X.messageId)};if(j.status="complete",j.errorText=void 0,j.retryAction=void 0,Gt.value!=="ai-agent"){d.value=x.role==="assistant"?I.filter(ie=>ie!==x):[...I],Qn(j).then(oe);return}let W=an();d.value=x.role==="assistant"?I.map(ie=>ie===x?W:ie):[...I,W],pn({continueExisting:!1,turn:j}).then(oe);return}case"repeat-user":{let j=I.find(xe=>xe.role==="user"&&xe.id===X.messageId);if(!j)return;let oe=Os(Ve(j),j.attachments?.map(xe=>({...xe}))??[]),W=new Set(oe.attachments?.flatMap(xe=>xe.url?[xe.url]:[])??[]),ie=j.partsSig.value.flatMap(xe=>xe.kind==="file"&&!W.has(xe.url)?[{...xe}]:[]);if(ie.length>0&&(oe.partsSig.value=[...oe.partsSig.value,...ie]),Gt.value!=="ai-agent"){d.value=[...I,oe],Qn(oe);return}d.value=[...I,oe,an()],pn({continueExisting:!1,turn:oe});return}default:return X}},[U,d,Gt,pn,Qn]),Mr=$(()=>{if(hd(e.mode,Ee)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),He("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Fe.fire("panel-close"),G(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Ee,Fe]),Cn=$(()=>{be.info("open",{mode:e.mode}),At.unlock(),ht(!0),G(!0),a.savePanelOpen(!0),!xt&&!St&&kt(),setTimeout(()=>ht(!1),Gy),n.emit("open",void 0),e.onOpen?.()},[n,e,At,a,xt,St,kt]),ki=$(()=>{let x=d.value.some(I=>I.role==="user");if(Te.current===c.value&&!x&&Ke&&c.value){be.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&Co(Ue.current?.messages);return}return be.info("clear \u2192 new conversation",{wasStreaming:U}),n.emit("clear",void 0),un.settle(),p.current=!1,_e.current=void 0,Te.current=void 0,Ft(()=>{d.value=[],c.value=void 0,Tr({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),$t(!0),S([]),at([]),Ir({newConversation:!0})},[U,d,c,a,Ir,n,Ke,Co,un,Tr]),Ao=$(()=>{let x=ki();ve("chat");let I=e.modules.list.find(X=>X.layout==="chat")?.id;return I&&g.switchTab(I),x},[ki,g,e]),$f=$(async x=>{await Ao(),await El.current(x,[])||Kn.current?.fill(x)},[Ao]),wi=$(()=>{let x=Ee==="expanded"?"normal":"expanded";be.info("expand",{from:Ee,expanded:x==="expanded"}),He(x),a.savePanelSize(x),n.emit("expand",x==="expanded")},[n,Ee,a]),Ci=$(()=>{let x=Ee==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:Ee,fullscreen:x==="fullscreen"}),He(x),a.savePanelSize(x),n.emit("fullscreen",x==="fullscreen")},[n,Ee,a]),Df=$(()=>{ve(x=>{let I=x==="history"?"chat":"history";return be.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),Ff=$(()=>{zt(x=>{let I=!x;return be.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Bf=$(x=>{be.info("resize",x),yl({widgetSize:x}),n.emit("resize",x)},[yl,n]),Uf=$(async x=>{let I=x.conversationId;if(I===c.value&&Sl(I)){be.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(x),ve("chat");let W=y();W&&g.switchTab(W),Gn(I);return}let j=++Rr.current;Zt.current++,f(!1);function oe(){return j!==Rr.current}be.info("selectConversation",{conversationId:I,wasStreaming:U}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(x);try{let[W,ie]=await Promise.all([le.loadConversation(I),To(I)]);if(oe())return;un.settle(),p.current=!0,_e.current=void 0;let xe=yn(W.messages),we=W.conversationId!==c.value,pt=we?xe:Us(xe,d.value);Te.current=pt.some(_n=>_n.role==="user")?void 0:W.conversationId,Ft(()=>{d.value=Ro(pt,ie),we&&(_.value=W.conversationId),c.value=W.conversationId}),S(ie),a.saveConversationId(W.conversationId),le.primeIdentity(i,W.conversationId),$t(W.canContinue),W.controlState&&Tr(W.controlState);let en=pt.findLast(_n=>_n.role==="assistant"&&!_n.ephemeral);at(en?.suggestions??[]),we?vi(W.conversationId):Gn(W.conversationId),ve("chat");let wt=y();wt&&g.switchTab(wt)}catch(W){if(oe())return;n.emit("error",W),e.onError?.(W)}},[le,d,c,_,n,e,a,To,Ro,U,i,un,vi,Gn,Sl,g]),Ol=$(x=>{if(typeof x!="string")return;te||Cn(),ve("chat");let I=y();I&&g.switchTab(I),O?Fe.fire("manual",x):Eo.current=x},[te,Cn,e.modules,g,O,Fe]),Mo=F(void 0),No=$(x=>{let I=e.modules.list.find(j=>j.layout===Vy[x.to]);if(!I){be.warn("open: the widget has no such tab",{to:x.to});return}let X=x.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:x.id,title:""}:void 0;g.open(I.id,X)},[e.modules,g]),$l=$(x=>{if(te||Cn(),x!==void 0){if(!au(x)){be.warn("open: unknown target",{detail:x});return}T?No(x):Mo.current=x}},[te,Cn,T,No]);D(()=>{!T||!Mo.current||(No(Mo.current),Mo.current=void 0)},[T,No]);let Dl=T&&!u&&!Io&&(!Si||!Nl.value&&!Ll.value),[Tn,Ti]=H(),Fl=$(x=>{let I=iu(x);if(!I){be.warn("ask: expected { text, send? } with non-empty text",{detail:x});return}te||Cn(),Ti(I)},[te,Cn]),Ri=te&&O&&Ke&&T&&!u&&!Io,Bl=Ri&&Dl&&!Re&&!(Si&&(U||Ml));D(()=>{if(Tn===void 0||!(Tn.send?Bl:Ri))return;let x=y();if(!x){be.warn("ask: the widget has no chat"),Ti(void 0);return}if(ot!=="chat"||!C()){ve("chat"),g.switchTab(x);return}if(Ti(void 0),!Tn.send){Kn.current?.fill(Tn.text);return}Jn(Tn.text,[]).then(I=>{I||Kn.current?.fill(Tn.text)})},[Tn,Ri,Bl,ot,k,e.modules,g,Jn]),D(()=>{if(e.widgetId!=="default")return;let x=`data-${A.cssPrefix}-`,I=["ask","open","close","form"].map(j=>x+j);function X(j){let oe=j.composedPath().find(we=>we instanceof Element&&I.some(pt=>we.hasAttribute(pt)));if(!(oe instanceof Element))return;j.preventDefault();let W=oe.getAttribute(`${x}ask`),ie=oe.getAttribute(`${x}open`),xe=oe.getAttribute(`${x}form`);W!==null?Lt(t,"ask",Vr(W||(oe.textContent??""),{send:oe.hasAttribute(`${x}send`)})):ie!==null?Lt(t,"open",aa(ie)):xe!==null?Lt(t,"openForm",xe):Lt(t,"close")}return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[e.widgetId,t]),D(()=>{if(e.widgetId!=="default")return;let x=cu(location.href);x&&(history.replaceState(history.state,"",x.url),x.ask?Lt(t,"ask",Vr(x.ask)):Lt(t,"open",x.target))},[e.widgetId,t]);let Ul=F(Wr),Hl=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";D(()=>jt(()=>{let x=c.value,I={open:Hl||te,ready:T,unread:Pl.value,...x?{conversationId:x}:{}},X=Ul.current;I.open===X.open&&I.ready===X.ready&&I.unread===X.unread&&I.conversationId===X.conversationId||(Ul.current=I,n.emit("state",I),I.unread!==X.unread&&n.emit("unread",I.unread))}),[n,Hl,te,T,Pl,c]);let Rn=F({handleOpenCommand:$l,handleClose:Mr,handleExpand:wi,handleFullscreen:Ci,openForm:Ol,handleAskCommand:Fl});Rn.current={handleOpenCommand:$l,handleClose:Mr,handleExpand:wi,handleFullscreen:Ci,openForm:Ol,handleAskCommand:Fl},Tt(()=>lu(t,{open:x=>Rn.current.handleOpenCommand(x),close:()=>Rn.current.handleClose(),expand:()=>Rn.current.handleExpand(),fullscreen:()=>Rn.current.handleFullscreen(),openForm:x=>Rn.current.openForm(x),ask:x=>Rn.current.handleAskCommand(x)}),[t]);let ft=ue(()=>Yi(e,wo,vl,bl),[e,wo,vl,bl]);qe.current=ft.strings;let Hf=ue(()=>v.map(x=>{let I=Xn.list.find(X=>X.id===x.formId);return{...x,title:I?.title,form:I}}),[v,Xn]);function Ii(x){Uf(x)}let ql={options:ft,transport:le,feedback:At,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:Kn,view:ot,canSend:Ke,isStreaming:U,pageToolRunning:Pi,isMemoryCompacting:Ml,canReleaseQueuedMessages:Dl,queueManualMessages:Si&&(Nl.value||Ll.value),sendPreparing:Re,composerActive:ft.mode==="page"||ft.mode==="inline"||ft.mode==="standalone"||te,controlMode:Gt.value,assignedOperatorInitials:_f.value,operatorAvailable:ff.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:gf,onCancelOperatorRequest:hf,loadingMessages:u,onLoadPreviousMessages:wf,messagesSig:d,agent:he,suggestions:fe,initialWidgetSize:s.widgetSize??null,onClose:Mr,onClear:ki,onExpand:wi,onFullscreen:Ci,onSoundToggle:pf,onToggleHistory:Df,onSelectHistoryConversation:Ii,onNewConversation:Ao,onLocaleChange:cf,onThemeChange:uf,onTextSizeChange:df,onWidgetSizeChange:Bf,onSend:Jn,onStop:Lf,onSuggestion:x=>{if(ae.current)return;let I=x.text??x.label;be.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?Jn(I,[]):Kn.current?.fill(I)},activeForm:Rl.value?.form??null,formMarkers:Hf,onFormSubmit:Fe.complete,onFormSkip:Fe.skip,onFormFill:x=>Fe.fire("manual",x),tool:Rf,onRetry:Of,onMessageFeedback:If};if(!T)return null;let Nr=ft.modules.list;function Ei(x){let I=pr("close",ft.mode,x);return Nr.length===0?l(w_,{strings:ft.strings,onClose:I?Mr:void 0}):Nr.length===1&&Nr[0]?.layout==="chat"?l(S_,{...ql,panelSize:x}):l(k_,{panelProps:{...ql,panelSize:x,onClose:I?Mr:void 0},enabledModules:Nr,nav:g,bus:n,hasUnread:bf.value,latestNews:Sf,onSelectConversation:Ii,onStartNewConversation:$f,onSetPanelSize:He})}if(e.mode==="page"){let x=e.history.enabled&&Nr.some(I=>I.layout==="chat");return l("div",{class:`${_i}-anchor`,children:l(R_,{site:B,blocks:ee,transport:le,strings:ft.strings,locale:ft.locale,persistence:a,showConversations:x,onSelectConversation:Ii,onNewConversation:Ao,sidebarCollapsed:it,onToggleSidebarCollapsed:Ff,children:Ei("fullscreen")})})}if(V){let x=e.mode==="standalone"?"fullscreen":Ee;return l("div",{class:`${_i}-anchor`,children:Ei(x)})}let zl=e.mode==="drawer",jl=!(e.mode==="modal")&&!e.launcher.hidden&&(!te||Ge),Vl=jl&&!Ge&&!xt&&!zl?ft.launcher.callout:null;return l("div",{class:`${_i}-anchor`,"data-launcher-size":ft.launcher.size,children:[te||Y?l("div",{class:`${_i}-surface`,hidden:!te,children:Ei(Ee)}):null,jl?l(tp,{onToggle:Cn,launcher:ft.launcher,strings:ft.strings,leaving:Ge,edgeTab:zl}):null,Vl?l(np,{callout:Vl,launcherPosition:ft.position,strings:ft.strings,closeLabel:ft.strings.close,onDismiss:kt}):null]})}function Wy(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Gy=120;async function Ky(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:_}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:_,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var Qy=ne.scope("error-boundary"),fi=class extends Dt{constructor(){super(...arguments);ce(this,"state",{crashed:!1})}componentDidCatch(n,r){Qy.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}};function Y_(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=Zn(i),p=!0,_=0,d=Pc(t);function u(){c=Zn(s?Zi(i,s):i)}function f(){Oc(n,Dr(c.mode));let P=o.loadUserPrefs().themeMode;$c(n,P?{...c,themeMode:P}:c),p&&(Yo(n,mi(c)),p=!1)}function m(){f(),hn(gn(fi,{onError:a},gn(J_,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",P=>{P.config&&(P.config.storageVersion&&o.rememberStorageVersion(P.config.storageVersion),s=P.config,u(),m())});let v=kc(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function S(P={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...P},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:P=>{i=P,u(),m()},patchUserOptions:P=>{let y="userToken"in P&&P.userToken!==i.userToken;if(y&&i.userToken){S(P);return}y&&(_+=1),i={...i,...P},u(),m()},reset:()=>S(),destroy:()=>v()}}function mi(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=tr(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=io(e,fr(),t.loadPanelOpen(),t.loadPanelSize());return $a(e.mode,r,n)}var Xy=ne.scope("hooks"),gi="*",hl=new Set;function Z_(e,t,n){let r={widgetId:e,event:t,listener:n};return hl.add(r),()=>{hl.delete(r)}}function Jy(e,t,n){let r=[...hl];for(let o of r)if(Yy(o.widgetId,e.widgetId)&&!(o.event!==gi&&o.event!==t))try{o.listener(e,t,n)}catch(a){Xy.warn("hook listener threw",{event:t,error:a})}}function ef(e,t){let n=[];for(let r of Zy)n.push(t.on(r,o=>{Jy(e,r,o)}));return()=>{for(let r of n)r()}}function Yy(e,t){return e===gi||e===t}var Zy=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","hostEvent","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound","state","unread"];var eP=ne.scope("iframe"),tP='<!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 rf(e,t,n="closed",r="floating",o=null){eP.debug("createIframeMount",{position:t,initialMode:n,layoutMode:r,hasTarget:!!o});let a=document.createElement("iframe");a.title=`${A.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),nf(a,t,n,r),(r==="inline"&&o?o:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(tP),s.close();let c=Jo({...e,target:s.body}),p=new MutationObserver(()=>{nf(a,t,c.hostElement.dataset.mode??"closed",r)});return p.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){p.disconnect(),c.destroy(),a.remove()}}}var hi="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",tf={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 nf(e,t,n,r){if(n==="fullscreen"||r==="standalone"){e.style.cssText=`${hi}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(r==="inline"){e.style.cssText=`${hi}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=`${hi}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",i=t.endsWith("-left")?"left":"right",{w:s,h:c}=tf[n]??tf.open;e.style.cssText=`${hi}position:fixed;${a}:16px;${i}:16px;width:${s};height:${c};`}var cn=new Map;function of(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Qo(e.debug);let t=ne.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=Zn(e),r=n.widgetId,o=cn.get(r);o&&(t.debug("destroy existing instance at slot",{widgetId:r}),o.destroy());let a=mi(n),i=n.iframe?rf({position:Dr(n.mode)},n.position,a,n.mode,e.target??null):Jo({position:Dr(n.mode),target:e.target??null});i.hostElement.dataset.widgetId=r;let s=new sa,c=tr(r,n.storage,n.aiAgentDeploymentId);function p(y){s.emit("error",y),_.getOptions().onError?.(y)}let _=Y_({bus:s,host:i.hostElement,appRoot:i.appRoot,persistence:c,initialRaw:e,reportError:p}),d=Wr,u=()=>{},f=new Promise(y=>{u=y});s.on("state",y=>{d=y,y.ready&&u()}),_.render();let m=i.hostElement,v=null;function S(y){y.debug!==void 0&&Qo(y.debug),_.patchUserOptions(y)}let P={widgetId:r,open:y=>Lt(m,"open",y),close:()=>Lt(m,"close"),expand:()=>Lt(m,"expand"),openForm:y=>Lt(m,"openForm",y),ask:(y,C)=>Lt(m,"ask",Vr(y,C)),on:(y,C)=>s.on(y,C),update:y=>{t.debug("update",{patch:y}),S(y)},setUserContext:y=>{t.debug("setUserContext",{keys:Object.keys(y)}),S({userContext:{..._.getUserOptions().userContext,...y}})},clearUserContext:()=>{t.debug("clearUserContext"),S({userContext:void 0})},setPageContext:y=>{t.debug("setPageContext",{keys:Object.keys(y)}),S({pageContext:{..._.getUserOptions().pageContext,...y}})},clearPageContext:()=>{t.debug("clearPageContext"),S({pageContext:void 0})},get state(){return d},ready:f,reset:()=>{t.info("reset",{widgetId:r}),_.reset()},login:y=>{t.info("login",{widgetId:r}),S({userToken:y})},track:(y,C)=>{let h=yc(y,C);h&&s.emit("hostEvent",h)},registerTool:Yp,setDebug:y=>{Qo(y),t.info("debug level set",{level:Ki()})},debugLevel:()=>Ki(),onLog:y=>mc(y),destroy:()=>{t.info("destroy",{widgetId:r}),s.emit("state",Wr),v?.(),_.destroy(),s.clear(),hn(null,i.appRoot),i.destroy(),cn.get(r)===P&&cn.delete(r)}};return v=ef(P,s),cn.set(r,P),P}function nP(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=cn.get(t);return n?(n.update(e),n):of(e)}function rP(e){if(e!==void 0){cn.get(e)?.destroy();return}let t=[...cn.values()];for(let n of t)n.destroy()}function oP(e="default"){return cn.get(e)??null}function aP(){return[...cn.values()]}function iP(e,t,n){return Z_(e,t,n)}var sP=nr,lP=A;
63
+ `).trim(),z=!C&&t!=="error"&&!h.value&&O.length>0,V=a?g_(m,{showReasoning:o,showSources:i}):m.map((G,Y)=>({kind:"part",part:G,index:Y}));function K(G,Y){return l(uy,{part:G,generativeUi:e.role==="assistant",active:w,live:v,strings:n,showReasoning:o,showToolCalls:a,showSources:i,interactive:s&&t==="complete"&&(G.kind!=="tool"||Ea(e,Y)),superseded:c,continuationStreaming:e.continuationStreaming===!0,tool:p},`${my(G)}#${Y}`)}let te=L||z;return l("div",{class:`${Oe}-bubble-row`,"data-role":e.role,"data-testid":ut(N.messageBubble,e.serverMessageId??e.id),children:l("div",{class:`${Oe}-bubble-col`,children:[l("div",{class:`${Oe}-bubble`,children:[e.role==="operator"&&e.operatorInitials?l("span",{class:`${Oe}-bubble-author`,children:e.operatorInitials}):null,l("div",{class:`${Oe}-bubble-body`,children:[k?l(vy,{label:n.loading}):V.flatMap((G,Y)=>G.kind==="part"?[K(G.part,G.index)]:G.parts.some(De=>De.kind==="tool")?[l(v_,{parts:G.parts,strings:n,live:v,running:v&&Y===V.length-1},`steps#${G.indices[0]}`)]:G.parts.map((De,_e)=>K(De,G.indices[_e]??_e))),T&&l(gy,{}),t==="error"||h.value?l("div",{class:`${Oe}-error`,role:"alert",children:[l("span",{children:e.errorText??n.errorGeneric}),_?l("button",{type:"button",class:`${Oe}-error-retry`,onClick:()=>_(e),"data-testid":N.messageRetry,children:n.errorRetry}):null]}):null]})]}),E||te?l("div",{class:`${Oe}-bubble-meta`,children:[E?l("time",{class:`${Oe}-bubble-time`,dateTime:E.iso,title:E.full,children:E.short}):null,te?l("div",{class:`${Oe}-bubble-actions`,children:[L&&e.serverMessageId?l(Hp,{messageId:e.serverMessageId,initial:e.feedback??null,strings:n,onFeedback:u}):null,z?l(ly,{text:O,strings:n}):null]}):null]}):null]})})}function ly({text:e,strings:t}){let[n,r]=H(!1);function o(){navigator.clipboard?.writeText(e).then(()=>{r(!0),setTimeout(()=>r(!1),1500)}).catch(()=>{})}let a=n?t.copied:t.copy;return l("button",{type:"button",class:`${Oe}-msg-action`,"data-active":n?"true":void 0,"aria-label":a,title:a,onClick:o,"data-testid":N.messageCopy,children:n?l(qn,{}):l(Xd,{})})}function cy(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 uy({part:e,generativeUi:t,active:n,live:r,strings:o,showReasoning:a,showToolCalls:i,showSources:s,interactive:c,superseded:p,continuationStreaming:_,tool:d}){switch(e.kind){case"step-start":return null;case"text":return l(hr,{textSig:e.textSig,doneSig:e.doneSig,generativeUi:t,strings:o});case"reasoning":return a?l(fy,{part:e,active:n,strings:o}):null;case"tool":return l(_y,{part:e,strings:o,showToolCalls:i,interactive:c,superseded:p,continuationStreaming:_,live:r,tool:d});case"file":return l(dy,{part:e,strings:o});case"source":return s?l(s_,{part:e,strings:o}):null}}function dy({part:e,strings:t}){let n=e.filename??t.file;if(e.mediaType.startsWith("image/"))return l("a",{class:`${Oe}-file-image`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:l("img",{src:e.url,alt:n,loading:"lazy"})});let r=(n.includes(".")?n.split(".").pop():e.mediaType.split("/").pop())?.toUpperCase(),o=e.fileSize===void 0?void 0:py(e.fileSize);return l("a",{class:`${Oe}-file-chip`,href:e.url,target:"_blank",rel:"noreferrer noopener",title:n,"data-testid":N.messageFile,children:[l("span",{class:`${Oe}-file-chip-icon`,"aria-hidden":"true",children:l(Da,{})}),l("span",{class:`${Oe}-file-chip-text`,children:[l("span",{class:`${Oe}-file-chip-name`,children:n}),l("span",{class:`${Oe}-file-chip-meta`,children:[r,o].filter(Boolean).join(" \xB7 ")})]})]})}function py(e){let t=Math.min(Math.floor(Math.log10(Math.max(e,1))/3),2);return new Intl.NumberFormat(void 0,{style:"unit",unit:["byte","kilobyte","megabyte"][t],unitDisplay:"narrow",maximumFractionDigits:1}).format(e/1e3**t)}function _y({part:e,strings:t,showToolCalls:n,interactive:r,superseded:o,continuationStreaming:a,live:i,tool:s}){let c=ue(()=>Se(()=>e.approvalSig.value!==void 0),[e]);return s?.humanInLoop&&c.value?e.toolMetadata?.card==="questions"?l(p_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):l(l_,{part:e,strings:t,active:r,superseded:o,continuationStreaming:a,onDecision:s.onDecision,onEdit:s.onEdit}):n?l(f_,{part:e,strings:t,live:i,superseded:o}):null}function fy({part:e,active:t,strings:n}){return l("details",{class:`${Oe}-reasoning`,"data-testid":N.reasoning,open:t,"data-active":t?"true":void 0,children:[l("summary",{class:`${Oe}-reasoning-summary`,children:l("span",{class:`${Oe}-reasoning-label`,children:t?n.thinking:n.thoughts})}),l("div",{class:`${Oe}-reasoning-body`,children:l(hr,{textSig:e.textSig,doneSig:e.doneSig})})]})}function my(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 gy(){return l("span",{class:`${Oe}-typing`,"data-testid":N.typingDots,"aria-hidden":"true",children:[l("span",{}),l("span",{}),l("span",{})]})}function vy({label:e}){return l("span",{class:`${Oe}-loading`,role:"status",children:[l("span",{class:`${Oe}-loading-spinner`,"aria-hidden":"true"}),l("span",{class:`${Oe}-loading-label`,children:e})]})}var wn=A.cssPrefix,pl=120,hy=350;function b_({messagesSig:e,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,enableMessageFeedback:i,onFeedback:s,loading:c,onLoadPreviousMessages:p,idle:_,controlMode:d="ai-agent",tool:u,onRetry:f,form:m,formMarkers:h,onFillForm:S}){let P=F(null),y=Rt(()=>e.value),[C,v]=H(!1),[g,k]=H(!1),w=F(!1),T=F(!1),[E,M]=H(),L=F(!1),O=F(!1),z=F(!1),V=F(0);function K(){return z.current||performance.now()-V.current<hy}let te=F(0);function G(b){let U=b.scrollHeight-b.clientHeight>1;b.dataset.fadeTop=U&&b.scrollTop>1?"true":"false",b.dataset.fadeBottom=U&&b.scrollHeight-b.scrollTop-b.clientHeight>1?"true":"false"}function Y(b){return v(b.scrollHeight-b.scrollTop-b.clientHeight>pl*2)}function De(b){te.current=performance.now(),b.scrollTop=b.scrollHeight,G(b)}function _e(b,U){De(b);let J=U,Z=0;function ae(){O.current||K()||(De(b),--J>0&&(Z=requestAnimationFrame(ae)))}return U>0&&(Z=requestAnimationFrame(ae)),()=>cancelAnimationFrame(Z)}function Te(b,U){let J,Z,ae,Re=-1;function Pe(){J.disconnect(),Z.disconnect(),clearTimeout(ae)}function ve(){if(O.current||K()||Re>=0&&b.scrollTop<Re-4)return Pe();De(b),Re=b.scrollTop}return J=new ResizeObserver(ve),Z=new MutationObserver(ve),ve(),J.observe(b),Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),ae=setTimeout(Pe,U),Pe}let et=y.value[0]?.id;Tt(()=>{let b=P.current;if(b&&y.value.length!==0&&!T.current&&(L.current=!0,!!y.value.some(U=>U.role==="user")))return Te(b,300)},[et]);let Ue=F(0);D(()=>{let b=P.current,U=y.value,J=Ue.current;if(Ue.current=U.length,!b||!L.current||T.current)return;if(U.slice(J).some(ae=>ae.role==="user"))return O.current=!1,_e(b,3);if(!U.some(ae=>ae.role==="user")||O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<pl&&De(b)},[y.value.length]);let gt=F(null);D(()=>{let b=P.current,U=y.value.at(-1),J=gt.current;if(gt.current=U?{id:U.id,streaming:U.status==="streaming"}:null,!!b&&L.current&&!(!U||U.id!==J?.id||J.streaming||U.status!=="streaming"))return O.current=!1,_e(b,3)},[y.value]),D(()=>{let b=P.current;if(!b)return;let U=y.value.at(-1);if(!U||U.status!=="streaming"&&!y.value.some(ae=>ae.role==="user"))return;let J=()=>{if(O.current||K())return;b.scrollHeight-b.scrollTop-b.clientHeight<pl*2&&De(b)};if(U.status!=="streaming")return Te(b,300);J();let Z=new MutationObserver(J);return Z.observe(b,{childList:!0,subtree:!0,characterData:!0}),()=>Z.disconnect()},[y.value]);let Ge=m?.form.id,vt=!!m&&(h??[]).some(b=>b.formId===m.form.id);Tt(()=>{let b=P.current;!b||!Ge||O.current||y.value.some(U=>U.role==="user")&&(vt?b.querySelector(`[data-testid="${N.formGate}"]`)?.scrollIntoView({block:"nearest"}):De(b))},[Ge,vt]),D(()=>{let b=P.current;if(!b)return;let U=()=>{Y(b),G(b),performance.now()-te.current>150&&(O.current=b.scrollHeight-b.scrollTop-b.clientHeight>8)};function J(){O.current=!0}function Z(fe){fe.deltaY<0&&J()}let ae=0;function Re(fe){ae=fe.touches[0]?.clientY??0,z.current=!0}function Pe(fe){(fe.touches[0]?.clientY??0)>ae+4&&J()}function ve(){z.current=!1,V.current=performance.now()}function _t(){z.current=!0}return b.addEventListener("scroll",U,{passive:!0}),b.addEventListener("wheel",Z,{passive:!0}),b.addEventListener("touchstart",Re,{passive:!0}),b.addEventListener("touchmove",Pe,{passive:!0}),b.addEventListener("touchend",ve,{passive:!0}),b.addEventListener("touchcancel",ve,{passive:!0}),b.addEventListener("pointerdown",_t,{passive:!0}),window.addEventListener("pointerup",ve,{passive:!0}),window.addEventListener("pointercancel",ve,{passive:!0}),Y(b),()=>{b.removeEventListener("scroll",U),b.removeEventListener("wheel",Z),b.removeEventListener("touchstart",Re),b.removeEventListener("touchmove",Pe),b.removeEventListener("touchend",ve),b.removeEventListener("touchcancel",ve),b.removeEventListener("pointerdown",_t),window.removeEventListener("pointerup",ve),window.removeEventListener("pointercancel",ve)}},[]);function xt(){let b=P.current;b&&(O.current=!1,De(b))}let dt=y.value.filter(b=>!b.ephemeral),St=dt[0],kt=St?.serverMessageId??St?.id,Ee=!!(p&&dt.length>=qs&&kt!==E);async function He(){if(!p||w.current)return;let b=P.current,U=b?.scrollHeight??0,J=b?.scrollTop??0;w.current=!0,T.current=!0,k(!0);try{let Z=await p();Z===!1&&kt&&M(kt),Z&&b&&(await new Promise(ae=>requestAnimationFrame(()=>requestAnimationFrame(()=>ae()))),b.scrollTop=J+b.scrollHeight-U,G(b),Y(b))}finally{T.current=!1,w.current=!1,k(!1)}}let ye=[],ot="",he=y.value.at(-1)?.id,ht=[...h??[]].toSorted((b,U)=>(b.createdAt??1/0)-(U.createdAt??1/0));function Ke(b){return m&&b.formId===m.form.id?l(tl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip},`gate:${b.formId}`):l($p,{marker:b,strings:t,onFill:!m&&S?()=>S(b.formId):void 0},b.key)}function $t(b){for(let U=ht[0];U?.createdAt!==void 0&&!(b!==void 0&&U.createdAt>b);U=ht[0])ht.shift(),ye.push(Ke(U))}for(let b of y.value){if(b.role==="assistant"&&b.id!==he&&Fn(b))continue;$t(b.createdAt);let U=by(b.createdAt);U&&U!==ot&&(ye.push(l("div",{class:`${wn}-date-divider`,children:l("span",{class:`${wn}-date-pill`,title:yy(b.createdAt),children:Py(b.createdAt,t)})},`day:${U}`)),ot=U);let Z=b.retryAction!==void 0||b.role==="assistant"&&b.id===he?Na(y.value,b):void 0,ae=Z!==void 0&&(Z.kind!=="continue-assistant"||d==="ai-agent");ye.push(l(h_,{message:b,status:b.status,strings:t,responseMode:n,showReasoning:r,showToolCalls:o,showSources:a,interactive:!!_&&d==="ai-agent"&&b.id===he,superseded:b.id!==he,tool:u,onRetry:_&&ae&&(b.role==="user"||b.id===he)?f:void 0,enableMessageFeedback:i,onFeedback:s},b.id))}for(let b of ht)ye.push(Ke(b));return l("div",{class:`${wn}-list-wrap`,children:[l("div",{ref:P,class:`${wn}-list ${wn}-list--fade`,part:"messages",role:"log","aria-live":"polite","aria-relevant":"additions text",children:[c&&y.value.length===0?l("div",{class:`${wn}-list-loading`,role:"status",children:t.conversationLoading}):null,Ee?l("div",{class:`${wn}-load-previous`,children:l("button",{type:"button",onClick:He,disabled:g,"aria-busy":g,"data-testid":N.loadPreviousMessages,children:t.loadPreviousMessages})}):null,ye,m&&!vt?l(tl,{form:m.form,strings:t,onSubmit:m.onSubmit,onSkip:m.onSkip}):null]}),C?l("button",{type:"button",class:`${wn}-jump`,onClick:xt,"aria-label":t.scrollToBottom,title:t.scrollToBottom,"data-testid":N.scrollToBottom,children:l(cn,{})}):null]})}function by(e){if(typeof e!="number"||!Number.isFinite(e))return"";let t=new Date(e);return`${t.getFullYear()}-${t.getMonth()}-${t.getDate()}`}function yy(e){if(typeof e!="number"||!Number.isFinite(e))return"";try{return new Date(e).toLocaleDateString(void 0,{dateStyle:"full"})}catch{return""}}function Py(e,t){let n=new Date(e);function r(a){return new Date(a.getFullYear(),a.getMonth(),a.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"})}function ii({panelEl:e,resize:t,position:n,initialSize:r,onSizeChange:o,strings:a}){let i=A.cssPrefix,s=F(null);if(D(()=>{if(!e)return;let m=e.style;t.minWidth&&m.setProperty(`--${i}-resize-min-w`,t.minWidth),t.maxWidth&&m.setProperty(`--${i}-resize-max-w`,t.maxWidth),t.minHeight&&m.setProperty(`--${i}-resize-min-h`,t.minHeight),t.maxHeight&&m.setProperty(`--${i}-resize-max-h`,t.maxHeight),r&&(m.setProperty(`--${i}-widget-w`,`${r.width}px`),m.setProperty(`--${i}-widget-h`,`${r.height}px`))},[e,t.minWidth,t.maxWidth,t.minHeight,t.maxHeight,i,r]),!e)return null;let c=n.startsWith("top-"),p=n.endsWith("-right"),_=`${i}-resize-grip ${i}-resize-grip--${c?"bottom":"top"}-${p?"left":"right"}`;function d(m){if(!e)return;let h=m.currentTarget,S=e.getBoundingClientRect();s.current={pointerId:m.pointerId,startX:m.clientX,startY:m.clientY,startW:S.width,startH:S.height,dirX:p?-1:1,dirY:c?1:-1},h.setPointerCapture(m.pointerId),e.setAttribute("data-resizing",""),m.preventDefault()}function u(m){let h=s.current;if(!h||m.pointerId!==h.pointerId||!e)return;let S=(m.clientX-h.startX)*h.dirX,P=(m.clientY-h.startY)*h.dirY;e.style.setProperty(`--${i}-widget-w`,`${h.startW+S}px`),e.style.setProperty(`--${i}-widget-h`,`${h.startH+P}px`)}function f(m){let h=s.current;if(!h||m.pointerId!==h.pointerId||!e)return;m.currentTarget.releasePointerCapture(m.pointerId),e.removeAttribute("data-resizing");let S=e.getBoundingClientRect();o({width:Math.round(S.width),height:Math.round(S.height)}),s.current=null}return l("div",{class:_,role:"separator","aria-orientation":"vertical","aria-label":a.resizeHandle,title:a.resizeHandle,onPointerDown:d,onPointerMove:u,onPointerUp:f,onPointerCancel:f,"data-testid":N.resizeGrip,children:l($d,{})})}var y_=A.cssPrefix;function P_({suggestions:e,onPick:t,disabled:n=!1}){return e.length===0?null:l("div",{class:`${y_}-suggestions`,role:"group","aria-label":"Suggested replies",children:e.map((r,o)=>l("button",{type:"button",class:`${y_}-suggestion`,onClick:()=>t(r),disabled:n,"data-testid":ut(N.suggestion,o),children:r.label},r.id))})}var Vn=A.cssPrefix,xy=`.${Vn}-header, .${Vn}-back-header, .${Vn}-home-hero`,Sy='button, a, input, textarea, select, [role="tab"], [contenteditable]',x_=56;function si(e,t){D(()=>{if(!t||!e)return;function n(c){return Number.parseFloat(c)||0}function r(c,p){return Math.min(p,Math.max(-p,c))}let o=null,a=c=>{let p=c.target;if(!(p instanceof Element)||!p.closest(xy)||p.closest(Sy))return;let _=e.getBoundingClientRect();o={id:c.pointerId,x:c.clientX,y:c.clientY,dx:n(e.style.getPropertyValue(`--${Vn}-modal-dx`)),dy:n(e.style.getPropertyValue(`--${Vn}-modal-dy`)),maxX:(window.innerWidth+_.width)/2-x_,maxY:(window.innerHeight+_.height)/2-x_},e.dataset.dragging="true",c.preventDefault()},i=c=>{if(!o||c.pointerId!==o.id)return;let p=r(o.dx+c.clientX-o.x,o.maxX),_=r(o.dy+c.clientY-o.y,o.maxY);e.style.setProperty(`--${Vn}-modal-dx`,`${p}px`),e.style.setProperty(`--${Vn}-modal-dy`,`${_}px`)},s=c=>{!o||c.pointerId!==o.id||(o=null,delete e.dataset.dragging)};return e.addEventListener("pointerdown",a),window.addEventListener("pointermove",i),window.addEventListener("pointerup",s),window.addEventListener("pointercancel",s),()=>{e.removeEventListener("pointerdown",a),window.removeEventListener("pointermove",i),window.removeEventListener("pointerup",s),window.removeEventListener("pointercancel",s)}},[e,t])}function li({containerRef:e,onDrop:t,disabled:n=!1}){let[r,o]=H(!1);return D(()=>{if(n){o(!1);return}let a=e.current;if(!a)return;let i=0;function s(d){i+=1,d.dataTransfer?.types.includes("Files")&&(d.preventDefault(),o(!0))}function c(){i-=1,!(i>0)&&(i=0,o(!1))}function p(d){d.dataTransfer?.types.includes("Files")&&d.preventDefault()}function _(d){i=0,o(!1),d.dataTransfer&&(d.preventDefault(),t(d.dataTransfer.items))}return a.addEventListener("dragenter",s),a.addEventListener("dragleave",c),a.addEventListener("dragover",p),a.addEventListener("drop",_),()=>{a.removeEventListener("dragenter",s),a.removeEventListener("dragleave",c),a.removeEventListener("dragover",p),a.removeEventListener("drop",_)}},[e,n,t]),{visible:n?!1:r}}var We=A.cssPrefix;function S_(e){let{options:t,onClose:n}=e,r=t.strings,o=F(null);D(()=>{let p=o.current;if(!p)return;let _=Ha(p);function d(u){u.key==="Escape"&&n?.()}return p.addEventListener("keydown",d),()=>{_(),p.removeEventListener("keydown",d)}},[n]);let a=e.composerApiRef,i=e.composerActive&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,s=$(p=>{i&&a.current?.attachFromDrop(p)},[a,i]),{visible:c}=li({containerRef:o,onDrop:s,disabled:!i});return si(o.current,t.mode==="modal"),l("div",{ref:o,class:`${We}-panel`,part:"panel",role:"dialog","aria-modal":"false","aria-label":r.panelTitle,style:{position:"relative"},"data-testid":N.panel,children:[l(_l,{...e,containerEl:o.current,dragOver:c}),l(fl,{poweredBy:e.options.poweredBy})]})}function _l(e){let{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,composerKey:s,panelSize:c,view:p,canSend:_,isStreaming:d,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,sendPreparing:h,controlMode:S,assignedOperatorInitials:P,operatorAvailable:y,operatorRequestEnabled:C,onRequestOperator:v,onCancelOperatorRequest:g,loadingMessages:k,onLoadPreviousMessages:w,messagesSig:T,agent:E,suggestions:M,initialWidgetSize:L,onClose:O,onBack:z,onClear:V,onToggleHistory:K,onSelectHistoryConversation:te,onNewConversation:G,onWidgetSizeChange:Y,onSend:De,onStop:_e,onSuggestion:Te,activeForm:et,formMarkers:Ue,onFormSubmit:gt,onFormSkip:Ge,onFormFill:vt,tool:xt,onRetry:dt,onMessageFeedback:St,containerEl:kt,dragOver:Ee,composerApiRef:He}=e,ye=t.strings,ot=Rt(()=>T.value.some(ht=>!ht.ephemeral&&ht.role!=="system")).value,he;return et?.blocking?he=null:_?he=l(de,{children:[S&&S!=="ai-agent"?l(Cy,{controlMode:S,operatorInitials:P,operatorAvailable:y,onCancelOperatorRequest:g,strings:ye}):null,u&&S==="ai-agent"?l("div",{class:`${We}-loading ${We}-compaction-status`,role:"status","data-testid":N.compactionStatus,children:[l("span",{class:`${We}-loading-spinner`,"aria-hidden":"true"}),ye.compactingContext]}):null,!d&&!u&&S==="ai-agent"&&l(P_,{suggestions:M,onPick:Te,disabled:h}),l(bp,{options:t,transport:n,feedback:r,bus:o,persistence:a,conversationId:i,isStreaming:d,pageToolRunning:e.pageToolRunning,isMemoryCompacting:u,canReleaseQueuedMessages:f,queueManualMessages:m,active:e.composerActive&&p==="chat",isPreparing:h,operatorRequestEnabled:C,canRequestOperator:ot,controlMode:S,onRequestOperator:v,onSend:De,onStop:_e,apiRef:He},s)]}):he=l(wy,{label:ye.conversationClosed,ctaLabel:ye.startNewConversation,onNewConversation:V}),l(de,{children:[p==="history"?l(ky,{strings:ye,onBack:K,onClose:O,showClose:Oa(t.mode,c,t.actions)}):l("header",{class:`${We}-header`,part:"header","data-testid":N.panelHeader,children:[z?l("button",{type:"button",class:`${We}-icon-btn`,onClick:z,"aria-label":ye.moduleBack,title:ye.moduleBack,children:l(lo,{})}):null,E?l(Rp,{agent:E,strings:ye}):l("h1",{children:ye.panelTitle}),l(Qt,{panelProps:e,variant:"chat"})]}),p==="history"?l(Xa,{transport:n,strings:ye,locale:t.locale,persistence:a,onSelect:te,onNewConversation:G}):l(de,{children:[l(Np,{visible:Ee,strings:ye}),l(b_,{messagesSig:T,strings:ye,responseMode:t.responseMode,showReasoning:t.showReasoning,showToolCalls:t.showToolCalls,showSources:t.showSources,enableMessageFeedback:t.enableMessageFeedback,onFeedback:St,loading:k,onLoadPreviousMessages:w,idle:!d&&!h&&_&&!et?.blocking,controlMode:S,tool:xt,onRetry:dt,form:et?{form:et,onSubmit:gt,onSkip:Ge}:null,formMarkers:Ue,onFillForm:vt}),he,l(Ry,{disclaimer:t.composerDisclaimer})]}),t.size.resize?.enabled?l(ii,{panelEl:kt,resize:t.size.resize,position:t.position,initialSize:L,onSizeChange:Y,strings:ye}):null]})}function ky({strings:e,onBack:t,onClose:n,showClose:r}){return l("header",{class:`${We}-header`,part:"header",children:[l("button",{type:"button",class:`${We}-icon-btn`,onClick:t,"aria-label":e.historyBack,title:e.historyBack,children:l(lo,{})}),l("h1",{children:e.historyTitle}),r?l("button",{type:"button",class:`${We}-icon-btn`,onClick:n,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null]})}function wy({label:e,ctaLabel:t,onNewConversation:n}){return l("div",{class:`${We}-readonly-banner`,role:"note",children:[l("span",{class:`${We}-readonly-label`,children:e}),l("button",{type:"button",class:`${We}-readonly-cta`,onClick:n,children:t})]})}function Cy({controlMode:e,operatorInitials:t,operatorAvailable:n,onCancelOperatorRequest:r,strings:o}){let a=Ty(e,t,n,o);return l("div",{class:`${We}-operator-banner`,role:"status","data-mode":e,"data-testid":N.operatorBanner,children:[l("span",{class:`${We}-operator-pulse`,"aria-hidden":"true"}),l("span",{class:`${We}-operator-label`,children:a}),e==="awaiting-operator"&&r?l("button",{type:"button",class:`${We}-cancel-operator-request`,"data-testid":N.cancelOperatorRequest,onClick:r,children:o.cancelOperatorRequest}):null]})}function Ty(e,t,n,r){return e==="operator"?r.chattingWithOperator.replace("{operator}",t??""):n===!1?r.noOperatorAvailable:r.connectingOperator}function Ry({disclaimer:e}){return e?l("div",{class:`${We}-composer-footer`,children:l("div",{class:`${We}-disclaimer`,children:e})}):null}function fl({poweredBy:e}){return e?l("div",{class:`${We}-poweredby-bar`,children:l(Iy,{logoUrl:e.logoUrl,text:e.text,href:e.href})}):null}function Iy({logoUrl:e,text:t,href:n}){let r=l(de,{children:[e?l("img",{class:`${We}-poweredby-logo`,src:e,alt:"",loading:"lazy"}):null,t?l("span",{children:t}):null]});return n?l("a",{class:`${We}-poweredby`,href:n,target:"_blank",rel:"noopener noreferrer",children:r}):l("span",{class:`${We}-poweredby`,children:r})}var ci=A.cssPrefix;function k_({panelProps:e,enabledModules:t,nav:n,bus:r,hasUnread:o,latestNews:a,onSelectConversation:i,onStartNewConversation:s,onSetPanelSize:c}){let p=e.options,_=p.strings,d=F(null),u=F(new Set);D(()=>{let V=d.current;if(!V)return;let K=Ha(V);function te(G){G.key==="Escape"&&e.onClose?.()}return V.addEventListener("keydown",te),()=>{K(),V.removeEventListener("keydown",te)}},[e.onClose]);let f=Rt(()=>n.sig.value).value,m=xd(f),h=p.modules.byId[f.activeTab],S=e.composerActive&&h?.layout==="chat"&&m===void 0,P=e.composerApiRef,y=S&&e.view==="chat"&&e.canSend&&!e.activeForm?.blocking&&!e.sendPreparing&&e.options.features.fileUpload,C=$(V=>{y&&P.current?.attachFromDrop(V)},[P,y]),{visible:v}=li({containerRef:d,onDrop:C,disabled:!y});si(d.current,p.mode==="modal");let g=m?.kind==="iframe"||m?.kind==="content",k=t.length>1&&(Sd(f)||!g),w=F(null);D(()=>{if(g&&w.current===null)w.current=e.panelSize,e.panelSize==="normal"&&c("expanded");else if(!g&&w.current!==null){let V=w.current;w.current=null,c(V)}},[g]);let T={push:V=>n.push(V),pop:()=>n.pop(),switchTab:V=>n.switchTab(V),switchToLayout:V=>{let K=t.find(te=>te.layout===V);K&&n.switchTab(K.id)},selectConversation:i,startNewConversation:s};function E(V){return{options:p,transport:e.transport,strings:_,config:V,nav:T,bus:r,panelProps:e,latestNews:a}}let M=l(Qt,{panelProps:e,variant:"plain"});h&&u.current.add(h.id);let L=t.filter(V=>u.current.has(V.id));function O(V){if(V.layout==="chat")return l(_l,{...e,composerActive:S,containerEl:d.current,dragOver:v});let K=Qa[V.layout].Root;return K?l(K,{...E(V)}):null}function z(){return m?.kind==="iframe"?l(Tp,{url:m.url,title:m.title,strings:_,onBack:()=>n.pop(),actions:M}):m?.kind==="content"?l(lp,{id:m.id,title:m.title,transport:e.transport,strings:_,bus:r,onBack:()=>n.pop(),actions:M}):null}return l("div",{ref:d,class:`${ci}-panel ${ci}-messenger`,part:"panel",role:"dialog","aria-modal":"false","aria-label":_.panelTitle,style:{position:"relative"},"data-testid":N.messengerHome,children:[l("div",{class:`${ci}-messenger-body`,children:[L.map(V=>l("div",{class:`${ci}-messenger-pane`,hidden:g||V.id!==h?.id,children:O(V)},V.id)),z()]}),k?l(wp,{modules:t,activeTab:f.activeTab,strings:_,hasUnread:o,onSelect:V=>n.switchTab(V)}):null,l(fl,{poweredBy:p.poweredBy}),p.size.resize?.enabled&&!(h?.layout==="chat"&&!m)?l(ii,{panelEl:d.current,resize:p.size.resize,position:p.position,initialSize:e.initialWidgetSize,onSizeChange:e.onWidgetSizeChange,strings:_}):null]})}var yo=A.cssPrefix;function w_({strings:e,onClose:t}){return l("div",{class:`${yo}-panel ${yo}-modules-empty`,part:"panel",role:"dialog","aria-label":e.panelTitle,"data-testid":N.modulesEmpty,children:[t?l("button",{type:"button",class:`${yo}-icon-btn ${yo}-modules-empty-close`,onClick:t,"aria-label":e.close,title:e.close,children:l(Bt,{})}):null,l("p",{class:`${yo}-modules-empty-text`,children:e.modulesEmpty})]})}function C_(e){let t=A.cssPrefix,{site:n,blocks:r,strings:o,collapsed:a}=e,i=r?.navigation??[],s=r?.linkCards??[],c=a?o.expandSidebar:o.collapseSidebar;return l("aside",{class:`${t}-sidebar`,"data-collapsed":a?"true":"false","data-testid":N.sidebar,children:[l("div",{class:`${t}-sidebar-header`,children:[l(Ey,{site:n}),l("button",{type:"button",class:`${t}-sidebar-toggle`,"aria-label":c,"aria-expanded":a?"false":"true",title:c,onClick:e.onToggleCollapsed,"data-testid":N.sidebarToggle,children:l(Ay,{collapsed:a})})]}),a?null:l(de,{children:[i.length>0?l("nav",{class:`${t}-sidebar-section`,"data-section":"navigation",children:l(My,{items:i})}):null,s.length>0?l("div",{class:`${t}-sidebar-section`,"data-section":"link-cards",children:l(Ny,{items:s})}):null,e.showConversations?l("div",{class:`${t}-sidebar-conversations`,children:l(Xa,{transport:e.transport,strings:e.strings,locale:e.locale,persistence:e.persistence,onSelect:e.onSelectConversation,onNewConversation:e.onNewConversation})}):null]})]})}function Ey({site:e}){let t=A.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??A.name})}function Ay({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 My({items:e}){let t=A.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 Ny({items:e}){let t=A.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 T_=A.cssPrefix;function R_(e){return l("main",{class:`${T_}-page-shell`,"data-sidebar-collapsed":e.sidebarCollapsed?"true":"false",children:[l(C_,{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:`${T_}-page-chat`,"aria-label":e.strings.panelTitle,children:e.children})]})}var Po=ne.scope("hitl");function ui(e){return e.kind==="tool"&&Wt(e.toolMetadata)&&(e.stateSig.value==="input-available"||e.stateSig.value==="approval-responded"&&e.approvalSig.value?.approved===!0)}function I_(e,t){t.errorSig.value=sl(t.toolCallId),t.stateSig.value="output-error",e.partsSig.value=[...e.partsSig.value]}function Ly(e,t){let n=e.slice(0,e.indexOf(t)).findLast(r=>r.role==="user");return n!==void 0&&It.sentHere(n.id)}function E_(e){let{streaming:t,controlModeSig:n,messagesSig:r,sendAiTurn:o,bus:a,humanInLoop:i,tools:s}=e,c=F(t);c.current=t;let p=F(s);p.current=s;let _=F(new Map),[d,u]=H(!1),f=$((v,g,k)=>{if(c.current||n.value!=="ai-agent")return!1;let w=r.value.at(-1),T=w?.partsSig.value.findIndex(L=>L.kind==="tool"&&L.toolCallId===v)??-1,E=w?.partsSig.value[T];if(!w||E?.kind!=="tool")return Po.warn("decideTool: tool part not found",{toolCallId:v}),!1;if(w.status!=="complete"||!Ea(w,T)||!g(E))return!1;if(k(E),w.partsSig.value=[...w.partsSig.value],!Bn(w)||w.partsSig.value.some(ui))return!0;w.status="streaming",w.retryAction={kind:"continue-assistant",messageId:w.serverMessageId??w.id},w.awaitingContinuation=!0,r.value=[...r.value];let M=w.partsSig.value.flatMap(L=>L.kind==="tool"?[L.toolCallId]:[]);return o({continueExisting:!0}).then(L=>L&&It.clear(M)),!0},[n,r,o]),m=$((v,g)=>{let{toolCallId:k,toolName:w}=g;_.current.has(k)||(_.current.set(k,v),u(!0),e_({toolCallId:k,toolName:w,input:g.inputSig.value,optionTools:p.current??[],onSettled:(T,E)=>{Po.info("toolResult",{toolCallId:k,status:T}),a.emit("toolResult",{toolCallId:k,name:bo(w),status:T,durationMs:E})}}).then(T=>{_.current.delete(k)&&(u(_.current.size>0),f(k,ui,E=>{T.state==="output-available"?E.outputSig.value=T.output:E.errorSig.value=T.errorText,E.stateSig.value=T.state}))}))},[a,f]),h=$(()=>{let v=r.value;for(let[w,T]of _.current){let E=v.findIndex(M=>M.id===T);E<0||E===v.length-1||(_.current.delete(w),t_(w),u(_.current.size>0))}let g=v.at(-1);if(c.current||g?.role!=="assistant"||g.status!=="complete")return;let k=g.partsSig.value.filter(w=>ui(w)&&w.stateSig.value==="input-available");if(!(k.length===0||!Ly(v,g)))for(let w of k)It.get(w.toolCallId)?.state==="stopped"?I_(g,w):m(g.id,w)},[r,m]);D(()=>h(),[t,h]),D(()=>r.subscribe(()=>h()),[r,h]);let S=$((v,g,k)=>{let w=!1,T;if(!f(v,L=>L.stateSig.value==="approval-requested",L=>{Wt(L.toolMetadata)&&(T=L),w=L.toolMetadata?.card==="questions";let O=L.approvalSig.value?.id??v;L.approvalSig.value={id:O,approved:g,reason:k},L.stateSig.value="approval-responded"}))return;let M=r.value.at(-1);if(T&&g&&M&&m(M.id,T),T&&!g&&a.emit("toolResult",{toolCallId:v,name:bo(T.toolName),status:"declined",durationMs:0}),w){Po.info("toolResult",{toolCallId:v}),a.emit("toolResult",{toolCallId:v});return}Po.info("toolDecision",{toolCallId:v,approved:g}),a.emit("toolDecision",{toolCallId:v,approved:g})},[a,f,r,m]),P=$(v=>{f(v,g=>g.stateSig.value==="approval-responded"&&g.approvalSig.value?.approved!==void 0&&!ui(g),g=>{let k=g.approvalSig.value?.id??v;g.approvalSig.value={id:k},g.stateSig.value="approval-requested"})},[f]),y=ue(()=>({humanInLoop:i,onDecision:S,onEdit:P}),[i,S,P]),C=$(()=>{let v=r.value.at(-1);for(let g of _.current.keys()){let k=v?.partsSig.value.find(w=>w.kind==="tool"&&w.toolCallId===g);v&&k?I_(v,k):sl(g),Po.info("toolResult",{toolCallId:g,status:"stopped"}),a.emit("toolResult",{toolCallId:g,name:k?bo(k.toolName):void 0,status:"stopped",durationMs:0})}_.current.clear(),u(!1)},[a,r]);return{toolInteraction:y,pageToolsRunning:d,stopPageTools:C}}var Oy=ne.scope("latest-news");function A_({transport:e,options:t,persistence:n,enabled:r}){let o=t.modules.list.find(d=>d.layout==="news")?.contentCollectionIds,a=o?.join(","),[i,s]=H(),[c,p]=H(()=>n.loadSeenNewsId());D(()=>{if(!r||!o?.length)return;let d=!1;return e.listContent({contentCollectionIds:o,sortBy:"publishedAt",sortOrder:"desc",limit:1}).then(u=>{d||s(u.items[0])}).catch(u=>Oy.debug("listContent (latest news) failed (non-fatal)",{err:u})),()=>{d=!0}},[e,r,a]);let _=$(d=>{n.saveSeenNewsId(d),p(d)},[n]);return{item:i,unseen:i!==void 0&&i.id!==c,markSeen:_}}function M_({callout:e,persistence:t}){let n=e?.text??"",r=e?.persistent??!0,[o,a]=H(()=>r?!1:t.loadCalloutDismissed(n));D(()=>{a(r?!1:t.loadCalloutDismissed(n))},[n,r,t]);let i=$(()=>{a(!0),r||t.saveCalloutDismissed(n)},[t,n,r]);return{dismissed:o,dismissCallout:i}}function N_(e){let{transport:t,conversationIdSig:n}=e,r=Nt("ai-agent"),o=Nt(void 0),a=Nt(void 0),i=F(void 0),s=$(d=>{let u=d.controlRevision,f=i.current;f&&f.conversationId===n.value&&u<f.revision||(i.current={conversationId:n.value,revision:u},r.value=d.controlMode,o.value=d.assignedOperatorInitials,d.controlMode!=="awaiting-operator"?a.value=void 0:d.operatorAvailable!==void 0&&(a.value=d.operatorAvailable))},[n,r,o,a]),c=$(d=>{if(d.type!=="data-control-state")return;let u=Ju(d.data);u&&s(u)},[s]),p=$(async()=>{let d=n.value,u=await t.requestOperator();u&&n.value===d&&s(u)},[t,n,s]),_=$(async()=>{let d=n.value,u=await t.cancelOperatorRequest();u&&n.value===d&&s(u)},[t,n,s]);return{controlModeSig:r,assignedOperatorInitialsSig:o,operatorAvailableSig:a,applyControlState:s,adoptControlStateChunk:c,requestOperator:p,cancelOperatorRequest:_}}var di=A.cssPrefix,L_=`--${di}-visual-viewport-height`,O_=`--${di}-visual-viewport-top`;function $_(e){let{hostElement:t,mode:n,panelSize:r,isOpen:o,surfaceReady:a,setIsOpen:i}=e;Tt(()=>{Yo(t,$a(n,r,o))},[t,o,r,n]),Tt(()=>{if(!o||!a)return;let s=t.ownerDocument.defaultView,c=s?.visualViewport,p=t.shadowRoot?.querySelector(`.${di}-anchor`);if(!s||!c||!p)return;let _=()=>{p.style.setProperty(L_,`${c.height}px`),p.style.setProperty(O_,`${c.offsetTop}px`)},d=0,u=()=>{s.cancelAnimationFrame(d),d=s.requestAnimationFrame(()=>{d=s.requestAnimationFrame(_)})};return _(),c.addEventListener("resize",u),c.addEventListener("scroll",u),()=>{s.cancelAnimationFrame(d),c.removeEventListener("resize",u),c.removeEventListener("scroll",u),p.style.removeProperty(L_),p.style.removeProperty(O_)}},[t,o,a]),D(()=>{if(n!=="modal"||!o)return;function s(c){c.composedPath().some(_=>_ instanceof HTMLElement&&_.classList.contains(`${di}-panel`))||i(!1)}return t.addEventListener("click",s),()=>t.removeEventListener("click",s)},[t,o,n,i]),D(()=>{if(n!=="drawer"||!o)return;function s(c){c.key==="Escape"&&i(!1)}return document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[o,n,i])}var ml=ne.scope("reducer"),pi=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 r=sn();r.id=t.id;let o=Wn(t)||Un(t)&&(t.status!=="streaming"||Bn(t)),a=t.status==="streaming"&&Bn(t)&&no(t);this.replay={baseline:t,shadow:r,chunks:[n],probeContinuation:o,continuationTailReplay:a,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),a=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(!a)return this.detach(),null;if(a===t.baseline)return t;let i=t.baseline;return t.baseline=a,D_(i,a),t.liveCatchUp&&Wn(t.shadow)&&(a.status==="streaming"||Un(a))?(t.probeContinuation=!1,t.continuationTailReplay=!1,t):(t.probeContinuation=Wn(a)||Un(a)&&(a.status!=="streaming"||Bn(a)),t.continuationTailReplay=a.status==="streaming"&&Bn(a)&&no(a),t.liveCatchUp=a.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),a=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(!a)return this.detach(),null;if(a===t)return t;D_(t,a);let i=Wn(t)&&Un(a);return a.status!=="streaming"&&!i?(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 Ft(()=>{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=Aa(n);return this.replay=null,Ft(()=>{if(t){let a=n.partsSig.value.findLastIndex(i=>i.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 r)this.apply(a);n.continuationStreaming=o||void 0,this.messagesSig.value=[...this.messagesSig.value]}),n}settleOwnedContinuation(t){let{baseline:n}=this.replay,r=Aa(n);return this.replay=null,Ft(()=>{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 a=t.messageId,i=a!==void 0?this.messagesSig.value.find(_=>_.serverMessageId===a||_.id===a):void 0;if(i!==void 0)return t.messageMetadata?.senderRole==="visitor"&&i.role==="user"&&(i.status==="pending"||i.status==="error")&&(i.serverMessageId=a,i.status="complete",i.errorText=void 0,i.retryAction=void 0,this.messagesSig.value=[...this.messagesSig.value]),this.beginReplay(i,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&&!Vt(c))return this.attach(c),this.apply(t),null;let p=sn();return this.attach(p),this.messagesSig.value=[...this.messagesSig.value,p],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:a,probeContinuation:i,continuationTailReplay:s,liveCatchUp:c}=r,p=t.type==="finish"||t.type==="error"||t.type==="abort";if(i){if(!Fy(o,a,t))return p&&(qy(o,a)&&(o.continuationStreaming=!0,this.messagesSig.value=[...this.messagesSig.value],this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id})),this.detach()),null;let d=Wn(o)&&p?this.settleOwnedContinuation(t):this.promoteContinuation();return p?(d.continuationStreaming&&(t.type==="finish"?this.onReconcileNeeded?.({messageId:d.serverMessageId??d.id}):d.continuationStreaming=!1),this.detach(),d):null}if(s&&Dy(o,a)){let d=this.promoteContinuation(!0);return p?(this.detach(),d):null}if(!c)return p&&this.detach(),null;if(p&&!Vt(o)&&Vt(a)){let d=this.promoteReplay();return this.detach(),d}if(!$y(o,a))return p&&(this.onReconcileNeeded?.({messageId:o.serverMessageId??o.id}),this.detach()),null;let _=this.promoteReplay();return p?(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 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}`,a=this.openTextParts.get(o);if(a)return a;let i={kind:n,id:`${r}#${this.partSeq++}`,textSig:se(""),doneSig:se(!1)};return this.openTextParts.set(o,i),xo(t,i),i}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":xo(n,{kind:"step-start",id:`ss-${this.partSeq++}`});return;case"finish":ml.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":ml.warn("stream error chunk",{errorText:t.errorText}),n.status="error",n.errorText=t.errorText,this.bumpDone(n);return;case"abort":ml.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":zy(n,t);return;case"file":xo(n,{kind:"file",url:t.url,mediaType:t.mediaType});return;case"source-url":F_(n,{kind:"source",sourceId:t.sourceId,url:t.url,title:t.title});return;case"source-document":F_(n,{kind:"source",sourceId:t.sourceId,title:t.title,filename:t.filename,mediaType:t.mediaType});return;case"data-suggestions":n.suggestions=Ra(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){Ft(()=>{t.partsSig.value=[...t.partsSig.value],this.messagesSig.value.includes(t)&&(this.messagesSig.value=[...this.messagesSig.value])})}},gl={"input-streaming":0,"input-available":1,"approval-requested":2,"approval-responded":3,"output-available":4,"output-denied":4,"output-error":4};function Wn(e){return e.awaitingContinuation===!0||e.continuationStreaming===!0||e.retryAction?.kind==="continue-assistant"}function D_(e,t){e.canceled&&(t.canceled=!0),!(!Wn(e)||t.status!=="streaming"&&!Un(t))&&(t.awaitingContinuation??(t.awaitingContinuation=e.awaitingContinuation),t.continuationStreaming??(t.continuationStreaming=e.continuationStreaming),t.retryAction===void 0&&(t.retryAction=e.retryAction))}function $y(e,t){let n=e.partsSig.value,r=t.partsSig.value;return e.role!==t.role||r.length<n.length?!1:n.every((o,a)=>B_(o,r[a]))}function Dy(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]:[])),a=t.partsSig.value.filter(s=>s.kind!=="tool"||!o.has(s.toolCallId)),i=n.slice(r+1);return a.length<i.length?!1:i.every((s,c)=>B_(s,a[c]))}function B_(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||!Ma(t.toolName,e.toolName)||gl[t.stateSig.value]<gl[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 Fy(e,t,n){return By(e,n)||!Uy(e,t)?!0:n.type!=="finish"&&n.type!=="error"&&n.type!=="abort"?!1:no(t)||e.awaitingContinuation===!0&&n.type!=="finish"?!0:e.awaitingContinuation===!0&&t.partsSig.value.every(r=>r.kind==="step-start")}function By(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&&gl[n.stateSig.value]<4}function Uy(e,t){let n=t.partsSig.value;if(n.length===0)return!0;let r=e.partsSig.value;return r.some((o,a)=>n.every((i,s)=>Hy(r[a+s],i)))}function Hy(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"||Ma(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 qy(e,t){if(Wn(e)||!Un(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 Cn(e,t,n,r,o){let a=e.partsSig.value.find(s=>s.kind==="tool"&&s.toolCallId===t);if(a)return r&&(a.dynamic=!0),a.toolMetadata??(a.toolMetadata=o),a;let i={kind:"tool",toolCallId:t,toolName:n??"tool",dynamic:r?!0:void 0,toolMetadata:o,inputPartialSig:se(""),inputSig:se(void 0),outputSig:se(void 0),errorSig:se(void 0),stateSig:se("input-streaming"),approvalSig:se(void 0)};return xo(e,i),i}function xo(e,t){e.partsSig.value=[...e.partsSig.value,t]}function F_(e,t){e.partsSig.value.some(n=>n.kind==="source"&&n.sourceId===t.sourceId)||xo(e,t)}function zy(e,t){switch(t.type){case"tool-input-start":Cn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);return;case"tool-input-delta":{let n=Cn(e,t.toolCallId);n.inputPartialSig.value+=t.inputTextDelta;return}case"tool-input-available":{let n=Cn(e,t.toolCallId,t.toolName,t.dynamic,t.toolMetadata);n.inputSig.value=t.input,n.stateSig.value="input-available";return}case"tool-input-error":{let n=Cn(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=Cn(e,t.toolCallId,t.toolName);n.approvalSig.value={id:t.approvalId},n.stateSig.value="approval-requested";return}case"tool-output-available":{let n=Cn(e,t.toolCallId,void 0,t.dynamic);n.outputSig.value=t.output,n.stateSig.value="output-available";return}case"tool-output-error":{let n=Cn(e,t.toolCallId,void 0,t.dynamic);n.errorSig.value=t.errorText,n.stateSig.value="output-error";return}case"tool-output-denied":{let n=Cn(e,t.toolCallId);n.stateSig.value="output-denied";return}default:return}}async function U_(e){let t=1e3,n=!1,r=!1,o=!1;function a(){o||e.signal.aborted||(o=!0,e.onInitialBoundaryReady())}for(;!e.signal.aborted;){let i,s="held";try{s=await e.connect(()=>{if(e.signal.aborted)return;i=e.now();let c=n||r;n=!0,r=!1,o?c&&e.backfill():a()})}catch{}if(e.signal.aborted||(!n&&i===void 0&&(r=!0,a()),s==="unavailable"))return;i!==void 0&&e.now()-i>=1e3&&(t=1e3),await e.sleep(t),t=Math.min(t*2,15e3)}}var jy=120;function H_(e){let{activated:t,conversationReady:n,conversationIdSig:r,messagesSig:o,optionsRef:a,transport:i,visitorId:s,adoptControlStateChunk:c,adoptMemoryCompactionStateChunk:p,settleSuggestions:_,recordConversationReply:d,transcriptRecoverySig:u,beginConversationTranscript:f,commitConversationTranscript:m,onReplyLanded:h,runCancellation:S,canContinueRef:P,setCanSend:y,feedback:C,bus:v,loadInitialThread:g,shouldReconcileOnConnect:k}=e,w=F(0);D(()=>{if(!t||!n||!r.value)return;let T=r.value,E=new AbortController,M=b=>{},L=new pi(o,b=>M(b));i.primeIdentity(s,T);let O=!1,z=!1,V,K=!1,te,G=0,Y=P.current,De,_e,Te=Date.now(),et,Ue=!1,gt=!1;function Ge(b,U,J){if(!Vt(b))return;let Z=o.value.findLast(Re=>!Re.ephemeral),ae=b.serverMessageId??b.id;if(!(Z&&(Z.serverMessageId??Z.id)!==ae))return Ia(o.value,b,T,a.current.strings.newConversation,U,J)}function vt(b,U,J,Z){let ae=Ge(b,U,Z);if(!ae)return;let Pe=`${b.serverMessageId??b.id}:${J}:${ae.preview??""}`;Pe!==_e&&(_e=Pe,i.publishConversation({...ae,hasUnread:!0},!0))}let xt;function dt(){xt&&(clearTimeout(xt.timer),xt=void 0)}function St(){let b=xt;if(!b)return;clearTimeout(b.timer),xt=void 0;let U=o.value.find(J=>(J.serverMessageId??J.id)===b.replyId);U?.role!=="assistant"&&U?.role!=="operator"||vt(U,b.canContinue,b.generation,b.activityAt)}function kt(b,U,J,Z){dt(),xt={replyId:b.serverMessageId??b.id,canContinue:U,generation:J,activityAt:Z,timer:setTimeout(St,jy)}}function Ee(b,U,J,Z=Date.now(),ae=!0){dt();let Re=Ge(b,U,Z);if(!Re)return;let ve=`${b.serverMessageId??b.id}:${J}`;ve!==De&&(De=ve,d(Re),ae&&et&&(Ue=!0))}function He(b,U){(b||!S.localSendRef.current)&&S.settle(U),b&&h()}function ye(b,U=[],J=!1,Z,ae=Y,Re=G,Pe=Date.now(),ve=!0){let _t=a.current;if(b.canceled){Ee(b,ae,Re,Pe,ve),He(J,Z);return}let fe=!0,at=b.status==="error";switch(sd(b,at)){case"drop":o.value=o.value.filter(qe=>qe!==b),fe=!1;break;case"complete-operator-routed":b.status="complete",J&&(C.play("messageReceived"),_r(v,_t,"assistant",Ve(b)));break;case"error":{if(b.status="error",b.errorText=_t.strings.errorGeneric,J){C.play("error");let qe=new Error(at?"stream error chunk":"empty reply");v.emit("error",qe),_t.onError?.(qe)}break}case"complete":b.status="complete",J&&(C.play("messageReceived"),_r(v,_t,"assistant",Ve(b))),_(b,U);break}fe&&Ee(b,ae,Re,Pe,ve),He(J,Z)}function ot(b){if(E.signal.aborted||r.value!==T)return;if(c(b),p?.(b),b.type==="start"){St();let qe=b.messageId===void 0?void 0:o.value.find(B=>B.serverMessageId===b.messageId||B.id===b.messageId);K=qe!==void 0&&qe.status!=="streaming";let qt=te?.senderRole==="visitor"?te.messageId:void 0;if(te={messageId:b.messageId,senderRole:b.messageMetadata?.senderRole},G+=1,Te=Date.now(),_e=void 0,O=b.messageMetadata?.senderRole===void 0,z=!1,V=O?b.messageMetadata?.runId:void 0,O){let B=b.messageId!==void 0&&o.value.some(it=>it.serverMessageId===b.messageId||it.id===b.messageId),Q=o.value.at(-1),ee=b.messageId!==void 0&&(Q?.serverMessageId===b.messageId||Q?.id===b.messageId),me=S.localSendRef.current&&(!B||ee)&&Q?.role==="assistant"&&Q.status==="streaming"&&(ee||Q.serverMessageId===void 0&&Q.partsSig.value.length===0);z=S.captureStart(T,b,me,qt)}}let U=O&&(b.type==="finish"||b.type==="error"||b.type==="abort"),J=U?V:void 0,Z=U&&(z||S.ownsLocalRun(J)),ae=G,Re=K;b.type==="finish"&&b.canContinue!==void 0&&(Y=b.canContinue);let Pe=Y;U&&(O=!1,z=!1,V=void 0);let ve=L.applyResume(b),_t=te?.messageId,fe=_t===void 0?void 0:o.value.find(qe=>qe.serverMessageId===_t||qe.id===_t);K&&te?.senderRole!=="visitor"&&(ve!==null||fe?.status==="streaming")&&(K=!1,Re=!1);let at=!K&&(fe?.role==="assistant"||fe?.role==="operator");if(b.type==="text-delta"&&at&&kt(fe,Y,G,Te),b.type==="text-end"&&(dt(),at&&vt(fe,Y,G,Te)),b.type==="finish"&&b.canContinue===!1&&y(!1),!ve){U&&(Z||!S.localSendRef.current)&&S.settle(J);return}if(ve.role==="operator"){Re||(C.play("messageReceived"),_r(v,a.current,"operator",Ve(ve))),Ee(ve,Pe,ae,Te),K=!1,U&&(Z||!S.localSendRef.current)&&S.settle(J);return}ve.role==="assistant"&&(ye(ve,[],Z,J,Pe,ae,Te),K=!1)}async function he(b){let U=G,J=await i.loadConversation(T,b?{ids:[b]}:void 0).catch(()=>null);if(E.signal.aborted||r.value!==T||!J)return!1;J.controlState&&c({type:"data-control-state",data:J.controlState});let Z=o.value.at(-1),ae=U===G&&(b===void 0||Z!==void 0&&(Z.serverMessageId===b||Z.id===b));if(J.messages.length===0)return!0;ae&&(Y=J.canContinue,y(Y));let Re=o.value,Pe=b===void 0?Re.at(-1):Re.find(B=>B.serverMessageId===b||B.id===b),{messages:ve,changed:_t}=ro(Re,Pn(J.messages));if(!_t)return!0;o.value=ve;let fe=b===void 0?ve.at(-1):ve.find(B=>B.serverMessageId===b||B.id===b),at=Pe!==void 0&&fe!==void 0&&(Pe.id===fe.id||Pe.serverMessageId!==void 0&&Pe.serverMessageId===fe.serverMessageId),qe=fe!==void 0&&fe.status!=="streaming"&&(!at||Pe?.status==="streaming"),qt=at&&Pe?.status==="streaming"?Date.now():fe?.createdAt;return ae&&qe&&fe.role==="assistant"?ye(fe,fe.suggestions??[],S.localSendRef.current,void 0,J.canContinue,U,qt,!1):ae&&qe&&fe.role==="operator"?Ee(fe,J.canContinue,U,qt,!1):ae&&fe?.role==="assistant"&&fe.status!=="streaming"&&_(fe,fe.suggestions??[]),!0}let ht=new Set;M=({messageId:b})=>{if(ht.has(b)||!o.value.some(J=>J.serverMessageId===b||J.id===b))return;ht.add(b);function U(){return ht.delete(b)}he(b).then(U,U)};function Ke(b=!1){if(E.signal.aborted||r.value!==T){Ue=!1;return}if(et){Ue=!0;return}let U=b?g(T)??(k()?he():void 0):he();if(!U)return;f(T),et=U;function J(Z=!1){if(et===U){if(et=void 0,Ue){Ue=!1,Ke();return}Z&&m(T)}}U.then(J,()=>J(!1))}let $t=u.subscribe(b=>{b<=w.current||(w.current=b,gt&&Ke())});return U_({signal:E.signal,now:()=>performance.now(),sleep:b=>Hn(b,E.signal),connect:b=>i.connectResumeStream({signal:E.signal,onChunk:ot,onConnected:b}),onInitialBoundaryReady:()=>{gt=!0,Ke(!0)},backfill:()=>Ke()}),()=>{E.abort(),dt(),$t(),L.detach()}},[t,n,r,r.value,s,i,c,p,_,d,u,f,m,h,S,P,y,o,v,C,g,k])}var Vy=32;function q_(e){let{transport:t,setStreaming:n}=e,r=F(void 0),o=F(void 0),a=F(!1),i=F(void 0),s=F(!1),c=F(new Map),p=F(new Set),_=$((g,k)=>{let w=`${g}:${k}`;i.current!==w&&(i.current=w,t.cancelTurn(g,k))},[t]),d=$(g=>{r.current=void 0,o.current=g,a.current=!1,i.current=void 0,s.current=!0,n(!0)},[n]),u=$((g,k)=>{c.current.set(g,{messageId:k})},[]),f=$(g=>{g!==void 0&&(p.current.add(g),p.current.size>Vy&&p.current.delete(p.current.values().next().value)),!(g!==void 0&&r.current?.runId!==g)&&(r.current=void 0,o.current=void 0,a.current=!1,s.current=!1,n(!1))},[n]),m=$((g,k)=>o.current!==g?k.runId&&r.current?.runId===k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId),!0):!1:(o.current=void 0,k.runId?(r.current={conversationId:k.conversationId,runId:k.runId},n(!0),a.current&&_(k.conversationId,k.runId),!0):(f(),!0)),[_,n,f]),h=$((g,k)=>{let w=c.current.get(g);return w?(c.current.delete(g),!k.runId||p.current.has(k.runId)?!0:w.runId!==void 0?(w.runId!==k.runId||r.current?.runId===k.runId&&(r.current={conversationId:k.conversationId,runId:k.runId},a.current&&_(k.conversationId,k.runId)),!0):(s.current||o.current||(r.current={conversationId:k.conversationId,runId:k.runId},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0)),!0)):!1},[_,n]),S=$(g=>o.current!==g?!1:(f(),!0),[f]),P=$(g=>{let k=c.current.get(g);return k?(c.current.delete(g),k.runId===void 0):!1},[]),y=$((g,k,w,T)=>{let E=k.messageMetadata?.runId;if(k.messageMetadata?.senderRole!==void 0||typeof E!="string"||!E||p.current.has(E))return!1;if(r.current?.runId===E)return s.current;if(s.current)return r.current||!w?!1:(o.current=void 0,r.current={conversationId:g,runId:E},n(!0),a.current&&_(g,E),!0);let L=[...c.current.values()].filter(O=>O.runId===void 0).find(O=>O.messageId===T);return L?(L.runId=E,r.current={conversationId:g,runId:E},o.current=void 0,a.current=!1,i.current=void 0,s.current=!0,n(!0),!0):(o.current=void 0,r.current={conversationId:g,runId:E},n(!0),a.current&&_(g,E),s.current)},[_,n]),C=$(g=>typeof g=="string"&&r.current?.runId===g&&s.current,[]),v=$(()=>{let g=r.current;if(g)return a.current=!0,_(g.conversationId,g.runId),!0;let k=o.current;return k?(a.current=!0,k.then(w=>{w.runId&&_(w.conversationId,w.runId)}).catch(()=>{}),!0):!1},[_]);return ue(()=>({localSendRef:s,begin:d,beginRouted:u,acceptAck:m,acceptRoutedAck:h,reject:S,rejectRouted:P,captureStart:y,ownsLocalRun:C,settle:f,stop:v}),[m,h,d,u,y,C,S,P,f,v])}var Wy=ne.scope("send");function j_(e,t,n,r,o,a=!0){e.publishConversation({...Ia(t,n,r,o,a),hasUnread:!1},!0)}function V_(e,t){return e.id===t.id||(e.serverMessageId??e.id)===(t.serverMessageId??t.id)}function W_(e){return e.findLast(t=>!t.ephemeral&&t.role!=="system"&&(t.role==="user"||t.status!=="streaming"||Vt(t)))}function So(e,t,n,r,o){let a=W_(t);a?.role!=="user"||!V_(a,n)||j_(e,t,a,r,o)}function z_(e){return!(e instanceof ct)||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 G_(e){let{transport:t,messagesSig:n,conversationIdSig:r,options:o,bus:a,feedback:i,persistence:s,visitorId:c,adoptConversationId:p,applyControlState:_,setCanSend:d,settleSuggestions:u,runCancellation:f}=e,m=$(()=>{let P=r.value??Ct();return r.value||(r.value=P,s.saveConversationId(P)),P},[r,s]),h=$(async({continueExisting:P,turn:y})=>{let C=m(),v=n.value.at(-1),g=y?[y]:td(n.value,P),k=g[0];k?.role==="user"&&It.markSent(k.id);let w=g.map(Ds),T=s.loadUserPrefs(),E=Za(o.tools).then(M=>t.sendTurn(Ns({messages:w,conversationId:C,visitorId:c,userPrefs:T,clientTools:il(M)}),{keepalive:P}));f.begin(E);try{let M=await E;if(r.value!==C||!f.acceptAck(E,M))return!1;if(p(M.conversationId),M.runId&&k?.role==="user"&&So(t,n.value,k,M.conversationId,o.strings.newConversation),!M.runId){let L=await t.loadConversation(M.conversationId).catch(()=>null);if(r.value!==M.conversationId)return!0;if(L){L.controlState&&_(L.controlState),d(L.canContinue);let O=Pn(L.messages),{messages:z,changed:V}=ro(n.value,O);V&&(n.value=z);let K=O.findLast(Y=>!Y.ephemeral&&Y.role!=="system"),te=W_(n.value);te&&K&&V_(te,K)&&j_(t,n.value,te,M.conversationId,o.strings.newConversation,L.canContinue);let G=v?n.value.find(Y=>Y.id===v.id&&Y.role==="assistant"&&Y.status!=="streaming"):void 0;G&&u(G,G.suggestions??[]),!P&&v?.role==="assistant"&&n.value.includes(v)&&v.serverMessageId===void 0&&!Vt(v)&&(n.value=n.value.filter(Y=>Y!==v))}else v?.role==="assistant"&&n.value.includes(v)&&(v.status="error",v.errorText=o.strings.errorGeneric,P?v.retryAction={kind:"continue-assistant",messageId:v.serverMessageId??v.id}:v.retryAction=k?.role==="user"?{kind:"resend-user",messageId:k.id}:null,n.value=[...n.value])}return!0}catch(M){if(r.value!==C)return!1;if(!f.reject(E))return k?.role==="user"&&So(t,n.value,k,C,o.strings.newConversation),!0;let L=zn(M,o.strings),O=z_(M),z=y?.role==="assistant"?y:n.value.at(-1);if(P&&z?.role==="assistant"&&M instanceof ct&&M.status===409){let V=z.serverMessageId??z.id,K=await t.loadConversation(C,{ids:[V]}).catch(()=>null);if(r.value!==C)return!1;if(K){K.controlState&&_(K.controlState),d(K.canContinue);let te=Pn(K.messages),G=te.find(Y=>(Y.serverMessageId??Y.id)===V);if(G&&ad(z,G)){let{messages:Y,changed:De}=ro(n.value,te),_e=Y.find(Te=>(Te.serverMessageId??Te.id)===V);if(De&&_e&&_e!==z)return _e.awaitingContinuation=!1,_e.continuationStreaming=void 0,_e.retryAction=null,n.value=Y,_e.status!=="streaming"&&u(_e,_e.suggestions??[]),!0}}if(!n.value.includes(z)||z.status!=="streaming")return!1;z.continuationStreaming=!0}if(P&&z?.role==="assistant")z.status="error",z.errorText=L,z.retryAction=O?{kind:"continue-assistant",messageId:z.serverMessageId??z.id}:null,n.value=[...n.value];else if(v?.role==="assistant"&&n.value.includes(v)){v.status="error",v.errorText=L;let V=g[0];v.retryAction=O&&V?.role==="user"?{kind:"resend-user",messageId:V.id}:null,n.value=[...n.value]}else{let V=sn();V.status="error",V.errorText=L;let K=g[0];V.retryAction=O&&K?.role==="user"?{kind:"resend-user",messageId:K.id}:null,n.value=[...n.value,V]}return i.play("error"),a.emit("error",M),o.onError?.(M),!1}},[t,n,o,a,i,s,c,p,_,d,u,m,f]),S=$(async P=>{let y=m();P.status="pending",P.errorText=void 0,P.retryAction=void 0,n.value.includes(P)&&(n.value=[...n.value]),It.markSent(P.id);let C=[Ds(P)],v=s.loadUserPrefs(),g=Za(o.tools).then(k=>t.sendTurn(Ns({messages:C,conversationId:y,visitorId:c,userPrefs:v,clientTools:il(k)})));f.beginRouted(g,P.id);try{let k=await g;return r.value!==y?(f.rejectRouted(g),!1):f.acceptRoutedAck(g,k)?(p(k.conversationId),So(t,n.value,P,k.conversationId,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0):!1}catch(k){let w=f.rejectRouted(g);if(r.value!==y)return!1;if(!w)return So(t,n.value,P,y,o.strings.newConversation),P.status==="pending"&&(P.status="complete",n.value.includes(P)&&(n.value=[...n.value])),!0;if(P.status!=="pending")return So(t,n.value,P,y,o.strings.newConversation),!0;Wy.debug("operator-routed send failed",{error:k});let T=k instanceof Error?k:new Error(String(k));return P.status="error",P.errorText=zn(k,o.strings),P.retryAction=z_(k)?{kind:"resend-user",messageId:P.id}:null,n.value.includes(P)&&(n.value=[...n.value]),i.play("error"),a.emit("error",T),o.onError?.(T),!1}},[t,n,o,a,i,s,c,p,m,f]);return{sendAiTurn:h,sendRoutedTurn:S}}var Gy=ne.scope("unread");function K_(e){let{transport:t,options:n,conversationIdSig:r,isConversationVisibleRef:o,activated:a,conversationReady:i}=e,s=Nt(!1),c=Nt(0),p=Nt(0),_=F([]),d=F(void 0),u=F(!1),f=$(()=>{let k=r.value,w=o.current()&&d.current===k?k:void 0,T=_.current.filter(E=>E.hasUnread&&E.conversationId!==w).length;c.value=T,s.value=T>0},[r,s,c,o]),m=$(k=>{let w=r.value,T=_.current.find(O=>O.conversationId===w),E=ln(_.current,k),M=E.find(O=>O.conversationId===w),L=k.type==="snapshot"&&w!==void 0&&M?.hasUnread===!0&&d.current===w&&T!==void 0&&T.lastMessageAt!==M.lastMessageAt;L&&(d.current=void 0),_.current=E,f(),L&&(p.value+=1)},[r,f,p]),h=$(()=>{if(f(),!o.current())return;let k=r.value;if(!k||d.current!==k)return;let w=_.current.find(T=>T.conversationId===k);w?.hasUnread&&t.markRead(k,w.lastMessageAt)},[r,o,f,t]),S=$(k=>{r.value===k&&(d.current=void 0,f())},[r,f]),P=$(k=>{r.value===k&&(d.current=k,h())},[r,h]),y=$(k=>d.current===k,[]),C=$((k=!1)=>{!n.history.enabled||!n.modules.list.some(w=>w.layout==="chat")||u.current||(u.current=!0,t.listConversations({limit:50},k).then(w=>{k||m({type:"snapshot",result:w,requestedRevision:0}),h()}).catch(w=>Gy.debug("refreshUnread failed (non-fatal)",{err:w})).finally(()=>{u.current=!1}))},[m,h,n.history.enabled,n.modules,t]),v=$(k=>{let w=k.conversationId,T=o.current()&&r.value===w&&d.current===w,E=_.current.find(L=>L.conversationId===w),M=T&&(E?.lastMessageAt!==k.lastMessageAt||E.hasUnread);t.publishConversation({...k,hasUnread:!T},!0),M&&t.markRead(w,k.lastMessageAt)},[r,o,t]);D(()=>t.subscribeConversationChanges(m),[m,t]);let g=F(!1);return D(()=>{!a||!i||g.current||(g.current=!0,C())},[a,i,C]),D(()=>{if(!a)return;function k(){document.visibilityState==="visible"&&(h(),C(!0))}return document.addEventListener("visibilitychange",k),()=>document.removeEventListener("visibilitychange",k)},[a,h,C]),{hasUnreadSig:s,unreadCountSig:c,transcriptRecoverySig:p,markVisibleConversationRead:h,beginConversationTranscript:S,commitConversationTranscript:P,isConversationTranscriptCommitted:y,recordConversationReply:v}}var ko=ne.scope("settings");function Q_(e){let{options:t,persistence:n,transport:r,feedback:o,hostElement:a,bus:i}=e,s=n.loadUserPrefs(),[c,p]=H(()=>s.locale??t.locale),[_,d]=H(s.themeMode),u=_??t.themeMode,[f,m]=H(()=>s.textSize??t.textSize),h=$(g=>{n.patchUserPrefs(g),r.saveUserPrefs(n.loadUserPrefs()).catch(k=>ko.warn("saveUserPrefs failed",{err:k}))},[n,r]);D(()=>{s.soundMuted!==void 0&&o.setMuted(s.soundMuted)},[]),D(()=>{if(u!=="host"){a.dataset.theme=u;return}return Mc(g=>{a.dataset.theme=g})},[a,u,t]),D(()=>{a.dataset.textSize=f},[a,f,t]),D(()=>{let g=!0;return o.mutedSig.subscribe(k=>{if(g){g=!1;return}h({soundMuted:k})})},[o,h]);let S=tr(c,t.availableLocales,t.defaultLocale);D(()=>{r.setLocale(S)},[r,S]),D(()=>{a.dir=sc(S)?"rtl":"ltr"},[a,S]),D(()=>{S!==c&&p(S)},[S,c]);let P=$(g=>{ko.info("localeChange",{locale:g}),p(g),h({locale:g}),i.emit("localeChange",g)},[h,i]),y=$(g=>{ko.info("themeChange",{mode:g}),d(g),a.dataset.theme=g,h({themeMode:g}),i.emit("themeChange",g)},[a,h,i]),C=$(g=>{ko.info("textSizeChange",{size:g}),m(g),a.dataset.textSize=g,h({textSize:g}),i.emit("textSizeChange",g)},[a,h,i]),v=$(()=>{o.toggleMuted();let g=o.mutedSig.value;ko.info("soundToggle",{muted:g}),i.emit("soundToggle",{muted:g})},[o,i]);return{activeLocale:c,activeThemeMode:u,activeTextSize:f,effectiveLocale:S,setActiveLocale:p,setActiveThemeMode:d,setActiveTextSize:m,patchAndSync:h,handleLocaleChange:P,handleThemeChange:y,handleTextSizeChange:C,handleSoundToggle:v}}var be=ne.scope("app"),_i=A.cssPrefix,Ky={home:"home",chats:"chat",help:"help",news:"news"};function X_(e,t){return ed({...e,text:bt(t,e.text)})}function J_({options:e,hostElement:t,bus:n,recentHostEvents:r}){let o=e.aiAgentDeploymentId;if(!o)throw new Error("aiAgentDeploymentId is required");let[a]=H(()=>nr(e.widgetId,e.storage,e.aiAgentDeploymentId)),[i]=H(()=>a.getVisitorId()),s=a.loadUserPrefs(),c=Nt(a.loadConversationId()),p=F(c.value!==void 0),_=Nt(c.value??""),d=Nt([]),[u,f]=H(!1),m=F(void 0),[h,S]=H([]);function P(){let x=e.modules.list,I=new Set(x.map(j=>j.id)),X=a.loadActiveModule();return X&&I.has(X)?X:x[0]?.id??""}function y(){return e.modules.list.find(x=>x.layout==="chat")?.id}function C(){let x=y();return x?e.modules.list.length===1?!0:g.sig.value.activeTab===x:!1}let v=F(void 0);if(!v.current){let x=e.modules.list.map(X=>X.id),I=a.loadActiveModule()??x[0]??"";v.current=yd(I,I?[...x,I]:x,X=>a.saveActiveModule(X))}let g=v.current,k=Rt(()=>g.sig.value.activeTab).value,w=Rt(()=>c.value).value,[T,E]=H(!1),[M,L]=H(null),[O,z]=H(!1),V=e.mode==="standalone"||e.mode==="inline",K=F(io(e,fr(),a.loadPanelOpen(),a.loadPanelSize())),[te,G]=H(K.current.panelOpen),[Y,De]=H(K.current.panelOpen),_e=F(void 0),Te=F(void 0),et=F(!1),Ue=F(void 0);D(()=>{te&&De(!0)},[te]);let gt=F(!1),[Ge,vt]=H(!1),{dismissed:xt,dismissCallout:dt}=M_({callout:e.launcher.callout,persistence:a}),St=e.launcher.callout?.persistent??!0,kt=$(()=>{be.info("calloutDismiss"),n.emit("calloutDismiss",void 0),dt()},[n,dt]),[Ee,He]=H(K.current.panelSize),ye=F(!1),[ot,he]=H("chat"),ht=F(()=>!1);ht.current=()=>te&&ot==="chat"&&!document.hidden&&C();let[Ke,$t]=H(!0),b=F(Ke);b.current=Ke;let[U,J]=H(!1),Z=F(U);Z.current=U;let ae=F(null),[Re,Pe]=H(!1),[ve,_t]=H(null),[fe,at]=H([]),qe=F(e.strings),qt=F(e);qt.current=e;let[B,Q]=H(void 0),[ee,me]=H(void 0),[it,zt]=H(()=>a.loadSidebarCollapsed()??!1),[Yt,At]=H({}),[le]=H(()=>new La({agentApiBaseUrl:e.agentApiBaseUrl,dataApiBaseUrl:e.dataApiBaseUrl,auth:ou({publicKey:e.publicKey,aiAgentDeploymentId:o,publicKeyHeader:"x-public-key"}),endpoints:e.endpoints,recentHostEvents:r})),[Mt]=H(()=>new ua(e.sound,e.haptics)),dn=q_({transport:le,setStreaming:J}),{activeLocale:wo,activeThemeMode:hl,activeTextSize:bl,effectiveLocale:Gn,setActiveLocale:af,setActiveThemeMode:sf,setActiveTextSize:lf,patchAndSync:yl,handleLocaleChange:cf,handleThemeChange:uf,handleTextSizeChange:df,handleSoundToggle:pf}=Q_({options:e,persistence:a,transport:le,feedback:Mt,hostElement:t,bus:n}),{controlModeSig:Gt,assignedOperatorInitialsSig:_f,operatorAvailableSig:ff,applyControlState:Tr,adoptControlStateChunk:mf,requestOperator:gf,cancelOperatorRequest:vf}=N_({transport:le,conversationIdSig:c}),pn=Nt(new Map),hf=$(x=>{if(x.type!=="data-memory-compaction-state")return;let I=c.value;if(!I)return;let X=Yu(x.data);if(!X)return;let j=pn.value.get(I);if(j&&(X.postFinishSequence<j.postFinishSequence||X.postFinishSequence===j.postFinishSequence&&(j.status==="ready"||j.status===X.status)))return;let oe=new Map(pn.value);oe.set(I,X),pn.value=oe},[c,pn]),{hasUnreadSig:bf,unreadCountSig:Pl,transcriptRecoverySig:yf,markVisibleConversationRead:xl,beginConversationTranscript:hi,commitConversationTranscript:Kn,isConversationTranscriptCommitted:Sl,recordConversationReply:Pf}=K_({transport:le,options:e,conversationIdSig:c,isConversationVisibleRef:ht,activated:Y,conversationReady:T}),xf=te&&e.modules.byId[k]?.layout==="home",Sf=A_({transport:le,options:e,persistence:a,enabled:T&&xf});D(()=>{xl()},[k,te,ot,w,xl]),D(()=>{Mt.update(e.sound,e.haptics)},[Mt,e.sound,e.haptics]),D(()=>()=>Mt.destroy(),[Mt]),D(()=>{ye.current||!e.size.initialSize||(ye.current=!0,!a.loadPanelSize()&&He(js(e.mode,e.size,fr())))},[e.mode,e.size,a]),D(()=>{if(!T||gt.current)return;gt.current=!0;let x=io(e,fr(),a.loadPanelOpen(),a.loadPanelSize());G(x.panelOpen),He(x.panelSize)},[T,e,a]);let Qn=F(null);D(()=>{T&&g.reconcile(e.modules.list.map(x=>x.id),P())},[T,e.modules.list,g]);let Co=$(x=>{!x||x.length===0||(d.value=x.map(I=>X_(I,qe.current)))},[d]),bi=F(null),To=$(async x=>{try{let{formSubmissions:I}=await(x?le.bootstrap(x):bi.current??le.bootstrap()),X=new Map;return I.forEach((j,oe)=>X.set(j.formId,oe)),I.filter((j,oe)=>!j.skipped||X.get(j.formId)===oe).map((j,oe)=>({key:`wire:${j.formId}:${j.createdAt??oe}`,formId:j.formId,outcome:j.skipped?"skipped":"submitted",createdAt:Qu(j.createdAt),values:j.values}))}catch(I){return be.debug("bootstrap failed \u2014 no form markers (non-fatal)",{err:I}),[]}},[le]),Rr=F(0),Zt=F(0),yi=$(x=>{if(x===c.value)return;let I=c.value;Zt.current++,f(!1),I&&(a.saveDraft(x,a.loadDraft(I)),a.saveDraft(I,""),a.saveMessageQueue(x,a.loadMessageQueue(I)),a.saveMessageQueue(I,[])),c.value=x,a.saveConversationId(x),le.primeIdentity(void 0,x),be.info("conversation rebound",{previous:I,current:x}),I&&n.emit("conversationRebound",{previous:I,current:x})},[n,c,a,le]),Ro=$((x,I)=>{let X=[...x.map(W=>W.createdAt),...I.map(W=>W.createdAt)].filter(W=>W!==void 0),j=(X.length?Math.min(...X):Date.now())-1;return[...(Ue.current?.messages??[]).map(W=>{let ie=X_(W,qe.current);return ie.createdAt=j,ie}),...x]},[]),kl=$(async x=>{let I=Zt.current;function X(){return I!==Zt.current||c.value!==x}Te.current===x&&(Te.current=void 0),f(!0);try{let[j,oe]=await Promise.all([le.loadConversation(x),To()]);if(X())return!1;let W=Pn(j.messages);S(oe);let ie=Ro(Us(W,d.value),oe);if(d.value=ie,Te.current=ie.some(we=>we.role==="user")?void 0:x,W.length>0||j.controlState!==void 0){$t(j.canContinue),j.controlState&&Tr(j.controlState);let we=W.findLast(pt=>pt.role==="assistant"&&!pt.ephemeral);at(we?.suggestions??[])}return!0}catch(j){return X()||(be.warn("loadThread failed; keeping conversation active",{err:j,conversationId:x}),n.emit("error",j),qt.current.onError?.(j)),!1}finally{X()||f(!1)}},[le,To,d,c,Ro,n]),kf=$(x=>{if(_e.current===x)return _e.current=void 0,kl(x)},[kl]),wf=$(()=>{if(m.current)return Promise.resolve(void 0);let x=c.value,I=d.value.find(ie=>ie.serverMessageId!==void 0),X=I?.serverMessageId,j=I?new Date(I.createdAt).toISOString():void 0;if(!x||!X||!j)return Promise.resolve(void 0);let oe=Zt.current,W={};return m.current=W,(async()=>{try{let ie=await le.loadConversation(x,{beforeId:X,beforeCreatedAt:j});if(m.current!==W||Zt.current!==oe||c.value!==x)return;if(ie.messages.length===0)return!1;let xe=ie.messages.map($s),we=d.value,pt=rd(we,xe);if(pt!==we){let en=Math.min(...xe.map(wt=>wt.createdAt??1/0),...h.map(wt=>wt.createdAt??1/0));if(Number.isFinite(en))for(let wt of we){if(!wt.ephemeral)break;(wt.createdAt??1/0)>=en&&(wt.createdAt=en-1)}d.value=pt}return!0}catch(ie){if(m.current!==W||Zt.current!==oe||c.value!==x)return;be.warn("load previous messages failed",{err:ie,conversationId:x,beforeId:X}),n.emit("error",ie),e.onError?.(ie);return}finally{m.current===W&&(m.current=void 0)}})()},[n,c,h,d,e,le]),Ir=$(async({newConversation:x})=>{let I=++Rr.current;function X(){return I!==Rr.current}let j=c.value,oe=x||!j?Ct():j;oe!==j&&(Zt.current++,f(!1),Ft(()=>{c.value=oe,_.value=oe}),a.saveConversationId(oe)),le.primeIdentity(i,oe);let W;try{W=await le.handshake({visitorId:i,conversationId:oe,userPrefs:a.loadUserPrefs(),locale:wo})}catch(we){if(X())return;n.emit("error",we),e.onError?.(we),x||E(!0);return}if(X())return;W.conversationId!==oe&&yi(W.conversationId),_t(W.agent),W.site&&gu(W.site)?Q(W.site):W.site&&be.warn("invalid site config, using fallback",{site:W.site}),W.blocks&&vu(W.blocks)?me(W.blocks):W.blocks&&be.warn("invalid blocks config, using fallback",{blocks:W.blocks});let ie=es(W.userPrefs);if(Object.keys(ie).length>0&&!x&&(a.saveUserPrefs(ie),ie.locale&&af(ie.locale),ie.soundMuted!==void 0&&Mt.setMuted(ie.soundMuted),ie.themeMode&&sf(ie.themeMode),ie.textSize&&lf(ie.textSize)),Ue.current=W.welcome,x||n.emit("handshake",W),W.welcome?.suggestions){let we=qe.current;at(W.welcome.suggestions.map(pt=>({...pt,label:bt(we,pt.label),...pt.text===void 0?{}:{text:bt(we,pt.text)}})))}let xe=!x&&j&&W.conversationId===j;p.current=!!xe,xe?et.current||(_e.current=W.conversationId):(Te.current=W.conversationId,Co(W.welcome?.messages),Kn(W.conversationId)),x||E(!0)},[le,i,a,e,n,c,_,Mt,Co,wo,yi,Kn]),Er=JSON.stringify(e.userContext??null),Cf=JSON.stringify(e.pageContext??null),Tf=JSON.stringify(Yt);D(()=>{let x=Object.keys(Yt).length?{...Yt,...e.userContext}:e.userContext;le.setContext(x,Qy(e.pageContext))},[le,Er,Cf,Tf]),D(()=>le.setUserToken(e.userToken),[le,e.userToken]);let wl=$((x,I=[])=>at(x.suggestions??I),[]);D(()=>(le.primeIdentity(i,c.value),Ir({newConversation:!1}),()=>{Rr.current++,Zt.current++}),[]),D(()=>{!Y||!T||et.current||(et.current=!0,bi.current=le.bootstrap(),(async()=>{try{let x=await bi.current;L($r((x??{forms:[]}).forms,Gn))}catch(x){be.debug("bootstrap failed \u2014 treating as no forms",{err:x})}finally{z(!0)}})(),_e.current===c.value&&f(!0))},[Y,T]);let Ar=F(null);D(()=>{if(!Y||!T||(Ar.current??(Ar.current=Gn),Ar.current===Gn))return;Ar.current=Gn;let x=!1;return le.bootstrap().then(I=>{x||L($r((I??{forms:[]}).forms,Gn))}).catch(I=>be.debug("forms re-localize failed \u2014 keeping current copy",{err:I})),()=>{x=!0}},[Y,T,Gn,le]);let Cl=F(Er);D(()=>{!T||Cl.current===Er||(Cl.current=Er,Ir({newConversation:!1}))},[Er,T,Ir]),$_({hostElement:t,mode:e.mode,panelSize:Ee,isOpen:te,surfaceReady:T,setIsOpen:G});let{sendAiTurn:_n,sendRoutedTurn:Xn}=G_({transport:le,messagesSig:d,conversationIdSig:c,options:e,bus:n,feedback:Mt,persistence:a,visitorId:i,adoptConversationId:yi,applyControlState:Tr,setCanSend:$t,settleSuggestions:wl,runCancellation:dn}),{toolInteraction:Rf,pageToolsRunning:Pi,stopPageTools:Tl}=E_({streaming:U,controlModeSig:Gt,messagesSig:d,sendAiTurn:_n,bus:n,humanInLoop:e.features.humanInLoop,tools:e.tools}),If=$((x,I)=>{let X=d.value.find(j=>j.serverMessageId===x);X&&(X.feedback=I),be.info("messageFeedback",{messageId:x,value:I}),n.emit("messageFeedback",{messageId:x,value:I}),le.submitFeedback({messageId:x,value:I})},[n,d,le]);function Ef(){return d.value.reduce((x,I)=>x+(I.role==="user"?1:0),0)}let Jn=e.forms.list.length>0?e.forms:M??e.forms,Fe=hd({forms:Jn,persistence:a,userContext:()=>e.userContext,messageCount:Ef,pageArea:()=>e.pageContext?.area?String(e.pageContext.area):void 0,conversationId:()=>c.value,onComplete:(x,I,X,j)=>{be.info("formSubmit",{formId:x.id,trigger:I,skipped:j}),n.emit("formSubmit",{formId:x.id,values:X,skipped:j}),S(W=>{let xe=W.find(we=>we.formId===x.id&&we.outcome==="skipped")?.createdAt??Date.now();return[...W.filter(we=>!(we.formId===x.id&&we.outcome==="skipped")),{key:`local:${x.id}:${xe}`,formId:x.id,outcome:j?"skipped":"submitted",createdAt:xe,...j?{}:{values:X}}]});let oe=c.value??Ct();c.value||(c.value=oe,a.saveConversationId(oe),le.primeIdentity(void 0,oe)),!j&&x.mirrorToContext&&At(W=>({...W,...X})),le.submitForm({formId:x.id,conversationId:oe,trigger:I,values:X,skipped:j})}}),Rl=Rt(()=>Fe.activeForm.value),Io=Rl.value?.form.blocking??!1,Af=$(()=>Fe.fire("after-messages"),[Fe]),Mf=$(()=>p.current||d.value.some(x=>!x.ephemeral&&x.role==="user"),[d]);H_({activated:Y,conversationReady:T,conversationIdSig:c,messagesSig:d,optionsRef:qt,transport:le,visitorId:i,adoptControlStateChunk:mf,adoptMemoryCompactionStateChunk:hf,settleSuggestions:wl,recordConversationReply:Pf,transcriptRecoverySig:yf,beginConversationTranscript:hi,commitConversationTranscript:Kn,onReplyLanded:Af,runCancellation:dn,canContinueRef:b,setCanSend:$t,feedback:Mt,bus:n,loadInitialThread:kf,shouldReconcileOnConnect:Mf}),D(()=>{Fe.refresh()},[Jn,Fe]);let Il=e.pageContext?.area?String(e.pageContext.area):void 0,Nf=Rt(()=>d.value.length),Eo=F(null);D(()=>{!O||!Eo.current||(Fe.fire("manual",Eo.current),Eo.current=null)},[O,Fe]),D(()=>{T&&O&&Fe.fire("pre-chat")},[T,O,Fe]),D(()=>{O&&!Ke&&Fe.fire("conversation-closed")},[O,Ke,Fe]),D(()=>{T&&O&&Il&&Fe.fire("page-area")},[T,O,Il,Fe]);let xi=ue(()=>{let x=Jn.list.flatMap(I=>I.triggers).filter(I=>I.kind==="idle").map(I=>Number(I.param));return x.length?Math.min(...x)*1e3:0},[Jn]);D(()=>{if(!xi||!te)return;let x=setTimeout(()=>Fe.fire("idle"),xi);return()=>clearTimeout(x)},[xi,te,Fe,Nf.value]);let Yn=$(async(x,I,X)=>{if(ae.current)return!1;let j=c.value,oe=j?pn.value.get(j):void 0,W=Gt.value!=="ai-agent";if(!W&&oe?.status==="compacting"||(be.info("send",{textLen:x.length,attachments:I.length,streaming:Z.current,routedToOperator:W}),Z.current&&!W))return!1;let ie=new AbortController,xe={conversationId:j,controller:ie};ae.current=xe,Pe(!0);try{Mt.unlock();let we=await Jy(le,I,ie.signal,fn=>{ie.signal.aborted||(be.warn("upload failed",{err:fn}),n.emit("error",fn),e.onError?.(fn))});if(ie.signal.aborted||c.value!==j||!b.current||Fe.activeForm.value?.form.blocking)return!1;let pt=j?pn.value.get(j):void 0,en=Gt.value!=="ai-agent";if(!en&&pt?.status==="compacting"||Z.current&&!en||!x&&we.length===0)return!1;n.emit("send",{text:x,attachmentCount:I.length}),fe.length>0&&at([]),Mt.play("messageSent");let wt=Os(x,we,X);return _r(n,e,"user",x),en?(d.value=[...d.value,wt],X?await Xn(wt):(Xn(wt),!0)):(d.value=[...d.value,wt,sn()],X?await _n({continueExisting:!1}):(_n({continueExisting:!1}),!0))}finally{ae.current===xe&&(ae.current=null,Pe(!1))}},[le,n,e,fe.length,d,c,pn,_n,Xn,Gt]),El=F(Yn);El.current=Yn;let Al=c.value,Ml=(Al?pn.value.get(Al):void 0)?.status==="compacting",Si=Gt.value==="ai-agent",Nl=Rt(()=>{let x=d.value.at(-1);return x?.role==="assistant"&&x.partsSig.value.some(I=>I.kind==="tool"&&I.stateSig.value==="approval-requested")}),Ll=Rt(()=>d.value.some(x=>x.retryAction?.kind==="resend-user"||x.retryAction?.kind==="continue-assistant"));Tt(()=>{let x=c.value;return()=>{let I=ae.current;!I||I.conversationId!==x||(ae.current=null,Pe(!1),I.controller.abort())}},[c.value]),D(()=>{Ke&&!Io||ae.current?.controller.abort()},[Io,Ke]);let Lf=$(()=>{if(Pi){be.info("stop page tools"),n.emit("stop",void 0),Tl();return}if(!dn.stop())return;be.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])},[dn,n,d,Pi,Tl]),Of=$(x=>{if(U)return;let I=d.value,X=Na(I,x);if(X)switch(be.info("retry",{kind:X.kind,messageId:X.messageId}),X.kind){case"continue-assistant":{if(Gt.value!=="ai-agent"||x.role!=="assistant"||(x.serverMessageId??x.id)!==X.messageId)return;x.status="streaming",x.errorText=void 0,x.retryAction=void 0,x.awaitingContinuation=!0,d.value=[...I],_n({continueExisting:!0,turn:x});return}case"resend-user":{let j=I.find(ie=>ie.role==="user"&&ie.id===X.messageId);if(!j)return;let oe=ie=>{ie&&Qn.current?.acceptQueuedMessage(X.messageId)};if(j.status="complete",j.errorText=void 0,j.retryAction=void 0,Gt.value!=="ai-agent"){d.value=x.role==="assistant"?I.filter(ie=>ie!==x):[...I],Xn(j).then(oe);return}let W=sn();d.value=x.role==="assistant"?I.map(ie=>ie===x?W:ie):[...I,W],_n({continueExisting:!1,turn:j}).then(oe);return}case"repeat-user":{let j=I.find(xe=>xe.role==="user"&&xe.id===X.messageId);if(!j)return;let oe=Os(Ve(j),j.attachments?.map(xe=>({...xe}))??[]),W=new Set(oe.attachments?.flatMap(xe=>xe.url?[xe.url]:[])??[]),ie=j.partsSig.value.flatMap(xe=>xe.kind==="file"&&!W.has(xe.url)?[{...xe}]:[]);if(ie.length>0&&(oe.partsSig.value=[...oe.partsSig.value,...ie]),Gt.value!=="ai-agent"){d.value=[...I,oe],Xn(oe);return}d.value=[...I,oe,sn()],_n({continueExisting:!1,turn:oe});return}default:return X}},[U,d,Gt,_n,Xn]),Mr=$(()=>{if(vd(e.mode,Ee)==="exit-fullscreen"){be.info("close \u2192 exit-fullscreen",{mode:e.mode}),He("normal"),n.emit("fullscreen",!1);return}be.info("close \u2192 panel closed",{mode:e.mode}),Fe.fire("panel-close"),G(!1),a.savePanelOpen(!1),n.emit("close",void 0),e.onClose?.()},[n,e,a,Ee,Fe]),Tn=$(()=>{be.info("open",{mode:e.mode}),Mt.unlock(),vt(!0),G(!0),a.savePanelOpen(!0),!xt&&!St&&kt(),setTimeout(()=>vt(!1),Xy),n.emit("open",void 0),e.onOpen?.()},[n,e,Mt,a,xt,St,kt]),ki=$(()=>{let x=d.value.some(I=>I.role==="user");if(Te.current===c.value&&!x&&Ke&&c.value){be.info("clear \u2192 reusing empty conversation",{conversationId:c.value}),d.value.length===0&&Co(Ue.current?.messages);return}return be.info("clear \u2192 new conversation",{wasStreaming:U}),n.emit("clear",void 0),dn.settle(),p.current=!1,_e.current=void 0,Te.current=void 0,Ft(()=>{d.value=[],c.value=void 0,Tr({controlMode:"ai-agent",controlRevision:0})}),a.clearConversation(),$t(!0),S([]),at([]),Ir({newConversation:!0})},[U,d,c,a,Ir,n,Ke,Co,dn,Tr]),Ao=$(()=>{let x=ki();he("chat");let I=e.modules.list.find(X=>X.layout==="chat")?.id;return I&&g.switchTab(I),x},[ki,g,e]),$f=$(async x=>{await Ao(),await El.current(x,[])||Qn.current?.fill(x)},[Ao]),wi=$(()=>{let x=Ee==="expanded"?"normal":"expanded";be.info("expand",{from:Ee,expanded:x==="expanded"}),He(x),a.savePanelSize(x),n.emit("expand",x==="expanded")},[n,Ee,a]),Ci=$(()=>{let x=Ee==="fullscreen"?"normal":"fullscreen";be.info("fullscreen",{from:Ee,fullscreen:x==="fullscreen"}),He(x),a.savePanelSize(x),n.emit("fullscreen",x==="fullscreen")},[n,Ee,a]),Df=$(()=>{he(x=>{let I=x==="history"?"chat":"history";return be.info("toggleHistory",{view:I}),n.emit("toggleHistory",{view:I}),I})},[n]),Ff=$(()=>{zt(x=>{let I=!x;return be.info("sidebarToggle",{collapsed:I}),a.saveSidebarCollapsed(I),n.emit("sidebarToggle",{collapsed:I}),I})},[a,n]),Bf=$(x=>{be.info("resize",x),yl({widgetSize:x}),n.emit("resize",x)},[yl,n]),Uf=$(async x=>{let I=x.conversationId;if(I===c.value&&Sl(I)){be.info("selectConversation",{conversationId:I,cached:!0}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(x),he("chat");let W=y();W&&g.switchTab(W),Kn(I);return}let j=++Rr.current;Zt.current++,f(!1);function oe(){return j!==Rr.current}be.info("selectConversation",{conversationId:I,wasStreaming:U}),n.emit("selectConversation",{conversationId:I}),le.publishConversation(x);try{let[W,ie]=await Promise.all([le.loadConversation(I),To(I)]);if(oe())return;dn.settle(),p.current=!0,_e.current=void 0;let xe=Pn(W.messages),we=W.conversationId!==c.value,pt=we?xe:Us(xe,d.value);Te.current=pt.some(fn=>fn.role==="user")?void 0:W.conversationId,Ft(()=>{d.value=Ro(pt,ie),we&&(_.value=W.conversationId),c.value=W.conversationId}),S(ie),a.saveConversationId(W.conversationId),le.primeIdentity(i,W.conversationId),$t(W.canContinue),W.controlState&&Tr(W.controlState);let en=pt.findLast(fn=>fn.role==="assistant"&&!fn.ephemeral);at(en?.suggestions??[]),we?hi(W.conversationId):Kn(W.conversationId),he("chat");let wt=y();wt&&g.switchTab(wt)}catch(W){if(oe())return;n.emit("error",W),e.onError?.(W)}},[le,d,c,_,n,e,a,To,Ro,U,i,dn,hi,Kn,Sl,g]),Ol=$(x=>{if(typeof x!="string")return;te||Tn(),he("chat");let I=y();I&&g.switchTab(I),O?Fe.fire("manual",x):Eo.current=x},[te,Tn,e.modules,g,O,Fe]),Mo=F(void 0),No=$(x=>{let I=e.modules.list.find(j=>j.layout===Ky[x.to]);if(!I){be.warn("open: the widget has no such tab",{to:x.to});return}let X=x.id&&(I.layout==="help"||I.layout==="news")?{kind:"content",id:x.id,title:""}:void 0;g.open(I.id,X)},[e.modules,g]),$l=$(x=>{if(te||Tn(),x!==void 0){if(!au(x)){be.warn("open: unknown target",{detail:x});return}T?No(x):Mo.current=x}},[te,Tn,T,No]);D(()=>{!T||!Mo.current||(No(Mo.current),Mo.current=void 0)},[T,No]);let Dl=T&&!u&&!Io&&(!Si||!Nl.value&&!Ll.value),[Rn,Ti]=H(),Fl=$(x=>{let I=iu(x);if(!I){be.warn("ask: expected { text, send? } with non-empty text",{detail:x});return}te||Tn(),Ti(I)},[te,Tn]),Ri=te&&O&&Ke&&T&&!u&&!Io,Bl=Ri&&Dl&&!Re&&!(Si&&(U||Ml));D(()=>{if(Rn===void 0||!(Rn.send?Bl:Ri))return;let x=y();if(!x){be.warn("ask: the widget has no chat"),Ti(void 0);return}if(ot!=="chat"||!C()){he("chat"),g.switchTab(x);return}if(Ti(void 0),!Rn.send){Qn.current?.fill(Rn.text);return}Yn(Rn.text,[]).then(I=>{I||Qn.current?.fill(Rn.text)})},[Rn,Ri,Bl,ot,k,e.modules,g,Yn]),D(()=>{if(e.widgetId!=="default")return;let x=`data-${A.cssPrefix}-`,I=["ask","open","close","form"].map(j=>x+j);function X(j){let oe=j.composedPath().find(we=>we instanceof Element&&I.some(pt=>we.hasAttribute(pt)));if(!(oe instanceof Element))return;j.preventDefault();let W=oe.getAttribute(`${x}ask`),ie=oe.getAttribute(`${x}open`),xe=oe.getAttribute(`${x}form`);W!==null?Lt(t,"ask",Vr(W||(oe.textContent??""),{send:oe.hasAttribute(`${x}send`)})):ie!==null?Lt(t,"open",aa(ie)):xe!==null?Lt(t,"openForm",xe):Lt(t,"close")}return document.addEventListener("click",X),()=>document.removeEventListener("click",X)},[e.widgetId,t]),D(()=>{if(e.widgetId!=="default")return;let x=cu(location.href);x&&(history.replaceState(history.state,"",x.url),x.ask?Lt(t,"ask",Vr(x.ask)):Lt(t,"open",x.target))},[e.widgetId,t]);let Ul=F(Wr),Hl=e.mode==="page"||e.mode==="inline"||e.mode==="standalone";D(()=>jt(()=>{let x=c.value,I={open:Hl||te,ready:T,unread:Pl.value,...x?{conversationId:x}:{}},X=Ul.current;I.open===X.open&&I.ready===X.ready&&I.unread===X.unread&&I.conversationId===X.conversationId||(Ul.current=I,n.emit("state",I),I.unread!==X.unread&&n.emit("unread",I.unread))}),[n,Hl,te,T,Pl,c]);let In=F({handleOpenCommand:$l,handleClose:Mr,handleExpand:wi,handleFullscreen:Ci,openForm:Ol,handleAskCommand:Fl});In.current={handleOpenCommand:$l,handleClose:Mr,handleExpand:wi,handleFullscreen:Ci,openForm:Ol,handleAskCommand:Fl},Tt(()=>lu(t,{open:x=>In.current.handleOpenCommand(x),close:()=>In.current.handleClose(),expand:()=>In.current.handleExpand(),fullscreen:()=>In.current.handleFullscreen(),openForm:x=>In.current.openForm(x),ask:x=>In.current.handleAskCommand(x)}),[t]);let ft=ue(()=>Yi(e,wo,hl,bl),[e,wo,hl,bl]);qe.current=ft.strings;let Hf=ue(()=>h.map(x=>{let I=Jn.list.find(X=>X.id===x.formId);return{...x,title:I?.title,form:I}}),[h,Jn]);function Ii(x){Uf(x)}let ql={options:ft,transport:le,feedback:Mt,bus:n,persistence:a,conversationId:c.value??"",composerKey:_.value,composerApiRef:Qn,view:ot,canSend:Ke,isStreaming:U,pageToolRunning:Pi,isMemoryCompacting:Ml,canReleaseQueuedMessages:Dl,queueManualMessages:Si&&(Nl.value||Ll.value),sendPreparing:Re,composerActive:ft.mode==="page"||ft.mode==="inline"||ft.mode==="standalone"||te,controlMode:Gt.value,assignedOperatorInitials:_f.value,operatorAvailable:ff.value,operatorRequestEnabled:e.features.operatorRequest,onRequestOperator:gf,onCancelOperatorRequest:vf,loadingMessages:u,onLoadPreviousMessages:wf,messagesSig:d,agent:ve,suggestions:fe,initialWidgetSize:s.widgetSize??null,onClose:Mr,onClear:ki,onExpand:wi,onFullscreen:Ci,onSoundToggle:pf,onToggleHistory:Df,onSelectHistoryConversation:Ii,onNewConversation:Ao,onLocaleChange:cf,onThemeChange:uf,onTextSizeChange:df,onWidgetSizeChange:Bf,onSend:Yn,onStop:Lf,onSuggestion:x=>{if(ae.current)return;let I=x.text??x.label;be.info("suggestion",{text:I,autoSend:e.autoSendSuggestions}),n.emit("suggestion",{text:I}),e.autoSendSuggestions?Yn(I,[]):Qn.current?.fill(I)},activeForm:Rl.value?.form??null,formMarkers:Hf,onFormSubmit:Fe.complete,onFormSkip:Fe.skip,onFormFill:x=>Fe.fire("manual",x),tool:Rf,onRetry:Of,onMessageFeedback:If};if(!T)return null;let Nr=ft.modules.list;function Ei(x){let I=pr("close",ft.mode,x);return Nr.length===0?l(w_,{strings:ft.strings,onClose:I?Mr:void 0}):Nr.length===1&&Nr[0]?.layout==="chat"?l(S_,{...ql,panelSize:x}):l(k_,{panelProps:{...ql,panelSize:x,onClose:I?Mr:void 0},enabledModules:Nr,nav:g,bus:n,hasUnread:bf.value,latestNews:Sf,onSelectConversation:Ii,onStartNewConversation:$f,onSetPanelSize:He})}if(e.mode==="page"){let x=e.history.enabled&&Nr.some(I=>I.layout==="chat");return l("div",{class:`${_i}-anchor`,children:l(R_,{site:B,blocks:ee,transport:le,strings:ft.strings,locale:ft.locale,persistence:a,showConversations:x,onSelectConversation:Ii,onNewConversation:Ao,sidebarCollapsed:it,onToggleSidebarCollapsed:Ff,children:Ei("fullscreen")})})}if(V){let x=e.mode==="standalone"?"fullscreen":Ee;return l("div",{class:`${_i}-anchor`,children:Ei(x)})}let zl=e.mode==="drawer",jl=!(e.mode==="modal")&&!e.launcher.hidden&&(!te||Ge),Vl=jl&&!Ge&&!xt&&!zl?ft.launcher.callout:null;return l("div",{class:`${_i}-anchor`,"data-launcher-size":ft.launcher.size,children:[te||Y?l("div",{class:`${_i}-surface`,hidden:!te,children:Ei(Ee)}):null,jl?l(tp,{onToggle:Tn,launcher:ft.launcher,strings:ft.strings,leaving:Ge,edgeTab:zl}):null,Vl?l(np,{callout:Vl,launcherPosition:ft.position,strings:ft.strings,closeLabel:ft.strings.close,onDismiss:kt}):null]})}function Qy(e){let t=e?.url??(typeof location<"u"?location.href:void 0);if(!(!e&&!t))return{...e,...t?{url:t}:{}}}var Xy=120;async function Jy(e,t,n,r){return(await Promise.all(t.map(async a=>{try{let{id:i,url:s,originalName:c,mimeType:p,fileSize:_}=await e.uploadFile(a.file,n);return{id:i,name:c,mediaType:p,size:_,url:s}}catch(i){r(i);return}}))).filter(a=>a!==void 0)}var Yy=ne.scope("error-boundary"),fi=class extends Dt{constructor(){super(...arguments);ce(this,"state",{crashed:!1})}componentDidCatch(n,r){Yy.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}};function Y_(e){let{bus:t,host:n,appRoot:r,persistence:o,reportError:a}=e,i=e.initialRaw,s,c=er(i),p=!0,_=0,d=Pc(t);function u(){c=er(s?Zi(i,s):i)}function f(){Oc(n,Dr(c.mode));let P=o.loadUserPrefs().themeMode;$c(n,P?{...c,themeMode:P}:c),p&&(Yo(n,mi(c)),p=!1)}function m(){f(),hn(vn(fi,{onError:a},vn(J_,{key:_,bus:t,hostElement:n,options:c,recentHostEvents:d})),r)}t.on("handshake",P=>{P.config&&(P.config.storageVersion&&o.rememberStorageVersion(P.config.storageVersion),s=P.config,u(),m())});let h=kc(t,{getOptions:()=>c,getVisitorId:()=>o.getVisitorId(),getConversationId:()=>o.loadConversationId()});function S(P={}){o.reset(),i={...i,userContext:void 0,userToken:void 0,...P},d.length=0,_+=1,p=!0,u(),m()}return{getOptions:()=>c,getUserOptions:()=>i,render:m,setUserOptions:P=>{i=P,u(),m()},patchUserOptions:P=>{let y="userToken"in P&&P.userToken!==i.userToken;if(y&&i.userToken){S(P);return}y&&(_+=1),i={...i,...P},u(),m()},reset:()=>S(),destroy:()=>h()}}function mi(e){if(e.mode==="standalone")return"standalone";if(e.mode==="inline")return"inline";let t=nr(e.widgetId,e.storage,e.aiAgentDeploymentId),{panelOpen:n,panelSize:r}=io(e,fr(),t.loadPanelOpen(),t.loadPanelSize());return $a(e.mode,r,n)}var Zy=ne.scope("hooks"),gi="*",vl=new Set;function Z_(e,t,n){let r={widgetId:e,event:t,listener:n};return vl.add(r),()=>{vl.delete(r)}}function eP(e,t,n){let r=[...vl];for(let o of r)if(tP(o.widgetId,e.widgetId)&&!(o.event!==gi&&o.event!==t))try{o.listener(e,t,n)}catch(a){Zy.warn("hook listener threw",{event:t,error:a})}}function ef(e,t){let n=[];for(let r of nP)n.push(t.on(r,o=>{eP(e,r,o)}));return()=>{for(let r of n)r()}}function tP(e,t){return e===gi||e===t}var nP=["open","close","expand","fullscreen","resize","message","send","stop","clear","selectConversation","suggestion","toggleHistory","formSubmit","toolResult","toolDecision","hostEvent","messageFeedback","contentView","contentOpen","contentSearch","contentRead","contentLinkClick","attach","removeAttachment","voiceStart","voiceStop","voiceCancel","localeChange","themeChange","textSizeChange","soundToggle","sidebarToggle","calloutDismiss","error","handshake","conversationRebound","state","unread"];var rP=ne.scope("iframe"),oP='<!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 rf(e,t,n="closed",r="floating",o=null){rP.debug("createIframeMount",{position:t,initialMode:n,layoutMode:r,hasTarget:!!o});let a=document.createElement("iframe");a.title=`${A.name} chat`,a.setAttribute("allow","microphone; clipboard-write"),nf(a,t,n,r),(r==="inline"&&o?o:document.body).appendChild(a);let s=a.contentDocument;if(!s)throw new Error("iframe contentDocument unavailable (cross-origin?)");s.open(),s.write(oP),s.close();let c=Jo({...e,target:s.body}),p=new MutationObserver(()=>{nf(a,t,c.hostElement.dataset.mode??"closed",r)});return p.observe(c.hostElement,{attributes:!0,attributeFilter:["data-mode"]}),{...c,iframeElement:a,destroy(){p.disconnect(),c.destroy(),a.remove()}}}var vi="border:0;background:transparent;z-index:2147483647;pointer-events:auto;",tf={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 nf(e,t,n,r){if(n==="fullscreen"||r==="standalone"){e.style.cssText=`${vi}position:fixed;inset:0;width:100vw;height:100vh;`;return}if(r==="inline"){e.style.cssText=`${vi}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=`${vi}position:fixed;inset:0;width:100vw;height:100vh;`;return}let a=t.startsWith("top-")?"top":"bottom",i=t.endsWith("-left")?"left":"right",{w:s,h:c}=tf[n]??tf.open;e.style.cssText=`${vi}position:fixed;${a}:16px;${i}:16px;width:${s};height:${c};`}var un=new Map;function of(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");e.debug!==void 0&&Qo(e.debug);let t=ne.scope("mount");t.info("mount",{widgetId:e.widgetId,publicKey:e.publicKey,mode:e.presentation?.mode});let n=er(e),r=n.widgetId,o=un.get(r);o&&(t.debug("destroy existing instance at slot",{widgetId:r}),o.destroy());let a=mi(n),i=n.iframe?rf({position:Dr(n.mode)},n.position,a,n.mode,e.target??null):Jo({position:Dr(n.mode),target:e.target??null});i.hostElement.dataset.widgetId=r;let s=new sa,c=nr(r,n.storage,n.aiAgentDeploymentId);function p(y){s.emit("error",y),_.getOptions().onError?.(y)}let _=Y_({bus:s,host:i.hostElement,appRoot:i.appRoot,persistence:c,initialRaw:e,reportError:p}),d=Wr,u=()=>{},f=new Promise(y=>{u=y});s.on("state",y=>{d=y,y.ready&&u()}),_.render();let m=i.hostElement,h=null;function S(y){y.debug!==void 0&&Qo(y.debug),_.patchUserOptions(y)}let P={widgetId:r,open:y=>Lt(m,"open",y),close:()=>Lt(m,"close"),expand:()=>Lt(m,"expand"),openForm:y=>Lt(m,"openForm",y),ask:(y,C)=>Lt(m,"ask",Vr(y,C)),on:(y,C)=>s.on(y,C),update:y=>{t.debug("update",{patch:y}),S(y)},setUserContext:y=>{t.debug("setUserContext",{keys:Object.keys(y)}),S({userContext:{..._.getUserOptions().userContext,...y}})},clearUserContext:()=>{t.debug("clearUserContext"),S({userContext:void 0})},setPageContext:y=>{t.debug("setPageContext",{keys:Object.keys(y)}),S({pageContext:{..._.getUserOptions().pageContext,...y}})},clearPageContext:()=>{t.debug("clearPageContext"),S({pageContext:void 0})},get state(){return d},ready:f,reset:()=>{t.info("reset",{widgetId:r}),_.reset()},login:y=>{t.info("login",{widgetId:r}),S({userToken:y})},track:(y,C)=>{let v=yc(y,C);v&&s.emit("hostEvent",v)},registerTool:Yp,setDebug:y=>{Qo(y),t.info("debug level set",{level:Ki()})},debugLevel:()=>Ki(),onLog:y=>mc(y),destroy:()=>{t.info("destroy",{widgetId:r}),s.emit("state",Wr),h?.(),_.destroy(),s.clear(),hn(null,i.appRoot),i.destroy(),un.get(r)===P&&un.delete(r)}};return h=ef(P,s),un.set(r,P),P}function aP(e){if(!e.aiAgentDeploymentId)throw new Error("aiAgentDeploymentId is required");let t=e.widgetId??"default",n=un.get(t);return n?(n.update(e),n):of(e)}function iP(e){if(e!==void 0){un.get(e)?.destroy();return}let t=[...un.values()];for(let n of t)n.destroy()}function sP(e="default"){return un.get(e)??null}function lP(){return[...un.values()]}function cP(e,t,n){return Z_(e,t,n)}var uP=rr,dP=A;
64
64
  //# sourceMappingURL=elements.cjs.js.map