@aiden-voice/widget 0.10.1 → 0.10.3

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.
@@ -1,11 +1,11 @@
1
- var whooAidenWidget=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={openChat:`Open chat`,closeChat:`Close chat`,chatWith:`Chat with {name}`,newConversation:`New conversation`,conversation:`Conversation`,you:`You`,message:`Message`,messagePlaceholder:`Type a message…`,send:`Send`,messageSent:`Message sent. {name} is preparing a response.`,lookingItUp:`Looking that up for you…`,goodResponse:`Good response`,badResponse:`Bad response`,additionalFeedback:`Additional feedback`,feedbackPlaceholder:`What was wrong? (optional)`,feedbackCategory:`Feedback category`,selectReason:`Select a reason (optional)`,categoryFactual:`Factual error`,categoryIncomplete:`Incomplete`,categoryTone:`Off tone`,categoryOther:`Other`,submit:`Submit`,cancel:`Cancel`,feedbackThanks:`Thanks for the feedback`,feedbackFailed:`Couldn't send feedback`,conversationCleared:`New conversation started. Previous messages were cleared.`,genericError:`Something went wrong, please try again.`,sessionExpired:`This chat session has expired. Reload the page to continue.`,opensInNewTab:`(opens in new tab)`,agreeToNotice:`I agree`},n=Object.keys(t);function r(e,t){if(e!=null&&e!==``){if(typeof e==`string`)try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`data:`&&t.pathname.toLowerCase().startsWith(`image/`))return e}catch{}console.warn(`whoo-aiden-widget: ignoring \`${t}\` -- only https: and data:image/ URLs are allowed.`)}}var i=[`primary`,`onPrimary`,`primaryText`,`ink`,`link`,`text`,`panel`,`border`,`headerHover`,`assistantBubble`,`muted`,`typingDots`,`errorBackground`,`errorText`,`inputBorder`,`focusRing`],a={primary:`#4f46e5`,onPrimary:`#ffffff`,primaryText:`#4f46e5`,ink:`#111111`,link:`#0000ee`,text:`#111111`,panel:`#ffffff`,border:`#e5e5e5`,headerHover:`#f3f4f6`,assistantBubble:`#f0f0f0`,muted:`#4b5563`,typingDots:`#6b7280`,errorBackground:`#fee2e2`,errorText:`#991b1b`,inputBorder:`#6b7280`,focusRing:`#111827`},o={primary:`--whoo-widget-color`,onPrimary:`--whoo-widget-text-on-color`,primaryText:`--whoo-widget-color-text`,ink:`--whoo-widget-ink`,link:`--whoo-widget-link-color`,text:`--whoo-widget-text`,panel:`--whoo-widget-panel`,border:`--whoo-widget-border`,headerHover:`--whoo-widget-header-hover`,assistantBubble:`--whoo-widget-assistant-bubble`,muted:`--whoo-widget-muted`,typingDots:`--whoo-widget-typing-dots`,errorBackground:`--whoo-widget-error-bg`,errorText:`--whoo-widget-error-text`,inputBorder:`--whoo-widget-input-border`,focusRing:`--whoo-widget-focus-ring`},s=2147483e3,c=2147483647;function l(e){return e===void 0?s:Number.isInteger(e)&&Math.abs(e)<=c?e:(console.warn(`whoo-aiden-widget: ignoring zIndex ${String(e)} (expected an integer between -${c} and ${c}); using ${s}.`),s)}var u=`Aiden`;function d(e){return typeof e==`string`?e.trim():``}function f(e){return/^[\p{White_Space}\p{Cf}\p{M}]*$/u.test(e)}function p(e){if((typeof e.publishableKey==`string`&&e.publishableKey.length>0)==(typeof e.sessionToken==`string`&&e.sessionToken.length>0))throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.")}function m(e){console.warn(`whoo-aiden-widget: ${e}`)}function h(e){let{getSessionToken:t}=e;if(t!==void 0){if(typeof t!=`function`)m("ignoring `getSessionToken` -- expected a function that returns a session token.");else if(!e.sessionToken)m("ignoring `getSessionToken` -- it is only used with `sessionToken`; with `publishableKey` the widget renews its session by itself.");else return t}}var g=20;function _(e){let t=new WeakSet,n=new Set;return r=>{if(typeof r==`object`&&r||typeof r==`function`){if(t.has(r))return;t.add(r)}else{if(n.has(r))return;n.size>=g&&n.delete(n.values().next().value),n.add(r)}m(e)}}var v=_("ignoring `theme` -- expected an object."),y=_("ignoring `layout` -- expected an object."),b=_("ignoring `messages` -- expected an object.");function x(e){if(e==null)return{};if(!S(e))return b(e),{};let t={};for(let r of Object.keys(e)){if(!n.includes(r)){m(`ignoring unknown option \`messages.${r}\`.`);continue}let i=e[r];typeof i!=`string`||f(i)?m(`ignoring \`messages.${r}\` -- expected a non-blank string.`):(r===`chatWith`&&!i.includes(`{name}`)&&m("`messages.chatWith` has no {name}, so the agent name is not shown in the title. For a fixed title, use the `title` option."),t[r]=i)}for(let t in e)Object.hasOwn(e,t)||m(`ignoring inherited option \`messages.${t}\` -- only the object's own keys are used.`);return t}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var C=e=>e==null||e===``;function w(e,t,n){let r=e[t];return r==null?null:S(r)?r:(m(`ignoring \`${n}\` -- expected an object.`),null)}function T(e,t,n){for(let r of Object.keys(e))t.includes(r)||m(`ignoring unknown option \`${n}.${r}\`.`)}function E(e,t,n){if(!C(e)){if(typeof e==`string`&&t.includes(e))return e;m(`ignoring \`${n}\` -- expected one of ${t.join(`, `)}.`)}}var D=[`bubble`,`centered`],O=[`top`,`footer`];function k(e){return E(e,D,`greetingStyle`)??`bubble`}function A(e){return E(e,O,`noticePlacement`)??`top`}var ee=200,te=/url\(|[@;{}\\]/i;function ne(e){if(!C(e)){if(typeof e==`string`){let t=e.trim();if(t&&t.length<=ee&&!te.test(t))return t}m(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${ee} characters, without url(), @, ;, {, } or \\.`)}}var re=[`chat`,`message`,`sparkle`],ie=[`chevron-down`,`close`],ae=new WeakMap;function oe(e){let t={colors:{},fontFamily:void 0,launcher:{}};if(e==null)return t;if(!S(e))return v(e),t;let n=ae.get(e);if(n)return n;T(e,[`colors`,`fonts`,`launcher`],`theme`);let a=w(e,`colors`,`theme.colors`);if(a){T(a,i,`theme.colors`);for(let e of i){let n=a[e];C(n)||(typeof n==`string`?t.colors[e]=n:m(`ignoring \`theme.colors.${e}\` -- expected a CSS color string.`))}}let o=w(e,`fonts`,`theme.fonts`);o&&(T(o,[`family`],`theme.fonts`),t.fontFamily=ne(o.family));let s=w(e,`launcher`,`theme.launcher`);if(s){T(s,[`icon`,`iconUrl`,`openIcon`,`openIconUrl`],`theme.launcher`);let e=E(s.icon,re,`theme.launcher.icon`),n=r(s.iconUrl,`theme.launcher.iconUrl`),i=E(s.openIcon,ie,`theme.launcher.openIcon`),a=r(s.openIconUrl,`theme.launcher.openIconUrl`);e&&(t.launcher.icon=e),n&&(t.launcher.iconUrl=n),i&&(t.launcher.openIcon=i),a&&(t.launcher.openIconUrl=a)}return ae.set(e,t),t}var j={offsetX:20,offsetY:20,launcherSize:56,panelWidth:360,panelHeight:480};function M(e,t,n){return e==null?n:typeof e==`number`&&Number.isFinite(e)&&e>=0?e:(m(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`),n)}function se(e,t,n,r){let i=Math.min(r,Math.max(n,e));return i!==e&&m(`\`${t}\` ${e} is out of range (${r===1/0?`at least ${n}`:`${n}-${r}`}); using ${i}.`),i}var ce=new WeakMap;function le(e){let t={...j};if(e==null)return t;if(!S(e))return y(e),t;let n=ce.get(e);if(n)return n;T(e,[`offset`,`launcherSize`,`panel`,`cornerRadius`],`layout`);let r=w(e,`offset`,`layout.offset`);r&&(T(r,[`x`,`y`],`layout.offset`),t.offsetX=M(r.x,`layout.offset.x`,j.offsetX),t.offsetY=M(r.y,`layout.offset.y`,j.offsetY)),t.launcherSize=se(M(e.launcherSize,`layout.launcherSize`,j.launcherSize),`layout.launcherSize`,24,120);let i=w(e,`panel`,`layout.panel`);i&&(T(i,[`width`,`height`],`layout.panel`),t.panelWidth=se(M(i.width,`layout.panel.width`,j.panelWidth),`layout.panel.width`,280,1/0),t.panelHeight=se(M(i.height,`layout.panel.height`,j.panelHeight),`layout.panel.height`,320,1/0));let a=e.cornerRadius;return typeof a==`number`&&Number.isFinite(a)&&a>=0?t.cornerRadius=se(a,`layout.cornerRadius`,0,32):C(a)||m("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."),ce.set(e,t),t}var N,ue,P,de,fe,pe,me,he,ge,_e,ve={},ye=[],be=/^m(i|n|o|s|text|space)$/,xe=Array.isArray,Se=ye.slice,F=Object.assign;function Ce(e){e&&e.parentNode&&e.remove()}function we(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i||++ue,__i:-1,__u:0};return!i&&N.vnode&&N.vnode(a),a}function I(e){return e.children}function Te(e,t){this.props=e,this.context=t,this.__g=0}function L(e,t){if(t==null)return e.__?L(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])&&n.__e)return n.__e;return typeof e.type!=`function`||e.props.__P?null:L(e)}function Ee(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Ee(e)}function De(e){(8&e.__g||!(e.__g|=8)||!P.push(e)||fe++)&&de==N.debounceRendering||((de=N.debounceRendering)||queueMicrotask)(Oe)}function Oe(){var e,t,n,r,i,a,o,s,c;try{for(t=1;P.length;)P.length>t&&P.sort(pe),e=P.shift(),t=P.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=F({constructor:void 0},i)).__v=i.__v+1,N.vnode&&N.vnode(r),Ie(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||L(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,Re(o,r,s),i.__=i.__e=null,r.__e!=a&&Ee(r)))}finally{P.length=fe=0}}function ke(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||ye,v=t.length;for(c=Ae(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||ve,p.__i=d,g=Ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&Be(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h||=m,4&p.__u?(c=je(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-7);return n.__e=h,c}function Ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m,h=n.length,g=h,_=0,v=!1,y=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor==String?o=y[a]=we(null,o):xe(o)?o=y[a]=we(I,{children:o}):o.constructor===void 0&&o.__b?o=y[a]=we(o.type,o.props,o.key,o.ref,o.__v):y[a]=o,c=a+_,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=Me(o,n,c,g))&&(g--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=2,l==c-1?_--:l==c+1?_++:l!=c&&(l>c?_--:_++,v=!0)):(~l||(i>h?_--:i<h&&_++),typeof o.type!=`function`&&(o.__u|=4))):y[a]=null;if(v){for(u=[],d=[],a=0;a<i;a++)if((o=y[a])&&2&o.__u){for(f=0,p=u.length;f<p;)u[m=f+p>>1]<o.__i?f=m+1:p=m;u[f]=o.__i,d[a]=f+1}for(_=u.length;a--;)d[a]&&(d[a]==_?_--:y[a].__u|=4)}if(g)for(a=0;a<h;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=L(s)),Ve(s,s));return r}function je(e,t,n,r){var i,a,o;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=je(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=L(e))&&!t.parentNode&&(t=null),o=t;o&&o.nodeType==8;)o=o.nextSibling;for(e.__e!=o&&(!r&&n.moveBefore&&e.__e.parentNode?n.moveBefore(e.__e,t):n.insertBefore(e.__e,t||null)),t=e.__e;(t&&=t.nextSibling)&&t.nodeType==8;);return t}function Me(e,t,n,r){var i,a,o,s=e.key,c=e.type,l=t[n],u=l&&!(2&l.__u);if(l===null&&s==null||u&&s==l.key&&c==l.type)return n;if(r>+!!u){for(i=n-1,a=n+1;i>=0||a<t.length;)if((l=t[o=i>=0?i--:a++])&&!(2&l.__u)&&s==l.key&&c==l.type)return o}return-1}function Ne(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function Pe(e,t,n,r,i){var a,o;n:if(t==`style`){if(typeof n==`string`)e.style.cssText=n;else{if(typeof r==`string`&&(e.style.cssText=r=``),r)for(t in r)n&&t in n||Ne(e.style,t,``);if(n)for(t in n)r&&n[t]==r[t]||Ne(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=_e[t]||(_e[t]=Fe(t)),(e.__a||={})[t]=ge,a=t!=(t=t.replace(he,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;break n}catch{}typeof n==`function`||(n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n))}}function Fe(e){return function(t){if(this.__e){var n=this.__e[e];if(t[me]==null)t[me]=ge++;else if(t[me]<this.__a[e])return;return n(N.event?N.event(t):t)}}}function Ie(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O,k,A=t.type;if(t.constructor!==void 0)return null;if(128&n.__u&&(c=32&n.__u,u=n.__c.__z)){if(t.__u|=c,d=a=[],u.nodeType==8)for(f=1,p=u.nextSibling;p;p=p.nextSibling){if(p.nodeType==8){if(p.data.startsWith(`$s`))f++;else if(p.data.startsWith(`/$s`)&&!--f)break}a.push(p)}else a.push(u);s=a[0]}(u=N.__b)&&u(t);n:if(typeof A==`function`){m=o.length;try{if(y=t.props,b=(u=A.prototype)&&u.render,x=(u=A.contextType)&&r[u.__c],S=u?x?x.props.value:u.__:r,n.__c?2&(h=t.__c=n.__c).__g&&(h.__g|=1):(b?t.__c=h=new A(y,S):(t.__c=h=new Te(y,S),h.constructor=A,h.render=He),x&&x.sub(h),h.state||(h.state={}),h.__n=r,h.__g|=8,h.__h=[],h.__k=[]),b&&(h.__s||(h.__s=h.state),A.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=F({},h.__s)),F(h.__s,A.getDerivedStateFromProps(y,h.__s)))),g=h.props,_=h.state,h.__v=t,n.__c){if(b&&!A.getDerivedStateFromProps&&y!==g&&h.componentWillReceiveProps&&h.componentWillReceiveProps(y,S),t.__v==n.__v&&!(8&h.__g)||!(4&h.__g)&&h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(y,h.__s,S)){t.__v!=n.__v&&(h.props=y,h.state=h.__s,h.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),ye.push.apply(h.__h,h.__k),h.__k=[],h.__h.length&&o.push(h),s=L(n);break n}h.componentWillUpdate&&h.componentWillUpdate(y,h.__s,S),b&&h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(g,_,v)})}else b&&!A.getDerivedStateFromProps&&h.componentWillMount&&h.componentWillMount(),b&&h.componentDidMount&&h.__h.push(h.componentDidMount);if(h.context=S,h.props=y,h.__P=e,h.__g&=-5,C=N.__r,w=0,b)h.state=h.__s,h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),ye.push.apply(h.__h,h.__k),h.__k=[];else do h.__g&=-9,C&&C(t),u=h.render(h.props,h.state,h.context),h.state=h.__s;while(8&h.__g&&++w<25);h.state=h.__s,h.getChildContext&&(r=F({},r,h.getChildContext())),b&&n.__c&&h.getSnapshotBeforeUpdate&&(v=h.getSnapshotBeforeUpdate(g,_)),T=u&&u.type===I&&u.key==null?u.props.children:u,y.__P&&(u=s,i=(e=y.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&Ve(e,e)}),n.__k=null),s=n.__k?L(n,0):null),s=ke(e,xe(T)?T:[T],t,n,r,i,a,o,s,c,l),y.__P&&(t.__e=null,s=u),t.__u&=-161,128&n.__u&&(h.__z=null),d&&d.some(Ce),h.__h.length&&o.push(h),1&h.__g&&(h.__g&=-4)}catch(e){if(o.length=m,t.__v=null,c||a){if(e.then){if(E=0,t.__u|=c?160:128,a){for(~(O=a.indexOf(s||void 0))||(O=a.length);(k=a[O-1])&&k.nodeType==8;)O--;for(;O<a.length;O++)if(k=a[O]){if(a[O]=null,k.nodeType==8){if(k.data.startsWith(`$s`))E++||(D=k);else if(E&&k.data.startsWith(`/$s`)&&!--E){s=k;break}}else if(!E)break}}if(!D){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;D=s}t.__c.__z||(t.__c.__z=D),t.__e=s}else a&&a.some(Ce)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||Le(t),N.__e(e,t,n)}}else s=t.__e=ze(n.__e,t,n,r,i,a,o,c,l,e);return(u=N.diffed)&&u(t),128&t.__u?void 0:s}function Le(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Le))}function Re(e,t,n){for(var r=0;r<n.length;)Be(n[r++],n[r++],n[r++]);N.__c&&N.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){N.__e(e,t.__v)}})}function ze(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||ve,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a){for(u=0;u<a.length;u++)if((m=a[u])&&(x?m.localName==x:m.nodeType==3)){e=m,a[u]=null;break}}if(!e){if(_=l.ownerDocument||document,!x)return _.createTextNode(b);e=_.createElementNS(i,x,b.is&&b),s&&=(N.__m&&N.__m(t,a),!1),a=null}if(x){if(l=x==`template`?e.content:e,a=x==`textarea`&&b.defaultValue!=null?null:a&&Se.call(l.childNodes),!s&&a)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)m=y[u],u==`dangerouslySetInnerHTML`?f=m:u==`children`||u in b||u==`value`&&`defaultValue`in b||u==`checked`&&`defaultChecked`in b||Pe(e,u,null,m,i);for(u in v=1&n.__u,b)m=b[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||!(y[u]!==m||v&&m!=null)||Pe(e,u,m,y[u],i);d?(s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(f&&(e.textContent=``),(x==`foreignObject`||i==`http://www.w3.org/1998/Math/MathML`&&be.test(x))&&(i=`http://www.w3.org/1999/xhtml`),ke(l,xe(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&L(n,0),s,c),a&&a.some(Ce)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||Pe(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&Pe(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function Be(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){N.__e(e,n)}}function Ve(e,t,n){var r,i;if(N.unmount&&N.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Be(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){N.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(i=0;i<r.length;i++)r[i]&&Ve(r[i],t,typeof e.type!=`function`||n&&!e.props.__P);(r=e.__e)&&(n||Ce(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function He(e,t,n){return this.constructor(e,n)}function Ue(e,t){var n,r,i,a;N.__&&N.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=we(I,{children:[e]}),i=[],a=[],Ie(t,t.__k,r||ve,ve,t.namespaceURI,r?null:t.firstChild?Se.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),Re(i,t.__k,a),t.__k.props.children=null}N={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((a=i.constructor)&&a.getDerivedStateFromError&&(i.setState(a.getDerivedStateFromError(e)),o=8&i.__g),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=8&i.__g),o)return void(i.__g|=2)}catch(t){e=t,o=0}}throw fe=0,e}},ue=0,Te.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=F({},this.state)),typeof e==`function`&&(e=e(F({},n),this.props)),e&&(F(n,e),this.__v&&(t&&this.__k.push(t),De(this)))},Te.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),De(this))},Te.prototype.render=I,P=[],fe=0,pe=function(e,t){return e.__v.__b-t.__v.__b},me=Symbol(),he=/(PointerCapture)$|Capture$/i,ge=0,_e={};var R,z,We,Ge,Ke=Object.is,qe=0,Je=[],Ye=[],B=N,Xe=B.__b,Ze=B.__r,Qe=B.diffed,$e=B.__c,et=B.unmount,tt=B.__;function nt(e,t){B.__h&&B.__h(z,e,qe||t),qe=0;var n=z.__H||(z.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function rt(e){return qe=1,it(pt,e)}function it(e,t,n){var r=nt(R++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):pt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);Ke(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=z,!z.__f)){z.__f=!0;var i=z.shouldComponentUpdate;z.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,Ke(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function at(e,t){var n=nt(R++,3);!B.__s&&ft(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,z.__H.__h.push(n))}function V(e,t){var n=nt(R++,4);!B.__s&&ft(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,z.__h.push(n))}function H(e){return qe=5,ot(function(){return{current:e}},[])}function ot(e,t){var n=nt(R++,7);return ft(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function st(){var e;do{for(;e=Ye.shift();)try{U(e)}catch(t){B.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Je.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(U),t.__h.some(dt),t.__h=[]}catch(n){t.__h=[],B.__e(n,e.__v)}}}while(Ye.length)}B.__b=function(e){z=null,Xe&&Xe(e)},B.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),tt&&tt(e,t)},B.__r=function(e){Ze&&Ze(e),R=0;var t=(z=e.__c).__H;t&&(We==z?z.__h=[]:(t.__h.some(U),t.__h.some(dt),R=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),We=z},B.diffed=function(e){Qe&&Qe(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&ut(Je.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),We=z=null},B.__c=function(e,t){t.some(function(e){try{e.__h.some(U),e.__h=e.__h.filter(function(e){return!e.__||dt(e)})}catch(n){t.some(function(e){e.__h&&=[]}),t=[],B.__e(n,e.__v)}}),$e&&$e(e,t)},B.unmount=function(e){et&&et(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,ut(Ye.push(r))}else U(r)}catch(e){t=e}}),r.__H=void 0,t&&B.__e(t,r.__v))};var ct=typeof requestAnimationFrame==`function`;function lt(e){var t,n=function(){clearTimeout(r),ct&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);ct&&(t=requestAnimationFrame(n))}function ut(e){e!=1&&Ge==B.requestAnimationFrame||((Ge=B.requestAnimationFrame)||lt)(st)}function U(e){var t=z,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),z=t}function dt(e){var t=z;e.__c=e.__(),z=t}function ft(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!Ke(t,e[n])})}function pt(e,t){return typeof t==`function`?t(e):t}var mt=0;Array.isArray;function W(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--mt,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),N.vnode&&N.vnode(l),l}function G({name:e,size:t,children:n}){return W(`svg`,{"data-icon":e,"aria-hidden":`true`,focusable:`false`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,children:n})}function ht({size:e=26}){return W(G,{name:`chat`,size:e,children:[W(`path`,{d:`M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z`}),W(`path`,{d:`M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01`,"stroke-width":`2.5`})]})}function gt({size:e=26}){return W(G,{name:`message`,size:e,children:W(`path`,{d:`M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z`})})}function _t({size:e=26}){return W(G,{name:`sparkle`,size:e,children:[W(`path`,{d:`M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z`}),W(`path`,{d:`M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z`})]})}function vt({size:e=26}){return W(G,{name:`chevron-down`,size:e,children:W(`path`,{d:`M6 9l6 6 6-6`})})}function yt({size:e=18}){return W(G,{name:`close`,size:e,children:W(`path`,{d:`M6 6l12 12M18 6L6 18`})})}var bt=`M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7`;function xt({size:e=16}){return W(G,{name:`thumb-up`,size:e,children:W(`path`,{d:bt})})}function St({size:e=16}){return W(G,{name:`thumb-down`,size:e,children:W(`path`,{d:bt,transform:`matrix(1 0 0 -1 0 24)`})})}var Ct={chat:ht,message:gt,sparkle:_t},wt={"chevron-down":vt,close:yt};function Tt({isOpen:e,onClick:n,iconUrl:r,icon:i=`chat`,openIconUrl:a,openIcon:o=`chevron-down`,buttonRef:s,text:c=t}){let[l,u]=rt(`loading`),[d,f]=rt(`loading`),p=r!==void 0&&l!==`failed`,m=a!==void 0&&d!==`failed`,h=p&&!e&&l===`loaded`,g=m&&e&&d===`loaded`,_=Ct[i]??ht,v=wt[o]??vt;return W(`button`,{type:`button`,class:`whoo-widget-launcher`,onClick:n,"aria-label":e?c.closeChat:c.openChat,ref:s,children:[e?g?null:W(v,{}):h?null:W(_,{}),p?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:r,alt:``,referrerpolicy:`no-referrer`,hidden:!h,onLoad:()=>u(`loaded`),onError:()=>u(`failed`)}):null,m?W(`img`,{class:`whoo-widget-launcher-icon-image`,src:a,alt:``,referrerpolicy:`no-referrer`,hidden:!g,onLoad:()=>f(`loaded`),onError:()=>f(`failed`)}):null]})}var Et={en:t,fr:{openChat:`Ouvrir le chat`,closeChat:`Fermer le chat`,chatWith:`Discuter avec {name}`,newConversation:`Nouvelle conversation`,conversation:`Conversation`,you:`Vous`,message:`Message`,messagePlaceholder:`Écrivez un message…`,send:`Envoyer`,messageSent:`Message envoyé. {name} prépare une réponse.`,lookingItUp:`Je recherche l’information pour vous…`,goodResponse:`Réponse utile`,badResponse:`Réponse peu utile`,additionalFeedback:`Commentaire supplémentaire`,feedbackPlaceholder:`Qu’est-ce qui n’allait pas ? (facultatif)`,feedbackCategory:`Catégorie du commentaire`,selectReason:`Choisissez un motif (facultatif)`,categoryFactual:`Erreur factuelle`,categoryIncomplete:`Réponse incomplète`,categoryTone:`Ton inapproprié`,categoryOther:`Autre`,submit:`Envoyer le commentaire`,cancel:`Annuler`,feedbackThanks:`Merci pour votre commentaire`,feedbackFailed:`Impossible d’envoyer votre commentaire`,conversationCleared:`Nouvelle conversation démarrée. Les messages précédents ont été effacés.`,genericError:`Une erreur s’est produite. Veuillez réessayer.`,sessionExpired:`Cette session de chat a expiré. Rechargez la page pour continuer.`,opensInNewTab:`(s’ouvre dans un nouvel onglet)`,agreeToNotice:`J’accepte`},es:{openChat:`Abrir chat`,closeChat:`Cerrar chat`,chatWith:`Chat con {name}`,newConversation:`Nueva conversación`,conversation:`Conversación`,you:`Usted`,message:`Mensaje`,messagePlaceholder:`Escriba un mensaje…`,send:`Enviar`,messageSent:`Mensaje enviado. {name} está preparando una respuesta.`,lookingItUp:`Estoy buscando esa información…`,goodResponse:`Buena respuesta`,badResponse:`Mala respuesta`,additionalFeedback:`Comentarios adicionales`,feedbackPlaceholder:`¿Qué estuvo mal? (opcional)`,feedbackCategory:`Tipo de problema`,selectReason:`Seleccione un motivo (opcional)`,categoryFactual:`Información incorrecta`,categoryIncomplete:`Respuesta incompleta`,categoryTone:`Tono inadecuado`,categoryOther:`Otro`,submit:`Enviar comentarios`,cancel:`Cancelar`,feedbackThanks:`Gracias por sus comentarios`,feedbackFailed:`No se pudieron enviar sus comentarios`,conversationCleared:`Se inició una nueva conversación. Se borraron los mensajes anteriores.`,genericError:`Algo salió mal. Inténtelo de nuevo.`,sessionExpired:`Esta sesión de chat expiró. Vuelva a cargar la página para continuar.`,opensInNewTab:`(se abre en una pestaña nueva)`,agreeToNotice:`Acepto`},pt:{openChat:`Abrir chat`,closeChat:`Fechar chat`,chatWith:`Conversa com {name}`,newConversation:`Nova conversa`,conversation:`Conversa`,you:`Você`,message:`Mensagem`,messagePlaceholder:`Digite uma mensagem…`,send:`Enviar`,messageSent:`Mensagem enviada. {name} está preparando uma resposta.`,lookingItUp:`Estou buscando essa informação…`,goodResponse:`Boa resposta`,badResponse:`Resposta ruim`,additionalFeedback:`Comentários adicionais`,feedbackPlaceholder:`O que estava errado? (opcional)`,feedbackCategory:`Categoria do feedback`,selectReason:`Selecione um motivo (opcional)`,categoryFactual:`Informação incorreta`,categoryIncomplete:`Resposta incompleta`,categoryTone:`Tom inadequado`,categoryOther:`Outro`,submit:`Enviar feedback`,cancel:`Cancelar`,feedbackThanks:`Agradecemos seu feedback`,feedbackFailed:`Não foi possível enviar o feedback`,conversationCleared:`Nova conversa iniciada. As mensagens anteriores foram apagadas.`,genericError:`Algo deu errado. Tente novamente.`,sessionExpired:`Esta sessão de chat expirou. Recarregue a página para continuar.`,opensInNewTab:`(abre em uma nova aba)`,agreeToNotice:`Concordo`},de:{openChat:`Chat öffnen`,closeChat:`Chat schließen`,chatWith:`Chat mit {name}`,newConversation:`Neue Unterhaltung`,conversation:`Unterhaltung`,you:`Sie`,message:`Nachricht`,messagePlaceholder:`Nachricht eingeben…`,send:`Senden`,messageSent:`Nachricht gesendet. {name} bereitet eine Antwort vor.`,lookingItUp:`Ich suche die Informationen für Sie heraus…`,goodResponse:`Gute Antwort`,badResponse:`Schlechte Antwort`,additionalFeedback:`Zusätzliches Feedback`,feedbackPlaceholder:`Was war falsch? (optional)`,feedbackCategory:`Feedback-Kategorie`,selectReason:`Grund auswählen (optional)`,categoryFactual:`Faktenfehler`,categoryIncomplete:`Unvollständig`,categoryTone:`Unpassender Ton`,categoryOther:`Sonstiges`,submit:`Absenden`,cancel:`Abbrechen`,feedbackThanks:`Danke für Ihr Feedback`,feedbackFailed:`Feedback konnte nicht gesendet werden`,conversationCleared:`Neue Unterhaltung gestartet. Die bisherigen Nachrichten wurden gelöscht.`,genericError:`Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.`,sessionExpired:`Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.`,opensInNewTab:`(öffnet sich in neuem Tab)`,agreeToNotice:`Ich stimme zu`},it:{openChat:`Apri la chat`,closeChat:`Chiudi la chat`,chatWith:`Chat con {name}`,newConversation:`Nuova conversazione`,conversation:`Conversazione`,you:`Tu`,message:`Messaggio`,messagePlaceholder:`Scrivi un messaggio…`,send:`Invia`,messageSent:`Messaggio inviato. {name} sta preparando una risposta.`,lookingItUp:`Sto cercando le informazioni richieste…`,goodResponse:`Risposta utile`,badResponse:`Risposta non utile`,additionalFeedback:`Commenti aggiuntivi`,feedbackPlaceholder:`Che cosa non andava? (facoltativo)`,feedbackCategory:`Categoria del feedback`,selectReason:`Seleziona un motivo (facoltativo)`,categoryFactual:`Informazione errata`,categoryIncomplete:`Risposta incompleta`,categoryTone:`Tono non adeguato`,categoryOther:`Altro`,submit:`Invia feedback`,cancel:`Annulla`,feedbackThanks:`Grazie per il feedback`,feedbackFailed:`Impossibile inviare il feedback`,conversationCleared:`Nuova conversazione avviata. I messaggi precedenti sono stati cancellati.`,genericError:`Si è verificato un errore. Riprovi.`,sessionExpired:`Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.`,opensInNewTab:`(si apre in una nuova scheda)`,agreeToNotice:`Accetto`},ja:{openChat:`チャットを開く`,closeChat:`チャットを閉じる`,chatWith:`{name}とチャット`,newConversation:`新しい会話`,conversation:`会話`,you:`あなた`,message:`メッセージ`,messagePlaceholder:`メッセージを入力…`,send:`送信`,messageSent:`メッセージを送信しました。{name}が回答を準備しています。`,lookingItUp:`確認しています…`,goodResponse:`良い回答`,badResponse:`良くない回答`,additionalFeedback:`追加のフィードバック`,feedbackPlaceholder:`何が問題でしたか?(任意)`,feedbackCategory:`フィードバックの種類`,selectReason:`理由を選択(任意)`,categoryFactual:`事実の誤り`,categoryIncomplete:`回答が不十分`,categoryTone:`不適切な口調`,categoryOther:`その他`,submit:`フィードバックを送信`,cancel:`キャンセル`,feedbackThanks:`フィードバックありがとうございます`,feedbackFailed:`フィードバックを送信できませんでした`,conversationCleared:`新しい会話を開始しました。以前のメッセージは消去されました。`,genericError:`エラーが発生しました。もう一度お試しください。`,sessionExpired:`このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。`,opensInNewTab:`(新しいタブで開きます)`,agreeToNotice:`同意する`},zh:{openChat:`打开聊天`,closeChat:`关闭聊天`,chatWith:`与{name}聊天`,newConversation:`新对话`,conversation:`对话`,you:`您`,message:`消息`,messagePlaceholder:`输入消息…`,send:`发送`,messageSent:`消息已发送。{name}正在准备回复。`,lookingItUp:`正在为您查找……`,goodResponse:`回答很好`,badResponse:`回答不好`,additionalFeedback:`补充反馈`,feedbackPlaceholder:`哪里有问题?(可选)`,feedbackCategory:`反馈类别`,selectReason:`选择原因(可选)`,categoryFactual:`事实错误`,categoryIncomplete:`回答不完整`,categoryTone:`语气不当`,categoryOther:`其他`,submit:`提交`,cancel:`取消`,feedbackThanks:`感谢您的反馈`,feedbackFailed:`反馈提交失败`,conversationCleared:`已开始新对话。之前的消息已清除。`,genericError:`出了点问题,请重试。`,sessionExpired:`此聊天会话已过期。请刷新页面后继续。`,opensInNewTab:`(将在新标签页中打开)`,agreeToNotice:`我同意`},ru:{openChat:`Открыть чат`,closeChat:`Закрыть чат`,chatWith:`Чат с ассистентом {name}`,newConversation:`Новый диалог`,conversation:`Диалог`,you:`Вы`,message:`Сообщение`,messagePlaceholder:`Введите сообщение…`,send:`Отправить`,messageSent:`Сообщение отправлено. {name} готовит ответ.`,lookingItUp:`Ищу информацию…`,goodResponse:`Хороший ответ`,badResponse:`Плохой ответ`,additionalFeedback:`Дополнительный комментарий`,feedbackPlaceholder:`Что было не так? (необязательно)`,feedbackCategory:`Категория отзыва`,selectReason:`Выберите причину (необязательно)`,categoryFactual:`Фактическая ошибка`,categoryIncomplete:`Неполный ответ`,categoryTone:`Неподходящий тон`,categoryOther:`Другое`,submit:`Отправить отзыв`,cancel:`Отмена`,feedbackThanks:`Спасибо за отзыв`,feedbackFailed:`Не удалось отправить отзыв`,conversationCleared:`Начат новый диалог. Предыдущие сообщения удалены.`,genericError:`Что-то пошло не так. Попробуйте ещё раз.`,sessionExpired:`Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.`,opensInNewTab:`(откроется в новой вкладке)`,agreeToNotice:`Принимаю`},hi:{openChat:`चैट खोलें`,closeChat:`चैट बंद करें`,chatWith:`{name} से चैट करें`,newConversation:`नई बातचीत`,conversation:`बातचीत`,you:`आप`,message:`संदेश`,messagePlaceholder:`संदेश लिखें…`,send:`भेजें`,messageSent:`संदेश भेज दिया गया। {name} द्वारा जवाब तैयार किया जा रहा है।`,lookingItUp:`आपके लिए जानकारी खोजी जा रही है…`,goodResponse:`अच्छा जवाब`,badResponse:`ख़राब जवाब`,additionalFeedback:`अतिरिक्त फ़ीडबैक`,feedbackPlaceholder:`क्या ग़लत था? (वैकल्पिक)`,feedbackCategory:`फ़ीडबैक की श्रेणी`,selectReason:`कारण चुनें (वैकल्पिक)`,categoryFactual:`तथ्यात्मक त्रुटि`,categoryIncomplete:`अधूरा जवाब`,categoryTone:`अनुचित लहजा`,categoryOther:`अन्य`,submit:`सबमिट करें`,cancel:`रद्द करें`,feedbackThanks:`आपके फ़ीडबैक के लिए धन्यवाद`,feedbackFailed:`फ़ीडबैक नहीं भेजा जा सका`,conversationCleared:`नई बातचीत शुरू हुई। पिछले संदेश मिटा दिए गए।`,genericError:`कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।`,sessionExpired:`यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।`,opensInNewTab:`(नए टैब में खुलता है)`,agreeToNotice:`मैं सहमत हूँ`},ar:{openChat:`فتح الدردشة`,closeChat:`إغلاق الدردشة`,chatWith:`الدردشة مع {name}`,newConversation:`محادثة جديدة`,conversation:`المحادثة`,you:`أنت`,message:`الرسالة`,messagePlaceholder:`كتابة رسالة…`,send:`إرسال`,messageSent:`تم إرسال الرسالة. جارٍ إعداد الرد من قِبل {name}.`,lookingItUp:`جارٍ البحث عن المعلومات…`,goodResponse:`إجابة جيدة`,badResponse:`إجابة سيئة`,additionalFeedback:`ملاحظات إضافية`,feedbackPlaceholder:`ما المشكلة؟ (اختياري)`,feedbackCategory:`فئة الملاحظات`,selectReason:`اختر سببًا (اختياري)`,categoryFactual:`معلومات غير صحيحة`,categoryIncomplete:`إجابة غير مكتملة`,categoryTone:`أسلوب غير مناسب`,categoryOther:`أخرى`,submit:`إرسال الملاحظات`,cancel:`إلغاء`,feedbackThanks:`شكرًا على ملاحظاتك`,feedbackFailed:`تعذّر إرسال الملاحظات`,conversationCleared:`بدأت محادثة جديدة. تم مسح الرسائل السابقة.`,genericError:`حدث خطأ ما. يُرجى المحاولة مرة أخرى.`,sessionExpired:`انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.`,opensInNewTab:`(يُفتح في علامة تبويب جديدة)`,agreeToNotice:`أوافق`}},Dt=Object.freeze(Object.keys(Et)),Ot={pt:`pt-BR`,es:`es-419`,zh:`zh-Hans`},kt=new Set([`ar`]),At=/^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i,jt=/^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;function Mt(e){return Et[e]}function Nt(e){let t=e.trim();if(!At.test(t)||jt.test(t))return null;let n=t.split(/[-_]/)[0].toLowerCase();return Object.hasOwn(Et,n)?n:null}function Pt(e,t){let n=null;return e!=null&&e!==``&&(n=typeof e==`string`?Nt(e):null,n||console.warn(`whoo-aiden-widget: ignoring \`language\` ${Ft(e)} -- expected one of ${Dt.join(`, `)} (or a regional tag like pt-BR). Using the page's language instead.`)),n??=typeof t==`string`?Nt(t):null,n??=`en`,{language:n,tag:Ot[n]??n,dir:kt.has(n)?`rtl`:`ltr`}}function Ft(e){return typeof e==`string`?JSON.stringify(e):`(a ${typeof e})`}function It(e){if(typeof e!=`string`)return null;let t=e.trim().replace(/_/g,`-`);return At.test(t)?t:null}function Lt(e,t,n){if(e!=null&&e!==``){let t=It(e);if(t)return t;console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Ft(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`)}return It(t)??It(n)??``}function Rt(e){let t=e.indexOf(`{name}`);return t===-1?{before:e,after:``,hasName:!1}:{before:e.slice(0,t),after:e.slice(t+6),hasName:!0}}function zt(e,t){return e.split(`{name}`).join(t.name)}var Bt=`(max-width: 400px), (max-height: 420px)`,Vt=`data-fit-visible`,Ht=40;function Ut(e){let t=typeof window<`u`?window.visualViewport:null;if(!t)return()=>{};let n=()=>{e.removeAttribute(Vt),e.style.removeProperty(`--whoo-widget-visible-top`),e.style.removeProperty(`--whoo-widget-visible-height`)},r=()=>{let r=document.documentElement.clientHeight,i=Math.abs(t.scale-1)>.01,a=r-t.height;if(i||r===0||a<Ht){n();return}e.setAttribute(Vt,``),e.style.setProperty(`--whoo-widget-visible-top`,`${Math.max(0,t.offsetTop)}px`),e.style.setProperty(`--whoo-widget-visible-height`,`${t.height}px`);let o=e.getRootNode().activeElement;o&&e.contains(o)&&typeof o.scrollIntoView==`function`&&o.scrollIntoView({block:`nearest`})};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r),n()}}function Wt(e,t){return typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}}var Gt=0,Kt=``;function qt(){Gt++===0&&(Kt=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`)}function Jt(){--Gt===0&&(document.documentElement.style.overflow=Kt)}function Yt(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let e=window.matchMedia(Bt),t=!1,n=()=>{e.matches&&!t?(t=!0,qt()):!e.matches&&t&&(t=!1,Jt())};n();let r=Wt(e,n);return()=>{r(),t&&(t=!1,Jt())}}function Xt(e){if(typeof window>`u`||typeof window.matchMedia!=`function`||typeof e.showModal!=`function`)return()=>{};let t=window.matchMedia(Bt),n=!1,r=()=>{if(t.matches===n||!e.isConnected)return;n=t.matches;let r=e.getRootNode().activeElement;e.close(),n?e.showModal():e.show(),r&&e.contains(r)&&r.focus({preventScroll:!0})};return r(),Wt(t,r)}function Zt(e){return e.isComposing||e.keyCode===229}function Qt({value:e,onChange:n,onSend:r,disabled:i,inputRef:a,text:o=t,contentLanguage:s}){return W(`div`,{class:`whoo-widget-composer`,children:[W(`label`,{class:`whoo-widget-sr-only`,for:`whoo-widget-composer-input`,children:o.message}),W(`input`,{id:`whoo-widget-composer-input`,class:`whoo-widget-composer-input`,lang:s,autoFocus:!0,placeholder:o.messagePlaceholder,value:e,readOnly:i,"aria-disabled":i,ref:a,onInput:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!Zt(e)&&r()}}),W(`button`,{type:`button`,class:`whoo-widget-composer-send`,"aria-disabled":i,onClick:()=>{i||r()},children:o.send})]})}function $t({message:e}){return W(`div`,{class:`whoo-widget-error-banner`,role:`alert`,children:e})}var en=/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y,tn=/\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y,nn=/(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y,rn=/\*([^*\s](?:[^*]*[^*\s])?)\*/y,an=/[ \t]*[*+-][ \t]+/y,on=/https?:\/\/\S+/y,sn=/[.,;:!?)\]}>]+$/;function cn(e){let t=[],n=0,r=0,i=n=>{n>r&&t.push({type:`text`,value:e.slice(r,n),start:r,end:n})};for(;n<e.length;){if((n===0||e[n-1]===`
2
- `)&&(an.lastIndex=n,an.exec(e))){i(n),t.push({type:`text`,value:`• `,start:n,end:an.lastIndex}),n=an.lastIndex,r=n;continue}if(e[n]===`!`&&n+1<e.length&&e[n+1]===`[`){let t=/!\[([^\]]*)\]\(([^)]*)\)/y;t.lastIndex=n;let r=t.exec(e);if(r){n+=r[0].length;continue}}if(e[n-1]!==`!`){en.lastIndex=n;let a=en.exec(e);if(a){i(n),t.push({type:`link`,text:a[1],url:a[2],start:n,end:en.lastIndex}),n=en.lastIndex,r=n;continue}}tn.lastIndex=n;let a=tn.exec(e);if(a){i(n),t.push({type:`bold`,value:a[1],start:n,end:tn.lastIndex}),n=tn.lastIndex,r=n;continue}nn.lastIndex=n;let o=nn.exec(e);if(o){i(n),t.push({type:`italic`,value:o[1],start:n,end:nn.lastIndex}),n=nn.lastIndex,r=n;continue}rn.lastIndex=n;let s=rn.exec(e);if(s){i(n),t.push({type:`italic`,value:s[1],start:n,end:rn.lastIndex}),n=rn.lastIndex,r=n;continue}on.lastIndex=n;let c=on.exec(e);if(c){let e=c[0].match(sn),a=e?c[0].slice(0,c[0].length-e[0].length):c[0];if(a.length>0){i(n),t.push({type:`link`,text:a,url:a,start:n,end:n+a.length}),n+=a.length,r=n;continue}}n+=1}return i(e.length),t}var ln=/^[ \t]*[*+-][ \t]+(.*)$/,un=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;function dn(e){let t=e.match(/\p{L}/u)?.[0];if(t)return un.test(t)?`rtl`:`ltr`}function fn(e){let t=[],n=[],r=[],i=()=>{n.length>0&&t.push({type:`text`,text:n.join(`
1
+ var whooAidenWidget=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t={openChat:`Open chat`,closeChat:`Close chat`,chatWith:`Chat with {name}`,newConversation:`New conversation`,conversation:`Conversation`,you:`You`,message:`Message`,messagePlaceholder:`Type a message…`,send:`Send`,messageSent:`Message sent. {name} is preparing a response.`,lookingItUp:`Looking that up for you…`,goodResponse:`Good response`,badResponse:`Bad response`,additionalFeedback:`Additional feedback`,feedbackPlaceholder:`What was wrong? (optional)`,feedbackCategory:`Feedback category`,selectReason:`Select a reason (optional)`,categoryFactual:`Factual error`,categoryIncomplete:`Incomplete`,categoryTone:`Off tone`,categoryOther:`Other`,submit:`Submit`,cancel:`Cancel`,feedbackThanks:`Thanks for the feedback`,feedbackFailed:`Couldn't send feedback`,conversationCleared:`New conversation started. Previous messages were cleared.`,genericError:`Something went wrong, please try again.`,sessionExpired:`This chat session has expired. Reload the page to continue.`,tooManyMessages:`You're sending messages too quickly. Please wait a moment and try again.`,assistantUnavailable:`The assistant is unavailable right now. Please try again later.`,waitForReply:`Please wait for the current reply to finish.`,messageLimitReached:`This conversation has reached its message limit. Please try again later.`,opensInNewTab:`(opens in new tab)`,agreeToNotice:`I agree`},n=Object.keys(t);function r(e,t){if(e!=null&&e!==``){if(typeof e==`string`)try{let t=new URL(e);if(t.protocol===`https:`||t.protocol===`data:`&&t.pathname.toLowerCase().startsWith(`image/`))return e}catch{}console.warn(`whoo-aiden-widget: ignoring \`${t}\` -- only https: and data:image/ URLs are allowed.`)}}var i=[`primary`,`onPrimary`,`primaryText`,`ink`,`link`,`text`,`panel`,`border`,`headerHover`,`assistantBubble`,`muted`,`typingDots`,`errorBackground`,`errorText`,`inputBorder`,`focusRing`],a={primary:`#4f46e5`,onPrimary:`#ffffff`,primaryText:`#4f46e5`,ink:`#111111`,link:`#0000ee`,text:`#111111`,panel:`#ffffff`,border:`#e5e5e5`,headerHover:`#f3f4f6`,assistantBubble:`#f0f0f0`,muted:`#4b5563`,typingDots:`#6b7280`,errorBackground:`#fee2e2`,errorText:`#991b1b`,inputBorder:`#6b7280`,focusRing:`#111827`},o={primary:`--whoo-widget-color`,onPrimary:`--whoo-widget-text-on-color`,primaryText:`--whoo-widget-color-text`,ink:`--whoo-widget-ink`,link:`--whoo-widget-link-color`,text:`--whoo-widget-text`,panel:`--whoo-widget-panel`,border:`--whoo-widget-border`,headerHover:`--whoo-widget-header-hover`,assistantBubble:`--whoo-widget-assistant-bubble`,muted:`--whoo-widget-muted`,typingDots:`--whoo-widget-typing-dots`,errorBackground:`--whoo-widget-error-bg`,errorText:`--whoo-widget-error-text`,inputBorder:`--whoo-widget-input-border`,focusRing:`--whoo-widget-focus-ring`},s=2147483e3,c=2147483647;function l(e){return e===void 0?s:Number.isInteger(e)&&Math.abs(e)<=c?e:(console.warn(`whoo-aiden-widget: ignoring zIndex ${String(e)} (expected an integer between -${c} and ${c}); using ${s}.`),s)}var u=`Aiden`;function d(e){return typeof e==`string`?e.trim():``}function f(e){return/^[\p{White_Space}\p{Cf}\p{M}]*$/u.test(e)}function p(e){if((typeof e.publishableKey==`string`&&e.publishableKey.length>0)==(typeof e.sessionToken==`string`&&e.sessionToken.length>0))throw Error("whoo-aiden-widget: init() requires exactly one of `publishableKey` or `sessionToken`, not both or neither.")}function m(e){console.warn(`whoo-aiden-widget: ${e}`)}function h(e){let{getSessionToken:t}=e;if(t!==void 0){if(typeof t!=`function`)m("ignoring `getSessionToken` -- expected a function that returns a session token.");else if(!e.sessionToken)m("ignoring `getSessionToken` -- it is only used with `sessionToken`; with `publishableKey` the widget renews its session by itself.");else return t}}var g=20;function _(e){let t=new WeakSet,n=new Set;return r=>{if(typeof r==`object`&&r||typeof r==`function`){if(t.has(r))return;t.add(r)}else{if(n.has(r))return;n.size>=g&&n.delete(n.values().next().value),n.add(r)}m(e)}}var v=_("ignoring `theme` -- expected an object."),y=_("ignoring `layout` -- expected an object."),b=_("ignoring `messages` -- expected an object.");function x(e){if(e==null)return{};if(!S(e))return b(e),{};let t={};for(let r of Object.keys(e)){if(!n.includes(r)){m(`ignoring unknown option \`messages.${r}\`.`);continue}let i=e[r];typeof i!=`string`||f(i)?m(`ignoring \`messages.${r}\` -- expected a non-blank string.`):(r===`chatWith`&&!i.includes(`{name}`)&&m("`messages.chatWith` has no {name}, so the agent name is not shown in the title. For a fixed title, use the `title` option."),t[r]=i)}for(let t in e)Object.hasOwn(e,t)||m(`ignoring inherited option \`messages.${t}\` -- only the object's own keys are used.`);return t}function S(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}var C=e=>e==null||e===``;function w(e,t,n){let r=e[t];return r==null?null:S(r)?r:(m(`ignoring \`${n}\` -- expected an object.`),null)}function T(e,t,n){for(let r of Object.keys(e))t.includes(r)||m(`ignoring unknown option \`${n}.${r}\`.`)}function E(e,t,n){if(!C(e)){if(typeof e==`string`&&t.includes(e))return e;m(`ignoring \`${n}\` -- expected one of ${t.join(`, `)}.`)}}var D=[`bubble`,`centered`],O=[`top`,`footer`];function ee(e){return E(e,D,`greetingStyle`)??`bubble`}function te(e){return E(e,O,`noticePlacement`)??`top`}var ne=200,re=/url\(|[@;{}\\]/i;function ie(e){if(!C(e)){if(typeof e==`string`){let t=e.trim();if(t&&t.length<=ne&&!re.test(t))return t}m(`ignoring \`theme.fonts.family\` -- expected a font-family stack of at most ${ne} characters, without url(), @, ;, {, } or \\.`)}}var ae=[`chat`,`message`,`sparkle`],oe=[`chevron-down`,`close`],se=new WeakMap;function ce(e){let t={colors:{},fontFamily:void 0,launcher:{}};if(e==null)return t;if(!S(e))return v(e),t;let n=se.get(e);if(n)return n;T(e,[`colors`,`fonts`,`launcher`],`theme`);let a=w(e,`colors`,`theme.colors`);if(a){T(a,i,`theme.colors`);for(let e of i){let n=a[e];C(n)||(typeof n==`string`?t.colors[e]=n:m(`ignoring \`theme.colors.${e}\` -- expected a CSS color string.`))}}let o=w(e,`fonts`,`theme.fonts`);o&&(T(o,[`family`],`theme.fonts`),t.fontFamily=ie(o.family));let s=w(e,`launcher`,`theme.launcher`);if(s){T(s,[`icon`,`iconUrl`,`openIcon`,`openIconUrl`],`theme.launcher`);let e=E(s.icon,ae,`theme.launcher.icon`),n=r(s.iconUrl,`theme.launcher.iconUrl`),i=E(s.openIcon,oe,`theme.launcher.openIcon`),a=r(s.openIconUrl,`theme.launcher.openIconUrl`);e&&(t.launcher.icon=e),n&&(t.launcher.iconUrl=n),i&&(t.launcher.openIcon=i),a&&(t.launcher.openIconUrl=a)}return se.set(e,t),t}var k={offsetX:20,offsetY:20,launcherSize:56,panelWidth:360,panelHeight:480};function A(e,t,n){return e==null?n:typeof e==`number`&&Number.isFinite(e)&&e>=0?e:(m(`ignoring \`${t}\` -- expected a non-negative number of pixels; using ${n}.`),n)}function j(e,t,n,r){let i=Math.min(r,Math.max(n,e));return i!==e&&m(`\`${t}\` ${e} is out of range (${r===1/0?`at least ${n}`:`${n}-${r}`}); using ${i}.`),i}var le=new WeakMap;function ue(e){let t={...k};if(e==null)return t;if(!S(e))return y(e),t;let n=le.get(e);if(n)return n;T(e,[`offset`,`launcherSize`,`panel`,`cornerRadius`],`layout`);let r=w(e,`offset`,`layout.offset`);r&&(T(r,[`x`,`y`],`layout.offset`),t.offsetX=A(r.x,`layout.offset.x`,k.offsetX),t.offsetY=A(r.y,`layout.offset.y`,k.offsetY)),t.launcherSize=j(A(e.launcherSize,`layout.launcherSize`,k.launcherSize),`layout.launcherSize`,24,120);let i=w(e,`panel`,`layout.panel`);i&&(T(i,[`width`,`height`],`layout.panel`),t.panelWidth=j(A(i.width,`layout.panel.width`,k.panelWidth),`layout.panel.width`,280,1/0),t.panelHeight=j(A(i.height,`layout.panel.height`,k.panelHeight),`layout.panel.height`,320,1/0));let a=e.cornerRadius;return typeof a==`number`&&Number.isFinite(a)&&a>=0?t.cornerRadius=j(a,`layout.cornerRadius`,0,32):C(a)||m("ignoring `layout.cornerRadius` -- expected a non-negative number of pixels."),le.set(e,t),t}var M,de,N,fe,pe,me,P,he,ge,_e,ve=Symbol.for(`pv`),ye={},be=[],xe=/^m(i|n|o|s|text|space)$/,Se=Array.isArray,Ce=be.slice,F=Object.assign;function I(e){e&&e.parentNode&&e.remove()}function we(e,t,n,r,i){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:ve,__v:i||++de,__i:-1,__u:0};return!i&&M.vnode&&M.vnode(a),a}function L(e){return e.children}function Te(e,t){this.props=e,this.context=t,this.__g=0}function R(e,t){if(t==null)return e.__&&R(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:R(e)}function Ee(e){if((e=e.__)&&e.__c&&!e.props.__P)return e.__e=null,e.__k.some(function(t){return t&&(e.__e=t.__e)}),Ee(e)}function De(e){(8&e.__g||(e.__g|=8,N.push(e),pe++))&&fe==M.debounceRendering||((fe=M.debounceRendering)||queueMicrotask)(Oe)}function Oe(){var e,t,n,r,i,a,o,s,c;try{for(t=1;N.length;)N.length>t&&N.sort(me),e=N.shift(),t=N.length,8&e.__g&&(r=void 0,i=void 0,a=(i=(n=e).__v).__e,o=[],s=[],(c=n.__P)&&((r=F({constructor:ve},i)).__v=i.__v+1,M.vnode&&M.vnode(r),Ie(c,r,i,n.__n,c.namespaceURI,32&i.__u?[a]:null,o,a||R(i),32&i.__u,s),r.__v=i.__v,r.__.__k[r.__i]=r,ze(o,r,s),i.__=i.__e=null,r.__e!=a&&Ee(r)))}finally{(pe=N.length)&&(fe||queueMicrotask)(Oe)}}function ke(e,t,n,r,i,a,o,s,c,l,u){var d,f,p,m,h,g,_=r.__k||be,v=t.length;for(c=Ae(n,t,_,c,v),d=0;d<v;d++)(p=n.__k[d])!=null&&(f=~p.__i&&_[p.__i]||ye,p.__i=d,g=Ie(e,p,f,i,a,o,s,c,l,u),m=p.__e,(f.ref!=p.ref||8&f.__u)&&(f.ref&&Ve(f.ref,null,p,f),p.ref&&u.push(p.ref,p.__c||m,p)),h||=m,4&p.__u?(c=je(p,c,e,!f.__v),f.__e&&(f.__e=null)):typeof p.type==`function`&&g!==void 0?c=g:m&&(c=m.nextSibling),p.__u&=-21);return n.__e=h,c}function Ae(e,t,n,r,i){var a,o,s,c,l,u,d,f,p,m=n.length,h=m,g=0,_=0,v=e.__k=Array(i);for(a=0;a<i;a++)(o=t[a])!=null&&typeof o!=`boolean`&&typeof o!=`function`?(typeof o!=`object`||o.constructor===String?o=v[a]=we(null,o):Se(o)?o=v[a]=we(L,{children:o}):o.constructor===ve&&o.__b?o=v[a]=we(o.type,o.props,o.key,o.ref,o.__v):v[a]=o,c=a+g,o.__=e,o.__b=e.__b+1,s=null,~(l=o.__i=Me(o,n,c,h))&&(h--,(s=n[l])&&(s.__u|=2)),s&&s.__v?(o.__u|=16,l==c-1?g--:l==c+1?g++:l!=c&&(l>c?g--:g++,_=1)):(~l||(i>m?g--:i<m&&g++),typeof o.type!=`function`&&(o.__u|=4))):v[a]=null;if(_){for(u=[],d=[],a=0;a<i;a++)if((o=v[a])&&16&o.__u){for(g=0,f=u.length;g<f;)u[p=g+f>>1]<o.__i?g=p+1:f=p;u[g]=o.__i,d[a]=g+1}for(g=u.length;a--;)d[a]&&(d[a]==g?g--:v[a].__u|=4)}if(h)for(a=0;a<m;a++)!(s=n[a])||2&s.__u||(s.__e==r&&(r=R(s)),He(s,s));return r}function je(e,t,n,r){var i,a,o,s;if(typeof e.type==`function`){if(e.props.__P)return t;if(i=e.__k)for(a=0;a<i.length;a++)i[a]&&(i[a].__=e,t=je(i[a],t,n,!1));return t}for(t&&!t.parentNode&&(t=R(e))&&!t.parentNode&&(t=null),o=e.__e,s=t;s&&s.nodeType==8;)s=s.nextSibling;for(o!=s&&(!r&&n.moveBefore&&o.parentNode?n.moveBefore(o,t):n.insertBefore(o,t||null)),t=o;(t&&=t.nextSibling)&&t.nodeType==8&&!t.data.startsWith(`$s`););return t}function Me(e,t,n,r){var i,a=e.key,o=e.type,s=t[n],c=s&&!(2&s.__u);if(s===null&&a==null||c&&a==s.key&&o==s.type)return n;if(r>+!!c){for(i=n-1;i>=0;i--)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i;for(i=n+1;i<t.length;i++)if((s=t[i])&&!(2&s.__u)&&a==s.key&&o==s.type)return i}return-1}function Ne(e,t,n){n??=``,t[0]==`-`?e.setProperty(t,n):e[t]=n}function Pe(e,t,n,r,i){var a,o;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||Ne(e.style,t);if(n)for(t in n)r&&n[t]==r[t]||Ne(e.style,t,n[t])}}else if(t[0]==`o`&&t[1]==`n`)(e.__e||={})[t]=n,n&&r||(o=_e[t]||(_e[t]=Fe(t)),(e.__a||={})[t]=ge,a=t!=(t=t.replace(he,`$1`)),(t=t.slice(2))[0]<`a`&&(t=t.toLowerCase()),n?e.addEventListener(t,o,a):e.removeEventListener(t,o,a));else{if(i==`http://www.w3.org/2000/svg`)t=t.replace(/xlink(H|:h)/,`h`).replace(/sName$/,`s`);else if(t!=`width`&&t!=`height`&&t!=`href`&&t!=`list`&&t!=`form`&&t!=`tabIndex`&&t!=`download`&&t!=`rowSpan`&&t!=`colSpan`&&t!=`role`&&t!=`popover`&&t in e)try{e[t]=n??``;return}catch{}if(typeof n==`function`)return;n==null||!1===n&&t[4]!=`-`?e.removeAttribute(t):e.setAttribute(t,t==`popover`&&n==1?``:n)}}function Fe(e){return function(t){var n=this.__e;if(n){if(n=n[e],t[P]==null)t[P]=ge++;else if(t[P]<this.__a[e])return;return n(M.event?M.event(t):t)}}}function Ie(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T,E,D,O=t.type;if(t.constructor!==ve)return null;128&n.__u&&(c=32&n.__u,u=n.__c.__z)&&(t.__u|=c,d=a=[],u.nodeType==8?s=Le(u,a):a.push(u),s=a[0]||s),(u=M.__b)&&u(t);n:if(typeof O==`function`){f=o.length;try{if(_=t.props,v=(u=O.prototype)&&u.render,y=(u=O.contextType)&&r[u.__c],b=u?y?y.props.value:u.__:r,(p=n.__c)?(t.__c=p,2&p.__g&&(p.__g|=1)):(v?t.__c=p=new O(_,b):(t.__c=p=new Te(_,b),p.constructor=O,p.render=Ue),y&&y.sub(p),p.state||(p.state={}),p.__n=r,p.__g|=8,p.__h=[],p.__k=[]),v&&(p.__s||(p.__s=p.state),O.getDerivedStateFromProps&&(p.__s==p.state&&(p.__s=F({},p.__s)),F(p.__s,O.getDerivedStateFromProps(_,p.__s)))),m=p.props,h=p.state,p.__v=t,n.__c){if(_!==m&&v&&!O.getDerivedStateFromProps&&p.componentWillReceiveProps&&p.componentWillReceiveProps(_,b),t.__v==n.__v&&!(8&p.__g)||!(4&p.__g)&&p.shouldComponentUpdate&&!1===p.shouldComponentUpdate(_,p.__s,b)){t.__v!=n.__v&&(p.props=_,p.state=p.__s,p.__g&=-9),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),be.push.apply(p.__h,p.__k),p.__k=[],p.__h.length&&o.push(p),s=R(n);break n}p.componentWillUpdate&&p.componentWillUpdate(_,p.__s,b),v&&p.componentDidUpdate&&p.__h.push(function(){p.componentDidUpdate(m,h,g)})}else v&&!O.getDerivedStateFromProps&&p.componentWillMount&&p.componentWillMount(),v&&p.componentDidMount&&p.__h.push(p.componentDidMount);if(p.context=b,p.props=_,p.__P=e,p.__g&=-5,x=M.__r,S=0,v)p.state=p.__s,p.__g&=-9,x&&x(t),u=p.render(p.props,p.state,p.context),be.push.apply(p.__h,p.__k),p.__k=[];else do p.__g&=-9,x&&x(t),u=p.render(p.props,p.state,p.context),p.state=p.__s;while(8&p.__g&&++S<25);p.state=p.__s,p.getChildContext&&(r=F({},r,p.getChildContext())),v&&n.__c&&p.getSnapshotBeforeUpdate&&(g=p.getSnapshotBeforeUpdate(m,h)),C=u&&u.type===L&&u.key==null?u.props.children:u,_.__P&&(u=s,i=(e=_.__P).namespaceURI,c=a=null,n.props&&n.props.__P!=e&&(n.__k.some(function(e){e&&He(e,e)}),n.__k=null),s=n.__k?R(n,0):null),s=ke(e,Se(C)?C:[C],t,n,r,i,a,o,s,c,l),_.__P&&(t.__e=null,s=u),t.__u&=-161,d&&d.some(I),p.__h.length&&o.push(p),1&p.__g&&(p.__g&=-4)}catch(e){if(o.length=f,t.__v=null,c||a){if(e.then){if(w=0,t.__u|=128|c,a){for(~(E=a.indexOf(s||void 0))||(E=a.length);(D=a[E-1])&&D.nodeType==8;)E--;for(;E<a.length;E++)if(D=a[E]){if(a[E]=null,D.nodeType==8){if(D.data.startsWith(`$s`))w++||(T=D);else if(w&&D.data.startsWith(`/$s`)&&!--w)break}else if(!w)break}}if(!T){for(;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;T=s}(u=Le(T=t.__c.__z||(t.__c.__z=T)))?(t.__e=T,s=u):t.__e=s,s&&=s.nextSibling}else a&&a.some(I)}else t.__e=n.__e;t.__k||=n.__k||[],e.then||Re(t),M.__e(e,t,n)}}else s=t.__e=Be(n.__e,t,n,r,i,a,o,c,l,e);return(u=M.diffed)&&u(t),s}function Le(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 Re(e){e&&(e.__c&&(e.__c.__g|=4),e.__k&&e.__k.some(Re))}function ze(e,t,n){for(var r=0;r<n.length;)Ve(n[r++],n[r++],n[r++]);M.__c&&M.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){M.__e(e,t.__v)}})}function Be(e,t,n,r,i,a,o,s,c,l){var u,d,f,p,m,h,g,_,v,y=n.props||ye,b=t.props,x=t.type;if(x==`svg`?i=`http://www.w3.org/2000/svg`:x==`math`?i=`http://www.w3.org/1998/Math/MathML`:i||=`http://www.w3.org/1999/xhtml`,a){for(u=0;u<a.length;u++)if((m=a[u])&&(x?m.localName==x:m.nodeType==3)){e=m,a[u]=null;break}}if(!e){if(_=l.ownerDocument||document,!x)return _.createTextNode(b);e=_.createElementNS(i,x,b.is&&b),s&&=(M.__m&&M.__m(t,a),!1),a=null}if(x){if(l=x==`template`&&e.content||e,a=x==`textarea`&&b.defaultValue!=null?null:a&&Ce.call(l.childNodes),!s&&a)for(y={},u=0;u<e.attributes.length;u++)y[(m=e.attributes[u]).name]=m.value;for(u in y)m=y[u],u==`dangerouslySetInnerHTML`?f=m:u==`children`||u in b||u==`value`&&`defaultValue`in b||u==`checked`&&`defaultChecked`in b||Pe(e,u,null,m,i);for(u in v=1&n.__u,b)m=b[u],u==`children`?p=m:u==`dangerouslySetInnerHTML`?d=m:u==`value`?h=m:u==`checked`?g=m:s&&typeof m!=`function`||!(y[u]!==m||v&&m!=null)||Pe(e,u,m,y[u],i);d?(s||f&&(d.__html==f.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[]):(f&&(e.textContent=``),(x==`foreignObject`||i==`http://www.w3.org/1998/Math/MathML`&&xe.test(x))&&(i=`http://www.w3.org/1999/xhtml`),ke(l,Se(p)?p:[p],t,n,r,i,a,o,a?a[0]:n.__k&&R(n,0),s,c),a&&a.some(I)),s&&x!=`textarea`||(u=`value`,x==`progress`&&h==null?e.removeAttribute(u):h==null||h===e[u]&&(x!=`progress`||h)||Pe(e,u,h,y[u],i),u=`checked`,g!=null&&g!=e[u]&&Pe(e,u,g,y[u],i))}else y===b||s&&e.data==b||(e.data=b);return e}function Ve(e,t,n,r){try{typeof e==`function`?t?t.__x=e(t)||1:(r&&=r.__c||r.__e)&&(t=r.__x)&&(r.__x=null,typeof t==`function`?t():e(null)):e.current=t}catch(e){M.__e(e,n)}}function He(e,t,n){var r,i,a,o;if(M.unmount&&M.unmount(e),!(r=e.ref)||r.current&&r.current!=e.__e||Ve(r,null,t,e),r=e.__c){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(e){M.__e(e,t)}r.__P=r.__n=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&He(r[o],t,typeof e.type!=`function`||n&&!e.props.__P);!n&&(r=e.__c)&&(r=r.__z)&&(i=Le(r,a=[]))&&(r==e.__e&&a.some(I),I(i),I(r)),(r=e.__e)&&(n||I(r),r.__e&&(r.__e=null)),e.__e=e.__c=e.__=null}function Ue(e,t,n){return this.constructor(e,n)}function We(e,t){var n,r,i,a;M.__&&M.__(e,t),t.nodeType==9&&(t=t.documentElement),r=(n=e&&32&e.__u)?null:t.__k,t.__k=we(L,{children:[e]}),i=[],a=[],Ie(t,t.__k,r||ye,ye,t.namespaceURI,r?null:t.firstChild?Ce.call(t.childNodes):null,i,r?r.__e:t.firstChild,n,a),ze(i,t.__k,a),t.__k.props.children=null}M={__e:function(e,t,n,r){for(var i,a,o;t=t.__;)if((i=t.__c)&&!(1&i.__g)){i.__g|=4;try{if((o=(a=i.constructor)&&a.getDerivedStateFromError)&&i.setState(a.getDerivedStateFromError(e)),i.componentDidCatch&&(i.componentDidCatch(e,r||{}),o=1),o&&8&i.__g)return void(i.__g|=2)}catch(t){e=t}}throw pe=0,e}},de=0,Te.prototype.setState=function(e,t){var n=this.__s;n&&n!=this.state||(n=this.__s=F({},this.state)),typeof e==`function`&&(e=e(F({},n),this.props)),e&&(F(n,e),this.__v&&(t&&this.__k.push(t),De(this)))},Te.prototype.forceUpdate=function(e){this.__v&&(this.__g|=4,e&&this.__h.push(e),De(this))},Te.prototype.render=L,N=[],pe=0,me=function(e,t){return e.__v.__b-t.__v.__b},P=Symbol(),he=/(PointerCapture)$|Capture$/i,ge=0,_e={};var z,B,Ge,Ke,qe=Object.is,Je=0,Ye=[],Xe=[],V=M,Ze=V.__b,Qe=V.__r,$e=V.diffed,et=V.__c,tt=V.unmount,nt=V.__;function rt(e,t){V.__h&&V.__h(B,e,Je||t),Je=0;var n=B.__H||(B.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function it(e){return Je=1,at(mt,e)}function at(e,t,n){var r=rt(z++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):mt(void 0,t),function(e){var t=r.__N?r.__N[0]:r.__[0],n=r.t(t,e);qe(t,n)||(r.__N=[n,r.__[1]],r.__c.setState({}))}],r.__c=B,!B.__f)){B.__f=!0;var i=B.shouldComponentUpdate;B.shouldComponentUpdate=function(e,t,n){var r=this.__H;if(!r)return!0;var a=!1,o=this.props!=e;if(r.__.some(function(e){e.__N&&(a=!0,qe(e.__[0],e.__N[0])||(o=!0))}),i){var s=i.call(this,e,t,n);return a?s||o:s}return!a||o}}return r.__}function ot(e,t){var n=rt(z++,3);!V.__s&&pt(n.__H,t)&&(n.__P=!0,n.__=e,n.u=t,B.__H.__h.push(n))}function H(e,t){var n=rt(z++,4);!V.__s&&pt(n.__H,t)&&(n.__P=!1,n.__=e,n.u=t,B.__h.push(n))}function U(e){return Je=5,st(function(){return{current:e}},[])}function st(e,t){var n=rt(z++,7);return pt(n.__H,t)&&(n.__=e(),n.__H=t),n.__}function ct(){var e;do{for(;e=Xe.shift();)try{W(e)}catch(t){V.__e(t,{__:(e=e.__P)&&e.__v})}for(;e=Ye.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(W),t.__h.some(ft),t.__h=[]}catch(n){t.__h=[],V.__e(n,e.__v)}}}while(Xe.length)}V.__b=function(e){B=null,Ze&&Ze(e)},V.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),nt&&nt(e,t)},V.__r=function(e){Qe&&Qe(e),z=0;var t=(B=e.__c).__H;t&&(Ge==B?B.__h=[]:(t.__h.some(W),t.__h.some(ft),z=0),t.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})),Ge=B},V.diffed=function(e){$e&&$e(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&dt(Ye.push(t)),t.__H.__.some(function(e){e.u&&(e.__H=e.u)})),Ge=B=null},V.__c=function(e,t){t.some(function(e){try{e.__h.some(W),e.__h=e.__h.filter(function(e){return!e.__||ft(e)})}catch(t){e.__h=[function(){throw t}]}}),et&&et(e,t)},V.unmount=function(e){tt&&tt(e);var t,n,r=e.__c;r&&r.__H&&(r.__H.__.some(function(r){try{if(r.__P&&r.__c){if(n===void 0){for(n=e.__;n&&(!n.__c||!n.__c.__P);)n=n.__;n&&=n.__c}r.__P=n,dt(Xe.push(r))}else W(r)}catch(e){t=e}}),r.__H=void 0,t&&V.__e(t,r.__v))};var lt=typeof requestAnimationFrame==`function`;function ut(e){var t,n=function(){clearTimeout(r),lt&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,35);lt&&(t=requestAnimationFrame(n))}function dt(e){e!=1&&Ke==V.requestAnimationFrame||((Ke=V.requestAnimationFrame)||ut)(ct)}function W(e){var t=B,n=e.__c;typeof n==`function`&&(e.__c=void 0,n()),B=t}function ft(e){var t=B;e.__c=e.__(),B=t}function pt(e,t){return!e||e.length!=t.length||t.some(function(t,n){return!qe(t,e[n])})}function mt(e,t){return typeof t==`function`?t(e):t}var ht=Symbol.for(`pv`),gt=0;Array.isArray;function G(e,t,n,r,i,a){t||={};var o,s,c=t;if(`ref`in c&&typeof e!=`function`)for(s in c={},t)s==`ref`?o=t[s]:c[s]=t[s];var l={type:e,props:c,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:ht,__v:--gt,__i:-1,__u:0};return(i||a)&&(l.__source=i,l.__self=a),M.vnode&&M.vnode(l),l}function K({name:e,size:t,children:n}){return G(`svg`,{"data-icon":e,"aria-hidden":`true`,focusable:`false`,width:t,height:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,children:n})}function _t({size:e=26}){return G(K,{name:`chat`,size:e,children:[G(`path`,{d:`M4 5.5A2.5 2.5 0 0 1 6.5 3h11A2.5 2.5 0 0 1 20 5.5v8a2.5 2.5 0 0 1-2.5 2.5H10l-4.5 4v-4h0A1.5 1.5 0 0 1 4 14.5z`}),G(`path`,{d:`M8.5 9.5h.01M12 9.5h.01M15.5 9.5h.01`,"stroke-width":`2.5`})]})}function vt({size:e=26}){return G(K,{name:`message`,size:e,children:G(`path`,{d:`M21 11.5a8.5 8.5 0 0 1-12.4 7.5L3 20.5l1.6-5.1A8.5 8.5 0 1 1 21 11.5z`})})}function yt({size:e=26}){return G(K,{name:`sparkle`,size:e,children:[G(`path`,{d:`M11 3l1.9 5.1L18 10l-5.1 1.9L11 17l-1.9-5.1L4 10l5.1-1.9z`}),G(`path`,{d:`M19 15l.7 1.8 1.8.7-1.8.7L19 20l-.7-1.8-1.8-.7 1.8-.7z`})]})}function bt({size:e=26}){return G(K,{name:`chevron-down`,size:e,children:G(`path`,{d:`M6 9l6 6 6-6`})})}function xt({size:e=18}){return G(K,{name:`close`,size:e,children:G(`path`,{d:`M6 6l12 12M18 6L6 18`})})}var St=`M7 11v9M7 11l3.5-7.2A1.8 1.8 0 0 1 14 4.6V9h4.6a2 2 0 0 1 2 2.3l-1.2 7A2 2 0 0 1 17.4 20H7M7 11H4.5A1.5 1.5 0 0 0 3 12.5v6A1.5 1.5 0 0 0 4.5 20H7`;function Ct({size:e=16}){return G(K,{name:`thumb-up`,size:e,children:G(`path`,{d:St})})}function wt({size:e=16}){return G(K,{name:`thumb-down`,size:e,children:G(`path`,{d:St,transform:`matrix(1 0 0 -1 0 24)`})})}var Tt={chat:_t,message:vt,sparkle:yt},Et={"chevron-down":bt,close:xt};function Dt({isOpen:e,onClick:n,iconUrl:r,icon:i=`chat`,openIconUrl:a,openIcon:o=`chevron-down`,buttonRef:s,text:c=t}){let[l,u]=it(`loading`),[d,f]=it(`loading`),p=r!==void 0&&l!==`failed`,m=a!==void 0&&d!==`failed`,h=p&&!e&&l===`loaded`,g=m&&e&&d===`loaded`,_=Tt[i]??_t,v=Et[o]??bt;return G(`button`,{type:`button`,class:`whoo-widget-launcher`,onClick:n,"aria-label":e?c.closeChat:c.openChat,ref:s,children:[e?g?null:G(v,{}):h?null:G(_,{}),p?G(`img`,{class:`whoo-widget-launcher-icon-image`,src:r,alt:``,referrerpolicy:`no-referrer`,hidden:!h,onLoad:()=>u(`loaded`),onError:()=>u(`failed`)}):null,m?G(`img`,{class:`whoo-widget-launcher-icon-image`,src:a,alt:``,referrerpolicy:`no-referrer`,hidden:!g,onLoad:()=>f(`loaded`),onError:()=>f(`failed`)}):null]})}var Ot={en:t,fr:{openChat:`Ouvrir le chat`,closeChat:`Fermer le chat`,chatWith:`Discuter avec {name}`,newConversation:`Nouvelle conversation`,conversation:`Conversation`,you:`Vous`,message:`Message`,messagePlaceholder:`Écrivez un message…`,send:`Envoyer`,messageSent:`Message envoyé. {name} prépare une réponse.`,lookingItUp:`Je recherche l’information pour vous…`,goodResponse:`Réponse utile`,badResponse:`Réponse peu utile`,additionalFeedback:`Commentaire supplémentaire`,feedbackPlaceholder:`Qu’est-ce qui n’allait pas ? (facultatif)`,feedbackCategory:`Catégorie du commentaire`,selectReason:`Choisissez un motif (facultatif)`,categoryFactual:`Erreur factuelle`,categoryIncomplete:`Réponse incomplète`,categoryTone:`Ton inapproprié`,categoryOther:`Autre`,submit:`Envoyer le commentaire`,cancel:`Annuler`,feedbackThanks:`Merci pour votre commentaire`,feedbackFailed:`Impossible d’envoyer votre commentaire`,conversationCleared:`Nouvelle conversation démarrée. Les messages précédents ont été effacés.`,genericError:`Une erreur s’est produite. Veuillez réessayer.`,sessionExpired:`Cette session de chat a expiré. Rechargez la page pour continuer.`,tooManyMessages:`Vous envoyez des messages trop rapidement. Veuillez patienter un instant et réessayer.`,assistantUnavailable:`L’assistant n’est pas disponible pour le moment. Veuillez réessayer plus tard.`,waitForReply:`Veuillez attendre la fin de la réponse en cours.`,messageLimitReached:`Cette conversation a atteint sa limite de messages. Veuillez réessayer plus tard.`,opensInNewTab:`(s’ouvre dans un nouvel onglet)`,agreeToNotice:`J’accepte`},es:{openChat:`Abrir chat`,closeChat:`Cerrar chat`,chatWith:`Chat con {name}`,newConversation:`Nueva conversación`,conversation:`Conversación`,you:`Usted`,message:`Mensaje`,messagePlaceholder:`Escriba un mensaje…`,send:`Enviar`,messageSent:`Mensaje enviado. {name} está preparando una respuesta.`,lookingItUp:`Estoy buscando esa información…`,goodResponse:`Buena respuesta`,badResponse:`Mala respuesta`,additionalFeedback:`Comentarios adicionales`,feedbackPlaceholder:`¿Qué estuvo mal? (opcional)`,feedbackCategory:`Tipo de problema`,selectReason:`Seleccione un motivo (opcional)`,categoryFactual:`Información incorrecta`,categoryIncomplete:`Respuesta incompleta`,categoryTone:`Tono inadecuado`,categoryOther:`Otro`,submit:`Enviar comentarios`,cancel:`Cancelar`,feedbackThanks:`Gracias por sus comentarios`,feedbackFailed:`No se pudieron enviar sus comentarios`,conversationCleared:`Se inició una nueva conversación. Se borraron los mensajes anteriores.`,genericError:`Algo salió mal. Inténtelo de nuevo.`,sessionExpired:`Esta sesión de chat expiró. Vuelva a cargar la página para continuar.`,tooManyMessages:`Está enviando mensajes demasiado rápido. Espere un momento e inténtelo de nuevo.`,assistantUnavailable:`El asistente no está disponible en este momento. Inténtelo de nuevo más tarde.`,waitForReply:`Espere a que termine la respuesta actual.`,messageLimitReached:`Esta conversación alcanzó su límite de mensajes. Inténtelo de nuevo más tarde.`,opensInNewTab:`(se abre en una pestaña nueva)`,agreeToNotice:`Acepto`},pt:{openChat:`Abrir chat`,closeChat:`Fechar chat`,chatWith:`Conversa com {name}`,newConversation:`Nova conversa`,conversation:`Conversa`,you:`Você`,message:`Mensagem`,messagePlaceholder:`Digite uma mensagem…`,send:`Enviar`,messageSent:`Mensagem enviada. {name} está preparando uma resposta.`,lookingItUp:`Estou buscando essa informação…`,goodResponse:`Boa resposta`,badResponse:`Resposta ruim`,additionalFeedback:`Comentários adicionais`,feedbackPlaceholder:`O que estava errado? (opcional)`,feedbackCategory:`Categoria do feedback`,selectReason:`Selecione um motivo (opcional)`,categoryFactual:`Informação incorreta`,categoryIncomplete:`Resposta incompleta`,categoryTone:`Tom inadequado`,categoryOther:`Outro`,submit:`Enviar feedback`,cancel:`Cancelar`,feedbackThanks:`Agradecemos seu feedback`,feedbackFailed:`Não foi possível enviar o feedback`,conversationCleared:`Nova conversa iniciada. As mensagens anteriores foram apagadas.`,genericError:`Algo deu errado. Tente novamente.`,sessionExpired:`Esta sessão de chat expirou. Recarregue a página para continuar.`,tooManyMessages:`Você está enviando mensagens rápido demais. Aguarde um momento e tente novamente.`,assistantUnavailable:`O assistente não está disponível no momento. Tente novamente mais tarde.`,waitForReply:`Aguarde até que a resposta atual termine.`,messageLimitReached:`Esta conversa atingiu o limite de mensagens. Tente novamente mais tarde.`,opensInNewTab:`(abre em uma nova aba)`,agreeToNotice:`Concordo`},de:{openChat:`Chat öffnen`,closeChat:`Chat schließen`,chatWith:`Chat mit {name}`,newConversation:`Neue Unterhaltung`,conversation:`Unterhaltung`,you:`Sie`,message:`Nachricht`,messagePlaceholder:`Nachricht eingeben…`,send:`Senden`,messageSent:`Nachricht gesendet. {name} bereitet eine Antwort vor.`,lookingItUp:`Ich suche die Informationen für Sie heraus…`,goodResponse:`Gute Antwort`,badResponse:`Schlechte Antwort`,additionalFeedback:`Zusätzliches Feedback`,feedbackPlaceholder:`Was war falsch? (optional)`,feedbackCategory:`Feedback-Kategorie`,selectReason:`Grund auswählen (optional)`,categoryFactual:`Faktenfehler`,categoryIncomplete:`Unvollständig`,categoryTone:`Unpassender Ton`,categoryOther:`Sonstiges`,submit:`Absenden`,cancel:`Abbrechen`,feedbackThanks:`Danke für Ihr Feedback`,feedbackFailed:`Feedback konnte nicht gesendet werden`,conversationCleared:`Neue Unterhaltung gestartet. Die bisherigen Nachrichten wurden gelöscht.`,genericError:`Etwas ist schiefgelaufen. Bitte versuchen Sie es erneut.`,sessionExpired:`Diese Chat-Sitzung ist abgelaufen. Laden Sie die Seite neu, um fortzufahren.`,tooManyMessages:`Sie senden zu schnell Nachrichten. Bitte warten Sie einen Moment und versuchen Sie es erneut.`,assistantUnavailable:`Der Assistent ist gerade nicht verfügbar. Bitte versuchen Sie es später erneut.`,waitForReply:`Bitte warten Sie, bis die aktuelle Antwort fertig ist.`,messageLimitReached:`Diese Unterhaltung hat ihr Nachrichtenlimit erreicht. Bitte versuchen Sie es später erneut.`,opensInNewTab:`(öffnet sich in neuem Tab)`,agreeToNotice:`Ich stimme zu`},it:{openChat:`Apri la chat`,closeChat:`Chiudi la chat`,chatWith:`Chat con {name}`,newConversation:`Nuova conversazione`,conversation:`Conversazione`,you:`Tu`,message:`Messaggio`,messagePlaceholder:`Scrivi un messaggio…`,send:`Invia`,messageSent:`Messaggio inviato. {name} sta preparando una risposta.`,lookingItUp:`Sto cercando le informazioni richieste…`,goodResponse:`Risposta utile`,badResponse:`Risposta non utile`,additionalFeedback:`Commenti aggiuntivi`,feedbackPlaceholder:`Che cosa non andava? (facoltativo)`,feedbackCategory:`Categoria del feedback`,selectReason:`Seleziona un motivo (facoltativo)`,categoryFactual:`Informazione errata`,categoryIncomplete:`Risposta incompleta`,categoryTone:`Tono non adeguato`,categoryOther:`Altro`,submit:`Invia feedback`,cancel:`Annulla`,feedbackThanks:`Grazie per il feedback`,feedbackFailed:`Impossibile inviare il feedback`,conversationCleared:`Nuova conversazione avviata. I messaggi precedenti sono stati cancellati.`,genericError:`Si è verificato un errore. Riprovi.`,sessionExpired:`Questa sessione di chat è scaduta. Ricarichi la pagina per continuare.`,tooManyMessages:`Sta inviando messaggi troppo rapidamente. Attenda un momento e riprovi.`,assistantUnavailable:`L’assistente non è disponibile al momento. Riprovi più tardi.`,waitForReply:`Attenda che la risposta in corso sia completata.`,messageLimitReached:`Questa conversazione ha raggiunto il limite di messaggi. Riprovi più tardi.`,opensInNewTab:`(si apre in una nuova scheda)`,agreeToNotice:`Accetto`},ja:{openChat:`チャットを開く`,closeChat:`チャットを閉じる`,chatWith:`{name}とチャット`,newConversation:`新しい会話`,conversation:`会話`,you:`あなた`,message:`メッセージ`,messagePlaceholder:`メッセージを入力…`,send:`送信`,messageSent:`メッセージを送信しました。{name}が回答を準備しています。`,lookingItUp:`確認しています…`,goodResponse:`良い回答`,badResponse:`良くない回答`,additionalFeedback:`追加のフィードバック`,feedbackPlaceholder:`何が問題でしたか?(任意)`,feedbackCategory:`フィードバックの種類`,selectReason:`理由を選択(任意)`,categoryFactual:`事実の誤り`,categoryIncomplete:`回答が不十分`,categoryTone:`不適切な口調`,categoryOther:`その他`,submit:`フィードバックを送信`,cancel:`キャンセル`,feedbackThanks:`フィードバックありがとうございます`,feedbackFailed:`フィードバックを送信できませんでした`,conversationCleared:`新しい会話を開始しました。以前のメッセージは消去されました。`,genericError:`エラーが発生しました。もう一度お試しください。`,sessionExpired:`このチャットセッションの有効期限が切れました。続けるにはページを再読み込みしてください。`,tooManyMessages:`メッセージの送信が速すぎます。少し待ってからもう一度お試しください。`,assistantUnavailable:`現在アシスタントはご利用いただけません。しばらくしてからもう一度お試しください。`,waitForReply:`現在の返信が完了するまでお待ちください。`,messageLimitReached:`この会話のメッセージ数が上限に達しました。しばらくしてからもう一度お試しください。`,opensInNewTab:`(新しいタブで開きます)`,agreeToNotice:`同意する`},zh:{openChat:`打开聊天`,closeChat:`关闭聊天`,chatWith:`与{name}聊天`,newConversation:`新对话`,conversation:`对话`,you:`您`,message:`消息`,messagePlaceholder:`输入消息…`,send:`发送`,messageSent:`消息已发送。{name}正在准备回复。`,lookingItUp:`正在为您查找……`,goodResponse:`回答很好`,badResponse:`回答不好`,additionalFeedback:`补充反馈`,feedbackPlaceholder:`哪里有问题?(可选)`,feedbackCategory:`反馈类别`,selectReason:`选择原因(可选)`,categoryFactual:`事实错误`,categoryIncomplete:`回答不完整`,categoryTone:`语气不当`,categoryOther:`其他`,submit:`提交`,cancel:`取消`,feedbackThanks:`感谢您的反馈`,feedbackFailed:`反馈提交失败`,conversationCleared:`已开始新对话。之前的消息已清除。`,genericError:`出了点问题,请重试。`,sessionExpired:`此聊天会话已过期。请刷新页面后继续。`,tooManyMessages:`您发送消息的速度过快。请稍候再试。`,assistantUnavailable:`助手暂时无法使用。请稍后再试。`,waitForReply:`请等待当前回复完成。`,messageLimitReached:`此对话的消息数量已达上限。请稍后再试。`,opensInNewTab:`(将在新标签页中打开)`,agreeToNotice:`我同意`},ru:{openChat:`Открыть чат`,closeChat:`Закрыть чат`,chatWith:`Чат с ассистентом {name}`,newConversation:`Новый диалог`,conversation:`Диалог`,you:`Вы`,message:`Сообщение`,messagePlaceholder:`Введите сообщение…`,send:`Отправить`,messageSent:`Сообщение отправлено. {name} готовит ответ.`,lookingItUp:`Ищу информацию…`,goodResponse:`Хороший ответ`,badResponse:`Плохой ответ`,additionalFeedback:`Дополнительный комментарий`,feedbackPlaceholder:`Что было не так? (необязательно)`,feedbackCategory:`Категория отзыва`,selectReason:`Выберите причину (необязательно)`,categoryFactual:`Фактическая ошибка`,categoryIncomplete:`Неполный ответ`,categoryTone:`Неподходящий тон`,categoryOther:`Другое`,submit:`Отправить отзыв`,cancel:`Отмена`,feedbackThanks:`Спасибо за отзыв`,feedbackFailed:`Не удалось отправить отзыв`,conversationCleared:`Начат новый диалог. Предыдущие сообщения удалены.`,genericError:`Что-то пошло не так. Попробуйте ещё раз.`,sessionExpired:`Срок действия сеанса чата истёк. Перезагрузите страницу, чтобы продолжить.`,tooManyMessages:`Вы отправляете сообщения слишком часто. Подождите немного и попробуйте ещё раз.`,assistantUnavailable:`Ассистент сейчас недоступен. Попробуйте позже.`,waitForReply:`Дождитесь окончания текущего ответа.`,messageLimitReached:`В этом диалоге достигнут лимит сообщений. Попробуйте позже.`,opensInNewTab:`(откроется в новой вкладке)`,agreeToNotice:`Принимаю`},hi:{openChat:`चैट खोलें`,closeChat:`चैट बंद करें`,chatWith:`{name} से चैट करें`,newConversation:`नई बातचीत`,conversation:`बातचीत`,you:`आप`,message:`संदेश`,messagePlaceholder:`संदेश लिखें…`,send:`भेजें`,messageSent:`संदेश भेज दिया गया। {name} द्वारा जवाब तैयार किया जा रहा है।`,lookingItUp:`आपके लिए जानकारी खोजी जा रही है…`,goodResponse:`अच्छा जवाब`,badResponse:`ख़राब जवाब`,additionalFeedback:`अतिरिक्त फ़ीडबैक`,feedbackPlaceholder:`क्या ग़लत था? (वैकल्पिक)`,feedbackCategory:`फ़ीडबैक की श्रेणी`,selectReason:`कारण चुनें (वैकल्पिक)`,categoryFactual:`तथ्यात्मक त्रुटि`,categoryIncomplete:`अधूरा जवाब`,categoryTone:`अनुचित लहजा`,categoryOther:`अन्य`,submit:`सबमिट करें`,cancel:`रद्द करें`,feedbackThanks:`आपके फ़ीडबैक के लिए धन्यवाद`,feedbackFailed:`फ़ीडबैक नहीं भेजा जा सका`,conversationCleared:`नई बातचीत शुरू हुई। पिछले संदेश मिटा दिए गए।`,genericError:`कुछ ग़लत हो गया। कृपया फिर से कोशिश करें।`,sessionExpired:`यह चैट सत्र समाप्त हो गया है। जारी रखने के लिए पेज को फिर से लोड करें।`,tooManyMessages:`संदेश बहुत जल्दी-जल्दी भेजे जा रहे हैं। कृपया थोड़ी देर रुककर फिर से कोशिश करें।`,assistantUnavailable:`सहायक अभी उपलब्ध नहीं है। कृपया बाद में फिर से कोशिश करें।`,waitForReply:`कृपया मौजूदा जवाब पूरा होने तक प्रतीक्षा करें।`,messageLimitReached:`इस बातचीत में संदेशों की सीमा पूरी हो गई है। कृपया बाद में फिर से कोशिश करें।`,opensInNewTab:`(नए टैब में खुलता है)`,agreeToNotice:`मैं सहमत हूँ`},ar:{openChat:`فتح الدردشة`,closeChat:`إغلاق الدردشة`,chatWith:`الدردشة مع {name}`,newConversation:`محادثة جديدة`,conversation:`المحادثة`,you:`أنت`,message:`الرسالة`,messagePlaceholder:`كتابة رسالة…`,send:`إرسال`,messageSent:`تم إرسال الرسالة. جارٍ إعداد الرد من قِبل {name}.`,lookingItUp:`جارٍ البحث عن المعلومات…`,goodResponse:`إجابة جيدة`,badResponse:`إجابة سيئة`,additionalFeedback:`ملاحظات إضافية`,feedbackPlaceholder:`ما المشكلة؟ (اختياري)`,feedbackCategory:`فئة الملاحظات`,selectReason:`اختر سببًا (اختياري)`,categoryFactual:`معلومات غير صحيحة`,categoryIncomplete:`إجابة غير مكتملة`,categoryTone:`أسلوب غير مناسب`,categoryOther:`أخرى`,submit:`إرسال الملاحظات`,cancel:`إلغاء`,feedbackThanks:`شكرًا على ملاحظاتك`,feedbackFailed:`تعذّر إرسال الملاحظات`,conversationCleared:`بدأت محادثة جديدة. تم مسح الرسائل السابقة.`,genericError:`حدث خطأ ما. يُرجى المحاولة مرة أخرى.`,sessionExpired:`انتهت صلاحية جلسة الدردشة هذه. يُرجى إعادة تحميل الصفحة للمتابعة.`,tooManyMessages:`يتم إرسال الرسائل بسرعة كبيرة. يُرجى الانتظار قليلاً ثم المحاولة مرة أخرى.`,assistantUnavailable:`المساعد غير متاح حاليًا. يُرجى المحاولة لاحقًا.`,waitForReply:`يُرجى الانتظار حتى يكتمل الرد الحالي.`,messageLimitReached:`وصلت هذه المحادثة إلى الحد الأقصى للرسائل. يُرجى المحاولة لاحقًا.`,opensInNewTab:`(يُفتح في علامة تبويب جديدة)`,agreeToNotice:`أوافق`}},kt=Object.freeze(Object.keys(Ot)),At={pt:`pt-BR`,es:`es-419`,zh:`zh-Hans`},jt=new Set([`ar`]),Mt=/^[a-z]{2,8}([-_][a-z0-9]{1,8})*$/i,Nt=/^zh[-_](hant|tw|hk|mo)(?=$|[-_])/i;function Pt(e){return Ot[e]}function Ft(e){let t=e.trim();if(!Mt.test(t)||Nt.test(t))return null;let n=t.split(/[-_]/)[0].toLowerCase();return Object.hasOwn(Ot,n)?n:null}function It(e,t){let n=null;return e!=null&&e!==``&&(n=typeof e==`string`?Ft(e):null,n||console.warn(`whoo-aiden-widget: ignoring \`language\` ${Lt(e)} -- expected one of ${kt.join(`, `)} (or a regional tag like pt-BR). Using the page's language instead.`)),n??=typeof t==`string`?Ft(t):null,n??=`en`,{language:n,tag:At[n]??n,dir:jt.has(n)?`rtl`:`ltr`}}function Lt(e){return typeof e==`string`?JSON.stringify(e):`(a ${typeof e})`}function Rt(e){if(typeof e!=`string`)return null;let t=e.trim().replace(/_/g,`-`);return Mt.test(t)?t:null}function zt(e,t,n){if(e!=null&&e!==``){let t=Rt(e);if(t)return t;console.warn(`whoo-aiden-widget: ignoring \`contentLanguage\` ${Lt(e)} -- expected a language tag such as 'nl' or 'pt-BR'. Using the page's language instead.`)}return Rt(t)??Rt(n)??``}function Bt(e){let t=e.indexOf(`{name}`);return t===-1?{before:e,after:``,hasName:!1}:{before:e.slice(0,t),after:e.slice(t+6),hasName:!0}}function Vt(e,t){return e.split(`{name}`).join(t.name)}var Ht=`(max-width: 400px), (max-height: 420px)`,Ut=`data-fit-visible`,Wt=40;function Gt(e){let t=typeof window<`u`?window.visualViewport:null;if(!t)return()=>{};let n=()=>{e.removeAttribute(Ut),e.style.removeProperty(`--whoo-widget-visible-top`),e.style.removeProperty(`--whoo-widget-visible-height`)},r=()=>{let r=document.documentElement.clientHeight,i=Math.abs(t.scale-1)>.01,a=r-t.height;if(i||r===0||a<Wt){n();return}e.setAttribute(Ut,``),e.style.setProperty(`--whoo-widget-visible-top`,`${Math.max(0,t.offsetTop)}px`),e.style.setProperty(`--whoo-widget-visible-height`,`${t.height}px`);let o=e.getRootNode().activeElement;o&&e.contains(o)&&typeof o.scrollIntoView==`function`&&o.scrollIntoView({block:`nearest`})};return r(),t.addEventListener(`resize`,r),t.addEventListener(`scroll`,r),()=>{t.removeEventListener(`resize`,r),t.removeEventListener(`scroll`,r),n()}}function Kt(e,t){return typeof e.addEventListener==`function`?(e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)):typeof e.addListener==`function`?(e.addListener(t),()=>e.removeListener(t)):()=>{}}var qt=0,Jt=``;function Yt(){qt++===0&&(Jt=document.documentElement.style.overflow,document.documentElement.style.overflow=`hidden`)}function Xt(){--qt===0&&(document.documentElement.style.overflow=Jt)}function Zt(){if(typeof window>`u`||typeof window.matchMedia!=`function`)return()=>{};let e=window.matchMedia(Ht),t=!1,n=()=>{e.matches&&!t?(t=!0,Yt()):!e.matches&&t&&(t=!1,Xt())};n();let r=Kt(e,n);return()=>{r(),t&&(t=!1,Xt())}}function Qt(e){if(typeof window>`u`||typeof window.matchMedia!=`function`||typeof e.showModal!=`function`)return()=>{};let t=window.matchMedia(Ht),n=!1,r=()=>{if(t.matches===n||!e.isConnected)return;n=t.matches;let r=e.getRootNode().activeElement;e.close(),n?e.showModal():e.show(),r&&e.contains(r)&&r.focus({preventScroll:!0})};return r(),Kt(t,r)}function $t(e){return e.isComposing||e.keyCode===229}function en({value:e,onChange:n,onSend:r,disabled:i,inputRef:a,text:o=t,contentLanguage:s}){return G(`div`,{class:`whoo-widget-composer`,children:[G(`label`,{class:`whoo-widget-sr-only`,for:`whoo-widget-composer-input`,children:o.message}),G(`input`,{id:`whoo-widget-composer-input`,class:`whoo-widget-composer-input`,lang:s,autoFocus:!0,placeholder:o.messagePlaceholder,value:e,readOnly:i,"aria-disabled":i,ref:a,onInput:e=>n(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!$t(e)&&r()}}),G(`button`,{type:`button`,class:`whoo-widget-composer-send`,"aria-disabled":i,onClick:()=>{i||r()},children:o.send})]})}function tn({message:e}){return G(`div`,{class:`whoo-widget-error-banner`,role:`alert`,children:e})}var nn=/\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)/y,rn=/\*\*([^*\s](?:[^*]*[^*\s])?)\*\*/y,an=/(?<![A-Za-z0-9_])_([^_\s](?:[^_]*[^_\s])?)_(?![A-Za-z0-9_])/y,on=/\*([^*\s](?:[^*]*[^*\s])?)\*/y,sn=/[ \t]*[*+-][ \t]+/y,cn=/https?:\/\/\S+/y,ln=/[.,;:!?)\]}>]+$/;function un(e){let t=[],n=0,r=0,i=n=>{n>r&&t.push({type:`text`,value:e.slice(r,n),start:r,end:n})};for(;n<e.length;){if((n===0||e[n-1]===`
2
+ `)&&(sn.lastIndex=n,sn.exec(e))){i(n),t.push({type:`text`,value:`• `,start:n,end:sn.lastIndex}),n=sn.lastIndex,r=n;continue}if(e[n]===`!`&&n+1<e.length&&e[n+1]===`[`){let t=/!\[([^\]]*)\]\(([^)]*)\)/y;t.lastIndex=n;let r=t.exec(e);if(r){n+=r[0].length;continue}}if(e[n-1]!==`!`){nn.lastIndex=n;let a=nn.exec(e);if(a){i(n),t.push({type:`link`,text:a[1],url:a[2],start:n,end:nn.lastIndex}),n=nn.lastIndex,r=n;continue}}rn.lastIndex=n;let a=rn.exec(e);if(a){i(n),t.push({type:`bold`,value:a[1],start:n,end:rn.lastIndex}),n=rn.lastIndex,r=n;continue}an.lastIndex=n;let o=an.exec(e);if(o){i(n),t.push({type:`italic`,value:o[1],start:n,end:an.lastIndex}),n=an.lastIndex,r=n;continue}on.lastIndex=n;let s=on.exec(e);if(s){i(n),t.push({type:`italic`,value:s[1],start:n,end:on.lastIndex}),n=on.lastIndex,r=n;continue}cn.lastIndex=n;let c=cn.exec(e);if(c){let e=c[0].match(ln),a=e?c[0].slice(0,c[0].length-e[0].length):c[0];if(a.length>0){i(n),t.push({type:`link`,text:a,url:a,start:n,end:n+a.length}),n+=a.length,r=n;continue}}n+=1}return i(e.length),t}var dn=/^[ \t]*[*+-][ \t]+(.*)$/,fn=/[\p{Script=Arabic}\p{Script=Hebrew}\p{Script=Syriac}\p{Script=Thaana}\p{Script=Nko}\p{Script=Adlam}\p{Script=Samaritan}\p{Script=Mandaic}\p{Script=Hanifi_Rohingya}\p{Script=Mende_Kikakui}]/u;function pn(e){let t=e.match(/\p{L}/u)?.[0];if(t)return fn.test(t)?`rtl`:`ltr`}function mn(e){let t=[],n=[],r=[],i=()=>{n.length>0&&t.push({type:`text`,text:n.join(`
3
3
  `)}),n=[]},a=()=>{r.length>0&&t.push({type:`list`,items:r}),r=[]};for(let t of e.split(`
4
- `)){let e=t.match(ln);e?(i(),r.push(e[1])):(a(),n.push(t))}return i(),a(),t.some(e=>e.type===`list`)?t.flatMap((e,n)=>{if(e.type===`list`)return[e];let{text:r}=e;return t[n-1]?.type===`list`&&(r=r.replace(/^(?:[ \t]*\n)+/,``)),t[n+1]?.type===`list`&&(r=r.replace(/(?:\n[ \t]*)+$/,``)),r.trim()===``?[]:[{type:`text`,text:r}]}):null}function K(e,t={}){return cn(e).map((e,n)=>{switch(e.type){case`bold`:return W(`strong`,{children:K(e.value,t)},n);case`italic`:return W(`em`,{children:K(e.value,t)},n);case`link`:return W(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[e.text,W(`span`,{class:`whoo-widget-sr-only`,lang:t.linkCueLang,children:[` `,t.linkCue??`(opens in new tab)`]})]},n);default:return e.value}})}function pn(e,t={}){let n=e.replace(/\r\n?/g,`
5
- `),r=fn(n);return r?r.map((e,n)=>e.type===`list`?W(`ul`,{class:`whoo-widget-list`,dir:dn(e.items.find(e=>dn(e))??``),children:e.items.map((e,n)=>W(`li`,{dir:dn(e),children:K(e,t)},n))},n):W(`span`,{children:K(e.text,t)},n)):K(n,t)}function mn(e){return[{value:``,label:e.selectReason},{value:`factual`,label:e.categoryFactual},{value:`incomplete`,label:e.categoryIncomplete},{value:`tone`,label:e.categoryTone},{value:`other`,label:e.categoryOther}]}function hn({state:e,containerRef:n,onThumbsUp:r,onThumbsDown:i,onDraftChange:a,onSubmitDetailed:o,onCancel:s,text:c=t,contentLanguage:l}){let u=e.correction??``,d=e.category??``,f=H(e.status),p=H(null),m=H(null);if(V(()=>{let t=f.current;if(f.current=e.status,t===e.status)return;if(e.status===`expanded`){p.current?.focus();return}if(t===`expanded`&&e.status===`idle`){m.current?.focus();return}let r=n?.current;if(!r)return;let i=r.getRootNode(),a=r.ownerDocument,o=i.activeElement;(o===null?a.activeElement===null||a.activeElement===a.body:o===a.body)&&r.focus()},[e.status,n]),e.status===`expanded`)return W(`div`,{class:`whoo-widget-feedback-form`,children:[W(`label`,{children:[W(`span`,{class:`whoo-widget-sr-only`,children:c.additionalFeedback}),W(`textarea`,{ref:p,class:`whoo-widget-feedback-textarea`,lang:l,value:u,onInput:e=>a(e.target.value,d),placeholder:c.feedbackPlaceholder})]}),W(`select`,{class:`whoo-widget-feedback-select`,"aria-label":c.feedbackCategory,value:d,onChange:e=>a(u,e.target.value),children:mn(c).map(e=>W(`option`,{value:e.value,children:e.label},e.value))}),W(`div`,{class:`whoo-widget-feedback-form-buttons`,children:[W(`button`,{type:`button`,class:`whoo-widget-feedback-submit`,onClick:()=>o(u,d),children:c.submit}),W(`button`,{type:`button`,class:`whoo-widget-feedback-cancel`,onClick:s,children:c.cancel})]})]});let h=e.status===`submitting`,g=e.status===`submitted`;return W(`div`,{class:`whoo-widget-feedback`,children:[g?null:W(`div`,{class:`whoo-widget-feedback-buttons`,children:[W(`button`,{type:`button`,"aria-label":c.goodResponse,"aria-disabled":h,onClick:()=>{h||r()},children:W(xt,{})}),W(`button`,{ref:m,type:`button`,"aria-label":c.badResponse,"aria-disabled":h,onClick:()=>{h||i()},children:W(St,{})})]}),W(`div`,{role:`status`,class:g?`whoo-widget-feedback-submitted`:e.status===`error`?`whoo-widget-feedback-error`:void 0,children:g?c.feedbackThanks:e.status===`error`?c.feedbackFailed:null})]})}function gn({isSlowResponse:e,text:t}){return W(`div`,{class:`whoo-widget-pending`,children:[W(`span`,{class:`whoo-widget-typing`,"aria-hidden":`true`,children:[W(`span`,{}),W(`span`,{}),W(`span`,{})]}),e?W(`span`,{class:`whoo-widget-pending-text`,children:t.lookingItUp}):null]})}function _n({url:e,alt:t,lang:n}){let[r,i]=rt(!1);return r?null:W(`img`,{class:`whoo-widget-empty-state-image`,src:e,alt:t,lang:n,referrerpolicy:`no-referrer`,onError:()=>i(!0)})}var vn=`whoo-widget-notice`;function yn({notice:e,placement:t=`top`,text:n,contentLanguage:r,languageTag:i}){return t===`footer`?W(`div`,{id:vn,class:`whoo-widget-notice-footer`,role:`note`,tabIndex:0,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:pn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})}):W(`div`,{id:vn,class:`whoo-widget-notice`,role:`note`,children:W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:pn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})})}function bn({message:e,speaker:t,feedbackState:n,showFeedback:r,pending:i,isSlowResponse:a,onThumbsUp:o,onThumbsDown:s,onDraftChange:c,onSubmitDetailed:l,onCancelFeedback:u,text:d,contentLanguage:f,languageTag:p}){let m=H(null),h=e.id;return W(`div`,{ref:m,tabIndex:-1,class:`whoo-widget-message whoo-widget-message--${e.role}`,children:[W(`span`,{class:`whoo-widget-sr-only`,children:[e.role===`assistant`?W(`span`,{lang:f,children:t}):t,`:`,` `]}),i?W(gn,{isSlowResponse:a,text:d}):W(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:f,children:pn(e.content,{linkCue:d.opensInNewTab,linkCueLang:p})}),r&&e.role===`assistant`&&h?W(hn,{state:n,containerRef:m,onThumbsUp:()=>o(h),onThumbsDown:()=>s(h),onDraftChange:(e,t)=>c(h,e,t),onSubmitDetailed:(e,t)=>l(h,e,t),onCancel:()=>u(h),text:d,contentLanguage:f}):null]})}function xn({messages:e,messageFeedback:n,announcement:r,emptyStateImage:i,centerEmptyState:a=!1,centeredGreeting:o,notice:s,agentName:c=u,showFeedback:l=!1,isStreaming:d=!1,isSlowResponse:f=!1,onThumbsUp:p,onThumbsDown:m,onDraftChange:h=()=>{},onSubmitDetailed:g,onCancelFeedback:_,text:v=t,contentLanguage:y,languageTag:b,announcementIsContent:x=!1}){let S=H(null),C=!!s&&!e.some(e=>e.role===`user`);at(()=>{let e=S.current;e&&(e.scrollTop=C?0:e.scrollHeight)},[e,f,C]);let w=i?W(_n,{...i,lang:y}):null,T=a&&e.length===0&&(i||o);return W(I,{children:[W(`section`,{class:`whoo-widget-message-list${T?` whoo-widget-message-list--centered`:``}`,ref:S,"aria-label":v.conversation,tabIndex:0,children:[a?null:w,s?W(yn,{notice:s,text:v,contentLanguage:y,languageTag:b}):null,T?W(`div`,{class:`whoo-widget-empty-state`,children:[w,o?W(`div`,{class:`whoo-widget-empty-state-greeting whoo-widget-message-text`,dir:`auto`,lang:y,children:pn(o,{linkCue:v.opensInNewTab,linkCueLang:b})}):null]}):null,e.map((t,r)=>W(bn,{message:t,speaker:t.role===`user`?v.you:c,showFeedback:l,feedbackState:t.id?n[t.id]??{status:`idle`}:{status:`idle`},pending:d&&r===e.length-1&&t.role===`assistant`&&t.content===``,isSlowResponse:f,onThumbsUp:p,onThumbsDown:m,onDraftChange:h,onSubmitDetailed:g,onCancelFeedback:_,text:v,contentLanguage:y,languageTag:b},t.id??r))]}),W(`div`,{class:`whoo-widget-sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,lang:x?y:b,children:r??``})]})}var Sn=`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`;function Cn(e){return Array.from(e.querySelectorAll(Sn)).filter(e=>{let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}function wn({state:e,controller:t,greeting:n}){let r=H(null),i=H(null),a=H(null),o=H(!1);V(()=>{(a.current??i.current)?.focus()},[]),V(()=>{e.noticeAgreed&&o.current&&(o.current=!1,i.current?.focus())},[e.noticeAgreed]),V(()=>{let e=r.current,n=e?Ut(e):()=>{},i=e?Xt(e):()=>{},a=()=>{e&&!e.open&&t.close()};e?.addEventListener(`close`,a);let o=Yt();return()=>{n(),i(),e?.removeEventListener(`close`,a),o()}},[]);let s=e=>{if(e.key===`Escape`&&!Zt(e)){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=r.current;if(!n)return;let i=Cn(n);if(i.length===0)return;let a=n.getRootNode().activeElement;e.preventDefault();let o=i.length-1,s,c=a?i.indexOf(a):-1;if(c!==-1)s=(c+(e.shiftKey?-1:1)+i.length)%i.length;else if(a&&a!==n&&n.contains(a)){let t=i.findIndex(e=>a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING);s=e.shiftKey?t<=0?o:t-1:t===-1?0:t}else s=e.shiftKey?o:0;i[s].focus()},c=()=>{let n=e.draft.trim();n&&!e.isStreaming&&(t.setDraft(``),t.sendMessage(n))},l=t.resolvedAgentName,u=d(t.config.title),{before:f,after:p,hasName:m}=Rt(t.text.chatWith),h=t.greetingStyle===`centered`,g=e.messages.length===0&&n&&!h?[{role:`assistant`,content:n,id:null}]:e.messages,_=e.messages.length===0&&h?n:void 0,v=t.notice!==``&&t.noticePlacement===`footer`,y=t.emptyStateImageUrl,b=e.messages.length===0&&y?{url:y,alt:t.emptyStateImageAlt}:void 0;return W(`dialog`,{open:!0,class:`whoo-widget-panel`,"aria-modal":`true`,"aria-labelledby":`whoo-widget-title`,"aria-describedby":t.notice&&e.noticeAgreed&&e.messages.length===0?vn:void 0,ref:r,onKeyDown:s,onCancel:e=>{e.preventDefault(),t.close()},children:[W(`div`,{class:`whoo-widget-header`,children:[W(`div`,{class:`whoo-widget-header-titles`,children:[u?W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,lang:t.contentLanguage,dir:`auto`,children:u}):W(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,children:[f,m?W(`bdi`,{lang:t.contentLanguage,children:l}):null,p]}),t.subtitle?W(`p`,{class:`whoo-widget-header-subtitle`,lang:t.contentLanguage,dir:`auto`,children:t.subtitle}):null]}),W(`div`,{class:`whoo-widget-header-actions`,children:[e.messages.length>0&&W(`button`,{type:`button`,class:`whoo-widget-header-reset`,onClick:()=>{t.resetConversation(),i.current?.focus()},children:t.text.newConversation}),W(`button`,{type:`button`,class:`whoo-widget-header-close`,"aria-label":t.text.closeChat,onClick:()=>t.close(),children:W(yt,{})})]})]}),W(xn,{messages:g,messageFeedback:e.messageFeedback,announcement:e.announcement,emptyStateImage:b,centerEmptyState:h,centeredGreeting:_,notice:v?void 0:t.notice,agentName:l,showFeedback:t.showFeedback,isStreaming:e.isStreaming,isSlowResponse:e.isSlowResponse,onThumbsUp:e=>t.submitFeedback(e,`up`),onThumbsDown:e=>t.expandFeedback(e),onDraftChange:(e,n,r)=>t.setFeedbackDraft(e,n,r),onSubmitDetailed:(e,n,r)=>t.submitFeedback(e,`down`,n||void 0,r||void 0),onCancelFeedback:e=>t.cancelFeedback(e),text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag,announcementIsContent:e.announcementIsContent}),e.runtimeError&&W($t,{message:e.runtimeError}),e.noticeAgreed?W(Qt,{value:e.draft,onChange:e=>t.setDraft(e),onSend:c,disabled:e.isStreaming,inputRef:i,text:t.text,contentLanguage:t.contentLanguage}):W(`div`,{class:`whoo-widget-agreement`,children:W(`button`,{type:`button`,class:`whoo-widget-agreement-button`,ref:a,"aria-describedby":vn,autoFocus:!0,onClick:()=>{o.current=!0,t.agreeToNotice()},children:t.text.agreeToNotice})}),v?W(yn,{notice:t.notice,placement:`footer`,text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag}):null]})}function Tn({controller:e}){let[t,n]=rt(e.getState()),r=H(null),i=H(t.isOpen);return at(()=>(n(e.getState()),e.subscribe(n)),[e]),V(()=>{i.current&&!t.isOpen&&r.current?.focus(),i.current=t.isOpen},[t.isOpen]),t.initError||t.isInitializing?null:W(I,{children:[W(Tt,{isOpen:t.isOpen,onClick:()=>t.isOpen?e.close():e.open(),iconUrl:e.launcher.iconUrl,icon:e.launcher.icon,openIconUrl:e.launcher.openIconUrl,openIcon:e.launcher.openIcon,buttonRef:r,text:e.text}),t.isOpen&&W(wn,{state:t,controller:e,greeting:e.config.greeting})]})}var En=class extends Error{status;constructor(e,t){super(e),this.name=`WidgetApiError`,this.status=t}};function Dn(e){if(typeof e!=`string`)return null;let t=e.trim();return t===``?null:t}async function On(e,t){let n=await fetch(`${e}/api/v1/widget/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publishable_key:t})});if(!n.ok)throw new En(`Failed to create widget session (${n.status})`,n.status);let r=await n.json();return{token:r.token,...kn(r)}}function kn(e){return{primaryColor:Dn(e.primary_color),name:Dn(e.name),accentColor:Dn(e.accent_color),inkColor:Dn(e.ink_color)}}async function An(e,t){let n=await fetch(`${e}/api/v1/widget/branding`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new En(`Failed to load widget branding (${n.status})`,n.status);return kn(await n.json())}async function jn(e,t,n){let r=await fetch(`${e}/api/v1/widget/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({message_id:n.messageId,rating:n.rating,correction:n.correction??null,category:n.category??null})});if(!r.ok)throw new En(`Feedback submission failed (${r.status})`,r.status)}async function*Mn(e,t,n,r,i){let a=await fetch(`${e}/api/v1/widget/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({conversation_id:n,message:r}),signal:i});if(!a.ok||!a.body)throw new En(`Chat request failed (${a.status})`,a.status);let o=a.body.getReader(),s=new TextDecoder,c=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;c+=s.decode(t,{stream:!0});let n=c.indexOf(`
4
+ `)){let e=t.match(dn);e?(i(),r.push(e[1])):(a(),n.push(t))}return i(),a(),t.some(e=>e.type===`list`)?t.flatMap((e,n)=>{if(e.type===`list`)return[e];let{text:r}=e;return t[n-1]?.type===`list`&&(r=r.replace(/^(?:[ \t]*\n)+/,``)),t[n+1]?.type===`list`&&(r=r.replace(/(?:\n[ \t]*)+$/,``)),r.trim()===``?[]:[{type:`text`,text:r}]}):null}function q(e,t={}){return un(e).map((e,n)=>{switch(e.type){case`bold`:return G(`strong`,{children:q(e.value,t)},n);case`italic`:return G(`em`,{children:q(e.value,t)},n);case`link`:return G(`a`,{href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:[e.text,G(`span`,{class:`whoo-widget-sr-only`,lang:t.linkCueLang,children:[` `,t.linkCue??`(opens in new tab)`]})]},n);default:return e.value}})}function hn(e,t={}){let n=e.replace(/\r\n?/g,`
5
+ `),r=mn(n);return r?r.map((e,n)=>e.type===`list`?G(`ul`,{class:`whoo-widget-list`,dir:pn(e.items.find(e=>pn(e))??``),children:e.items.map((e,n)=>G(`li`,{dir:pn(e),children:q(e,t)},n))},n):G(`span`,{children:q(e.text,t)},n)):q(n,t)}function gn(e){return[{value:``,label:e.selectReason},{value:`factual`,label:e.categoryFactual},{value:`incomplete`,label:e.categoryIncomplete},{value:`tone`,label:e.categoryTone},{value:`other`,label:e.categoryOther}]}function _n({state:e,containerRef:n,onThumbsUp:r,onThumbsDown:i,onDraftChange:a,onSubmitDetailed:o,onCancel:s,text:c=t,contentLanguage:l}){let u=e.correction??``,d=e.category??``,f=U(e.status),p=U(null),m=U(null);if(H(()=>{let t=f.current;if(f.current=e.status,t===e.status)return;if(e.status===`expanded`){p.current?.focus();return}if(t===`expanded`&&e.status===`idle`){m.current?.focus();return}let r=n?.current;if(!r)return;let i=r.getRootNode(),a=r.ownerDocument,o=i.activeElement;(o===null?a.activeElement===null||a.activeElement===a.body:o===a.body)&&r.focus()},[e.status,n]),e.status===`expanded`)return G(`div`,{class:`whoo-widget-feedback-form`,children:[G(`label`,{children:[G(`span`,{class:`whoo-widget-sr-only`,children:c.additionalFeedback}),G(`textarea`,{ref:p,class:`whoo-widget-feedback-textarea`,lang:l,value:u,onInput:e=>a(e.target.value,d),placeholder:c.feedbackPlaceholder})]}),G(`select`,{class:`whoo-widget-feedback-select`,"aria-label":c.feedbackCategory,value:d,onChange:e=>a(u,e.target.value),children:gn(c).map(e=>G(`option`,{value:e.value,children:e.label},e.value))}),G(`div`,{class:`whoo-widget-feedback-form-buttons`,children:[G(`button`,{type:`button`,class:`whoo-widget-feedback-submit`,onClick:()=>o(u,d),children:c.submit}),G(`button`,{type:`button`,class:`whoo-widget-feedback-cancel`,onClick:s,children:c.cancel})]})]});let h=e.status===`submitting`,g=e.status===`submitted`;return G(`div`,{class:`whoo-widget-feedback`,children:[g?null:G(`div`,{class:`whoo-widget-feedback-buttons`,children:[G(`button`,{type:`button`,"aria-label":c.goodResponse,"aria-disabled":h,onClick:()=>{h||r()},children:G(Ct,{})}),G(`button`,{ref:m,type:`button`,"aria-label":c.badResponse,"aria-disabled":h,onClick:()=>{h||i()},children:G(wt,{})})]}),G(`div`,{role:`status`,class:g?`whoo-widget-feedback-submitted`:e.status===`error`?`whoo-widget-feedback-error`:void 0,children:g?c.feedbackThanks:e.status===`error`?c.feedbackFailed:null})]})}function vn({isSlowResponse:e,text:t}){return G(`div`,{class:`whoo-widget-pending`,children:[G(`span`,{class:`whoo-widget-typing`,"aria-hidden":`true`,children:[G(`span`,{}),G(`span`,{}),G(`span`,{})]}),e?G(`span`,{class:`whoo-widget-pending-text`,children:t.lookingItUp}):null]})}function yn({url:e,alt:t,lang:n}){let[r,i]=it(!1);return r?null:G(`img`,{class:`whoo-widget-empty-state-image`,src:e,alt:t,lang:n,referrerpolicy:`no-referrer`,onError:()=>i(!0)})}var bn=`whoo-widget-notice`;function xn({notice:e,placement:t=`top`,text:n,contentLanguage:r,languageTag:i}){return t===`footer`?G(`div`,{id:bn,class:`whoo-widget-notice-footer`,role:`note`,tabIndex:0,children:G(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:hn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})}):G(`div`,{id:bn,class:`whoo-widget-notice`,role:`note`,children:G(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:r,children:hn(e,{linkCue:n.opensInNewTab,linkCueLang:i})})})}function Sn({message:e,speaker:t,feedbackState:n,showFeedback:r,pending:i,isSlowResponse:a,onThumbsUp:o,onThumbsDown:s,onDraftChange:c,onSubmitDetailed:l,onCancelFeedback:u,text:d,contentLanguage:f,languageTag:p}){let m=U(null),h=e.id;return G(`div`,{ref:m,tabIndex:-1,class:`whoo-widget-message whoo-widget-message--${e.role}`,children:[G(`span`,{class:`whoo-widget-sr-only`,children:[e.role===`assistant`?G(`span`,{lang:f,children:t}):t,`:`,` `]}),i?G(vn,{isSlowResponse:a,text:d}):G(`div`,{class:`whoo-widget-message-text`,dir:`auto`,lang:f,children:hn(e.content,{linkCue:d.opensInNewTab,linkCueLang:p})}),r&&e.role===`assistant`&&h?G(_n,{state:n,containerRef:m,onThumbsUp:()=>o(h),onThumbsDown:()=>s(h),onDraftChange:(e,t)=>c(h,e,t),onSubmitDetailed:(e,t)=>l(h,e,t),onCancel:()=>u(h),text:d,contentLanguage:f}):null]})}function Cn({messages:e,messageFeedback:n,announcement:r,emptyStateImage:i,centerEmptyState:a=!1,centeredGreeting:o,notice:s,agentName:c=u,showFeedback:l=!1,isStreaming:d=!1,isSlowResponse:f=!1,onThumbsUp:p,onThumbsDown:m,onDraftChange:h=()=>{},onSubmitDetailed:g,onCancelFeedback:_,text:v=t,contentLanguage:y,languageTag:b,announcementIsContent:x=!1}){let S=U(null),C=!!s&&!e.some(e=>e.role===`user`);ot(()=>{let e=S.current;e&&(e.scrollTop=C?0:e.scrollHeight)},[e,f,C]);let w=i?G(yn,{...i,lang:y}):null,T=a&&e.length===0&&(i||o);return G(L,{children:[G(`section`,{class:`whoo-widget-message-list${T?` whoo-widget-message-list--centered`:``}`,ref:S,"aria-label":v.conversation,tabIndex:0,children:[a?null:w,s?G(xn,{notice:s,text:v,contentLanguage:y,languageTag:b}):null,T?G(`div`,{class:`whoo-widget-empty-state`,children:[w,o?G(`div`,{class:`whoo-widget-empty-state-greeting whoo-widget-message-text`,dir:`auto`,lang:y,children:hn(o,{linkCue:v.opensInNewTab,linkCueLang:b})}):null]}):null,e.map((t,r)=>G(Sn,{message:t,speaker:t.role===`user`?v.you:c,showFeedback:l,feedbackState:t.id?n[t.id]??{status:`idle`}:{status:`idle`},pending:d&&r===e.length-1&&t.role===`assistant`&&t.content===``,isSlowResponse:f,onThumbsUp:p,onThumbsDown:m,onDraftChange:h,onSubmitDetailed:g,onCancelFeedback:_,text:v,contentLanguage:y,languageTag:b},t.id??r))]}),G(`div`,{class:`whoo-widget-sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,lang:x?y:b,children:r??``})]})}var wn=`button:not(:disabled), [href], input:not(:disabled), select:not(:disabled), textarea:not(:disabled), [tabindex]:not([tabindex="-1"])`;function Tn(e){return Array.from(e.querySelectorAll(wn)).filter(e=>{let t=getComputedStyle(e);return t.display!==`none`&&t.visibility!==`hidden`})}function En({state:e,controller:t,greeting:n}){let r=U(null),i=U(null),a=U(null),o=U(!1);H(()=>{(a.current??i.current)?.focus()},[]),H(()=>{e.noticeAgreed&&o.current&&(o.current=!1,i.current?.focus())},[e.noticeAgreed]),H(()=>{let e=r.current,n=e?Gt(e):()=>{},i=e?Qt(e):()=>{},a=()=>{e&&!e.open&&t.close()};e?.addEventListener(`close`,a);let o=Zt();return()=>{n(),i(),e?.removeEventListener(`close`,a),o()}},[]);let s=e=>{if(e.key===`Escape`&&!$t(e)){e.preventDefault(),t.close();return}if(e.key!==`Tab`)return;let n=r.current;if(!n)return;let i=Tn(n);if(i.length===0)return;let a=n.getRootNode().activeElement;e.preventDefault();let o=i.length-1,s,c=a?i.indexOf(a):-1;if(c!==-1)s=(c+(e.shiftKey?-1:1)+i.length)%i.length;else if(a&&a!==n&&n.contains(a)){let t=i.findIndex(e=>a.compareDocumentPosition(e)&Node.DOCUMENT_POSITION_FOLLOWING);s=e.shiftKey?t<=0?o:t-1:t===-1?0:t}else s=e.shiftKey?o:0;i[s].focus()},c=()=>{let n=e.draft.trim();n&&!e.isStreaming&&(t.setDraft(``),t.sendMessage(n))},l=t.resolvedAgentName,u=d(t.config.title),{before:f,after:p,hasName:m}=Bt(t.text.chatWith),h=t.greetingStyle===`centered`,g=e.messages.length===0&&n&&!h?[{role:`assistant`,content:n,id:null}]:e.messages,_=e.messages.length===0&&h?n:void 0,v=t.notice!==``&&t.noticePlacement===`footer`,y=t.emptyStateImageUrl,b=e.messages.length===0&&y?{url:y,alt:t.emptyStateImageAlt}:void 0;return G(`dialog`,{open:!0,class:`whoo-widget-panel`,"aria-modal":`true`,"aria-labelledby":`whoo-widget-title`,"aria-describedby":t.notice&&e.noticeAgreed&&e.messages.length===0?bn:void 0,ref:r,onKeyDown:s,onCancel:e=>{e.preventDefault(),t.close()},children:[G(`div`,{class:`whoo-widget-header`,children:[G(`div`,{class:`whoo-widget-header-titles`,children:[u?G(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,lang:t.contentLanguage,dir:`auto`,children:u}):G(`h2`,{id:`whoo-widget-title`,class:`whoo-widget-header-title`,children:[f,m?G(`bdi`,{lang:t.contentLanguage,children:l}):null,p]}),t.subtitle?G(`p`,{class:`whoo-widget-header-subtitle`,lang:t.contentLanguage,dir:`auto`,children:t.subtitle}):null]}),G(`div`,{class:`whoo-widget-header-actions`,children:[e.messages.length>0&&G(`button`,{type:`button`,class:`whoo-widget-header-reset`,onClick:()=>{t.resetConversation(),i.current?.focus()},children:t.text.newConversation}),G(`button`,{type:`button`,class:`whoo-widget-header-close`,"aria-label":t.text.closeChat,onClick:()=>t.close(),children:G(xt,{})})]})]}),G(Cn,{messages:g,messageFeedback:e.messageFeedback,announcement:e.announcement,emptyStateImage:b,centerEmptyState:h,centeredGreeting:_,notice:v?void 0:t.notice,agentName:l,showFeedback:t.showFeedback,isStreaming:e.isStreaming,isSlowResponse:e.isSlowResponse,onThumbsUp:e=>t.submitFeedback(e,`up`),onThumbsDown:e=>t.expandFeedback(e),onDraftChange:(e,n,r)=>t.setFeedbackDraft(e,n,r),onSubmitDetailed:(e,n,r)=>t.submitFeedback(e,`down`,n||void 0,r||void 0),onCancelFeedback:e=>t.cancelFeedback(e),text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag,announcementIsContent:e.announcementIsContent}),e.runtimeError&&G(tn,{message:e.runtimeError}),e.noticeAgreed?G(en,{value:e.draft,onChange:e=>t.setDraft(e),onSend:c,disabled:e.isStreaming,inputRef:i,text:t.text,contentLanguage:t.contentLanguage}):G(`div`,{class:`whoo-widget-agreement`,children:G(`button`,{type:`button`,class:`whoo-widget-agreement-button`,ref:a,"aria-describedby":bn,autoFocus:!0,onClick:()=>{o.current=!0,t.agreeToNotice()},children:t.text.agreeToNotice})}),v?G(xn,{notice:t.notice,placement:`footer`,text:t.text,contentLanguage:t.contentLanguage,languageTag:t.languageTag}):null]})}function Dn({controller:e}){let[t,n]=it(e.getState()),r=U(null),i=U(t.isOpen);return ot(()=>(n(e.getState()),e.subscribe(n)),[e]),H(()=>{i.current&&!t.isOpen&&r.current?.focus(),i.current=t.isOpen},[t.isOpen]),t.initError||t.isInitializing?null:G(L,{children:[G(Dt,{isOpen:t.isOpen,onClick:()=>t.isOpen?e.close():e.open(),iconUrl:e.launcher.iconUrl,icon:e.launcher.icon,openIconUrl:e.launcher.openIconUrl,openIcon:e.launcher.openIcon,buttonRef:r,text:e.text}),t.isOpen&&G(En,{state:t,controller:e,greeting:e.config.greeting})]})}var On=class extends Error{status;code;constructor(e,t,n){super(e),this.name=`WidgetApiError`,this.status=t,this.code=n}};function kn(e){if(typeof e!=`string`)return null;let t=e.trim();return t===``?null:t}async function An(e,t){let n=await fetch(`${e}/api/v1/widget/session`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({publishable_key:t})});if(!n.ok)throw new On(`Failed to create widget session (${n.status})`,n.status);let r=await n.json();return{token:r.token,...jn(r)}}function jn(e){return{primaryColor:kn(e.primary_color),name:kn(e.name),accentColor:kn(e.accent_color),inkColor:kn(e.ink_color)}}async function Mn(e,t){let n=await fetch(`${e}/api/v1/widget/branding`,{headers:{Authorization:`Bearer ${t}`}});if(!n.ok)throw new On(`Failed to load widget branding (${n.status})`,n.status);return jn(await n.json())}async function Nn(e,t,n){let r=await fetch(`${e}/api/v1/widget/feedback`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({message_id:n.messageId,rating:n.rating,correction:n.correction??null,category:n.category??null})});if(!r.ok)throw new On(`Feedback submission failed (${r.status})`,r.status)}async function*Pn(e,t,n,r,i){let a=await fetch(`${e}/api/v1/widget/chat`,{method:`POST`,headers:{"Content-Type":`application/json`,Authorization:`Bearer ${t}`},body:JSON.stringify({conversation_id:n,message:r}),signal:i});if(!a.ok||!a.body)throw new On(`Chat request failed (${a.status})`,a.status,a.status===429?await In(a):void 0);let o=a.body.getReader(),s=new TextDecoder,c=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;c+=s.decode(t,{stream:!0});let n=c.indexOf(`
6
6
 
7
7
  `);for(;n!==-1;){let e=c.slice(0,n);c=c.slice(n+2);let t=e.split(`
8
- `).find(e=>e.startsWith(`data: `));if(i?.aborted)return;t&&(yield Nn(JSON.parse(t.slice(6)))),n=c.indexOf(`
8
+ `).find(e=>e.startsWith(`data: `));if(i?.aborted)return;t&&(yield Fn(JSON.parse(t.slice(6)))),n=c.indexOf(`
9
9
 
10
- `)}}}function Nn(e){return typeof e.error==`string`?{type:`error`,error:e.error,conversationId:e.conversation_id}:e.done===!0?{type:`done`,conversationId:e.conversation_id,messageId:e.message_id??null}:typeof e.delta==`string`?e.verbatim===!0?{type:`delta`,delta:e.delta,verbatim:!0}:{type:`delta`,delta:e.delta}:{type:`conversation_id`,conversationId:e.conversation_id}}function Pn(e){return cn(e.replace(/\r\n?/g,`
11
- `)).map(e=>{switch(e.type){case`bold`:case`italic`:return Pn(e.value);case`link`:return e.text;default:return e.value}}).join(``)}var Fn=40,In=120;function Ln(e){let t=[];for(let n of cn(e))if(n.type===`text`){let e=n.value.split(/(\s+)/),r=n.start;for(let n of e)r+=n.length,n.trim().length>0&&t.push(r)}else t.push(n.end);return t}function Rn(e){let t=null;return e?.addEventListener(`abort`,()=>{t?.()},{once:!0}),function(e){return new Promise(n=>{let r=setTimeout(()=>{t=null,n()},e);t=()=>{clearTimeout(r),t=null,n()}})}}async function zn(e,t,n){let r=n?.wordIntervalMs??Fn,i=n?.tokenIntervalMs??In,a=n?.signal,o=cn(e),s=new Set(o.filter(e=>e.type!==`text`).map(e=>e.end)),c=Rn(a),l=``;for(let n of Ln(e))if(a?.aborted||(l=e.slice(0,n),t(l),await c(s.has(n)?i:r),a?.aborted))return;l!==e&&t(e)}function Bn(e){let t=e.split(`.`);if(t.length!==3||t.some(e=>e===``))return null;let n=t[1];try{let e=n.replace(/-/g,`+`).replace(/_/g,`/`),t=JSON.parse(atob(e.padEnd(Math.ceil(e.length/4)*4,`=`))),r=e=>typeof e==`number`&&Number.isFinite(e)?e:null,{exp:i,iat:a}=t??{};return{exp:r(i),iat:r(a)}}catch{return null}}function Vn(e){let t=Bn(e)?.exp;return typeof t==`number`?t*1e3:null}function Hn(e,t=Date.now()){let n=Vn(e);return n!==null&&n<=t}function Un(e,t=Date.now()){let n=Bn(e);return n?.exp==null?null:n.iat!=null&&n.exp>n.iat?t+(n.exp-n.iat)*1e3:n.exp*1e3}function Wn(e){return`whoo-aiden-widget:conversation:${e}`}function Gn(e){try{return window.sessionStorage.getItem(Wn(e))}catch{return null}}function Kn(e,t){try{window.sessionStorage.setItem(Wn(e),t)}catch{}}function qn(e){return`whoo-aiden-widget:notice-agreed:${e}`}function Jn(e,t){try{return window.sessionStorage.getItem(qn(e))===t}catch{return!1}}function Yn(e,t){try{window.sessionStorage.setItem(qn(e),t)}catch{}}function Xn(e){try{window.sessionStorage.removeItem(Wn(e))}catch{}}var Zn=/^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;function Qn(e){if(Zn.test(e.trim()))return null;let t=document.createElement(`div`);if(t.style.color=e,t.style.color===``)return null;let n=document.createElement(`div`);n.attachShadow({mode:`open`}).appendChild(t),document.body.appendChild(n);let r=getComputedStyle(t).color;n.remove();let i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);if(!i)return null;let a=i[4]===void 0?1:Number(i[4]);return{rgb:[Number(i[1]),Number(i[2]),Number(i[3])].map(e=>Math.round(e*a+255*(1-a))),translucent:a<1}}function q(e){return Qn(e)?.rgb??null}function J([e,t,n]){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function $n(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function er(e){let t=q(e);if(!t)return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`),`#ffffff`;let n=J(t);return $n(n,J([0,0,0]))>=$n(n,J([255,255,255]))?`#000000`:`#ffffff`}function tr(e,t){let n=q(e),r=q(t);return!n||!r?NaN:$n(J(n),J(r))}var Y=a.primary,nr=a.panel,rr=a.assistantBubble,ir=a.headerHover,ar=4.5;function or([e,t,n]){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function sr(e,t=nr){let n=q(e),r=q(t);if(!n||!r)return Y;let i=J(r),a=e=>$n(J(e),i)>=ar;if(a(n))return or(n);for(let e=.99;e>0;e-=.01){let t=n.map(t=>Math.round(t*e));if(a(t))return or(t)}return`#000000`}var cr=a.ink,lr=a.link;function X(e){if(typeof e!=`string`||!e)return null;let t=Qn(e);return t?or(t.rgb):null}function ur(e){if(typeof e!=`string`||!e)return null;let t=Qn(e);return t?t.translucent?e.trim():or(t.rgb):null}var dr=[{role:`onPrimary`,against:[`primary`],required:4.5},{role:`primaryText`,against:[`panel`,`headerHover`],required:4.5},{role:`ink`,against:[`assistantBubble`,`panel`],required:4.5},{role:`link`,against:[`assistantBubble`,`panel`],required:4.5},{role:`muted`,against:[`assistantBubble`,`panel`],required:4.5},{role:`text`,against:[`panel`,`assistantBubble`],required:4.5},{role:`errorText`,against:[`errorBackground`],required:4.5},{role:`typingDots`,against:[`assistantBubble`],required:3},{role:`inputBorder`,against:[`panel`],required:3},{role:`focusRing`,against:[`panel`],required:3}];function fr({color:e,inkColor:t,accentColor:n,overrides:r}){let o=typeof r==`object`&&r&&!Array.isArray(r)?r:{},s=e=>ur(o[e]),c=X(e),l=s(`primary`),u=l??c??Y,d=s(`primaryText`),f=d??sr(u,ir),p=s(`onPrimary`)??er(u),m=X(t),h=s(`ink`)??(m?sr(m,rr):cr),g=X(n),_=s(`link`)??(g?sr(g,rr):lr),v=e=>s(e)??a[e],y={primary:u,onPrimary:p,primaryText:f,ink:h,link:_,text:v(`text`),panel:v(`panel`),border:v(`border`),headerHover:v(`headerHover`),assistantBubble:v(`assistantBubble`),muted:v(`muted`),typingDots:v(`typingDots`),errorBackground:v(`errorBackground`),errorText:v(`errorText`),inputBorder:v(`inputBorder`),focusRing:v(`focusRing`)},b=Object.fromEntries(i.map(e=>[e,s(e)!==null])),x=[];for(let{role:e,against:t,required:n}of dr)for(let r of t){if(!b[e]&&!b[r])continue;let t=tr(y[e],y[r]);Number.isFinite(t)&&t<n&&x.push({role:e,against:r,value:y[e],ratio:t,required:n,overridden:b[e]})}return{primary:u,textOnPrimary:p,primaryAsText:f,ink:h,link:_,adjusted:{primary:l===null&&d===null&&c!==null&&f!==u,ink:!b.ink&&m!==null&&h!==m,link:!b.link&&g!==null&&_!==g},roles:y,overridden:b,contrastWarnings:x}}function Z(e){return typeof e==`string`?`"${e}"`:`a ${typeof e} value`}function pr(e,t,n=Y){let r=t;X(t)===null&&(console.warn(`[whoo-aiden-widget] Could not use ${Z(t)} as the theme color; falling back to ${Z(n)}.`),r=n);let i=fr({color:r});e.style.setProperty(`--whoo-widget-color`,i.primary),e.style.setProperty(`--whoo-widget-text-on-color`,i.textOnPrimary),e.style.setProperty(`--whoo-widget-color-text`,i.primaryAsText)}function mr(e,{inkColor:t,accentColor:n}){let r=fr({inkColor:t,accentColor:n});e.style.setProperty(`--whoo-widget-ink`,r.ink),e.style.setProperty(`--whoo-widget-link-color`,r.link)}function hr(e,t){let n=fr({overrides:t});for(let t of i){let r=n.overridden.primary&&(t===`onPrimary`||t===`primaryText`);(n.overridden[t]||r)&&e.style.setProperty(o[t],n.roles[t])}}function gr(e,t){e&&X(e)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(e)} as the ${t}; using the default.`)}function _r(e,t,n){for(let e of i){let n=t[e];n&&X(n)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(n)} as theme.colors.${e}; using the calculated color.`)}let r=t.primary;typeof r==`string`&&Qn(r)?.translucent&&console.warn(`[whoo-aiden-widget] theme.colors.primary ${Z(r)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`),vr({color:e.color,inkColor:e.inkColor,accentColor:e.accentColor,overrides:t},n)}function vr(e,t){for(let n of fr(e).contrastWarnings){let{role:e,against:r,value:i,ratio:a,required:o,overridden:s}=n,c=`${e}|${r}|${i}`;t.has(c)||(t.add(c),console.warn(s?`[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.`:`[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`))}}function yr(e,t,n=new Set){pr(e,t.color??Y),gr(t.inkColor,`ink color`),gr(t.accentColor,`accent color`),mr(e,{inkColor:t.inkColor,accentColor:t.accentColor});let r=oe(t.theme);_r(t,r.colors,n),hr(e,r.colors),r.fontFamily&&e.style.setProperty(`--whoo-widget-font`,r.fontFamily)}var br=8e3,xr=3e3,Sr=15e3,Cr=class extends Error{name=`SessionUnavailableError`};function wr(e,t){return t?new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));if(t.aborted)return i();t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})}):e}function Tr(e,t){return e===`refused`?new Q(t):new Cr}function Er(e){let t=e?.status;return t===401||t===403||t===404}var Q=class extends Error{name=`SessionExpiredError`;constructor(e){super(e instanceof Error?e.message:`The session has expired.`)}};function Dr(e){return e?.status===401}function Or(e,t){return new Promise(n=>{let r=setTimeout(n,t);e.then(()=>{clearTimeout(r),n()})})}var kr=class{config;state;listeners=new Set;sessionToken=null;sessionTokenExpiresAt=null;tokenRenewal=null;renewalGeneration=0;sendEpoch=0;getSessionToken;conversationId=null;storageIdentifier;activeRequestController=null;slowResponseTimer=null;announcementTimer=null;prefersReducedMotion;launcher;launcherIconUrl;emptyStateImageUrl;emptyStateImageAlt;notice;requireNoticeAgreement;noticePlacement;subtitle;greetingStyle;showFeedback;text;language;languageTag;contentLanguage;dir;constructor(e){this.config=e;let t=oe(e.theme).launcher,n=t.iconUrl??r(e.launcherIconUrl,`launcherIconUrl`);this.launcher={...t,...n?{iconUrl:n}:{}},this.launcherIconUrl=n,this.emptyStateImageUrl=r(e.emptyStateImageUrl,`emptyStateImageUrl`),this.emptyStateImageAlt=typeof e.emptyStateImageAlt==`string`?e.emptyStateImageAlt.trim():``,this.notice=typeof e.notice==`string`&&!f(e.notice)?e.notice.trim():``,this.requireNoticeAgreement=e.requireNoticeAgreement===!0&&this.notice!==``,e.requireNoticeAgreement===!0&&!this.notice&&console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."),this.noticePlacement=A(e.noticePlacement),this.subtitle=typeof e.subtitle==`string`&&!f(e.subtitle)?e.subtitle.trim():``,this.greetingStyle=k(e.greetingStyle),this.showFeedback=e.showFeedback===!0,this.storageIdentifier=e.publishableKey??`session-token-mode`,this.getSessionToken=h(e);let{language:i,tag:a,dir:o}=Pt(e.language,typeof document>`u`?void 0:document.documentElement.lang);this.language=i,this.languageTag=a,this.dir=o,this.contentLanguage=Lt(e.contentLanguage,typeof document>`u`?void 0:document.documentElement.lang,e.language),this.text={...Mt(i),...x(e.messages)},this.prefersReducedMotion=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.state={isOpen:!1,messages:[],isStreaming:!1,initError:null,isInitializing:!1,runtimeError:null,messageFeedback:{},primaryColor:null,agentName:null,accentColor:null,inkColor:null,announcement:null,announcementIsContent:!1,isSlowResponse:!1,noticeAgreed:!this.requireNoticeAgreement||Jn(this.storageIdentifier,this.notice),draft:``}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get resolvedAgentName(){return d(this.config.name)||this.state.agentName||`Aiden`}announce(e,t=!1,n=!1){this.announcementTimer!==null&&(clearTimeout(this.announcementTimer),this.announcementTimer=null),n&&e!==null&&this.state.announcement!==e?this.setState({announcement:e,announcementIsContent:t}):(this.state.announcement!==null&&this.setState({announcement:null}),e!==null&&(this.announcementTimer=setTimeout(()=>{this.announcementTimer=null,this.setState({announcement:e,announcementIsContent:t})},250)))}clearSlowResponse(){this.slowResponseTimer!==null&&(clearTimeout(this.slowResponseTimer),this.slowResponseTimer=null),this.state.isSlowResponse&&this.setState({isSlowResponse:!1})}setState(e){this.state={...this.state,...e};for(let e of this.listeners)e(this.state)}async init(){this.setState({isInitializing:!0});try{await this.start()}finally{this.setState({isInitializing:!1})}}async start(){let e=this.config.apiBaseUrl??`https://api.aidenvoice.com`;try{if(this.config.sessionToken){if(Hn(this.config.sessionToken)){if(!(`token`in await this.renewToken()))throw Error(`The sessionToken has expired.`)}else this.sessionToken=this.config.sessionToken,this.sessionTokenExpiresAt=Vn(this.config.sessionToken)}else if(this.config.publishableKey){let{token:t,primaryColor:n,name:r,accentColor:i,inkColor:a}=await On(e,this.config.publishableKey);this.sessionToken=t,this.sessionTokenExpiresAt=Un(t),this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}else throw Error(`WidgetConfig must include exactly one of publishableKey or sessionToken`)}catch(e){console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)});return}this.conversationId=Gn(this.storageIdentifier),this.config.sessionToken&&await Or(this.loadBranding(e),xr)}async loadBranding(e){try{let t=this.config;if(X(t.color)&&X(t.inkColor)&&X(t.accentColor)&&d(t.name))return;let{primaryColor:n,name:r,accentColor:i,inkColor:a}=await this.withSession(t=>An(e,t));this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}catch(e){let t=e?.status;(e instanceof Q||t===401||t===403)&&(this.state.isInitializing?(console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)})):(console.error(`[whoo-aiden-widget] the session was refused after start-up:`,e),this.setState({runtimeError:this.text.sessionExpired})))}}open(){this.setState({isOpen:!0})}resetConversation(){this.sendEpoch+=1,this.activeRequestController?.abort(`reset`),this.activeRequestController=null,this.clearSlowResponse(),this.conversationId=null,Xn(this.storageIdentifier),this.setState({messages:[],messageFeedback:{},runtimeError:null,isStreaming:!1}),this.announce(this.text.conversationCleared)}agreeToNotice(){this.state.noticeAgreed||(Yn(this.storageIdentifier,this.notice),this.setState({noticeAgreed:!0}))}setDraft(e){this.setState({draft:e})}close(){this.activeRequestController?.abort(`close`),this.activeRequestController=null,this.clearSlowResponse(),this.announce(null),this.setState({isOpen:!1})}async sendMessage(e){if(!this.sessionToken||!this.state.noticeAgreed)return;let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.sendEpoch+=1;let n=this.sendEpoch,r=()=>n===this.sendEpoch,i={role:`user`,content:e,id:null},a={role:`assistant`,content:``,id:null};this.setState({messages:[...this.state.messages,i,a],isStreaming:!0,runtimeError:null}),this.announce(zt(this.text.messageSent,{name:this.resolvedAgentName}),!1,!0);let o=a,s=e=>{let t=o;o={...o,...e},this.setState({messages:this.state.messages.map(e=>e===t?o:e)})},c=e=>s({content:e}),l=new AbortController;this.activeRequestController=l;let{signal:u}=l,d=!1;this.slowResponseTimer=setTimeout(()=>{this.slowResponseTimer=null,this.setState({isSlowResponse:!0}),r()&&this.announce(this.text.lookingItUp)},br);let f=!1,p=()=>{this.state.draft===``&&(f=!0,this.setState({draft:e}))},m=!1,h=e=>{m=!0,this.announce(Pn(e),!0)},g=(e=this.text.genericError)=>{r()&&(m||(m=!0,this.announce(null)),this.setState({runtimeError:e}),p())},_=``;try{let{stream:n,first:i}=await this.withSession(async n=>{d=!0;let r=Mn(t,n,this.conversationId,e,u);return{stream:r,first:await r.next()}},u);for(let e=i;!e.done&&!u.aborted&&r();e=await n.next()){let t=e.value;if(t.type===`conversation_id`)this.conversationId=t.conversationId,Kn(this.storageIdentifier,t.conversationId);else if(t.type===`delta`)this.clearSlowResponse(),t.verbatim&&!this.prefersReducedMotion?(await zn(t.delta,e=>c(e),{signal:u}),_=t.delta):t.verbatim?(_=t.delta,c(_)):(_+=t.delta,c(_));else if(t.type===`done`)t.conversationId&&(this.conversationId=t.conversationId,Kn(this.storageIdentifier,t.conversationId)),t.messageId&&s({id:t.messageId}),r()&&h(_);else if(t.type===`error`){console.error(`[whoo-aiden-widget] chat error:`,t.error),_.trim()!==``&&r()&&h(_),g(),l.abort();break}}}catch(e){u.aborted?u.reason===`close`&&r()&&!d&&p():e instanceof Q?(console.error(`[whoo-aiden-widget] chat request failed: the session has expired.`,e),g(this.text.sessionExpired)):e instanceof Cr?(console.error(`[whoo-aiden-widget] chat request failed: no session could be had.`),g()):(console.error(`[whoo-aiden-widget] chat request failed:`,e),g())}finally{let e=o.id===null&&o.content.trim()===``,t=this.state.messages.filter(t=>!(e&&t===o)&&!(e&&f&&t===i)),n=t.length!==this.state.messages.length;r()?(this.activeRequestController=null,this.clearSlowResponse(),m||(!u.aborted&&_.trim()!==``?h(_):this.announce(null)),this.setState({isStreaming:!1,...n?{messages:t}:{}})):n&&this.setState({messages:t})}}expandFeedback(e){let{correction:t,category:n}=this.state.messageFeedback[e]??{};this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`expanded`,correction:t,category:n}}})}setFeedbackDraft(e,t,n){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{...this.state.messageFeedback[e],correction:t,category:n}}})}cancelFeedback(e){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`idle`}}})}async submitFeedback(e,t,n,r){if(!this.sessionToken)return;let i=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitting`,rating:t}}});try{await this.withSession(a=>jn(i,a,{messageId:e,rating:t,correction:n,category:r})),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitted`,rating:t}}})}catch(i){console.error(`[whoo-aiden-widget] feedback submission failed:`,i),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`error`,rating:t,correction:n,category:r}}})}}async currentToken(e){let t=this.sessionToken,n=this.sessionTokenExpiresAt;return t&&(n===null||n-Date.now()>6e4)?{token:t}:wr(this.renewToken(),e)}renewToken(){return this.tokenRenewal??=this.fetchNewToken().finally(()=>{this.tokenRenewal=null}),this.tokenRenewal}async fetchNewToken(){let e=++this.renewalGeneration,t,n=new Promise(e=>{t=setTimeout(()=>{console.error(`[whoo-aiden-widget] could not renew the session: it took too long.`),e({failure:`unavailable`})},Sr)});try{return await Promise.race([this.obtainToken(e),n])}finally{clearTimeout(t)}}async obtainToken(e){let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`,n;try{if(this.config.publishableKey)n=(await On(t,this.config.publishableKey)).token;else if(this.getSessionToken)n=await this.getSessionToken();else return{failure:`refused`}}catch(e){return console.error(`[whoo-aiden-widget] could not renew the session:`,e),{failure:this.config.publishableKey&&Er(e)?`refused`:`unavailable`}}let r=typeof n==`string`?Un(n):null;return typeof n!=`string`||n===``||r!==null&&r<=Date.now()?(console.error(`[whoo-aiden-widget] could not renew the session: no usable token was returned.`),{failure:`refused`}):(e===this.renewalGeneration&&(this.sessionToken=n,this.sessionTokenExpiresAt=r),{token:n})}async withSession(e,t){let n=await this.currentToken(t);if(!(`token`in n))throw Tr(n.failure);let{token:r}=n;try{return await e(r)}catch(n){if(!Dr(n))throw n;let i=this.sessionToken&&this.sessionToken!==r?{token:this.sessionToken}:await wr(this.renewToken(),t);if(!(`token`in i))throw Tr(i.failure,n);try{return await e(i.token)}catch(e){throw Dr(e)?new Q(e):e}}}},$=20,Ar=12,jr=300,Mr=352;function Nr(){try{return typeof CSS<`u`&&CSS.supports?.(`height`,`100dvh`)?`dvh`:`vh`}catch{return`vh`}}function Pr(e,t){let{offsetX:n,offsetY:r,launcherSize:i,panelWidth:a,panelHeight:o,cornerRadius:s}=le(t.layout),c=e=>typeof t.layout?.offset?.[e]==`number`;if(typeof window<`u`&&window.innerWidth>0&&window.innerHeight>0){let e=Math.max($,window.innerWidth-jr),t=Math.max($,window.innerHeight-i-Mr);c(`x`)&&(n>e||n>window.innerWidth-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`),c(`y`)&&(r>t||r>window.innerHeight-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`)}let l=`100${Nr()}`,u=`min(${n}px, max(${$}px, calc(100vw - ${jr}px)), calc(100vw - ${i}px))`,d=`min(${r}px, max(${$}px, calc(${l} - ${i+Mr}px)), calc(${l} - ${i}px))`,f=`calc(${d} + ${i}px + ${Ar}px)`,p=t.position===`bottom-left`,m=(t,n)=>e.style.setProperty(t,n);m(`--whoo-widget-inset-left`,p?u:`auto`),m(`--whoo-widget-inset-right`,p?`auto`:u),m(`--whoo-widget-inset-bottom`,d),m(`--whoo-widget-launcher-size`,`${i}px`),m(`--whoo-widget-panel-bottom`,f),m(`--whoo-widget-panel-width`,`${a}px`),m(`--whoo-widget-panel-height`,`${o}px`),m(`--whoo-widget-panel-max-width`,`calc(100vw - ${u} - ${$}px)`),m(`--whoo-widget-panel-max-height`,`calc(${l} - ${f} - ${$}px)`),s===void 0?e.style.removeProperty(`--whoo-widget-corner-radius`):m(`--whoo-widget-corner-radius`,`${s}px`)}var Fr=`:host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start:auto;display:flex;position:sticky;bottom:0}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:var(--whoo-widget-typing-dots,#6b7280);border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:var(--whoo-widget-muted,#4b5563);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#991b1b);font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}`;function Ir(e){let t=document.createElement(`div`);t.id=`whoo-aiden-widget-host`,t.style.position=`relative`,t.style.zIndex=String(l(e.zIndex));let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Fr,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=new Set;yr(i,e,a),Pr(i,e);let o=new kr(e);i.setAttribute(`lang`,o.languageTag),i.setAttribute(`dir`,o.dir);let s=X(e.color)!==null,c=null,u=``,d=oe(e.theme).colors,f=Object.keys(d).length>0,p={color:e.color,inkColor:e.inkColor,accentColor:e.accentColor};return o.subscribe(t=>{let n=!1;!s&&t.primaryColor&&t.primaryColor!==c&&(c=t.primaryColor,pr(i,t.primaryColor,e.color),X(t.primaryColor)&&(p={...p,color:t.primaryColor}),n=!0);let r=`${t.inkColor}|${t.accentColor}`;if((t.inkColor||t.accentColor)&&r!==u){u=r;let a=X(e.inkColor)?e.inkColor:t.inkColor,o=X(e.accentColor)?e.accentColor:t.accentColor;mr(i,{inkColor:a,accentColor:o}),p={...p,inkColor:a,accentColor:o},n=!0}n&&(hr(i,d),f&&vr({...p,overrides:d},a))}),o.init(),Ue(W(Tn,{controller:o}),i),document.body.appendChild(t),{unmount(){Ue(null,i),t.remove()}}}function Lr(e){return p(e),Ir(e)}return e.init=Lr,e})({});
10
+ `)}}}function Fn(e){return typeof e.error==`string`?{type:`error`,error:e.error,conversationId:e.conversation_id}:e.done===!0?{type:`done`,conversationId:e.conversation_id,messageId:e.message_id??null}:typeof e.delta==`string`?e.verbatim===!0?{type:`delta`,delta:e.delta,verbatim:!0}:{type:`delta`,delta:e.delta}:{type:`conversation_id`,conversationId:e.conversation_id}}async function In(e){try{let t=(await e.json())?.detail?.code;return typeof t==`string`?t:void 0}catch{return}}function Ln(e){return un(e.replace(/\r\n?/g,`
11
+ `)).map(e=>{switch(e.type){case`bold`:case`italic`:return Ln(e.value);case`link`:return e.text;default:return e.value}}).join(``)}var Rn=40,zn=120;function Bn(e){let t=[];for(let n of un(e))if(n.type===`text`){let e=n.value.split(/(\s+)/),r=n.start;for(let n of e)r+=n.length,n.trim().length>0&&t.push(r)}else t.push(n.end);return t}function Vn(e){let t=null;return e?.addEventListener(`abort`,()=>{t?.()},{once:!0}),function(e){return new Promise(n=>{let r=setTimeout(()=>{t=null,n()},e);t=()=>{clearTimeout(r),t=null,n()}})}}async function Hn(e,t,n){let r=n?.wordIntervalMs??Rn,i=n?.tokenIntervalMs??zn,a=n?.signal,o=un(e),s=new Set(o.filter(e=>e.type!==`text`).map(e=>e.end)),c=Vn(a),l=``;for(let n of Bn(e))if(a?.aborted||(l=e.slice(0,n),t(l),await c(s.has(n)?i:r),a?.aborted))return;l!==e&&t(e)}function Un(e){let t=e.split(`.`);if(t.length!==3||t.some(e=>e===``))return null;let n=t[1];try{let e=n.replace(/-/g,`+`).replace(/_/g,`/`),t=JSON.parse(atob(e.padEnd(Math.ceil(e.length/4)*4,`=`))),r=e=>typeof e==`number`&&Number.isFinite(e)?e:null,{exp:i,iat:a}=t??{};return{exp:r(i),iat:r(a)}}catch{return null}}function Wn(e){let t=Un(e)?.exp;return typeof t==`number`?t*1e3:null}function Gn(e,t=Date.now()){let n=Wn(e);return n!==null&&n<=t}function Kn(e,t=Date.now()){let n=Un(e);return n?.exp==null?null:n.iat!=null&&n.exp>n.iat?t+(n.exp-n.iat)*1e3:n.exp*1e3}function qn(e){return`whoo-aiden-widget:conversation:${e}`}function Jn(e){try{return window.sessionStorage.getItem(qn(e))}catch{return null}}function Yn(e,t){try{window.sessionStorage.setItem(qn(e),t)}catch{}}function Xn(e){return`whoo-aiden-widget:notice-agreed:${e}`}function Zn(e,t){try{return window.sessionStorage.getItem(Xn(e))===t}catch{return!1}}function Qn(e,t){try{window.sessionStorage.setItem(Xn(e),t)}catch{}}function $n(e){try{window.sessionStorage.removeItem(qn(e))}catch{}}var er=/^(inherit|initial|unset|revert|revert-layer)$|\bcurrentcolor\b|\b(var|env|attr|light-dark)\(/i;function tr(e){if(er.test(e.trim()))return null;let t=document.createElement(`div`);if(t.style.color=e,t.style.color===``)return null;let n=document.createElement(`div`);n.attachShadow({mode:`open`}).appendChild(t),document.body.appendChild(n);let r=getComputedStyle(t).color;n.remove();let i=r.match(/rgba?\((\d+),\s*(\d+),\s*(\d+)(?:,\s*([\d.]+))?/);if(!i)return null;let a=i[4]===void 0?1:Number(i[4]);return{rgb:[Number(i[1]),Number(i[2]),Number(i[3])].map(e=>Math.round(e*a+255*(1-a))),translucent:a<1}}function J(e){return tr(e)?.rgb??null}function Y([e,t,n]){let r=e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4};return .2126*r(e)+.7152*r(t)+.0722*r(n)}function nr(e,t){let n=Math.max(e,t),r=Math.min(e,t);return(n+.05)/(r+.05)}function rr(e){let t=J(e);if(!t)return console.warn(`[whoo-aiden-widget] Could not parse color "${e}" for contrast calculation; defaulting to white text.`),`#ffffff`;let n=Y(t);return nr(n,Y([0,0,0]))>=nr(n,Y([255,255,255]))?`#000000`:`#ffffff`}function ir(e,t){let n=J(e),r=J(t);return!n||!r?NaN:nr(Y(n),Y(r))}var ar=a.primary,or=a.panel,sr=a.assistantBubble,cr=a.headerHover,lr=4.5;function ur([e,t,n]){return`#${[e,t,n].map(e=>e.toString(16).padStart(2,`0`)).join(``)}`}function dr(e,t=or){let n=J(e),r=J(t);if(!n||!r)return ar;let i=Y(r),a=e=>nr(Y(e),i)>=lr;if(a(n))return ur(n);for(let e=.99;e>0;e-=.01){let t=n.map(t=>Math.round(t*e));if(a(t))return ur(t)}return`#000000`}var fr=a.ink,pr=a.link;function X(e){if(typeof e!=`string`||!e)return null;let t=tr(e);return t?ur(t.rgb):null}function mr(e){if(typeof e!=`string`||!e)return null;let t=tr(e);return t?t.translucent?e.trim():ur(t.rgb):null}var hr=[{role:`onPrimary`,against:[`primary`],required:4.5},{role:`primaryText`,against:[`panel`,`headerHover`],required:4.5},{role:`ink`,against:[`assistantBubble`,`panel`],required:4.5},{role:`link`,against:[`assistantBubble`,`panel`],required:4.5},{role:`muted`,against:[`assistantBubble`,`panel`],required:4.5},{role:`text`,against:[`panel`,`assistantBubble`],required:4.5},{role:`errorText`,against:[`errorBackground`],required:4.5},{role:`typingDots`,against:[`assistantBubble`],required:3},{role:`inputBorder`,against:[`panel`],required:3},{role:`focusRing`,against:[`panel`],required:3}];function gr({color:e,inkColor:t,accentColor:n,overrides:r}){let o=typeof r==`object`&&r&&!Array.isArray(r)?r:{},s=e=>mr(o[e]),c=X(e),l=s(`primary`),u=l??c??ar,d=s(`primaryText`),f=d??dr(u,cr),p=s(`onPrimary`)??rr(u),m=X(t),h=s(`ink`)??(m?dr(m,sr):fr),g=X(n),_=s(`link`)??(g?dr(g,sr):pr),v=e=>s(e)??a[e],y={primary:u,onPrimary:p,primaryText:f,ink:h,link:_,text:v(`text`),panel:v(`panel`),border:v(`border`),headerHover:v(`headerHover`),assistantBubble:v(`assistantBubble`),muted:v(`muted`),typingDots:v(`typingDots`),errorBackground:v(`errorBackground`),errorText:v(`errorText`),inputBorder:v(`inputBorder`),focusRing:v(`focusRing`)},b=Object.fromEntries(i.map(e=>[e,s(e)!==null])),x=[];for(let{role:e,against:t,required:n}of hr)for(let r of t){if(!b[e]&&!b[r])continue;let t=ir(y[e],y[r]);Number.isFinite(t)&&t<n&&x.push({role:e,against:r,value:y[e],ratio:t,required:n,overridden:b[e]})}return{primary:u,textOnPrimary:p,primaryAsText:f,ink:h,link:_,adjusted:{primary:l===null&&d===null&&c!==null&&f!==u,ink:!b.ink&&m!==null&&h!==m,link:!b.link&&g!==null&&_!==g},roles:y,overridden:b,contrastWarnings:x}}function Z(e){return typeof e==`string`?`"${e}"`:`a ${typeof e} value`}function _r(e,t,n=ar){let r=t;X(t)===null&&(console.warn(`[whoo-aiden-widget] Could not use ${Z(t)} as the theme color; falling back to ${Z(n)}.`),r=n);let i=gr({color:r});e.style.setProperty(`--whoo-widget-color`,i.primary),e.style.setProperty(`--whoo-widget-text-on-color`,i.textOnPrimary),e.style.setProperty(`--whoo-widget-color-text`,i.primaryAsText)}function vr(e,{inkColor:t,accentColor:n}){let r=gr({inkColor:t,accentColor:n});e.style.setProperty(`--whoo-widget-ink`,r.ink),e.style.setProperty(`--whoo-widget-link-color`,r.link)}function yr(e,t){let n=gr({overrides:t});for(let t of i){let r=n.overridden.primary&&(t===`onPrimary`||t===`primaryText`);(n.overridden[t]||r)&&e.style.setProperty(o[t],n.roles[t])}}function br(e,t){e&&X(e)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(e)} as the ${t}; using the default.`)}function xr(e,t,n){for(let e of i){let n=t[e];n&&X(n)===null&&console.warn(`[whoo-aiden-widget] Could not use ${Z(n)} as theme.colors.${e}; using the calculated color.`)}let r=t.primary;typeof r==`string`&&tr(r)?.translucent&&console.warn(`[whoo-aiden-widget] theme.colors.primary ${Z(r)} is translucent. The launcher shows your page through it, so its icon may be unreadable over dark content; pass a solid color.`),Sr({color:e.color,inkColor:e.inkColor,accentColor:e.accentColor,overrides:t},n)}function Sr(e,t){for(let n of gr(e).contrastWarnings){let{role:e,against:r,value:i,ratio:a,required:o,overridden:s}=n,c=`${e}|${r}|${i}`;t.has(c)||(t.add(c),console.warn(s?`[whoo-aiden-widget] theme.colors.${e} (${i}) has ${a.toFixed(2)}:1 contrast against the ${r} color; ${o}:1 is recommended. Using it as given.`:`[whoo-aiden-widget] the ${e} color (${i}) has ${a.toFixed(2)}:1 contrast against your theme.colors.${r}; ${o}:1 is recommended. Override theme.colors.${e} too.`))}}function Cr(e,t,n=new Set){_r(e,t.color??ar),br(t.inkColor,`ink color`),br(t.accentColor,`accent color`),vr(e,{inkColor:t.inkColor,accentColor:t.accentColor});let r=ce(t.theme);xr(t,r.colors,n),yr(e,r.colors),r.fontFamily&&e.style.setProperty(`--whoo-widget-font`,r.fontFamily)}var wr=8e3,Tr=3e3,Er=15e3,Dr=class extends Error{name=`SessionUnavailableError`};function Or(e,t){return t?new Promise((n,r)=>{let i=()=>r(new DOMException(`Aborted`,`AbortError`));if(t.aborted)return i();t.addEventListener(`abort`,i,{once:!0}),e.then(e=>{t.removeEventListener(`abort`,i),n(e)},e=>{t.removeEventListener(`abort`,i),r(e)})}):e}function kr(e,t){return e===`refused`?new jr(t):new Dr}function Ar(e){let t=e?.status;return t===401||t===403||t===404}var jr=class extends Error{name=`SessionExpiredError`;constructor(e){super(e instanceof Error?e.message:`The session has expired.`)}};function Mr(e){return e?.status===401}function Q(e){if(e?.status!==429)return;let t=e.code;return typeof t==`string`?t:null}function Nr(e){return Q(e)===`session_message_limit`}function Pr(e,t){return new Promise(n=>{let r=setTimeout(n,t);e.then(()=>{clearTimeout(r),n()})})}var Fr=class{config;state;listeners=new Set;sessionToken=null;sessionTokenExpiresAt=null;tokenRenewal=null;renewalGeneration=0;sendEpoch=0;getSessionToken;conversationId=null;storageIdentifier;activeRequestController=null;slowResponseTimer=null;announcementTimer=null;prefersReducedMotion;launcher;launcherIconUrl;emptyStateImageUrl;emptyStateImageAlt;notice;requireNoticeAgreement;noticePlacement;subtitle;greetingStyle;showFeedback;text;language;languageTag;contentLanguage;dir;constructor(e){this.config=e;let t=ce(e.theme).launcher,n=t.iconUrl??r(e.launcherIconUrl,`launcherIconUrl`);this.launcher={...t,...n?{iconUrl:n}:{}},this.launcherIconUrl=n,this.emptyStateImageUrl=r(e.emptyStateImageUrl,`emptyStateImageUrl`),this.emptyStateImageAlt=typeof e.emptyStateImageAlt==`string`?e.emptyStateImageAlt.trim():``,this.notice=typeof e.notice==`string`&&!f(e.notice)?e.notice.trim():``,this.requireNoticeAgreement=e.requireNoticeAgreement===!0&&this.notice!==``,e.requireNoticeAgreement===!0&&!this.notice&&console.warn("whoo-aiden-widget: `requireNoticeAgreement` has no effect without a `notice`, so it is ignored."),this.noticePlacement=te(e.noticePlacement),this.subtitle=typeof e.subtitle==`string`&&!f(e.subtitle)?e.subtitle.trim():``,this.greetingStyle=ee(e.greetingStyle),this.showFeedback=e.showFeedback===!0,this.storageIdentifier=e.publishableKey??`session-token-mode`,this.getSessionToken=h(e);let{language:i,tag:a,dir:o}=It(e.language,typeof document>`u`?void 0:document.documentElement.lang);this.language=i,this.languageTag=a,this.dir=o,this.contentLanguage=zt(e.contentLanguage,typeof document>`u`?void 0:document.documentElement.lang,e.language),this.text={...Pt(i),...x(e.messages)},this.prefersReducedMotion=typeof window.matchMedia==`function`&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches,this.state={isOpen:!1,messages:[],isStreaming:!1,initError:null,isInitializing:!1,runtimeError:null,messageFeedback:{},primaryColor:null,agentName:null,accentColor:null,inkColor:null,announcement:null,announcementIsContent:!1,isSlowResponse:!1,noticeAgreed:!this.requireNoticeAgreement||Zn(this.storageIdentifier,this.notice),draft:``}}getState(){return this.state}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}get resolvedAgentName(){return d(this.config.name)||this.state.agentName||`Aiden`}announce(e,t=!1,n=!1){this.announcementTimer!==null&&(clearTimeout(this.announcementTimer),this.announcementTimer=null),n&&e!==null&&this.state.announcement!==e?this.setState({announcement:e,announcementIsContent:t}):(this.state.announcement!==null&&this.setState({announcement:null}),e!==null&&(this.announcementTimer=setTimeout(()=>{this.announcementTimer=null,this.setState({announcement:e,announcementIsContent:t})},250)))}clearSlowResponse(){this.slowResponseTimer!==null&&(clearTimeout(this.slowResponseTimer),this.slowResponseTimer=null),this.state.isSlowResponse&&this.setState({isSlowResponse:!1})}setState(e){this.state={...this.state,...e};for(let e of this.listeners)e(this.state)}async init(){this.setState({isInitializing:!0});try{await this.start()}finally{this.setState({isInitializing:!1})}}async start(){let e=this.config.apiBaseUrl??`https://api.aidenvoice.com`;try{if(this.config.sessionToken){if(Gn(this.config.sessionToken)){if(!(`token`in await this.renewToken()))throw Error(`The sessionToken has expired.`)}else this.sessionToken=this.config.sessionToken,this.sessionTokenExpiresAt=Wn(this.config.sessionToken)}else if(this.config.publishableKey){let{token:t,primaryColor:n,name:r,accentColor:i,inkColor:a}=await An(e,this.config.publishableKey);this.sessionToken=t,this.sessionTokenExpiresAt=Kn(t),this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}else throw Error(`WidgetConfig must include exactly one of publishableKey or sessionToken`)}catch(e){console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)});return}this.conversationId=Jn(this.storageIdentifier),this.config.sessionToken&&await Pr(this.loadBranding(e),Tr)}async loadBranding(e){try{let t=this.config;if(X(t.color)&&X(t.inkColor)&&X(t.accentColor)&&d(t.name))return;let{primaryColor:n,name:r,accentColor:i,inkColor:a}=await this.withSession(t=>Mn(e,t));this.setState({primaryColor:n,agentName:r,accentColor:i,inkColor:a})}catch(e){let t=e?.status;(e instanceof jr||t===401||t===403)&&(this.state.isInitializing?(console.error(`[whoo-aiden-widget] initialization failed:`,e),this.setState({initError:e instanceof Error?e.message:String(e)})):(console.error(`[whoo-aiden-widget] the session was refused after start-up:`,e),this.setState({runtimeError:this.text.sessionExpired})))}}open(){this.setState({isOpen:!0})}resetConversation(){this.sendEpoch+=1,this.activeRequestController?.abort(`reset`),this.activeRequestController=null,this.clearSlowResponse(),this.conversationId=null,$n(this.storageIdentifier),this.setState({messages:[],messageFeedback:{},runtimeError:null,isStreaming:!1}),this.announce(this.text.conversationCleared)}agreeToNotice(){this.state.noticeAgreed||(Qn(this.storageIdentifier,this.notice),this.setState({noticeAgreed:!0}))}setDraft(e){this.setState({draft:e})}close(){this.activeRequestController?.abort(`close`),this.activeRequestController=null,this.clearSlowResponse(),this.announce(null),this.setState({isOpen:!1})}async sendMessage(e){if(!this.sessionToken||!this.state.noticeAgreed)return;let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.sendEpoch+=1;let n=this.sendEpoch,r=()=>n===this.sendEpoch,i={role:`user`,content:e,id:null},a={role:`assistant`,content:``,id:null};this.setState({messages:[...this.state.messages,i,a],isStreaming:!0,runtimeError:null}),this.announce(Vt(this.text.messageSent,{name:this.resolvedAgentName}),!1,!0);let o=a,s=e=>{let t=o;o={...o,...e},this.setState({messages:this.state.messages.map(e=>e===t?o:e)})},c=e=>s({content:e}),l=new AbortController;this.activeRequestController=l;let{signal:u}=l,d=!1;this.slowResponseTimer=setTimeout(()=>{this.slowResponseTimer=null,this.setState({isSlowResponse:!0}),r()&&this.announce(this.text.lookingItUp)},wr);let f=!1,p=()=>{this.state.draft===``&&(f=!0,this.setState({draft:e}))},m=!1,h=e=>{m=!0,this.announce(Ln(e),!0)},g=(e=this.text.genericError)=>{r()&&(m||(m=!0,this.announce(null)),this.setState({runtimeError:e}),p())},_=``;try{let{stream:n,first:i}=await this.withSession(async n=>{d=!0;let r=Pn(t,n,this.conversationId,e,u);try{return{stream:r,first:await r.next()}}catch(e){throw(Mr(e)||Q(e)!==void 0)&&(d=!1),e}},u);for(let e=i;!e.done&&!u.aborted&&r();e=await n.next()){let t=e.value;if(t.type===`conversation_id`)this.conversationId=t.conversationId,Yn(this.storageIdentifier,t.conversationId);else if(t.type===`delta`)this.clearSlowResponse(),t.verbatim&&!this.prefersReducedMotion?(await Hn(t.delta,e=>c(e),{signal:u}),_=t.delta):t.verbatim?(_=t.delta,c(_)):(_+=t.delta,c(_));else if(t.type===`done`)t.conversationId&&(this.conversationId=t.conversationId,Yn(this.storageIdentifier,t.conversationId)),t.messageId&&s({id:t.messageId}),r()&&h(_);else if(t.type===`error`){console.error(`[whoo-aiden-widget] chat error:`,t.error),_.trim()!==``&&r()&&h(_),g(),l.abort();break}}}catch(e){if(u.aborted)u.reason===`close`&&r()&&!d&&p();else if(e instanceof jr)console.error(`[whoo-aiden-widget] chat request failed: the session has expired.`,e),g(this.text.sessionExpired);else if(e instanceof Dr)console.error(`[whoo-aiden-widget] chat request failed: no session could be had.`),g();else if(Q(e)!==void 0){console.error(`[whoo-aiden-widget] chat request refused:`,Q(e));let t=Q(e);g(t===`assistant_unavailable`?this.text.assistantUnavailable:t===`turn_in_progress`?this.text.waitForReply:t===`session_message_limit`?this.text.messageLimitReached:this.text.tooManyMessages)}else console.error(`[whoo-aiden-widget] chat request failed:`,e),g()}finally{let e=o.id===null&&o.content.trim()===``,t=this.state.messages.filter(t=>!(e&&t===o)&&!(e&&f&&t===i)),n=t.length!==this.state.messages.length;r()?(this.activeRequestController=null,this.clearSlowResponse(),m||(!u.aborted&&_.trim()!==``?h(_):this.announce(null)),this.setState({isStreaming:!1,...n?{messages:t}:{}})):n&&this.setState({messages:t})}}expandFeedback(e){let{correction:t,category:n}=this.state.messageFeedback[e]??{};this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`expanded`,correction:t,category:n}}})}setFeedbackDraft(e,t,n){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{...this.state.messageFeedback[e],correction:t,category:n}}})}cancelFeedback(e){this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`idle`}}})}async submitFeedback(e,t,n,r){if(!this.sessionToken)return;let i=this.config.apiBaseUrl??`https://api.aidenvoice.com`;this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitting`,rating:t}}});try{await this.withSession(a=>Nn(i,a,{messageId:e,rating:t,correction:n,category:r})),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`submitted`,rating:t}}})}catch(i){console.error(`[whoo-aiden-widget] feedback submission failed:`,i),this.setState({messageFeedback:{...this.state.messageFeedback,[e]:{status:`error`,rating:t,correction:n,category:r}}})}}async currentToken(e){let t=this.sessionToken,n=this.sessionTokenExpiresAt;return t&&(n===null||n-Date.now()>6e4)?{token:t}:Or(this.renewToken(),e)}renewToken(){return this.tokenRenewal??=this.fetchNewToken().finally(()=>{this.tokenRenewal=null}),this.tokenRenewal}async fetchNewToken(){let e=++this.renewalGeneration,t,n=new Promise(e=>{t=setTimeout(()=>{console.error(`[whoo-aiden-widget] could not renew the session: it took too long.`),e({failure:`unavailable`})},Er)});try{return await Promise.race([this.obtainToken(e),n])}finally{clearTimeout(t)}}async obtainToken(e){let t=this.config.apiBaseUrl??`https://api.aidenvoice.com`,n;try{if(this.config.publishableKey)n=(await An(t,this.config.publishableKey)).token;else if(this.getSessionToken)n=await this.getSessionToken();else return{failure:`refused`}}catch(e){return console.error(`[whoo-aiden-widget] could not renew the session:`,e),{failure:this.config.publishableKey&&Ar(e)?`refused`:`unavailable`}}let r=typeof n==`string`?Kn(n):null;return typeof n!=`string`||n===``||r!==null&&r<=Date.now()?(console.error(`[whoo-aiden-widget] could not renew the session: no usable token was returned.`),{failure:`refused`}):(e===this.renewalGeneration&&(this.sessionToken=n,this.sessionTokenExpiresAt=r),{token:n})}async withSession(e,t){let n=await this.currentToken(t);if(!(`token`in n))throw kr(n.failure);let{token:r}=n;try{return await e(r)}catch(n){if(!Mr(n)&&!Nr(n))throw n;let i=this.sessionToken&&this.sessionToken!==r?{token:this.sessionToken}:await Or(this.renewToken(),t);if(!(`token`in i))throw kr(i.failure,n);try{return await e(i.token)}catch(e){throw Mr(e)?new jr(e):e}}}},$=20,Ir=12,Lr=300,Rr=352;function zr(){try{return typeof CSS<`u`&&CSS.supports?.(`height`,`100dvh`)?`dvh`:`vh`}catch{return`vh`}}function Br(e,t){let{offsetX:n,offsetY:r,launcherSize:i,panelWidth:a,panelHeight:o,cornerRadius:s}=ue(t.layout),c=e=>typeof t.layout?.offset?.[e]==`number`;if(typeof window<`u`&&window.innerWidth>0&&window.innerHeight>0){let e=Math.max($,window.innerWidth-Lr),t=Math.max($,window.innerHeight-i-Rr);c(`x`)&&(n>e||n>window.innerWidth-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.x\` ${n} leaves no room for the launcher and panel in this viewport; it is held back.`),c(`y`)&&(r>t||r>window.innerHeight-i)&&console.warn(`whoo-aiden-widget: \`layout.offset.y\` ${r} leaves no room for the launcher and panel in this viewport; it is held back.`)}let l=`100${zr()}`,u=`min(${n}px, max(${$}px, calc(100vw - ${Lr}px)), calc(100vw - ${i}px))`,d=`min(${r}px, max(${$}px, calc(${l} - ${i+Rr}px)), calc(${l} - ${i}px))`,f=`calc(${d} + ${i}px + ${Ir}px)`,p=t.position===`bottom-left`,m=(t,n)=>e.style.setProperty(t,n);m(`--whoo-widget-inset-left`,p?u:`auto`),m(`--whoo-widget-inset-right`,p?`auto`:u),m(`--whoo-widget-inset-bottom`,d),m(`--whoo-widget-launcher-size`,`${i}px`),m(`--whoo-widget-panel-bottom`,f),m(`--whoo-widget-panel-width`,`${a}px`),m(`--whoo-widget-panel-height`,`${o}px`),m(`--whoo-widget-panel-max-width`,`calc(100vw - ${u} - ${$}px)`),m(`--whoo-widget-panel-max-height`,`calc(${l} - ${f} - ${$}px)`),s===void 0?e.style.removeProperty(`--whoo-widget-corner-radius`):m(`--whoo-widget-corner-radius`,`${s}px`)}var Vr=`:host,.whoo-widget-root{all:initial;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,sans-serif}.whoo-widget-launcher{bottom:var(--whoo-widget-inset-bottom,20px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-launcher-size,56px);height:var(--whoo-widget-launcher-size,56px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:50%;justify-content:center;align-items:center;padding:0;font-size:24px;display:flex;position:fixed;box-shadow:0 2px 8px #0003}.whoo-widget-launcher:focus-visible{box-shadow:0 2px 8px #0003,0 0 0 4px #fff}.whoo-widget-launcher svg{width:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);height:calc(var(--whoo-widget-launcher-size,56px) * 13 / 28);display:block}.whoo-widget-launcher-icon-image{width:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);height:calc(var(--whoo-widget-launcher-size,56px) * 4 / 7);object-fit:cover;border-radius:50%}.whoo-widget-launcher-icon-image[hidden]{display:none}.whoo-widget-panel{bottom:var(--whoo-widget-panel-bottom,88px);left:var(--whoo-widget-inset-left,auto);right:var(--whoo-widget-inset-right,20px);width:var(--whoo-widget-panel-width,360px);height:var(--whoo-widget-panel-height,480px);max-width:var(--whoo-widget-panel-max-width,calc(100vw - 40px));max-height:var(--whoo-widget-panel-max-height,calc(100vh - 108px));background:var(--whoo-widget-panel,#fff);border-radius:var(--whoo-widget-corner-radius,12px);font-family:var(--whoo-widget-font,-apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif);color:inherit;border:none;flex-direction:column;margin:0;padding:0;display:flex;position:fixed;overflow:hidden;box-shadow:0 4px 16px #0003}button,input,textarea,select{font-family:inherit}.whoo-widget-panel:not([open]){display:none}.whoo-widget-panel::backdrop{background:0 0}@media (width<=400px),(height<=420px){.whoo-widget-panel{width:auto;max-width:none;height:auto;max-height:none;inset:8px}}.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + max(8px, var(--whoo-widget-visible-height,100%) - 8px - var(--whoo-widget-panel-height,480px)));height:min(var(--whoo-widget-panel-height,480px), calc(var(--whoo-widget-visible-height,100%) - 16px));max-height:none;bottom:auto}@media (width<=400px),(height<=420px){.whoo-widget-panel[data-fit-visible]{top:calc(var(--whoo-widget-visible-top,0px) + 8px);height:calc(var(--whoo-widget-visible-height,100%) - 16px)}}.whoo-widget-header{border-bottom:1px solid var(--whoo-widget-border,#e5e5e5);flex-wrap:wrap;flex-shrink:0;justify-content:space-between;align-items:center;gap:8px;max-height:50%;padding-block:8px;padding-inline:16px 8px;display:flex;overflow-y:auto}.whoo-widget-header-titles{flex:10em;min-width:0}.whoo-widget-header-title{color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;margin:0;font-size:15px;font-weight:600}.whoo-widget-header-subtitle{color:var(--whoo-widget-muted,#4b5563);overflow-wrap:anywhere;margin:2px 0 0;font-size:13px}.whoo-widget-header-actions{background:var(--whoo-widget-panel,#fff);flex-shrink:0;align-items:center;gap:4px;margin-inline-start:auto;display:flex;position:sticky;bottom:0}.whoo-widget-header-close,.whoo-widget-header-reset{color:var(--whoo-widget-color-text,#4f46e5);cursor:pointer;background:0 0;border:none;border-radius:6px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px 8px;font-size:13px;display:inline-flex}.whoo-widget-header-close{width:32px;height:32px;padding:0}.whoo-widget-header-close:hover,.whoo-widget-header-reset:hover{background:var(--whoo-widget-header-hover,#f3f4f6)}.whoo-widget-message-list{overscroll-behavior:contain;flex:1;min-height:0;padding:12px;overflow-y:auto}.whoo-widget-message-list:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-empty-state-image{object-fit:contain;max-width:min(160px,100%);height:auto;max-height:160px;margin:8px auto 16px;display:block}.whoo-widget-message-list--centered{flex-direction:column;display:flex}.whoo-widget-empty-state{margin-block:auto}.whoo-widget-empty-state-greeting{color:var(--whoo-widget-ink,#111);text-align:center;overflow-wrap:anywhere;white-space:pre-line}.whoo-widget-empty-state-greeting a{color:var(--whoo-widget-link-color,#00e)}@media (width<=400px),(height<=420px){.whoo-widget-empty-state-image{max-height:64px;margin:0 auto 8px}}.whoo-widget-notice{border:1px solid var(--whoo-widget-border,#e5e5e5);color:var(--whoo-widget-ink,#111);overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;margin-bottom:12px;padding:8px 12px}.whoo-widget-notice a,.whoo-widget-notice-footer a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-message{overflow-wrap:anywhere;white-space:pre-line;border-radius:8px;max-width:80%;margin-bottom:8px;padding:8px 12px}.whoo-widget-message-text,.whoo-widget-message-text li{unicode-bidi:plaintext}.whoo-widget-list{margin:4px 0;padding-inline-start:0}.whoo-widget-list li{margin-inline-start:20px}.whoo-widget-message--user{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);margin-inline-start:auto}.whoo-widget-message--user a{color:inherit}.whoo-widget-message--assistant{background:var(--whoo-widget-assistant-bubble,#f0f0f0);color:var(--whoo-widget-ink,#111)}.whoo-widget-message--assistant a{color:var(--whoo-widget-link-color,#00e)}.whoo-widget-pending{flex-wrap:wrap;align-items:center;gap:8px;min-height:1.2em;display:flex}.whoo-widget-typing{align-items:center;gap:4px;display:inline-flex}.whoo-widget-typing span{background:var(--whoo-widget-typing-dots,#6b7280);border-radius:50%;width:6px;height:6px;animation:1.2s ease-in-out infinite whoo-widget-typing-bounce}.whoo-widget-typing span:nth-child(2){animation-delay:.2s}.whoo-widget-typing span:nth-child(3){animation-delay:.4s}@keyframes whoo-widget-typing-bounce{0%,80%,to{transform:translateY(0)}40%{transform:translateY(-4px)}}@media (prefers-reduced-motion:reduce){.whoo-widget-typing span{animation:none}}.whoo-widget-error-banner{background:var(--whoo-widget-error-bg,#fee2e2);color:var(--whoo-widget-error-text,#991b1b);padding:8px 12px;font-size:13px}.whoo-widget-composer{border-top:1px solid var(--whoo-widget-border,#e5e5e5);gap:8px;padding:12px;display:flex}.whoo-widget-composer-input{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:var(--whoo-widget-corner-radius,6px);unicode-bidi:plaintext;flex:1;min-width:0;padding:8px;font-size:16px}.whoo-widget-agreement{border-top:1px solid var(--whoo-widget-border,#e5e5e5);padding:12px}.whoo-widget-agreement-button{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);width:100%;min-height:44px;color:var(--whoo-widget-text-on-color,#fff);overflow-wrap:anywhere;cursor:pointer;border:none;padding:8px 16px;font-weight:600;display:block}.whoo-widget-composer-send{border-radius:var(--whoo-widget-corner-radius,6px);background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;padding:8px 16px}.whoo-widget-composer-input::placeholder{color:var(--whoo-widget-muted,#4b5563);opacity:1}.whoo-widget-notice-footer{overscroll-behavior:contain;border-top:1px solid var(--whoo-widget-border,#e5e5e5);min-height:0;max-height:25%;color:var(--whoo-widget-muted,#4b5563);text-align:center;overflow-wrap:anywhere;white-space:pre-line;flex:0 auto;padding:8px 16px;font-size:12px;line-height:1.4;overflow-y:auto}.whoo-widget-notice-footer:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:-2px;box-shadow:inset 0 0 0 4px var(--whoo-widget-panel,#fff)}.whoo-widget-composer-send[aria-disabled=true],.whoo-widget-composer-input[aria-disabled=true]{opacity:.6;cursor:not-allowed}.whoo-widget-feedback{align-items:center;gap:6px;margin-top:4px;display:flex}.whoo-widget-feedback-buttons{gap:6px;display:flex}.whoo-widget-feedback-buttons button{cursor:pointer;color:var(--whoo-widget-muted,#4b5563);background:0 0;border:none;border-radius:4px;justify-content:center;align-items:center;min-width:24px;min-height:24px;padding:4px;display:inline-flex}.whoo-widget-feedback-buttons button:hover:not(:disabled){color:var(--whoo-widget-text,#111);background:#0000000f}.whoo-widget-feedback-buttons button[aria-disabled=true]{opacity:.3;cursor:not-allowed}.whoo-widget-feedback-form{flex-direction:column;gap:6px;margin-top:6px;display:flex}.whoo-widget-feedback-textarea{box-sizing:border-box;border:1px solid var(--whoo-widget-input-border,#6b7280);resize:vertical;unicode-bidi:plaintext;border-radius:6px;width:100%;padding:6px;font-size:16px}.whoo-widget-feedback-select{border:1px solid var(--whoo-widget-input-border,#6b7280);border-radius:6px;height:2em;min-height:24px;padding:4px;font-size:16px}.whoo-widget-feedback-form-buttons{gap:6px;display:flex}.whoo-widget-feedback-submit{background:var(--whoo-widget-color,#4f46e5);color:var(--whoo-widget-text-on-color,#fff);cursor:pointer;border:none;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-cancel{border:1px solid var(--whoo-widget-input-border,#6b7280);background:var(--whoo-widget-panel,#fff);color:var(--whoo-widget-text,#111);cursor:pointer;border-radius:6px;padding:8px 16px;font-size:13px}.whoo-widget-feedback-submitted{color:var(--whoo-widget-muted,#4b5563);margin-top:4px;font-size:12px}.whoo-widget-feedback-error{color:var(--whoo-widget-error-text,#991b1b);font-size:12px}.whoo-widget-sr-only{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;width:1px;height:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}button:focus-visible,input:focus-visible,textarea:focus-visible,select:focus-visible,a:focus-visible{outline:2px solid var(--whoo-widget-focus-ring,#111827);outline-offset:2px;box-shadow:0 0 0 4px var(--whoo-widget-panel,#fff)}@media (forced-colors:active){.whoo-widget-message{border:1px solid canvastext}.whoo-widget-launcher,.whoo-widget-header-close,.whoo-widget-header-reset,.whoo-widget-composer-send,.whoo-widget-agreement-button,.whoo-widget-feedback-submit,.whoo-widget-feedback-buttons button{border:1px solid buttontext}.whoo-widget-panel{box-sizing:border-box;border:1px solid canvastext}}`;function Hr(e){let t=document.createElement(`div`);t.id=`whoo-aiden-widget-host`,t.style.position=`relative`,t.style.zIndex=String(l(e.zIndex));let n=t.attachShadow({mode:`open`}),r=document.createElement(`style`);r.textContent=Vr,n.appendChild(r);let i=document.createElement(`div`);n.appendChild(i);let a=new Set;Cr(i,e,a),Br(i,e);let o=new Fr(e);i.setAttribute(`lang`,o.languageTag),i.setAttribute(`dir`,o.dir);let s=X(e.color)!==null,c=null,u=``,d=ce(e.theme).colors,f=Object.keys(d).length>0,p={color:e.color,inkColor:e.inkColor,accentColor:e.accentColor};return o.subscribe(t=>{let n=!1;!s&&t.primaryColor&&t.primaryColor!==c&&(c=t.primaryColor,_r(i,t.primaryColor,e.color),X(t.primaryColor)&&(p={...p,color:t.primaryColor}),n=!0);let r=`${t.inkColor}|${t.accentColor}`;if((t.inkColor||t.accentColor)&&r!==u){u=r;let a=X(e.inkColor)?e.inkColor:t.inkColor,o=X(e.accentColor)?e.accentColor:t.accentColor;vr(i,{inkColor:a,accentColor:o}),p={...p,inkColor:a,accentColor:o},n=!0}n&&(yr(i,d),f&&Sr({...p,overrides:d},a))}),o.init(),We(G(Dn,{controller:o}),i),document.body.appendChild(t),{unmount(){We(null,i),t.remove()}}}function Ur(e){return p(e),Hr(e)}return e.init=Ur,e})({});