@elevenlabs/convai-widget-embed 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 ElevenLabs
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.js ADDED
@@ -0,0 +1,422 @@
1
+ (function(){"use strict";var $t,T,to,no,tt,ro,oo,ao,io,On,Ln,Rn,so,It={},lo=[],Ss=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Dt=Array.isArray;function Ne(e,t){for(var n in t)e[n]=t[n];return e}function Fn(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function K(e,t,n){var r,o,a,i={};for(a in t)a=="key"?r=t[a]:a=="ref"?o=t[a]:i[a]=t[a];if(arguments.length>2&&(i.children=arguments.length>3?$t.call(arguments,2):n),typeof e=="function"&&e.defaultProps!=null)for(a in e.defaultProps)i[a]==null&&(i[a]=e.defaultProps[a]);return Mt(e,i,r,o,null)}function Mt(e,t,n,r,o){var a={type:e,props:t,key:n,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++to,__i:-1,__u:0};return o==null&&T.vnode!=null&&T.vnode(a),a}function co(){return{current:null}}function ee(e){return e.children}function be(e,t){this.props=e,this.context=t}function ut(e,t){if(t==null)return e.__?ut(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null)return n.__e;return typeof e.type=="function"?ut(e):null}function uo(e){var t,n;if((e=e.__)!=null&&e.__c!=null){for(e.__e=e.__c.base=null,t=0;t<e.__k.length;t++)if((n=e.__k[t])!=null&&n.__e!=null){e.__e=e.__c.base=n.__e;break}return uo(e)}}function zn(e){(!e.__d&&(e.__d=!0)&&tt.push(e)&&!Gt.__r++||ro!=T.debounceRendering)&&((ro=T.debounceRendering)||oo)(Gt)}function Gt(){for(var e,t,n,r,o,a,i,s=1;tt.length;)tt.length>s&&tt.sort(ao),e=tt.shift(),s=tt.length,e.__d&&(n=void 0,o=(r=(t=e).__v).__e,a=[],i=[],t.__P&&((n=Ne({},r)).__v=r.__v+1,T.vnode&&T.vnode(n),Un(t.__P,n,r,t.__n,t.__P.namespaceURI,32&r.__u?[o]:null,a,o??ut(r),!!(32&r.__u),i),n.__v=r.__v,n.__.__k[n.__i]=n,mo(a,n,i),n.__e!=o&&uo(n)));Gt.__r=0}function fo(e,t,n,r,o,a,i,s,l,c,f){var u,v,h,g,p,m,_=r&&r.__k||lo,w=t.length;for(l=Es(n,t,_,l,w),u=0;u<w;u++)(h=n.__k[u])!=null&&(v=h.__i==-1?It:_[h.__i]||It,h.__i=u,m=Un(e,h,v,o,a,i,s,l,c,f),g=h.__e,h.ref&&v.ref!=h.ref&&(v.ref&&Bn(v.ref,null,h),f.push(h.ref,h.__c||g,h)),p==null&&g!=null&&(p=g),4&h.__u||v.__k===h.__k?l=po(h,l,e):typeof h.type=="function"&&m!==void 0?l=m:g&&(l=g.nextSibling),h.__u&=-7);return n.__e=p,l}function Es(e,t,n,r,o){var a,i,s,l,c,f=n.length,u=f,v=0;for(e.__k=new Array(o),a=0;a<o;a++)(i=t[a])!=null&&typeof i!="boolean"&&typeof i!="function"?(l=a+v,(i=e.__k[a]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?Mt(null,i,null,null,null):Dt(i)?Mt(ee,{children:i},null,null,null):i.constructor==null&&i.__b>0?Mt(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=e,i.__b=e.__b+1,s=null,(c=i.__i=Ts(i,n,l,u))!=-1&&(u--,(s=n[c])&&(s.__u|=2)),s==null||s.__v==null?(c==-1&&(o>f?v--:o<f&&v++),typeof i.type!="function"&&(i.__u|=4)):c!=l&&(c==l-1?v--:c==l+1?v++:(c>l?v--:v++,i.__u|=4))):e.__k[a]=null;if(u)for(a=0;a<f;a++)(s=n[a])!=null&&(2&s.__u)==0&&(s.__e==r&&(r=ut(s)),_o(s,s));return r}function po(e,t,n){var r,o;if(typeof e.type=="function"){for(r=e.__k,o=0;r&&o<r.length;o++)r[o]&&(r[o].__=e,t=po(r[o],t,n));return t}e.__e!=t&&(t&&e.type&&!n.contains(t)&&(t=ut(e)),n.insertBefore(e.__e,t||null),t=e.__e);do t=t&&t.nextSibling;while(t!=null&&t.nodeType==8);return t}function De(e,t){return t=t||[],e==null||typeof e=="boolean"||(Dt(e)?e.some(function(n){De(n,t)}):t.push(e)),t}function Ts(e,t,n,r){var o,a,i=e.key,s=e.type,l=t[n];if(l===null&&e.key==null||l&&i==l.key&&s==l.type&&(2&l.__u)==0)return n;if(r>(l!=null&&(2&l.__u)==0?1:0))for(o=n-1,a=n+1;o>=0||a<t.length;){if(o>=0){if((l=t[o])&&(2&l.__u)==0&&i==l.key&&s==l.type)return o;o--}if(a<t.length){if((l=t[a])&&(2&l.__u)==0&&i==l.key&&s==l.type)return a;a++}}return-1}function ho(e,t,n){t[0]=="-"?e.setProperty(t,n??""):e[t]=n==null?"":typeof n!="number"||Ss.test(t)?n:n+"px"}function Zt(e,t,n,r,o){var a;e:if(t=="style")if(typeof n=="string")e.style.cssText=n;else{if(typeof r=="string"&&(e.style.cssText=r=""),r)for(t in r)n&&t in n||ho(e.style,t,"");if(n)for(t in n)r&&n[t]==r[t]||ho(e.style,t,n[t])}else if(t[0]=="o"&&t[1]=="n")a=t!=(t=t.replace(io,"$1")),t=t.toLowerCase()in e||t=="onFocusOut"||t=="onFocusIn"?t.toLowerCase().slice(2):t.slice(2),e.l||(e.l={}),e.l[t+a]=n,n?r?n.u=r.u:(n.u=On,e.addEventListener(t,a?Rn:Ln,a)):e.removeEventListener(t,a?Rn:Ln,a);else{if(o=="http://www.w3.org/2000/svg")t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(t!="width"&&t!="height"&&t!="href"&&t!="list"&&t!="form"&&t!="tabIndex"&&t!="download"&&t!="rowSpan"&&t!="colSpan"&&t!="role"&&t!="popover"&&t in e)try{e[t]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&t[4]!="-"?e.removeAttribute(t):e.setAttribute(t,t=="popover"&&n==1?"":n))}}function vo(e){return function(t){if(this.l){var n=this.l[t.type+e];if(t.t==null)t.t=On++;else if(t.t<n.u)return;return n(T.event?T.event(t):t)}}}function Un(e,t,n,r,o,a,i,s,l,c){var f,u,v,h,g,p,m,_,w,y,b,C,k,x,P,D,F,O=t.type;if(t.constructor!=null)return null;128&n.__u&&(l=!!(32&n.__u),a=[s=t.__e=n.__e]),(f=T.__b)&&f(t);e:if(typeof O=="function")try{if(_=t.props,w="prototype"in O&&O.prototype.render,y=(f=O.contextType)&&r[f.__c],b=f?y?y.props.value:f.__:r,n.__c?m=(u=t.__c=n.__c).__=u.__E:(w?t.__c=u=new O(_,b):(t.__c=u=new be(_,b),u.constructor=O,u.render=Ps),y&&y.sub(u),u.props=_,u.state||(u.state={}),u.context=b,u.__n=r,v=u.__d=!0,u.__h=[],u._sb=[]),w&&u.__s==null&&(u.__s=u.state),w&&O.getDerivedStateFromProps!=null&&(u.__s==u.state&&(u.__s=Ne({},u.__s)),Ne(u.__s,O.getDerivedStateFromProps(_,u.__s))),h=u.props,g=u.state,u.__v=t,v)w&&O.getDerivedStateFromProps==null&&u.componentWillMount!=null&&u.componentWillMount(),w&&u.componentDidMount!=null&&u.__h.push(u.componentDidMount);else{if(w&&O.getDerivedStateFromProps==null&&_!==h&&u.componentWillReceiveProps!=null&&u.componentWillReceiveProps(_,b),!u.__e&&u.shouldComponentUpdate!=null&&u.shouldComponentUpdate(_,u.__s,b)===!1||t.__v==n.__v){for(t.__v!=n.__v&&(u.props=_,u.state=u.__s,u.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(L){L&&(L.__=t)}),C=0;C<u._sb.length;C++)u.__h.push(u._sb[C]);u._sb=[],u.__h.length&&i.push(u);break e}u.componentWillUpdate!=null&&u.componentWillUpdate(_,u.__s,b),w&&u.componentDidUpdate!=null&&u.__h.push(function(){u.componentDidUpdate(h,g,p)})}if(u.context=b,u.props=_,u.__P=e,u.__e=!1,k=T.__r,x=0,w){for(u.state=u.__s,u.__d=!1,k&&k(t),f=u.render(u.props,u.state,u.context),P=0;P<u._sb.length;P++)u.__h.push(u._sb[P]);u._sb=[]}else do u.__d=!1,k&&k(t),f=u.render(u.props,u.state,u.context),u.state=u.__s;while(u.__d&&++x<25);u.state=u.__s,u.getChildContext!=null&&(r=Ne(Ne({},r),u.getChildContext())),w&&!v&&u.getSnapshotBeforeUpdate!=null&&(p=u.getSnapshotBeforeUpdate(h,g)),D=f,f!=null&&f.type===ee&&f.key==null&&(D=go(f.props.children)),s=fo(e,Dt(D)?D:[D],t,n,r,o,a,i,s,l,c),u.base=t.__e,t.__u&=-161,u.__h.length&&i.push(u),m&&(u.__E=u.__=null)}catch(L){if(t.__v=null,l||a!=null)if(L.then){for(t.__u|=l?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;a[a.indexOf(s)]=null,t.__e=s}else for(F=a.length;F--;)Fn(a[F]);else t.__e=n.__e,t.__k=n.__k;T.__e(L,t,n)}else a==null&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):s=t.__e=Ns(n.__e,t,n,r,o,a,i,l,c);return(f=T.diffed)&&f(t),128&t.__u?void 0:s}function mo(e,t,n){for(var r=0;r<n.length;r++)Bn(n[r],n[++r],n[++r]);T.__c&&T.__c(t,e),e.some(function(o){try{e=o.__h,o.__h=[],e.some(function(a){a.call(o)})}catch(a){T.__e(a,o.__v)}})}function go(e){return typeof e!="object"||e==null||e.__b&&e.__b>0?e:Dt(e)?e.map(go):Ne({},e)}function Ns(e,t,n,r,o,a,i,s,l){var c,f,u,v,h,g,p,m=n.props,_=t.props,w=t.type;if(w=="svg"?o="http://www.w3.org/2000/svg":w=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),a!=null){for(c=0;c<a.length;c++)if((h=a[c])&&"setAttribute"in h==!!w&&(w?h.localName==w:h.nodeType==3)){e=h,a[c]=null;break}}if(e==null){if(w==null)return document.createTextNode(_);e=document.createElementNS(o,w,_.is&&_),s&&(T.__m&&T.__m(t,a),s=!1),a=null}if(w==null)m===_||s&&e.data==_||(e.data=_);else{if(a=a&&$t.call(e.childNodes),m=n.props||It,!s&&a!=null)for(m={},c=0;c<e.attributes.length;c++)m[(h=e.attributes[c]).name]=h.value;for(c in m)if(h=m[c],c!="children"){if(c=="dangerouslySetInnerHTML")u=h;else if(!(c in _)){if(c=="value"&&"defaultValue"in _||c=="checked"&&"defaultChecked"in _)continue;Zt(e,c,null,h,o)}}for(c in _)h=_[c],c=="children"?v=h:c=="dangerouslySetInnerHTML"?f=h:c=="value"?g=h:c=="checked"?p=h:s&&typeof h!="function"||m[c]===h||Zt(e,c,h,m[c],o);if(f)s||u&&(f.__html==u.__html||f.__html==e.innerHTML)||(e.innerHTML=f.__html),t.__k=[];else if(u&&(e.innerHTML=""),fo(t.type=="template"?e.content:e,Dt(v)?v:[v],t,n,r,w=="foreignObject"?"http://www.w3.org/1999/xhtml":o,a,i,a?a[0]:n.__k&&ut(n,0),s,l),a!=null)for(c=a.length;c--;)Fn(a[c]);s||(c="value",w=="progress"&&g==null?e.removeAttribute("value"):g!=null&&(g!==e[c]||w=="progress"&&!g||w=="option"&&g!=m[c])&&Zt(e,c,g,m[c],o),c="checked",p!=null&&p!=e[c]&&Zt(e,c,p,m[c],o))}return e}function Bn(e,t,n){try{if(typeof e=="function"){var r=typeof e.__u=="function";r&&e.__u(),r&&t==null||(e.__u=e(t))}else e.current=t}catch(o){T.__e(o,n)}}function _o(e,t,n){var r,o;if(T.unmount&&T.unmount(e),(r=e.ref)&&(r.current&&r.current!=e.__e||Bn(r,null,t)),(r=e.__c)!=null){if(r.componentWillUnmount)try{r.componentWillUnmount()}catch(a){T.__e(a,t)}r.base=r.__P=null}if(r=e.__k)for(o=0;o<r.length;o++)r[o]&&_o(r[o],t,n||typeof e.type!="function");n||Fn(e.__e),e.__c=e.__=e.__e=void 0}function Ps(e,t,n){return this.constructor(e,n)}function Be(e,t,n){var r,o,a,i;t==document&&(t=document.documentElement),T.__&&T.__(e,t),o=(r=typeof n=="function")?null:n&&n.__k||t.__k,a=[],i=[],Un(t,e=(!r&&n||t).__k=K(ee,null,[e]),o||It,It,t.namespaceURI,!r&&n?[n]:o?null:t.firstChild?$t.call(t.childNodes):null,a,!r&&n?n:o?o.__e:t.firstChild,r,i),mo(a,e,i)}function Wn(e,t){Be(e,t,Wn)}function Hn(e,t,n){var r,o,a,i,s=Ne({},e.props);for(a in e.type&&e.type.defaultProps&&(i=e.type.defaultProps),t)a=="key"?r=t[a]:a=="ref"?o=t[a]:s[a]=t[a]==null&&i!=null?i[a]:t[a];return arguments.length>2&&(s.children=arguments.length>3?$t.call(arguments,2):n),Mt(e.type,s,r||e.key,o||e.ref,null)}function ie(e){function t(n){var r,o;return this.getChildContext||(r=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){r=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&r.forEach(function(i){i.__e=!0,zn(i)})},this.sub=function(a){r.add(a);var i=a.componentWillUnmount;a.componentWillUnmount=function(){r&&r.delete(a),i&&i.call(a)}}),n.children}return t.__c="__cC"+so++,t.__=e,t.Provider=t.__l=(t.Consumer=function(n,r){return n.children(r)}).contextType=t,t}$t=lo.slice,T={__e:function(e,t,n,r){for(var o,a,i;t=t.__;)if((o=t.__c)&&!o.__)try{if((a=o.constructor)&&a.getDerivedStateFromError!=null&&(o.setState(a.getDerivedStateFromError(e)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(e,r||{}),i=o.__d),i)return o.__E=o}catch(s){e=s}throw e}},to=0,no=function(e){return e!=null&&e.constructor==null},be.prototype.setState=function(e,t){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=Ne({},this.state),typeof e=="function"&&(e=e(Ne({},n),this.props)),e&&Ne(n,e),e!=null&&this.__v&&(t&&this._sb.push(t),zn(this))},be.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),zn(this))},be.prototype.render=ee,tt=[],oo=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,ao=function(e,t){return e.__v.__b-t.__v.__b},Gt.__r=0,io=/(PointerCapture)$|Capture$/i,On=0,Ln=vo(!1),Rn=vo(!0),so=0;function Vn(){return(Vn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}var As=["context","children"];function $s(e){this.getChildContext=function(){return e.context};var t=e.children,n=function(r,o){if(r==null)return{};var a,i,s={},l=Object.keys(r);for(i=0;i<l.length;i++)o.indexOf(a=l[i])>=0||(s[a]=r[a]);return s}(e,As);return Hn(t,n)}function Is(){var e=new CustomEvent("_preact",{detail:{},bubbles:!0,cancelable:!0});this.dispatchEvent(e),this._vdom=K($s,Vn({},this._props,{context:e.detail.context}),function t(n,r){if(n.nodeType===3)return n.data;if(n.nodeType!==1)return null;var o=[],a={},i=0,s=n.attributes,l=n.childNodes;for(i=s.length;i--;)s[i].name!=="slot"&&(a[s[i].name]=s[i].value,a[wo(s[i].name)]=s[i].value);for(i=l.length;i--;){var c=t(l[i],null),f=l[i].slot;f?a[f]=K(yo,{name:f},c):o[i]=c}var u=r?K(yo,null,o):o;return K(r||n.nodeName.toLowerCase(),a,u)}(this,this._vdomComponent)),(this.hasAttribute("hydrate")?Wn:Be)(this._vdom,this._root)}function wo(e){return e.replace(/-(\w)/g,function(t,n){return n?n.toUpperCase():""})}function Ds(e,t,n){if(this._vdom){var r={};r[e]=n=n??void 0,r[wo(e)]=n,this._vdom=Hn(this._vdom,r),Be(this._vdom,this._root)}}function Ms(){Be(this._vdom=null,this._root)}function yo(e,t){var n=this;return K("slot",Vn({},e,{ref:function(r){r?(n.ref=r,n._listener||(n._listener=function(o){o.stopPropagation(),o.detail.context=t},r.addEventListener("_preact",n._listener))):n.ref.removeEventListener("_preact",n._listener)}}))}function Os(e,t,n,r){function o(){var a=Reflect.construct(HTMLElement,[],o);return a._vdomComponent=e,a._root=r&&r.shadow?a.attachShadow({mode:r.mode||"open"}):a,a}return(o.prototype=Object.create(HTMLElement.prototype)).constructor=o,o.prototype.connectedCallback=Is,o.prototype.attributeChangedCallback=Ds,o.prototype.disconnectedCallback=Ms,n=n||e.observedAttributes||Object.keys(e.propTypes||{}),o.observedAttributes=n,n.forEach(function(a){Object.defineProperty(o.prototype,a,{get:function(){return this._vdom.props[a]},set:function(i){this._vdom?this.attributeChangedCallback(a,null,i):(this._props||(this._props={}),this._props[a]=i,this.connectedCallback());var s=typeof i;i!=null&&s!=="string"&&s!=="boolean"&&s!=="number"||this.setAttribute(a,i)}})}),customElements.define(t||e.tagName||e.displayName||e.name,o)}var Ls=0;function d(e,t,n,r,o,a){t||(t={});var i,s,l=t;if("ref"in l)for(s in l={},t)s=="ref"?i=t[s]:l[s]=t[s];var c={type:e,props:l,key:n,ref:i,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Ls,__i:-1,__u:0,__source:o,__self:a};if(typeof e=="function"&&(i=e.defaultProps))for(s in i)l[s]===void 0&&(l[s]=i[s]);return T.vnode&&T.vnode(c),c}var Me,W,jn,bo,dt=0,xo=[],Z=T,Co=Z.__b,ko=Z.__r,So=Z.diffed,Eo=Z.__c,To=Z.unmount,No=Z.__;function nt(e,t){Z.__h&&Z.__h(W,e,dt||t),dt=0;var n=W.__H||(W.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function S(e){return dt=1,Jt(Ao,e)}function Jt(e,t,n){var r=nt(Me++,2);if(r.t=e,!r.__c&&(r.__=[n?n(t):Ao(void 0,t),function(s){var l=r.__N?r.__N[0]:r.__[0],c=r.t(l,s);l!==c&&(r.__N=[c,r.__[1]],r.__c.setState({}))}],r.__c=W,!W.__f)){var o=function(s,l,c){if(!r.__c.__H)return!0;var f=r.__c.__H.__.filter(function(v){return!!v.__c});if(f.every(function(v){return!v.__N}))return!a||a.call(this,s,l,c);var u=r.__c.props!==s;return f.forEach(function(v){if(v.__N){var h=v.__[0];v.__=v.__N,v.__N=void 0,h!==v.__[0]&&(u=!0)}}),a&&a.call(this,s,l,c)||u};W.__f=!0;var a=W.shouldComponentUpdate,i=W.componentWillUpdate;W.componentWillUpdate=function(s,l,c){if(this.__e){var f=a;a=void 0,o(s,l,c),a=f}i&&i.call(this,s,l,c)},W.shouldComponentUpdate=o}return r.__N||r.__}function A(e,t){var n=nt(Me++,3);!Z.__s&&Gn(n.__H,t)&&(n.__=e,n.u=t,W.__H.__h.push(n))}function Oe(e,t){var n=nt(Me++,4);!Z.__s&&Gn(n.__H,t)&&(n.__=e,n.u=t,W.__h.push(n))}function E(e){return dt=5,B(function(){return{current:e}},[])}function Yn(e,t,n){dt=6,Oe(function(){if(typeof e=="function"){var r=e(t());return function(){e(null),r&&typeof r=="function"&&r()}}if(e)return e.current=t(),function(){return e.current=null}},n==null?n:n.concat(e))}function B(e,t){var n=nt(Me++,7);return Gn(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function $(e,t){return dt=8,B(function(){return e},t)}function We(e){var t=W.context[e.__c],n=nt(Me++,9);return n.c=e,t?(n.__==null&&(n.__=!0,t.sub(W)),t.props.value):e.__}function qn(e,t){Z.useDebugValue&&Z.useDebugValue(t?t(e):e)}function Rs(e){var t=nt(Me++,10),n=S();return t.__=e,W.componentDidCatch||(W.componentDidCatch=function(r,o){t.__&&t.__(r,o),n[1](r)}),[n[0],function(){n[1](void 0)}]}function Xn(){var e=nt(Me++,11);if(!e.__){for(var t=W.__v;t!==null&&!t.__m&&t.__!==null;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Fs(){for(var e;e=xo.shift();)if(e.__P&&e.__H)try{e.__H.__h.forEach(Qt),e.__H.__h.forEach(Kn),e.__H.__h=[]}catch(t){e.__H.__h=[],Z.__e(t,e.__v)}}Z.__b=function(e){W=null,Co&&Co(e)},Z.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),No&&No(e,t)},Z.__r=function(e){ko&&ko(e),Me=0;var t=(W=e.__c).__H;t&&(jn===W?(t.__h=[],W.__h=[],t.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(t.__h.forEach(Qt),t.__h.forEach(Kn),t.__h=[],Me=0)),jn=W},Z.diffed=function(e){So&&So(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(xo.push(t)!==1&&bo===Z.requestAnimationFrame||((bo=Z.requestAnimationFrame)||zs)(Fs)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0})),jn=W=null},Z.__c=function(e,t){t.some(function(n){try{n.__h.forEach(Qt),n.__h=n.__h.filter(function(r){return!r.__||Kn(r)})}catch(r){t.some(function(o){o.__h&&(o.__h=[])}),t=[],Z.__e(r,n.__v)}}),Eo&&Eo(e,t)},Z.unmount=function(e){To&&To(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.forEach(function(r){try{Qt(r)}catch(o){t=o}}),n.__H=void 0,t&&Z.__e(t,n.__v))};var Po=typeof requestAnimationFrame=="function";function zs(e){var t,n=function(){clearTimeout(r),Po&&cancelAnimationFrame(t),setTimeout(e)},r=setTimeout(n,100);Po&&(t=requestAnimationFrame(n))}function Qt(e){var t=W,n=e.__c;typeof n=="function"&&(e.__c=void 0,n()),W=t}function Kn(e){var t=W;e.__c=e.__(),W=t}function Gn(e,t){return!e||e.length!==t.length||t.some(function(n,r){return n!==e[r]})}function Ao(e,t){return typeof t=="function"?t(e):t}function $o(e,t){for(var n in t)e[n]=t[n];return e}function Zn(e,t){for(var n in e)if(n!=="__source"&&!(n in t))return!0;for(var r in t)if(r!=="__source"&&e[r]!==t[r])return!0;return!1}function Jn(e,t){var n=t(),r=S({t:{__:n,u:t}}),o=r[0].t,a=r[1];return Oe(function(){o.__=n,o.u=t,Qn(o)&&a({t:o})},[e,n,t]),A(function(){return Qn(o)&&a({t:o}),e(function(){Qn(o)&&a({t:o})})},[e]),n}function Qn(e){var t,n,r=e.u,o=e.__;try{var a=r();return!((t=o)===(n=a)&&(t!==0||1/t==1/n)||t!=t&&n!=n)}catch{return!0}}function er(e){e()}function tr(e){return e}function nr(){return[!1,er]}var rr=Oe;function en(e,t){this.props=e,this.context=t}function tn(e,t){function n(o){var a=this.props.ref,i=a==o.ref;return!i&&a&&(a.call?a(null):a.current=null),t?!t(this.props,o)||!i:Zn(this.props,o)}function r(o){return this.shouldComponentUpdate=n,K(e,o)}return r.displayName="Memo("+(e.displayName||e.name)+")",r.prototype.isReactComponent=!0,r.__f=!0,r}(en.prototype=new be).isPureReactComponent=!0,en.prototype.shouldComponentUpdate=function(e,t){return Zn(this.props,e)||Zn(this.state,t)};var Io=T.__b;T.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Io&&Io(e)};var Us=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.forward_ref")||3911;function I(e){function t(n){var r=$o({},n);return delete r.ref,e(r,n.ref||null)}return t.$$typeof=Us,t.render=t,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t}var Do=function(e,t){return e==null?null:De(De(e).map(t))},He={map:Do,forEach:Do,count:function(e){return e?De(e).length:0},only:function(e){var t=De(e);if(t.length!==1)throw"Children.only";return t[0]},toArray:De},Bs=T.__e;T.__e=function(e,t,n,r){if(e.then){for(var o,a=t;a=a.__;)if((o=a.__c)&&o.__c)return t.__e==null&&(t.__e=n.__e,t.__k=n.__k),o.__c(e,t)}Bs(e,t,n,r)};var Mo=T.unmount;function Oo(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(r){typeof r.__c=="function"&&r.__c()}),e.__c.__H=null),(e=$o({},e)).__c!=null&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(r){return Oo(r,t,n)})),e}function Lo(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(r){return Lo(r,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Ot(){this.__u=0,this.o=null,this.__b=null}function Ro(e){var t=e.__.__c;return t&&t.__a&&t.__a(e)}function Fo(e){var t,n,r;function o(a){if(t||(t=e()).then(function(i){n=i.default||i},function(i){r=i}),r)throw r;if(!n)throw t;return K(n,a)}return o.displayName="Lazy",o.__f=!0,o}function ft(){this.i=null,this.l=null}T.unmount=function(e){var t=e.__c;t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),Mo&&Mo(e)},(Ot.prototype=new be).__c=function(e,t){var n=t.__c,r=this;r.o==null&&(r.o=[]),r.o.push(n);var o=Ro(r.__v),a=!1,i=function(){a||(a=!0,n.__R=null,o?o(s):s())};n.__R=i;var s=function(){if(!--r.__u){if(r.state.__a){var l=r.state.__a;r.__v.__k[0]=Lo(l,l.__c.__P,l.__c.__O)}var c;for(r.setState({__a:r.__b=null});c=r.o.pop();)c.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),e.then(i,i)},Ot.prototype.componentWillUnmount=function(){this.o=[]},Ot.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),r=this.__v.__k[0].__c;this.__v.__k[0]=Oo(this.__b,n,r.__O=r.__P)}this.__b=null}var o=t.__a&&K(ee,null,e.fallback);return o&&(o.__u&=-33),[K(ee,null,t.__a?null:e.children),o]};var zo=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&(e.props.revealOrder[0]!=="t"||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function Ws(e){return this.getChildContext=function(){return e.context},e.children}function Hs(e){var t=this,n=e.h;t.componentWillUnmount=function(){Be(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),t.v||(t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],contains:function(){return!0},appendChild:function(r){this.childNodes.push(r),t.h.appendChild(r)},insertBefore:function(r,o){this.childNodes.push(r),t.h.insertBefore(r,o)},removeChild:function(r){this.childNodes.splice(this.childNodes.indexOf(r)>>>1,1),t.h.removeChild(r)}}),Be(K(Ws,{context:t.context},e.__v),t.v)}function nn(e,t){var n=K(Hs,{__v:e,h:t});return n.containerInfo=t,n}(ft.prototype=new be).__a=function(e){var t=this,n=Ro(t.__v),r=t.l.get(e);return r[0]++,function(o){var a=function(){t.props.revealOrder?(r.push(o),zo(t,e,r)):o()};n?n(a):a()}},ft.prototype.render=function(e){this.i=null,this.l=new Map;var t=De(e.children);e.revealOrder&&e.revealOrder[0]==="b"&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},ft.prototype.componentDidUpdate=ft.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){zo(e,n,t)})};var Uo=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103,Vs=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,js=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,Ys=/[A-Z0-9]/g,qs=typeof document<"u",Xs=function(e){return(typeof Symbol<"u"&&typeof Symbol()=="symbol"?/fil|che|rad/:/fil|che|ra/).test(e)};function Bo(e,t,n){return t.__k==null&&(t.textContent=""),Be(e,t),typeof n=="function"&&n(),e?e.__c:null}function Wo(e,t,n){return Wn(e,t),typeof n=="function"&&n(),e?e.__c:null}be.prototype.isReactComponent={},["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(be.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var Ho=T.event;function Ks(){}function Gs(){return this.cancelBubble}function Zs(){return this.defaultPrevented}T.event=function(e){return Ho&&(e=Ho(e)),e.persist=Ks,e.isPropagationStopped=Gs,e.isDefaultPrevented=Zs,e.nativeEvent=e};var or,Js={enumerable:!1,configurable:!0,get:function(){return this.class}},Vo=T.vnode;T.vnode=function(e){typeof e.type=="string"&&function(t){var n=t.props,r=t.type,o={},a=r.indexOf("-")===-1;for(var i in n){var s=n[i];if(!(i==="value"&&"defaultValue"in n&&s==null||qs&&i==="children"&&r==="noscript"||i==="class"||i==="className")){var l=i.toLowerCase();i==="defaultValue"&&"value"in n&&n.value==null?i="value":i==="download"&&s===!0?s="":l==="translate"&&s==="no"?s=!1:l[0]==="o"&&l[1]==="n"?l==="ondoubleclick"?i="ondblclick":l!=="onchange"||r!=="input"&&r!=="textarea"||Xs(n.type)?l==="onfocus"?i="onfocusin":l==="onblur"?i="onfocusout":js.test(i)&&(i=l):l=i="oninput":a&&Vs.test(i)?i=i.replace(Ys,"-$&").toLowerCase():s===null&&(s=void 0),l==="oninput"&&o[i=l]&&(i="oninputCapture"),o[i]=s}}r=="select"&&o.multiple&&Array.isArray(o.value)&&(o.value=De(n.children).forEach(function(c){c.props.selected=o.value.indexOf(c.props.value)!=-1})),r=="select"&&o.defaultValue!=null&&(o.value=De(n.children).forEach(function(c){c.props.selected=o.multiple?o.defaultValue.indexOf(c.props.value)!=-1:o.defaultValue==c.props.value})),n.class&&!n.className?(o.class=n.class,Object.defineProperty(o,"className",Js)):(n.className&&!n.class||n.class&&n.className)&&(o.class=o.className=n.className),t.props=o}(e),e.$$typeof=Uo,Vo&&Vo(e)};var jo=T.__r;T.__r=function(e){jo&&jo(e),or=e.__c};var Yo=T.diffed;T.diffed=function(e){Yo&&Yo(e);var t=e.props,n=e.__e;n!=null&&e.type==="textarea"&&"value"in t&&t.value!==n.value&&(n.value=t.value==null?"":t.value),or=null};var qo={ReactCurrentDispatcher:{current:{readContext:function(e){return or.__n[e.__c].props.value},useCallback:$,useContext:We,useDebugValue:qn,useDeferredValue:tr,useEffect:A,useId:Xn,useImperativeHandle:Yn,useInsertionEffect:rr,useLayoutEffect:Oe,useMemo:B,useReducer:Jt,useRef:E,useState:S,useSyncExternalStore:Jn,useTransition:nr}}},Qs="18.3.1";function Xo(e){return K.bind(null,e)}function Le(e){return!!e&&e.$$typeof===Uo}function Ko(e){return Le(e)&&e.type===ee}function Go(e){return!!e&&!!e.displayName&&(typeof e.displayName=="string"||e.displayName instanceof String)&&e.displayName.startsWith("Memo(")}function Lt(e){return Le(e)?Hn.apply(null,arguments):e}function Zo(e){return!!e.__k&&(Be(null,e),!0)}function Jo(e){return e&&(e.base||e.nodeType===1&&e)||null}var Qo=function(e,t){return e(t)},rn=function(e,t){return e(t)},ea=ee,ta=Le,Re={useState:S,useId:Xn,useReducer:Jt,useEffect:A,useLayoutEffect:Oe,useInsertionEffect:rr,useTransition:nr,useDeferredValue:tr,useSyncExternalStore:Jn,startTransition:er,useRef:E,useImperativeHandle:Yn,useMemo:B,useCallback:$,useContext:We,useDebugValue:qn,version:"18.3.1",Children:He,render:Bo,hydrate:Wo,unmountComponentAtNode:Zo,createPortal:nn,createElement:K,createContext:ie,createFactory:Xo,cloneElement:Lt,createRef:co,Fragment:ee,isValidElement:Le,isElement:ta,isFragment:Ko,isMemo:Go,findDOMNode:Jo,Component:be,PureComponent:en,memo:tn,forwardRef:I,flushSync:rn,unstable_batchedUpdates:Qo,StrictMode:ea,Suspense:Ot,SuspenseList:ft,lazy:Fo,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:qo};const na=Object.freeze(Object.defineProperty({__proto__:null,Children:He,Component:be,Fragment:ee,PureComponent:en,StrictMode:ea,Suspense:Ot,SuspenseList:ft,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:qo,cloneElement:Lt,createContext:ie,createElement:K,createFactory:Xo,createPortal:nn,createRef:co,default:Re,findDOMNode:Jo,flushSync:rn,forwardRef:I,hydrate:Wo,isElement:ta,isFragment:Ko,isMemo:Go,isValidElement:Le,lazy:Fo,memo:tn,render:Bo,startTransition:er,unmountComponentAtNode:Zo,unstable_batchedUpdates:Qo,useCallback:$,useContext:We,useDebugValue:qn,useDeferredValue:tr,useEffect:A,useErrorBoundary:Rs,useId:Xn,useImperativeHandle:Yn,useInsertionEffect:rr,useLayoutEffect:Oe,useMemo:B,useReducer:Jt,useRef:E,useState:S,useSyncExternalStore:Jn,useTransition:nr,version:Qs},Symbol.toStringTag,{value:"Module"}));var el=Symbol.for("preact-signals");function on(){if(Ve>1)Ve--;else{for(var e,t=!1;Rt!==void 0;){var n=Rt;for(Rt=void 0,ar++;n!==void 0;){var r=n.o;if(n.o=void 0,n.f&=-3,!(8&n.f)&&aa(n))try{n.c()}catch(o){t||(e=o,t=!0)}n=r}}if(ar=0,Ve--,t)throw e}}function ra(e){if(Ve>0)return e();Ve++;try{return e()}finally{on()}}var H=void 0,Rt=void 0,Ve=0,ar=0,an=0;function oa(e){if(H!==void 0){var t=e.n;if(t===void 0||t.t!==H)return t={i:0,S:e,p:H.s,n:void 0,t:H,e:void 0,x:void 0,r:t},H.s!==void 0&&(H.s.n=t),H.s=t,e.n=t,32&H.f&&e.S(t),t;if(t.i===-1)return t.i=0,t.n!==void 0&&(t.n.p=t.p,t.p!==void 0&&(t.p.n=t.n),t.p=H.s,t.n=void 0,H.s.n=t,H.s=t),t}}function se(e){this.v=e,this.i=0,this.n=void 0,this.t=void 0}se.prototype.brand=el,se.prototype.h=function(){return!0},se.prototype.S=function(e){this.t!==e&&e.e===void 0&&(e.x=this.t,this.t!==void 0&&(this.t.e=e),this.t=e)},se.prototype.U=function(e){if(this.t!==void 0){var t=e.e,n=e.x;t!==void 0&&(t.x=n,e.e=void 0),n!==void 0&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n)}},se.prototype.subscribe=function(e){var t=this;return ht(function(){var n=t.value,r=H;H=void 0;try{e(n)}finally{H=r}})},se.prototype.valueOf=function(){return this.value},se.prototype.toString=function(){return this.value+""},se.prototype.toJSON=function(){return this.value},se.prototype.peek=function(){var e=H;H=void 0;try{return this.value}finally{H=e}},Object.defineProperty(se.prototype,"value",{get:function(){var e=oa(this);return e!==void 0&&(e.i=this.i),this.v},set:function(e){if(e!==this.v){if(ar>100)throw new Error("Cycle detected");this.v=e,this.i++,an++,Ve++;try{for(var t=this.t;t!==void 0;t=t.x)t.t.N()}finally{on()}}}});function ve(e){return new se(e)}function aa(e){for(var t=e.s;t!==void 0;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function ia(e){for(var t=e.s;t!==void 0;t=t.n){var n=t.S.n;if(n!==void 0&&(t.r=n),t.S.n=t,t.i=-1,t.n===void 0){e.s=t;break}}}function sa(e){for(var t=e.s,n=void 0;t!==void 0;){var r=t.p;t.i===-1?(t.S.U(t),r!==void 0&&(r.n=t.n),t.n!==void 0&&(t.n.p=r)):n=t,t.S.n=t.r,t.r!==void 0&&(t.r=void 0),t=r}e.s=n}function pt(e){se.call(this,void 0),this.x=e,this.s=void 0,this.g=an-1,this.f=4}(pt.prototype=new se).h=function(){if(this.f&=-3,1&this.f)return!1;if((36&this.f)==32||(this.f&=-5,this.g===an))return!0;if(this.g=an,this.f|=1,this.i>0&&!aa(this))return this.f&=-2,!0;var e=H;try{ia(this),H=this;var t=this.x();(16&this.f||this.v!==t||this.i===0)&&(this.v=t,this.f&=-17,this.i++)}catch(n){this.v=n,this.f|=16,this.i++}return H=e,sa(this),this.f&=-2,!0},pt.prototype.S=function(e){if(this.t===void 0){this.f|=36;for(var t=this.s;t!==void 0;t=t.n)t.S.S(t)}se.prototype.S.call(this,e)},pt.prototype.U=function(e){if(this.t!==void 0&&(se.prototype.U.call(this,e),this.t===void 0)){this.f&=-33;for(var t=this.s;t!==void 0;t=t.n)t.S.U(t)}},pt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(var e=this.t;e!==void 0;e=e.x)e.t.N()}},Object.defineProperty(pt.prototype,"value",{get:function(){if(1&this.f)throw new Error("Cycle detected");var e=oa(this);if(this.h(),e!==void 0&&(e.i=this.i),16&this.f)throw this.v;return this.v}});function me(e){return new pt(e)}function la(e){var t=e.u;if(e.u=void 0,typeof t=="function"){Ve++;var n=H;H=void 0;try{t()}catch(r){throw e.f&=-2,e.f|=8,ir(e),r}finally{H=n,on()}}}function ir(e){for(var t=e.s;t!==void 0;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,la(e)}function tl(e){if(H!==this)throw new Error("Out-of-order effect");sa(this),H=e,this.f&=-2,8&this.f&&ir(this),on()}function Ft(e){this.x=e,this.u=void 0,this.s=void 0,this.o=void 0,this.f=32}Ft.prototype.c=function(){var e=this.S();try{if(8&this.f||this.x===void 0)return;var t=this.x();typeof t=="function"&&(this.u=t)}finally{e()}},Ft.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,la(this),ia(this),Ve++;var e=H;return H=this,tl.bind(this,e)},Ft.prototype.N=function(){2&this.f||(this.f|=2,this.o=Rt,Rt=this)},Ft.prototype.d=function(){this.f|=8,1&this.f||ir(this)};function ht(e){var t=new Ft(e);try{t.c()}catch(n){throw t.d(),n}return t.d.bind(t)}var sr,sn,lr,ca=[],ua=[];ht(function(){sr=this.N})();function vt(e,t){T[e]=t.bind(null,T[e]||function(){})}function ln(e){lr&&lr(),lr=e&&e.S()}function da(e){var t=this,n=e.data,r=xe(n);r.value=n;var o=B(function(){for(var s=t,l=t.__v;l=l.__;)if(l.__c){l.__c.__$f|=4;break}var c=me(function(){var h=r.value.value;return h===0?0:h===!0?"":h||""}),f=me(function(){return!Array.isArray(c.value)&&!no(c.value)}),u=ht(function(){if(this.N=fa,f.value){var h=c.value;s.__v&&s.__v.__e&&s.__v.__e.nodeType===3&&(s.__v.__e.data=h)}}),v=t.__$u.d;return t.__$u.d=function(){u(),v.call(this)},[f,c]},[]),a=o[0],i=o[1];return a.value?i.peek():i.value}da.displayName="_st",Object.defineProperties(se.prototype,{constructor:{configurable:!0,value:void 0},type:{configurable:!0,value:da},props:{configurable:!0,get:function(){return{data:this}}},__b:{configurable:!0,value:1}}),vt("__b",function(e,t){if(typeof t.type=="string"){var n,r=t.props;for(var o in r)if(o!=="children"){var a=r[o];a instanceof se&&(n||(t.__np=n={}),n[o]=a,r[o]=a.peek())}}e(t)}),vt("__r",function(e,t){ln();var n,r=t.__c;r&&(r.__$f&=-2,(n=r.__$u)===void 0&&(r.__$u=n=function(o){var a;return ht(function(){a=this}),a.c=function(){r.__$f|=1,r.setState({})},a}())),sn=r,ln(n),e(t)}),vt("__e",function(e,t,n,r){ln(),sn=void 0,e(t,n,r)}),vt("diffed",function(e,t){ln(),sn=void 0;var n;if(typeof t.type=="string"&&(n=t.__e)){var r=t.__np,o=t.props;if(r){var a=n.U;if(a)for(var i in a){var s=a[i];s!==void 0&&!(i in r)&&(s.d(),a[i]=void 0)}else a={},n.U=a;for(var l in r){var c=a[l],f=r[l];c===void 0?(c=nl(n,l,f,o),a[l]=c):c.o(f,o)}}}e(t)});function nl(e,t,n,r){var o=t in e&&e.ownerSVGElement===void 0,a=ve(n);return{o:function(i,s){a.value=i,r=s},d:ht(function(){this.N=fa;var i=a.value.value;r[t]!==i&&(r[t]=i,o?e[t]=i:i?e.setAttribute(t,i):e.removeAttribute(t))})}}vt("unmount",function(e,t){if(typeof t.type=="string"){var n=t.__e;if(n){var r=n.U;if(r){n.U=void 0;for(var o in r){var a=r[o];a&&a.d()}}}}else{var i=t.__c;if(i){var s=i.__$u;s&&(i.__$u=void 0,s.d())}}e(t)}),vt("__h",function(e,t,n,r){(r<3||r===9)&&(t.__$f|=2),e(t,n,r)}),be.prototype.shouldComponentUpdate=function(e,t){var n=this.__$u,r=n&&n.s!==void 0;for(var o in t)return!0;if(this.__f||typeof this.u=="boolean"&&this.u===!0){var a=2&this.__$f;if(!(r||a||4&this.__$f)||1&this.__$f)return!0}else if(!(r||4&this.__$f)||3&this.__$f)return!0;for(var i in e)if(i!=="__source"&&e[i]!==this.props[i])return!0;for(var s in this.props)if(!(s in e))return!0;return!1};function xe(e){return B(function(){return ve(e)},[])}function Q(e){var t=E(e);return t.current=e,sn.__$f|=4,B(function(){return me(function(){return t.current()})},[])}var rl=typeof requestAnimationFrame>"u"?setTimeout:function(e){var t=function(){clearTimeout(n),cancelAnimationFrame(r),e()},n=setTimeout(t,100),r=requestAnimationFrame(t)},ol=function(e){queueMicrotask(function(){queueMicrotask(e)})};function al(){ra(function(){for(var e;e=ca.shift();)sr.call(e)})}function il(){ca.push(this)===1&&(T.requestAnimationFrame||rl)(al)}function sl(){ra(function(){for(var e;e=ua.shift();)sr.call(e)})}function fa(){ua.push(this)===1&&(T.requestAnimationFrame||ol)(sl)}function je(e){var t=E(e);t.current=e,A(function(){return ht(function(){return this.N=il,t.current()})},[])}function cn(){return cn=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},cn.apply(null,arguments)}const pa=new Uint8Array(0);class zt{static getFullOptions(t){return cn({clientTools:{},onConnect:()=>{},onDebug:()=>{},onDisconnect:()=>{},onError:()=>{},onMessage:()=>{},onAudio:()=>{},onModeChange:()=>{},onStatusChange:()=>{},onCanSendFeedbackChange:()=>{}},t)}constructor(t,n){var r=this;this.options=void 0,this.connection=void 0,this.lastInterruptTimestamp=0,this.mode="listening",this.status="connecting",this.volume=1,this.currentEventId=1,this.lastFeedbackEventId=1,this.canSendFeedback=!1,this.endSessionWithDetails=async function(o){r.status!=="connected"&&r.status!=="connecting"||(r.updateStatus("disconnecting"),await r.handleEndSession(),r.updateStatus("disconnected"),r.options.onDisconnect(o))},this.onMessage=async function(o){switch(o.type){case"interruption":return void r.handleInterruption(o);case"agent_response":return void r.handleAgentResponse(o);case"user_transcript":return void r.handleUserTranscript(o);case"internal_tentative_agent_response":return void r.handleTentativeAgentResponse(o);case"client_tool_call":return void await r.handleClientToolCall(o);case"audio":return void r.handleAudio(o);case"ping":return void r.connection.sendMessage({type:"pong",event_id:o.ping_event.event_id});default:return void r.options.onDebug(o)}},this.setVolume=({volume:o})=>{this.volume=o},this.options=t,this.connection=n,this.options.onConnect({conversationId:n.conversationId}),this.connection.onDisconnect(this.endSessionWithDetails),this.connection.onMessage(this.onMessage),this.updateStatus("connected")}endSession(){return this.endSessionWithDetails({reason:"user"})}async handleEndSession(){this.connection.close()}updateMode(t){t!==this.mode&&(this.mode=t,this.options.onModeChange({mode:t}))}updateStatus(t){t!==this.status&&(this.status=t,this.options.onStatusChange({status:t}))}updateCanSendFeedback(){const t=this.currentEventId!==this.lastFeedbackEventId;this.canSendFeedback!==t&&(this.canSendFeedback=t,this.options.onCanSendFeedbackChange({canSendFeedback:t}))}handleInterruption(t){t.interruption_event&&(this.lastInterruptTimestamp=t.interruption_event.event_id)}handleAgentResponse(t){this.options.onMessage({source:"ai",message:t.agent_response_event.agent_response})}handleUserTranscript(t){this.options.onMessage({source:"user",message:t.user_transcription_event.user_transcript})}handleTentativeAgentResponse(t){this.options.onDebug({type:"tentative_agent_response",response:t.tentative_agent_response_internal_event.tentative_agent_response})}async handleClientToolCall(t){if(this.options.clientTools.hasOwnProperty(t.client_tool_call.tool_name))try{var n;const r=(n=await this.options.clientTools[t.client_tool_call.tool_name](t.client_tool_call.parameters))!=null?n:"Client tool execution successful.",o=typeof r=="object"?JSON.stringify(r):String(r);this.connection.sendMessage({type:"client_tool_result",tool_call_id:t.client_tool_call.tool_call_id,result:o,is_error:!1})}catch(r){this.onError("Client tool execution failed with following error: "+(r==null?void 0:r.message),{clientToolName:t.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:t.client_tool_call.tool_call_id,result:"Client tool execution failed: "+(r==null?void 0:r.message),is_error:!0})}else{if(this.options.onUnhandledClientToolCall)return void this.options.onUnhandledClientToolCall(t.client_tool_call);this.onError(`Client tool with name ${t.client_tool_call.tool_name} is not defined on client`,{clientToolName:t.client_tool_call.tool_name}),this.connection.sendMessage({type:"client_tool_result",tool_call_id:t.client_tool_call.tool_call_id,result:`Client tool with name ${t.client_tool_call.tool_name} is not defined on client`,is_error:!0})}}handleAudio(t){}onError(t,n){console.error(t,n),this.options.onError(t,n)}getId(){return this.connection.conversationId}isOpen(){return this.status==="connected"}setMicMuted(t){}getInputByteFrequencyData(){return pa}getOutputByteFrequencyData(){return pa}getInputVolume(){return 0}getOutputVolume(){return 0}sendFeedback(t){this.canSendFeedback?(this.connection.sendMessage({type:"feedback",score:t?"like":"dislike",event_id:this.currentEventId}),this.lastFeedbackEventId=this.currentEventId,this.updateCanSendFeedback()):console.warn(this.lastFeedbackEventId===0?"Cannot send feedback: the conversation has not started yet.":"Cannot send feedback: feedback has already been sent for the current response.")}sendContextualUpdate(t){this.connection.sendMessage({type:"contextual_update",text:t})}sendUserMessage(t){this.connection.sendMessage({type:"user_message",text:t})}sendUserActivity(){this.connection.sendMessage({type:"user_activity"})}}function ha(e){return!!e.type}class un{static async create(t){let n=null;try{var r;const a=(r=t.origin)!=null?r:"wss://api.elevenlabs.io",i=t.signedUrl?t.signedUrl:a+"/v1/convai/conversation?agent_id="+t.agentId,s=["convai"];t.authorization&&s.push(`bearer.${t.authorization}`),n=new WebSocket(i,s);const l=await new Promise((g,p)=>{n.addEventListener("open",()=>{var m;const _={type:"conversation_initiation_client_data"};var w,y,b,C,k;t.overrides&&(_.conversation_config_override={agent:{prompt:(w=t.overrides.agent)==null?void 0:w.prompt,first_message:(y=t.overrides.agent)==null?void 0:y.firstMessage,language:(b=t.overrides.agent)==null?void 0:b.language},tts:{voice_id:(C=t.overrides.tts)==null?void 0:C.voiceId},conversation:{text_only:(k=t.overrides.conversation)==null?void 0:k.textOnly}}),t.customLlmExtraBody&&(_.custom_llm_extra_body=t.customLlmExtraBody),t.dynamicVariables&&(_.dynamic_variables=t.dynamicVariables),(m=n)==null||m.send(JSON.stringify(_))},{once:!0}),n.addEventListener("error",m=>{setTimeout(()=>p(m),0)}),n.addEventListener("close",p),n.addEventListener("message",m=>{const _=JSON.parse(m.data);ha(_)&&(_.type==="conversation_initiation_metadata"?g(_.conversation_initiation_metadata_event):console.warn("First received message is not conversation metadata."))},{once:!0})}),{conversation_id:c,agent_output_audio_format:f,user_input_audio_format:u}=l,v=va(u??"pcm_16000"),h=va(f);return new un(n,c,v,h)}catch(a){var o;throw(o=n)==null||o.close(),a}}constructor(t,n,r,o){this.socket=void 0,this.conversationId=void 0,this.inputFormat=void 0,this.outputFormat=void 0,this.queue=[],this.disconnectionDetails=null,this.onDisconnectCallback=null,this.onMessageCallback=null,this.socket=t,this.conversationId=n,this.inputFormat=r,this.outputFormat=o,this.socket.addEventListener("error",a=>{setTimeout(()=>this.disconnect({reason:"error",message:"The connection was closed due to a socket error.",context:a}),0)}),this.socket.addEventListener("close",a=>{this.disconnect(a.code===1e3?{reason:"agent",context:a}:{reason:"error",message:a.reason||"The connection was closed by the server.",context:a})}),this.socket.addEventListener("message",a=>{try{const i=JSON.parse(a.data);if(!ha(i))return;this.onMessageCallback?this.onMessageCallback(i):this.queue.push(i)}catch{}})}close(){this.socket.close()}sendMessage(t){this.socket.send(JSON.stringify(t))}onMessage(t){this.onMessageCallback=t,this.queue.forEach(t),this.queue=[]}onDisconnect(t){this.onDisconnectCallback=t,this.disconnectionDetails&&t(this.disconnectionDetails)}disconnect(t){var n;this.disconnectionDetails||(this.disconnectionDetails=t,(n=this.onDisconnectCallback)==null||n.call(this,t))}}function va(e){const[t,n]=e.split("_");if(!["pcm","ulaw"].includes(t))throw new Error(`Invalid format: ${e}`);const r=parseInt(n);if(isNaN(r))throw new Error(`Invalid sample rate: ${n}`);return{format:t,sampleRate:r}}function ma(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}async function ga(e={default:0,android:3e3}){let t=e.default;var n;if(/android/i.test(navigator.userAgent))t=(n=e.android)!=null?n:t;else if(ma()){var r;t=(r=e.ios)!=null?r:t}t>0&&await new Promise(o=>setTimeout(o,t))}class cr extends zt{static async startSession(t){const n=zt.getFullOptions(t);n.onStatusChange({status:"connecting"}),n.onCanSendFeedbackChange({canSendFeedback:!1});let r=null;try{return await ga(n.connectionDelay),r=await un.create(t),new cr(n,r)}catch(a){var o;throw n.onStatusChange({status:"disconnected"}),(o=r)==null||o.close(),a}}}function ll(e){const t=new Uint8Array(e);return window.btoa(String.fromCharCode(...t))}function cl(e){const t=window.atob(e),n=t.length,r=new Uint8Array(n);for(let o=0;o<n;o++)r[o]=t.charCodeAt(o);return r.buffer}const ur=new Map;function _a(e,t){return async n=>{const r=ur.get(e);if(r)return n.addModule(r);const o=new Blob([t],{type:"application/javascript"}),a=URL.createObjectURL(o);try{return await n.addModule(a),void ur.set(e,a)}catch{URL.revokeObjectURL(a)}try{const i=`data:application/javascript;base64,${btoa(t)}`;await n.addModule(i),ur.set(e,i)}catch{throw new Error(`Failed to load the ${e} worklet module. Make sure the browser supports AudioWorklets.`)}}}const ul=_a("raw-audio-processor",`
2
+ const BIAS = 0x84;
3
+ const CLIP = 32635;
4
+ const encodeTable = [
5
+ 0,0,1,1,2,2,2,2,3,3,3,3,3,3,3,3,
6
+ 4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,4,
7
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
8
+ 5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
9
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
10
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
11
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
12
+ 6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
13
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
14
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
15
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
16
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
17
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
18
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
19
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
20
+ 7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7
21
+ ];
22
+
23
+ function encodeSample(sample) {
24
+ let sign;
25
+ let exponent;
26
+ let mantissa;
27
+ let muLawSample;
28
+ sign = (sample >> 8) & 0x80;
29
+ if (sign !== 0) sample = -sample;
30
+ sample = sample + BIAS;
31
+ if (sample > CLIP) sample = CLIP;
32
+ exponent = encodeTable[(sample>>7) & 0xFF];
33
+ mantissa = (sample >> (exponent+3)) & 0x0F;
34
+ muLawSample = ~(sign | (exponent << 4) | mantissa);
35
+
36
+ return muLawSample;
37
+ }
38
+
39
+ class RawAudioProcessor extends AudioWorkletProcessor {
40
+ constructor() {
41
+ super();
42
+
43
+ this.port.onmessage = ({ data }) => {
44
+ switch (data.type) {
45
+ case "setFormat":
46
+ this.isMuted = false;
47
+ this.buffer = []; // Initialize an empty buffer
48
+ this.bufferSize = data.sampleRate / 4;
49
+ this.format = data.format;
50
+
51
+ if (globalThis.LibSampleRate && sampleRate !== data.sampleRate) {
52
+ globalThis.LibSampleRate.create(1, sampleRate, data.sampleRate).then(resampler => {
53
+ this.resampler = resampler;
54
+ });
55
+ }
56
+ break;
57
+ case "setMuted":
58
+ this.isMuted = data.isMuted;
59
+ break;
60
+ }
61
+ };
62
+ }
63
+ process(inputs) {
64
+ if (!this.buffer) {
65
+ return true;
66
+ }
67
+
68
+ const input = inputs[0]; // Get the first input node
69
+ if (input.length > 0) {
70
+ let channelData = input[0]; // Get the first channel's data
71
+
72
+ // Resample the audio if necessary
73
+ if (this.resampler) {
74
+ channelData = this.resampler.full(channelData);
75
+ }
76
+
77
+ // Add channel data to the buffer
78
+ this.buffer.push(...channelData);
79
+ // Get max volume
80
+ let sum = 0.0;
81
+ for (let i = 0; i < channelData.length; i++) {
82
+ sum += channelData[i] * channelData[i];
83
+ }
84
+ const maxVolume = Math.sqrt(sum / channelData.length);
85
+ // Check if buffer size has reached or exceeded the threshold
86
+ if (this.buffer.length >= this.bufferSize) {
87
+ const float32Array = this.isMuted
88
+ ? new Float32Array(this.buffer.length)
89
+ : new Float32Array(this.buffer);
90
+
91
+ let encodedArray = this.format === "ulaw"
92
+ ? new Uint8Array(float32Array.length)
93
+ : new Int16Array(float32Array.length);
94
+
95
+ // Iterate through the Float32Array and convert each sample to PCM16
96
+ for (let i = 0; i < float32Array.length; i++) {
97
+ // Clamp the value to the range [-1, 1]
98
+ let sample = Math.max(-1, Math.min(1, float32Array[i]));
99
+
100
+ // Scale the sample to the range [-32768, 32767]
101
+ let value = sample < 0 ? sample * 32768 : sample * 32767;
102
+ if (this.format === "ulaw") {
103
+ value = encodeSample(Math.round(value));
104
+ }
105
+
106
+ encodedArray[i] = value;
107
+ }
108
+
109
+ // Send the buffered data to the main script
110
+ this.port.postMessage([encodedArray, maxVolume]);
111
+
112
+ // Clear the buffer after sending
113
+ this.buffer = [];
114
+ }
115
+ }
116
+ return true; // Continue processing
117
+ }
118
+ }
119
+ registerProcessor("raw-audio-processor", RawAudioProcessor);
120
+ `);class dr{static async create({sampleRate:t,format:n,preferHeadphonesForIosDevices:r}){let o=null,a=null;try{const l={sampleRate:{ideal:t},echoCancellation:{ideal:!0},noiseSuppression:{ideal:!0}};if(ma()&&r){const h=(await window.navigator.mediaDevices.enumerateDevices()).find(g=>g.kind==="audioinput"&&["airpod","headphone","earphone"].find(p=>g.label.toLowerCase().includes(p)));h&&(l.deviceId={ideal:h.deviceId})}const c=navigator.mediaDevices.getSupportedConstraints().sampleRate;o=new window.AudioContext(c?{sampleRate:t}:{});const f=o.createAnalyser();c||await o.audioWorklet.addModule("https://cdn.jsdelivr.net/npm/@alexanderolsen/libsamplerate-js@2.1.2/dist/libsamplerate.worklet.js"),await ul(o.audioWorklet),a=await navigator.mediaDevices.getUserMedia({audio:l});const u=o.createMediaStreamSource(a),v=new AudioWorkletNode(o,"raw-audio-processor");return v.port.postMessage({type:"setFormat",format:n,sampleRate:t}),u.connect(f),f.connect(v),await o.resume(),new dr(o,f,v,a)}catch(l){var i,s;throw(i=a)==null||i.getTracks().forEach(c=>c.stop()),(s=o)==null||s.close(),l}}constructor(t,n,r,o){this.context=void 0,this.analyser=void 0,this.worklet=void 0,this.inputStream=void 0,this.context=t,this.analyser=n,this.worklet=r,this.inputStream=o}async close(){this.inputStream.getTracks().forEach(t=>t.stop()),await this.context.close()}setMuted(t){this.worklet.port.postMessage({type:"setMuted",isMuted:t})}}const dl=_a("audio-concat-processor",`
121
+ const decodeTable = [0,132,396,924,1980,4092,8316,16764];
122
+
123
+ export function decodeSample(muLawSample) {
124
+ let sign;
125
+ let exponent;
126
+ let mantissa;
127
+ let sample;
128
+ muLawSample = ~muLawSample;
129
+ sign = (muLawSample & 0x80);
130
+ exponent = (muLawSample >> 4) & 0x07;
131
+ mantissa = muLawSample & 0x0F;
132
+ sample = decodeTable[exponent] + (mantissa << (exponent+3));
133
+ if (sign !== 0) sample = -sample;
134
+
135
+ return sample;
136
+ }
137
+
138
+ class AudioConcatProcessor extends AudioWorkletProcessor {
139
+ constructor() {
140
+ super();
141
+ this.buffers = []; // Initialize an empty buffer
142
+ this.cursor = 0;
143
+ this.currentBuffer = null;
144
+ this.wasInterrupted = false;
145
+ this.finished = false;
146
+
147
+ this.port.onmessage = ({ data }) => {
148
+ switch (data.type) {
149
+ case "setFormat":
150
+ this.format = data.format;
151
+ break;
152
+ case "buffer":
153
+ this.wasInterrupted = false;
154
+ this.buffers.push(
155
+ this.format === "ulaw"
156
+ ? new Uint8Array(data.buffer)
157
+ : new Int16Array(data.buffer)
158
+ );
159
+ break;
160
+ case "interrupt":
161
+ this.wasInterrupted = true;
162
+ break;
163
+ case "clearInterrupted":
164
+ if (this.wasInterrupted) {
165
+ this.wasInterrupted = false;
166
+ this.buffers = [];
167
+ this.currentBuffer = null;
168
+ }
169
+ }
170
+ };
171
+ }
172
+ process(_, outputs) {
173
+ let finished = false;
174
+ const output = outputs[0][0];
175
+ for (let i = 0; i < output.length; i++) {
176
+ if (!this.currentBuffer) {
177
+ if (this.buffers.length === 0) {
178
+ finished = true;
179
+ break;
180
+ }
181
+ this.currentBuffer = this.buffers.shift();
182
+ this.cursor = 0;
183
+ }
184
+
185
+ let value = this.currentBuffer[this.cursor];
186
+ if (this.format === "ulaw") {
187
+ value = decodeSample(value);
188
+ }
189
+ output[i] = value / 32768;
190
+ this.cursor++;
191
+
192
+ if (this.cursor >= this.currentBuffer.length) {
193
+ this.currentBuffer = null;
194
+ }
195
+ }
196
+
197
+ if (this.finished !== finished) {
198
+ this.finished = finished;
199
+ this.port.postMessage({ type: "process", finished });
200
+ }
201
+
202
+ return true; // Continue processing
203
+ }
204
+ }
205
+
206
+ registerProcessor("audio-concat-processor", AudioConcatProcessor);
207
+ `);class fr{static async create({sampleRate:t,format:n}){let r=null;try{r=new AudioContext({sampleRate:t});const a=r.createAnalyser(),i=r.createGain();i.connect(a),a.connect(r.destination),await dl(r.audioWorklet);const s=new AudioWorkletNode(r,"audio-concat-processor");return s.port.postMessage({type:"setFormat",format:n}),s.connect(i),await r.resume(),new fr(r,a,i,s)}catch(a){var o;throw(o=r)==null||o.close(),a}}constructor(t,n,r,o){this.context=void 0,this.analyser=void 0,this.gain=void 0,this.worklet=void 0,this.context=t,this.analyser=n,this.gain=r,this.worklet=o}async close(){await this.context.close()}}class pr extends zt{static async startSession(t){var n;const r=zt.getFullOptions(t);r.onStatusChange({status:"connecting"}),r.onCanSendFeedbackChange({canSendFeedback:!1});let o=null,a=null,i=null,s=null,l=null;if((n=t.useWakeLock)==null||n)try{l=await navigator.wakeLock.request("screen")}catch{}try{var c;return s=await navigator.mediaDevices.getUserMedia({audio:!0}),await ga(r.connectionDelay),a=await un.create(t),[o,i]=await Promise.all([dr.create(cn({},a.inputFormat,{preferHeadphonesForIosDevices:t.preferHeadphonesForIosDevices})),fr.create(a.outputFormat)]),(c=s)==null||c.getTracks().forEach(p=>p.stop()),s=null,new pr(r,a,o,i,l)}catch(p){var f,u,v,h;r.onStatusChange({status:"disconnected"}),(f=s)==null||f.getTracks().forEach(m=>m.stop()),(u=a)==null||u.close(),await((v=o)==null?void 0:v.close()),await((h=i)==null?void 0:h.close());try{var g;await((g=l)==null?void 0:g.release()),l=null}catch{}throw p}}constructor(t,n,r,o,a){super(t,n),this.input=void 0,this.output=void 0,this.wakeLock=void 0,this.inputFrequencyData=void 0,this.outputFrequencyData=void 0,this.onInputWorkletMessage=i=>{this.status==="connected"&&this.connection.sendMessage({user_audio_chunk:ll(i.data[0].buffer)})},this.onOutputWorkletMessage=({data:i})=>{i.type==="process"&&this.updateMode(i.finished?"listening":"speaking")},this.addAudioBase64Chunk=i=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"}),this.output.worklet.port.postMessage({type:"buffer",buffer:cl(i)})},this.fadeOutAudio=()=>{this.updateMode("listening"),this.output.worklet.port.postMessage({type:"interrupt"}),this.output.gain.gain.exponentialRampToValueAtTime(1e-4,this.output.context.currentTime+2),setTimeout(()=>{this.output.gain.gain.value=this.volume,this.output.worklet.port.postMessage({type:"clearInterrupted"})},2e3)},this.calculateVolume=i=>{if(i.length===0)return 0;let s=0;for(let l=0;l<i.length;l++)s+=i[l]/255;return s/=i.length,s<0?0:s>1?1:s},this.input=r,this.output=o,this.wakeLock=a,this.input.worklet.port.onmessage=this.onInputWorkletMessage,this.output.worklet.port.onmessage=this.onOutputWorkletMessage}async handleEndSession(){await super.handleEndSession();try{var t;await((t=this.wakeLock)==null?void 0:t.release()),this.wakeLock=null}catch{}await this.input.close(),await this.output.close()}handleInterruption(t){super.handleInterruption(t),this.fadeOutAudio()}handleAudio(t){this.lastInterruptTimestamp<=t.audio_event.event_id&&(this.options.onAudio(t.audio_event.audio_base_64),this.addAudioBase64Chunk(t.audio_event.audio_base_64),this.currentEventId=t.audio_event.event_id,this.updateCanSendFeedback(),this.updateMode("speaking"))}setMicMuted(t){this.input.setMuted(t)}getInputByteFrequencyData(){return this.inputFrequencyData!=null||(this.inputFrequencyData=new Uint8Array(this.input.analyser.frequencyBinCount)),this.input.analyser.getByteFrequencyData(this.inputFrequencyData),this.inputFrequencyData}getOutputByteFrequencyData(){return this.outputFrequencyData!=null||(this.outputFrequencyData=new Uint8Array(this.output.analyser.frequencyBinCount)),this.output.analyser.getByteFrequencyData(this.outputFrequencyData),this.outputFrequencyData}getInputVolume(){return this.calculateVolume(this.getInputByteFrequencyData())}getOutputVolume(){return this.calculateVolume(this.getOutputByteFrequencyData())}}class fl extends zt{static startSession(t){return t.textOnly?cr.startSession(t):pr.startSession(t)}}function wa(e){var t,n,r="";if(typeof e=="string"||typeof e=="number")r+=e;else if(typeof e=="object")if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=wa(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Y(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=wa(e))&&(r&&(r+=" "),r+=t);return r}var pl=Object.defineProperty,hl=(e,t,n)=>t in e?pl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ue=(e,t,n)=>hl(e,typeof t!="symbol"?t+"":t,n);function mt(e){return e?e==="true"?!0:e==="false"?!1:null:null}const hr=["variant","placement","override-config","avatar-image-url","avatar-orb-color-1","avatar-orb-color-2","agent-id","signed-url","terms-key","server-location","language","dynamic-variables","show-avatar-when-collapsed","override-prompt","override-first-message","override-language","override-voice-id","override-text-only","mic-muting","transcript","text-input","text-contents"],vl='@import"https://fonts.googleapis.com/css2?family=Inter:wght@400,500&display=swap";*,:before,:after{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }::backdrop{--tw-border-spacing-x: 0;--tw-border-spacing-y: 0;--tw-translate-x: 0;--tw-translate-y: 0;--tw-rotate: 0;--tw-skew-x: 0;--tw-skew-y: 0;--tw-scale-x: 1;--tw-scale-y: 1;--tw-pan-x: ;--tw-pan-y: ;--tw-pinch-zoom: ;--tw-scroll-snap-strictness: proximity;--tw-gradient-from-position: ;--tw-gradient-via-position: ;--tw-gradient-to-position: ;--tw-ordinal: ;--tw-slashed-zero: ;--tw-numeric-figure: ;--tw-numeric-spacing: ;--tw-numeric-fraction: ;--tw-ring-inset: ;--tw-ring-offset-width: 0px;--tw-ring-offset-color: #fff;--tw-ring-color: rgb(59 130 246 / .5);--tw-ring-offset-shadow: 0 0 #0000;--tw-ring-shadow: 0 0 #0000;--tw-shadow: 0 0 #0000;--tw-shadow-colored: 0 0 #0000;--tw-blur: ;--tw-brightness: ;--tw-contrast: ;--tw-grayscale: ;--tw-hue-rotate: ;--tw-invert: ;--tw-saturate: ;--tw-sepia: ;--tw-drop-shadow: ;--tw-backdrop-blur: ;--tw-backdrop-brightness: ;--tw-backdrop-contrast: ;--tw-backdrop-grayscale: ;--tw-backdrop-hue-rotate: ;--tw-backdrop-invert: ;--tw-backdrop-opacity: ;--tw-backdrop-saturate: ;--tw-backdrop-sepia: ;--tw-contain-size: ;--tw-contain-layout: ;--tw-contain-paint: ;--tw-contain-style: }*,:before,:after{box-sizing:border-box;border-width:0;border-style:solid;border-color:currentColor}:before,:after{--tw-content: ""}html,:host{line-height:1.5;-webkit-text-size-adjust:100%;-moz-tab-size:4;-o-tab-size:4;tab-size:4;font-family:ui-sans-serif,system-ui,sans-serif,"Apple Color Emoji","Segoe UI Emoji",Segoe UI Symbol,"Noto Color Emoji";font-feature-settings:normal;font-variation-settings:normal;-webkit-tap-highlight-color:transparent}body{margin:0;line-height:inherit}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,Liberation Mono,Courier New,monospace;font-feature-settings:normal;font-variation-settings:normal;font-size:1em}small{font-size:80%}sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}sub{bottom:-.25em}sup{top:-.5em}table{text-indent:0;border-color:inherit;border-collapse:collapse}button,input,optgroup,select,textarea{font-family:inherit;font-feature-settings:inherit;font-variation-settings:inherit;font-size:100%;font-weight:inherit;line-height:inherit;letter-spacing:inherit;color:inherit;margin:0;padding:0}button,select{text-transform:none}button,input:where([type=button]),input:where([type=reset]),input:where([type=submit]){-webkit-appearance:button;background-color:transparent;background-image:none}:-moz-focusring{outline:auto}:-moz-ui-invalid{box-shadow:none}progress{vertical-align:baseline}::-webkit-inner-spin-button,::-webkit-outer-spin-button{height:auto}[type=search]{-webkit-appearance:textfield;outline-offset:-2px}::-webkit-search-decoration{-webkit-appearance:none}::-webkit-file-upload-button{-webkit-appearance:button;font:inherit}summary{display:list-item}blockquote,dl,dd,h1,h2,h3,h4,h5,h6,hr,figure,p,pre{margin:0}fieldset{margin:0;padding:0}legend{padding:0}ol,ul,menu{list-style:none;margin:0;padding:0}dialog{padding:0}textarea{resize:vertical}input::-moz-placeholder,textarea::-moz-placeholder{opacity:1;color:#9ca3af}input::placeholder,textarea::placeholder{opacity:1;color:#9ca3af}button,[role=button]{cursor:pointer}:disabled{cursor:default}img,svg,video,canvas,audio,iframe,embed,object{display:block;vertical-align:middle}img,video{max-width:100%;height:auto}[hidden]:where(:not([hidden=until-found])){display:none}.container{width:100%}@media (min-width: 640px){.container{max-width:640px}}@media (min-width: 768px){.container{max-width:768px}}@media (min-width: 1024px){.container{max-width:1024px}}@media (min-width: 1280px){.container{max-width:1280px}}@media (min-width: 1536px){.container{max-width:1536px}}.pointer-events-auto{pointer-events:auto}.\\!visible{visibility:visible!important}.visible{visibility:visible}.collapse{visibility:collapse}.static{position:static}.fixed{position:fixed}.absolute{position:absolute}.relative{position:relative}.inset-0{top:0;right:0;bottom:0;left:0}.-bottom-3{bottom:-12px}.bottom-0{bottom:0}.bottom-20{bottom:80px}.left-0{left:0}.left-1\\/2{left:50%}.left-4{left:16px}.right-0{right:0}.top-0{top:0}.top-1\\/2{top:50%}.top-20{top:80px}.top-4{top:16px}.z-1{z-index:1}.z-10{z-index:10}.m-1{margin:4px}.-mx-0\\.5{margin-left:-2px;margin-right:-2px}.mx-1{margin-left:4px;margin-right:4px}.-mr-1\\.5{margin-right:-6px}.ml-auto{margin-left:auto}.mt-2{margin-top:8px}.block{display:block}.inline{display:inline}.flex{display:flex}.inline-flex{display:inline-flex}.hidden{display:none}.h-11{height:44px}.h-16{height:64px}.h-4{height:16px}.h-48{height:192px}.h-5{height:20px}.h-6{height:24px}.h-9{height:36px}.h-\\[calc\\(100\\%-80px\\)\\]{height:calc(100% - 80px)}.h-full{height:100%}.h-screen{height:100vh}.max-h-\\[550px\\]{max-height:550px}.max-h-\\[8lh\\]{max-height:8lh}.max-h-\\[min\\(384px\\,var\\(--radix-select-content-available-height\\)\\)\\]{max-height:min(384px,var(--radix-select-content-available-height))}.min-h-min{min-height:-moz-min-content;min-height:min-content}.w-16{width:64px}.w-4{width:16px}.w-48{width:192px}.w-5{width:20px}.w-6{width:24px}.w-64{width:256px}.w-9{width:36px}.w-full{width:100%}.w-screen{width:100vw}.\\!min-w-60{min-width:240px!important}.min-w-0{min-width:0px}.min-w-60{min-width:240px}.min-w-9{min-width:36px}.min-w-\\[var\\(--radix-select-trigger-width\\)\\]{min-width:var(--radix-select-trigger-width)}.min-w-max{min-width:-moz-max-content;min-width:max-content}.min-w-min{min-width:-moz-min-content;min-width:min-content}.max-w-64{max-width:256px}.max-w-\\[400px\\]{max-width:400px}.shrink-0{flex-shrink:0}.grow{flex-grow:1}.origin-bottom{transform-origin:bottom}.origin-bottom-left{transform-origin:bottom left}.origin-bottom-right{transform-origin:bottom right}.origin-top{transform-origin:top}.origin-top-left{transform-origin:top left}.origin-top-right{transform-origin:top right}.-translate-x-1\\/2{--tw-translate-x: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-1\\/2{--tw-translate-y: -50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-translate-y-\\[calc\\(var\\(--el-overlay-padding\\)\\)\\]{--tw-translate-y: calc(calc(var(--el-overlay-padding)) * -1);transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-1\\/2{--tw-translate-y: 50%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-\\[calc\\(var\\(--el-overlay-padding\\)\\)\\]{--tw-translate-y: calc(var(--el-overlay-padding));transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.translate-y-full{--tw-translate-y: 100%;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.-rotate-180{--tw-rotate: -180deg;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-100{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-150{--tw-scale-x: 1.5;--tw-scale-y: 1.5;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-75{--tw-scale-x: .75;--tw-scale-y: .75;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-90{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.scale-\\[0\\.333\\]{--tw-scale-x: .333;--tw-scale-y: .333;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.transform{transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.cursor-default{cursor:default}.cursor-pointer{cursor:pointer}.select-none{-webkit-user-select:none;-moz-user-select:none;user-select:none}.resize-none{resize:none}.flex-col{flex-direction:column}.flex-col-reverse{flex-direction:column-reverse}.items-start{align-items:flex-start}.items-end{align-items:flex-end}.items-center{align-items:center}.justify-end{justify-content:flex-end}.justify-center{justify-content:center}.gap-1{gap:4px}.gap-2{gap:8px}.gap-2\\.5{gap:10px}.gap-3{gap:12px}.overflow-hidden{overflow:hidden}.overflow-y-auto{overflow-y:auto}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.whitespace-nowrap{white-space:nowrap}.break-all{word-break:break-all}.rounded-\\[calc\\(var\\(--el-button-radius\\)\\+4px\\)\\]{border-radius:calc(var(--el-button-radius) + 4px)}.rounded-bubble{border-radius:var(--el-bubble-radius)}.rounded-button{border-radius:var(--el-button-radius)}.rounded-compact-sheet{border-radius:var(--el-compact-sheet-radius)}.rounded-dropdown-sheet{border-radius:var(--el-dropdown-sheet-radius)}.rounded-full{border-radius:9999px}.rounded-input{border-radius:var(--el-input-radius)}.rounded-sheet{border-radius:var(--el-sheet-radius)}.rounded-bl-\\[calc\\(var\\(--el-bubble-radius\\)\\/3\\)\\]{border-bottom-left-radius:calc(var(--el-bubble-radius) / 3)}.border{border-width:1px}.border-accent{border-color:var(--el-accent)}.border-base-border{border-color:var(--el-base-border)}.bg-accent{background-color:var(--el-accent)}.bg-base{background-color:var(--el-base)}.bg-base-active{background-color:var(--el-base-active)}.bg-base-border{background-color:var(--el-base-border)}.bg-base-hover{background-color:var(--el-base-hover)}.bg-cover{background-size:cover}.object-cover{-o-object-fit:cover;object-fit:cover}.p-1{padding:4px}.p-1\\.5{padding:6px}.p-2{padding:8px}.p-3{padding:12px}.p-4{padding:16px}.px-1{padding-left:4px;padding-right:4px}.px-1\\.5{padding-left:6px;padding-right:6px}.px-2{padding-left:8px;padding-right:8px}.px-2\\.5{padding-left:10px;padding-right:10px}.px-3{padding-left:12px;padding-right:12px}.px-4{padding-left:16px;padding-right:16px}.px-8{padding-left:32px;padding-right:32px}.py-1\\.5{padding-top:6px;padding-bottom:6px}.py-2\\.5{padding-top:10px;padding-bottom:10px}.py-\\[calc\\(theme\\(spacing\\.2\\)-1px\\)\\]{padding-top:7px;padding-bottom:7px}.pb-1{padding-bottom:4px}.pb-3{padding-bottom:12px}.pl-16{padding-left:64px}.pr-16{padding-right:64px}.pr-3{padding-right:12px}.pt-1{padding-top:4px}.text-center{text-align:center}.text-\\[10px\\]{font-size:10px}.text-lg{font-size:18px;line-height:26px}.text-md{font-size:16px;line-height:24px}.text-sm{font-size:14px;line-height:20px}.text-xs{font-size:12px;line-height:16px}.font-medium{font-weight:500}.text-accent-primary{color:var(--el-accent-primary)}.text-base-error{color:var(--el-base-error)}.text-base-primary{color:var(--el-base-primary)}.text-base-subtle{color:var(--el-base-subtle)}.underline{text-decoration-line:underline}.opacity-0{opacity:0}.opacity-30{opacity:.3}.shadow-lg{--tw-shadow: 0 2px 40px 1px rgba(0, 0, 0, .12);--tw-shadow-colored: 0 2px 40px 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.shadow-md{--tw-shadow: 0 2px 24px 1px rgba(0, 0, 0, .16);--tw-shadow-colored: 0 2px 24px 1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.filter{filter:var(--tw-blur) var(--tw-brightness) var(--tw-contrast) var(--tw-grayscale) var(--tw-hue-rotate) var(--tw-invert) var(--tw-saturate) var(--tw-sepia) var(--tw-drop-shadow)}.transition{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,-webkit-backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter;transition-property:color,background-color,border-color,text-decoration-color,fill,stroke,opacity,box-shadow,transform,filter,backdrop-filter,-webkit-backdrop-filter;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[border-radius\\]{transition-property:border-radius;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[margin\\]{transition-property:margin;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[opacity\\,transform\\]{transition-property:opacity,transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[opacity\\,width\\,height\\,transform\\,flex-grow\\]{transition-property:opacity,width,height,transform,flex-grow;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[transform\\,left\\,top\\]{transition-property:transform,left,top;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-\\[transform\\,opacity\\]{transition-property:transform,opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-colors{transition-property:color,background-color,border-color,text-decoration-color,fill,stroke;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-opacity{transition-property:opacity;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.transition-transform{transition-property:transform;transition-timing-function:cubic-bezier(.4,0,.2,1);transition-duration:.15s}.duration-200{transition-duration:.2s}.ease-out{transition-timing-function:cubic-bezier(0,0,.2,1)}.overlay{position:absolute;inset:var(--el-overlay-padding);right:calc(var(--el-overlay-padding) + var(--removed-body-scroll-bar-size, 0px))}.focus-ring{--tw-ring-color: var(--el-accent);--tw-ring-offset-width: 2px;--tw-ring-offset-color: var(--el-base)}.focus-ring:focus-visible{outline:2px solid transparent;outline-offset:2px;--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);box-shadow:var(--tw-ring-offset-shadow),var(--tw-ring-shadow),var(--tw-shadow, 0 0 #0000)}.animate-text{background-image:linear-gradient(75deg,var(--el-base-primary),var(--el-base-subtle),var(--el-base-primary),var(--el-base-subtle));background-size:300% 100%;-webkit-background-clip:text;background-clip:text;color:transparent;animation:TextAnimation 2s linear infinite}@keyframes TextAnimation{0%{background-position:0 0}to{background-position:100% 0}}.\\!terms h6,.terms h6{font-size:12px;line-height:16px;font-weight:500;color:var(--el-base-primary)}.\\!terms h5,.terms h5{font-size:14px;line-height:20px;font-weight:500;color:var(--el-base-primary)}.\\!terms h4,.terms h4{font-size:16px;line-height:24px;font-weight:500;color:var(--el-base-primary)}.\\!terms h3,.terms h3{font-size:18px;line-height:26px;font-weight:500;color:var(--el-base-primary)}.\\!terms h2,.terms h2{font-size:20px;line-height:28px;font-weight:500;color:var(--el-base-primary)}.\\!terms h2,.terms h2{font-size:24px;line-height:30px;font-weight:500;color:var(--el-base-primary)}.\\[field-sizing\\:content\\]{field-sizing:content}.\\[line-height\\:var\\(--el-overlay-padding\\)\\]{line-height:var(--el-overlay-padding)}:host,:root{--el-base: #ffffff;--el-base-hover: #f9fafb;--el-base-active: #f3f4f6;--el-base-border: #e5e7eb;--el-base-subtle: #6b7280;--el-base-primary: #000000;--el-base-error: #ef4444;--el-accent: #000000;--el-accent-hover: #1f2937;--el-accent-active: #374151;--el-accent-border: #4b5563;--el-accent-subtle: #6b7280;--el-accent-primary: #ffffff;--el-overlay-padding: 32px;--el-button-radius: 18px;--el-input-radius: 10px;--el-bubble-radius: 15px;--el-sheet-radius: calc(var(--el-button-radius) + 6px);--el-compact-sheet-radius: calc(var(--el-button-radius) + 12px);--el-dropdown-sheet-radius: calc(var(--el-input-radius) + 6px)}.dev-host,:host{pointer-events:none;position:fixed;top:0;right:0;bottom:0;left:0;z-index:1000;font-size:16px;line-height:24px;color:var(--el-base-primary);font-family:Inter,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;scrollbar-color:#e5e7eb transparent}.placeholder\\:text-base-subtle::-moz-placeholder{color:var(--el-base-subtle)}.placeholder\\:text-base-subtle::placeholder{color:var(--el-base-subtle)}.hover\\:border-accent-hover:hover{border-color:var(--el-accent-hover)}.hover\\:bg-accent-hover:hover{background-color:var(--el-accent-hover)}.hover\\:bg-base-hover:hover{background-color:var(--el-base-hover)}.hover\\:opacity-50:hover{opacity:.5}.focus-visible\\:underline-offset-2:focus-visible{text-underline-offset:2px}.focus-visible\\:opacity-100:focus-visible{opacity:1}.focus-visible\\:outline-none:focus-visible{outline:2px solid transparent;outline-offset:2px}.active\\:border-accent-active:active{border-color:var(--el-accent-active)}.active\\:bg-accent-active:active{background-color:var(--el-accent-active)}.active\\:bg-base-active:active{background-color:var(--el-base-active)}.data-hidden\\:-translate-y-4[data-shown=false]{--tw-translate-y: -16px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-hidden\\:translate-y-2[data-shown=false]{--tw-translate-y: 8px;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-hidden\\:scale-100[data-shown=false]{--tw-scale-x: 1;--tw-scale-y: 1;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-hidden\\:scale-75[data-shown=false]{--tw-scale-x: .75;--tw-scale-y: .75;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-hidden\\:scale-90[data-shown=false]{--tw-scale-x: .9;--tw-scale-y: .9;transform:translate(var(--tw-translate-x),var(--tw-translate-y)) rotate(var(--tw-rotate)) skew(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y))}.data-hidden\\:opacity-0[data-shown=false]{opacity:0}.data-\\[highlighted\\]\\:bg-base-active[data-highlighted]{background-color:var(--el-base-active)}',ml=tn(function(){return d("style",{children:vl})});function Ce(e){const t=We(e);if(t==null)throw new Error(`${e.displayName} cannot be used outside of provider`);return t}const ya=ie(null);function gl({value:e,children:t}){const n=B(()=>Object.fromEntries(hr.map(r=>[r,ve(e[r])])),[]);return hr.forEach(r=>{n[r].value=e[r]}),d(ya.Provider,{value:n,children:t})}function _l(){return Ce(ya)}function q(e){return _l()[e]}const Ut={en:{name:"English",flagCode:"us",languageCode:"en"},zh:{name:"中文",flagCode:"cn",languageCode:"zh"},es:{name:"Español",flagCode:"es",languageCode:"es"},hi:{name:"हिन्दी",flagCode:"in",languageCode:"hi"},pt:{name:"Português (Portugal)",flagCode:"pt",languageCode:"pt"},"pt-br":{name:"Português (Brasil)",flagCode:"br",languageCode:"pt-br"},fr:{name:"Français",flagCode:"fr",languageCode:"fr"},de:{name:"Deutsch",flagCode:"de",languageCode:"de"},ja:{name:"日本語",flagCode:"jp",languageCode:"ja"},ar:{name:"العربية",flagCode:"ae",languageCode:"ar"},ru:{name:"Русский",flagCode:"ru",languageCode:"ru"},ko:{name:"한국어",flagCode:"kr",languageCode:"ko"},id:{name:"Bahasa Indonesia",flagCode:"id",languageCode:"id"},it:{name:"Italiano",flagCode:"it",languageCode:"it"},nl:{name:"Nederlands",flagCode:"nl",languageCode:"nl"},tr:{name:"Türkçe",flagCode:"tr",languageCode:"tr"},pl:{name:"Polski",flagCode:"pl",languageCode:"pl"},sv:{name:"Svenska",flagCode:"se",languageCode:"sv"},ms:{name:"Bahasa Melayu",flagCode:"my",languageCode:"ms"},ro:{name:"Română",flagCode:"ro",languageCode:"ro"},uk:{name:"Українська",flagCode:"ua",languageCode:"uk"},el:{name:"Ελληνικά",flagCode:"gr",languageCode:"el"},cs:{name:"Čeština",flagCode:"cz",languageCode:"cs"},da:{name:"Dansk",flagCode:"dk",languageCode:"da"},fi:{name:"Suomi",flagCode:"fi",languageCode:"fi"},bg:{name:"Български",flagCode:"bg",languageCode:"bg"},hr:{name:"Hrvatski",flagCode:"hr",languageCode:"hr"},sk:{name:"Slovenčina",flagCode:"sk",languageCode:"sk"},ta:{name:"தமிழ்",flagCode:"in",languageCode:"ta"},hu:{name:"Magyar",flagCode:"hu",languageCode:"hu"},no:{name:"Norsk",flagCode:"no",languageCode:"no"},vi:{name:"Tiếng Việt",flagCode:"vn",languageCode:"vi"}};function vr(e){return Object.keys(Ut).includes(e??"")}const ba=["tiny","compact","full"];function wl(e){return ba.includes(e)?e:ba[0]}const yl=["top-left","top","top-right","bottom-left","bottom","bottom-right"];function bl(e){return yl.includes(e)?e:"bottom-right"}const xa={main_label:"Need help?",start_call:"Start a call",start_chat:"Start a chat",new_call:"New call",end_call:"End",mute_microphone:"Mute microphone",change_language:"Change language",collapse:"Collapse",expand:"Expand",copied:"Copied!",accept_terms:"Accept",dismiss_terms:"Cancel",listening_status:"Listening",speaking_status:"Talk to interrupt",connecting_status:"Connecting",chatting_status:"Chatting with AI Agent",input_label:"Text message input",input_placeholder:"Send a message",input_placeholder_text_only:"Send a message",input_placeholder_new_conversation:"Start a new conversation",user_ended_conversation:"You ended the conversation",agent_ended_conversation:"The agent ended the conversation",conversation_id:"ID",error_occurred:"An error occurred",copy_id:"Copy ID"},xl=Object.keys(xa),Ca=ie(null);function Cl({children:e}){const t=q("server-location"),n=B(()=>{const r=me(()=>kl(t.value));return{location:r,serverUrl:me(()=>r.value==="us"?"https://api.us.elevenlabs.io":"https://api.elevenlabs.io"),webSocketUrl:me(()=>r.value==="us"?"wss://api.us.elevenlabs.io":"wss://api.elevenlabs.io")}},[]);return d(Ca.Provider,{value:n,children:e})}function ka(){return Ce(Ca)}function kl(e="us"){switch(e){case"us":case"global":return e;default:return console.warn(`[ConversationalAI] Invalid server-location: ${e}. Defaulting to "us"`),"us"}}const Sa=ie(null);function Sl({children:e}){const t=ce(),n=Q(()=>t.value.mic_muting_enabled??!1),r=xe(!1),o=B(()=>({isMuted:me(()=>n.value?r.value:!1),setIsMuted:a=>{r.value=a},isMutingEnabled:n}),[]);return d(Sa.Provider,{value:o,children:e})}function Ea(){return Ce(Sa)}const Ta=ie(null);function El({children:e}){const{language:t}=gt(),n=q("override-prompt"),r=q("override-first-message"),o=q("override-voice-id"),a=q("override-text-only"),i=Q(()=>({agent:{prompt:{prompt:n.value},firstMessage:r.value,language:t.value.languageCode},tts:{voiceId:o.value},conversation:{textOnly:mt(a.value)??void 0}})),s=q("dynamic-variables"),l=Q(()=>{if(s.value)try{return JSON.parse(s.value)}catch(g){console.error(`[ConversationalAI] Cannot parse dynamic-variables: ${g==null?void 0:g.message}`)}}),{webSocketUrl:c}=ka(),f=q("agent-id"),u=q("signed-url"),v=mr(),h=Q(()=>{const g={dynamicVariables:l.value,overrides:i.value,connectionDelay:{default:300},textOnly:v.value};return f.value?{agentId:f.value,origin:c.value,...g}:u.value?{signedUrl:u.value,...g}:(console.error("[ConversationalAI] Either agent-id or signed-url is required"),null)});return h.value?d(Ta.Provider,{value:h,children:e}):null}function Tl(){return Ce(Ta)}const Na=ie(null);function Nl({children:e}){const t=ce(),n=B(()=>{const r=t.peek().terms_key,o=r?!!localStorage.getItem(r):!1,a=ve(!1),i=ve(o),s=me(()=>!t.value.terms_html||i.value);let l=[];return{termsShown:a,termsAccepted:s,dismissTerms:()=>{a.value=!1,l.forEach(c=>c.reject()),l=[]},acceptTerms:()=>{i.value=!0,a.value=!1;const c=t.peek().terms_key;c&&localStorage.setItem(c,"true"),l.forEach(f=>f.resolve()),l=[]},requestTerms:async()=>{s.peek()||(a.value=!0,await new Promise((c,f)=>{l.push({resolve:c,reject:f})}))}}},[]);return d(Na.Provider,{value:n,children:e})}function dn(){return Ce(Na)}const Pa=ie(null);function Pl({children:e}){const t=Al();return je(()=>{if(t.conversationTextOnly.value===!0){t.transcript.value;const n=setTimeout(()=>{t.endSession()},10*60*1e3);return()=>{clearTimeout(n)}}}),d(Pa.Provider,{value:t,children:e})}function de(){return Ce(Pa)}function Al(){const e=E(null),t=E(null),n=ce(),r=$a(),o=dn(),a=Tl(),{isMuted:i}=Ea();return je(()=>{var s;i.value&&((s=e==null?void 0:e.current)==null||s.setMicMuted(i.value))}),A(()=>()=>{var s;(s=e.current)==null||s.endSession()},[]),B(()=>{const s=ve("disconnected"),l=me(()=>s.value==="disconnected"),c=ve("listening"),f=me(()=>c.value==="speaking"),u=ve(null),v=ve(null),h=ve(!1),g=ve([]),p=ve(0),m=ve(null);return{status:s,isSpeaking:f,mode:c,isDisconnected:l,lastId:v,error:u,canSendFeedback:h,conversationIndex:p,conversationTextOnly:m,transcript:g,startSession:async(_,w)=>{var y,b;if(await o.requestTerms(),(y=e.current)!=null&&y.isOpen())return e.current.getId();if(t.current)return(await t.current).getId();let C=structuredClone(a.peek());w&&n.value.supports_text_only&&(C.textOnly=!0,n.value.text_only||(C.overrides??(C.overrides={}),(b=C.overrides).conversation??(b.conversation={}),C.overrides.conversation.textOnly=!0));try{C=$l(_,C)}catch(k){console.error("[ConversationalAI] Error triggering call event:",k)}m.value=C.textOnly??!1,g.value=w?[{type:"message",role:"user",message:w,isText:!0,conversationIndex:p.peek()}]:[];try{if(t.current=fl.startSession({...C,onModeChange:x=>{c.value=x.mode},onStatusChange:x=>{s.value=x.status},onCanSendFeedbackChange:x=>{h.value=x.canSendFeedback},onMessage:({source:x,message:P})=>{m.peek()===!0&&x==="ai"&&P===r.peek()||(g.value=[...g.value,{type:"message",role:x,message:P,isText:!1,conversationIndex:p.peek()}])},onDisconnect:x=>{m.value=null,g.value=[...g.value,x.reason==="error"?{type:"error",message:x.message,conversationIndex:p.peek()}:{type:"disconnection",role:x.reason==="user"?"user":"ai",conversationIndex:p.peek()}],p.value++,x.reason==="error"&&(u.value=x.message,console.error("[ConversationalAI] Disconnected due to an error:",x.message))}}),e.current=await t.current,i.peek()!==void 0&&e.current.setMicMuted(i.peek()),w){const x=e.current;setTimeout(()=>x.sendUserMessage(w),100)}const k=e.current.getId();return v.value=k,u.value=null,k}catch(k){let x="Could not start a conversation.";k instanceof CloseEvent?x=k.reason||x:k instanceof Error&&(x=k.message||x),u.value=x,g.value=[...g.value,{type:"error",message:x,conversationIndex:p.peek()}]}finally{t.current=null}},endSession:async()=>{const _=e.current;e.current=null,await(_==null?void 0:_.endSession())},getInputVolume:()=>{var _;return((_=e.current)==null?void 0:_.getInputVolume())??0},getOutputVolume:()=>{var _;return((_=e.current)==null?void 0:_.getOutputVolume())??0},sendFeedback:_=>{var w;(w=e.current)==null||w.sendFeedback(_)},sendUserMessage:_=>{var w;(w=e.current)==null||w.sendUserMessage(_),g.value=[...g.value,{type:"message",role:"user",message:_,isText:!0,conversationIndex:p.peek()}]},sendUserActivity:()=>{var _;(_=e.current)==null||_.sendUserActivity()}}},[a,i])}function $l(e,t){try{const n=new CustomEvent("elevenlabs-convai:call",{bubbles:!0,composed:!0,detail:{config:t}});return e.dispatchEvent(n),n.detail.config}catch(n){return console.error("[ConversationalAI] Could not trigger call event:",n),t}}const Aa=ie(null);function Il({children:e}){const{serverUrl:t}=ka(),n=q("agent-id"),r=q("override-config"),o=xe(null);je(()=>{if(r.value)try{const g=JSON.parse(r.value);if(g){o.value=g;return}}catch(g){console.error(`[ConversationalAI] Cannot parse override-config: ${g==null?void 0:g.message}`)}if(!n.value){o.value=null;return}const h=new AbortController;return Dl(n.value,t.value,h.signal).then(g=>{h.signal.aborted||(o.value=g)}).catch(g=>{console.error(`[ConversationalAI] Cannot fetch config for agent ${n.value}: ${g==null?void 0:g.message}`),h.signal.aborted||(o.value=null)}),()=>{h.abort()}});const a=q("variant"),i=q("placement"),s=q("terms-key"),l=q("mic-muting"),c=q("transcript"),f=q("text-input"),u=q("override-text-only"),v=Q(()=>{if(!o.value)return null;const h=a.value??o.value.variant,g=i.value??o.value.placement,p=s.value??o.value.terms_key,m=mt(u.value)??o.value.text_only??!1,_=mt(l.value)??o.value.mic_muting_enabled,w=mt(c.value)??o.value.transcript_enabled,y=mt(f.value)??o.value.text_input_enabled;return{...o.value,variant:wl(h),placement:bl(g),terms_key:p,mic_muting_enabled:!m&&_,transcript_enabled:m||w,text_input_enabled:m||y}});return v.value?d(Aa.Provider,{value:v,children:e}):null}function ce(){return Ce(Aa)}function mr(){const e=q("override-text-only"),t=ce();return Q(()=>mt(e.value)??t.value.text_only??!1)}function fn(){const e=mr(),{conversationTextOnly:t}=de();return Q(()=>t.value??e.value)}function $a(){const e=q("override-first-message"),t=ce(),{language:n}=gt();return Q(()=>{var r,o;return e.value??((o=(r=t.value.language_presets)==null?void 0:r[n.value.languageCode])==null?void 0:o.first_message)??t.value.first_message??null})}async function Dl(e,t,n){const r=await(await fetch(`${t}/v1/convai/agents/${e}/widget`,{signal:n})).json();if(!r.widget_config)throw new Error("Response does not contain widget_config");return r.widget_config}const Ia=ie(null);function Ml({children:e}){const t=ce(),n=q("language"),r=q("override-language"),o=xe(n.peek()??t.peek().language),a=Q(()=>(t.value.supported_language_overrides??[]).filter(vr)),i=Q(()=>a.value.map(l=>Ut[l]).sort((l,c)=>l.name.localeCompare(c.name))),s=B(()=>({language:me(()=>vr(r.value)?Ut[r.value]:vr(o.value)&&a.value.includes(o.value)?Ut[o.value]:Ut[t.value.language]),setLanguage:l=>{o.value=l},options:i,showPicker:me(()=>i.value.length>0)}),[]);return d(Ia.Provider,{value:s,children:e})}function gt(){return Ce(Ia)}const Da=ie(null);function Ol({children:e}){const t=ce(),{language:n}=gt(),r=q("text-contents"),o=Q(()=>{try{if(r.value){const i=JSON.parse(r.value);if(typeof i=="object")return i}}catch(i){console.error("[ConversationalAI] Cannot parse text-contents:",i)}return{}}),a=B(()=>Object.fromEntries(xl.map(i=>[i,me(()=>{var s,l,c,f;return o.value[i]??((c=(l=(s=t.value.language_presets)==null?void 0:s[n.value.languageCode])==null?void 0:l.text_contents)==null?void 0:c[i])??((f=t.value.text_contents)==null?void 0:f[i])??xa[i]})])),[]);return d(Da.Provider,{value:a,children:e})}function fe(){return Ce(Da)}const Ma=ie(null);function Ll({children:e}){const t=ce(),n=q("avatar-image-url"),r=q("avatar-orb-color-1"),o=q("avatar-orb-color-2"),a=xe(""),i=Q(()=>n.value?{type:"image",url:n.value}:r.value&&o.value?{type:"orb",color_1:r.value,color_2:o.value}:t.value.avatar),s=Q(()=>{switch(i.value.type){case"url":return i.value.custom_url;case"orb":return a.value;case"image":return i.value.url}}),l=B(()=>({config:i,previewUrl:s,canvasUrl:a}),[]);return d(Ma.Provider,{value:l,children:e})}function gr(){return Ce(Ma)}const Oa=ie(null);function pn({children:e,...t}){const[n,r]=S(null);return d("div",{ref:r,...t,children:n&&d(Oa.Provider,{value:n,children:e})})}function Rl(){return Ce(Oa)}function _r(e){return e&&typeof e=="object"&&"peek"in e}function Fl(e){const t=_r(e),n=xe(t?e.peek():e);return t?e:(n.value=e,n)}function La(e){return _r(e)?e.value:e}function zl(e){return _r(e)?e.peek():e}function Ra(e,t){if(typeof e=="function")return e(t);e!=null&&(e.current=t)}function Fa(...e){return t=>{let n=!1;const r=e.map(o=>{const a=Ra(o,t);return!n&&typeof a=="function"&&(n=!0),a});if(n)return()=>{for(let o=0;o<r.length;o++){const a=r[o];typeof a=="function"?a():Ra(e[o],null)}}}}function le(...e){return $(Fa(...e),e)}function Bt(e){const t=Ul(e),n=I((r,o)=>{const{children:a,...i}=r,s=He.toArray(a),l=s.find(Wl);if(l){const c=l.props.children,f=s.map(u=>u===l?He.count(c)>1?He.only(null):Le(c)?c.props.children:null:u);return d(t,{...i,ref:o,children:Le(c)?Lt(c,void 0,f):null})}return d(t,{...i,ref:o,children:a})});return n.displayName=`${e}.Slot`,n}var za=Bt("Slot");function Ul(e){const t=I((n,r)=>{const{children:o,...a}=n;if(Le(o)){const i=Vl(o),s=Hl(a,o.props);return o.type!==ee&&(s.ref=r?Fa(r,i):i),Lt(o,s)}return He.count(o)>1?He.only(null):null});return t.displayName=`${e}.SlotClone`,t}var Bl=Symbol("radix.slottable");function Wl(e){return Le(e)&&typeof e.type=="function"&&"__radixId"in e.type&&e.type.__radixId===Bl}function Hl(e,t){const n={...t};for(const r in t){const o=e[r],a=t[r];/^on[A-Z]/.test(r)?o&&a?n[r]=(...i)=>{a(...i),o(...i)}:o&&(n[r]=o):r==="style"?n[r]={...o,...a}:r==="className"&&(n[r]=[o,a].filter(Boolean).join(" "))}return{...e,...n}}function Vl(e){var t,n;let r=(t=Object.getOwnPropertyDescriptor(e.props,"ref"))==null?void 0:t.get,o=r&&"isReactWarning"in r&&r.isReactWarning;return o?e.ref:(r=(n=Object.getOwnPropertyDescriptor(e,"ref"))==null?void 0:n.get,o=r&&"isReactWarning"in r&&r.isReactWarning,o?e.props.ref:e.props.ref||e.ref)}const wr=window.matchMedia("(prefers-reduced-motion: reduce)");function Ua(){const e=xe(wr.matches);return A(()=>{const t=n=>{e.value=n.matches};return wr.addEventListener("change",t),()=>wr.removeEventListener("change",t)},[]),e}function Ba({onStart:e,onEnd:t}){const n=E();n.current??(n.current=new Set);const r=E(e);r.current=e;const o=E(t);o.current=t;const a=xe(!1),i=$(l=>{var c,f;l.target===l.currentTarget&&((c=n.current)==null||c.add(l.propertyName),a.peek()||(a.value=!0,(f=r.current)==null||f.call(r)))},[]),s=$(l=>{var c,f,u;l.target===l.currentTarget&&((c=n.current)==null||c.delete(l.propertyName),(f=n.current)!=null&&f.size||(a.value=!1,(u=o.current)==null||u.call(o)))},[]);return{transitioning:a,handlers:{onTransitionStart:i,onTransitionEnd:s}}}function ke(e){const t=Ua().value?jl:Yl;return d(t,{...e})}function jl({active:e,...t}){return La(e)?d(za,{"data-shown":!0,...t}):null}function Yl({active:e,initial:t=e,...n}){const r=Fl(e),o=xe(zl(t));je(()=>{r.value&&(o.value=r.value)});const{handlers:a}=Ba({onEnd:()=>{o.value=r.value}});return!r.value&&!o.value?null:d(za,{"data-shown":r.value&&o.value,...a,...n})}const ql=`#version 300 es
208
+ precision highp float;
209
+
210
+ uniform float uTime;
211
+ uniform float uOffsets[7];
212
+ uniform vec3 uColor1;
213
+ uniform vec3 uColor2;
214
+ uniform sampler2D uPerlinTexture;
215
+
216
+ in vec2 vUv;
217
+
218
+ out vec4 outColor;
219
+
220
+ const float PI = 3.14159265358979323846;
221
+
222
+ // Draw a single oval with soft edges and calculate its gradient color
223
+ bool drawOval(vec2 polarUv, vec2 polarCenter, float a, float b, bool reverseGradient, float softness, out vec4 color) {
224
+ vec2 p = polarUv - polarCenter;
225
+ float oval = (p.x * p.x) / (a * a) + (p.y * p.y) / (b * b);
226
+
227
+ float edge = smoothstep(1.0, 1.0 - softness, oval);
228
+
229
+ if (edge > 0.0) {
230
+ float gradient = reverseGradient ? (1.0 - (p.x / a + 1.0) / 2.0) : ((p.x / a + 1.0) / 2.0);
231
+ color = vec4(vec3(gradient), 0.8 * edge);
232
+ return true;
233
+ }
234
+ return false;
235
+ }
236
+
237
+ // Map grayscale value to a 4-color ramp (color1, color2, color3, color4)
238
+ vec3 colorRamp(float grayscale, vec3 color1, vec3 color2, vec3 color3, vec3 color4) {
239
+ if (grayscale < 0.33) {
240
+ return mix(color1, color2, grayscale * 3.0);
241
+ } else if (grayscale < 0.66) {
242
+ return mix(color2, color3, (grayscale - 0.33) * 3.0);
243
+ } else {
244
+ return mix(color3, color4, (grayscale - 0.66) * 3.0);
245
+ }
246
+ }
247
+
248
+ vec2 hash2(vec2 p) {
249
+ return fract(sin(vec2(dot(p, vec2(127.1, 311.7)), dot(p, vec2(269.5, 183.3)))) * 43758.5453);
250
+ }
251
+
252
+ // 2D noise for the ring
253
+ float noise2D(vec2 p) {
254
+ vec2 i = floor(p);
255
+ vec2 f = fract(p);
256
+
257
+ vec2 u = f * f * (3.0 - 2.0 * f);
258
+ float n = mix(
259
+ mix(dot(hash2(i + vec2(0.0, 0.0)), f - vec2(0.0, 0.0)),
260
+ dot(hash2(i + vec2(1.0, 0.0)), f - vec2(1.0, 0.0)), u.x),
261
+ mix(dot(hash2(i + vec2(0.0, 1.0)), f - vec2(0.0, 1.0)),
262
+ dot(hash2(i + vec2(1.0, 1.0)), f - vec2(1.0, 1.0)), u.x),
263
+ u.y
264
+ );
265
+
266
+ return 0.5 + 0.5 * n;
267
+ }
268
+
269
+ float sharpRing(vec2 uv, float theta, float time) {
270
+ float ringStart = 1.0;
271
+ float ringWidth = 0.5;
272
+ float noiseScale = 5.0;
273
+
274
+ vec2 noiseCoord = vec2(theta / (2.0 * PI), time * 0.1);
275
+ noiseCoord *= noiseScale;
276
+
277
+ float noise = noise2D(noiseCoord);
278
+ noise = (noise - 0.5) * 4.0;
279
+
280
+ return ringStart + noise * ringWidth * 1.5;
281
+ }
282
+
283
+ float smoothRing(vec2 uv, float time) {
284
+ float angle = atan(uv.y, uv.x);
285
+ if (angle < 0.0) angle += 2.0 * PI;
286
+
287
+ vec2 noiseCoord = vec2(angle / (2.0 * PI), time * 0.1);
288
+ noiseCoord *= 6.0;
289
+
290
+ float noise = noise2D(noiseCoord);
291
+ noise = (noise - 0.5) * 8.0;
292
+
293
+ float ringStart = 0.9;
294
+ float ringWidth = 0.3;
295
+
296
+ return ringStart + noise * ringWidth;
297
+ }
298
+
299
+ void main() {
300
+ // Normalize vUv to be centered around (0.0, 0.0)
301
+ vec2 uv = vUv * 2.0 - 1.0;
302
+
303
+ // Convert uv to polar coordinates
304
+ float radius = length(uv);
305
+ float theta = atan(uv.y, uv.x);
306
+ if (theta < 0.0) theta += 2.0 * PI; // Normalize theta to [0, 2*PI]
307
+
308
+ // Initialize the base color to white
309
+ vec4 color = vec4(1.0, 1.0, 1.0, 1.0);
310
+
311
+ // Original parameters for the ovals in polar coordinates
312
+ float originalCenters[7] = float[7](0.0, 0.5 * PI, 1.0 * PI, 1.5 * PI, 2.0 * PI, 2.5 * PI, 3.0 * PI);
313
+
314
+ // Parameters for the animated centers in polar coordinates
315
+ float centers[7];
316
+ for (int i = 0; i < 7; i++) {
317
+ centers[i] = originalCenters[i] + 0.5 * sin(uTime / 20.0 + uOffsets[i]);
318
+ }
319
+
320
+ float a, b;
321
+ vec4 ovalColor;
322
+
323
+ // Check if the pixel is inside any of the ovals
324
+ for (int i = 0; i < 7; i++) {
325
+ float noise = texture(uPerlinTexture, vec2(mod(centers[i] + uTime * 0.05, 1.0), 0.5)).r;
326
+ a = noise * 1.5; // Increased variance: goes from 0.0 to 1.0
327
+ b = noise * 4.5; // Tall semi-minor axis
328
+ bool reverseGradient = (i % 2 == 1); // Reverse gradient for every second oval
329
+
330
+ // Calculate the distance in polar coordinates
331
+ float distTheta = abs(theta - centers[i]);
332
+ if (distTheta > PI) distTheta = 2.0 * PI - distTheta; // Shortest distance on circle
333
+ float distRadius = radius;
334
+
335
+ float softness = 0.4; // Controls edge softness (e.g. how much blur is applied to the ovals)
336
+
337
+ // Check if the pixel is inside the oval in polar coordinates
338
+ if (drawOval(vec2(distTheta, distRadius), vec2(0.0, 0.0), a, b, reverseGradient, softness, ovalColor)) {
339
+ // Blend the oval color with the existing color
340
+ color.rgb = mix(color.rgb, ovalColor.rgb, ovalColor.a);
341
+ color.a = max(color.a, ovalColor.a); // Max alpha
342
+ }
343
+ }
344
+
345
+ // Calculate both noisy rings
346
+ float ringRadius1 = sharpRing(uv, theta, uTime);
347
+ float ringRadius2 = smoothRing(uv, uTime);
348
+
349
+ // Blend both rings
350
+ float ringAlpha1 = (radius >= ringRadius1) ? 0.3 : 0.0;
351
+ float ringAlpha2 = smoothstep(ringRadius2 - 0.05, ringRadius2 + 0.05, radius) * 0.25;
352
+
353
+ float totalRingAlpha = max(ringAlpha1, ringAlpha2);
354
+
355
+ // Apply screen blend mode for combined rings
356
+ vec3 ringColor = vec3(1.0); // White ring color
357
+ color.rgb = 1.0 - (1.0 - color.rgb) * (1.0 - ringColor * totalRingAlpha);
358
+
359
+ // Define colours to ramp against greyscale (could increase the amount of colours in the ramp)
360
+ vec3 color1 = vec3(0.0, 0.0, 0.0); // Black
361
+ vec3 color2 = uColor1; // Darker Color
362
+ vec3 color3 = uColor2; // Lighter Color
363
+ vec3 color4 = vec3(1.0, 1.0, 1.0); // White
364
+
365
+ // Convert grayscale color to the color ramp
366
+ float luminance = color.r;
367
+ color.rgb = colorRamp(luminance, color1, color2, color3, color4); // Apply the color ramp
368
+
369
+ outColor = color;
370
+ }
371
+ `,Xl=`#version 300 es
372
+ precision highp float;
373
+
374
+ in vec2 position;
375
+
376
+ out vec2 vUv;
377
+
378
+ void main() {
379
+ vUv = position * 0.5 + 0.5;
380
+ gl_Position = vec4(position, 0, 1);
381
+ }
382
+ `,Wa=0,Kl=new Float32Array([-1,1,-1,-1,1,1,1,-1]),Gl="https://storage.googleapis.com/eleven-public-cdn/images/perlin-noise.png",Ha=class et{constructor(t){ue(this,"gl"),ue(this,"program"),ue(this,"startTime"),ue(this,"targetSpeed",0),ue(this,"speed",.5),ue(this,"rafId",null),ue(this,"resizeObserver"),ue(this,"colorA",[0,0,0]),ue(this,"colorB",[0,0,0]),ue(this,"offsets",new Float32Array(7).map(()=>Math.random()*Math.PI*2)),ue(this,"copyNoiseImage",()=>{this.gl&&(this.gl.texImage2D(this.gl.TEXTURE_2D,0,this.gl.RGBA,this.gl.RGBA,this.gl.UNSIGNED_BYTE,et.noiseImage),this.gl.generateMipmap(this.gl.TEXTURE_2D))}),ue(this,"toDataURL",()=>this.gl.canvas.toDataURL("image/png")),ue(this,"render",()=>{if(!this.gl){this.rafId=null;return}const i=(performance.now()-this.startTime)/1e3;this.gl.uniform1f(this.gl.getUniformLocation(this.program,"uTime"),i),this.gl.drawArrays(this.gl.TRIANGLE_STRIP,0,4),this.rafId=requestAnimationFrame(this.render)});const n=t.getContext("webgl2",{depth:!1,stencil:!1});this.gl=n,this.program=this.setupProgram(ql,Xl);const r=n.createTexture();n.bindTexture(n.TEXTURE_2D,r),n.texImage2D(n.TEXTURE_2D,0,n.RGBA,1,1,0,n.RGBA,n.UNSIGNED_BYTE,new Uint8Array([128,128,128,255])),et.noiseImage||(et.noiseImage=new Image,et.noiseImage.crossOrigin="anonymous",et.noiseImage.src=Gl),et.noiseImage.complete?this.copyNoiseImage():et.noiseImage.addEventListener("load",this.copyNoiseImage);const o=n.createBuffer();n.bindBuffer(n.ARRAY_BUFFER,o),n.bufferData(n.ARRAY_BUFFER,Kl,n.STATIC_DRAW),n.vertexAttribPointer(Wa,2,n.FLOAT,!1,0,0),n.enableVertexAttribArray(Wa),this.updateColors("#2792DC","#9CE6E6"),this.resizeObserver=new ResizeObserver(i=>{const s=i[0],l=s.devicePixelContentBoxSize?s.devicePixelContentBoxSize[0]:s.contentBoxSize[0];t.width=Math.min(512,l.inlineSize),t.height=Math.min(512,l.blockSize),this.updateViewport()});const a=t.parentElement;if(a)try{this.resizeObserver.observe(a,{box:"device-pixel-content-box"})}catch{this.resizeObserver.observe(a)}this.startTime=performance.now(),this.rafId=requestAnimationFrame(this.render)}dispose(){var t;this.rafId!==null&&cancelAnimationFrame(this.rafId),(t=this.resizeObserver)==null||t.disconnect(),this.gl=null,this.program=null}updateViewport(){this.gl.viewport(0,0,this.gl.canvas.width,this.gl.canvas.height)}updateColors(t,n){this.gl&&(this.colorA=this.updateColor("uColor1",t)??this.colorA,this.colorB=this.updateColor("uColor2",n)??this.colorB)}updateVolume(t,n){this.targetSpeed=.2+(1-Math.pow(n-1,2))*1.8,this.targetSpeed>this.speed&&(this.speed=this.targetSpeed),this.gl.uniform1f(this.gl.getUniformLocation(this.program,"uInputVolume"),t),this.gl.uniform1f(this.gl.getUniformLocation(this.program,"uOutputVolume"),n)}updateColor(t,n){try{const r=parseInt(n.slice(1,3),16)/255,o=parseInt(n.slice(3,5),16)/255,a=parseInt(n.slice(5,7),16)/255,i=[Math.pow(r,2.2),Math.pow(o,2.2),Math.pow(a,2.2)];return this.gl.uniform3fv(this.gl.getUniformLocation(this.program,t),i),i}catch(r){console.error(`[ConversationalAI] Failed to parse ${n} as color:`,r)}}setupProgram(t,n){const r=this.getShader(this.gl.FRAGMENT_SHADER,t),o=this.getShader(this.gl.VERTEX_SHADER,n);if(!r||!o)throw new Error("Failed to compile shaders");if(this.program=this.gl.createProgram(),this.gl.attachShader(this.program,r),this.gl.attachShader(this.program,o),this.gl.linkProgram(this.program),!this.gl.getProgramParameter(this.program,this.gl.LINK_STATUS))throw new Error("Failed to link program");return this.gl.useProgram(this.program),this.gl.uniform1i(this.gl.getUniformLocation(this.program,"uPerlinTexture"),0),this.gl.uniform1fv(this.gl.getUniformLocation(this.program,"uOffsets"),this.offsets),this.gl.uniform3fv(this.gl.getUniformLocation(this.program,"uColor1"),this.colorA),this.gl.uniform3fv(this.gl.getUniformLocation(this.program,"uColor2"),this.colorB),this.program}getShader(t,n){const r=this.gl.createShader(t);return this.gl.shaderSource(r,n),this.gl.compileShader(r),this.gl.getShaderParameter(r,this.gl.COMPILE_STATUS)?r:(this.gl.deleteShader(r),null)}};ue(Ha,"noiseImage");let Zl=Ha;const Jl={sm:"w-9 h-9",lg:"w-48 h-48"};function _t({size:e="sm",className:t}){const{getInputVolume:n,getOutputVolume:r,isSpeaking:o,isDisconnected:a}=de(),{config:i}=gr(),s=E(null),l=E(null);je(()=>{if(a.value){s.current.style.transform="",l.current.style.transform="";return}let f;function u(){const v=n(),h=r(),g=o.peek()?1:1-v*.4,p=o.peek()?1+h*.4:1;s.current.style.transform=`scale(${p})`,l.current.style.transform=`scale(${g})`,f=requestAnimationFrame(u)}return u(),()=>{cancelAnimationFrame(f)}});const c=Q(()=>({backgroundImage:i.value.type==="image"?`url(${i.value.url})`:i.value.type==="url"?`url(${i.value.custom_url})`:void 0}));return d("div",{className:Y("relative shrink-0",Jl[e],t),children:[d("div",{ref:s,className:"absolute inset-0 rounded-full bg-base-border"}),d("div",{ref:l,style:c,className:"absolute inset-0 rounded-full overflow-hidden bg-base bg-cover",children:i.value.type==="orb"&&d(Ql,{color1:i.value.color_1,color2:i.value.color_2})})]})}function Ql({color1:e,color2:t}){const{canvasUrl:n}=gr(),[r,o]=S(null);A(()=>{r&&(r.updateColors(e,t),r.render(),n.value=r.toDataURL())},[r,e,t]);const a=$(i=>{if(i){const s=new Zl(i);return o(s),()=>s.dispose()}else o(null)},[o]);return d("canvas",{className:"w-full h-full",ref:a})}const ec={phone:nc,"phone-off":rc,chat:oc,mic:ac,"mic-off":ic,check:cc,"chevron-down":sc,"chevron-up":lc},tc={sm:"text-xs",md:"text-lg"};function wt({name:e,size:t="md",className:n}){const r=ec[e];return d("slot",{name:`icon-${e}`,className:Y("flex",tc[t],n),"aria-hidden":!0,children:d(r,{})})}function nc(e){return d("svg",{height:"1em",width:"1em",viewBox:"0 0 18 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:d("path",{d:"M3.7489 2.25C2.93286 2.25 2.21942 2.92142 2.27338 3.7963C2.6686 10.2041 7.79483 15.3303 14.2026 15.7255C15.0775 15.7795 15.7489 15.066 15.7489 14.25V11.958C15.7489 11.2956 15.3144 10.7116 14.6799 10.5213L12.6435 9.91035C12.1149 9.75179 11.542 9.89623 11.1518 10.2864L10.5901 10.8482C9.15291 10.0389 7.95998 8.84599 7.15074 7.40881L7.71246 6.84709C8.10266 6.45689 8.24711 5.88396 8.08854 5.35541L7.47761 3.31898C7.28727 2.6845 6.70329 2.25 6.04087 2.25H3.7489Z"})})}function rc(e){return d("svg",{height:"1em",width:"1em",viewBox:"0 0 19 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[d("path",{d:"M16.0303 3.53033C16.3232 3.23744 16.3232 2.76256 16.0303 2.46967C15.7374 2.17678 15.2626 2.17678 14.9697 2.46967L8.6271 8.81224C8.25925 8.3778 7.93185 7.90804 7.65074 7.40881L8.21246 6.84709C8.60266 6.45689 8.74711 5.88396 8.58854 5.35541L7.97761 3.31898C7.78727 2.6845 7.20329 2.25 6.54087 2.25H4.2489C3.43286 2.25 2.71942 2.92142 2.77338 3.7963C2.95462 6.73468 4.13069 9.40357 5.96899 11.4703L2.96967 14.4697C2.67678 14.7626 2.67678 15.2374 2.96967 15.5303C3.26256 15.8232 3.73744 15.8232 4.03033 15.5303L16.0303 3.53033Z"}),d("path",{d:"M14.7026 15.7255C12.2994 15.5773 10.0765 14.7636 8.21584 13.4665L10.9278 10.7545C10.9815 10.7863 11.0356 10.8175 11.0901 10.8482L11.6518 10.2864C12.042 9.89623 12.6149 9.75179 13.1435 9.91035L15.1799 10.5213C15.8144 10.7116 16.2489 11.2956 16.2489 11.958V14.25C16.2489 15.066 15.5775 15.7795 14.7026 15.7255Z"})]})}function oc(e){return d("svg",{height:"1em",width:"1em",viewBox:"0 0 19 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:d("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M1.5 6.75C1.5 4.26472 3.51472 2.25 6 2.25H12C14.4853 2.25 16.5 4.26472 16.5 6.75V11.25C16.5 13.7353 14.4853 15.75 12 15.75H2.25C1.83579 15.75 1.5 15.4142 1.5 15V6.75ZM6 9.9375C5.48223 9.9375 5.0625 9.51777 5.0625 9C5.0625 8.48223 5.48223 8.0625 6 8.0625C6.51777 8.0625 6.9375 8.48223 6.9375 9C6.9375 9.51777 6.51777 9.9375 6 9.9375ZM9 9.9375C8.48223 9.9375 8.0625 9.51777 8.0625 9C8.0625 8.48223 8.48223 8.0625 9 8.0625C9.51777 8.0625 9.9375 8.48223 9.9375 9C9.9375 9.51777 9.51777 9.9375 9 9.9375ZM11.0625 9C11.0625 9.51777 11.4822 9.9375 12 9.9375C12.5178 9.9375 12.9375 9.51777 12.9375 9C12.9375 8.48223 12.5178 8.0625 12 8.0625C11.4822 8.0625 11.0625 8.48223 11.0625 9Z"})})}function ac(e){return d("svg",{height:"1em",width:"1em",viewBox:"0 0 19 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[d("path",{d:"M9.50008 1.5C7.42901 1.5 5.75008 3.17893 5.75008 5.25V8.25C5.75008 10.3211 7.42901 12 9.50008 12C11.5712 12 13.2501 10.3211 13.2501 8.25V5.25C13.2501 3.17893 11.5712 1.5 9.50008 1.5Z"}),d("path",{d:"M4.88997 10.8417C4.66448 10.4943 4.20002 10.3954 3.85256 10.6209C3.50509 10.8463 3.40621 11.3108 3.63169 11.6583C4.47442 12.9569 6.08493 14.6838 8.75008 14.9616V15.75C8.75008 16.1642 9.08587 16.5 9.50008 16.5C9.9143 16.5 10.2501 16.1642 10.2501 15.75V14.9616C12.9152 14.6838 14.5257 12.9569 15.3685 11.6583C15.594 11.3108 15.4951 10.8463 15.1476 10.6209C14.8001 10.3954 14.3357 10.4943 14.1102 10.8417C13.3305 12.0432 11.9002 13.5 9.50008 13.5C7.1 13.5 5.66968 12.0432 4.88997 10.8417Z"})]})}function ic(e){return d("svg",{height:"1em",width:"1em",viewBox:"0 0 19 18",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[d("path",{d:"M13.25 8.25C13.25 8.64791 13.188 9.03135 13.0732 9.39119L6.57947 2.8975C7.26687 2.04521 8.31974 1.5 9.49995 1.5C11.571 1.5 13.25 3.17893 13.25 5.25V8.25Z"}),d("path",{d:"M2.21967 1.71967C2.51256 1.42678 2.98744 1.42678 3.28033 1.71967L16.7803 15.2197C17.0732 15.5126 17.0732 15.9874 16.7803 16.2803C16.4874 16.5732 16.0126 16.5732 15.7197 16.2803L13.2828 13.8435C12.4719 14.4022 11.4678 14.8338 10.25 14.9614V15.75C10.25 16.1642 9.91422 16.5 9.50001 16.5C9.08579 16.5 8.75001 16.1642 8.75001 15.75V14.9616C6.08485 14.6838 4.47434 12.9569 3.63162 11.6583C3.40614 11.3108 3.50502 10.8463 3.85248 10.6209C4.19995 10.3954 4.66441 10.4943 4.88989 10.8417C5.6696 12.0432 7.09993 13.5 9.50001 13.5C10.5978 13.5 11.4845 13.1981 12.1992 12.7598L11.0875 11.6482C10.605 11.8739 10.0667 12 9.50001 12C7.42894 12 5.75001 10.3211 5.75001 8.25V6.31067L2.21967 2.78033C1.92678 2.48744 1.92678 2.01256 2.21967 1.71967Z"})]})}function sc(e){return d("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e,children:d("path",{d:"m6 9 6 6 6-6"})})}function lc(e){return d("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e,children:d("path",{d:"m18 15-6-6-6 6"})})}function cc(e){return d("svg",{xmlns:"http://www.w3.org/2000/svg",height:"1em",width:"1em",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round",...e,children:d("path",{d:"M20 6 9 17l-5-5"})})}function Fe(e){const t=Ua().value?uc:dc;return d(t,{...e})}function uc({visible:e,className:t,grow:n,dep:r,...o}){return e?d("div",{className:Y(n&&"grow",t),...o}):null}function dc({visible:e,children:t,className:n,grow:r,dep:o,...a}){const[i,s]=S(e),[l,c]=S(null),[f,u]=S(null),v=E(t);e&&(v.current=t);const h=$(m=>{c(m),m&&!e&&(m.style.width="0px",m.style.height="0px")},[]);A(()=>{f&&(f.style.transition="none",f.style.opacity="0",f.offsetWidth,f.style.transition="",f.style.opacity="")},[o]),B(()=>{l&&(l.style.width=`${l.offsetWidth}px`,l.style.height=`${l.offsetHeight}px`)},[l,e,o]),A(()=>{if(!l||!f)return;e&&s(!0);const m=e?f.offsetWidth:0,_=e?f.offsetHeight:0;l.style.width=!e||l.offsetWidth!==m?`${m}px`:"",l.style.height=!e||l.offsetHeight!==_?`${_}px`:""},[l,f,e,o]);const{transitioning:g,handlers:p}=Ba({onEnd:()=>{e?(l.style.width="",l.style.height=""):s(!1)}});return d("div",{ref:h,className:Y("relative inline-flex shrink-0 justify-center items-center transition-[opacity,width,height,transform,flex-grow] duration-200 min-w-0",!e&&"opacity-0 scale-75",e&&r&&"grow",e&&i&&!g.value&&"z-1"),...p,children:d("div",{ref:u,className:Y("shrink-0 min-h-min min-w-min transition-opacity duration-200",r&&"grow",n),...a,children:(e||i)&&v.current})})}const fc={primary:"text-accent-primary border border-accent bg-accent hover:border-accent-hover hover:bg-accent-hover active:border-accent-active active:bg-accent-active",secondary:"text-base-primary border border-base-border bg-base hover:bg-base-hover active:bg-base-active"},Ye=I(function({variant:e="secondary",children:t,icon:n,className:r,iconClassName:o,truncate:a=!0,...i},s){const l=!!n&&!t;return d("button",{ref:s,className:Y("h-9 flex px-2.5 text-sm items-center transition-colors justify-center rounded-button duration-200 focus-ring overflow-hidden select-none",fc[e],l&&"min-w-9",r),type:"button",...i,children:[n&&d(wt,{className:Y("transition-[margin] duration-200",l&&"-mx-0.5",o),name:n}),d(Fe,{visible:!!t,dep:t,children:d("span",{className:"block whitespace-nowrap max-w-64 truncate px-1.5",children:t})})]})});function yr({className:e,...t}){const{status:n,isSpeaking:r}=de(),o=fn(),a=fe(),i=Q(()=>n.value!=="connected"?a.connecting_status.value:o.value?a.chatting_status.value:r.value?a.speaking_status.value:a.listening_status.value),[s,l]=S(i.peek());return je(()=>{const c=i.value;if(n.value==="connected"&&r.value)l(c);else{const f=setTimeout(()=>{l(c)},500);return()=>clearTimeout(f)}}),d("div",{className:Y("py-1.5 px-3 bg-base-active overflow-hidden rounded-bubble text-sm",e),...t,children:d(ke,{initial:!1,active:!0,children:d("div",{className:"animate-text whitespace-nowrap transition-[opacity,transform] ease-out duration-200 data-hidden:opacity-0 transform data-hidden:translate-y-2",children:s})},s)})}function Va(e,[t,n]){return Math.min(n,Math.max(t,e))}function oe(e,t,{checkForDefaultPrevented:n=!0}={}){return function(r){if(e==null||e(r),n===!1||!r.defaultPrevented)return t==null?void 0:t(r)}}function br(e,t=[]){let n=[];function r(a,i){const s=ie(i),l=n.length;n=[...n,i];const c=u=>{var v;const{scope:h,children:g,...p}=u,m=((v=h==null?void 0:h[e])==null?void 0:v[l])||s,_=B(()=>p,Object.values(p));return d(m.Provider,{value:_,children:g})};c.displayName=a+"Provider";function f(u,v){var h;const g=((h=v==null?void 0:v[e])==null?void 0:h[l])||s,p=We(g);if(p)return p;if(i!==void 0)return i;throw new Error(`\`${u}\` must be used within \`${a}\``)}return[c,f]}const o=()=>{const a=n.map(i=>ie(i));return function(i){const s=(i==null?void 0:i[e])||a;return B(()=>({[`__scope${e}`]:{...i,[e]:s}}),[i,s])}};return o.scopeName=e,[r,pc(o,...t)]}function pc(...e){const t=e[0];if(e.length===1)return t;const n=()=>{const r=e.map(o=>({useScope:o(),scopeName:o.scopeName}));return function(o){const a=r.reduce((i,{useScope:s,scopeName:l})=>{const c=s(o)[`__scope${l}`];return{...i,...c}},{});return B(()=>({[`__scope${t.scopeName}`]:a}),[a])}};return n.scopeName=t.scopeName,n}function hc(e){const t=e+"CollectionProvider",[n,r]=br(t),[o,a]=n(t,{collectionRef:{current:null},itemMap:new Map}),i=p=>{const{scope:m,children:_}=p,w=Re.useRef(null),y=Re.useRef(new Map).current;return d(o,{scope:m,itemMap:y,collectionRef:w,children:_})};i.displayName=t;const s=e+"CollectionSlot",l=Bt(s),c=Re.forwardRef((p,m)=>{const{scope:_,children:w}=p,y=a(s,_),b=le(m,y.collectionRef);return d(l,{ref:b,children:w})});c.displayName=s;const f=e+"CollectionItemSlot",u="data-radix-collection-item",v=Bt(f),h=Re.forwardRef((p,m)=>{const{scope:_,children:w,...y}=p,b=Re.useRef(null),C=le(m,b),k=a(f,_);return Re.useEffect(()=>(k.itemMap.set(b,{ref:b,...y}),()=>void k.itemMap.delete(b))),d(v,{[u]:"",ref:C,children:w})});h.displayName=f;function g(p){const m=a(e+"CollectionConsumer",p);return Re.useCallback(()=>{const _=m.collectionRef.current;if(!_)return[];const w=Array.from(_.querySelectorAll(`[${u}]`));return Array.from(m.itemMap.values()).sort((y,b)=>w.indexOf(y.ref.current)-w.indexOf(b.ref.current))},[m.collectionRef,m.itemMap])}return[{Provider:i,Slot:c,ItemSlot:h},g,r]}var vc=ie(void 0);function mc(e){const t=We(vc);return e||t||"ltr"}var gc=["a","button","div","form","h2","h3","img","input","label","li","nav","ol","p","select","span","svg","ul"],te=gc.reduce((e,t)=>{const n=Bt(`Primitive.${t}`),r=I((o,a)=>{const{asChild:i,...s}=o,l=i?n:t;return typeof window<"u"&&(window[Symbol.for("radix-ui")]=!0),d(l,{...s,ref:a})});return r.displayName=`Primitive.${t}`,{...e,[t]:r}},{});function _c(e,t){e&&rn(()=>e.dispatchEvent(t))}function rt(e){const t=E(e);return A(()=>{t.current=e}),B(()=>(...n)=>{var r;return(r=t.current)==null?void 0:r.call(t,...n)},[])}function wc(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e);A(()=>{const r=o=>{o.key==="Escape"&&n(o)};return t.addEventListener("keydown",r,{capture:!0}),()=>t.removeEventListener("keydown",r,{capture:!0})},[n,t])}var yc="DismissableLayer",xr="dismissableLayer.update",bc="dismissableLayer.pointerDownOutside",xc="dismissableLayer.focusOutside",ja,Ya=ie({layers:new Set,layersWithOutsidePointerEventsDisabled:new Set,branches:new Set}),qa=I((e,t)=>{const{disableOutsidePointerEvents:n=!1,onEscapeKeyDown:r,onPointerDownOutside:o,onFocusOutside:a,onInteractOutside:i,onDismiss:s,...l}=e,c=We(Ya),[f,u]=S(null),v=(f==null?void 0:f.ownerDocument)??(globalThis==null?void 0:globalThis.document),[,h]=S({}),g=le(t,x=>u(x)),p=Array.from(c.layers),[m]=[...c.layersWithOutsidePointerEventsDisabled].slice(-1),_=p.indexOf(m),w=f?p.indexOf(f):-1,y=c.layersWithOutsidePointerEventsDisabled.size>0,b=w>=_,C=Sc(x=>{const P=x.target,D=[...c.branches].some(F=>F.contains(P));!b||D||(o==null||o(x),i==null||i(x),x.defaultPrevented||s==null||s())},v),k=Ec(x=>{const P=x.target;[...c.branches].some(D=>D.contains(P))||(a==null||a(x),i==null||i(x),x.defaultPrevented||s==null||s())},v);return wc(x=>{w===c.layers.size-1&&(r==null||r(x),!x.defaultPrevented&&s&&(x.preventDefault(),s()))},v),A(()=>{if(f)return n&&(c.layersWithOutsidePointerEventsDisabled.size===0&&(ja=v.body.style.pointerEvents,v.body.style.pointerEvents="none"),c.layersWithOutsidePointerEventsDisabled.add(f)),c.layers.add(f),Xa(),()=>{n&&c.layersWithOutsidePointerEventsDisabled.size===1&&(v.body.style.pointerEvents=ja)}},[f,v,n,c]),A(()=>()=>{f&&(c.layers.delete(f),c.layersWithOutsidePointerEventsDisabled.delete(f),Xa())},[f,c]),A(()=>{const x=()=>h({});return document.addEventListener(xr,x),()=>document.removeEventListener(xr,x)},[]),d(te.div,{...l,ref:g,style:{pointerEvents:y?b?"auto":"none":void 0,...e.style},onFocusCapture:oe(e.onFocusCapture,k.onFocusCapture),onBlurCapture:oe(e.onBlurCapture,k.onBlurCapture),onPointerDownCapture:oe(e.onPointerDownCapture,C.onPointerDownCapture)})});qa.displayName=yc;var Cc="DismissableLayerBranch",kc=I((e,t)=>{const n=We(Ya),r=E(null),o=le(t,r);return A(()=>{const a=r.current;if(a)return n.branches.add(a),()=>{n.branches.delete(a)}},[n.branches]),d(te.div,{...e,ref:o})});kc.displayName=Cc;function Sc(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e),r=E(!1),o=E(()=>{});return A(()=>{const a=s=>{if(s.target&&!r.current){let l=function(){Ka(bc,n,c,{discrete:!0})};const c={originalEvent:s};s.pointerType==="touch"?(t.removeEventListener("click",o.current),o.current=l,t.addEventListener("click",o.current,{once:!0})):l()}else t.removeEventListener("click",o.current);r.current=!1},i=window.setTimeout(()=>{t.addEventListener("pointerdown",a)},0);return()=>{window.clearTimeout(i),t.removeEventListener("pointerdown",a),t.removeEventListener("click",o.current)}},[t,n]),{onPointerDownCapture:()=>r.current=!0}}function Ec(e,t=globalThis==null?void 0:globalThis.document){const n=rt(e),r=E(!1);return A(()=>{const o=a=>{a.target&&!r.current&&Ka(xc,n,{originalEvent:a},{discrete:!1})};return t.addEventListener("focusin",o),()=>t.removeEventListener("focusin",o)},[t,n]),{onFocusCapture:()=>r.current=!0,onBlurCapture:()=>r.current=!1}}function Xa(){const e=new CustomEvent(xr);document.dispatchEvent(e)}function Ka(e,t,n,{discrete:r}){const o=n.originalEvent.target,a=new CustomEvent(e,{bubbles:!1,cancelable:!0,detail:n});t&&o.addEventListener(e,t,{once:!0}),r?_c(o,a):o.dispatchEvent(a)}var Cr=0;function Tc(){A(()=>{const e=document.querySelectorAll("[data-radix-focus-guard]");return document.body.insertAdjacentElement("afterbegin",e[0]??Ga()),document.body.insertAdjacentElement("beforeend",e[1]??Ga()),Cr++,()=>{Cr===1&&document.querySelectorAll("[data-radix-focus-guard]").forEach(t=>t.remove()),Cr--}},[])}function Ga(){const e=document.createElement("span");return e.setAttribute("data-radix-focus-guard",""),e.tabIndex=0,e.style.outline="none",e.style.opacity="0",e.style.position="fixed",e.style.pointerEvents="none",e}var kr="focusScope.autoFocusOnMount",Sr="focusScope.autoFocusOnUnmount",Za={bubbles:!1,cancelable:!0},Nc="FocusScope",Ja=I((e,t)=>{const{loop:n=!1,trapped:r=!1,onMountAutoFocus:o,onUnmountAutoFocus:a,...i}=e,[s,l]=S(null),c=rt(o),f=rt(a),u=E(null),v=le(t,p=>l(p)),h=E({paused:!1,pause(){this.paused=!0},resume(){this.paused=!1}}).current;A(()=>{if(r){let p=function(y){if(h.paused||!s)return;const b=y.target;s.contains(b)?u.current=b:qe(u.current,{select:!0})},m=function(y){if(h.paused||!s)return;const b=y.relatedTarget;b!==null&&(s.contains(b)||qe(u.current,{select:!0}))},_=function(y){if(document.activeElement===document.body)for(const b of y)b.removedNodes.length>0&&qe(s)};document.addEventListener("focusin",p),document.addEventListener("focusout",m);const w=new MutationObserver(_);return s&&w.observe(s,{childList:!0,subtree:!0}),()=>{document.removeEventListener("focusin",p),document.removeEventListener("focusout",m),w.disconnect()}}},[r,s,h.paused]),A(()=>{if(s){ti.add(h);const p=document.activeElement;if(!s.contains(p)){const m=new CustomEvent(kr,Za);s.addEventListener(kr,c),s.dispatchEvent(m),m.defaultPrevented||(Pc(Mc(Qa(s)),{select:!0}),document.activeElement===p&&qe(s))}return()=>{s.removeEventListener(kr,c),setTimeout(()=>{const m=new CustomEvent(Sr,Za);s.addEventListener(Sr,f),s.dispatchEvent(m),m.defaultPrevented||qe(p??document.body,{select:!0}),s.removeEventListener(Sr,f),ti.remove(h)},0)}}},[s,c,f,h]);const g=$(p=>{if(!n&&!r||h.paused)return;const m=p.key==="Tab"&&!p.altKey&&!p.ctrlKey&&!p.metaKey,_=document.activeElement;if(m&&_){const w=p.currentTarget,[y,b]=Ac(w);y&&b?!p.shiftKey&&_===b?(p.preventDefault(),n&&qe(y,{select:!0})):p.shiftKey&&_===y&&(p.preventDefault(),n&&qe(b,{select:!0})):_===w&&p.preventDefault()}},[n,r,h.paused]);return d(te.div,{tabIndex:-1,...i,ref:v,onKeyDown:g})});Ja.displayName=Nc;function Pc(e,{select:t=!1}={}){const n=document.activeElement;for(const r of e)if(qe(r,{select:t}),document.activeElement!==n)return}function Ac(e){const t=Qa(e),n=ei(t,e),r=ei(t.reverse(),e);return[n,r]}function Qa(e){const t=[],n=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,{acceptNode:r=>{const o=r.tagName==="INPUT"&&r.type==="hidden";return r.disabled||r.hidden||o?NodeFilter.FILTER_SKIP:r.tabIndex>=0?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_SKIP}});for(;n.nextNode();)t.push(n.currentNode);return t}function ei(e,t){for(const n of e)if(!$c(n,{upTo:t}))return n}function $c(e,{upTo:t}){if(getComputedStyle(e).visibility==="hidden")return!0;for(;e;){if(t!==void 0&&e===t)return!1;if(getComputedStyle(e).display==="none")return!0;e=e.parentElement}return!1}function Ic(e){return e instanceof HTMLInputElement&&"select"in e}function qe(e,{select:t=!1}={}){if(e&&e.focus){const n=document.activeElement;e.focus({preventScroll:!0}),e!==n&&Ic(e)&&t&&e.select()}}var ti=Dc();function Dc(){let e=[];return{add(t){const n=e[0];t!==n&&(n==null||n.pause()),e=ni(e,t),e.unshift(t)},remove(t){var n;e=ni(e,t),(n=e[0])==null||n.resume()}}}function ni(e,t){const n=[...e],r=n.indexOf(t);return r!==-1&&n.splice(r,1),n}function Mc(e){return e.filter(t=>t.tagName!=="A")}var pe=globalThis!=null&&globalThis.document?Oe:()=>{},Oc=na[" useId ".trim().toString()]||(()=>{}),Lc=0;function Er(e){const[t,n]=S(Oc());return pe(()=>{n(r=>r??String(Lc++))},[e]),t?`radix-${t}`:""}const Rc=["top","right","bottom","left"],Xe=Math.min,ge=Math.max,hn=Math.round,vn=Math.floor,Pe=e=>({x:e,y:e}),Fc={left:"right",right:"left",bottom:"top",top:"bottom"},zc={start:"end",end:"start"};function Tr(e,t,n){return ge(e,Xe(t,n))}function ze(e,t){return typeof e=="function"?e(t):e}function Ue(e){return e.split("-")[0]}function yt(e){return e.split("-")[1]}function Nr(e){return e==="x"?"y":"x"}function Pr(e){return e==="y"?"height":"width"}function Ke(e){return["top","bottom"].includes(Ue(e))?"y":"x"}function Ar(e){return Nr(Ke(e))}function Uc(e,t,n){n===void 0&&(n=!1);const r=yt(e),o=Ar(e),a=Pr(o);let i=o==="x"?r===(n?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[a]>t.floating[a]&&(i=mn(i)),[i,mn(i)]}function Bc(e){const t=mn(e);return[$r(e),t,$r(t)]}function $r(e){return e.replace(/start|end/g,t=>zc[t])}function Wc(e,t,n){const r=["left","right"],o=["right","left"],a=["top","bottom"],i=["bottom","top"];switch(e){case"top":case"bottom":return n?t?o:r:t?r:o;case"left":case"right":return t?a:i;default:return[]}}function Hc(e,t,n,r){const o=yt(e);let a=Wc(Ue(e),n==="start",r);return o&&(a=a.map(i=>i+"-"+o),t&&(a=a.concat(a.map($r)))),a}function mn(e){return e.replace(/left|right|bottom|top/g,t=>Fc[t])}function Vc(e){return{top:0,right:0,bottom:0,left:0,...e}}function ri(e){return typeof e!="number"?Vc(e):{top:e,right:e,bottom:e,left:e}}function gn(e){const{x:t,y:n,width:r,height:o}=e;return{width:r,height:o,top:n,left:t,right:t+r,bottom:n+o,x:t,y:n}}function oi(e,t,n){let{reference:r,floating:o}=e;const a=Ke(t),i=Ar(t),s=Pr(i),l=Ue(t),c=a==="y",f=r.x+r.width/2-o.width/2,u=r.y+r.height/2-o.height/2,v=r[s]/2-o[s]/2;let h;switch(l){case"top":h={x:f,y:r.y-o.height};break;case"bottom":h={x:f,y:r.y+r.height};break;case"right":h={x:r.x+r.width,y:u};break;case"left":h={x:r.x-o.width,y:u};break;default:h={x:r.x,y:r.y}}switch(yt(t)){case"start":h[i]-=v*(n&&c?-1:1);break;case"end":h[i]+=v*(n&&c?-1:1);break}return h}const jc=async(e,t,n)=>{const{placement:r="bottom",strategy:o="absolute",middleware:a=[],platform:i}=n,s=a.filter(Boolean),l=await(i.isRTL==null?void 0:i.isRTL(t));let c=await i.getElementRects({reference:e,floating:t,strategy:o}),{x:f,y:u}=oi(c,r,l),v=r,h={},g=0;for(let p=0;p<s.length;p++){const{name:m,fn:_}=s[p],{x:w,y,data:b,reset:C}=await _({x:f,y:u,initialPlacement:r,placement:v,strategy:o,middlewareData:h,rects:c,platform:i,elements:{reference:e,floating:t}});f=w??f,u=y??u,h={...h,[m]:{...h[m],...b}},C&&g<=50&&(g++,typeof C=="object"&&(C.placement&&(v=C.placement),C.rects&&(c=C.rects===!0?await i.getElementRects({reference:e,floating:t,strategy:o}):C.rects),{x:f,y:u}=oi(c,v,l)),p=-1)}return{x:f,y:u,placement:v,strategy:o,middlewareData:h}};async function Wt(e,t){var n;t===void 0&&(t={});const{x:r,y:o,platform:a,rects:i,elements:s,strategy:l}=e,{boundary:c="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:v=!1,padding:h=0}=ze(t,e),g=ri(h),p=s[v?u==="floating"?"reference":"floating":u],m=gn(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(p)))==null||n?p:p.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:c,rootBoundary:f,strategy:l})),_=u==="floating"?{x:r,y:o,width:i.floating.width,height:i.floating.height}:i.reference,w=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(w))?await(a.getScale==null?void 0:a.getScale(w))||{x:1,y:1}:{x:1,y:1},b=gn(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:w,strategy:l}):_);return{top:(m.top-b.top+g.top)/y.y,bottom:(b.bottom-m.bottom+g.bottom)/y.y,left:(m.left-b.left+g.left)/y.x,right:(b.right-m.right+g.right)/y.x}}const Yc=e=>({name:"arrow",options:e,async fn(t){const{x:n,y:r,placement:o,rects:a,platform:i,elements:s,middlewareData:l}=t,{element:c,padding:f=0}=ze(e,t)||{};if(c==null)return{};const u=ri(f),v={x:n,y:r},h=Ar(o),g=Pr(h),p=await i.getDimensions(c),m=h==="y",_=m?"top":"left",w=m?"bottom":"right",y=m?"clientHeight":"clientWidth",b=a.reference[g]+a.reference[h]-v[h]-a.floating[g],C=v[h]-a.reference[h],k=await(i.getOffsetParent==null?void 0:i.getOffsetParent(c));let x=k?k[y]:0;(!x||!await(i.isElement==null?void 0:i.isElement(k)))&&(x=s.floating[y]||a.floating[g]);const P=b/2-C/2,D=x/2-p[g]/2-1,F=Xe(u[_],D),O=Xe(u[w],D),L=F,X=x-p[g]-O,z=x/2-p[g]/2+P,ne=Tr(L,z,X),R=!l.arrow&&yt(o)!=null&&z!==ne&&a.reference[g]/2-(z<L?F:O)-p[g]/2<0,V=R?z<L?z-L:z-X:0;return{[h]:v[h]+V,data:{[h]:ne,centerOffset:z-ne-V,...R&&{alignmentOffset:V}},reset:R}}}),qc=function(e){return e===void 0&&(e={}),{name:"flip",options:e,async fn(t){var n,r;const{placement:o,middlewareData:a,rects:i,initialPlacement:s,platform:l,elements:c}=t,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:v,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:g="none",flipAlignment:p=!0,...m}=ze(e,t);if((n=a.arrow)!=null&&n.alignmentOffset)return{};const _=Ue(o),w=Ke(s),y=Ue(s)===s,b=await(l.isRTL==null?void 0:l.isRTL(c.floating)),C=v||(y||!p?[mn(s)]:Bc(s)),k=g!=="none";!v&&k&&C.push(...Hc(s,p,g,b));const x=[s,...C],P=await Wt(t,m),D=[];let F=((r=a.flip)==null?void 0:r.overflows)||[];if(f&&D.push(P[_]),u){const z=Uc(o,i,b);D.push(P[z[0]],P[z[1]])}if(F=[...F,{placement:o,overflows:D}],!D.every(z=>z<=0)){var O,L;const z=(((O=a.flip)==null?void 0:O.index)||0)+1,ne=x[z];if(ne)return{data:{index:z,overflows:F},reset:{placement:ne}};let R=(L=F.filter(V=>V.overflows[0]<=0).sort((V,M)=>V.overflows[1]-M.overflows[1])[0])==null?void 0:L.placement;if(!R)switch(h){case"bestFit":{var X;const V=(X=F.filter(M=>{if(k){const j=Ke(M.placement);return j===w||j==="y"}return!0}).map(M=>[M.placement,M.overflows.filter(j=>j>0).reduce((j,he)=>j+he,0)]).sort((M,j)=>M[1]-j[1])[0])==null?void 0:X[0];V&&(R=V);break}case"initialPlacement":R=s;break}if(o!==R)return{reset:{placement:R}}}return{}}}};function ai(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function ii(e){return Rc.some(t=>e[t]>=0)}const Xc=function(e){return e===void 0&&(e={}),{name:"hide",options:e,async fn(t){const{rects:n}=t,{strategy:r="referenceHidden",...o}=ze(e,t);switch(r){case"referenceHidden":{const a=await Wt(t,{...o,elementContext:"reference"}),i=ai(a,n.reference);return{data:{referenceHiddenOffsets:i,referenceHidden:ii(i)}}}case"escaped":{const a=await Wt(t,{...o,altBoundary:!0}),i=ai(a,n.floating);return{data:{escapedOffsets:i,escaped:ii(i)}}}default:return{}}}}};async function Kc(e,t){const{placement:n,platform:r,elements:o}=e,a=await(r.isRTL==null?void 0:r.isRTL(o.floating)),i=Ue(n),s=yt(n),l=Ke(n)==="y",c=["left","top"].includes(i)?-1:1,f=a&&l?-1:1,u=ze(t,e);let{mainAxis:v,crossAxis:h,alignmentAxis:g}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return s&&typeof g=="number"&&(h=s==="end"?g*-1:g),l?{x:h*f,y:v*c}:{x:v*c,y:h*f}}const Gc=function(e){return e===void 0&&(e=0),{name:"offset",options:e,async fn(t){var n,r;const{x:o,y:a,placement:i,middlewareData:s}=t,l=await Kc(t,e);return i===((n=s.offset)==null?void 0:n.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:o+l.x,y:a+l.y,data:{...l,placement:i}}}}},Zc=function(e){return e===void 0&&(e={}),{name:"shift",options:e,async fn(t){const{x:n,y:r,placement:o}=t,{mainAxis:a=!0,crossAxis:i=!1,limiter:s={fn:m=>{let{x:_,y:w}=m;return{x:_,y:w}}},...l}=ze(e,t),c={x:n,y:r},f=await Wt(t,l),u=Ke(Ue(o)),v=Nr(u);let h=c[v],g=c[u];if(a){const m=v==="y"?"top":"left",_=v==="y"?"bottom":"right",w=h+f[m],y=h-f[_];h=Tr(w,h,y)}if(i){const m=u==="y"?"top":"left",_=u==="y"?"bottom":"right",w=g+f[m],y=g-f[_];g=Tr(w,g,y)}const p=s.fn({...t,[v]:h,[u]:g});return{...p,data:{x:p.x-n,y:p.y-r,enabled:{[v]:a,[u]:i}}}}}},Jc=function(e){return e===void 0&&(e={}),{options:e,fn(t){const{x:n,y:r,placement:o,rects:a,middlewareData:i}=t,{offset:s=0,mainAxis:l=!0,crossAxis:c=!0}=ze(e,t),f={x:n,y:r},u=Ke(o),v=Nr(u);let h=f[v],g=f[u];const p=ze(s,t),m=typeof p=="number"?{mainAxis:p,crossAxis:0}:{mainAxis:0,crossAxis:0,...p};if(l){const y=v==="y"?"height":"width",b=a.reference[v]-a.floating[y]+m.mainAxis,C=a.reference[v]+a.reference[y]-m.mainAxis;h<b?h=b:h>C&&(h=C)}if(c){var _,w;const y=v==="y"?"width":"height",b=["top","left"].includes(Ue(o)),C=a.reference[u]-a.floating[y]+(b&&((_=i.offset)==null?void 0:_[u])||0)+(b?0:m.crossAxis),k=a.reference[u]+a.reference[y]+(b?0:((w=i.offset)==null?void 0:w[u])||0)-(b?m.crossAxis:0);g<C?g=C:g>k&&(g=k)}return{[v]:h,[u]:g}}}},Qc=function(e){return e===void 0&&(e={}),{name:"size",options:e,async fn(t){var n,r;const{placement:o,rects:a,platform:i,elements:s}=t,{apply:l=()=>{},...c}=ze(e,t),f=await Wt(t,c),u=Ue(o),v=yt(o),h=Ke(o)==="y",{width:g,height:p}=a.floating;let m,_;u==="top"||u==="bottom"?(m=u,_=v===(await(i.isRTL==null?void 0:i.isRTL(s.floating))?"start":"end")?"left":"right"):(_=u,m=v==="end"?"top":"bottom");const w=p-f.top-f.bottom,y=g-f.left-f.right,b=Xe(p-f[m],w),C=Xe(g-f[_],y),k=!t.middlewareData.shift;let x=b,P=C;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(P=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(x=w),k&&!v){const F=ge(f.left,0),O=ge(f.right,0),L=ge(f.top,0),X=ge(f.bottom,0);h?P=g-2*(F!==0||O!==0?F+O:ge(f.left,f.right)):x=p-2*(L!==0||X!==0?L+X:ge(f.top,f.bottom))}await l({...t,availableWidth:P,availableHeight:x});const D=await i.getDimensions(s.floating);return g!==D.width||p!==D.height?{reset:{rects:!0}}:{}}}};function _n(){return typeof window<"u"}function bt(e){return si(e)?(e.nodeName||"").toLowerCase():"#document"}function _e(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ae(e){var t;return(t=(si(e)?e.ownerDocument:e.document)||window.document)==null?void 0:t.documentElement}function si(e){return _n()?e instanceof Node||e instanceof _e(e).Node:!1}function Se(e){return _n()?e instanceof Element||e instanceof _e(e).Element:!1}function $e(e){return _n()?e instanceof HTMLElement||e instanceof _e(e).HTMLElement:!1}function li(e){return!_n()||typeof ShadowRoot>"u"?!1:e instanceof ShadowRoot||e instanceof _e(e).ShadowRoot}function Ht(e){const{overflow:t,overflowX:n,overflowY:r,display:o}=Ee(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!["inline","contents"].includes(o)}function eu(e){return["table","td","th"].includes(bt(e))}function wn(e){return[":popover-open",":modal"].some(t=>{try{return e.matches(t)}catch{return!1}})}function Ir(e){const t=Dr(),n=Se(e)?Ee(e):e;return["transform","translate","scale","rotate","perspective"].some(r=>n[r]?n[r]!=="none":!1)||(n.containerType?n.containerType!=="normal":!1)||!t&&(n.backdropFilter?n.backdropFilter!=="none":!1)||!t&&(n.filter?n.filter!=="none":!1)||["transform","translate","scale","rotate","perspective","filter"].some(r=>(n.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(n.contain||"").includes(r))}function tu(e){let t=Ge(e);for(;$e(t)&&!xt(t);){if(Ir(t))return t;if(wn(t))return null;t=Ge(t)}return null}function Dr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function xt(e){return["html","body","#document"].includes(bt(e))}function Ee(e){return _e(e).getComputedStyle(e)}function yn(e){return Se(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Ge(e){if(bt(e)==="html")return e;const t=e.assignedSlot||e.parentNode||li(e)&&e.host||Ae(e);return li(t)?t.host:t}function ci(e){const t=Ge(e);return xt(t)?e.ownerDocument?e.ownerDocument.body:e.body:$e(t)&&Ht(t)?t:ci(t)}function Vt(e,t,n){var r;t===void 0&&(t=[]),n===void 0&&(n=!0);const o=ci(e),a=o===((r=e.ownerDocument)==null?void 0:r.body),i=_e(o);if(a){const s=Mr(i);return t.concat(i,i.visualViewport||[],Ht(o)?o:[],s&&n?Vt(s):[])}return t.concat(o,Vt(o,[],n))}function Mr(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ui(e){const t=Ee(e);let n=parseFloat(t.width)||0,r=parseFloat(t.height)||0;const o=$e(e),a=o?e.offsetWidth:n,i=o?e.offsetHeight:r,s=hn(n)!==a||hn(r)!==i;return s&&(n=a,r=i),{width:n,height:r,$:s}}function Or(e){return Se(e)?e:e.contextElement}function Ct(e){const t=Or(e);if(!$e(t))return Pe(1);const n=t.getBoundingClientRect(),{width:r,height:o,$:a}=ui(t);let i=(a?hn(n.width):n.width)/r,s=(a?hn(n.height):n.height)/o;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const nu=Pe(0);function di(e){const t=_e(e);return!Dr()||!t.visualViewport?nu:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ru(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==_e(e)?!1:t}function ot(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);const o=e.getBoundingClientRect(),a=Or(e);let i=Pe(1);t&&(r?Se(r)&&(i=Ct(r)):i=Ct(e));const s=ru(a,n,r)?di(a):Pe(0);let l=(o.left+s.x)/i.x,c=(o.top+s.y)/i.y,f=o.width/i.x,u=o.height/i.y;if(a){const v=_e(a),h=r&&Se(r)?_e(r):r;let g=v,p=Mr(g);for(;p&&r&&h!==g;){const m=Ct(p),_=p.getBoundingClientRect(),w=Ee(p),y=_.left+(p.clientLeft+parseFloat(w.paddingLeft))*m.x,b=_.top+(p.clientTop+parseFloat(w.paddingTop))*m.y;l*=m.x,c*=m.y,f*=m.x,u*=m.y,l+=y,c+=b,g=_e(p),p=Mr(g)}}return gn({width:f,height:u,x:l,y:c})}function Lr(e,t){const n=yn(e).scrollLeft;return t?t.left+n:ot(Ae(e)).left+n}function fi(e,t,n){n===void 0&&(n=!1);const r=e.getBoundingClientRect(),o=r.left+t.scrollLeft-(n?0:Lr(e,r)),a=r.top+t.scrollTop;return{x:o,y:a}}function ou(e){let{elements:t,rect:n,offsetParent:r,strategy:o}=e;const a=o==="fixed",i=Ae(r),s=t?wn(t.floating):!1;if(r===i||s&&a)return n;let l={scrollLeft:0,scrollTop:0},c=Pe(1);const f=Pe(0),u=$e(r);if((u||!u&&!a)&&((bt(r)!=="body"||Ht(i))&&(l=yn(r)),$e(r))){const h=ot(r);c=Ct(r),f.x=h.x+r.clientLeft,f.y=h.y+r.clientTop}const v=i&&!u&&!a?fi(i,l,!0):Pe(0);return{width:n.width*c.x,height:n.height*c.y,x:n.x*c.x-l.scrollLeft*c.x+f.x+v.x,y:n.y*c.y-l.scrollTop*c.y+f.y+v.y}}function au(e){return Array.from(e.getClientRects())}function iu(e){const t=Ae(e),n=yn(e),r=e.ownerDocument.body,o=ge(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=ge(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight);let i=-n.scrollLeft+Lr(e);const s=-n.scrollTop;return Ee(r).direction==="rtl"&&(i+=ge(t.clientWidth,r.clientWidth)-o),{width:o,height:a,x:i,y:s}}function su(e,t){const n=_e(e),r=Ae(e),o=n.visualViewport;let a=r.clientWidth,i=r.clientHeight,s=0,l=0;if(o){a=o.width,i=o.height;const c=Dr();(!c||c&&t==="fixed")&&(s=o.offsetLeft,l=o.offsetTop)}return{width:a,height:i,x:s,y:l}}function lu(e,t){const n=ot(e,!0,t==="fixed"),r=n.top+e.clientTop,o=n.left+e.clientLeft,a=$e(e)?Ct(e):Pe(1),i=e.clientWidth*a.x,s=e.clientHeight*a.y,l=o*a.x,c=r*a.y;return{width:i,height:s,x:l,y:c}}function pi(e,t,n){let r;if(t==="viewport")r=su(e,n);else if(t==="document")r=iu(Ae(e));else if(Se(t))r=lu(t,n);else{const o=di(e);r={x:t.x-o.x,y:t.y-o.y,width:t.width,height:t.height}}return gn(r)}function hi(e,t){const n=Ge(e);return n===t||!Se(n)||xt(n)?!1:Ee(n).position==="fixed"||hi(n,t)}function cu(e,t){const n=t.get(e);if(n)return n;let r=Vt(e,[],!1).filter(s=>Se(s)&&bt(s)!=="body"),o=null;const a=Ee(e).position==="fixed";let i=a?Ge(e):e;for(;Se(i)&&!xt(i);){const s=Ee(i),l=Ir(i);!l&&s.position==="fixed"&&(o=null),(a?!l&&!o:!l&&s.position==="static"&&o&&["absolute","fixed"].includes(o.position)||Ht(i)&&!l&&hi(e,i))?r=r.filter(c=>c!==i):o=s,i=Ge(i)}return t.set(e,r),r}function uu(e){let{element:t,boundary:n,rootBoundary:r,strategy:o}=e;const a=[...n==="clippingAncestors"?wn(t)?[]:cu(t,this._c):[].concat(n),r],i=a[0],s=a.reduce((l,c)=>{const f=pi(t,c,o);return l.top=ge(f.top,l.top),l.right=Xe(f.right,l.right),l.bottom=Xe(f.bottom,l.bottom),l.left=ge(f.left,l.left),l},pi(t,i,o));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function du(e){const{width:t,height:n}=ui(e);return{width:t,height:n}}function fu(e,t,n){const r=$e(t),o=Ae(t),a=n==="fixed",i=ot(e,!0,a,t);let s={scrollLeft:0,scrollTop:0};const l=Pe(0);if(r||!r&&!a)if((bt(t)!=="body"||Ht(o))&&(s=yn(t)),r){const v=ot(t,!0,a,t);l.x=v.x+t.clientLeft,l.y=v.y+t.clientTop}else o&&(l.x=Lr(o));const c=o&&!r&&!a?fi(o,s):Pe(0),f=i.left+s.scrollLeft-l.x-c.x,u=i.top+s.scrollTop-l.y-c.y;return{x:f,y:u,width:i.width,height:i.height}}function Rr(e){return Ee(e).position==="static"}function vi(e,t){if(!$e(e)||Ee(e).position==="fixed")return null;if(t)return t(e);let n=e.offsetParent;return Ae(e)===n&&(n=n.ownerDocument.body),n}function mi(e,t){const n=_e(e);if(wn(e))return n;if(!$e(e)){let o=Ge(e);for(;o&&!xt(o);){if(Se(o)&&!Rr(o))return o;o=Ge(o)}return n}let r=vi(e,t);for(;r&&eu(r)&&Rr(r);)r=vi(r,t);return r&&xt(r)&&Rr(r)&&!Ir(r)?n:r||tu(e)||n}const pu=async function(e){const t=this.getOffsetParent||mi,n=this.getDimensions,r=await n(e.floating);return{reference:fu(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function hu(e){return Ee(e).direction==="rtl"}const vu={convertOffsetParentRelativeRectToViewportRelativeRect:ou,getDocumentElement:Ae,getClippingRect:uu,getOffsetParent:mi,getElementRects:pu,getClientRects:au,getDimensions:du,getScale:Ct,isElement:Se,isRTL:hu};function gi(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function mu(e,t){let n=null,r;const o=Ae(e);function a(){var s;clearTimeout(r),(s=n)==null||s.disconnect(),n=null}function i(s,l){s===void 0&&(s=!1),l===void 0&&(l=1),a();const c=e.getBoundingClientRect(),{left:f,top:u,width:v,height:h}=c;if(s||t(),!v||!h)return;const g=vn(u),p=vn(o.clientWidth-(f+v)),m=vn(o.clientHeight-(u+h)),_=vn(f),w={rootMargin:-g+"px "+-p+"px "+-m+"px "+-_+"px",threshold:ge(0,Xe(1,l))||1};let y=!0;function b(C){const k=C[0].intersectionRatio;if(k!==l){if(!y)return i();k?i(!1,k):r=setTimeout(()=>{i(!1,1e-7)},1e3)}k===1&&!gi(c,e.getBoundingClientRect())&&i(),y=!1}try{n=new IntersectionObserver(b,{...w,root:o.ownerDocument})}catch{n=new IntersectionObserver(b,w)}n.observe(e)}return i(!0),a}function gu(e,t,n,r){r===void 0&&(r={});const{ancestorScroll:o=!0,ancestorResize:a=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Or(e),f=o||a?[...c?Vt(c):[],...Vt(t)]:[];f.forEach(_=>{o&&_.addEventListener("scroll",n,{passive:!0}),a&&_.addEventListener("resize",n)});const u=c&&s?mu(c,n):null;let v=-1,h=null;i&&(h=new ResizeObserver(_=>{let[w]=_;w&&w.target===c&&h&&(h.unobserve(t),cancelAnimationFrame(v),v=requestAnimationFrame(()=>{var y;(y=h)==null||y.observe(t)})),n()}),c&&!l&&h.observe(c),h.observe(t));let g,p=l?ot(e):null;l&&m();function m(){const _=ot(e);p&&!gi(p,_)&&n(),p=_,g=requestAnimationFrame(m)}return n(),()=>{var _;f.forEach(w=>{o&&w.removeEventListener("scroll",n),a&&w.removeEventListener("resize",n)}),u==null||u(),(_=h)==null||_.disconnect(),h=null,l&&cancelAnimationFrame(g)}}const _u=Gc,wu=Zc,yu=qc,bu=Qc,xu=Xc,_i=Yc,Cu=Jc,ku=(e,t,n)=>{const r=new Map,o={platform:vu,...n},a={...o.platform,_c:r};return jc(e,t,{...o,platform:a})};var bn=typeof document<"u"?Oe:A;function xn(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e=="function"&&e.toString()===t.toString())return!0;let n,r,o;if(e&&t&&typeof e=="object"){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!xn(e[r],t[r]))return!1;return!0}if(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,o[r]))return!1;for(r=n;r--!==0;){const a=o[r];if(!(a==="_owner"&&e.$$typeof)&&!xn(e[a],t[a]))return!1}return!0}return e!==e&&t!==t}function wi(e){return typeof window>"u"?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function yi(e,t){const n=wi(e);return Math.round(t*n)/n}function Fr(e){const t=E(e);return bn(()=>{t.current=e}),t}function Su(e){e===void 0&&(e={});const{placement:t="bottom",strategy:n="absolute",middleware:r=[],platform:o,elements:{reference:a,floating:i}={},transform:s=!0,whileElementsMounted:l,open:c}=e,[f,u]=S({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[v,h]=S(r);xn(v,r)||h(r);const[g,p]=S(null),[m,_]=S(null),w=$(M=>{M!==k.current&&(k.current=M,p(M))},[]),y=$(M=>{M!==x.current&&(x.current=M,_(M))},[]),b=a||g,C=i||m,k=E(null),x=E(null),P=E(f),D=l!=null,F=Fr(l),O=Fr(o),L=Fr(c),X=$(()=>{if(!k.current||!x.current)return;const M={placement:t,strategy:n,middleware:v};O.current&&(M.platform=O.current),ku(k.current,x.current,M).then(j=>{const he={...j,isPositioned:L.current!==!1};z.current&&!xn(P.current,he)&&(P.current=he,rn(()=>{u(he)}))})},[v,t,n,O,L]);bn(()=>{c===!1&&P.current.isPositioned&&(P.current.isPositioned=!1,u(M=>({...M,isPositioned:!1})))},[c]);const z=E(!1);bn(()=>(z.current=!0,()=>{z.current=!1}),[]),bn(()=>{if(b&&(k.current=b),C&&(x.current=C),b&&C){if(F.current)return F.current(b,C,X);X()}},[b,C,X,F,D]);const ne=B(()=>({reference:k,floating:x,setReference:w,setFloating:y}),[w,y]),R=B(()=>({reference:b,floating:C}),[b,C]),V=B(()=>{const M={position:n,left:0,top:0};if(!R.floating)return M;const j=yi(R.floating,f.x),he=yi(R.floating,f.y);return s?{...M,transform:"translate("+j+"px, "+he+"px)",...wi(R.floating)>=1.5&&{willChange:"transform"}}:{position:n,left:j,top:he}},[n,s,R.floating,f.x,f.y]);return B(()=>({...f,update:X,refs:ne,elements:R,floatingStyles:V}),[f,X,ne,R,V])}const Eu=e=>{function t(n){return{}.hasOwnProperty.call(n,"current")}return{name:"arrow",options:e,fn(n){const{element:r,padding:o}=typeof e=="function"?e(n):e;return r&&t(r)?r.current!=null?_i({element:r.current,padding:o}).fn(n):{}:r?_i({element:r,padding:o}).fn(n):{}}}},Tu=(e,t)=>({..._u(e),options:[e,t]}),Nu=(e,t)=>({...wu(e),options:[e,t]}),Pu=(e,t)=>({...Cu(e),options:[e,t]}),Au=(e,t)=>({...yu(e),options:[e,t]}),$u=(e,t)=>({...bu(e),options:[e,t]}),Iu=(e,t)=>({...xu(e),options:[e,t]}),Du=(e,t)=>({...Eu(e),options:[e,t]});var Mu="Arrow",bi=I((e,t)=>{const{children:n,width:r=10,height:o=5,...a}=e;return d(te.svg,{...a,ref:t,width:r,height:o,viewBox:"0 0 30 10",preserveAspectRatio:"none",children:e.asChild?n:d("polygon",{points:"0,0 30,0 15,10"})})});bi.displayName=Mu;var Ou=bi;function Lu(e){const[t,n]=S(void 0);return pe(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});const r=new ResizeObserver(o=>{if(!Array.isArray(o)||!o.length)return;const a=o[0];let i,s;if("borderBoxSize"in a){const l=a.borderBoxSize,c=Array.isArray(l)?l[0]:l;i=c.inlineSize,s=c.blockSize}else i=e.offsetWidth,s=e.offsetHeight;n({width:i,height:s})});return r.observe(e,{box:"border-box"}),()=>r.unobserve(e)}else n(void 0)},[e]),t}var zr="Popper",[xi,Ci]=br(zr),[Ru,ki]=xi(zr),Si=e=>{const{__scopePopper:t,children:n}=e,[r,o]=S(null);return d(Ru,{scope:t,anchor:r,onAnchorChange:o,children:n})};Si.displayName=zr;var Ei="PopperAnchor",Ti=I((e,t)=>{const{__scopePopper:n,virtualRef:r,...o}=e,a=ki(Ei,n),i=E(null),s=le(t,i);return A(()=>{a.onAnchorChange((r==null?void 0:r.current)||i.current)}),r?null:d(te.div,{...o,ref:s})});Ti.displayName=Ei;var Ur="PopperContent",[Fu,zu]=xi(Ur),Ni=I((e,t)=>{var n,r,o,a,i,s;const{__scopePopper:l,side:c="bottom",sideOffset:f=0,align:u="center",alignOffset:v=0,arrowPadding:h=0,avoidCollisions:g=!0,collisionBoundary:p=[],collisionPadding:m=0,sticky:_="partial",hideWhenDetached:w=!1,updatePositionStrategy:y="optimized",onPlaced:b,...C}=e,k=ki(Ur,l),[x,P]=S(null),D=le(t,ye=>P(ye)),[F,O]=S(null),L=Lu(F),X=(L==null?void 0:L.width)??0,z=(L==null?void 0:L.height)??0,ne=c+(u!=="center"?"-"+u:""),R=typeof m=="number"?m:{top:0,right:0,bottom:0,left:0,...m},V=Array.isArray(p)?p:[p],M=V.length>0,j={padding:R,boundary:V.filter(Bu),altBoundary:M},{refs:he,floatingStyles:st,placement:Yt,isPositioned:Qe,middlewareData:we}=Su({strategy:"fixed",placement:ne,whileElementsMounted:(...ye)=>gu(...ye,{animationFrame:y==="always"}),elements:{reference:k.anchor},middleware:[Tu({mainAxis:f+z,alignmentAxis:v}),g&&Nu({mainAxis:!0,crossAxis:!1,limiter:_==="partial"?Pu():void 0,...j}),g&&Au({...j}),$u({...j,apply:({elements:ye,rects:qt,availableWidth:Xt,availableHeight:Kt})=>{const{width:Hf,height:Vf}=qt.reference,Mn=ye.floating.style;Mn.setProperty("--radix-popper-available-width",`${Xt}px`),Mn.setProperty("--radix-popper-available-height",`${Kt}px`),Mn.setProperty("--radix-popper-anchor-width",`${Hf}px`),Mn.setProperty("--radix-popper-anchor-height",`${Vf}px`)}}),F&&Du({element:F,padding:h}),Wu({arrowWidth:X,arrowHeight:z}),w&&Iu({strategy:"referenceHidden",...j})]}),[lt,ct]=$i(Yt),N=rt(b);pe(()=>{Qe&&(N==null||N())},[Qe,N]);const G=(n=we.arrow)==null?void 0:n.x,re=(r=we.arrow)==null?void 0:r.y,U=((o=we.arrow)==null?void 0:o.centerOffset)!==0,[J,ae]=S();return pe(()=>{x&&ae(window.getComputedStyle(x).zIndex)},[x]),d("div",{ref:he.setFloating,"data-radix-popper-content-wrapper":"",style:{...st,transform:Qe?st.transform:"translate(0, -200%)",minWidth:"max-content",zIndex:J,"--radix-popper-transform-origin":[(a=we.transformOrigin)==null?void 0:a.x,(i=we.transformOrigin)==null?void 0:i.y].join(" "),...((s=we.hide)==null?void 0:s.referenceHidden)&&{visibility:"hidden",pointerEvents:"none"}},dir:e.dir,children:d(Fu,{scope:l,placedSide:lt,onArrowChange:O,arrowX:G,arrowY:re,shouldHideArrow:U,children:d(te.div,{"data-side":lt,"data-align":ct,...C,ref:D,style:{...C.style,animation:Qe?void 0:"none"}})})})});Ni.displayName=Ur;var Pi="PopperArrow",Uu={top:"bottom",right:"left",bottom:"top",left:"right"},Ai=I(function(e,t){const{__scopePopper:n,...r}=e,o=zu(Pi,n),a=Uu[o.placedSide];return d("span",{ref:o.onArrowChange,style:{position:"absolute",left:o.arrowX,top:o.arrowY,[a]:0,transformOrigin:{top:"",right:"0 0",bottom:"center 0",left:"100% 0"}[o.placedSide],transform:{top:"translateY(100%)",right:"translateY(50%) rotate(90deg) translateX(-50%)",bottom:"rotate(180deg)",left:"translateY(50%) rotate(-90deg) translateX(50%)"}[o.placedSide],visibility:o.shouldHideArrow?"hidden":void 0},children:d(Ou,{...r,ref:t,style:{...r.style,display:"block"}})})});Ai.displayName=Pi;function Bu(e){return e!==null}var Wu=e=>({name:"transformOrigin",options:e,fn(t){var n,r,o;const{placement:a,rects:i,middlewareData:s}=t,l=((n=s.arrow)==null?void 0:n.centerOffset)!==0,c=l?0:e.arrowWidth,f=l?0:e.arrowHeight,[u,v]=$i(a),h={start:"0%",center:"50%",end:"100%"}[v],g=(((r=s.arrow)==null?void 0:r.x)??0)+c/2,p=(((o=s.arrow)==null?void 0:o.y)??0)+f/2;let m="",_="";return u==="bottom"?(m=l?h:`${g}px`,_=`${-f}px`):u==="top"?(m=l?h:`${g}px`,_=`${i.floating.height+f}px`):u==="right"?(m=`${-f}px`,_=l?h:`${p}px`):u==="left"&&(m=`${i.floating.width+f}px`,_=l?h:`${p}px`),{data:{x:m,y:_}}}});function $i(e){const[t,n="center"]=e.split("-");return[t,n]}var Hu=Si,Vu=Ti,ju=Ni,Yu=Ai,qu="Portal",Ii=I((e,t)=>{var n;const{container:r,...o}=e,[a,i]=S(!1);pe(()=>i(!0),[]);const s=r||a&&((n=globalThis==null?void 0:globalThis.document)==null?void 0:n.body);return s?Re.createPortal(d(te.div,{...o,ref:t}),s):null});Ii.displayName=qu;var Xu=na[" useInsertionEffect ".trim().toString()]||pe;function Di({prop:e,defaultProp:t,onChange:n=()=>{},caller:r}){const[o,a,i]=Ku({defaultProp:t,onChange:n}),s=e!==void 0,l=s?e:o;{const f=E(e!==void 0);A(()=>{const u=f.current;u!==s&&console.warn(`${r} is changing from ${u?"controlled":"uncontrolled"} to ${s?"controlled":"uncontrolled"}. Components should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled value for the lifetime of the component.`),f.current=s},[s,r])}const c=$(f=>{var u;if(s){const v=Gu(f)?f(e):f;v!==e&&((u=i.current)==null||u.call(i,v))}else a(f)},[s,e,a,i]);return[l,c]}function Ku({defaultProp:e,onChange:t}){const[n,r]=S(e),o=E(n),a=E(t);return Xu(()=>{a.current=t},[t]),A(()=>{var i;o.current!==n&&((i=a.current)==null||i.call(a,n),o.current=n)},[n,o]),[n,r,a]}function Gu(e){return typeof e=="function"}function Zu(e){const t=E({value:e,previous:e});return B(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var Mi=Object.freeze({position:"absolute",border:0,width:1,height:1,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",wordWrap:"normal"}),Ju="VisuallyHidden",Qu=I((e,t)=>d(te.span,{...e,ref:t,style:{...Mi,...e.style}}));Qu.displayName=Ju;var ed=function(e){if(typeof document>"u")return null;var t=Array.isArray(e)?e[0]:e;return t.ownerDocument.body},kt=new WeakMap,Cn=new WeakMap,kn={},Br=0,Oi=function(e){return e&&(e.host||Oi(e.parentNode))},td=function(e,t){return t.map(function(n){if(e.contains(n))return n;var r=Oi(n);return r&&e.contains(r)?r:(console.error("aria-hidden",n,"in not contained inside",e,". Doing nothing"),null)}).filter(function(n){return!!n})},nd=function(e,t,n,r){var o=td(t,Array.isArray(e)?e:[e]);kn[n]||(kn[n]=new WeakMap);var a=kn[n],i=[],s=new Set,l=new Set(o),c=function(u){!u||s.has(u)||(s.add(u),c(u.parentNode))};o.forEach(c);var f=function(u){!u||l.has(u)||Array.prototype.forEach.call(u.children,function(v){if(s.has(v))f(v);else try{var h=v.getAttribute(r),g=h!==null&&h!=="false",p=(kt.get(v)||0)+1,m=(a.get(v)||0)+1;kt.set(v,p),a.set(v,m),i.push(v),p===1&&g&&Cn.set(v,!0),m===1&&v.setAttribute(n,"true"),g||v.setAttribute(r,"true")}catch(_){console.error("aria-hidden: cannot operate on ",v,_)}})};return f(t),s.clear(),Br++,function(){i.forEach(function(u){var v=kt.get(u)-1,h=a.get(u)-1;kt.set(u,v),a.set(u,h),v||(Cn.has(u)||u.removeAttribute(r),Cn.delete(u)),h||u.removeAttribute(n)}),Br--,Br||(kt=new WeakMap,kt=new WeakMap,Cn=new WeakMap,kn={})}},rd=function(e,t,n){n===void 0&&(n="data-aria-hidden");var r=Array.from(Array.isArray(e)?e:[e]),o=ed(e);return o?(r.push.apply(r,Array.from(o.querySelectorAll("[aria-live]"))),nd(r,o,n,"aria-hidden")):function(){return null}},Ie=function(){return Ie=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Ie.apply(this,arguments)};function Li(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&typeof Object.getOwnPropertySymbols=="function")for(var o=0,r=Object.getOwnPropertySymbols(e);o<r.length;o++)t.indexOf(r[o])<0&&Object.prototype.propertyIsEnumerable.call(e,r[o])&&(n[r[o]]=e[r[o]]);return n}function od(e,t,n){for(var r=0,o=t.length,a;r<o;r++)(a||!(r in t))&&(a||(a=Array.prototype.slice.call(t,0,r)),a[r]=t[r]);return e.concat(a||Array.prototype.slice.call(t))}var Sn="right-scroll-bar-position",En="width-before-scroll-bar",ad="with-scroll-bars-hidden",id="--removed-body-scroll-bar-size";function Wr(e,t){return typeof e=="function"?e(t):e&&(e.current=t),e}function sd(e,t){var n=S(function(){return{value:e,callback:t,facade:{get current(){return n.value},set current(r){var o=n.value;o!==r&&(n.value=r,n.callback(r,o))}}}})[0];return n.callback=t,n.facade}var ld=typeof window<"u"?Oe:A,Ri=new WeakMap;function cd(e,t){var n=sd(null,function(r){return e.forEach(function(o){return Wr(o,r)})});return ld(function(){var r=Ri.get(n);if(r){var o=new Set(r),a=new Set(e),i=n.current;o.forEach(function(s){a.has(s)||Wr(s,null)}),a.forEach(function(s){o.has(s)||Wr(s,i)})}Ri.set(n,e)},[e]),n}function ud(e){return e}function dd(e,t){t===void 0&&(t=ud);var n=[],r=!1,o={read:function(){if(r)throw new Error("Sidecar: could not `read` from an `assigned` medium. `read` could be used only with `useMedium`.");return n.length?n[n.length-1]:e},useMedium:function(a){var i=t(a,r);return n.push(i),function(){n=n.filter(function(s){return s!==i})}},assignSyncMedium:function(a){for(r=!0;n.length;){var i=n;n=[],i.forEach(a)}n={push:function(s){return a(s)},filter:function(){return n}}},assignMedium:function(a){r=!0;var i=[];if(n.length){var s=n;n=[],s.forEach(a),i=n}var l=function(){var f=i;i=[],f.forEach(a)},c=function(){return Promise.resolve().then(l)};c(),n={push:function(f){i.push(f),c()},filter:function(f){return i=i.filter(f),n}}}};return o}function fd(e){e===void 0&&(e={});var t=dd(null);return t.options=Ie({async:!0,ssr:!1},e),t}var Fi=function(e){var t=e.sideCar,n=Li(e,["sideCar"]);if(!t)throw new Error("Sidecar: please provide `sideCar` property to import the right car");var r=t.read();if(!r)throw new Error("Sidecar medium not found");return K(r,Ie({},n))};Fi.isSideCarExport=!0;function pd(e,t){return e.useMedium(t),Fi}var zi=fd(),Hr=function(){},Tn=I(function(e,t){var n=E(null),r=S({onScrollCapture:Hr,onWheelCapture:Hr,onTouchMoveCapture:Hr}),o=r[0],a=r[1],i=e.forwardProps,s=e.children,l=e.className,c=e.removeScrollBar,f=e.enabled,u=e.shards,v=e.sideCar,h=e.noIsolation,g=e.inert,p=e.allowPinchZoom,m=e.as,_=m===void 0?"div":m,w=e.gapMode,y=Li(e,["forwardProps","children","className","removeScrollBar","enabled","shards","sideCar","noIsolation","inert","allowPinchZoom","as","gapMode"]),b=v,C=cd([n,t]),k=Ie(Ie({},y),o);return K(ee,null,f&&K(b,{sideCar:zi,removeScrollBar:c,shards:u,noIsolation:h,inert:g,setCallbacks:a,allowPinchZoom:!!p,lockRef:n,gapMode:w}),i?Lt(He.only(s),Ie(Ie({},k),{ref:C})):K(_,Ie({},k,{className:l,ref:C}),s))});Tn.defaultProps={enabled:!0,removeScrollBar:!0,inert:!1},Tn.classNames={fullWidth:En,zeroRight:Sn};var hd=function(){if(typeof __webpack_nonce__<"u")return __webpack_nonce__};function vd(){if(!document)return null;var e=document.createElement("style");e.type="text/css";var t=hd();return t&&e.setAttribute("nonce",t),e}function md(e,t){e.styleSheet?e.styleSheet.cssText=t:e.appendChild(document.createTextNode(t))}function gd(e){var t=document.head||document.getElementsByTagName("head")[0];t.appendChild(e)}var _d=function(){var e=0,t=null;return{add:function(n){e==0&&(t=vd())&&(md(t,n),gd(t)),e++},remove:function(){e--,!e&&t&&(t.parentNode&&t.parentNode.removeChild(t),t=null)}}},wd=function(){var e=_d();return function(t,n){A(function(){return e.add(t),function(){e.remove()}},[t&&n])}},Ui=function(){var e=wd(),t=function(n){var r=n.styles,o=n.dynamic;return e(r,o),null};return t},yd={left:0,top:0,right:0,gap:0},Vr=function(e){return parseInt(e||"",10)||0},bd=function(e){var t=window.getComputedStyle(document.body),n=t[e==="padding"?"paddingLeft":"marginLeft"],r=t[e==="padding"?"paddingTop":"marginTop"],o=t[e==="padding"?"paddingRight":"marginRight"];return[Vr(n),Vr(r),Vr(o)]},xd=function(e){if(e===void 0&&(e="margin"),typeof window>"u")return yd;var t=bd(e),n=document.documentElement.clientWidth,r=window.innerWidth;return{left:t[0],top:t[1],right:t[2],gap:Math.max(0,r-n+t[2]-t[0])}},Cd=Ui(),St="data-scroll-locked",kd=function(e,t,n,r){var o=e.left,a=e.top,i=e.right,s=e.gap;return n===void 0&&(n="margin"),`
383
+ .`.concat(ad,` {
384
+ overflow: hidden `).concat(r,`;
385
+ padding-right: `).concat(s,"px ").concat(r,`;
386
+ }
387
+ body[`).concat(St,`] {
388
+ overflow: hidden `).concat(r,`;
389
+ overscroll-behavior: contain;
390
+ `).concat([t&&"position: relative ".concat(r,";"),n==="margin"&&`
391
+ padding-left: `.concat(o,`px;
392
+ padding-top: `).concat(a,`px;
393
+ padding-right: `).concat(i,`px;
394
+ margin-left:0;
395
+ margin-top:0;
396
+ margin-right: `).concat(s,"px ").concat(r,`;
397
+ `),n==="padding"&&"padding-right: ".concat(s,"px ").concat(r,";")].filter(Boolean).join(""),`
398
+ }
399
+
400
+ .`).concat(Sn,` {
401
+ right: `).concat(s,"px ").concat(r,`;
402
+ }
403
+
404
+ .`).concat(En,` {
405
+ margin-right: `).concat(s,"px ").concat(r,`;
406
+ }
407
+
408
+ .`).concat(Sn," .").concat(Sn,` {
409
+ right: 0 `).concat(r,`;
410
+ }
411
+
412
+ .`).concat(En," .").concat(En,` {
413
+ margin-right: 0 `).concat(r,`;
414
+ }
415
+
416
+ body[`).concat(St,`] {
417
+ `).concat(id,": ").concat(s,`px;
418
+ }
419
+ `)},Bi=function(){var e=parseInt(document.body.getAttribute(St)||"0",10);return isFinite(e)?e:0},Sd=function(){A(function(){return document.body.setAttribute(St,(Bi()+1).toString()),function(){var e=Bi()-1;e<=0?document.body.removeAttribute(St):document.body.setAttribute(St,e.toString())}},[])},Ed=function(e){var t=e.noRelative,n=e.noImportant,r=e.gapMode,o=r===void 0?"margin":r;Sd();var a=B(function(){return xd(o)},[o]);return K(Cd,{styles:kd(a,!t,o,n?"":"!important")})},jr=!1;if(typeof window<"u")try{var Nn=Object.defineProperty({},"passive",{get:function(){return jr=!0,!0}});window.addEventListener("test",Nn,Nn),window.removeEventListener("test",Nn,Nn)}catch{jr=!1}var Et=jr?{passive:!1}:!1,Td=function(e){return e.tagName==="TEXTAREA"},Wi=function(e,t){if(!(e instanceof Element))return!1;var n=window.getComputedStyle(e);return n[t]!=="hidden"&&!(n.overflowY===n.overflowX&&!Td(e)&&n[t]==="visible")},Nd=function(e){return Wi(e,"overflowY")},Pd=function(e){return Wi(e,"overflowX")},Hi=function(e,t){var n=t.ownerDocument,r=t;do{typeof ShadowRoot<"u"&&r instanceof ShadowRoot&&(r=r.host);var o=Vi(e,r);if(o){var a=ji(e,r),i=a[1],s=a[2];if(i>s)return!0}r=r.parentNode}while(r&&r!==n.body);return!1},Ad=function(e){var t=e.scrollTop,n=e.scrollHeight,r=e.clientHeight;return[t,n,r]},$d=function(e){var t=e.scrollLeft,n=e.scrollWidth,r=e.clientWidth;return[t,n,r]},Vi=function(e,t){return e==="v"?Nd(t):Pd(t)},ji=function(e,t){return e==="v"?Ad(t):$d(t)},Id=function(e,t){return e==="h"&&t==="rtl"?-1:1},Dd=function(e,t,n,r,o){var a=Id(e,window.getComputedStyle(t).direction),i=a*r,s=n.target,l=t.contains(s),c=!1,f=i>0,u=0,v=0;do{var h=ji(e,s),g=h[0],p=h[1],m=h[2],_=p-m-a*g;(g||_)&&Vi(e,s)&&(u+=_,v+=g),s instanceof ShadowRoot?s=s.host:s=s.parentNode}while(!l&&s!==document.body||l&&(t.contains(s)||t===s));return(f&&Math.abs(u)<1||!f&&Math.abs(v)<1)&&(c=!0),c},Pn=function(e){return"changedTouches"in e?[e.changedTouches[0].clientX,e.changedTouches[0].clientY]:[0,0]},Yi=function(e){return[e.deltaX,e.deltaY]},qi=function(e){return e&&"current"in e?e.current:e},Md=function(e,t){return e[0]===t[0]&&e[1]===t[1]},Od=function(e){return`
420
+ .block-interactivity-`.concat(e,` {pointer-events: none;}
421
+ .allow-interactivity-`).concat(e,` {pointer-events: all;}
422
+ `)},Ld=0,Tt=[];function Rd(e){var t=E([]),n=E([0,0]),r=E(),o=S(Ld++)[0],a=S(Ui)[0],i=E(e);A(function(){i.current=e},[e]),A(function(){if(e.inert){document.body.classList.add("block-interactivity-".concat(o));var p=od([e.lockRef.current],(e.shards||[]).map(qi)).filter(Boolean);return p.forEach(function(m){return m.classList.add("allow-interactivity-".concat(o))}),function(){document.body.classList.remove("block-interactivity-".concat(o)),p.forEach(function(m){return m.classList.remove("allow-interactivity-".concat(o))})}}},[e.inert,e.lockRef.current,e.shards]);var s=$(function(p,m){if("touches"in p&&p.touches.length===2||p.type==="wheel"&&p.ctrlKey)return!i.current.allowPinchZoom;var _=Pn(p),w=n.current,y="deltaX"in p?p.deltaX:w[0]-_[0],b="deltaY"in p?p.deltaY:w[1]-_[1],C,k=p.target,x=Math.abs(y)>Math.abs(b)?"h":"v";if("touches"in p&&x==="h"&&k.type==="range")return!1;var P=Hi(x,k);if(!P)return!0;if(P?C=x:(C=x==="v"?"h":"v",P=Hi(x,k)),!P)return!1;if(!r.current&&"changedTouches"in p&&(y||b)&&(r.current=C),!C)return!0;var D=r.current||C;return Dd(D,m,p,D==="h"?y:b)},[]),l=$(function(p){var m=p;if(!(!Tt.length||Tt[Tt.length-1]!==a)){var _="deltaY"in m?Yi(m):Pn(m),w=t.current.filter(function(C){return C.name===m.type&&(C.target===m.target||m.target===C.shadowParent)&&Md(C.delta,_)})[0];if(w&&w.should){m.cancelable&&m.preventDefault();return}if(!w){var y=(i.current.shards||[]).map(qi).filter(Boolean).filter(function(C){return C.contains(m.target)}),b=y.length>0?s(m,y[0]):!i.current.noIsolation;b&&m.cancelable&&m.preventDefault()}}},[]),c=$(function(p,m,_,w){var y={name:p,delta:m,target:_,should:w,shadowParent:Fd(_)};t.current.push(y),setTimeout(function(){t.current=t.current.filter(function(b){return b!==y})},1)},[]),f=$(function(p){n.current=Pn(p),r.current=void 0},[]),u=$(function(p){c(p.type,Yi(p),p.target,s(p,e.lockRef.current))},[]),v=$(function(p){c(p.type,Pn(p),p.target,s(p,e.lockRef.current))},[]);A(function(){return Tt.push(a),e.setCallbacks({onScrollCapture:u,onWheelCapture:u,onTouchMoveCapture:v}),document.addEventListener("wheel",l,Et),document.addEventListener("touchmove",l,Et),document.addEventListener("touchstart",f,Et),function(){Tt=Tt.filter(function(p){return p!==a}),document.removeEventListener("wheel",l,Et),document.removeEventListener("touchmove",l,Et),document.removeEventListener("touchstart",f,Et)}},[]);var h=e.removeScrollBar,g=e.inert;return K(ee,null,g?K(a,{styles:Od(o)}):null,h?K(Ed,{gapMode:e.gapMode}):null)}function Fd(e){for(var t=null;e!==null;)e instanceof ShadowRoot&&(t=e.host,e=e.host),e=e.parentNode;return t}const zd=pd(zi,Rd);var Xi=I(function(e,t){return K(Tn,Ie({},e,{ref:t,sideCar:zd}))});Xi.classNames=Tn.classNames;var Ud=[" ","Enter","ArrowUp","ArrowDown"],Bd=[" ","Enter"],at="Select",[An,$n,Wd]=hc(at),[Nt,jf]=br(at,[Wd,Ci]),In=Ci(),[Hd,Ze]=Nt(at),[Vd,jd]=Nt(at),Ki=e=>{const{__scopeSelect:t,children:n,open:r,defaultOpen:o,onOpenChange:a,value:i,defaultValue:s,onValueChange:l,dir:c,name:f,autoComplete:u,disabled:v,required:h,form:g}=e,p=In(t),[m,_]=S(null),[w,y]=S(null),[b,C]=S(!1),k=mc(c),[x,P]=Di({prop:r,defaultProp:o??!1,onChange:a,caller:at}),[D,F]=Di({prop:i,defaultProp:s,onChange:l,caller:at}),O=E(null),L=m?g||!!m.closest("form"):!0,[X,z]=S(new Set),ne=Array.from(X).map(R=>R.props.value).join(";");return d(Hu,{...p,children:d(Hd,{required:h,scope:t,trigger:m,onTriggerChange:_,valueNode:w,onValueNodeChange:y,valueNodeHasChildren:b,onValueNodeHasChildrenChange:C,contentId:Er(),value:D,onValueChange:F,open:x,onOpenChange:P,dir:k,triggerPointerDownPosRef:O,disabled:v,children:[d(An.Provider,{scope:t,children:d(Vd,{scope:e.__scopeSelect,onNativeOptionAdd:$(R=>{z(V=>new Set(V).add(R))},[]),onNativeOptionRemove:$(R=>{z(V=>{const M=new Set(V);return M.delete(R),M})},[]),children:n})}),L?d(ms,{"aria-hidden":!0,required:h,tabIndex:-1,name:f,autoComplete:u,value:D,onChange:R=>F(R.target.value),disabled:v,form:g,children:[D===void 0?d("option",{value:""}):null,Array.from(X)]},ne):null]})})};Ki.displayName=at;var Gi="SelectTrigger",Zi=I((e,t)=>{const{__scopeSelect:n,disabled:r=!1,...o}=e,a=In(n),i=Ze(Gi,n),s=i.disabled||r,l=le(t,i.onTriggerChange),c=$n(n),f=E("touch"),[u,v,h]=_s(p=>{const m=c().filter(y=>!y.disabled),_=m.find(y=>y.value===i.value),w=ws(m,p,_);w!==void 0&&i.onValueChange(w.value)}),g=p=>{s||(i.onOpenChange(!0),h()),p&&(i.triggerPointerDownPosRef.current={x:Math.round(p.pageX),y:Math.round(p.pageY)})};return d(Vu,{asChild:!0,...a,children:d(te.button,{type:"button",role:"combobox","aria-controls":i.contentId,"aria-expanded":i.open,"aria-required":i.required,"aria-autocomplete":"none",dir:i.dir,"data-state":i.open?"open":"closed",disabled:s,"data-disabled":s?"":void 0,"data-placeholder":gs(i.value)?"":void 0,...o,ref:l,onClick:oe(o.onClick,p=>{p.currentTarget.focus(),f.current!=="mouse"&&g(p)}),onPointerDown:oe(o.onPointerDown,p=>{f.current=p.pointerType;const m=p.target;m.hasPointerCapture(p.pointerId)&&m.releasePointerCapture(p.pointerId),p.button===0&&p.ctrlKey===!1&&p.pointerType==="mouse"&&(g(p),p.preventDefault())}),onKeyDown:oe(o.onKeyDown,p=>{const m=u.current!=="";!(p.ctrlKey||p.altKey||p.metaKey)&&p.key.length===1&&v(p.key),!(m&&p.key===" ")&&Ud.includes(p.key)&&(g(),p.preventDefault())})})})});Zi.displayName=Gi;var Ji="SelectValue",Yd=I((e,t)=>{const{__scopeSelect:n,className:r,style:o,children:a,placeholder:i="",...s}=e,l=Ze(Ji,n),{onValueNodeHasChildrenChange:c}=l,f=a!==void 0,u=le(t,l.onValueNodeChange);return pe(()=>{c(f)},[c,f]),d(te.span,{...s,ref:u,style:{pointerEvents:"none"},children:gs(l.value)?d(ee,{children:i}):a})});Yd.displayName=Ji;var qd="SelectIcon",Qi=I((e,t)=>{const{__scopeSelect:n,children:r,...o}=e;return d(te.span,{"aria-hidden":!0,...o,ref:t,children:r||"▼"})});Qi.displayName=qd;var Xd="SelectPortal",es=e=>d(Ii,{asChild:!0,...e});es.displayName=Xd;var it="SelectContent",ts=I((e,t)=>{const n=Ze(it,e.__scopeSelect),[r,o]=S();if(pe(()=>{o(new DocumentFragment)},[]),!n.open){const a=r;return a?nn(d(ns,{scope:e.__scopeSelect,children:d(An.Slot,{scope:e.__scopeSelect,children:d("div",{children:e.children})})}),a):null}return d(rs,{...e,ref:t})});ts.displayName=it;var Te=10,[ns,Je]=Nt(it),Kd="SelectContentImpl",Gd=Bt("SelectContent.RemoveScroll"),rs=I((e,t)=>{const{__scopeSelect:n,position:r="item-aligned",onCloseAutoFocus:o,onEscapeKeyDown:a,onPointerDownOutside:i,side:s,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:v,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:m,..._}=e,w=Ze(it,n),[y,b]=S(null),[C,k]=S(null),x=le(t,N=>b(N)),[P,D]=S(null),[F,O]=S(null),L=$n(n),[X,z]=S(!1),ne=E(!1);A(()=>{if(y)return rd(y)},[y]),Tc();const R=$(N=>{const[G,...re]=L().map(ae=>ae.ref.current),[U]=re.slice(-1),J=document.activeElement;for(const ae of N)if(ae===J||(ae==null||ae.scrollIntoView({block:"nearest"}),ae===G&&C&&(C.scrollTop=0),ae===U&&C&&(C.scrollTop=C.scrollHeight),ae==null||ae.focus(),document.activeElement!==J))return},[L,C]),V=$(()=>R([P,y]),[R,P,y]);A(()=>{X&&V()},[X,V]);const{onOpenChange:M,triggerPointerDownPosRef:j}=w;A(()=>{if(y){let N={x:0,y:0};const G=U=>{var J,ae;N={x:Math.abs(Math.round(U.pageX)-(((J=j.current)==null?void 0:J.x)??0)),y:Math.abs(Math.round(U.pageY)-(((ae=j.current)==null?void 0:ae.y)??0))}},re=U=>{N.x<=10&&N.y<=10?U.preventDefault():y.contains(U.target)||M(!1),document.removeEventListener("pointermove",G),j.current=null};return j.current!==null&&(document.addEventListener("pointermove",G),document.addEventListener("pointerup",re,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",G),document.removeEventListener("pointerup",re,{capture:!0})}}},[y,M,j]),A(()=>{const N=()=>M(!1);return window.addEventListener("blur",N),window.addEventListener("resize",N),()=>{window.removeEventListener("blur",N),window.removeEventListener("resize",N)}},[M]);const[he,st]=_s(N=>{const G=L().filter(J=>!J.disabled),re=G.find(J=>J.ref.current===document.activeElement),U=ws(G,N,re);U&&setTimeout(()=>U.ref.current.focus())}),Yt=$((N,G,re)=>{const U=!ne.current&&!re;(w.value!==void 0&&w.value===G||U)&&(D(N),U&&(ne.current=!0))},[w.value]),Qe=$(()=>y==null?void 0:y.focus(),[y]),we=$((N,G,re)=>{const U=!ne.current&&!re;(w.value!==void 0&&w.value===G||U)&&O(N)},[w.value]),lt=r==="popper"?Yr:os,ct=lt===Yr?{side:s,sideOffset:l,align:c,alignOffset:f,arrowPadding:u,collisionBoundary:v,collisionPadding:h,sticky:g,hideWhenDetached:p,avoidCollisions:m}:{};return d(ns,{scope:n,content:y,viewport:C,onViewportChange:k,itemRefCallback:Yt,selectedItem:P,onItemLeave:Qe,itemTextRefCallback:we,focusSelectedItem:V,selectedItemText:F,position:r,isPositioned:X,searchRef:he,children:d(Xi,{as:Gd,allowPinchZoom:!0,children:d(Ja,{asChild:!0,trapped:w.open,onMountAutoFocus:N=>{N.preventDefault()},onUnmountAutoFocus:oe(o,N=>{var G;(G=w.trigger)==null||G.focus({preventScroll:!0}),N.preventDefault()}),children:d(qa,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:a,onPointerDownOutside:i,onFocusOutside:N=>N.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:d(lt,{role:"listbox",id:w.contentId,"data-state":w.open?"open":"closed",dir:w.dir,onContextMenu:N=>N.preventDefault(),..._,...ct,onPlaced:()=>z(!0),ref:x,style:{display:"flex",flexDirection:"column",outline:"none",..._.style},onKeyDown:oe(_.onKeyDown,N=>{const G=N.ctrlKey||N.altKey||N.metaKey;if(N.key==="Tab"&&N.preventDefault(),!G&&N.key.length===1&&st(N.key),["ArrowUp","ArrowDown","Home","End"].includes(N.key)){let re=L().filter(U=>!U.disabled).map(U=>U.ref.current);if(["ArrowUp","End"].includes(N.key)&&(re=re.slice().reverse()),["ArrowUp","ArrowDown"].includes(N.key)){const U=N.target,J=re.indexOf(U);re=re.slice(J+1)}setTimeout(()=>R(re)),N.preventDefault()}})})})})})})});rs.displayName=Kd;var Zd="SelectItemAlignedPosition",os=I((e,t)=>{const{__scopeSelect:n,onPlaced:r,...o}=e,a=Ze(it,n),i=Je(it,n),[s,l]=S(null),[c,f]=S(null),u=le(t,x=>f(x)),v=$n(n),h=E(!1),g=E(!0),{viewport:p,selectedItem:m,selectedItemText:_,focusSelectedItem:w}=i,y=$(()=>{if(a.trigger&&a.valueNode&&s&&c&&p&&m&&_){const x=a.trigger.getBoundingClientRect(),P=c.getBoundingClientRect(),D=a.valueNode.getBoundingClientRect(),F=_.getBoundingClientRect();if(a.dir!=="rtl"){const U=F.left-P.left,J=D.left-U,ae=x.left-J,ye=x.width+ae,qt=Math.max(ye,P.width),Xt=window.innerWidth-Te,Kt=Va(J,[Te,Math.max(Te,Xt-qt)]);s.style.minWidth=ye+"px",s.style.left=Kt+"px"}else{const U=P.right-F.right,J=window.innerWidth-D.right-U,ae=window.innerWidth-x.right-J,ye=x.width+ae,qt=Math.max(ye,P.width),Xt=window.innerWidth-Te,Kt=Va(J,[Te,Math.max(Te,Xt-qt)]);s.style.minWidth=ye+"px",s.style.right=Kt+"px"}const O=v(),L=window.innerHeight-Te*2,X=p.scrollHeight,z=window.getComputedStyle(c),ne=parseInt(z.borderTopWidth,10),R=parseInt(z.paddingTop,10),V=parseInt(z.borderBottomWidth,10),M=parseInt(z.paddingBottom,10),j=ne+R+X+M+V,he=Math.min(m.offsetHeight*5,j),st=window.getComputedStyle(p),Yt=parseInt(st.paddingTop,10),Qe=parseInt(st.paddingBottom,10),we=x.top+x.height/2-Te,lt=L-we,ct=m.offsetHeight/2,N=m.offsetTop+ct,G=ne+R+N,re=j-G;if(G<=we){const U=O.length>0&&m===O[O.length-1].ref.current;s.style.bottom="0px";const J=c.clientHeight-p.offsetTop-p.offsetHeight,ae=Math.max(lt,ct+(U?Qe:0)+J+V),ye=G+ae;s.style.height=ye+"px"}else{const U=O.length>0&&m===O[0].ref.current;s.style.top="0px";const J=Math.max(we,ne+p.offsetTop+(U?Yt:0)+ct)+re;s.style.height=J+"px",p.scrollTop=G-we+p.offsetTop}s.style.margin=`${Te}px 0`,s.style.minHeight=he+"px",s.style.maxHeight=L+"px",r==null||r(),requestAnimationFrame(()=>h.current=!0)}},[v,a.trigger,a.valueNode,s,c,p,m,_,a.dir,r]);pe(()=>y(),[y]);const[b,C]=S();pe(()=>{c&&C(window.getComputedStyle(c).zIndex)},[c]);const k=$(x=>{x&&g.current===!0&&(y(),w==null||w(),g.current=!1)},[y,w]);return d(Qd,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:k,children:d("div",{ref:l,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:b},children:d(te.div,{...o,ref:u,style:{boxSizing:"border-box",maxHeight:"100%",...o.style}})})})});os.displayName=Zd;var Jd="SelectPopperPosition",Yr=I((e,t)=>{const{__scopeSelect:n,align:r="start",collisionPadding:o=Te,...a}=e,i=In(n);return d(ju,{...i,...a,ref:t,align:r,collisionPadding:o,style:{boxSizing:"border-box",...a.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});Yr.displayName=Jd;var[Qd,qr]=Nt(it,{}),Xr="SelectViewport",as=I((e,t)=>{const{__scopeSelect:n,nonce:r,...o}=e,a=Je(Xr,n),i=qr(Xr,n),s=le(t,a.onViewportChange),l=E(0);return d(ee,{children:[d("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:r}),d(An.Slot,{scope:n,children:d(te.div,{"data-radix-select-viewport":"",role:"presentation",...o,ref:s,style:{position:"relative",flex:1,overflow:"hidden auto",...o.style},onScroll:oe(o.onScroll,c=>{const f=c.currentTarget,{contentWrapper:u,shouldExpandOnScrollRef:v}=i;if(v!=null&&v.current&&u){const h=Math.abs(l.current-f.scrollTop);if(h>0){const g=window.innerHeight-Te*2,p=parseFloat(u.style.minHeight),m=parseFloat(u.style.height),_=Math.max(p,m);if(_<g){const w=_+h,y=Math.min(g,w),b=w-y;u.style.height=y+"px",u.style.bottom==="0px"&&(f.scrollTop=b>0?b:0,u.style.justifyContent="flex-end")}}}l.current=f.scrollTop})})})]})});as.displayName=Xr;var is="SelectGroup",[ef,tf]=Nt(is),nf=I((e,t)=>{const{__scopeSelect:n,...r}=e,o=Er();return d(ef,{scope:n,id:o,children:d(te.div,{role:"group","aria-labelledby":o,...r,ref:t})})});nf.displayName=is;var ss="SelectLabel",rf=I((e,t)=>{const{__scopeSelect:n,...r}=e,o=tf(ss,n);return d(te.div,{id:o.id,...r,ref:t})});rf.displayName=ss;var Dn="SelectItem",[of,ls]=Nt(Dn),cs=I((e,t)=>{const{__scopeSelect:n,value:r,disabled:o=!1,textValue:a,...i}=e,s=Ze(Dn,n),l=Je(Dn,n),c=s.value===r,[f,u]=S(a??""),[v,h]=S(!1),g=le(t,w=>{var y;return(y=l.itemRefCallback)==null?void 0:y.call(l,w,r,o)}),p=Er(),m=E("touch"),_=()=>{o||(s.onValueChange(r),s.onOpenChange(!1))};if(r==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return d(of,{scope:n,value:r,disabled:o,textId:p,isSelected:c,onItemTextChange:$(w=>{u(y=>y||((w==null?void 0:w.textContent)??"").trim())},[]),children:d(An.ItemSlot,{scope:n,value:r,disabled:o,textValue:f,children:d(te.div,{role:"option","aria-labelledby":p,"data-highlighted":v?"":void 0,"aria-selected":c&&v,"data-state":c?"checked":"unchecked","aria-disabled":o||void 0,"data-disabled":o?"":void 0,tabIndex:o?void 0:-1,...i,ref:g,onFocus:oe(i.onFocus,()=>h(!0)),onBlur:oe(i.onBlur,()=>h(!1)),onClick:oe(i.onClick,()=>{m.current!=="mouse"&&_()}),onPointerUp:oe(i.onPointerUp,()=>{m.current==="mouse"&&_()}),onPointerDown:oe(i.onPointerDown,w=>{m.current=w.pointerType}),onPointerMove:oe(i.onPointerMove,w=>{var y;m.current=w.pointerType,o?(y=l.onItemLeave)==null||y.call(l):m.current==="mouse"&&w.currentTarget.focus({preventScroll:!0})}),onPointerLeave:oe(i.onPointerLeave,w=>{var y;w.currentTarget===document.activeElement&&((y=l.onItemLeave)==null||y.call(l))}),onKeyDown:oe(i.onKeyDown,w=>{var y;((y=l.searchRef)==null?void 0:y.current)!==""&&w.key===" "||(Bd.includes(w.key)&&_(),w.key===" "&&w.preventDefault())})})})})});cs.displayName=Dn;var jt="SelectItemText",us=I((e,t)=>{const{__scopeSelect:n,className:r,style:o,...a}=e,i=Ze(jt,n),s=Je(jt,n),l=ls(jt,n),c=jd(jt,n),[f,u]=S(null),v=le(t,_=>u(_),l.onItemTextChange,_=>{var w;return(w=s.itemTextRefCallback)==null?void 0:w.call(s,_,l.value,l.disabled)}),h=f==null?void 0:f.textContent,g=B(()=>d("option",{value:l.value,disabled:l.disabled,children:h},l.value),[l.disabled,l.value,h]),{onNativeOptionAdd:p,onNativeOptionRemove:m}=c;return pe(()=>(p(g),()=>m(g)),[p,m,g]),d(ee,{children:[d(te.span,{id:l.textId,...a,ref:v}),l.isSelected&&i.valueNode&&!i.valueNodeHasChildren?nn(a.children,i.valueNode):null]})});us.displayName=jt;var ds="SelectItemIndicator",fs=I((e,t)=>{const{__scopeSelect:n,...r}=e;return ls(ds,n).isSelected?d(te.span,{"aria-hidden":!0,...r,ref:t}):null});fs.displayName=ds;var Kr="SelectScrollUpButton",ps=I((e,t)=>{const n=Je(Kr,e.__scopeSelect),r=qr(Kr,e.__scopeSelect),[o,a]=S(!1),i=le(t,r.onScrollButtonChange);return pe(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollTop>0;a(c)};const l=n.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?d(vs,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop-l.offsetHeight)}}):null});ps.displayName=Kr;var Gr="SelectScrollDownButton",hs=I((e,t)=>{const n=Je(Gr,e.__scopeSelect),r=qr(Gr,e.__scopeSelect),[o,a]=S(!1),i=le(t,r.onScrollButtonChange);return pe(()=>{if(n.viewport&&n.isPositioned){let s=function(){const c=l.scrollHeight-l.clientHeight,f=Math.ceil(l.scrollTop)<c;a(f)};const l=n.viewport;return s(),l.addEventListener("scroll",s),()=>l.removeEventListener("scroll",s)}},[n.viewport,n.isPositioned]),o?d(vs,{...e,ref:i,onAutoScroll:()=>{const{viewport:s,selectedItem:l}=n;s&&l&&(s.scrollTop=s.scrollTop+l.offsetHeight)}}):null});hs.displayName=Gr;var vs=I((e,t)=>{const{__scopeSelect:n,onAutoScroll:r,...o}=e,a=Je("SelectScrollButton",n),i=E(null),s=$n(n),l=$(()=>{i.current!==null&&(window.clearInterval(i.current),i.current=null)},[]);return A(()=>()=>l(),[l]),pe(()=>{var c;const f=s().find(u=>u.ref.current===document.activeElement);(c=f==null?void 0:f.ref.current)==null||c.scrollIntoView({block:"nearest"})},[s]),d(te.div,{"aria-hidden":!0,...o,ref:t,style:{flexShrink:0,...o.style},onPointerDown:oe(o.onPointerDown,()=>{i.current===null&&(i.current=window.setInterval(r,50))}),onPointerMove:oe(o.onPointerMove,()=>{var c;(c=a.onItemLeave)==null||c.call(a),i.current===null&&(i.current=window.setInterval(r,50))}),onPointerLeave:oe(o.onPointerLeave,()=>{l()})})}),af="SelectSeparator",sf=I((e,t)=>{const{__scopeSelect:n,...r}=e;return d(te.div,{"aria-hidden":!0,...r,ref:t})});sf.displayName=af;var Zr="SelectArrow",lf=I((e,t)=>{const{__scopeSelect:n,...r}=e,o=In(n),a=Ze(Zr,n),i=Je(Zr,n);return a.open&&i.position==="popper"?d(Yu,{...o,...r,ref:t}):null});lf.displayName=Zr;var cf="SelectBubbleInput",ms=I(({__scopeSelect:e,value:t,...n},r)=>{const o=E(null),a=le(r,o),i=Zu(t);return A(()=>{const s=o.current;if(!s)return;const l=window.HTMLSelectElement.prototype,c=Object.getOwnPropertyDescriptor(l,"value").set;if(i!==t&&c){const f=new Event("change",{bubbles:!0});c.call(s,t),s.dispatchEvent(f)}},[i,t]),d(te.select,{...n,style:{...Mi,...n.style},ref:a,defaultValue:t})});ms.displayName=cf;function gs(e){return e===""||e===void 0}function _s(e){const t=rt(e),n=E(""),r=E(0),o=$(i=>{const s=n.current+i;t(s),function l(c){n.current=c,window.clearTimeout(r.current),c!==""&&(r.current=window.setTimeout(()=>l(""),1e3))}(s)},[t]),a=$(()=>{n.current="",window.clearTimeout(r.current)},[]);return A(()=>()=>window.clearTimeout(r.current),[]),[n,o,a]}function ws(e,t,n){const r=t.length>1&&Array.from(t).every(s=>s===t[0])?t[0]:t,o=n?e.indexOf(n):-1;let a=uf(e,Math.max(o,0));r.length===1&&(a=a.filter(s=>s!==n));const i=a.find(s=>s.textValue.toLowerCase().startsWith(r.toLowerCase()));return i!==n?i:void 0}function uf(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var df=Ki,ys=Zi,bs=Qi,ff=es,pf=ts,hf=as,vf=cs,mf=us,gf=fs,_f=ps,wf=hs;const yf={sm:"w-4 h-4",md:"w-6 h-6"};function Jr({size:e="md",flagCode:t,className:n,...r}){return d("img",{className:Y("rounded-full object-cover",yf[e],n),src:`https://storage.googleapis.com/eleven-public-cdn/images/flags/circle-flags/${t}.svg`,alt:`${t.toUpperCase()} flag`,...r})}function xs({children:e,...t}){const[n,r]=S(!1),{language:o,setLanguage:a,options:i}=gt(),s=Rl();return d(df,{open:n,value:o.value.languageCode,onValueChange:l=>{a(l),r(!1)},onOpenChange:l=>{l&&r(!0)},children:[e,d(ff,{container:s,children:d(pf,{className:"overflow-hidden bg-base border border-base-border rounded-dropdown-sheet max-h-[min(384px,var(--radix-select-content-available-height))] min-w-[var(--radix-select-trigger-width)] z-10",position:"popper",sideOffset:8,align:"end",side:"top",onPointerDownOutside:()=>r(!1),onCloseAutoFocus:()=>r(!1),onEscapeKeyDown:()=>r(!1),...t,children:[d(_f,{className:"flex items-center justify-center h-6 bg-base text-base-subtle cursor-default",children:d(wt,{size:"sm",name:"chevron-up"})}),d(hf,{className:"p-1.5",children:i.value.map(l=>d(vf,{value:l.languageCode,className:"flex select-none items-center p-1.5 pr-3 gap-2 cursor-pointer rounded-input relative focus-visible:outline-none data-[highlighted]:bg-base-active text-sm",children:[d(Jr,{flagCode:l.flagCode}),d(mf,{children:l.name}),d(gf,{className:"text-base-primary p-1.5 -mr-1.5 ml-auto",children:d(wt,{size:"sm",name:"check"})})]},l.languageCode))}),d(wf,{className:"flex items-center justify-center h-6 bg-base text-base-subtle cursor-default",children:d(wt,{size:"sm",name:"chevron-down"})})]})})]})}function bf({className:e,...t}){const n=fe(),{language:r,showPicker:o}=gt();return o.value?d(xs,{align:"center",children:d(ys,{className:Y("h-9 min-w-max rounded-button focus-ring px-2 flex gap-2 items-center text-base-primary bg-base hover:bg-base-hover active:bg-base-active font-medium",e),"aria-label":n.change_language,...t,children:[d(Jr,{size:"sm",flagCode:r.value.flagCode}),r.value.name,d(bs,{className:"text-base-subtle",asChild:!0,children:d(wt,{size:"sm",name:"chevron-down"})})]})}):null}function xf({className:e,...t}){return d("textarea",{className:Y("px-3 py-[calc(theme(spacing.2)-1px)] border text-sm text-base-primary bg-base border-base-border rounded-input focus-ring resize-none [field-sizing:content] placeholder:text-base-subtle",e),...t})}function Qr({visible:e,...t}){const n=fe(),{isMuted:r,isMutingEnabled:o,setIsMuted:a}=Ea(),i=$(()=>{a(!r.peek())},[a]);return o.value?d(Fe,{visible:e,className:"p-1",children:d(Ye,{"aria-label":n.mute_microphone,"aria-pressed":r,icon:r.value?"mic-off":"mic",onClick:i,...t})}):null}function eo({iconOnly:e,isDisconnected:t,children:n,...r}){const{endSession:o,startSession:a}=de(),i=fe();return d(Ye,{variant:t?"primary":"secondary",icon:t?"phone":"phone-off",onClick:t?s=>a(s.currentTarget):o,"aria-label":t?i.start_call:i.end_call,...r,children:e?void 0:n??(t?i.start_call:i.end_call)})}function Cf({showTranscript:e,scrollPinned:t}){const[n,r]=S(""),o=fn(),{text_input_enabled:a}=ce().value,i=fe(),{isDisconnected:s,status:l,startSession:c,sendUserMessage:f,sendUserActivity:u,conversationIndex:v}=de();return d("div",{className:"shrink-0 overflow-hidden flex p-3 items-end justify-end",children:[a&&d(xf,{rows:1,"aria-label":i.input_label,value:n,onInput:u,onChange:h=>r(h.currentTarget.value),onKeyDown:async h=>{h.key==="Enter"&&!h.shiftKey&&(h.preventDefault(),n.trim()&&(t.value=!0,r(""),s.value?await c(h.currentTarget,n):f(n)))},className:"m-1 grow z-1 max-h-[8lh]",placeholder:o.value?s.value&&v.value>0?i.input_placeholder_new_conversation:i.input_placeholder_text_only:i.input_placeholder}),d("div",{className:"flex h-11 items-center",children:[d(Qr,{visible:!o.value&&!s.value}),d(Fe,{visible:!o.value&&(!s.value||e),className:"p-1",children:d(eo,{iconOnly:!s.value,isDisconnected:s.value,disabled:l.value==="disconnecting"||l.value==="connecting",children:i.new_call})})]})]})}function kf({entry:e,animateIn:t}){const n=fe(),{previewUrl:r}=gr(),{lastId:o}=de();return d(ke,{initial:!t,active:!0,children:e.type==="message"?d("div",{className:Y("flex gap-2.5 transition-[opacity,transform] duration-200 data-hidden:opacity-0 data-hidden:scale-75",e.role=="user"?"justify-end pl-16 origin-top-right":"pr-16 origin-top-left"),children:[e.role==="ai"&&d("img",{src:r,alt:"AI agent avatar",className:"bg-base-border shrink-0 w-5 h-5 rounded-full"}),d("div",{dir:"auto",className:Y("px-3 py-2.5 rounded-bubble text-sm",e.role==="user"?"bg-accent text-accent-primary":"bg-base-active text-base-primary"),children:e.message})]}):e.type==="disconnection"?d("div",{className:"mt-2 px-8 text-xs text-base-subtle text-center transition-opacity duration-200 data-hidden:opacity-0",children:[e.role==="user"?n.user_ended_conversation:n.agent_ended_conversation,d("br",{}),o.value&&d("span",{className:"break-all",children:[n.conversation_id,": ",o.value]})]}):d("div",{className:"mt-2 px-8 text-xs text-base-error text-center transition-opacity duration-200 data-hidden:opacity-0",children:[n.error_occurred,d("br",{}),e.message,o.value&&d(ee,{children:[d("br",{}),d("span",{className:"text-base-subtle break-all",children:[n.conversation_id,": ",o.value]})]})]})})}const Sf=16;function Ef({scrollPinned:e,transcript:t}){const n=E(null),r=a=>{var i;(i=n.current)==null||i.scrollTo({top:n.current.scrollHeight,behavior:a?"smooth":"instant"})},o=E(!0);return A(()=>{o.current=!1,r(!1)},[]),je(()=>{t.value,e.peek()&&r(!0)}),d("div",{ref:n,onScroll:a=>{e.value=a.currentTarget.scrollTop>=a.currentTarget.scrollHeight-a.currentTarget.clientHeight-Sf},className:"px-4 pb-3 grow flex flex-col gap-3 overflow-y-auto",children:t.value.map((a,i)=>d(kf,{entry:a,animateIn:!o.current},`${a.message}-${i}-${a.conversationIndex}`))})}const Tf={"top-left":"origin-top-left",top:"origin-top","top-right":"origin-top-right","bottom-left":"origin-bottom-left","bottom-right":"origin-bottom-right",bottom:"origin-bottom"};function Nf({open:e}){const t=fe(),n=mr(),r=fn(),o=ce(),a=o.value.placement,{isDisconnected:i,startSession:s,transcript:l,conversationIndex:c}=de(),f=$a(),u=Q(()=>{var g;return n.value||r.value?!f.value||!n.value?l.value:[{type:"message",role:"ai",message:f.value,isText:!0,conversationIndex:((g=l.value[0])==null?void 0:g.conversationIndex)??c.peek()},...l.value]:o.value.transcript_enabled?l.value:l.value.filter(p=>p.type!=="message"||p.isText)}),v=u.value.length>0||!i.value&&o.value.transcript_enabled,h=xe(!0);return d(ke,{initial:!1,active:e,children:d("div",{className:Y("flex flex-col overflow-hidden absolute bg-base shadow-lg pointer-events-auto rounded-sheet w-full max-w-[400px] h-[calc(100%-80px)] max-h-[550px]","transition-[transform,opacity] duration-200 data-hidden:scale-90 data-hidden:opacity-0",Tf[a],a.startsWith("top")?"top-20":"bottom-20"),children:[d("div",{className:"bg-base shrink-0 flex gap-2 p-4 items-start",children:[d("div",{className:"relative w-16 h-16"}),d(ke,{active:v&&!i.value,children:d(yr,{className:"rounded-bl-[calc(var(--el-bubble-radius)/3)] transition-opacity data-hidden:opacity-0"})})]}),d(Ef,{transcript:u,scrollPinned:h}),d(Cf,{scrollPinned:h,showTranscript:v}),d(ke,{active:!v||i.value,children:d("div",{className:"absolute top-0 left-0 right-0 p-4 flex justify-center transition-[opacity,transform] duration-200 data-hidden:opacity-0 data-hidden:-translate-y-4",children:d(bf,{})})}),d("div",{className:Y("absolute origin-top-left transition-[transform,left,top] duration-200 z-1",v?"top-4 left-4 scale-[0.333]":"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 scale-100"),children:[d(_t,{size:"lg"}),d(ke,{active:!v&&i.value&&!n.value,children:d("div",{className:"absolute bottom-0 p-1 rounded-[calc(var(--el-button-radius)+4px)] bg-base left-1/2 -translate-x-1/2 translate-y-1/2 transition-[opacity,transform] data-hidden:opacity-0 data-hidden:scale-100 scale-150",children:d(Ye,{"aria-label":t.start_call,variant:"primary",icon:"phone",onClick:g=>s(g.currentTarget)})})}),d(ke,{active:!v&&!i.value,children:d("div",{className:"absolute -bottom-3 left-1/2 -translate-x-1/2 translate-y-full transition-[opacity,transform] data-hidden:opacity-0 data-hidden:scale-75",children:d(yr,{})})})]})]})})}function Cs({expanded:e}){const t=fn(),n=ce().value.variant,{isDisconnected:r}=de(),o=fe(),a=$(()=>{e.value=!e.value},[e]);return d(ee,{children:[n==="full"&&d(Fe,{visible:!e.value&&!r.value,className:"p-1",children:d(_t,{})}),d(Fe,{grow:n!=="tiny",visible:!t.value&&!e.value&&!r.value,className:"p-1",children:d(eo,{iconOnly:!0,isDisconnected:!1})}),d(Qr,{visible:!t.value&&!e.value&&!r.value}),d(Fe,{grow:r.value,visible:!0,className:"p-1",children:d(Ye,{className:"w-full",variant:"primary",iconClassName:Y((e.value||!r.value)&&"transition-transform duration-200",e.value&&"-rotate-180"),icon:e.value?"chevron-up":r.value?t.value?"chat":"phone":"chevron-up","aria-label":e.value?o.collapse:r.value?t.value?o.start_chat:o.start_call:o.expand,onClick:!e.value&&!r.value?a:void 0,children:!e.value&&r.value&&n!=="tiny"?t.value?o.start_chat:o.start_call:void 0})})]})}function Pf({expanded:e,className:t,...n}){const{isDisconnected:r}=de(),o=fe();return d("div",{className:Y("transition-[border-radius] flex flex-col p-2",!e.value&&r.value?"rounded-sheet":"rounded-compact-sheet",t),...n,children:[d(Fe,{visible:!e.value&&r.value,className:"p-1 !min-w-60",children:d("div",{className:"flex items-center gap-2",children:[d(_t,{}),d("div",{className:"text-sm max-w-64",children:o.main_label})]})}),d("div",{className:"flex items-center",children:d(Cs,{expanded:e})})]})}function Af({expanded:e,className:t,...n}){return d("div",{className:Y("rounded-compact-sheet flex items-center p-2",t),...n,children:[d(Fe,{visible:!e.value,className:"p-1",children:d(_t,{})}),d(Cs,{expanded:e})]})}function $f({visible:e,className:t,...n}){const r=fe(),{language:o,showPicker:a}=gt();return a.value?d(Fe,{visible:e,className:"p-1",children:d(xs,{children:d(ys,{className:Y("h-9 min-w-max border border-base-border rounded-button focus-ring px-1.5 flex gap-1 items-center transition-colors duration-200 hover:bg-base-hover active:bg-base-active",t),"aria-label":r.change_language,...n,children:[d(Jr,{flagCode:o.value.flagCode}),d(bs,{className:"px-1 text-base-subtle",asChild:!0,children:d(wt,{size:"sm",name:"chevron-down"})})]})})}):null}function ks(){const e=ce().value.variant,{isDisconnected:t,status:n}=de();return d(ee,{children:[d(eo,{isDisconnected:t.value,iconOnly:e==="tiny",className:"w-full m-1 z-1",disabled:n.value==="disconnecting"||n.value==="connecting"}),d($f,{visible:t.value}),d(Qr,{visible:!t.value})]})}function If({className:e,...t}){const{isDisconnected:n}=de(),r=fe();return d("div",{className:Y("flex flex-col p-2 rounded-sheet",e),...t,children:[d("div",{className:"flex items-center p-1 gap-2 min-w-60",children:[d(_t,{}),d("div",{className:"relative text-sm max-w-64",children:[d("span",{className:Y("block transition-[transform,opacity] duration-200",!n.value&&"opacity-0 scale-90"),children:r.main_label}),d(ke,{active:!n.value,children:d(yr,{className:"absolute top-1/2 -translate-y-1/2 transition-[transform,opacity] duration-200 data-hidden:opacity-0 data-hidden:scale-90"})})]})]}),d("div",{className:"flex items-center",children:d(ks,{})})]})}function Df({className:e,...t}){return d("div",{className:Y("rounded-compact-sheet flex items-center p-2",e),...t,children:[d(_t,{className:"mx-1"}),d(ks,{})]})}function Mf({expandable:e,expanded:t}){const n=ce().value.variant,r=dn(),{isDisconnected:o}=de(),a=$(async()=>{await r.requestTerms(),t.value=!t.peek()},[t]),i=n==="full";return e?d(i?Pf:Af,{expanded:t,className:Y("bg-base shadow-md pointer-events-auto overflow-hidden",(o.value||t.value)&&"cursor-pointer"),onClick:o.value||t.value?a:void 0}):d(i?If:Df,{className:"bg-base shadow-md pointer-events-auto overflow-hidden"})}function Of(){const e=fe(),t=ce(),{dismissTerms:n,acceptTerms:r}=dn();return d("div",{className:"max-w-[400px] flex flex-col gap-2 bg-base shadow-md pointer-events-auto rounded-sheet p-3 text-sm",children:[d("div",{className:"flex flex-col gap-1 terms p-2 pt-1",dangerouslySetInnerHTML:{__html:t.value.terms_html??""}}),d("div",{className:"flex justify-end gap-2",children:[d(Ye,{onClick:n,children:e.dismiss_terms}),d(Ye,{onClick:r,variant:"primary",children:e.accept_terms})]})]})}function Lf({copyText:e,children:t}){const n=fe(),[r,o]=S(!1);A(()=>{if(r){const i=setTimeout(()=>{o(!1)},2e3);return()=>{clearTimeout(i)}}},[r]);const a=$(()=>{const i=La(e);i&&(navigator.clipboard.writeText(i),o(!0))},[]);return d(Ye,{onClick:a,children:r?n.copied:t})}function Rf({sawError:e}){const t=fe(),{error:n,lastId:r}=de(),o=$(()=>{e.value=!0},[]);return d("div",{className:"max-w-[400px] flex flex-col gap-2 bg-base shadow-md pointer-events-auto rounded-sheet p-3 text-sm",children:[d("div",{className:"p-2 pt-1",children:[d("h1",{className:"text-md font-medium pb-1",children:t.error_occurred}),n.value,r.value&&d(ee,{children:[d("br",{}),d("span",{className:"text-base-subtle",children:[t.conversation_id,": ",r.value]})]})]}),d("div",{className:"flex justify-end gap-2",children:[d(Lf,{copyText:r,children:t.copy_id}),d(Ye,{variant:"primary",onClick:o,children:"Close"})]})]})}function Ff(){const e=ce();return e.value.disable_banner?null:d("p",{className:Y("whitespace-nowrap [line-height:var(--el-overlay-padding)] text-[10px] px-3",e.value.placement.startsWith("top")?"-translate-y-[calc(var(--el-overlay-padding))]":"translate-y-[calc(var(--el-overlay-padding))]"),children:[d("span",{className:"opacity-30",children:"Powered by ElevenLabs"})," ",d("a",{href:e.value.override_link||"https://elevenlabs.io/conversational-ai",className:"underline cursor-pointer pointer-events-auto focus-visible:outline-none opacity-30 hover:opacity-50 focus-visible:opacity-100 focus-visible:underline-offset-2",target:"_blank",children:"Conversational AI"})]})}const Pt={left:"items-start",center:"items-center",right:"items-end"},At={top:"flex-col-reverse justify-end",bottom:"flex-col justify-end"},zf={"top-left":`${At.top} ${Pt.left}`,top:`${At.top} ${Pt.center}`,"top-right":`${At.top} ${Pt.right}`,"bottom-left":`${At.bottom} ${Pt.left}`,bottom:`${At.bottom} ${Pt.center}`,"bottom-right":`${At.bottom} ${Pt.right}`},Uf=tn(function(){const e=xe(!1),t=ce(),n=xe(!1),{error:r}=de(),o=dn(),a=Q(()=>t.value.transcript_enabled||t.value.text_input_enabled),i=Q(()=>Y("overlay flex transition-opacity duration-200 data-hidden:opacity-0",zf[t.value.placement]));je(()=>{r.value&&(a.value?(n.value=!0,e.value=!0):n.value=!1)});const s=Q(()=>!a.value&&r.value&&!n.value?"error":!o.termsAccepted.value&&o.termsShown.value?"terms":"conversation"),l=Q(()=>s.value==="error"),c=Q(()=>s.value==="terms"),f=Q(()=>s.value==="conversation");return d(ee,{children:[d(ke,{initial:!1,active:f,children:d(pn,{className:i,children:[a.value&&d(Nf,{open:e}),d(Mf,{expandable:a.value,expanded:e})]})}),d(ke,{initial:!1,active:c,children:d(pn,{className:i,children:d(Of,{})})}),d(ke,{initial:!1,active:l,children:d(pn,{className:i,children:d(Rf,{sawError:n})})}),d(pn,{className:i,children:d(Ff,{})})]})});function Bf(e){return d(gl,{value:e,children:d(Cl,{children:d(Il,{children:d(Nl,{children:d(Ml,{children:d(Sl,{children:d(El,{children:d(Pl,{children:d(Ol,{children:d(Ll,{children:[d(ml,{}),d(Uf,{})]})})})})})})})})})})}function Wf(e="elevenlabs-convai"){Os(Bf,e,[...hr],{shadow:!0})}Wf()})();
@@ -0,0 +1 @@
1
+ module.exports = {};
package/package.json ADDED
@@ -0,0 +1,31 @@
1
+ {
2
+ "name": "@elevenlabs/convai-widget-embed",
3
+ "version": "0.0.6",
4
+ "description": "The Conversational AI Widget bundled with all dependencies for easy embedding.",
5
+ "main": "./dist/index.js",
6
+ "unpkg": "./dist/index.js",
7
+ "source": "src/index.ts",
8
+ "type": "module",
9
+ "keywords": [],
10
+ "author": "ElevenLabs",
11
+ "license": "MIT",
12
+ "devDependencies": {
13
+ "eslint": "^9.8.0",
14
+ "microbundle": "^0.15.1",
15
+ "typescript": "^5.5.4",
16
+ "vite": "^6.3.2",
17
+ "@elevenlabs/convai-widget-core": "0.0.6"
18
+ },
19
+ "repository": {
20
+ "type": "git",
21
+ "url": "git+https://github.com/elevenlabs/packages.git",
22
+ "directory": "packages/convai-widget-embed"
23
+ },
24
+ "scripts": {
25
+ "build": "vite build",
26
+ "lint": "npm run lint:ts && npm run lint:es && npm run lint:prettier",
27
+ "lint:ts": "tsc --noEmit --skipLibCheck",
28
+ "lint:es": "npx eslint .",
29
+ "lint:prettier": "prettier 'src/**/*.ts'"
30
+ }
31
+ }
package/vite.config.ts ADDED
@@ -0,0 +1,13 @@
1
+ import { defineConfig } from "vite";
2
+
3
+ export default defineConfig({
4
+ build: {
5
+ lib: {
6
+ name: "ConvaiWidgetEmbed",
7
+ entry: "src/index.ts",
8
+ fileName: () => "index.js",
9
+ formats: ["iife"],
10
+ },
11
+ outDir: "dist",
12
+ },
13
+ });