@accurix/centrinfo-widget 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,1156 @@
1
+ var Centrinfo=(function(ae){"use strict";var xr=Object.defineProperty;var yr=(ae,ee,T)=>ee in ae?xr(ae,ee,{enumerable:!0,configurable:!0,writable:!0,value:T}):ae[ee]=T;var be=(ae,ee,T)=>yr(ae,typeof ee!="symbol"?ee+"":ee,T);var ee,T,At,de,It,Tt,Et,rt,Ue,Te,Nt,at,it,st,Mt,je={},Le=[],En=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,Be=Array.isArray;function ce(t,e){for(var n in e)t[n]=e[n];return t}function ct(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function Nn(t,e,n){var o,i,a,s={};for(a in e)a=="key"?o=e[a]:a=="ref"?i=e[a]:s[a]=e[a];if(arguments.length>2&&(s.children=arguments.length>3?ee.call(arguments,2):n),typeof t=="function"&&t.defaultProps!=null)for(a in t.defaultProps)s[a]===void 0&&(s[a]=t.defaultProps[a]);return qe(t,s,o,i,null)}function qe(t,e,n,o,i){var a={type:t,props:e,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:i??++At,__i:-1,__u:0};return i==null&&T.vnode!=null&&T.vnode(a),a}function R(t){return t.children}function Fe(t,e){this.props=t,this.context=e}function we(t,e){if(e==null)return t.__?we(t.__,t.__i+1):null;for(var n;e<t.__k.length;e++)if((n=t.__k[e])!=null&&n.__e!=null)return n.__e;return typeof t.type=="function"?we(t):null}function Mn(t){if(t.__P&&t.__d){var e=t.__v,n=e.__e,o=[],i=[],a=ce({},e);a.__v=e.__v+1,T.vnode&&T.vnode(a),dt(t.__P,a,e,t.__n,t.__P.namespaceURI,32&e.__u?[n]:null,o,n??we(e),!!(32&e.__u),i),a.__v=e.__v,a.__.__k[a.__i]=a,Rt(o,a,i),e.__e=e.__=null,a.__e!=n&&Pt(a)}}function Pt(t){if((t=t.__)!=null&&t.__c!=null)return t.__e=t.__c.base=null,t.__k.some(function(e){if(e!=null&&e.__e!=null)return t.__e=t.__c.base=e.__e}),Pt(t)}function lt(t){(!t.__d&&(t.__d=!0)&&de.push(t)&&!We.__r++||It!=T.debounceRendering)&&((It=T.debounceRendering)||Tt)(We)}function We(){try{for(var t,e=1;de.length;)de.length>e&&de.sort(Et),t=de.shift(),e=de.length,Mn(t)}finally{de.length=We.__r=0}}function $t(t,e,n,o,i,a,s,d,f,l,u){var c,x,m,g,O,w,y,b=o&&o.__k||Le,I=e.length;for(f=Pn(n,e,b,f,I),c=0;c<I;c++)(m=n.__k[c])!=null&&(x=m.__i!=-1&&b[m.__i]||je,m.__i=c,w=dt(t,m,x,i,a,s,d,f,l,u),g=m.__e,m.ref&&x.ref!=m.ref&&(x.ref&&ut(x.ref,null,m),u.push(m.ref,m.__c||g,m)),O==null&&g!=null&&(O=g),(y=!!(4&m.__u))||x.__k===m.__k?(f=Dt(m,f,t,y),y&&x.__e&&(x.__e=null)):typeof m.type=="function"&&w!==void 0?f=w:g&&(f=g.nextSibling),m.__u&=-7);return n.__e=O,f}function Pn(t,e,n,o,i){var a,s,d,f,l,u=n.length,c=u,x=0;for(t.__k=new Array(i),a=0;a<i;a++)(s=e[a])!=null&&typeof s!="boolean"&&typeof s!="function"?(typeof s=="string"||typeof s=="number"||typeof s=="bigint"||s.constructor==String?s=t.__k[a]=qe(null,s,null,null,null):Be(s)?s=t.__k[a]=qe(R,{children:s},null,null,null):s.constructor===void 0&&s.__b>0?s=t.__k[a]=qe(s.type,s.props,s.key,s.ref?s.ref:null,s.__v):t.__k[a]=s,f=a+x,s.__=t,s.__b=t.__b+1,d=null,(l=s.__i=$n(s,n,f,c))!=-1&&(c--,(d=n[l])&&(d.__u|=2)),d==null||d.__v==null?(l==-1&&(i>u?x--:i<u&&x++),typeof s.type!="function"&&(s.__u|=4)):l!=f&&(l==f-1?x--:l==f+1?x++:(l>f?x--:x++,s.__u|=4))):t.__k[a]=null;if(c)for(a=0;a<u;a++)(d=n[a])!=null&&(2&d.__u)==0&&(d.__e==o&&(o=we(d)),Ut(d,d));return o}function Dt(t,e,n,o){var i,a;if(typeof t.type=="function"){for(i=t.__k,a=0;i&&a<i.length;a++)i[a]&&(i[a].__=t,e=Dt(i[a],e,n,o));return e}t.__e!=e&&(o&&(e&&t.type&&!e.parentNode&&(e=we(t)),n.insertBefore(t.__e,e||null)),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function $n(t,e,n,o){var i,a,s,d=t.key,f=t.type,l=e[n],u=l!=null&&(2&l.__u)==0;if(l===null&&d==null||u&&d==l.key&&f==l.type)return n;if(o>(u?1:0)){for(i=n-1,a=n+1;i>=0||a<e.length;)if((l=e[s=i>=0?i--:a++])!=null&&(2&l.__u)==0&&d==l.key&&f==l.type)return s}return-1}function Ot(t,e,n){e[0]=="-"?t.setProperty(e,n??""):t[e]=n==null?"":typeof n!="number"||En.test(e)?n:n+"px"}function Ge(t,e,n,o,i){var a,s;e:if(e=="style")if(typeof n=="string")t.style.cssText=n;else{if(typeof o=="string"&&(t.style.cssText=o=""),o)for(e in o)n&&e in n||Ot(t.style,e,"");if(n)for(e in n)o&&n[e]==o[e]||Ot(t.style,e,n[e])}else if(e[0]=="o"&&e[1]=="n")a=e!=(e=e.replace(Nt,"$1")),s=e.toLowerCase(),e=s in t||e=="onFocusOut"||e=="onFocusIn"?s.slice(2):e.slice(2),t.l||(t.l={}),t.l[e+a]=n,n?o?n[Te]=o[Te]:(n[Te]=at,t.addEventListener(e,a?st:it,a)):t.removeEventListener(e,a?st:it,a);else{if(i=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=n??"";break e}catch{}typeof n=="function"||(n==null||n===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&n==1?"":n))}}function zt(t){return function(e){if(this.l){var n=this.l[e.type+t];if(e[Ue]==null)e[Ue]=at++;else if(e[Ue]<n[Te])return;return n(T.event?T.event(e):e)}}}function dt(t,e,n,o,i,a,s,d,f,l){var u,c,x,m,g,O,w,y,b,I,H,G,X,V,K,$=e.type;if(e.constructor!==void 0)return null;128&n.__u&&(f=!!(32&n.__u),a=[d=e.__e=n.__e]),(u=T.__b)&&u(e);e:if(typeof $=="function")try{if(y=e.props,b=$.prototype&&$.prototype.render,I=(u=$.contextType)&&o[u.__c],H=u?I?I.props.value:u.__:o,n.__c?w=(c=e.__c=n.__c).__=c.__E:(b?e.__c=c=new $(y,H):(e.__c=c=new Fe(y,H),c.constructor=$,c.render=On),I&&I.sub(c),c.state||(c.state={}),c.__n=o,x=c.__d=!0,c.__h=[],c._sb=[]),b&&c.__s==null&&(c.__s=c.state),b&&$.getDerivedStateFromProps!=null&&(c.__s==c.state&&(c.__s=ce({},c.__s)),ce(c.__s,$.getDerivedStateFromProps(y,c.__s))),m=c.props,g=c.state,c.__v=e,x)b&&$.getDerivedStateFromProps==null&&c.componentWillMount!=null&&c.componentWillMount(),b&&c.componentDidMount!=null&&c.__h.push(c.componentDidMount);else{if(b&&$.getDerivedStateFromProps==null&&y!==m&&c.componentWillReceiveProps!=null&&c.componentWillReceiveProps(y,H),e.__v==n.__v||!c.__e&&c.shouldComponentUpdate!=null&&c.shouldComponentUpdate(y,c.__s,H)===!1){e.__v!=n.__v&&(c.props=y,c.state=c.__s,c.__d=!1),e.__e=n.__e,e.__k=n.__k,e.__k.some(function(j){j&&(j.__=e)}),Le.push.apply(c.__h,c._sb),c._sb=[],c.__h.length&&s.push(c);break e}c.componentWillUpdate!=null&&c.componentWillUpdate(y,c.__s,H),b&&c.componentDidUpdate!=null&&c.__h.push(function(){c.componentDidUpdate(m,g,O)})}if(c.context=H,c.props=y,c.__P=t,c.__e=!1,G=T.__r,X=0,b)c.state=c.__s,c.__d=!1,G&&G(e),u=c.render(c.props,c.state,c.context),Le.push.apply(c.__h,c._sb),c._sb=[];else do c.__d=!1,G&&G(e),u=c.render(c.props,c.state,c.context),c.state=c.__s;while(c.__d&&++X<25);c.state=c.__s,c.getChildContext!=null&&(o=ce(ce({},o),c.getChildContext())),b&&!x&&c.getSnapshotBeforeUpdate!=null&&(O=c.getSnapshotBeforeUpdate(m,g)),V=u!=null&&u.type===R&&u.key==null?Ht(u.props.children):u,d=$t(t,Be(V)?V:[V],e,n,o,i,a,s,d,f,l),c.base=e.__e,e.__u&=-161,c.__h.length&&s.push(c),w&&(c.__E=c.__=null)}catch(j){if(e.__v=null,f||a!=null)if(j.then){for(e.__u|=f?160:128;d&&d.nodeType==8&&d.nextSibling;)d=d.nextSibling;a[a.indexOf(d)]=null,e.__e=d}else{for(K=a.length;K--;)ct(a[K]);ft(e)}else e.__e=n.__e,e.__k=n.__k,j.then||ft(e);T.__e(j,e,n)}else a==null&&e.__v==n.__v?(e.__k=n.__k,e.__e=n.__e):d=e.__e=Dn(n.__e,e,n,o,i,a,s,f,l);return(u=T.diffed)&&u(e),128&e.__u?void 0:d}function ft(t){t&&(t.__c&&(t.__c.__e=!0),t.__k&&t.__k.some(ft))}function Rt(t,e,n){for(var o=0;o<n.length;o++)ut(n[o],n[++o],n[++o]);T.__c&&T.__c(e,t),t.some(function(i){try{t=i.__h,i.__h=[],t.some(function(a){a.call(i)})}catch(a){T.__e(a,i.__v)}})}function Ht(t){return typeof t!="object"||t==null||t.__b>0?t:Be(t)?t.map(Ht):t.constructor!==void 0?null:ce({},t)}function Dn(t,e,n,o,i,a,s,d,f){var l,u,c,x,m,g,O,w=n.props||je,y=e.props,b=e.type;if(b=="svg"?i="http://www.w3.org/2000/svg":b=="math"?i="http://www.w3.org/1998/Math/MathML":i||(i="http://www.w3.org/1999/xhtml"),a!=null){for(l=0;l<a.length;l++)if((m=a[l])&&"setAttribute"in m==!!b&&(b?m.localName==b:m.nodeType==3)){t=m,a[l]=null;break}}if(t==null){if(b==null)return document.createTextNode(y);t=document.createElementNS(i,b,y.is&&y),d&&(T.__m&&T.__m(e,a),d=!1),a=null}if(b==null)w===y||d&&t.data==y||(t.data=y);else{if(a=b=="textarea"&&y.defaultValue!=null?null:a&&ee.call(t.childNodes),!d&&a!=null)for(w={},l=0;l<t.attributes.length;l++)w[(m=t.attributes[l]).name]=m.value;for(l in w)m=w[l],l=="dangerouslySetInnerHTML"?c=m:l=="children"||l in y||l=="value"&&"defaultValue"in y||l=="checked"&&"defaultChecked"in y||Ge(t,l,null,m,i);for(l in y)m=y[l],l=="children"?x=m:l=="dangerouslySetInnerHTML"?u=m:l=="value"?g=m:l=="checked"?O=m:d&&typeof m!="function"||w[l]===m||Ge(t,l,m,w[l],i);if(u)d||c&&(u.__html==c.__html||u.__html==t.innerHTML)||(t.innerHTML=u.__html),e.__k=[];else if(c&&(t.innerHTML=""),$t(e.type=="template"?t.content:t,Be(x)?x:[x],e,n,o,b=="foreignObject"?"http://www.w3.org/1999/xhtml":i,a,s,a?a[0]:n.__k&&we(n,0),d,f),a!=null)for(l=a.length;l--;)ct(a[l]);d&&b!="textarea"||(l="value",b=="progress"&&g==null?t.removeAttribute("value"):g!=null&&(g!==t[l]||b=="progress"&&!g||b=="option"&&g!=w[l])&&Ge(t,l,g,w[l],i),l="checked",O!=null&&O!=t[l]&&Ge(t,l,O,w[l],i))}return t}function ut(t,e,n){try{if(typeof t=="function"){var o=typeof t.__u=="function";o&&t.__u(),o&&e==null||(t.__u=t(e))}else t.current=e}catch(i){T.__e(i,n)}}function Ut(t,e,n){var o,i;if(T.unmount&&T.unmount(t),(o=t.ref)&&(o.current&&o.current!=t.__e||ut(o,null,e)),(o=t.__c)!=null){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(a){T.__e(a,e)}o.base=o.__P=null}if(o=t.__k)for(i=0;i<o.length;i++)o[i]&&Ut(o[i],e,n||typeof t.type!="function");n||ct(t.__e),t.__c=t.__=t.__e=void 0}function On(t,e,n){return this.constructor(t,n)}function jt(t,e,n){var o,i,a,s;e==document&&(e=document.documentElement),T.__&&T.__(t,e),i=(o=!1)?null:e.__k,a=[],s=[],dt(e,t=e.__k=Nn(R,null,[t]),i||je,je,e.namespaceURI,i?null:e.firstChild?ee.call(e.childNodes):null,a,i?i.__e:e.firstChild,o,s),Rt(a,t,s)}function zn(t){function e(n){var o,i;return this.getChildContext||(o=new Set,(i={})[e.__c]=this,this.getChildContext=function(){return i},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(a){this.props.value!=a.value&&o.forEach(function(s){s.__e=!0,lt(s)})},this.sub=function(a){o.add(a);var s=a.componentWillUnmount;a.componentWillUnmount=function(){o&&o.delete(a),s&&s.call(a)}}),n.children}return e.__c="__cC"+Mt++,e.__=t,e.Provider=e.__l=(e.Consumer=function(n,o){return n.children(o)}).contextType=e,e}ee=Le.slice,T={__e:function(t,e,n,o){for(var i,a,s;e=e.__;)if((i=e.__c)&&!i.__)try{if((a=i.constructor)&&a.getDerivedStateFromError!=null&&(i.setState(a.getDerivedStateFromError(t)),s=i.__d),i.componentDidCatch!=null&&(i.componentDidCatch(t,o||{}),s=i.__d),s)return i.__E=i}catch(d){t=d}throw t}},At=0,Fe.prototype.setState=function(t,e){var n;n=this.__s!=null&&this.__s!=this.state?this.__s:this.__s=ce({},this.state),typeof t=="function"&&(t=t(ce({},n),this.props)),t&&ce(n,t),t!=null&&this.__v&&(e&&this._sb.push(e),lt(this))},Fe.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),lt(this))},Fe.prototype.render=R,de=[],Tt=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,Et=function(t,e){return t.__v.__b-e.__v.__b},We.__r=0,rt=Math.random().toString(8),Ue="__d"+rt,Te="__a"+rt,Nt=/(PointerCapture)$|Capture$/i,at=0,it=zt(!1),st=zt(!0),Mt=0;var Rn=0;function r(t,e,n,o,i,a){e||(e={});var s,d,f=e;if("ref"in f)for(d in f={},e)d=="ref"?s=e[d]:f[d]=e[d];var l={type:t,props:f,key:n,ref:s,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--Rn,__i:-1,__u:0,__source:i,__self:a};if(typeof t=="function"&&(s=t.defaultProps))for(d in s)f[d]===void 0&&(f[d]=s[d]);return T.vnode&&T.vnode(l),l}class Lt extends Error{constructor(n,o){super(o);be(this,"status");this.status=n,this.name="ApiError"}}const ht=()=>({agentName:"Assistant",greeting:"Hi! ๐Ÿ‘‹ How can I help you today?",allowVoiceInput:!1,availableActions:[]});class Bt{constructor(e,n,o){be(this,"baseUrl");be(this,"token");be(this,"gifApiKey");this.baseUrl=e,this.token=n,this.gifApiKey=o}headers(e=!0){const n={Authorization:`Bearer ${this.token}`};return e&&(n["Content-Type"]="application/json"),n}async json(e){let n;try{n=await e.json()}catch{n=void 0}if(!e.ok){const o=Un(n)??`request failed (${e.status})`;throw new Lt(e.status,o)}return n?.data??n}async bootstrap(){try{const e=await fetch(`${this.baseUrl}/public-chat/bootstrap`,{headers:this.headers(!1)});if(!e.ok)return ht();const n=await this.json(e);return{...ht(),...n}}catch{return ht()}}async stream(e,n,o){const i=await fetch(`${this.baseUrl}/public-chat/stream`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:n}),signal:o.signal});return!i.ok||!i.body?this.send(e,n,o):jn(i.body,o)}async send(e,n,o){const i=await fetch(`${this.baseUrl}/public-chat`,{method:"POST",headers:this.headers(),body:JSON.stringify({question:e,sessionId:n}),signal:o.signal}),a=await this.json(i);return o.onChunk(a.answer??""),{answer:a.answer??"",sources:a.sources??[],suggestedReplies:a.suggestedReplies??[],availableActions:a.availableActions??[],handoffOffered:a.handoffOffered??!1,requestedContactFields:qt(a.requestedContactFields),conversationEnded:a.conversationEnded??!1}}async action(e,n){const o=await fetch(`${this.baseUrl}/public-chat/${e}`,{method:"POST",headers:this.headers(),body:JSON.stringify(n)}),i=await this.json(o);return{ok:!0,note:i?.note,booking:i?.booking}}async identify(e,n){if(!(!e||!n))try{const o=await fetch(`${this.baseUrl}/public-chat/identify`,{method:"POST",headers:this.headers(),body:JSON.stringify(Hn(e,n))});if(!o.ok)try{await o.text()}catch{}}catch{}}async transcribe(e,n){const o=await fetch(`${this.baseUrl}/public-chat/transcribe`,{method:"POST",headers:this.headers(),body:JSON.stringify({audioBase64:e,mimeType:n})});return(await this.json(o)).text??""}async endConversation(e){try{const n=await fetch(`${this.baseUrl}/public-chat/end`,{method:"POST",headers:this.headers(),body:JSON.stringify({sessionId:e})});if(!n.ok)try{await n.text()}catch{}}catch{}}async sendFeedback(e){try{const n=await fetch(`${this.baseUrl}/public-chat/feedback`,{method:"POST",headers:this.headers(),body:JSON.stringify(e)});if(!n.ok)try{await n.text()}catch{}}catch{}}async extract(e,n,o){const i=await fetch(`${this.baseUrl}/public-chat/extract`,{method:"POST",headers:this.headers(),body:JSON.stringify({fileBase64:e,mimeType:n,filename:o})});return(await this.json(i)).text??""}async demoSlots(e,n){try{const o=`from=${encodeURIComponent(e)}&to=${encodeURIComponent(n)}`,i=await fetch(`${this.baseUrl}/public-chat/demo-slots?${o}`,{headers:this.headers(!1)});if(!i.ok)return{taken:[],busy:[]};const a=await this.json(i);return{taken:a?.taken??[],busy:a?.busy??[]}}catch{return{taken:[],busy:[]}}}async searchGifs(e){if(!this.gifApiKey)return[];const o=`https://tenor.googleapis.com/v2/search?q=${encodeURIComponent(e.trim()||"trending")}&key=${this.gifApiKey}&limit=24&media_filter=tinygif,gif&contentfilter=high`;try{const i=await fetch(o);return i.ok?((await i.json()).results??[]).map(s=>({id:s.id,url:s.media_formats?.gif?.url??s.media_formats?.tinygif?.url??"",preview:s.media_formats?.tinygif?.url??s.media_formats?.gif?.url??"",alt:s.content_description||"GIF"})).filter(s=>s.url):[]}catch{return[]}}}const Hn=(t,e)=>{const n={...e.customAttributes??{},...e.metadata??{}};e.createdAt!==void 0&&(n.createdAt=e.createdAt),e.avatarUrl&&(n.avatarUrl=e.avatarUrl),e.company&&(n.company=e.company);const o={sessionId:t},i=e.externalId??e.userId;return i&&(o.externalId=i),e.email&&(o.email=e.email),e.firstName&&(o.firstName=e.firstName),e.lastName&&(o.lastName=e.lastName),e.name&&(o.name=e.name),e.phone&&(o.phone=e.phone),Object.keys(n).length>0&&(o.metadata=n),o},Un=t=>{const e=t?.message;if(Array.isArray(e))return e.join(", ");if(typeof e=="string")return e},jn=async(t,e)=>{const n=t.getReader(),o=new TextDecoder,i={answer:"",sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1,requestedContactFields:[],conversationEnded:!1};let a="";for(;;){const{done:s,value:d}=await n.read();if(s)break;a+=o.decode(d,{stream:!0});let f;for(;(f=a.indexOf(`
2
+
3
+ `))!==-1;){const l=a.slice(0,f);a=a.slice(f+2);const u=Ln(l);if(u){if(u.event==="error")throw new Lt(502,u.data?.message??"stream error");if(u.event==="chunk"&&typeof u.data?.text=="string")i.answer+=u.data.text,e.onChunk(u.data.text);else if(u.event==="final"&&u.data)i.sources=u.data.sources??[],i.suggestedReplies=u.data.suggestedReplies??[],i.availableActions=u.data.availableActions??[],i.handoffOffered=!!u.data.handoffOffered,i.requestedContactFields=qt(u.data.requestedContactFields),i.conversationEnded=!!u.data.conversationEnded;else if(u.event==="done")return i}}}return i},Ln=t=>{let e="message";const n=[];for(const o of t.split(`
4
+ `))o.startsWith("event:")?e=o.slice(6).trim():o.startsWith("data:")&&n.push(o.slice(5).trim());if(n.length===0)return{event:e};try{return{event:e,data:JSON.parse(n.join(`
5
+ `))}}catch{return{event:e}}},qt=t=>Array.isArray(t)?t.filter(e=>typeof e=="string"):[],te=t=>new Promise(e=>setTimeout(e,t)),Ft={agentName:"Sara",agentAvatarUrl:"",greeting:"Hi! ๐Ÿ‘‹ I'm Sara, the Northwind assistant. Ask me anything about tracking, customs, or pricing โ€” or book a demo.",allowVoiceInput:!0,availableActions:["public_book_demo","public_capture_contact","public_submit_inquiry"],agentDescription:"I help with shipment tracking, customs, and pricing.",welcomeSubtitle:"Ask me anything โ€” most answers are instant.",disclaimerText:"Sara is an AI assistant; answers may be imperfect.",starterQuestions:["How do I track a shipment?","How does customs work?","What's your pricing?"]},Bn=[{match:/^\s*(hi+|hey+|hello|yo|sup|howdy|hola|thanks|thank you|thx|good (morning|afternoon|evening))\b/i,result:{answer:"Hello! ๐Ÿ‘‹ How can I help you today?",sources:[],suggestedReplies:["How do I track a shipment?","How does customs work?"],handoffOffered:!1}},{match:/track|shipment|where|status/i,result:{answer:"You can track any shipment in real time from the **Tracking** tab โ€” we merge GPS pings with carrier scan events, so the status is usually fresher than the carrier's own site. Each shipment also has a shareable link you can send to customers.",sources:[{title:"Real-time tracking",url:"https://northwind.example/docs/tracking"},{title:"Shareable tracking links",url:"https://northwind.example/docs/share"}],suggestedReplies:["How fresh is the data?","Can customers track too?"],handoffOffered:!1}},{match:/custom|clear|duty|tariff|import/i,result:{answer:"Customs is automated end-to-end: HS codes are auto-classified from your product catalog, duties are estimated up front, and most lanes are pre-cleared before the freight lands. If a shipment needs a human broker, we flag it early so it never sits at the border.",sources:[{title:"Smart customs",url:"https://northwind.example/docs/customs"}],suggestedReplies:["Which countries are pre-cleared?","What does it cost?"],handoffOffered:!1}},{match:/price|cost|pricing|plan|quote/i,result:{answer:"Pricing is usage-based โ€” you pay per shipment, with volume tiers that kick in automatically. There's no platform fee and no per-seat charge. I can have someone put together a quote for your lanes if you'd like.",sources:[{title:"Pricing",url:"https://northwind.example/pricing"}],suggestedReplies:["How do volume tiers work?","Is there a free trial?"],handoffOffered:!1}}],qn={answer:"That's a great question โ€” I don't have a confident answer from Northwind's published docs yet. Want me to pass it to the team so a human can follow up? You can also book a quick demo.",sources:[],suggestedReplies:["What can you help with?"],handoffOffered:!0};class Fn{async bootstrap(){return await te(180),Ft}async stream(e,n,o){await te(550);const i=Bn.find(d=>d.match.test(e)),a=i?i.result:qn,s=a.answer.split(/(\s+)/);for(const d of s){if(o.signal?.aborted)break;o.onChunk(d),await te(18+Math.min(40,d.length*6))}return{...a,availableActions:Ft.availableActions}}async action(e,n){return await te(450),{ok:!0,note:{"book-demo":"Demo requested โ€” we'll email you a few times that work. ๐Ÿ“…",contact:"Got it โ€” saved your details. โœ…",inquiry:"Thanks! We'll get back to you shortly. โœ‰๏ธ","request-callback":"We'll call you back soon. ๐Ÿ“ž","subscribe-newsletter":"You're subscribed. ๐ŸŽ‰"}[e]}}async transcribe(e,n){return await te(700),"How do I track a shipment?"}async extract(e,n,o){return await te(600),`[Attached file${o?`: ${o}`:""}] Invoice #4821 โ€” 3 pallets, Rotterdam โ†’ Lagos, ETA 12 days.`}async identify(e,n){await te(50)}async endConversation(e){await te(50)}async sendFeedback(){await te(50)}async demoSlots(e,n){return await te(150),{taken:[[11,0],[15,0]].map(([i,a])=>{const s=new Date;return s.setHours(i,a,0,0),s.toISOString()}),busy:[]}}async searchGifs(e){await te(280);const n=e.trim().toLowerCase(),o=n?pt.filter(a=>a.alt.includes(n)||a.tags.some(s=>s.includes(n)||n.includes(s))):pt;return(o.length>0?o:pt).map(a=>({id:a.id,url:Wt(a.emoji,a.anim),preview:Wt(a.emoji,a.anim),alt:a.alt}))}}const Ve="<animateTransform attributeName='transform' attributeType='XML' type='translate' values='0 0;0 -16;0 0' dur='0.7s' repeatCount='indefinite'/>",Ke="<animateTransform attributeName='transform' attributeType='XML' type='rotate' values='-14 64 110;14 64 110;-14 64 110' dur='0.9s' repeatCount='indefinite'/>",Wt=(t,e)=>{const n=`<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128'><rect width='128' height='128' rx='14' fill='#eef1f4'/><text x='64' y='88' font-size='64' text-anchor='middle'>${t}${e}</text></svg>`;return`data:image/svg+xml,${encodeURIComponent(n)}`},pt=[{id:"g1",emoji:"๐Ÿ‘",alt:"thumbs up",tags:["thumbs","yes","ok","great","good"],anim:Ve},{id:"g2",emoji:"๐ŸŽ‰",alt:"celebrate",tags:["party","yay","congrats","celebrate"],anim:Ke},{id:"g3",emoji:"๐Ÿ‘‹",alt:"wave hello",tags:["hi","hello","hey","wave","bye"],anim:Ke},{id:"g4",emoji:"โค๏ธ",alt:"heart",tags:["love","thanks","heart"],anim:Ve},{id:"g5",emoji:"๐Ÿค”",alt:"thinking",tags:["hmm","think","thinking"],anim:Ke},{id:"g6",emoji:"๐Ÿ˜‚",alt:"laughing",tags:["lol","funny","haha","laugh"],anim:Ve},{id:"g7",emoji:"๐Ÿ”ฅ",alt:"fire",tags:["fire","hot","lit","awesome"],anim:Ve},{id:"g8",emoji:"๐Ÿš€",alt:"rocket",tags:["rocket","launch","fast","go"],anim:Ke}],mt=t=>new Promise(e=>setTimeout(e,t));class Wn{constructor(e,n){be(this,"real");be(this,"strings");this.real=e,this.strings=n}bootstrap(){return this.real.bootstrap()}async stream(e,n,o){await mt(300);for(const i of this.strings.previewReply.split(/(\s+)/)){if(o.signal?.aborted)break;o.onChunk(i),await mt(16)}return{answer:this.strings.previewReply,sources:[],suggestedReplies:[],availableActions:[],handoffOffered:!1}}async action(){return await mt(250),{ok:!0,note:this.strings.previewActionNote}}async identify(){}async endConversation(){}async sendFeedback(){}async transcribe(){return""}async extract(){return""}async searchGifs(){return[]}async demoSlots(){return{taken:[],busy:[]}}}var Ce,U,_t,Gt,Ee=0,Vt=[],W=T,Kt=W.__b,Jt=W.__r,Yt=W.diffed,Zt=W.__c,Xt=W.unmount,Qt=W.__;function Je(t,e){W.__h&&W.__h(U,t,Ee||e),Ee=0;var n=U.__H||(U.__H={__:[],__h:[]});return t>=n.__.length&&n.__.push({}),n.__[t]}function C(t){return Ee=1,Gn(nn,t)}function Gn(t,e,n){var o=Je(Ce++,2);if(o.t=t,!o.__c&&(o.__=[nn(void 0,e),function(d){var f=o.__N?o.__N[0]:o.__[0],l=o.t(f,d);f!==l&&(o.__N=[l,o.__[1]],o.__c.setState({}))}],o.__c=U,!U.__f)){var i=function(d,f,l){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(x){return x.__c});if(u.every(function(x){return!x.__N}))return!a||a.call(this,d,f,l);var c=o.__c.props!==d;return u.some(function(x){if(x.__N){var m=x.__[0];x.__=x.__N,x.__N=void 0,m!==x.__[0]&&(c=!0)}}),a&&a.call(this,d,f,l)||c};U.__f=!0;var a=U.shouldComponentUpdate,s=U.componentWillUpdate;U.componentWillUpdate=function(d,f,l){if(this.__e){var u=a;a=void 0,i(d,f,l),a=u}s&&s.call(this,d,f,l)},U.shouldComponentUpdate=i}return o.__N||o.__}function B(t,e){var n=Je(Ce++,3);!W.__s&&tn(n.__H,e)&&(n.__=t,n.u=e,U.__H.__h.push(n))}function J(t){return Ee=5,Ne(function(){return{current:t}},[])}function Ne(t,e){var n=Je(Ce++,7);return tn(n.__H,e)&&(n.__=t(),n.__H=e,n.__h=t),n.__}function M(t,e){return Ee=8,Ne(function(){return t},e)}function Vn(t){var e=U.context[t.__c],n=Je(Ce++,9);return n.c=t,e?(n.__==null&&(n.__=!0,e.sub(U)),e.props.value):t.__}function Kn(){for(var t;t=Vt.shift();){var e=t.__H;if(t.__P&&e)try{e.__h.some(Ye),e.__h.some(bt),e.__h=[]}catch(n){e.__h=[],W.__e(n,t.__v)}}}W.__b=function(t){U=null,Kt&&Kt(t)},W.__=function(t,e){t&&e.__k&&e.__k.__m&&(t.__m=e.__k.__m),Qt&&Qt(t,e)},W.__r=function(t){Jt&&Jt(t),Ce=0;var e=(U=t.__c).__H;e&&(_t===U?(e.__h=[],U.__h=[],e.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(e.__h.some(Ye),e.__h.some(bt),e.__h=[],Ce=0)),_t=U},W.diffed=function(t){Yt&&Yt(t);var e=t.__c;e&&e.__H&&(e.__H.__h.length&&(Vt.push(e)!==1&&Gt===W.requestAnimationFrame||((Gt=W.requestAnimationFrame)||Jn)(Kn)),e.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),_t=U=null},W.__c=function(t,e){e.some(function(n){try{n.__h.some(Ye),n.__h=n.__h.filter(function(o){return!o.__||bt(o)})}catch(o){e.some(function(i){i.__h&&(i.__h=[])}),e=[],W.__e(o,n.__v)}}),Zt&&Zt(t,e)},W.unmount=function(t){Xt&&Xt(t);var e,n=t.__c;n&&n.__H&&(n.__H.__.some(function(o){try{Ye(o)}catch(i){e=i}}),n.__H=void 0,e&&W.__e(e,n.__v))};var en=typeof requestAnimationFrame=="function";function Jn(t){var e,n=function(){clearTimeout(o),en&&cancelAnimationFrame(e),setTimeout(t)},o=setTimeout(n,35);en&&(e=requestAnimationFrame(n))}function Ye(t){var e=U,n=t.__c;typeof n=="function"&&(t.__c=void 0,n()),U=e}function bt(t){var e=U;t.__c=t.__(),U=e}function tn(t,e){return!t||t.length!==e.length||e.some(function(n,o){return n!==t[o]})}function nn(t,e){return typeof e=="function"?e(t):e}const Yn=[{name:"Smileys",emojis:["๐Ÿ˜€","๐Ÿ˜ƒ","๐Ÿ˜„","๐Ÿ˜","๐Ÿ˜…","๐Ÿ˜‚","๐Ÿคฃ","๐Ÿ˜Š","๐Ÿ˜‡","๐Ÿ™‚","๐Ÿ™ƒ","๐Ÿ˜‰","๐Ÿ˜Œ","๐Ÿ˜","๐Ÿฅฐ","๐Ÿ˜˜","๐Ÿ˜‹","๐Ÿ˜›","๐Ÿ˜œ","๐Ÿคช","๐Ÿค—","๐Ÿคญ","๐Ÿค”","๐Ÿค","๐Ÿ˜","๐Ÿ˜ถ","๐Ÿ˜","๐Ÿ™„","๐Ÿ˜ด","๐Ÿฅณ","๐Ÿ˜Ž","๐Ÿค“","๐Ÿฅบ","๐Ÿ˜ข","๐Ÿ˜ญ","๐Ÿ˜ค","๐Ÿ˜ ","๐Ÿคฏ","๐Ÿ˜ฌ","๐Ÿ˜ฑ","๐Ÿคฉ","๐Ÿฅฑ"]},{name:"Gestures",emojis:["๐Ÿ‘","๐Ÿ‘Ž","๐Ÿ‘Œ","๐ŸคŒ","โœŒ๏ธ","๐Ÿคž","๐ŸคŸ","๐Ÿค˜","๐Ÿค™","๐Ÿ‘ˆ","๐Ÿ‘‰","๐Ÿ‘†","๐Ÿ‘‡","โœ‹","๐Ÿ–๏ธ","๐Ÿ‘‹","๐Ÿค","๐Ÿ™","๐Ÿ’ช","๐Ÿ‘","๐Ÿ™Œ","๐Ÿ‘","๐Ÿคฒ","๐Ÿซถ"]},{name:"Hearts & symbols",emojis:["โค๏ธ","๐Ÿงก","๐Ÿ’›","๐Ÿ’š","๐Ÿ’™","๐Ÿ’œ","๐Ÿ–ค","๐Ÿค","๐Ÿ’”","โฃ๏ธ","๐Ÿ’•","๐Ÿ’–","๐Ÿ’˜","๐Ÿ’","โœจ","โญ","๐ŸŒŸ","๐Ÿ’ซ","๐Ÿ”ฅ","๐ŸŽ‰","๐ŸŽŠ","โœ…","โŒ","โšก","๐Ÿ’ฏ","๐Ÿš€"]},{name:"Animals & nature",emojis:["๐Ÿถ","๐Ÿฑ","๐ŸฆŠ","๐Ÿป","๐Ÿผ","๐Ÿจ","๐Ÿฆ","๐Ÿฎ","๐Ÿธ","๐Ÿต","๐Ÿง","๐Ÿฆ„","๐Ÿ","๐Ÿฆ‹","๐Ÿข","๐Ÿฌ","๐ŸŒท","๐ŸŒธ","๐ŸŒน","๐ŸŒป","๐ŸŒณ","๐Ÿ€"]},{name:"Food & drink",emojis:["๐ŸŽ","๐ŸŒ","๐Ÿ‰","๐Ÿ“","๐Ÿ’","๐Ÿฅ‘","๐Ÿ”","๐ŸŸ","๐Ÿ•","๐ŸŒฎ","๐Ÿฟ","๐Ÿฉ","๐Ÿช","๐ŸŽ‚","โ˜•","๐Ÿต","๐Ÿบ","๐Ÿฅ‚","๐Ÿท"]},{name:"Objects & travel",emojis:["๐Ÿš€","โœˆ๏ธ","๐Ÿš—","๐Ÿ ","๐Ÿ“ฆ","๐Ÿ“ฑ","๐Ÿ’ป","โŒš","๐Ÿ“ท","๐Ÿ’ก","๐Ÿ”‘","๐ŸŽ","๐Ÿ“Œ","โœ๏ธ","๐Ÿ“","๐Ÿ“ž","๐Ÿ“ง","๐Ÿ’ฐ","๐Ÿ“ˆ","โฐ","๐Ÿ””","๐ŸŽฏ","๐Ÿ†","๐ŸŽฎ","๐ŸŽต","๐Ÿ’ฌ","๐Ÿ‘€"]}],Ze={inquiry:{title:"Leave a message",submit:"Send message",fields:[{key:"visitorName",label:"Name",kind:"text",identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"message",label:"Message",kind:"textarea",required:!0,placeholder:"How can we help?"}]},contact:{title:"Share your details",submit:"Save",fields:[{key:"name",label:"Name",kind:"text",identity:"name"},{key:"email",label:"Email",kind:"email",required:!0,identity:"email"},{key:"phone",label:"Phone",kind:"tel",identity:"phone"}]},"book-demo":{title:"Book a demo",submit:"Request demo",fields:[{key:"visitorName",label:"Name",kind:"text",identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"},{key:"preferredAt",label:"Preferred time",kind:"text",placeholder:"e.g. Thursday 3pm"},{key:"notes",label:"Notes",kind:"textarea",placeholder:"Anything we should know?"}]},"request-callback":{title:"Request a callback",submit:"Request callback",fields:[{key:"visitorName",label:"Name",kind:"text",identity:"name"},{key:"visitorPhone",label:"Phone",kind:"tel",required:!0,identity:"phone"},{key:"bestTime",label:"Best time to call",kind:"text",placeholder:"e.g. tomorrow afternoon"},{key:"topic",label:"Topic",kind:"text",placeholder:"What should we call about?"}]},"subscribe-newsletter":{title:"Subscribe",submit:"Subscribe",fields:[{key:"visitorName",label:"Name",kind:"text",identity:"name"},{key:"visitorEmail",label:"Email",kind:"email",required:!0,identity:"email"}]}},gt={openChat:"Open chat",closeChat:"Close chat",muteSounds:"Mute sounds",unmuteSounds:"Unmute sounds",statusOnline:"Online ยท replies instantly",statusOffline:"Away ยท leave a message",composerPlaceholder:"Type your messageโ€ฆ",send:"Send message",emoji:"Emoji",gifs:"GIFs",attachFile:"Attach a file",recordVoice:"Record a voice message",stopRecording:"Stop recording",stop:"Stop",copy:"Copy",copied:"Copied",retry:"Retry",clearChat:"Clear conversation",clearChatConfirm:"Clear this conversation?",clearChatConfirmBody:"This clears the messages on this device and starts a fresh chat.",clearConfirmCta:"Clear chat",endChat:"End conversation",endChatConfirm:"End this conversation?",endChatConfirmBody:"You won't be able to send more messages in this chat, but you can start a new one anytime.",endConfirmCta:"End conversation",conversationEnded:"This conversation has ended.",startNewChat:"Start a new conversation",pastConversations:"Past conversations",viewingPast:"Viewing a past conversation (read-only)",backToChat:"Back to current chat",historyEnded:"ended",feedbackHelpful:"Helpful",feedbackNotHelpful:"Not helpful",feedbackThanks:"Thanks for the feedback",csatPrompt:"How was this chat?",feedbackCommentPlaceholder:"What went wrong? (optional)",feedbackSend:"Send",cancel:"Cancel",newMessages:"New messages",poweredBy:"Powered by",searchGifs:"Search GIFsโ€ฆ",searchingGifs:"Searchingโ€ฆ",noGifs:"No GIFs found",assistantTyping:"Assistant is typing",emptyReply:"Sorry, I couldn't generate a reply.",errorGeneric:"Something went wrong reaching the assistant. Please try again.",errorRateLimit:"Youโ€™re sending messages a little fast โ€” give it a second and try again.",attaching:"Reading fileโ€ฆ",attachTooLarge:"That file is too large (max 8 MB).",attachFailed:"Couldnโ€™t read that file โ€” try another.",handoffTitle:"Want our team to follow up?",handoffName:"Name (optional)",handoffEmail:"Your email",handoffNotify:"Notify the team",sending:"Sendingโ€ฆ",handoffShared:"Iโ€™ve shared this with our team โ€” theyโ€™ll get back to you at {email}.",formThanks:"Thanks! Weโ€™ll be in touch.",formError:"Something went wrong โ€” please try again.",bookingPickTime:"What time works best?",bookingDuration:"30-minute demo",bookingRequested:"Requested for {when} โ€” weโ€™ll confirm by email.",bookingConfirmed:"Youโ€™re booked for {when}! A calendar invite is on its way. ๐Ÿ“…",bookingSlotTaken:"That time was just taken โ€” please pick another.",bookingViaProvider:"Pick a time that works for you on {provider}.",bookingOpenScheduler:"Open the scheduler",bookingLinkOpened:"Opening the scheduler โ€” pick a time that suits you. ๐Ÿ“…",bookingMeetingLink:"Meeting link",previewReply:"๐Ÿ‘‹ This is a preview โ€” replies here are samples. Publish the widget on your site to chat with the live AI.",previewActionNote:"Preview โ€” nothing was actually sent. This works for real once you publish.",previewBanner:"Preview โ€” sample replies, no AI"},Xe=(t,e)=>t.replace(/\{(\w+)\}/g,(n,o)=>e[o]??""),Zn=t=>t?{...gt,...t}:gt,on=zn(gt),Xn=on.Provider,le=()=>Vn(on),F=(t,e)=>r("svg",{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":"2","stroke-linecap":"round","stroke-linejoin":"round","aria-hidden":"true",...e,children:t}),Qn=t=>r("svg",{viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",...t,children:r("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M5 3.25h14A3.75 3.75 0 0 1 22.75 7v6A3.75 3.75 0 0 1 19 16.75h-7.19l-4.26 3.84A.75.75 0 0 1 6.25 20v-3.32A3.75 3.75 0 0 1 2.25 13V7A3.75 3.75 0 0 1 6 3.25Zm3 7.75a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Zm4 0a1.25 1.25 0 1 0 0-2.5 1.25 1.25 0 0 0 0 2.5Z"})}),rn=t=>F(r("path",{d:"m6 9 6 6 6-6"}),t),eo=t=>F(r(R,{children:[r("path",{d:"m22 2-7 20-4-9-9-4Z"}),r("path",{d:"M22 2 11 13"})]}),t),to=t=>F(r(R,{children:[r("path",{d:"M12 2a3 3 0 0 0-3 3v7a3 3 0 0 0 6 0V5a3 3 0 0 0-3-3Z"}),r("path",{d:"M19 10v2a7 7 0 0 1-14 0v-2"}),r("line",{x1:"12",y1:"19",x2:"12",y2:"22"})]}),t),vt=t=>F(r(R,{children:[r("path",{d:"M15 3h6v6"}),r("path",{d:"M10 14 21 3"}),r("path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"})]}),t),no=t=>F(r(R,{children:[r("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2"}),r("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),r("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),r("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]}),t),an=t=>F(r(R,{children:[r("rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}),r("path",{d:"m22 7-10 5L2 7"})]}),t),oo=t=>F(r("path",{d:"M22 16.92v3a2 2 0 0 1-2.18 2 19.79 19.79 0 0 1-8.63-3.07 19.5 19.5 0 0 1-6-6 19.79 19.79 0 0 1-3.07-8.67A2 2 0 0 1 4.11 2h3a2 2 0 0 1 2 1.72c.13.96.36 1.9.7 2.81a2 2 0 0 1-.45 2.11L8.09 9.91a16 16 0 0 0 6 6l1.27-1.27a2 2 0 0 1 2.11-.45c.91.34 1.85.57 2.81.7A2 2 0 0 1 22 16.92Z"}),t),ro=t=>F(r(R,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M8.5 14.5a4 4 0 0 0 7 0"}),r("line",{x1:"9",y1:"9.5",x2:"9.01",y2:"9.5"}),r("line",{x1:"15",y1:"9.5",x2:"15.01",y2:"9.5"})]}),t),sn=t=>F(r(R,{children:[r("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),r("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]}),t),ao=t=>F(r(R,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("path",{d:"M15.5 8.5a5 5 0 0 1 0 7"}),r("path",{d:"M19 5a9 9 0 0 1 0 14"})]}),t),io=t=>F(r(R,{children:[r("path",{d:"M11 5 6 9H2v6h4l5 4z"}),r("line",{x1:"22",y1:"9",x2:"16",y2:"15"}),r("line",{x1:"16",y1:"9",x2:"22",y2:"15"})]}),t),Qe=t=>F(r("path",{d:"M20 6 9 17l-5-5"}),t),so=t=>F(r(R,{children:[r("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2"}),r("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]}),t),co=t=>F(r(R,{children:[r("path",{d:"M1 4v6h6"}),r("path",{d:"M3.51 15a9 9 0 1 0 2.13-9.36L1 10"})]}),t),lo=t=>F(r("rect",{x:"6",y:"6",width:"12",height:"12",rx:"2"}),t),xt=t=>F(r("path",{d:"M21.44 11.05 12.25 20.24a6 6 0 0 1-8.49-8.49l9.19-9.19a4 4 0 0 1 5.66 5.66l-9.2 9.19a2 2 0 0 1-2.83-2.83l8.49-8.48"}),t),fo=t=>F(r(R,{children:[r("path",{d:"M18.36 6.64a9 9 0 1 1-12.73 0"}),r("line",{x1:"12",y1:"2",x2:"12",y2:"12"})]}),t),uo=t=>F(r(R,{children:[r("circle",{cx:"12",cy:"12",r:"9"}),r("path",{d:"M12 7v5l3 2"})]}),t),cn=t=>F(r(R,{children:[r("path",{d:"M7 10v12"}),r("path",{d:"M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z"})]}),t),ln=t=>F(r(R,{children:[r("path",{d:"M17 14V2"}),r("path",{d:"M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z"})]}),t),ho=t=>F(r(R,{children:[r("line",{x1:"12",y1:"5",x2:"12",y2:"19"}),r("path",{d:"m19 12-7 7-7-7"})]}),t),dn=/(`[^`]+`)|(\*\*[^*]+\*\*)|(\[[^\]]+\]\(https?:\/\/[^\s)]+\))|(https?:\/\/[^\s)]+)/g,et=t=>{const e=[];let n=0,o=0,i;for(dn.lastIndex=0;(i=dn.exec(t))!==null;){i.index>n&&e.push(t.slice(n,i.index));const a=i[0];if(a.startsWith("`"))e.push(r("code",{class:"cf-md-code",children:a.slice(1,-1)},o++));else if(a.startsWith("**"))e.push(r("strong",{children:a.slice(2,-2)},o++));else if(a.startsWith("[")){const s=/^\[([^\]]+)\]\((https?:\/\/[^\s)]+)\)$/.exec(a),d=s?s[1]:a,f=s?s[2]:"#";e.push(r("a",{href:f,target:"_blank",rel:"noopener noreferrer nofollow",children:d},o++))}else e.push(r("a",{href:a,target:"_blank",rel:"noopener noreferrer nofollow",children:a},o++));n=i.index+a.length}return n<t.length&&e.push(t.slice(n)),e},po=/^(```|#{1,6}\s|\s*[-*]\s|\s*\d+\.\s)/,mo=t=>{const e=t.replace(/\r\n/g,`
6
+ `).split(`
7
+ `),n=[];let o=0,i=0;for(;i<e.length;){const a=e[i];if(a.trim().startsWith("```")){const f=[];for(i++;i<e.length&&!e[i].trim().startsWith("```");)f.push(e[i]),i++;i++,n.push(r("pre",{class:"cf-md-pre",children:r("code",{children:f.join(`
8
+ `)})},o++));continue}if(a.trim()===""){i++;continue}const s=/^(#{1,6})\s+(.*)$/.exec(a);if(s){n.push(r("div",{class:"cf-md-h",children:et(s[2])},o++)),i++;continue}if(/^\s*[-*]\s+/.test(a)){const f=[];for(;i<e.length&&/^\s*[-*]\s+/.test(e[i]);)f.push(r("li",{children:et(e[i].replace(/^\s*[-*]\s+/,""))},f.length)),i++;n.push(r("ul",{class:"cf-md-list",children:f},o++));continue}if(/^\s*\d+\.\s+/.test(a)){const f=[];for(;i<e.length&&/^\s*\d+\.\s+/.test(e[i]);)f.push(r("li",{children:et(e[i].replace(/^\s*\d+\.\s+/,""))},f.length)),i++;n.push(r("ol",{class:"cf-md-list",children:f},o++));continue}const d=[a];for(i++;i<e.length&&e[i].trim()!==""&&!po.test(e[i]);)d.push(e[i]),i++;n.push(r("p",{children:et(d.join(" "))},o++))}return n},fn=()=>{const t=J(null);return B(()=>{const e=requestAnimationFrame(()=>t.current?.scrollIntoView({block:"end"}));return()=>cancelAnimationFrame(e)},[]),t},_o=t=>t.trim().split(/\s+/).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("")||"๐Ÿค–",un=({persona:t,small:e})=>{const n=e?"cf-msg__avatar":"cf-header__avatar";return t?.agentAvatarUrl?r("span",{class:n,children:r("img",{src:t.agentAvatarUrl,alt:""})}):r("span",{class:n,children:t?_o(t.agentName):"ยท"})},bo=()=>{const t=le();return r("div",{class:"cf-msg__bubble cf-typing","aria-label":t.assistantTyping,children:[r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"}),r("span",{class:"cf-typing__dot"})]})},go=3,vo=({msg:t})=>{if(!t.sources||t.sources.length===0)return null;const e=new Set,n=[];for(const a of t.sources){const s=(a.url||a.title||"").toLowerCase();!s||e.has(s)||(e.add(s),n.push(a))}if(n.length===0)return null;const o=n.slice(0,go),i=n.length-o.length;return r("div",{class:"cf-sources",children:[o.map((a,s)=>a.url?r("a",{class:"cf-source",href:a.url,target:"_blank",rel:"noopener noreferrer nofollow",title:a.title||a.url,children:[r(vt,{}),r("span",{children:a.title||a.url})]},s):r("span",{class:"cf-source",title:a.title,children:[r(vt,{}),r("span",{children:a.title})]},s)),i>0&&r("span",{class:"cf-source cf-source--more",children:["+",i," more"]})]})},xo=({replies:t,onPick:e})=>t&&t.length>0?r("div",{class:"cf-chips",children:t.map((n,o)=>r("button",{type:"button",class:"cf-chip",onClick:()=>e(n),children:n},o))}):null,yo={public_book_demo:{type:"book-demo",label:"Book a demo",Icon:no},public_submit_inquiry:{type:"inquiry",label:"Leave a message",Icon:an},public_request_callback:{type:"request-callback",label:"Request a callback",Icon:oo},public_subscribe_newsletter:{type:"subscribe-newsletter",label:"Subscribe",Icon:an}},ko=({field:t,value:e,onInput:n})=>{const o=t.placeholder??t.label,i={class:"cf-form__input",placeholder:t.required?`${o} *`:o,value:e,"aria-label":t.label,onInput:a=>n(a.target.value)};return t.kind==="textarea"?r("textarea",{rows:2,...i}):r("input",{type:t.kind,...i})},wo=({spec:t,visitor:e,onSubmit:n,onCancel:o})=>{const i=le(),a=fn(),[s,d]=C(()=>{const y={};for(const b of t.fields)b.identity&&e[b.identity]&&(y[b.key]=e[b.identity]);return y}),[f,l]=C("idle"),[u,c]=C(""),x=y=>!!(y.identity&&e[y.identity]?.trim()),m=t.fields.filter(y=>!x(y)),g=m.every(y=>!y.required||(s[y.key]?.trim()??"")!==""),O=e.email||e.name||"",w=async()=>{if(!g||f==="submitting")return;l("submitting");const y={},b={};for(const I of t.fields){const H=s[I.key]?.trim();H&&(y[I.key]=H,I.identity&&(b[I.identity]=H))}try{const I=await n(y,b);c(I.note||i.formThanks),l("done")}catch{l("error")}};return f==="done"?r("div",{class:"cf-form cf-form--done",children:[r(Qe,{}),r("span",{children:u})]}):r("div",{class:"cf-form",ref:a,children:[r("div",{class:"cf-form__title",children:t.title}),m.length===0&&O&&r("div",{class:"cf-form__as",children:["as ",O]}),m.map(y=>r(ko,{field:y,value:s[y.key]??"",onInput:b=>d(I=>({...I,[y.key]:b}))},y.key)),f==="error"&&r("div",{class:"cf-form__err",children:i.formError}),r("div",{class:"cf-form__actions",children:[o&&r("button",{type:"button",class:"cf-form__cancel",onClick:o,children:"Cancel"}),r("button",{type:"button",class:"cf-form__submit",disabled:!g||f==="submitting",onClick:w,children:f==="submitting"?i.sending:t.submit})]})]})},hn=t=>String(t).padStart(2,"0"),Co=()=>{const t=[];for(let e=9;e<=17;e++)t.push(`${hn(e)}:00`),t.push(`${hn(e)}:30`);return t},So=t=>{const e=new Date;return e.setHours(0,0,0,0),Array.from({length:t},(n,o)=>{const i=new Date(e);return i.setDate(e.getDate()+o),i})},Ao=(t,e)=>{const[n,o]=e.split(":").map(Number),i=new Date(t.getFullYear(),t.getMonth(),t.getDate(),n??0,o??0);try{return new Intl.DateTimeFormat(void 0,{weekday:"short",day:"numeric",month:"short",year:"numeric",hour:"2-digit",minute:"2-digit",timeZoneName:"short"}).format(i)}catch{return`${t.toDateString()} ${e}`}},Me=(t,e)=>{const[n,o]=e.split(":").map(Number);return new Date(t.getFullYear(),t.getMonth(),t.getDate(),n??0,o??0)},Io=({visitor:t,onSubmit:e,onCancel:n,onDemoSlots:o,scheduler:i})=>{const a=le(),s=fn(),d=Ne(()=>So(14),[]),f=Ne(()=>Co(),[]),l=Ne(()=>{const A=Date.now();for(let h=0;h<d.length;h++)if(f.some(v=>Me(d[h],v).getTime()>A))return h;return 0},[d,f]),[u,c]=C(l),[x,m]=C(null),[g,O]=C(t.name??""),[w,y]=C(t.email??""),[b,I]=C("idle"),[H,G]=C(""),[X,V]=C(""),[K,$]=C(""),j=i?.connected&&i.mode==="link",oe=async()=>{if(b==="submitting"||!t.email?.trim()&&!w.trim())return;I("submitting"),V("");const A={};w.trim()&&(A.email=w.trim()),g.trim()&&(A.name=g.trim());try{const h=await e({...w.trim()?{visitorEmail:w.trim()}:{},...g.trim()?{visitorName:g.trim()}:{}},A),v=h.booking?.schedulingLink||i?.bookingLink||"";if(!v){I("error");return}try{window.open(v,"_blank","noopener,noreferrer")}catch{}$(v),G(h.note||a.bookingLinkOpened),I("done")}catch{I("error")}},[fe,ue]=C(new Set),[ge,he]=C([]),[re,L]=C(0),[pe,S]=C(!1);B(()=>{if(!o)return;let A=!0;const h=new Date,v=new Date;return v.setDate(v.getDate()+15),o(h.toISOString(),v.toISOString()).then(k=>{A&&(ue(new Set(k.taken.map(_=>Date.parse(_)).filter(_=>!Number.isNaN(_)))),he(k.busy.map(_=>[Date.parse(_.start),Date.parse(_.end)]).filter(([_,E])=>!Number.isNaN(_)&&!Number.isNaN(E))))}).catch(()=>{}),()=>{A=!1}},[o,re]);const N=!!t.email?.trim(),z=!!x&&(N||w.trim()!==""),Z=t.email||t.name||"",Y=A=>fe.has(Me(d[u],A).getTime()),me=A=>Me(d[u],A).getTime()<=Date.now(),ve=1800*1e3,Se=A=>{const h=Me(d[u],A).getTime(),v=h+ve;return ge.some(([k,_])=>h<_&&v>k)},_e=async()=>{if(!z||b==="submitting"||!x)return;I("submitting"),S(!1),V("");const A=Me(d[u],x),h=Ao(d[u],x),v={};w.trim()&&(v.email=w.trim()),g.trim()&&(v.name=g.trim());try{const k=await e({preferredAt:h,slotAt:A.toISOString(),...w.trim()?{visitorEmail:w.trim()}:{},...g.trim()?{visitorName:g.trim()}:{}},v);k.booking?.confirmed?(G(k.note||Xe(a.bookingConfirmed,{when:h})),$(k.booking.meetingUrl||k.booking.eventLink||"")):G(k.note||Xe(a.bookingRequested,{when:h})),I("done")}catch(k){if(k?.status===409)ue(_=>new Set(_).add(A.getTime())),m(null),S(!0),L(_=>_+1),I("idle");else{const _=k?.message;V(_&&_.length<120?_:""),I("error")}}};return b==="done"?r("div",{class:"cf-form cf-form--done",children:[r(Qe,{}),r("span",{children:H}),K&&r("a",{class:"cf-booking__link",href:K,target:"_blank",rel:"noopener noreferrer",children:[j?a.bookingOpenScheduler:a.bookingMeetingLink," ",r(vt,{})]})]}):j?r("div",{class:"cf-form cf-booking",ref:s,children:[r("div",{class:"cf-form__title",children:Ze["book-demo"].title}),r("div",{class:"cf-booking__hint",children:Xe(a.bookingViaProvider,{provider:i?.label??"the scheduler"})}),N?Z?r("div",{class:"cf-form__as",children:["as ",Z]}):null:r(R,{children:[r("input",{class:"cf-form__input",type:"text",placeholder:a.handoffName,value:g,"aria-label":a.handoffName,onInput:A=>O(A.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${a.handoffEmail} *`,value:w,"aria-label":a.handoffEmail,onInput:A=>y(A.target.value)})]}),b==="error"&&r("div",{class:"cf-form__err",children:X||a.formError}),r("div",{class:"cf-form__actions",children:[n&&r("button",{type:"button",class:"cf-form__cancel",onClick:n,children:a.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:b==="submitting"||!N&&w.trim()==="",onClick:oe,children:b==="submitting"?a.sending:a.bookingOpenScheduler})]})]}):r("div",{class:"cf-form cf-booking",ref:s,children:[r("div",{class:"cf-form__title",children:Ze["book-demo"].title}),r("div",{class:"cf-booking__hint",children:[a.bookingPickTime," ยท ",r("span",{class:"cf-booking__dur",children:a.bookingDuration})]}),r("div",{class:"cf-booking__dates",role:"tablist","aria-label":"Pick a day",children:d.map((A,h)=>r("button",{type:"button",role:"tab","aria-selected":h===u,class:`cf-booking__date ${h===u?"is-selected":""}`,onClick:()=>{c(h),m(null)},children:[r("span",{class:"cf-booking__dow",children:A.toLocaleDateString(void 0,{weekday:"short"})}),r("span",{class:"cf-booking__dom",children:A.getDate()})]},h))}),r("div",{class:"cf-booking__slots",role:"listbox","aria-label":"Pick a time",children:f.map(A=>{const h=me(A),v=Se(A),k=Y(A),_=k||h||v;return r("button",{type:"button",role:"option","aria-selected":x===A,disabled:_,title:h?"Earlier today":v?"Busy on the calendar":k?"Already booked":void 0,class:`cf-booking__slot ${x===A?"is-selected":""} ${_?"is-taken":""}`,onClick:()=>m(A),children:A},A)})}),pe&&r("div",{class:"cf-form__err",children:a.bookingSlotTaken}),N?Z?r("div",{class:"cf-form__as",children:["as ",Z]}):null:r(R,{children:[r("input",{class:"cf-form__input",type:"text",placeholder:a.handoffName,value:g,"aria-label":a.handoffName,onInput:A=>O(A.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${a.handoffEmail} *`,value:w,"aria-label":a.handoffEmail,onInput:A=>y(A.target.value)})]}),b==="error"&&r("div",{class:"cf-form__err",children:X||a.formError}),r("div",{class:"cf-form__actions",children:[n&&r("button",{type:"button",class:"cf-form__cancel",onClick:n,children:a.cancel}),r("button",{type:"button",class:"cf-form__submit",disabled:!z||b==="submitting",onClick:_e,children:b==="submitting"?a.sending:Ze["book-demo"].submit})]})]})},To=({actions:t,visitor:e,onSubmitForm:n,onDemoSlots:o,scheduler:i,exclude:a=[]})=>{const[s,d]=C(null),f=(t??[]).map(l=>yo[l]).filter(l=>!!l&&!a.includes(l.type));return f.length===0?null:s==="book-demo"?r(Io,{visitor:e,onCancel:()=>d(null),onSubmit:(l,u)=>n("book-demo",l,u),onDemoSlots:o,scheduler:i}):s?r(wo,{spec:Ze[s],visitor:e,onCancel:()=>d(null),onSubmit:(l,u)=>n(s,l,u)}):r("div",{class:"cf-actions",children:f.map(({type:l,label:u,Icon:c})=>r("button",{type:"button",class:"cf-action",onClick:()=>d(l),children:[r(c,{}),u]},l))})},Eo=({hasEmail:t,visitor:e,question:n,onSubmitForm:o})=>{const i=le(),[a,s]=C(!1),[d,f]=C(!1),[l,u]=C(e.name??""),[c,x]=C(e.email??"");if(t)return null;if(a){const g=e.email||c;return r("div",{class:"cf-handoff cf-handoff--done",children:[r(Qe,{}),r("span",{children:Xe(i.handoffShared,{email:g})})]})}const m=async()=>{if(!(!c.trim()||d)){f(!0);try{await o("inquiry",{visitorEmail:c.trim(),...l.trim()?{visitorName:l.trim()}:{},message:n||"I had a question the assistant couldnโ€™t answer.",subject:"Help request from chat"},{email:c.trim(),name:l.trim()||void 0}),s(!0)}catch{f(!1)}}};return r("div",{class:"cf-handoff",children:[r("div",{class:"cf-handoff__title",children:i.handoffTitle}),r("input",{class:"cf-form__input",type:"text",placeholder:i.handoffName,value:l,"aria-label":i.handoffName,onInput:g=>u(g.target.value)}),r("input",{class:"cf-form__input",type:"email",placeholder:`${i.handoffEmail} *`,value:c,"aria-label":i.handoffEmail,onInput:g=>x(g.target.value)}),r("button",{type:"button",class:"cf-form__submit",disabled:!c.trim()||d,onClick:m,children:d?i.sending:i.handoffNotify})]})},No=({text:t})=>{const e=le(),[n,o]=C(!1);return r("button",{type:"button",class:"cf-tool",onClick:async()=>{try{await navigator.clipboard.writeText(t),o(!0),setTimeout(()=>o(!1),1500)}catch{}},"aria-label":e.copy,children:[n?r(Qe,{}):r(so,{}),n?e.copied:e.copy]})},Mo=({items:t,onPick:e})=>t.length===0?null:r("div",{class:"cf-starters",children:t.map((n,o)=>r("button",{type:"button",class:"cf-starter",onClick:()=>e(n),children:n},o))}),Po=({msg:t,onRate:e})=>{const n=le(),[o,i]=C(!1),[a,s]=C(""),d=t.feedback,f=()=>{e(t.id,"up"),i(!1)},l=()=>{e(t.id,"down"),i(!0)},u=()=>{e(t.id,"down",a.trim()),i(!1)};return r("div",{class:"cf-feedback",children:[r("div",{class:"cf-feedback__row",children:[r("button",{type:"button",class:`cf-feedback__btn ${d==="up"?"is-active":""}`,"aria-label":n.feedbackHelpful,"aria-pressed":d==="up",onClick:f,children:r(cn,{})}),r("button",{type:"button",class:`cf-feedback__btn ${d==="down"?"is-active":""}`,"aria-label":n.feedbackNotHelpful,"aria-pressed":d==="down",onClick:l,children:r(ln,{})}),d&&!o&&r("span",{class:"cf-feedback__thanks",children:n.feedbackThanks})]}),o&&d==="down"&&r("div",{class:"cf-feedback__comment",children:[r("textarea",{class:"cf-feedback__input",rows:2,placeholder:n.feedbackCommentPlaceholder,value:a,onInput:c=>s(c.target.value)}),r("button",{type:"button",class:"cf-feedback__send",onClick:u,children:n.feedbackSend})]})]})},$o=({msg:t,persona:e,isLast:n,visitor:o,hasEmail:i,lastQuestion:a,showActions:s,onPickReply:d,onSubmitForm:f,onDemoSlots:l,onRetry:u,ratable:c,onRate:x})=>{const m=le(),g=t.role==="user",O=t.requestedContactFields?.includes("email")===!0,w=n&&!g&&!!(t.handoffOffered||O),y=w&&!i?["inquiry"]:[],b=!t.pending&&!t.streaming;return r("div",{class:`cf-msg cf-msg--${g?"user":"agent"}`,children:[!g&&r(un,{persona:e,small:!0}),r("div",{class:"cf-msg__col",children:[t.pending&&t.content===""?r(bo,{}):t.imageUrl?r("div",{class:"cf-msg__bubble cf-msg__bubble--media",children:[r("img",{class:"cf-msg__media",src:t.imageUrl,alt:"GIF"}),t.content&&r("span",{class:"cf-msg__caption",children:t.content})]}):r("div",{class:"cf-msg__bubble",children:[g?t.content:mo(t.content),t.streaming&&r("span",{class:"cf-caret","aria-hidden":"true"})]}),g&&t.attachmentName&&r("div",{class:"cf-attach-chip",title:t.attachmentName,children:[r(xt,{}),r("span",{children:t.attachmentName})]}),!g&&r(R,{children:[b&&(t.error||t.content)&&r("div",{class:"cf-msg__tools",children:t.error?r("button",{type:"button",class:"cf-tool",onClick:()=>u(t.id,t.retryText??""),children:[r(co,{}),m.retry]}):r(No,{text:t.content})}),b&&c&&!t.error&&t.content&&r(Po,{msg:t,onRate:x}),r(vo,{msg:t}),n&&r(xo,{replies:t.suggestedReplies,onPick:d}),w&&r(Eo,{hasEmail:i,visitor:o,question:a,onSubmitForm:f}),s&&r(To,{actions:t.availableActions,visitor:o,onSubmitForm:f,onDemoSlots:l,scheduler:e?.scheduler,exclude:y})]})]})]})},pn=t=>new Promise((e,n)=>{const o=new FileReader;o.onload=()=>e(String(o.result).split(",")[1]??""),o.onerror=n,o.readAsDataURL(t)}),Do=({onPick:t})=>r("div",{class:"cf-picker cf-emoji",children:Yn.map(e=>r("div",{class:"cf-emoji__group",children:[r("div",{class:"cf-emoji__label",children:e.name}),r("div",{class:"cf-emoji__grid",children:e.emojis.map((n,o)=>r("button",{type:"button",class:"cf-emoji__btn",onClick:()=>t(n),"aria-label":n,children:n},o))})]},e.name))}),Oo=({onSearch:t,onPick:e})=>{const n=le(),[o,i]=C(""),[a,s]=C([]),[d,f]=C(!0);return B(()=>{let l=!0;f(!0);const u=setTimeout(()=>{t(o).then(c=>l&&(s(c),f(!1))).catch(()=>l&&(s([]),f(!1)))},300);return()=>{l=!1,clearTimeout(u)}},[o,t]),r("div",{class:"cf-picker cf-gif",children:[r("input",{class:"cf-gif__search",placeholder:n.searchGifs,value:o,"aria-label":n.searchGifs,onInput:l=>i(l.target.value)}),r("div",{class:"cf-gif__grid",children:d?r("div",{class:"cf-gif__hint",children:n.searchingGifs}):a.length===0?r("div",{class:"cf-gif__hint",children:n.noGifs}):a.map(l=>r("button",{type:"button",class:"cf-gif__item",onClick:()=>e(l.url),"aria-label":l.alt,children:r("img",{src:l.preview,alt:l.alt,loading:"lazy"})},l.id))}),r("div",{class:"cf-gif__powered",children:"via Tenor"})]})},zo=8*1024*1024,Ro="image/png,image/jpeg,image/webp,image/gif,application/pdf",Ho=({onSend:t,onSendGif:e,disabled:n,allowVoice:o,onTranscribe:i,gifEnabled:a,onSearchGifs:s,allowAttach:d,onExtract:f})=>{const l=le(),[u,c]=C(""),[x,m]=C(!1),[g,O]=C("none"),[w,y]=C(null),[b,I]=C(!1),[H,G]=C(""),X=J(null),V=J(null),K=J(null),$=J(null),j=J([]);B(()=>{const S=X.current;S&&(S.style.height="auto",S.style.height=`${Math.min(S.scrollHeight,110)}px`)},[u]),B(()=>{if(g==="none")return;const S=N=>{V.current&&!N.composedPath().includes(V.current)&&O("none")};return document.addEventListener("mousedown",S),()=>document.removeEventListener("mousedown",S)},[g]);const oe=S=>O(N=>N===S?"none":S),fe=S=>{const N=X.current;if(!N){c(Y=>Y+S);return}const z=N.selectionStart??u.length,Z=N.selectionEnd??u.length;c(u.slice(0,z)+S+u.slice(Z)),requestAnimationFrame(()=>{N.focus();const Y=z+S.length;N.setSelectionRange(Y,Y)})},ue=S=>{O("none"),e(S)},ge=async S=>{const N=S.target,z=N.files?.[0];if(N.value="",!!z){if(G(""),z.size>zo){G(l.attachTooLarge);return}I(!0);try{const Z=await pn(z),Y=await f(Z,z.type||"application/octet-stream",z.name);if(!Y){G(l.attachFailed);return}y({name:z.name,text:Y})}catch{G(l.attachFailed)}finally{I(!1)}}},he=(!!u.trim()||!!w)&&!n&&!b,re=()=>{he&&(t(u,w?{attachmentName:w.name,attachmentText:w.text}:void 0),c(""),y(null),G(""))},L=S=>{S.key==="Enter"&&!S.shiftKey?(S.preventDefault(),re()):S.key==="Escape"&&g!=="none"&&(S.preventDefault(),S.stopPropagation(),O("none"))},pe=async()=>{if(x){$.current?.stop();return}try{const S=await navigator.mediaDevices.getUserMedia({audio:!0}),N=new MediaRecorder(S);j.current=[],N.ondataavailable=z=>z.data.size>0&&j.current.push(z.data),N.onstop=async()=>{S.getTracks().forEach(Z=>Z.stop()),m(!1);const z=new Blob(j.current,{type:N.mimeType||"audio/webm"});try{const Z=await pn(z),Y=await i(Z,z.type);Y&&c(me=>me?`${me} ${Y}`:Y)}catch{}},$.current=N,N.start(),m(!0)}catch{const S=await i("","audio/webm").catch(()=>"");S&&c(N=>N?`${N} ${S}`:S)}};return r("div",{class:"cf-composer",ref:V,children:[g==="emoji"&&r(Do,{onPick:fe}),g==="gif"&&r(Oo,{onSearch:s,onPick:ue}),(w||b||H)&&r("div",{class:"cf-attach-row",children:b?r("span",{class:"cf-attach-status",children:l.attaching}):H?r("span",{class:"cf-attach-status cf-attach-status--err",children:H}):w&&r("span",{class:"cf-attach-chip",title:w.name,children:[r(xt,{}),r("span",{children:w.name}),r("button",{type:"button",class:"cf-attach-x","aria-label":"Remove attachment",onClick:()=>y(null),children:r(sn,{})})]})}),r("div",{class:"cf-composer__field",children:[r("button",{type:"button",class:`cf-iconbtn ${g==="emoji"?"is-active":""}`,"aria-label":l.emoji,"aria-pressed":g==="emoji",onClick:()=>oe("emoji"),children:g==="emoji"?r(sn,{}):r(ro,{})}),a&&r("button",{type:"button",class:`cf-iconbtn cf-gifbtn ${g==="gif"?"is-active":""}`,"aria-label":l.gifs,"aria-pressed":g==="gif",onClick:()=>oe("gif"),children:r("span",{class:"cf-gif-label",children:"GIF"})}),d&&r(R,{children:[r("input",{ref:K,type:"file",class:"cf-file-input",accept:Ro,onChange:ge,tabIndex:-1,"aria-hidden":"true"}),r("button",{type:"button",class:"cf-iconbtn","aria-label":l.attachFile,disabled:b,onClick:()=>K.current?.click(),children:r(xt,{})})]}),r("textarea",{ref:X,class:"cf-textarea",rows:1,placeholder:l.composerPlaceholder,value:u,"aria-label":l.composerPlaceholder,disabled:n,onInput:S=>c(S.target.value),onKeyDown:L}),o&&r("button",{type:"button",class:`cf-iconbtn cf-mic ${x?"is-recording":""}`,"aria-label":x?l.stopRecording:l.recordVoice,"aria-pressed":x,onClick:pe,children:r(to,{})}),r("button",{type:"button",class:"cf-send","aria-label":l.send,disabled:!he,onClick:re,children:r(eo,{})})]})]})};let mn=!0,Pe=null;const Uo=t=>{mn=t},jo=()=>{const t=typeof window<"u"?window.AudioContext??window.webkitAudioContext:void 0;if(!t)return null;if(!Pe)try{Pe=new t}catch{return null}return Pe.state==="suspended"&&Pe.resume(),Pe},$e=(t,e,n,o,i,a)=>{const s=t.createOscillator(),d=t.createGain();s.type=i,s.frequency.setValueAtTime(e,n),s.connect(d),d.connect(t.destination),d.gain.setValueAtTime(1e-4,n),d.gain.exponentialRampToValueAtTime(a,n+.012),d.gain.exponentialRampToValueAtTime(1e-4,n+o),s.start(n),s.stop(n+o+.03)},De=t=>{if(!mn)return;const e=jo();if(!e)return;const n=e.currentTime;try{t==="open"?($e(e,523,n,.12,"sine",.05),$e(e,784,n+.08,.16,"sine",.05)):t==="send"?$e(e,660,n,.08,"triangle",.04):t==="receive"&&($e(e,880,n,.1,"sine",.045),$e(e,1175,n+.09,.14,"sine",.045))}catch{}},ne=()=>typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.round(Math.random()*1e9)}`,Lo=t=>{try{return t==="none"?null:t==="session"?sessionStorage:localStorage}catch{return null}},tt=t=>`centrinfo:session:${t.slice(0,12)}`,yt=t=>`centrinfo:visitor:${t.slice(0,12)}`,_n=(t,e)=>`centrinfo:chat:${t.slice(0,12)}:${e}`,kt=t=>`centrinfo:history:${t.slice(0,12)}`,bn=20,gn=720*60*60*1e3,Bo=1440*60*1e3,qo=(t,e)=>{try{return JSON.parse(t?.getItem(yt(e))||"{}")}catch{return{}}},Fo=(t,e)=>{if(!t)return ne();try{const n=tt(e),o=t.getItem(n);if(o)return o;const i=ne();return t.setItem(n,i),i}catch{return ne()}},vn=(t,e,n)=>{if(!t)return{};try{const o=t.getItem(_n(e,n));return o?JSON.parse(o):{}}catch{return{}}},xn=(t,e,n)=>{const{ts:o,messages:i}=vn(t,e,n);return!Array.isArray(i)||typeof o=="number"&&Date.now()-o>gn?[]:i},Wo=(t,e,n)=>{const{ts:o,messages:i,ended:a}=vn(t,e,n);return!Array.isArray(i)||i.length===0||typeof o=="number"&&Date.now()-o>gn?!1:a===!0||typeof o=="number"&&Date.now()-o>Bo},Go=(t,e,n,o,i)=>{if(t)try{const a=o.filter(s=>!s.pending).slice(-50);if(a.length===0)return;t.setItem(_n(e,n),JSON.stringify({ts:Date.now(),messages:a,ended:i}))}catch{}},Vo=(t,e)=>{if(!t)return[];try{const n=t.getItem(kt(e)),o=n?JSON.parse(n):[];return Array.isArray(o)?o:[]}catch{return[]}},Ko=(t,e,n)=>{if(t)try{t.setItem(kt(e),JSON.stringify(n.slice(0,bn)))}catch{}},Jo=(t,e)=>{if(t)try{const n=`centrinfo:chat:${e.slice(0,12)}:`,o=new Set([tt(e),yt(e),kt(e)]),i=[];for(let a=0;a<t.length;a++){const s=t.key(a);s&&(o.has(s)||s.startsWith(n))&&i.push(s)}i.forEach(a=>t.removeItem(a))}catch{}},Yo=t=>{const o=(t.find(i=>i.role==="user"&&i.content.trim())?.content||t.find(i=>i.content.trim())?.content||"").trim().replace(/\s+/g," ");return o.length>60?o.slice(0,60)+"โ€ฆ":o||"Conversation"},Zo=(t,e)=>{const n=J(Lo(e.persistence)).current,o=J(Fo(n,e.token)),i=J(null),[a,s]=C(null),[d,f]=C(()=>xn(n,e.token,o.current)),[l,u]=C(!1),[c,x]=C(()=>Wo(n,e.token,o.current)),[m,g]=C(()=>qo(n,e.token)),[O,w]=C(()=>Vo(n,e.token)),[y,b]=C(null),[I,H]=C([]),G=J(m);B(()=>{G.current=m},[m]);const X=M(()=>{i.current?.abort(),Jo(n,e.token);const h=ne();o.current=h;try{n?.setItem(tt(e.token),h)}catch{}b(null),H([]),x(!1),w([]),g({}),f(a?[{id:ne(),role:"assistant",content:a.greeting,availableActions:a.availableActions}]:[])},[n,e.token,a]),V=M(h=>{try{n?.setItem(yt(e.token),JSON.stringify(h))}catch{}},[n,e.token]),K=M(h=>{const v=(h.email??"").trim().toLowerCase(),k=(G.current.email??"").trim().toLowerCase();v&&k&&v!==k&&X();const _={};h.email?.trim()&&(_.email=h.email.trim()),h.phone?.trim()&&(_.phone=h.phone.trim());const D=[h.firstName,h.lastName].filter(q=>!!q?.trim()).join(" ").trim()||h.name?.trim()||"";D&&(_.name=D),Object.keys(_).length>0&&g(q=>{const xe={..._,...q};return V(xe),xe}),t.identify(o.current,h).catch(()=>{})},[t,V,X]);B(()=>{let h=!0;return t.bootstrap().then(v=>{h&&(s(v),f(k=>k.length>0?k:[{id:ne(),role:"assistant",content:v.greeting,availableActions:v.availableActions}]))}),e.user&&K(e.user),()=>{h=!1}},[]),B(()=>{Go(n,e.token,o.current,d,c)},[d,c,n,e.token]),B(()=>{d.some(v=>v.role==="user")&&w(v=>{const k=o.current,E=[{sessionId:k,ts:Date.now(),title:Yo(d),ended:c},...v.filter(D=>D.sessionId!==k)];return Ko(n,e.token,E),E.slice(0,bn)})},[d,c,n,e.token]);const $=M((h,v)=>{f(k=>k.map(_=>_.id===h?{..._,...v}:_))},[]),j=M((h,v)=>{u(!0);const k=new AbortController;i.current=k,t.stream(h,o.current,{signal:k.signal,onChunk:_=>f(E=>E.map(D=>D.id===v?{...D,content:D.content+_,pending:!1,streaming:!0}:D))}).then(_=>{f(E=>E.map(D=>D.id===v?{...D,content:_.answer||D.content||e.strings.emptyReply,pending:!1,streaming:!1,error:!1,retryText:void 0,sources:_.sources,suggestedReplies:_.suggestedReplies,availableActions:_.availableActions,handoffOffered:_.handoffOffered,requestedContactFields:_.requestedContactFields}:D)),De("receive"),e.onMessage?.({role:"assistant",content:_.answer}),_.handoffOffered&&e.onHandoff?.(),_.conversationEnded&&x(!0)}).catch(_=>{if(k.signal.aborted){$(v,{pending:!1,streaming:!1});return}const E=_?.status===429?e.strings.errorRateLimit:e.strings.errorGeneric;$(v,{content:E,pending:!1,streaming:!1,error:!0,retryText:h})}).finally(()=>{u(!1),i.current=null})},[t,e,$]),oe=M((h,v={})=>{const k=h.trim(),{imageUrl:_,attachmentName:E,attachmentText:D}=v;if(!k&&!_&&!D||l||c)return;let q=k;if(D){const Oe=E?` "${E}"`:"";q=`${k}
9
+
10
+ [Attached file${Oe}]:
11
+ ${D}`.trim()}else!q&&_&&(q=_);const xe={id:ne(),role:"user",content:k,imageUrl:_,attachmentName:E},ye=ne();f(Oe=>[...Oe,xe,{id:ye,role:"assistant",content:"",pending:!0}]),De("send"),e.onMessage?.({role:"user",content:q}),j(q,ye)},[l,c,e,j]),fe=M(()=>i.current?.abort(),[]),ue=M((h,v)=>{l||c||!v||($(h,{content:"",pending:!0,streaming:!1,error:!1}),De("send"),j(v,h))},[l,c,$,j]),ge=M((h,v,k)=>{$(h,{feedback:v});const _=d.findIndex(q=>q.id===h),E=_>=0?d[_]?.content:void 0;let D;for(let q=_-1;q>=0;q--)if(d[q]?.role==="user"){D=d[q]?.content;break}t.sendFeedback({sessionId:o.current,messageId:h,rating:v,comment:k,question:D,answer:E}).catch(()=>{})},[t,$,d]),he=M(async(h,v,k={})=>{e.onAction?.(h);const _=await t.action(h,{sessionId:o.current,...v}),E={};return k.name?.trim()&&(E.name=k.name.trim()),k.email?.trim()&&(E.email=k.email.trim()),k.phone?.trim()&&(E.phone=k.phone.trim()),Object.keys(E).length>0&&(g(D=>{const q={...D,...E};return V(q),q}),E.email&&h!=="contact"&&t.action("contact",{sessionId:o.current,...E}).catch(()=>{})),De("receive"),_},[t,e,V]),re=M(h=>{const v=h.trim();v&&f(k=>k.some(_=>_.role==="assistant"&&_.content===v)?k:[...k,{id:ne(),role:"assistant",content:v}])},[]),L=M((h,v)=>{t.sendFeedback({sessionId:o.current,messageId:"__csat__",rating:h,comment:v}).catch(()=>{})},[t]),pe=M((h,v)=>t.transcribe(h,v),[t]),S=M((h,v,k)=>t.extract(h,v,k),[t]),N=M(h=>t.searchGifs(h),[t]),z=M((h,v)=>t.demoSlots(h,v),[t]),Z=M(h=>oe("",{imageUrl:h}),[oe]),Y=e.demo||!!e.gifApiKey,me=M(()=>{i.current?.abort(),x(!0),t.endConversation(o.current).catch(()=>{})},[t]),ve=M(()=>{i.current?.abort();const h=ne();o.current=h;try{n?.setItem(tt(e.token),h)}catch{}b(null),H([]),x(!1),f(a?[{id:ne(),role:"assistant",content:a.greeting,availableActions:a.availableActions}]:[])},[n,e.token,a]),Se=M(h=>{if(h===o.current){b(null);return}H(xn(n,e.token,h)),b(h)},[n,e.token]),_e=M(()=>{b(null),H([])},[]),A=e.starters.length>0?e.starters:a?.starterQuestions??[];return{persona:a,messages:d,sending:l,visitor:m,starters:A,hasEmail:!!m.email,send:oe,sendGif:Z,stop:fe,retry:ue,rateMessage:ge,injectAssistant:re,submitCsat:L,submitForm:he,transcribe:pe,extract:S,searchGifs:N,demoSlots:z,gifEnabled:Y,identify:K,ended:c,endConversation:me,startNew:ve,history:O,viewingSessionId:y,viewMessages:I,openConversation:Se,closeHistoryView:_e,shutdown:X}},Xo=t=>{const[e,n]=C("light");return B(()=>{if(t!=="auto"||typeof matchMedia>"u")return;const o=matchMedia("(prefers-color-scheme: dark)"),i=()=>n(o.matches?"dark":"light");return i(),o.addEventListener("change",i),()=>o.removeEventListener("change",i)},[t]),t==="auto"?e:t},Qo=({transport:t,config:e,bindControls:n})=>{const o=e.strings,{persona:i,messages:a,sending:s,visitor:d,hasEmail:f,starters:l,send:u,sendGif:c,stop:x,retry:m,rateMessage:g,injectAssistant:O,submitCsat:w,submitForm:y,transcribe:b,extract:I,searchGifs:H,demoSlots:G,gifEnabled:X,identify:V,ended:K,endConversation:$,startNew:j,history:oe,viewingSessionId:fe,viewMessages:ue,openConversation:ge,closeHistoryView:he,shutdown:re}=Zo(t,e),[L,pe]=C(e.openByDefault),[S,N]=C(0),[z,Z]=C(()=>{try{return localStorage.getItem("centrinfo:muted")==="1"}catch{return!1}}),Y=Xo(e.theme);B(()=>{Uo(e.sound&&!z)},[e.sound,z]);const me=M(()=>{Z(p=>{const P=!p;try{localStorage.setItem("centrinfo:muted",P?"1":"0")}catch{}return P})},[]),ve=J(null),Se=J(null),_e=J(null),A=J(0),[h,v]=C(!0),[k,_]=C(!1),[E,D]=C(!1),q=J(null),[xe,ye]=C(!1),[Oe,Cn]=C(!1),ie=!!fe,ot=ie?ue:a,ze=M(()=>{pe(!0),N(0),De("open"),e.onOpen?.(),e.onShow?.()},[e]),ke=M(()=>{pe(!1),e.onClose?.(),e.onHide?.(),Se.current?.focus()},[e]),Re=M(()=>L?ke():ze(),[L,ze,ke]),cr=M(()=>D(!0),[]),lr=M(()=>{$(),D(!1)},[$]),dr=M(()=>{j(),_(!1),v(!0)},[j]);B(()=>{E&&q.current?.focus()},[E]),B(()=>{n({open:ze,close:ke,toggle:Re,identify:V,startNew:j,endConversation:$,shutdown:re})},[n,ze,ke,Re,V,j,$,re]),B(()=>{const p=a.filter(P=>P.role==="assistant"&&!P.pending).length;if(L){A.current=p;return}p>A.current&&N(p-A.current)},[a,L]),B(()=>{e.onUnreadChange?.(S)},[S,e]),B(()=>{const p=e.sessionDurationMinutes;if(!p||p<=0)return;const P=setTimeout(()=>re(),p*60*1e3);return()=>clearTimeout(P)},[e.sessionDurationMinutes,a,L,re]),B(()=>{const p=e.customLauncherSelector;if(!p||typeof document>"u")return;let P=[];try{P=Array.from(document.querySelectorAll(p))}catch{return}const Q=se=>{se.preventDefault(),Re()};return P.forEach(se=>se.addEventListener("click",Q)),()=>P.forEach(se=>se.removeEventListener("click",Q))},[e.customLauncherSelector,Re]);const Sn=J(!1);B(()=>{const p=e.proactiveMessage?.trim();if(!p||Sn.current)return;const P=e.proactiveOnPaths??[],Q=typeof location<"u"?location.pathname:"";if(P.length>0&&!P.some(Ie=>Q.includes(Ie)))return;const se=`centrinfo:proactive:${e.token.slice(0,12)}`;try{if(sessionStorage.getItem(se)==="1")return}catch{}const Ae=setTimeout(()=>{if(!(L||K||a.some(Ie=>Ie.role==="user"))){Sn.current=!0;try{sessionStorage.setItem(se,"1")}catch{}O(p),ze()}},Math.max(0,e.proactiveDelaySeconds)*1e3);return()=>clearTimeout(Ae)},[e.proactiveMessage]),B(()=>{const p=_e.current;if(!L||!p)return;a[a.length-1]?.role==="user"||h?(p.scrollTop=p.scrollHeight,_(!1)):_(!0)},[a,L,s,h]);const fr=M(()=>{const p=_e.current;if(!p)return;const P=p.scrollHeight-p.scrollTop-p.clientHeight<80;v(P),P&&_(!1)},[]),ur=M(()=>{const p=_e.current;p&&(p.scrollTop=p.scrollHeight),_(!1),v(!0)},[]),[hr,pr]=C(""),An=J(!1);B(()=>{if(An.current&&!s){const p=[...a].reverse().find(P=>P.role==="assistant"&&!P.streaming&&!P.pending&&P.content);p&&pr(p.content)}An.current=s},[s,a]),B(()=>{if(!L)return;const p=ve.current;E||p?.querySelector(".cf-textarea")?.focus();const P=Q=>{if(Q.key==="Escape"){if(Q.preventDefault(),E){D(!1);return}ke();return}if(Q.key!=="Tab"||!p)return;const se=p.querySelectorAll('button, [href], textarea, input, [tabindex]:not([tabindex="-1"])'),Ae=Array.from(se).filter(vr=>!vr.hasAttribute("disabled"));if(Ae.length===0)return;const Ie=Ae[0],In=Ae[Ae.length-1],Tn=p.getRootNode()instanceof ShadowRoot?p.getRootNode().activeElement:document.activeElement;Q.shiftKey&&Tn===Ie?(Q.preventDefault(),In.focus()):!Q.shiftKey&&Tn===In&&(Q.preventDefault(),Ie.focus())};return p?.addEventListener("keydown",P),()=>p?.removeEventListener("keydown",P)},[L,ke,E]),B(()=>{const p=ve.current;p&&(L?p.removeAttribute("inert"):p.setAttribute("inert",""))},[L]);const St=e.accentColor??i?.accentColor,mr={zIndex:e.zIndex,"--cf-h-pad":`${e.horizontalPadding}px`,"--cf-v-pad":`${e.verticalPadding}px`,...St?{"--cf-accent":St,"--cf-accent-2":`color-mix(in oklab, ${St} 76%, #14141f)`}:{}},_r=p=>u(p),br=[...a].reverse().find(p=>p.role==="user"&&p.content.trim())?.content??"",He=a.some(p=>p.role==="user"),gr=!He&&!!(i?.agentDescription||i?.welcomeSubtitle);return r(Xn,{value:o,children:r("div",{class:"cf-root","data-theme":Y,"data-align":e.alignment,style:mr,children:[r("div",{ref:ve,class:`cf-panel ${L?"is-open":""}`,role:"dialog","aria-modal":"false","aria-label":`Chat with ${i?.agentName??"us"}`,"aria-hidden":!L,children:[r("div",{class:"cf-header",children:[r(un,{persona:i}),r("div",{class:"cf-header__meta",children:[r("div",{class:"cf-header__name",children:i?.agentName??"Chat"}),r("div",{class:`cf-header__status ${i?.offline?"cf-header__status--offline":""}`,children:r("span",{class:"cf-header__status-text",children:i?.offline?o.statusOffline:o.statusOnline})})]}),r("div",{class:"cf-header__actions",children:[oe.length>0&&r("button",{type:"button",class:"cf-header__btn","aria-label":o.pastConversations,title:o.pastConversations,"aria-pressed":xe,onClick:()=>ye(p=>!p),children:r(uo,{})}),He&&!K&&!ie&&r("button",{type:"button",class:"cf-header__btn","aria-label":o.endChat,title:o.endChat,onClick:cr,children:r(fo,{})}),e.sound&&r("button",{type:"button",class:"cf-header__btn","aria-label":z?o.unmuteSounds:o.muteSounds,"aria-pressed":z,onClick:me,children:z?r(io,{}):r(ao,{})}),r("button",{type:"button",class:"cf-header__btn","aria-label":o.closeChat,onClick:ke,children:r(rn,{})})]})]}),e.preview&&r("div",{class:"cf-preview-banner",children:o.previewBanner}),ie&&r("div",{class:"cf-viewing-banner",children:o.viewingPast}),r("div",{class:"cf-body",ref:_e,role:"log",onScroll:fr,children:[gr&&!ie&&r("div",{class:"cf-welcome",children:[i?.agentDescription&&r("p",{class:"cf-welcome__desc",children:i.agentDescription}),i?.welcomeSubtitle&&r("p",{class:"cf-welcome__sub",children:i.welcomeSubtitle})]}),ot.map((p,P)=>r($o,{msg:p,persona:i,isLast:!ie&&P===ot.length-1,visitor:d,hasEmail:f,lastQuestion:br,showActions:!ie&&P===ot.length-1&&(!He||!!p.handoffOffered),onPickReply:_r,onSubmitForm:y,onDemoSlots:G,onRetry:m,ratable:!ie&&ot.slice(0,P).some(Q=>Q.role==="user"),onRate:g},p.id)),!He&&!ie&&r(Mo,{items:l,onPick:u}),k&&r("button",{type:"button",class:"cf-newmsg",onClick:ur,children:[r(ho,{}),o.newMessages]})]}),r("div",{class:"cf-sr-live","aria-live":"polite","aria-atomic":"true",children:hr}),s&&!K&&!ie&&r("div",{class:"cf-stopbar",children:r("button",{type:"button",class:"cf-stop",onClick:x,children:[r(lo,{}),o.stop]})}),ie?r("div",{class:"cf-ended",children:r("button",{type:"button",class:"cf-ended__btn",onClick:he,children:o.backToChat})}):K?r("div",{class:"cf-ended",children:[r("p",{class:"cf-ended__text",children:o.conversationEnded}),e.csat&&He?Oe?r("p",{class:"cf-ended__text",children:o.feedbackThanks}):r("div",{class:"cf-csat",children:[r("span",{class:"cf-csat__q",children:o.csatPrompt}),r("button",{type:"button",class:"cf-csat__btn","aria-label":o.feedbackHelpful,onClick:()=>{w("up"),Cn(!0)},children:r(cn,{})}),r("button",{type:"button",class:"cf-csat__btn","aria-label":o.feedbackNotHelpful,onClick:()=>{w("down"),Cn(!0)},children:r(ln,{})})]}):null,r("button",{type:"button",class:"cf-ended__btn",onClick:dr,children:o.startNewChat})]}):r(Ho,{onSend:u,onSendGif:c,disabled:s,allowVoice:!!i?.allowVoiceInput,onTranscribe:b,gifEnabled:X,onSearchGifs:H,allowAttach:e.attachments,onExtract:I}),!K&&i?.disclaimerText&&r("div",{class:"cf-disclaimer",children:i.disclaimerText}),r("div",{class:"cf-footer",children:[o.poweredBy," ",r("a",{href:"https://accurix.tech/centrinfo",target:"_blank",rel:"noopener noreferrer",children:"Centrinfo"})]}),E&&r("div",{class:"cf-confirm",onClick:()=>D(!1),children:r("div",{class:"cf-confirm__card",role:"alertdialog","aria-modal":"true","aria-label":o.endChatConfirm,onClick:p=>p.stopPropagation(),children:[r("div",{class:"cf-confirm__title",children:o.endChatConfirm}),r("div",{class:"cf-confirm__body",children:o.endChatConfirmBody}),r("div",{class:"cf-confirm__actions",children:[r("button",{ref:q,type:"button",class:"cf-confirm__btn cf-confirm__btn--cancel",onClick:()=>D(!1),children:o.cancel}),r("button",{type:"button",class:"cf-confirm__btn cf-confirm__btn--danger",onClick:lr,children:o.endConfirmCta})]})]})}),xe&&r("div",{class:"cf-confirm",onClick:()=>ye(!1),children:r("div",{class:"cf-history",role:"dialog","aria-modal":"true","aria-label":o.pastConversations,onClick:p=>p.stopPropagation(),children:[r("div",{class:"cf-history__head",children:[r("span",{children:o.pastConversations}),r("button",{type:"button",class:"cf-header__btn","aria-label":o.closeChat,onClick:()=>ye(!1),children:r(rn,{})})]}),r("div",{class:"cf-history__list",children:oe.map(p=>r("button",{type:"button",class:`cf-history__item ${p.sessionId===fe?"is-active":""}`,onClick:()=>{ge(p.sessionId),ye(!1)},children:[r("span",{class:"cf-history__title",children:p.title}),r("span",{class:"cf-history__meta",children:[new Date(p.ts).toLocaleDateString(void 0,{month:"short",day:"numeric"}),p.ended?` ยท ${o.historyEnded}`:""]})]},p.sessionId))})]})})]}),!e.hideDefaultLauncher&&r("button",{ref:Se,type:"button",class:"cf-launcher","aria-label":L?o.closeChat:o.openChat,"aria-expanded":L,onClick:Re,children:[e.launcherIcon?r("img",{class:"cf-launcher__img",src:e.launcherIcon,alt:""}):r(Qn,{}),!L&&S>0&&r("span",{class:"cf-launcher__badge",children:S})]})]})})},er="https://api.accurixtech.com",tr=t=>{if(!t||typeof t.token!="string"||t.token.length===0)throw new Error("[centrinfo-widget] `token` is required โ€” pass your pub_* token to Centrinfo.init({ token }).");return{token:t.token,apiBaseUrl:(t.apiBaseUrl??er).replace(/\/$/,""),accentColor:t.accentColor,launcherIcon:t.launcherIcon,gifApiKey:t.gifApiKey,theme:t.theme??"auto",openByDefault:t.openByDefault??!1,sound:t.sound??!0,starters:t.starters??[],strings:Zn(t.labels),persistence:t.persistence??"local",attachments:t.attachments??!0,zIndex:t.zIndex??2147483e3,demo:t.demo??!1,preview:t.preview??!1,alignment:t.alignment==="left"?"left":"right",horizontalPadding:typeof t.horizontalPadding=="number"?t.horizontalPadding:20,verticalPadding:typeof t.verticalPadding=="number"?t.verticalPadding:20,hideDefaultLauncher:t.hideDefaultLauncher??!1,customLauncherSelector:t.customLauncherSelector,sessionDurationMinutes:typeof t.sessionDurationMinutes=="number"?t.sessionDurationMinutes:0,proactiveMessage:t.proactiveMessage,proactiveDelaySeconds:typeof t.proactiveDelaySeconds=="number"?t.proactiveDelaySeconds:5,proactiveOnPaths:t.proactiveOnPaths,csat:t.csat??!0,user:t.user,onOpen:t.onOpen,onClose:t.onClose,onShow:t.onShow,onHide:t.onHide,onUnreadChange:t.onUnreadChange,onMessage:t.onMessage,onAction:t.onAction,onHandoff:t.onHandoff}},yn=`
12
+ :host {
13
+ all: initial;
14
+ }
15
+ .cf-root {
16
+ --cf-accent: #2f7f55;
17
+ --cf-accent-2: #2f7de8;
18
+ --cf-accent-ink: #ffffff;
19
+ --cf-bg: #ffffff;
20
+ --cf-surface: #f4f6f8;
21
+ --cf-surface-2: #eef1f4;
22
+ --cf-text: #0f1e2a;
23
+ --cf-muted: #5b7186;
24
+ --cf-border: #e4e9ee;
25
+ --cf-shadow: 0 12px 48px -12px rgba(15, 30, 42, 0.4), 0 4px 12px -4px rgba(15, 30, 42, 0.2);
26
+ --cf-radius: 18px;
27
+ --cf-font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
28
+
29
+ position: fixed;
30
+ bottom: 0;
31
+ right: 0;
32
+ font-family: var(--cf-font);
33
+ font-size: 15px;
34
+ line-height: 1.5;
35
+ color: var(--cf-text);
36
+ -webkit-font-smoothing: antialiased;
37
+ }
38
+ .cf-root[data-theme='dark'] {
39
+ --cf-accent-ink: #ffffff;
40
+ --cf-bg: #0f1c27;
41
+ --cf-surface: #1a2a37;
42
+ --cf-surface-2: #213442;
43
+ --cf-text: #eef3f7;
44
+ --cf-muted: #93a7b6;
45
+ --cf-border: #2a3d4c;
46
+ --cf-shadow: 0 12px 48px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
47
+ }
48
+ .cf-root *,
49
+ .cf-root *::before,
50
+ .cf-root *::after {
51
+ box-sizing: border-box;
52
+ }
53
+ /* :where() keeps this reset at ZERO added specificity, so component button
54
+ styles (.cf-launcher, .cf-send, .cf-chip, .cf-action) win over it. Without
55
+ it, ".cf-root button" (class+element) out-specifies ".cf-launcher" (class)
56
+ and silently wipes every button background โ€” the launcher rendered white. */
57
+ .cf-root :where(button) {
58
+ font-family: inherit;
59
+ cursor: pointer;
60
+ border: none;
61
+ background: none;
62
+ padding: 0;
63
+ color: inherit;
64
+ }
65
+
66
+ /* ---------- Launcher ---------- */
67
+ .cf-launcher {
68
+ position: fixed;
69
+ bottom: var(--cf-v-pad, 20px);
70
+ right: var(--cf-h-pad, 20px);
71
+ z-index: 1;
72
+ /* The host element is pointer-events: none so it can't swallow
73
+ clicks on host-page UI behind it (see mount.tsx). Re-enable here
74
+ on the only two visible surfaces (launcher + panel) so they DO
75
+ receive clicks where they're actually drawn. */
76
+ pointer-events: auto;
77
+ width: 60px;
78
+ height: 60px;
79
+ border-radius: 50%;
80
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 140%);
81
+ color: var(--cf-accent-ink);
82
+ display: grid;
83
+ place-items: center;
84
+ box-shadow: 0 8px 24px -6px rgba(15, 30, 42, 0.45);
85
+ transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease;
86
+ animation: cf-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
87
+ }
88
+ .cf-launcher:hover {
89
+ transform: scale(1.06);
90
+ box-shadow: 0 12px 28px -6px rgba(15, 30, 42, 0.5);
91
+ }
92
+ .cf-launcher:active {
93
+ transform: scale(0.95);
94
+ }
95
+ .cf-launcher:focus-visible {
96
+ outline: 3px solid var(--cf-accent-2);
97
+ outline-offset: 3px;
98
+ }
99
+ .cf-launcher svg {
100
+ width: 30px;
101
+ height: 30px;
102
+ transition: transform 0.25s ease, opacity 0.2s ease;
103
+ }
104
+ /* Custom org logo in the launcher (config.launcherIcon). */
105
+ .cf-launcher__img {
106
+ width: 34px;
107
+ height: 34px;
108
+ border-radius: 50%;
109
+ object-fit: cover;
110
+ }
111
+ .cf-launcher__badge {
112
+ position: absolute;
113
+ top: -2px;
114
+ right: -2px;
115
+ min-width: 20px;
116
+ height: 20px;
117
+ padding: 0 5px;
118
+ border-radius: 10px;
119
+ background: #f25767;
120
+ color: #fff;
121
+ font-size: 11px;
122
+ font-weight: 700;
123
+ display: grid;
124
+ place-items: center;
125
+ box-shadow: 0 0 0 2px var(--cf-bg);
126
+ animation: cf-badge-pop 0.3s ease both;
127
+ }
128
+
129
+ /* ---------- Panel ---------- */
130
+ .cf-panel {
131
+ position: fixed;
132
+ /* Pair to .cf-launcher's pointer-events: auto โ€” the host element
133
+ itself is pointer-events: none, so each visible surface re-enables. */
134
+ pointer-events: auto;
135
+ bottom: var(--cf-v-pad, 20px);
136
+ right: var(--cf-h-pad, 20px);
137
+ /* Above the launcher so the open chat covers it (no second button showing). */
138
+ z-index: 2;
139
+ width: 384px;
140
+ max-width: calc(100vw - 32px);
141
+ height: 640px;
142
+ max-height: calc(100vh - 40px);
143
+ background: var(--cf-bg);
144
+ border-radius: var(--cf-radius);
145
+ box-shadow: var(--cf-shadow);
146
+ display: flex;
147
+ flex-direction: column;
148
+ overflow: hidden;
149
+ transform-origin: bottom right;
150
+ opacity: 0;
151
+ transform: translateY(16px) scale(0.96);
152
+ pointer-events: none;
153
+ transition: opacity 0.24s ease, transform 0.28s cubic-bezier(0.22, 1, 0.36, 1);
154
+ }
155
+ .cf-panel.is-open {
156
+ opacity: 1;
157
+ transform: translateY(0) scale(1);
158
+ pointer-events: auto;
159
+ }
160
+
161
+ /* Left-aligned messenger (alignment: 'left') โ€” dock to the left edge. */
162
+ .cf-root[data-align='left'] .cf-launcher { right: auto; left: var(--cf-h-pad, 20px); }
163
+ .cf-root[data-align='left'] .cf-panel { right: auto; left: var(--cf-h-pad, 20px); transform-origin: bottom left; }
164
+
165
+ /* ---------- Header ---------- */
166
+ .cf-header {
167
+ position: relative;
168
+ padding: 16px 14px 18px 18px;
169
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 150%);
170
+ color: var(--cf-accent-ink);
171
+ display: flex;
172
+ align-items: center;
173
+ gap: 10px;
174
+ flex-shrink: 0;
175
+ }
176
+ .cf-header__avatar {
177
+ width: 42px;
178
+ height: 42px;
179
+ border-radius: 50%;
180
+ background: rgba(255, 255, 255, 0.18);
181
+ display: grid;
182
+ place-items: center;
183
+ font-weight: 700;
184
+ font-size: 17px;
185
+ overflow: hidden;
186
+ flex-shrink: 0;
187
+ box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.25);
188
+ }
189
+ .cf-header__avatar img {
190
+ width: 100%;
191
+ height: 100%;
192
+ object-fit: cover;
193
+ }
194
+ .cf-header__meta {
195
+ min-width: 0;
196
+ flex: 1 1 auto;
197
+ }
198
+ .cf-header__name {
199
+ font-weight: 700;
200
+ font-size: 16px;
201
+ letter-spacing: -0.2px;
202
+ white-space: nowrap;
203
+ overflow: hidden;
204
+ text-overflow: ellipsis;
205
+ }
206
+ .cf-header__status {
207
+ display: flex;
208
+ align-items: center;
209
+ gap: 6px;
210
+ font-size: 12.5px;
211
+ opacity: 0.9;
212
+ margin-top: 1px;
213
+ min-width: 0;
214
+ }
215
+ .cf-header__status::before {
216
+ content: '';
217
+ width: 7px;
218
+ height: 7px;
219
+ border-radius: 50%;
220
+ background: #7ee2a8;
221
+ box-shadow: 0 0 0 2px rgba(126, 226, 168, 0.3);
222
+ flex-shrink: 0;
223
+ }
224
+ /* Keep the status on one line โ€” the icons no longer squeeze it to wrap. */
225
+ .cf-header__status-text {
226
+ white-space: nowrap;
227
+ overflow: hidden;
228
+ text-overflow: ellipsis;
229
+ }
230
+ /* Action icons cluster tightly together, separated from the meta by the
231
+ header gap, and never shrink (so the meta yields space first). */
232
+ .cf-header__actions {
233
+ display: flex;
234
+ align-items: center;
235
+ gap: 2px;
236
+ flex-shrink: 0;
237
+ }
238
+ .cf-header__btn {
239
+ width: 30px;
240
+ height: 30px;
241
+ border-radius: 8px;
242
+ display: grid;
243
+ place-items: center;
244
+ color: var(--cf-accent-ink);
245
+ opacity: 0.85;
246
+ transition: background 0.15s ease, opacity 0.15s ease;
247
+ flex-shrink: 0;
248
+ }
249
+ .cf-header__btn:hover {
250
+ background: rgba(255, 255, 255, 0.16);
251
+ opacity: 1;
252
+ }
253
+ .cf-header__btn svg {
254
+ width: 17px;
255
+ height: 17px;
256
+ }
257
+ .cf-header__btn:focus-visible {
258
+ outline: 2px solid #fff;
259
+ outline-offset: 1px;
260
+ }
261
+
262
+ /* Preview-mode banner (data-preview) โ€” sample replies, no AI. */
263
+ .cf-preview-banner {
264
+ flex-shrink: 0;
265
+ padding: 5px 12px;
266
+ text-align: center;
267
+ font-size: 11.5px;
268
+ font-weight: 600;
269
+ letter-spacing: 0.2px;
270
+ color: #7a5b00;
271
+ background: #fff3cd;
272
+ border-bottom: 1px solid #ffe69c;
273
+ }
274
+ .cf-root[data-theme='dark'] .cf-preview-banner {
275
+ color: #ffe08a;
276
+ background: #3a3320;
277
+ border-bottom-color: #4d4427;
278
+ }
279
+
280
+ /* ---------- Body / messages ---------- */
281
+ .cf-body {
282
+ flex: 1;
283
+ overflow-y: auto;
284
+ /* Never scroll/shift horizontally โ€” a long source pill or code line is
285
+ clipped, not allowed to push the whole thread sideways. */
286
+ overflow-x: hidden;
287
+ padding: 18px 16px 8px;
288
+ display: flex;
289
+ flex-direction: column;
290
+ gap: 12px;
291
+ scroll-behavior: smooth;
292
+ background: var(--cf-bg);
293
+ }
294
+ .cf-body::-webkit-scrollbar {
295
+ width: 8px;
296
+ }
297
+ .cf-body::-webkit-scrollbar-thumb {
298
+ background: var(--cf-border);
299
+ border-radius: 4px;
300
+ }
301
+ .cf-msg {
302
+ display: flex;
303
+ gap: 8px;
304
+ max-width: 100%;
305
+ animation: cf-msg-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
306
+ }
307
+ .cf-msg--user {
308
+ justify-content: flex-end;
309
+ }
310
+ .cf-msg__avatar {
311
+ width: 26px;
312
+ height: 26px;
313
+ border-radius: 50%;
314
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55), var(--cf-accent-2, #2f7de8));
315
+ color: #fff;
316
+ display: grid;
317
+ place-items: center;
318
+ font-size: 11px;
319
+ font-weight: 700;
320
+ flex-shrink: 0;
321
+ overflow: hidden;
322
+ align-self: flex-end;
323
+ }
324
+ .cf-msg__avatar img { width: 100%; height: 100%; object-fit: cover; }
325
+ .cf-msg__bubble {
326
+ padding: 10px 13px;
327
+ border-radius: 16px;
328
+ max-width: 100%;
329
+ /* break-word (not anywhere) only breaks words too long to fit โ€” so short
330
+ words like "Hello" never split mid-word. */
331
+ overflow-wrap: break-word;
332
+ white-space: pre-wrap;
333
+ font-size: 14.5px;
334
+ }
335
+ .cf-msg--agent .cf-msg__bubble {
336
+ background: var(--cf-surface);
337
+ border-bottom-left-radius: 5px;
338
+ color: var(--cf-text);
339
+ }
340
+ .cf-msg--user .cf-msg__bubble {
341
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
342
+ color: var(--cf-accent-ink);
343
+ border-bottom-right-radius: 5px;
344
+ }
345
+ .cf-msg__bubble a {
346
+ color: inherit;
347
+ text-decoration: underline;
348
+ }
349
+ .cf-msg__bubble strong { font-weight: 700; }
350
+ .cf-msg__bubble p { margin: 0 0 8px; }
351
+ .cf-msg__bubble p:last-child { margin-bottom: 0; }
352
+ .cf-msg__col { min-width: 0; max-width: 85%; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
353
+ .cf-msg--user .cf-msg__col { align-items: flex-end; }
354
+
355
+ /* ---------- Markdown in answers ---------- */
356
+ .cf-msg__bubble .cf-md-h { font-weight: 700; font-size: 14.5px; margin: 4px 0 2px; }
357
+ .cf-msg__bubble ul.cf-md-list, .cf-msg__bubble ol.cf-md-list { margin: 4px 0; padding-left: 20px; }
358
+ .cf-msg__bubble .cf-md-list li { margin: 2px 0; }
359
+ .cf-md-code {
360
+ font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
361
+ font-size: 0.86em;
362
+ background: var(--cf-surface-2);
363
+ padding: 1px 5px;
364
+ border-radius: 5px;
365
+ }
366
+ .cf-msg--user .cf-md-code { background: rgba(255, 255, 255, 0.22); }
367
+ .cf-md-pre {
368
+ margin: 6px 0;
369
+ padding: 10px 12px;
370
+ background: var(--cf-surface-2);
371
+ border: 1px solid var(--cf-border);
372
+ border-radius: 10px;
373
+ overflow-x: auto;
374
+ }
375
+ .cf-md-pre code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; white-space: pre; color: var(--cf-text); }
376
+ .cf-msg--user .cf-md-pre { background: rgba(0, 0, 0, 0.18); border-color: rgba(255, 255, 255, 0.18); }
377
+ .cf-msg--user .cf-md-pre code { color: var(--cf-accent-ink); }
378
+
379
+ /* streaming caret */
380
+ .cf-caret {
381
+ display: inline-block;
382
+ width: 7px;
383
+ height: 1em;
384
+ margin-left: 2px;
385
+ vertical-align: text-bottom;
386
+ background: var(--cf-accent);
387
+ border-radius: 1px;
388
+ animation: cf-blink 1s step-end infinite;
389
+ }
390
+ @keyframes cf-blink {
391
+ 0%, 100% { opacity: 1; }
392
+ 50% { opacity: 0; }
393
+ }
394
+
395
+ /* message tools (copy / retry) */
396
+ .cf-msg__tools { display: flex; gap: 6px; }
397
+ .cf-tool {
398
+ display: inline-flex;
399
+ align-items: center;
400
+ gap: 5px;
401
+ font-size: 12px;
402
+ color: var(--cf-muted);
403
+ padding: 3px 7px;
404
+ border-radius: 7px;
405
+ opacity: 0.6;
406
+ transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
407
+ }
408
+ .cf-msg:hover .cf-tool { opacity: 1; }
409
+ .cf-tool:hover { background: var(--cf-surface); color: var(--cf-text); }
410
+ .cf-tool svg { width: 13px; height: 13px; }
411
+
412
+ /* Per-message ๐Ÿ‘/๐Ÿ‘Ž feedback. */
413
+ .cf-feedback { margin-top: 4px; }
414
+ .cf-feedback__row { display: flex; align-items: center; gap: 4px; }
415
+ .cf-feedback__btn {
416
+ display: inline-flex;
417
+ align-items: center;
418
+ justify-content: center;
419
+ width: 26px;
420
+ height: 26px;
421
+ border-radius: 7px;
422
+ color: var(--cf-muted);
423
+ opacity: 0.6;
424
+ cursor: pointer;
425
+ transition: opacity 0.15s ease, background 0.15s ease, color 0.15s ease;
426
+ }
427
+ .cf-msg:hover .cf-feedback__btn { opacity: 1; }
428
+ .cf-feedback__btn:hover { background: var(--cf-surface); color: var(--cf-text); }
429
+ .cf-feedback__btn.is-active { opacity: 1; color: var(--cf-accent); background: var(--cf-surface); }
430
+ .cf-feedback__btn svg { width: 14px; height: 14px; }
431
+ .cf-feedback__thanks { margin-left: 4px; font-size: 11.5px; color: var(--cf-muted); }
432
+ .cf-feedback__comment { display: flex; flex-direction: column; gap: 6px; margin-top: 6px; max-width: 260px; }
433
+ .cf-feedback__input {
434
+ width: 100%;
435
+ resize: none;
436
+ font: inherit;
437
+ font-size: 12.5px;
438
+ line-height: 1.4;
439
+ color: var(--cf-text);
440
+ background: var(--cf-bg);
441
+ border: 1px solid var(--cf-border);
442
+ border-radius: 9px;
443
+ padding: 7px 9px;
444
+ box-sizing: border-box;
445
+ }
446
+ .cf-feedback__input:focus { outline: none; border-color: var(--cf-accent); }
447
+ .cf-feedback__send {
448
+ align-self: flex-end;
449
+ font-size: 12px;
450
+ font-weight: 600;
451
+ color: var(--cf-accent-ink);
452
+ background: var(--cf-accent);
453
+ border: none;
454
+ border-radius: 999px;
455
+ padding: 5px 14px;
456
+ cursor: pointer;
457
+ transition: opacity 0.15s ease;
458
+ }
459
+ .cf-feedback__send:hover { opacity: 0.9; }
460
+
461
+ /* conversation starters */
462
+ .cf-starters { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; margin: 2px 0 4px 34px; }
463
+ .cf-starter {
464
+ padding: 9px 13px;
465
+ border-radius: 14px;
466
+ border: 1px solid var(--cf-border);
467
+ background: var(--cf-bg);
468
+ color: var(--cf-text);
469
+ font-size: 13.5px;
470
+ font-weight: 500;
471
+ text-align: left;
472
+ transition: border-color 0.15s ease, transform 0.1s ease;
473
+ }
474
+ .cf-starter:hover { border-color: var(--cf-accent); }
475
+ .cf-starter:active { transform: scale(0.98); }
476
+
477
+ /* stop generating */
478
+ .cf-stopbar { display: flex; justify-content: center; padding: 6px 0 2px; flex-shrink: 0; }
479
+ .cf-stop {
480
+ display: inline-flex;
481
+ align-items: center;
482
+ gap: 6px;
483
+ font-size: 12.5px;
484
+ font-weight: 600;
485
+ color: var(--cf-muted);
486
+ background: var(--cf-bg);
487
+ border: 1px solid var(--cf-border);
488
+ border-radius: 999px;
489
+ padding: 6px 14px;
490
+ box-shadow: var(--cf-shadow);
491
+ transition: border-color 0.15s ease, color 0.15s ease;
492
+ }
493
+ .cf-stop:hover { border-color: var(--cf-accent); color: var(--cf-text); }
494
+ .cf-stop svg { width: 13px; height: 13px; }
495
+
496
+ /* typing */
497
+ .cf-typing {
498
+ display: inline-flex;
499
+ gap: 4px;
500
+ padding: 13px 14px;
501
+ }
502
+ .cf-typing__dot {
503
+ width: 7px;
504
+ height: 7px;
505
+ border-radius: 50%;
506
+ background: var(--cf-muted);
507
+ animation: cf-typing 1.1s infinite ease-in-out;
508
+ }
509
+ .cf-typing__dot:nth-child(2) { animation-delay: 0.15s; }
510
+ .cf-typing__dot:nth-child(3) { animation-delay: 0.3s; }
511
+
512
+ /* sources */
513
+ .cf-sources {
514
+ display: flex;
515
+ flex-wrap: wrap;
516
+ gap: 6px;
517
+ /* Tie the row to the message column so a long title can't widen the thread. */
518
+ max-width: 100%;
519
+ min-width: 0;
520
+ }
521
+ .cf-source {
522
+ display: inline-flex;
523
+ align-items: center;
524
+ gap: 5px;
525
+ padding: 5px 10px;
526
+ border-radius: 999px;
527
+ background: var(--cf-surface-2);
528
+ border: 1px solid var(--cf-border);
529
+ color: var(--cf-muted);
530
+ font-size: 12px;
531
+ text-decoration: none;
532
+ max-width: 100%;
533
+ min-width: 0;
534
+ transition: border-color 0.15s ease, color 0.15s ease;
535
+ }
536
+ .cf-source:hover { color: var(--cf-text); border-color: var(--cf-accent); }
537
+ .cf-source--more { color: var(--cf-muted); cursor: default; }
538
+ .cf-source--more:hover { border-color: var(--cf-border); color: var(--cf-muted); }
539
+ .cf-source svg { width: 12px; height: 12px; flex-shrink: 0; }
540
+ .cf-source span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
541
+
542
+ /* chips + actions */
543
+ .cf-chips, .cf-actions {
544
+ display: flex;
545
+ flex-wrap: wrap;
546
+ gap: 8px;
547
+ }
548
+ .cf-chip {
549
+ padding: 8px 13px;
550
+ border-radius: 999px;
551
+ background: var(--cf-bg);
552
+ border: 1.5px solid var(--cf-accent);
553
+ color: var(--cf-accent);
554
+ font-size: 13px;
555
+ font-weight: 600;
556
+ transition: background 0.15s ease, color 0.15s ease, transform 0.1s ease;
557
+ }
558
+ .cf-root[data-theme='dark'] .cf-chip { color: var(--cf-text); border-color: var(--cf-border); }
559
+ .cf-chip:hover { background: var(--cf-accent); color: var(--cf-accent-ink); }
560
+ .cf-chip:active { transform: scale(0.97); }
561
+ .cf-chip:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 2px; }
562
+ .cf-action {
563
+ display: inline-flex;
564
+ align-items: center;
565
+ gap: 7px;
566
+ padding: 9px 14px;
567
+ border-radius: 12px;
568
+ background: var(--cf-surface);
569
+ border: 1px solid var(--cf-border);
570
+ color: var(--cf-text);
571
+ font-size: 13.5px;
572
+ font-weight: 600;
573
+ transition: border-color 0.15s ease, transform 0.1s ease;
574
+ }
575
+ .cf-action:hover { border-color: var(--cf-accent); }
576
+ .cf-action:active { transform: scale(0.98); }
577
+ .cf-action svg { width: 15px; height: 15px; color: var(--cf-accent); }
578
+
579
+ /* ---------- Inline forms + handoff card ---------- */
580
+ .cf-form {
581
+ display: flex;
582
+ flex-direction: column;
583
+ gap: 8px;
584
+ width: 100%;
585
+ max-width: 300px;
586
+ padding: 12px;
587
+ border-radius: 14px;
588
+ border: 1px solid var(--cf-border);
589
+ background: var(--cf-surface);
590
+ animation: cf-msg-in 0.2s ease both;
591
+ }
592
+ .cf-form__title { font-size: 13.5px; font-weight: 700; color: var(--cf-fg, var(--cf-text)); }
593
+ .cf-form__as { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; }
594
+ .cf-form__input {
595
+ width: 100%;
596
+ padding: 9px 11px;
597
+ border: 1.5px solid var(--cf-border);
598
+ border-radius: 10px;
599
+ background: var(--cf-bg);
600
+ color: var(--cf-text);
601
+ font-family: inherit;
602
+ font-size: 14px;
603
+ outline: none;
604
+ resize: none;
605
+ }
606
+ .cf-form__input:focus { border-color: var(--cf-accent); }
607
+ .cf-form__input::placeholder { color: var(--cf-muted); }
608
+ .cf-form__actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
609
+ .cf-form__submit {
610
+ padding: 8px 14px;
611
+ border-radius: 10px;
612
+ font-size: 13.5px;
613
+ font-weight: 600;
614
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
615
+ color: var(--cf-accent-ink);
616
+ transition: opacity 0.15s ease, transform 0.1s ease;
617
+ }
618
+ .cf-form__submit:disabled { opacity: 0.45; cursor: default; }
619
+ .cf-form__submit:not(:disabled):active { transform: scale(0.97); }
620
+ .cf-form__cancel { padding: 8px 12px; border-radius: 10px; font-size: 13.5px; font-weight: 600; color: var(--cf-muted); }
621
+ .cf-form__cancel:hover { color: var(--cf-text); }
622
+ .cf-form__err { font-size: 12.5px; color: #f25767; }
623
+ .cf-form--done {
624
+ flex-direction: row;
625
+ align-items: center;
626
+ gap: 8px;
627
+ font-size: 13.5px;
628
+ color: var(--cf-text);
629
+ }
630
+ .cf-form--done svg { width: 18px; height: 18px; color: var(--cf-accent); flex-shrink: 0; }
631
+ .cf-form--done { flex-wrap: wrap; }
632
+ .cf-booking__link {
633
+ display: inline-flex;
634
+ align-items: center;
635
+ gap: 4px;
636
+ font-size: 13px;
637
+ font-weight: 600;
638
+ color: var(--cf-accent);
639
+ text-decoration: none;
640
+ flex-basis: 100%;
641
+ }
642
+ .cf-booking__link svg { width: 13px; height: 13px; }
643
+ .cf-booking__link:hover { text-decoration: underline; }
644
+
645
+ .cf-handoff {
646
+ display: flex;
647
+ flex-direction: column;
648
+ gap: 8px;
649
+ width: 100%;
650
+ max-width: 300px;
651
+ padding: 12px;
652
+ border-radius: 14px;
653
+ border: 1.5px solid var(--cf-accent);
654
+ background: color-mix(in oklab, var(--cf-accent) 8%, var(--cf-bg));
655
+ animation: cf-msg-in 0.2s ease both;
656
+ }
657
+ .cf-handoff__title { font-size: 13.5px; font-weight: 700; color: var(--cf-text); }
658
+
659
+ /* ---------- Demo booking picker ---------- */
660
+ .cf-booking { max-width: 320px; }
661
+ .cf-booking__hint { font-size: 12.5px; color: var(--cf-muted); margin-top: -2px; }
662
+ .cf-booking__dur { font-weight: 600; color: var(--cf-text); }
663
+ .cf-booking__dates {
664
+ display: flex;
665
+ gap: 6px;
666
+ overflow-x: auto;
667
+ padding-bottom: 4px;
668
+ scrollbar-width: thin;
669
+ }
670
+ .cf-booking__dates::-webkit-scrollbar { height: 5px; }
671
+ .cf-booking__dates::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 3px; }
672
+ .cf-booking__date {
673
+ flex-shrink: 0;
674
+ display: flex;
675
+ flex-direction: column;
676
+ align-items: center;
677
+ gap: 1px;
678
+ width: 46px;
679
+ padding: 7px 0;
680
+ border-radius: 10px;
681
+ border: 1px solid var(--cf-border);
682
+ background: var(--cf-bg);
683
+ color: var(--cf-text);
684
+ transition: border-color 0.15s ease, background 0.15s ease, transform 0.1s ease;
685
+ }
686
+ .cf-booking__date:hover { border-color: var(--cf-accent); }
687
+ .cf-booking__date:active { transform: scale(0.96); }
688
+ .cf-booking__date.is-selected {
689
+ border-color: var(--cf-accent);
690
+ background: color-mix(in oklab, var(--cf-accent) 14%, var(--cf-bg));
691
+ color: var(--cf-accent);
692
+ }
693
+ .cf-root[data-theme='dark'] .cf-booking__date.is-selected { color: var(--cf-text); }
694
+ .cf-booking__dow { font-size: 10px; text-transform: uppercase; letter-spacing: 0.4px; color: var(--cf-muted); }
695
+ .cf-booking__date.is-selected .cf-booking__dow { color: inherit; }
696
+ .cf-booking__dom { font-size: 15px; font-weight: 700; line-height: 1.1; }
697
+ .cf-booking__slots {
698
+ display: grid;
699
+ grid-template-columns: repeat(3, 1fr);
700
+ gap: 6px;
701
+ max-height: 156px;
702
+ overflow-y: auto;
703
+ padding: 2px;
704
+ }
705
+ .cf-booking__slots::-webkit-scrollbar { width: 6px; }
706
+ .cf-booking__slots::-webkit-scrollbar-thumb { background: var(--cf-border); border-radius: 3px; }
707
+ .cf-booking__slot {
708
+ padding: 8px 0;
709
+ border-radius: 9px;
710
+ border: 1px solid var(--cf-border);
711
+ background: var(--cf-bg);
712
+ color: var(--cf-accent);
713
+ font-size: 13px;
714
+ font-weight: 600;
715
+ transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease, transform 0.1s ease;
716
+ }
717
+ .cf-root[data-theme='dark'] .cf-booking__slot { color: var(--cf-text); }
718
+ .cf-booking__slot:hover { border-color: var(--cf-accent); }
719
+ .cf-booking__slot:active { transform: scale(0.96); }
720
+ .cf-booking__slot.is-selected {
721
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
722
+ color: var(--cf-accent-ink);
723
+ border-color: var(--cf-accent);
724
+ }
725
+ .cf-booking__slot.is-taken,
726
+ .cf-booking__slot:disabled {
727
+ color: var(--cf-muted);
728
+ background: var(--cf-surface);
729
+ border-color: var(--cf-border);
730
+ text-decoration: line-through;
731
+ cursor: not-allowed;
732
+ opacity: 0.55;
733
+ }
734
+ .cf-booking__slot.is-taken:hover { border-color: var(--cf-border); }
735
+ .cf-handoff--done {
736
+ flex-direction: row;
737
+ align-items: center;
738
+ border-color: var(--cf-border);
739
+ background: var(--cf-surface);
740
+ font-size: 13.5px;
741
+ }
742
+ .cf-handoff--done svg { width: 18px; height: 18px; color: var(--cf-accent); flex-shrink: 0; }
743
+
744
+ /* note (action confirmation) */
745
+ .cf-note {
746
+ align-self: center;
747
+ font-size: 12.5px;
748
+ color: var(--cf-muted);
749
+ background: var(--cf-surface);
750
+ padding: 7px 12px;
751
+ border-radius: 999px;
752
+ animation: cf-msg-in 0.3s ease both;
753
+ }
754
+
755
+ /* ---------- Composer ---------- */
756
+ .cf-composer {
757
+ flex-shrink: 0;
758
+ padding: 10px 12px;
759
+ border-top: 1px solid var(--cf-border);
760
+ background: var(--cf-bg);
761
+ }
762
+ .cf-composer__field {
763
+ display: flex;
764
+ align-items: flex-end;
765
+ gap: 6px;
766
+ background: var(--cf-surface);
767
+ border: 1.5px solid var(--cf-border);
768
+ border-radius: 14px;
769
+ padding: 6px 6px 6px 12px;
770
+ transition: border-color 0.15s ease;
771
+ }
772
+ .cf-composer__field:focus-within { border-color: var(--cf-accent); }
773
+ .cf-textarea {
774
+ flex: 1;
775
+ border: none;
776
+ background: none;
777
+ resize: none;
778
+ outline: none;
779
+ font-family: inherit;
780
+ font-size: 14.5px;
781
+ color: var(--cf-text);
782
+ max-height: 110px;
783
+ line-height: 1.45;
784
+ padding: 6px 0;
785
+ }
786
+ .cf-textarea::placeholder { color: var(--cf-muted); }
787
+ .cf-iconbtn {
788
+ width: 36px;
789
+ height: 36px;
790
+ border-radius: 10px;
791
+ display: grid;
792
+ place-items: center;
793
+ flex-shrink: 0;
794
+ color: var(--cf-muted);
795
+ transition: background 0.15s ease, color 0.15s ease;
796
+ }
797
+ .cf-iconbtn:hover { background: var(--cf-surface-2); color: var(--cf-text); }
798
+ .cf-iconbtn:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 1px; }
799
+ .cf-iconbtn svg { width: 19px; height: 19px; }
800
+ .cf-send {
801
+ width: 36px;
802
+ height: 36px;
803
+ border-radius: 10px;
804
+ display: grid;
805
+ place-items: center;
806
+ flex-shrink: 0;
807
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
808
+ color: var(--cf-accent-ink);
809
+ transition: opacity 0.15s ease, transform 0.1s ease;
810
+ }
811
+ .cf-send:disabled { opacity: 0.4; cursor: default; }
812
+ .cf-send:not(:disabled):hover { transform: scale(1.05); }
813
+ .cf-send:not(:disabled):active { transform: scale(0.94); }
814
+ .cf-send svg { width: 18px; height: 18px; }
815
+ .cf-mic.is-recording { color: #f25767; animation: cf-pulse 1s infinite; }
816
+
817
+ .cf-iconbtn.is-active { background: var(--cf-surface-2); color: var(--cf-accent); }
818
+ .cf-gif-label { font-size: 11px; font-weight: 800; letter-spacing: 0.5px; }
819
+
820
+ /* ---------- Emoji + GIF pickers ---------- */
821
+ .cf-composer { position: relative; }
822
+ .cf-picker {
823
+ position: absolute;
824
+ left: 8px;
825
+ right: 8px;
826
+ bottom: calc(100% - 4px);
827
+ background: var(--cf-bg);
828
+ border: 1px solid var(--cf-border);
829
+ border-radius: 14px;
830
+ box-shadow: var(--cf-shadow);
831
+ overflow: hidden;
832
+ animation: cf-msg-in 0.18s ease both;
833
+ z-index: 2;
834
+ }
835
+ .cf-emoji { max-height: 260px; overflow-y: auto; padding: 8px 10px 10px; }
836
+ .cf-emoji__label {
837
+ font-size: 11px;
838
+ font-weight: 700;
839
+ text-transform: uppercase;
840
+ letter-spacing: 0.5px;
841
+ color: var(--cf-muted);
842
+ margin: 8px 2px 4px;
843
+ }
844
+ .cf-emoji__grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
845
+ .cf-emoji__btn {
846
+ font-size: 21px;
847
+ line-height: 1;
848
+ height: 34px;
849
+ border-radius: 8px;
850
+ transition: background 0.12s ease, transform 0.08s ease;
851
+ }
852
+ .cf-emoji__btn:hover { background: var(--cf-surface); }
853
+ .cf-emoji__btn:active { transform: scale(0.9); }
854
+
855
+ .cf-gif { display: flex; flex-direction: column; max-height: 320px; }
856
+ .cf-gif__search {
857
+ margin: 10px 10px 8px;
858
+ padding: 9px 12px;
859
+ border: 1.5px solid var(--cf-border);
860
+ border-radius: 10px;
861
+ background: var(--cf-surface);
862
+ color: var(--cf-text);
863
+ font-family: inherit;
864
+ font-size: 14px;
865
+ outline: none;
866
+ }
867
+ .cf-gif__search:focus { border-color: var(--cf-accent); }
868
+ .cf-gif__search::placeholder { color: var(--cf-muted); }
869
+ .cf-gif__grid {
870
+ flex: 1;
871
+ overflow-y: auto;
872
+ display: grid;
873
+ grid-template-columns: 1fr 1fr;
874
+ gap: 6px;
875
+ padding: 0 10px 8px;
876
+ align-content: start;
877
+ }
878
+ .cf-gif__item {
879
+ border-radius: 10px;
880
+ overflow: hidden;
881
+ background: var(--cf-surface);
882
+ aspect-ratio: 1 / 1;
883
+ transition: transform 0.1s ease, box-shadow 0.12s ease;
884
+ }
885
+ .cf-gif__item:hover { transform: scale(1.03); box-shadow: 0 0 0 2px var(--cf-accent); }
886
+ .cf-gif__item img { width: 100%; height: 100%; object-fit: cover; display: block; }
887
+ .cf-gif__hint { grid-column: 1 / -1; text-align: center; color: var(--cf-muted); font-size: 13px; padding: 24px 0; }
888
+ .cf-gif__powered { text-align: right; font-size: 10px; color: var(--cf-muted); padding: 0 12px 8px; }
889
+
890
+ /* Inline media (GIF) in a message bubble. */
891
+ .cf-msg__bubble--media { padding: 4px; background: var(--cf-surface); overflow: hidden; }
892
+ .cf-msg--user .cf-msg__bubble--media { background: var(--cf-surface-2); }
893
+ .cf-msg__media { display: block; max-width: 200px; width: 100%; border-radius: 12px; }
894
+ .cf-msg__caption { display: block; padding: 4px 6px 2px; font-size: 14px; }
895
+
896
+ .cf-footer {
897
+ text-align: center;
898
+ padding: 7px 0 9px;
899
+ font-size: 11px;
900
+ color: var(--cf-muted);
901
+ }
902
+ .cf-footer a { color: var(--cf-muted); text-decoration: none; font-weight: 600; }
903
+ .cf-footer a:hover { color: var(--cf-accent); }
904
+
905
+ /* ---------- Welcome intro (token branding) ---------- */
906
+ .cf-welcome { text-align: center; padding: 2px 14px 4px; }
907
+ .cf-welcome__desc { margin: 0 0 4px; font-size: 14px; font-weight: 600; color: var(--cf-text); }
908
+ .cf-welcome__sub { margin: 0; font-size: 12.5px; color: var(--cf-muted); }
909
+
910
+ /* Offline presence dot (amber instead of green). */
911
+ .cf-header__status--offline::before { background: #e2c07e; box-shadow: 0 0 0 2px rgba(226, 192, 126, 0.3); }
912
+
913
+ /* Disclaimer fine-print under the composer. */
914
+ .cf-disclaimer { padding: 0 16px 2px; font-size: 10.5px; line-height: 1.45; color: var(--cf-muted); text-align: center; }
915
+
916
+ /* Read-only banner shown while viewing a past conversation. */
917
+ .cf-viewing-banner {
918
+ padding: 7px 16px;
919
+ font-size: 12px;
920
+ font-weight: 600;
921
+ text-align: center;
922
+ color: var(--cf-muted);
923
+ background: var(--cf-surface);
924
+ border-bottom: 1px solid var(--cf-border);
925
+ flex-shrink: 0;
926
+ }
927
+
928
+ /* Past-conversations history panel (over the chat, like the confirm dialog). */
929
+ .cf-history {
930
+ width: min(340px, 90%);
931
+ max-height: 70%;
932
+ display: flex;
933
+ flex-direction: column;
934
+ background: var(--cf-bg);
935
+ border-radius: 14px;
936
+ box-shadow: var(--cf-shadow);
937
+ overflow: hidden;
938
+ }
939
+ .cf-history__head {
940
+ display: flex;
941
+ align-items: center;
942
+ justify-content: space-between;
943
+ padding: 12px 14px;
944
+ font-size: 14px;
945
+ font-weight: 700;
946
+ color: var(--cf-text);
947
+ border-bottom: 1px solid var(--cf-border);
948
+ }
949
+ .cf-history__list { overflow-y: auto; padding: 6px; }
950
+ .cf-history__item {
951
+ display: flex;
952
+ flex-direction: column;
953
+ gap: 2px;
954
+ width: 100%;
955
+ text-align: left;
956
+ padding: 9px 10px;
957
+ border-radius: 9px;
958
+ cursor: pointer;
959
+ transition: background 0.15s ease;
960
+ }
961
+ .cf-history__item:hover { background: var(--cf-surface); }
962
+ .cf-history__item.is-active { background: var(--cf-surface); }
963
+ .cf-history__title { font-size: 13px; color: var(--cf-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
964
+ .cf-history__meta { font-size: 11px; color: var(--cf-muted); }
965
+
966
+ /* Ended-conversation bar โ€” replaces the composer once the chat is closed. */
967
+ .cf-ended {
968
+ display: flex;
969
+ flex-direction: column;
970
+ align-items: center;
971
+ gap: 10px;
972
+ padding: 14px 16px 16px;
973
+ flex-shrink: 0;
974
+ text-align: center;
975
+ }
976
+ .cf-ended__text { margin: 0; font-size: 12.5px; line-height: 1.45; color: var(--cf-muted); }
977
+ .cf-csat { display: inline-flex; align-items: center; gap: 8px; }
978
+ .cf-csat__q { font-size: 12.5px; color: var(--cf-muted); }
979
+ .cf-csat__btn {
980
+ display: inline-flex;
981
+ align-items: center;
982
+ justify-content: center;
983
+ width: 30px;
984
+ height: 30px;
985
+ border-radius: 8px;
986
+ color: var(--cf-muted);
987
+ cursor: pointer;
988
+ transition: background 0.15s ease, color 0.15s ease;
989
+ }
990
+ .cf-csat__btn:hover { background: var(--cf-surface); color: var(--cf-accent); }
991
+ .cf-csat__btn svg { width: 16px; height: 16px; }
992
+ .cf-ended__btn {
993
+ font-size: 13px;
994
+ font-weight: 600;
995
+ color: var(--cf-accent-ink);
996
+ background: var(--cf-accent);
997
+ border: none;
998
+ border-radius: 999px;
999
+ padding: 9px 18px;
1000
+ cursor: pointer;
1001
+ transition: opacity 0.15s ease;
1002
+ }
1003
+ .cf-ended__btn:hover { opacity: 0.9; }
1004
+ .cf-ended__btn:focus-visible { outline: 2px solid var(--cf-accent); outline-offset: 2px; }
1005
+
1006
+ /* "โ†“ New messages" pill โ€” shown when a reply streams in while scrolled up. */
1007
+ .cf-newmsg {
1008
+ /* Sticky inside the scroll body: pins to the bottom of the visible thread,
1009
+ just above the composer (never overlapping it). Horizontal centering via
1010
+ align-self so it doesn't fight the entrance animation's transform. */
1011
+ position: sticky;
1012
+ bottom: 10px;
1013
+ align-self: center;
1014
+ z-index: 3;
1015
+ pointer-events: auto;
1016
+ display: inline-flex;
1017
+ align-items: center;
1018
+ gap: 6px;
1019
+ font-size: 12.5px;
1020
+ font-weight: 600;
1021
+ color: var(--cf-accent-ink);
1022
+ background: linear-gradient(135deg, var(--cf-accent, #2f7f55) 0%, var(--cf-accent-2, #2f7de8) 160%);
1023
+ border-radius: 999px;
1024
+ padding: 7px 14px;
1025
+ box-shadow: var(--cf-shadow);
1026
+ animation: cf-msg-in 0.2s ease both;
1027
+ }
1028
+ .cf-newmsg svg { width: 14px; height: 14px; }
1029
+
1030
+ /* ---------- Clear-chat confirm dialog (in-widget, replaces window.confirm) ---------- */
1031
+ .cf-confirm {
1032
+ position: absolute;
1033
+ inset: 0;
1034
+ z-index: 6;
1035
+ pointer-events: auto;
1036
+ display: grid;
1037
+ place-items: center;
1038
+ padding: 22px;
1039
+ background: color-mix(in oklab, var(--cf-bg) 62%, transparent);
1040
+ backdrop-filter: blur(2px);
1041
+ animation: cf-fade-in 0.14s ease both;
1042
+ }
1043
+ .cf-confirm__card {
1044
+ width: 100%;
1045
+ max-width: 300px;
1046
+ background: var(--cf-bg);
1047
+ border: 1px solid var(--cf-border);
1048
+ border-radius: 16px;
1049
+ box-shadow: var(--cf-shadow);
1050
+ padding: 18px;
1051
+ text-align: center;
1052
+ animation: cf-msg-in 0.18s cubic-bezier(0.22, 1, 0.36, 1) both;
1053
+ }
1054
+ .cf-confirm__title { font-size: 15px; font-weight: 700; color: var(--cf-text); }
1055
+ .cf-confirm__body { margin-top: 6px; font-size: 13px; line-height: 1.45; color: var(--cf-muted); }
1056
+ .cf-confirm__actions { margin-top: 16px; display: flex; gap: 8px; justify-content: center; }
1057
+ .cf-confirm__btn {
1058
+ padding: 9px 16px;
1059
+ border-radius: 10px;
1060
+ font-size: 13.5px;
1061
+ font-weight: 600;
1062
+ transition: transform 0.1s ease, opacity 0.15s ease, border-color 0.15s ease, background 0.15s ease;
1063
+ }
1064
+ .cf-confirm__btn:active { transform: scale(0.97); }
1065
+ .cf-confirm__btn:focus-visible { outline: 2px solid var(--cf-accent-2); outline-offset: 2px; }
1066
+ .cf-confirm__btn--cancel { background: var(--cf-surface); color: var(--cf-text); border: 1px solid var(--cf-border); }
1067
+ .cf-confirm__btn--cancel:hover { border-color: var(--cf-accent); }
1068
+ .cf-confirm__btn--danger { background: #f25767; color: #fff; }
1069
+ .cf-confirm__btn--danger:hover { opacity: 0.9; }
1070
+
1071
+ /* Visually-hidden live region (announces the final answer only). */
1072
+ .cf-sr-live {
1073
+ position: absolute;
1074
+ width: 1px;
1075
+ height: 1px;
1076
+ padding: 0;
1077
+ margin: -1px;
1078
+ overflow: hidden;
1079
+ clip: rect(0 0 0 0);
1080
+ white-space: nowrap;
1081
+ border: 0;
1082
+ }
1083
+
1084
+ /* ---------- Attachments ---------- */
1085
+ .cf-file-input { display: none; }
1086
+ .cf-iconbtn:disabled { opacity: 0.4; cursor: default; }
1087
+ .cf-attach-row { padding: 0 4px 8px; }
1088
+ .cf-attach-status { font-size: 12px; color: var(--cf-muted); }
1089
+ .cf-attach-status--err { color: #f25767; }
1090
+ .cf-attach-chip {
1091
+ display: inline-flex;
1092
+ align-items: center;
1093
+ gap: 6px;
1094
+ max-width: 100%;
1095
+ padding: 5px 6px 5px 10px;
1096
+ border-radius: 999px;
1097
+ background: var(--cf-surface-2);
1098
+ border: 1px solid var(--cf-border);
1099
+ color: var(--cf-text);
1100
+ font-size: 12px;
1101
+ }
1102
+ .cf-attach-chip > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
1103
+ .cf-attach-chip svg { width: 13px; height: 13px; flex-shrink: 0; color: var(--cf-muted); }
1104
+ .cf-attach-x { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; color: var(--cf-muted); flex-shrink: 0; }
1105
+ .cf-attach-x:hover { background: var(--cf-surface); color: var(--cf-text); }
1106
+ .cf-attach-x svg { width: 11px; height: 11px; }
1107
+
1108
+ /* ---------- Mobile: full-screen panel ---------- */
1109
+ @media (max-width: 480px) {
1110
+ .cf-panel {
1111
+ bottom: 0;
1112
+ right: 0;
1113
+ width: 100vw;
1114
+ max-width: 100vw;
1115
+ height: 100dvh;
1116
+ max-height: 100dvh;
1117
+ border-radius: 0;
1118
+ }
1119
+ .cf-launcher { bottom: 16px; right: 16px; }
1120
+ }
1121
+
1122
+ /* ---------- Keyframes ---------- */
1123
+ @keyframes cf-pop {
1124
+ from { transform: scale(0); opacity: 0; }
1125
+ to { transform: scale(1); opacity: 1; }
1126
+ }
1127
+ @keyframes cf-badge-pop {
1128
+ from { transform: scale(0); }
1129
+ to { transform: scale(1); }
1130
+ }
1131
+ @keyframes cf-msg-in {
1132
+ from { opacity: 0; transform: translateY(8px); }
1133
+ to { opacity: 1; transform: none; }
1134
+ }
1135
+ @keyframes cf-fade-in {
1136
+ from { opacity: 0; }
1137
+ to { opacity: 1; }
1138
+ }
1139
+ @keyframes cf-typing {
1140
+ 0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
1141
+ 40% { opacity: 1; transform: translateY(-4px); }
1142
+ }
1143
+ @keyframes cf-pulse {
1144
+ 0%, 100% { opacity: 1; }
1145
+ 50% { opacity: 0.4; }
1146
+ }
1147
+
1148
+ @media (prefers-reduced-motion: reduce) {
1149
+ .cf-root *, .cf-root *::before, .cf-root *::after {
1150
+ animation-duration: 0.01ms !important;
1151
+ animation-iteration-count: 1 !important;
1152
+ transition-duration: 0.01ms !important;
1153
+ scroll-behavior: auto !important;
1154
+ }
1155
+ }
1156
+ `,wt="centrinfo-widget";class nr extends HTMLElement{constructor(){super(...arguments);be(this,"controls",null)}mountWith(n){const o=tr(n),i=this.shadowRoot??this.attachShadow({mode:"open"});if("adoptedStyleSheets"in Document.prototype&&typeof CSSStyleSheet<"u"){const s=new CSSStyleSheet;s.replaceSync(yn),i.adoptedStyleSheets=[s]}else{const s=document.createElement("style");s.textContent=yn,i.appendChild(s)}const a=o.demo?new Fn:o.preview?new Wn(new Bt(o.apiBaseUrl,o.token,o.gifApiKey),o.strings):new Bt(o.apiBaseUrl,o.token,o.gifApiKey);jt(r(Qo,{transport:a,config:o,bindControls:s=>this.controls=s}),i)}open(){this.controls?.open()}close(){this.controls?.close()}toggle(){this.controls?.toggle()}identify(n){this.controls?.identify(n)}clear(){this.controls?.startNew()}shutdown(){this.controls?.shutdown()}unmount(){this.shadowRoot&&jt(null,this.shadowRoot)}}typeof customElements<"u"&&!customElements.get(wt)&&customElements.define(wt,nr);const kn=t=>{if(typeof document>"u")throw new Error("[centrinfo-widget] createWidget must run in a browser.");const e=document.createElement(wt);return e.style.pointerEvents="none",e.style.position="fixed",e.style.inset="0",e.style.width="0",e.style.height="0",document.body.appendChild(e),e.mountWith(t),{open:()=>e.open(),close:()=>e.close(),toggle:()=>e.toggle(),show:()=>e.open(),hide:()=>e.close(),identify:n=>e.identify(n),update:n=>e.identify(n),clear:()=>e.clear(),shutdown:()=>e.shutdown(),logout:()=>e.shutdown(),destroy:()=>{e.unmount(),e.remove()}}};let Ct=null;const wn=t=>(Ct?.destroy(),Ct=kn(t),Ct),or=t=>t==="light"||t==="dark"||t==="auto"?t:void 0,nt=t=>{if(t==null||t.trim()==="")return;const e=Number(t);return Number.isFinite(e)?e:void 0},rr=t=>{if(t)try{const e=JSON.parse(t);return e&&typeof e=="object"?e:void 0}catch{return}},ar=t=>{const e=o=>t.getAttribute(o),n=e("data-token");return n?{token:n,apiBaseUrl:e("data-api-base")??void 0,accentColor:e("data-accent")??void 0,launcherIcon:e("data-launcher-icon")??void 0,gifApiKey:e("data-gif-api-key")??void 0,theme:or(e("data-theme")),sound:e("data-sound")!=="false",openByDefault:e("data-open")==="true",demo:e("data-demo")==="true",preview:e("data-preview")==="true",alignment:e("data-alignment")==="left"?"left":void 0,horizontalPadding:nt(e("data-horizontal-padding")),verticalPadding:nt(e("data-vertical-padding")),hideDefaultLauncher:e("data-hide-launcher")==="true",customLauncherSelector:e("data-custom-launcher-selector")??void 0,sessionDurationMinutes:nt(e("data-session-duration")),proactiveMessage:e("data-proactive-message")??void 0,proactiveDelaySeconds:nt(e("data-proactive-delay")),csat:e("data-csat")==="false"?!1:void 0,user:rr(e("data-user"))}:null},ir=t=>{typeof document>"u"||(document.readyState!=="loading"?t():document.addEventListener("DOMContentLoaded",t,{once:!0}))},sr=()=>{const t=document.currentScript??document.querySelector("script[data-token]");if(!t)return;const e=ar(t);e&&wn(e)};return ir(()=>{try{sr()}catch(t){console.error("[centrinfo-widget]",t)}}),ae.createWidget=kn,ae.init=wn,Object.defineProperty(ae,Symbol.toStringTag,{value:"Module"}),ae})({});