@flowengage/react-chatbot 0.1.9 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`react`);l=c(l);let u=require(`react/jsx-runtime`);var d=e=>{if(!e||typeof e!=`object`)throw Error(`FlowEngage config is required`);if(!e.siteId||typeof e.siteId!=`string`)throw Error(`[FlowEngage] config.siteId is required. Pass it as <FlowEngageProvider siteId="your-site-id" /> or config={{ siteId: 'your-site-id' }}.`);let t=(e.apiBaseUrl||`http://localhost:5001`).replace(/\/+$/,``);return{siteId:e.siteId.trim(),apiBaseUrl:t}},f={chatId:`flowengage.chatId`,isOpen:`flowengage.isOpen`,activeScreen:`flowengage.activeScreen`,isHumanHandled:`flowengage.isHumanHandled`,agentName:`flowengage.agentName`,agentHeadshot:`flowengage.agentHeadshot`},p=1e4,m=6e4,ee=typeof window<`u`,te=()=>{if(!ee)return`server-chat-id`;let e=window.sessionStorage.getItem(f.chatId);if(e)return e;let t=typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return window.sessionStorage.setItem(f.chatId,t),t},h=()=>ee?{isOpen:window.sessionStorage.getItem(f.isOpen)===`true`,activeScreen:window.sessionStorage.getItem(f.activeScreen)||`ai`,isHumanHandled:window.sessionStorage.getItem(f.isHumanHandled)===`true`,agentName:window.sessionStorage.getItem(f.agentName),agentHeadshot:window.sessionStorage.getItem(f.agentHeadshot)}:{isOpen:!1,activeScreen:`ai`,isHumanHandled:!1,agentName:null,agentHeadshot:null},ne=e=>{ee&&Object.entries(e).forEach(([e,t])=>{let n=f[e];if(n){if(t==null||t===!1){window.sessionStorage.removeItem(n);return}window.sessionStorage.setItem(n,String(t))}})},g=async e=>{let t=await e.json().catch(()=>({}));if(!e.ok){let n=Error(t.message||t.error||`Request failed with status ${e.status}`);throw n.status=e.status,n}return t},re=async(e,t={})=>{try{return await fetch(e,{mode:`cors`,...t})}catch(t){let n=Error(`Network error reaching ${e}. Check: (1) backend is running, (2) CORS allows this origin, (3) siteId is correct. Original: ${t.message}`);throw n.status=0,n.cause=t,n}},ie=async({apiBaseUrl:e,siteId:t})=>{let n=typeof window<`u`?window.location.origin:`http://localhost`,r=`${e}/api/widget/bootstrap?${new URLSearchParams({siteId:t,origin:n}).toString()}`;console.log(`[FlowEngageAPI] bootstrap request`,{apiBaseUrl:e,siteId:t,origin:n,url:r});let i=await g(await re(r,{method:`GET`}));return console.log(`[FlowEngageAPI] bootstrap success`,i),i.data},ae=({apiBaseUrl:e,userId:t,siteId:n})=>{let r=async(r,i={})=>g(await re(`${e}${r}`,{...i,headers:{"Content-Type":`application/json`,"x-user-id":t,...n?{"x-site-id":n}:{},...i.headers||{}}}));return{async loadHistory(e,t=`en`,n=``){return r(`/api/ai/chat`,{method:`POST`,body:JSON.stringify({session_id:e,user_query:``,lang:t,category:n})})},async sendAiMessage(e,t,n=`en`,i=``,a=null){return r(`/api/ai/chat`,{method:`POST`,body:JSON.stringify({session_id:e,user_query:t,lang:n,category:i,...a||{}})})},async checkHumanHandled(e){return r(`/api/ai/check_human_handled`,{method:`POST`,body:JSON.stringify({session_id:e})})},async setChatMode(e,t){return r(`/api/ai/set_chat_mode`,{method:`POST`,body:JSON.stringify({session_id:e,mode:t})})},async toggleVoice(e){return r(`/api/ai/voice/toggle`,{method:`POST`,body:JSON.stringify({session_id:e})})},async syncVoice(e,t){return r(`/api/ai/voice/sync`,{method:`POST`,body:JSON.stringify({session_id:e,messages:t})})},async trackVisitor(e){return r(`/api/visitors/track`,{method:`POST`,body:JSON.stringify(e)})},async updateChatStatus(e,t){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:t})})},async startConversation(e,t=`en`){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`open`,lang:t})})},async endConversation(e){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`closed`})})},async acceptCall(e,t){return r(`/api/calls/${e}/accept`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async rejectCall(e,t){return r(`/api/calls/${e}/reject`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async endWebRTCCall(e,t){return r(`/api/calls/${e}/end`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},beaconSyncVoice(e,t,n,r){if(typeof navigator>`u`||!navigator.sendBeacon)return!1;let i=new Blob([JSON.stringify({session_id:n,messages:r})],{type:`application/json`});return navigator.sendBeacon(`${e}/api/ai/voice/sync`,i)}}},oe=Object.create(null);oe.open=`0`,oe.close=`1`,oe.ping=`2`,oe.pong=`3`,oe.message=`4`,oe.upgrade=`5`,oe.noop=`6`;var _=Object.create(null);Object.keys(oe).forEach(e=>{_[oe[e]]=e});var v={type:`error`,data:`parser error`},se=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,ce=typeof ArrayBuffer==`function`,le=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ue=({type:e,data:t},n,r)=>se&&t instanceof Blob?n?r(t):de(t,r):ce&&(t instanceof ArrayBuffer||le(t))?n?r(t):de(new Blob([t]),r):r(oe[e]+(t||``)),de=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function fe(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var pe;function me(e,t){if(se&&e.data instanceof Blob)return e.data.arrayBuffer().then(fe).then(t);if(ce&&(e.data instanceof ArrayBuffer||le(e.data)))return t(fe(e.data));ue(e,!1,e=>{pe||=new TextEncoder,t(pe.encode(e))})}var he=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ge=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)ge[he.charCodeAt(e)]=e;var _e=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=ge[e.charCodeAt(r)],o=ge[e.charCodeAt(r+1)],s=ge[e.charCodeAt(r+2)],c=ge[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},ve=typeof ArrayBuffer==`function`,ye=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:xe(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:be(e.substring(1),t)}:_[n]?e.length>1?{type:_[n],data:e.substring(1)}:{type:_[n]}:v},be=(e,t)=>ve?xe(_e(e),t):{base64:!0,data:e},xe=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Se=``,Ce=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{ue(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Se))})})},we=(e,t)=>{let n=e.split(Se),r=[];for(let e=0;e<n.length;e++){let i=ye(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Te(){return new TransformStream({transform(e,t){me(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Ee;function De(e){return e.reduce((e,t)=>e+t.length,0)}function Oe(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function ke(e,t){Ee||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(De(n)<1)break;let e=Oe(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(De(n)<2)break;let e=Oe(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(De(n)<8)break;let e=Oe(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(v);break}i=a*2**32+t.getUint32(4),r=3}else{if(De(n)<i)break;let e=Oe(n,i);s.enqueue(ye(a?e:Ee.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(v);break}}}})}function y(e){if(e)return Ae(e)}function Ae(e){for(var t in y.prototype)e[t]=y.prototype[t];return e}y.prototype.on=y.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},y.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},y.prototype.off=y.prototype.removeListener=y.prototype.removeAllListeners=y.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},y.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},y.prototype.emitReserved=y.prototype.emit,y.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},y.prototype.hasListeners=function(e){return!!this.listeners(e).length};var b=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),x=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),je=`arraybuffer`;function Me(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Ne=x.setTimeout,Pe=x.clearTimeout;function Fe(e,t){t.useNativeTimers?(e.setTimeoutFn=Ne.bind(x),e.clearTimeoutFn=Pe.bind(x)):(e.setTimeoutFn=x.setTimeout.bind(x),e.clearTimeoutFn=x.clearTimeout.bind(x))}var Ie=1.33;function Le(e){return typeof e==`string`?Re(e):Math.ceil((e.byteLength||e.size)*Ie)}function Re(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function ze(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Be(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function S(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var C=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},w=class extends y{constructor(e){super(),this.writable=!1,Fe(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new C(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=ye(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Be(e);return t.length?`?`+t:``}},Ve=class extends w{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){we(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Ce(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ze()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},He=!1;try{He=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Ue=He;function We(){}var Ge=class extends Ve{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},Ke=class e extends y{constructor(e,t,n){super(),this.createRequest=e,Fe(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Me(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=We,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(Ke.requestsCount=0,Ke.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,qe);else if(typeof addEventListener==`function`){let e=`onpagehide`in x?`pagehide`:`unload`;addEventListener(e,qe,!1)}}function qe(){for(let e in Ke.requests)Ke.requests.hasOwnProperty(e)&&Ke.requests[e].abort()}var Je=(function(){let e=Xe({xdomain:!1});return e&&e.responseType!==null})(),Ye=class extends Ge{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Je&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ke(Xe,this.uri(),e)}};function Xe(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Ue))return new XMLHttpRequest}catch{}if(!t)try{return new x[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var Ze=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Qe=class extends w{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=Ze?{}:Me(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;ue(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&b(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ze()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},$e=x.WebSocket||x.MozWebSocket,et={websocket:class extends Qe{createSocket(e,t,n){return Ze?new $e(e,t,n):t?new $e(e,t):new $e(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends w{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=ke(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Te();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&b(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:Ye},tt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,nt=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function rt(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=tt.exec(e||``),a={},o=14;for(;o--;)a[nt[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=it(a,a.path),a.queryKey=at(a,a.query),a}function it(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function at(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var ot=typeof addEventListener==`function`&&typeof removeEventListener==`function`,st=[];ot&&addEventListener(`offline`,()=>{st.forEach(e=>e())},!1);var ct=class e extends y{constructor(e,t){if(super(),this.binaryType=je,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=rt(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=rt(t.host).host);Fe(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=S(this.opts.query)),ot&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},st.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=Le(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,b(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),ot&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=st.indexOf(this._offlineEventListener);e!==-1&&st.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};ct.protocol=4;var lt=class extends ct{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;ct.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;ct.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},ut=class extends lt{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>et[e]).filter(e=>!!e)),super(e,n)}};ut.protocol;function dt(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=rt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var ft=typeof ArrayBuffer==`function`,pt=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,mt=Object.prototype.toString,ht=typeof Blob==`function`||typeof Blob<`u`&&mt.call(Blob)===`[object BlobConstructor]`,gt=typeof File==`function`||typeof File<`u`&&mt.call(File)===`[object FileConstructor]`;function _t(e){return ft&&(e instanceof ArrayBuffer||pt(e))||ht&&e instanceof Blob||gt&&e instanceof File}function vt(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(vt(e[t]))return!0;return!1}if(_t(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return vt(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&vt(e[t]))return!0;return!1}function yt(e){let t=[],n=e.data,r=e;return r.data=bt(n,t),r.attachments=t.length,{packet:r,buffers:t}}function bt(e,t){if(!e)return e;if(_t(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=bt(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=bt(e[r],t));return n}return e}function xt(e,t){return e.data=St(e.data,t),delete e.attachments,e}function St(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=St(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=St(e[n],t));return e}var Ct=o({Decoder:()=>Et,Encoder:()=>Tt,PacketType:()=>T,isPacketValid:()=>Nt,protocol:()=>5}),wt=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],T;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(T||={});var Tt=class{constructor(e){this.replacer=e}encode(e){return(e.type===T.EVENT||e.type===T.ACK)&&vt(e)?this.encodeAsBinary({type:e.type===T.EVENT?T.BINARY_EVENT:T.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===T.BINARY_EVENT||e.type===T.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=yt(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Et=class e extends y{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===T.BINARY_EVENT;n||t.type===T.BINARY_ACK?(t.type=n?T.EVENT:T.ACK,this.reconstructor=new Dt(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(_t(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(T[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===T.BINARY_EVENT||r.type===T.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!kt(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case T.CONNECT:return jt(t);case T.DISCONNECT:return t===void 0;case T.CONNECT_ERROR:return typeof t==`string`||jt(t);case T.EVENT:case T.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&wt.indexOf(t[0])===-1);case T.ACK:case T.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},Dt=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=xt(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Ot(e){return typeof e==`string`}var kt=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function At(e){return e===void 0||kt(e)}function jt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Mt(e,t){switch(e){case T.CONNECT:return t===void 0||jt(t);case T.DISCONNECT:return t===void 0;case T.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&wt.indexOf(t[0])===-1);case T.ACK:return Array.isArray(t);case T.CONNECT_ERROR:return typeof t==`string`||jt(t);default:return!1}}function Nt(e){return Ot(e.nsp)&&At(e.id)&&Mt(e.type,e.data)}function Pt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Ft=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),It=class extends y{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[Pt(e,`open`,this.onopen.bind(this)),Pt(e,`packet`,this.onpacket.bind(this)),Pt(e,`error`,this.onerror.bind(this)),Pt(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(Ft.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:T.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:T.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case T.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case T.EVENT:case T.BINARY_EVENT:this.onevent(e);break;case T.ACK:case T.BINARY_ACK:this.onack(e);break;case T.DISCONNECT:this.ondisconnect();break;case T.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:T.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:T.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function Lt(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Lt.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},Lt.prototype.reset=function(){this.attempts=0},Lt.prototype.setMin=function(e){this.ms=e},Lt.prototype.setMax=function(e){this.max=e},Lt.prototype.setJitter=function(e){this.jitter=e};var Rt=class extends y{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Fe(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new Lt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||Ct;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new ut(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=Pt(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=Pt(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(Pt(e,`ping`,this.onping.bind(this)),Pt(e,`data`,this.ondata.bind(this)),Pt(e,`error`,this.onerror.bind(this)),Pt(e,`close`,this.onclose.bind(this)),Pt(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){b(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new It(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},zt={};function Bt(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=dt(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=zt[i]&&a in zt[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Rt(r,t):(zt[i]||(zt[i]=new Rt(r,t)),c=zt[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Bt,{Manager:Rt,Socket:It,io:Bt,connect:Bt});var Vt=({apiBaseUrl:e,userId:t,chatId:n,siteId:r})=>Bt(e,{transports:[`polling`,`websocket`],upgrade:!0,rememberUpgrade:!1,auth:{userId:t,chatId:n,siteId:r},query:{chatId:n,siteId:r}}),Ht=({socket:e,chatId:t})=>{if(!e||!t||typeof window>`u`)return()=>{};let n=window.location.pathname+window.location.search,r=Date.now(),i=()=>{console.log(`[FlowEngageTracking] visitor:session_start`,{chatId:t,path:n}),e.emit(`visitor:session_start`,{chatId:t,path:n,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,timestamp:Date.now()})},a=()=>{console.log(`[FlowEngageTracking] visitor:page_enter`,{chatId:t,path:n}),e.emit(`visitor:page_enter`,{chatId:t,path:n,title:document.title,timestamp:Date.now()})},o=(n,r)=>{console.log(`[FlowEngageTracking] visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3))}),e.emit(`visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3)),timestamp:Date.now()})},s=()=>{console.log(`[FlowEngageTracking] visitor:heartbeat`,{chatId:t,path:n}),e.emit(`visitor:heartbeat`,{chatId:t,timestamp:Date.now()})},c=()=>{let e=window.location.pathname+window.location.search;if(e===n){console.log(`[FlowEngageTracking] route unchanged`,{currentPath:n});return}console.log(`[FlowEngageTracking] route changed`,{from:n,to:e}),o(n,r),n=e,r=Date.now(),a()},l=window.history.pushState.bind(window.history),u=window.history.replaceState.bind(window.history);window.history.pushState=(...e)=>{l(...e),c()},window.history.replaceState=(...e)=>{u(...e),c()};let d=window.setInterval(s,p),f=()=>{o(n,r),e.emit(`visitor:session_end`,{chatId:t,timestamp:Date.now()})};return window.addEventListener(`popstate`,c),window.addEventListener(`hashchange`,c),window.addEventListener(`beforeunload`,f),i(),s(),{notifyRouteChange:c,cleanup:()=>{window.clearInterval(d),window.history.pushState=l,window.history.replaceState=u,window.removeEventListener(`popstate`,c),window.removeEventListener(`hashchange`,c),window.removeEventListener(`beforeunload`,f)}}},Ut=(0,l.createContext)(null),Wt=()=>{let e=(0,l.useContext)(Ut);if(!e)throw Error(`useFlowEngage must be used inside FlowEngageProvider`);return e},Gt=()=>{if(typeof document>`u`||document.getElementById(`fe-highlight-styles`))return;let e=document.createElement(`style`);e.id=`fe-highlight-styles`,e.textContent=`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n||t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`react`);l=c(l);let u=require(`react/jsx-runtime`);var d=e=>{if(!e||typeof e!=`object`)throw Error(`FlowEngage config is required`);if(!e.siteId||typeof e.siteId!=`string`)throw Error(`[FlowEngage] config.siteId is required. Pass it as <FlowEngageProvider siteId="your-site-id" /> or config={{ siteId: 'your-site-id' }}.`);let t=(e.apiBaseUrl||`http://localhost:5001`).replace(/\/+$/,``);return{siteId:e.siteId.trim(),apiBaseUrl:t}},f={chatId:`flowengage.chatId`,isOpen:`flowengage.isOpen`,activeScreen:`flowengage.activeScreen`,isHumanHandled:`flowengage.isHumanHandled`,agentName:`flowengage.agentName`,agentHeadshot:`flowengage.agentHeadshot`},p=1e4,m=6e4,ee=typeof window<`u`,te=()=>{if(!ee)return`server-chat-id`;let e=window.sessionStorage.getItem(f.chatId);if(e)return e;let t=typeof crypto<`u`&&crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`;return window.sessionStorage.setItem(f.chatId,t),t},h=()=>ee?{isOpen:!1,activeScreen:window.sessionStorage.getItem(f.activeScreen)||`ai`,isHumanHandled:window.sessionStorage.getItem(f.isHumanHandled)===`true`,agentName:window.sessionStorage.getItem(f.agentName),agentHeadshot:window.sessionStorage.getItem(f.agentHeadshot)}:{isOpen:!1,activeScreen:`ai`,isHumanHandled:!1,agentName:null,agentHeadshot:null},ne=e=>{ee&&Object.entries(e).forEach(([e,t])=>{let n=f[e];if(n){if(t==null||t===!1){window.sessionStorage.removeItem(n);return}window.sessionStorage.setItem(n,String(t))}})},g=async e=>{let t=await e.json().catch(()=>({}));if(!e.ok){let n=Error(t.message||t.error||`Request failed with status ${e.status}`);throw n.status=e.status,n}return t},re=async(e,t={})=>{try{return await fetch(e,{mode:`cors`,...t})}catch(t){let n=Error(`Network error reaching ${e}. Check: (1) backend is running, (2) CORS allows this origin, (3) siteId is correct. Original: ${t.message}`);throw n.status=0,n.cause=t,n}},ie=async({apiBaseUrl:e,siteId:t})=>{let n=typeof window<`u`?window.location.origin:`http://localhost`,r=`${e}/api/widget/bootstrap?${new URLSearchParams({siteId:t,origin:n}).toString()}`;console.log(`[FlowEngageAPI] bootstrap request`,{apiBaseUrl:e,siteId:t,origin:n,url:r});let i=await g(await re(r,{method:`GET`}));return console.log(`[FlowEngageAPI] bootstrap success`,i),i.data},ae=({apiBaseUrl:e,userId:t,siteId:n})=>{let r=async(r,i={})=>g(await re(`${e}${r}`,{...i,headers:{"Content-Type":`application/json`,"x-user-id":t,...n?{"x-site-id":n}:{},...i.headers||{}}}));return{async loadHistory(e,t=`en`,n=``){return r(`/api/ai/chat`,{method:`POST`,body:JSON.stringify({session_id:e,user_query:``,lang:t,category:n})})},async sendAiMessage(e,t,n=`en`,i=``,a=null){return r(`/api/ai/chat`,{method:`POST`,body:JSON.stringify({session_id:e,user_query:t,lang:n,category:i,...a||{}})})},async checkHumanHandled(e){return r(`/api/ai/check_human_handled`,{method:`POST`,body:JSON.stringify({session_id:e})})},async setChatMode(e,t){return r(`/api/ai/set_chat_mode`,{method:`POST`,body:JSON.stringify({session_id:e,mode:t})})},async toggleVoice(e){return r(`/api/ai/voice/toggle`,{method:`POST`,body:JSON.stringify({session_id:e})})},async syncVoice(e,t){return r(`/api/ai/voice/sync`,{method:`POST`,body:JSON.stringify({session_id:e,messages:t})})},async trackVisitor(e){return r(`/api/visitors/track`,{method:`POST`,body:JSON.stringify(e)})},async updateChatStatus(e,t){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:t})})},async startConversation(e,t=`en`){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`open`,lang:t})})},async endConversation(e){return r(`/api/chat/status`,{method:`POST`,body:JSON.stringify({chatId:e,type:`closed`})})},async acceptCall(e,t){return r(`/api/calls/${e}/accept`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async rejectCall(e,t){return r(`/api/calls/${e}/reject`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},async endWebRTCCall(e,t){return r(`/api/calls/${e}/end`,{method:`POST`,body:JSON.stringify({session_id:t,site_id:n})})},beaconSyncVoice(e,t,n,r){if(typeof navigator>`u`||!navigator.sendBeacon)return!1;let i=new Blob([JSON.stringify({session_id:n,messages:r})],{type:`application/json`});return navigator.sendBeacon(`${e}/api/ai/voice/sync`,i)}}},oe=Object.create(null);oe.open=`0`,oe.close=`1`,oe.ping=`2`,oe.pong=`3`,oe.message=`4`,oe.upgrade=`5`,oe.noop=`6`;var _=Object.create(null);Object.keys(oe).forEach(e=>{_[oe[e]]=e});var v={type:`error`,data:`parser error`},se=typeof Blob==`function`||typeof Blob<`u`&&Object.prototype.toString.call(Blob)===`[object BlobConstructor]`,ce=typeof ArrayBuffer==`function`,le=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,ue=({type:e,data:t},n,r)=>se&&t instanceof Blob?n?r(t):de(t,r):ce&&(t instanceof ArrayBuffer||le(t))?n?r(t):de(new Blob([t]),r):r(oe[e]+(t||``)),de=(e,t)=>{let n=new FileReader;return n.onload=function(){let e=n.result.split(`,`)[1];t(`b`+(e||``))},n.readAsDataURL(e)};function fe(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}var pe;function me(e,t){if(se&&e.data instanceof Blob)return e.data.arrayBuffer().then(fe).then(t);if(ce&&(e.data instanceof ArrayBuffer||le(e.data)))return t(fe(e.data));ue(e,!1,e=>{pe||=new TextEncoder,t(pe.encode(e))})}var he=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,ge=typeof Uint8Array>`u`?[]:new Uint8Array(256);for(let e=0;e<64;e++)ge[he.charCodeAt(e)]=e;var _e=e=>{let t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);let l=new ArrayBuffer(t),u=new Uint8Array(l);for(r=0;r<n;r+=4)a=ge[e.charCodeAt(r)],o=ge[e.charCodeAt(r+1)],s=ge[e.charCodeAt(r+2)],c=ge[e.charCodeAt(r+3)],u[i++]=a<<2|o>>4,u[i++]=(o&15)<<4|s>>2,u[i++]=(s&3)<<6|c&63;return l},ve=typeof ArrayBuffer==`function`,ye=(e,t)=>{if(typeof e!=`string`)return{type:`message`,data:xe(e,t)};let n=e.charAt(0);return n===`b`?{type:`message`,data:be(e.substring(1),t)}:_[n]?e.length>1?{type:_[n],data:e.substring(1)}:{type:_[n]}:v},be=(e,t)=>ve?xe(_e(e),t):{base64:!0,data:e},xe=(e,t)=>{switch(t){case`blob`:return e instanceof Blob?e:new Blob([e]);default:return e instanceof ArrayBuffer?e:e.buffer}},Se=``,Ce=(e,t)=>{let n=e.length,r=Array(n),i=0;e.forEach((e,a)=>{ue(e,!1,e=>{r[a]=e,++i===n&&t(r.join(Se))})})},we=(e,t)=>{let n=e.split(Se),r=[];for(let e=0;e<n.length;e++){let i=ye(n[e],t);if(r.push(i),i.type===`error`)break}return r};function Te(){return new TransformStream({transform(e,t){me(e,n=>{let r=n.length,i;if(r<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,r);else if(r<65536){i=new Uint8Array(3);let e=new DataView(i.buffer);e.setUint8(0,126),e.setUint16(1,r)}else{i=new Uint8Array(9);let e=new DataView(i.buffer);e.setUint8(0,127),e.setBigUint64(1,BigInt(r))}e.data&&typeof e.data!=`string`&&(i[0]|=128),t.enqueue(i),t.enqueue(n)})}})}var Ee;function De(e){return e.reduce((e,t)=>e+t.length,0)}function Oe(e,t){if(e[0].length===t)return e.shift();let n=new Uint8Array(t),r=0;for(let i=0;i<t;i++)n[i]=e[0][r++],r===e[0].length&&(e.shift(),r=0);return e.length&&r<e[0].length&&(e[0]=e[0].slice(r)),n}function ke(e,t){Ee||=new TextDecoder;let n=[],r=0,i=-1,a=!1;return new TransformStream({transform(o,s){for(n.push(o);;){if(r===0){if(De(n)<1)break;let e=Oe(n,1);a=(e[0]&128)==128,i=e[0]&127,r=i<126?3:i===126?1:2}else if(r===1){if(De(n)<2)break;let e=Oe(n,2);i=new DataView(e.buffer,e.byteOffset,e.length).getUint16(0),r=3}else if(r===2){if(De(n)<8)break;let e=Oe(n,8),t=new DataView(e.buffer,e.byteOffset,e.length),a=t.getUint32(0);if(a>2**21-1){s.enqueue(v);break}i=a*2**32+t.getUint32(4),r=3}else{if(De(n)<i)break;let e=Oe(n,i);s.enqueue(ye(a?e:Ee.decode(e),t)),r=0}if(i===0||i>e){s.enqueue(v);break}}}})}function y(e){if(e)return Ae(e)}function Ae(e){for(var t in y.prototype)e[t]=y.prototype[t];return e}y.prototype.on=y.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks[`$`+e]=this._callbacks[`$`+e]||[]).push(t),this},y.prototype.once=function(e,t){function n(){this.off(e,n),t.apply(this,arguments)}return n.fn=t,this.on(e,n),this},y.prototype.off=y.prototype.removeListener=y.prototype.removeAllListeners=y.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var n=this._callbacks[`$`+e];if(!n)return this;if(arguments.length==1)return delete this._callbacks[`$`+e],this;for(var r,i=0;i<n.length;i++)if(r=n[i],r===t||r.fn===t){n.splice(i,1);break}return n.length===0&&delete this._callbacks[`$`+e],this},y.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=Array(arguments.length-1),n=this._callbacks[`$`+e],r=1;r<arguments.length;r++)t[r-1]=arguments[r];if(n){n=n.slice(0);for(var r=0,i=n.length;r<i;++r)n[r].apply(this,t)}return this},y.prototype.emitReserved=y.prototype.emit,y.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks[`$`+e]||[]},y.prototype.hasListeners=function(e){return!!this.listeners(e).length};var b=typeof Promise==`function`&&typeof Promise.resolve==`function`?e=>Promise.resolve().then(e):(e,t)=>t(e,0),x=typeof self<`u`?self:typeof window<`u`?window:Function(`return this`)(),je=`arraybuffer`;function Me(e,...t){return t.reduce((t,n)=>(e.hasOwnProperty(n)&&(t[n]=e[n]),t),{})}var Ne=x.setTimeout,Pe=x.clearTimeout;function Fe(e,t){t.useNativeTimers?(e.setTimeoutFn=Ne.bind(x),e.clearTimeoutFn=Pe.bind(x)):(e.setTimeoutFn=x.setTimeout.bind(x),e.clearTimeoutFn=x.clearTimeout.bind(x))}var Ie=1.33;function Le(e){return typeof e==`string`?Re(e):Math.ceil((e.byteLength||e.size)*Ie)}function Re(e){let t=0,n=0;for(let r=0,i=e.length;r<i;r++)t=e.charCodeAt(r),t<128?n+=1:t<2048?n+=2:t<55296||t>=57344?n+=3:(r++,n+=4);return n}function ze(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Be(e){let t=``;for(let n in e)e.hasOwnProperty(n)&&(t.length&&(t+=`&`),t+=encodeURIComponent(n)+`=`+encodeURIComponent(e[n]));return t}function S(e){let t={},n=e.split(`&`);for(let e=0,r=n.length;e<r;e++){let r=n[e].split(`=`);t[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return t}var C=class extends Error{constructor(e,t,n){super(e),this.description=t,this.context=n,this.type=`TransportError`}},w=class extends y{constructor(e){super(),this.writable=!1,Fe(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,n){return super.emitReserved(`error`,new C(e,t,n)),this}open(){return this.readyState=`opening`,this.doOpen(),this}close(){return(this.readyState===`opening`||this.readyState===`open`)&&(this.doClose(),this.onClose()),this}send(e){this.readyState===`open`&&this.write(e)}onOpen(){this.readyState=`open`,this.writable=!0,super.emitReserved(`open`)}onData(e){let t=ye(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved(`packet`,e)}onClose(e){this.readyState=`closed`,super.emitReserved(`close`,e)}pause(e){}createUri(e,t={}){return e+`://`+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){let e=this.opts.hostname;return e.indexOf(`:`)===-1?e:`[`+e+`]`}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?`:`+this.opts.port:``}_query(e){let t=Be(e);return t.length?`?`+t:``}},Ve=class extends w{constructor(){super(...arguments),this._polling=!1}get name(){return`polling`}doOpen(){this._poll()}pause(e){this.readyState=`pausing`;let t=()=>{this.readyState=`paused`,e()};if(this._polling||!this.writable){let e=0;this._polling&&(e++,this.once(`pollComplete`,function(){--e||t()})),this.writable||(e++,this.once(`drain`,function(){--e||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved(`poll`)}onData(e){we(e,this.socket.binaryType).forEach(e=>{if(this.readyState===`opening`&&e.type===`open`&&this.onOpen(),e.type===`close`)return this.onClose({description:`transport closed by the server`}),!1;this.onPacket(e)}),this.readyState!==`closed`&&(this._polling=!1,this.emitReserved(`pollComplete`),this.readyState===`open`&&this._poll())}doClose(){let e=()=>{this.write([{type:`close`}])};this.readyState===`open`?e():this.once(`open`,e)}write(e){this.writable=!1,Ce(e,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved(`drain`)})})}uri(){let e=this.opts.secure?`https`:`http`,t=this.query||{};return!1!==this.opts.timestampRequests&&(t[this.opts.timestampParam]=ze()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}},He=!1;try{He=typeof XMLHttpRequest<`u`&&`withCredentials`in new XMLHttpRequest}catch{}var Ue=He;function We(){}var Ge=class extends Ve{constructor(e){if(super(e),typeof location<`u`){let t=location.protocol===`https:`,n=location.port;n||=t?`443`:`80`,this.xd=typeof location<`u`&&e.hostname!==location.hostname||n!==e.port}}doWrite(e,t){let n=this.request({method:`POST`,data:e});n.on(`success`,t),n.on(`error`,(e,t)=>{this.onError(`xhr post error`,e,t)})}doPoll(){let e=this.request();e.on(`data`,this.onData.bind(this)),e.on(`error`,(e,t)=>{this.onError(`xhr poll error`,e,t)}),this.pollXhr=e}},Ke=class e extends y{constructor(e,t,n){super(),this.createRequest=e,Fe(this,n),this._opts=n,this._method=n.method||`GET`,this._uri=t,this._data=n.data===void 0?null:n.data,this._create()}_create(){var t;let n=Me(this._opts,`agent`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`autoUnref`);n.xdomain=!!this._opts.xd;let r=this._xhr=this.createRequest(n);try{r.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){r.setDisableHeaderCheck&&r.setDisableHeaderCheck(!0);for(let e in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(e)&&r.setRequestHeader(e,this._opts.extraHeaders[e])}}catch{}if(this._method===`POST`)try{r.setRequestHeader(`Content-type`,`text/plain;charset=UTF-8`)}catch{}try{r.setRequestHeader(`Accept`,`*/*`)}catch{}(t=this._opts.cookieJar)==null||t.addCookies(r),`withCredentials`in r&&(r.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(r.timeout=this._opts.requestTimeout),r.onreadystatechange=()=>{var e;r.readyState===3&&((e=this._opts.cookieJar)==null||e.parseCookies(r.getResponseHeader(`set-cookie`))),r.readyState===4&&(r.status===200||r.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof r.status==`number`?r.status:0)},0))},r.send(this._data)}catch(e){this.setTimeoutFn(()=>{this._onError(e)},0);return}typeof document<`u`&&(this._index=e.requestsCount++,e.requests[this._index]=this)}_onError(e){this.emitReserved(`error`,e,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(this._xhr===void 0||this._xhr===null)){if(this._xhr.onreadystatechange=We,t)try{this._xhr.abort()}catch{}typeof document<`u`&&delete e.requests[this._index],this._xhr=null}}_onLoad(){let e=this._xhr.responseText;e!==null&&(this.emitReserved(`data`,e),this.emitReserved(`success`),this._cleanup())}abort(){this._cleanup()}};if(Ke.requestsCount=0,Ke.requests={},typeof document<`u`){if(typeof attachEvent==`function`)attachEvent(`onunload`,qe);else if(typeof addEventListener==`function`){let e=`onpagehide`in x?`pagehide`:`unload`;addEventListener(e,qe,!1)}}function qe(){for(let e in Ke.requests)Ke.requests.hasOwnProperty(e)&&Ke.requests[e].abort()}var Je=(function(){let e=Xe({xdomain:!1});return e&&e.responseType!==null})(),Ye=class extends Ge{constructor(e){super(e);let t=e&&e.forceBase64;this.supportsBinary=Je&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new Ke(Xe,this.uri(),e)}};function Xe(e){let t=e.xdomain;try{if(typeof XMLHttpRequest<`u`&&(!t||Ue))return new XMLHttpRequest}catch{}if(!t)try{return new x[[`Active`,`Object`].join(`X`)](`Microsoft.XMLHTTP`)}catch{}}var Ze=typeof navigator<`u`&&typeof navigator.product==`string`&&navigator.product.toLowerCase()===`reactnative`,Qe=class extends w{get name(){return`websocket`}doOpen(){let e=this.uri(),t=this.opts.protocols,n=Ze?{}:Me(this.opts,`agent`,`perMessageDeflate`,`pfx`,`key`,`passphrase`,`cert`,`ca`,`ciphers`,`rejectUnauthorized`,`localAddress`,`protocolVersion`,`origin`,`maxPayload`,`family`,`checkServerIdentity`);this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,n)}catch(e){return this.emitReserved(`error`,e)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:`websocket connection closed`,context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError(`websocket error`,e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;ue(n,this.supportsBinary,e=>{try{this.doWrite(n,e)}catch{}r&&b(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){this.ws!==void 0&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){let e=this.opts.secure?`wss`:`ws`,t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ze()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}},$e=x.WebSocket||x.MozWebSocket,et={websocket:class extends Qe{createSocket(e,t,n){return Ze?new $e(e,t,n):t?new $e(e,t):new $e(e)}doWrite(e,t){this.ws.send(t)}},webtransport:class extends w{get name(){return`webtransport`}doOpen(){try{this._transport=new WebTransport(this.createUri(`https`),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved(`error`,e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError(`webtransport error`,e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{let t=ke(2**53-1,this.socket.binaryType),n=e.readable.pipeThrough(t).getReader(),r=Te();r.readable.pipeTo(e.writable),this._writer=r.writable.getWriter();let i=()=>{n.read().then(({done:e,value:t})=>{e||(this.onPacket(t),i())}).catch(e=>{})};i();let a={type:`open`};this.query.sid&&(a.data=`{"sid":"${this.query.sid}"}`),this._writer.write(a).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){let n=e[t],r=t===e.length-1;this._writer.write(n).then(()=>{r&&b(()=>{this.writable=!0,this.emitReserved(`drain`)},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)==null||e.close()}},polling:Ye},tt=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,nt=[`source`,`protocol`,`authority`,`userInfo`,`user`,`password`,`host`,`port`,`relative`,`path`,`directory`,`file`,`query`,`anchor`];function rt(e){if(e.length>8e3)throw`URI too long`;let t=e,n=e.indexOf(`[`),r=e.indexOf(`]`);n!=-1&&r!=-1&&(e=e.substring(0,n)+e.substring(n,r).replace(/:/g,`;`)+e.substring(r,e.length));let i=tt.exec(e||``),a={},o=14;for(;o--;)a[nt[o]]=i[o]||``;return n!=-1&&r!=-1&&(a.source=t,a.host=a.host.substring(1,a.host.length-1).replace(/;/g,`:`),a.authority=a.authority.replace(`[`,``).replace(`]`,``).replace(/;/g,`:`),a.ipv6uri=!0),a.pathNames=it(a,a.path),a.queryKey=at(a,a.query),a}function it(e,t){let n=t.replace(/\/{2,9}/g,`/`).split(`/`);return(t.slice(0,1)==`/`||t.length===0)&&n.splice(0,1),t.slice(-1)==`/`&&n.splice(n.length-1,1),n}function at(e,t){let n={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(e,t,r){t&&(n[t]=r)}),n}var ot=typeof addEventListener==`function`&&typeof removeEventListener==`function`,st=[];ot&&addEventListener(`offline`,()=>{st.forEach(e=>e())},!1);var ct=class e extends y{constructor(e,t){if(super(),this.binaryType=je,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e==`object`&&(t=e,e=null),e){let n=rt(e);t.hostname=n.host,t.secure=n.protocol===`https`||n.protocol===`wss`,t.port=n.port,n.query&&(t.query=n.query)}else t.host&&(t.hostname=rt(t.host).host);Fe(this,t),this.secure=t.secure==null?typeof location<`u`&&location.protocol===`https:`:t.secure,t.hostname&&!t.port&&(t.port=this.secure?`443`:`80`),this.hostname=t.hostname||(typeof location<`u`?location.hostname:`localhost`),this.port=t.port||(typeof location<`u`&&location.port?location.port:this.secure?`443`:`80`),this.transports=[],this._transportsByName={},t.transports.forEach(e=>{let t=e.prototype.name;this.transports.push(t),this._transportsByName[t]=e}),this.opts=Object.assign({path:`/engine.io`,agent:!1,withCredentials:!1,upgrade:!0,timestampParam:`t`,rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,``)+(this.opts.addTrailingSlash?`/`:``),typeof this.opts.query==`string`&&(this.opts.query=S(this.opts.query)),ot&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener(`beforeunload`,this._beforeunloadEventListener,!1)),this.hostname!==`localhost`&&(this._offlineEventListener=()=>{this._onClose(`transport close`,{description:`network connection lost`})},st.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){let t=Object.assign({},this.opts.query);t.EIO=4,t.transport=e,this.id&&(t.sid=this.id);let n=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved(`error`,`No transports available`)},0);return}let t=this.opts.rememberUpgrade&&e.priorWebsocketSuccess&&this.transports.indexOf(`websocket`)!==-1?`websocket`:this.transports[0];this.readyState=`opening`;let n=this.createTransport(t);n.open(),this.setTransport(n)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on(`drain`,this._onDrain.bind(this)).on(`packet`,this._onPacket.bind(this)).on(`error`,this._onError.bind(this)).on(`close`,e=>this._onClose(`transport close`,e))}onOpen(){this.readyState=`open`,e.priorWebsocketSuccess=this.transport.name===`websocket`,this.emitReserved(`open`),this.flush()}_onPacket(e){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`)switch(this.emitReserved(`packet`,e),this.emitReserved(`heartbeat`),e.type){case`open`:this.onHandshake(JSON.parse(e.data));break;case`ping`:this._sendPacket(`pong`),this.emitReserved(`ping`),this.emitReserved(`pong`),this._resetPingTimeout();break;case`error`:let t=Error(`server error`);t.code=e.data,this._onError(t);break;case`message`:this.emitReserved(`data`,e.data),this.emitReserved(`message`,e.data);break}}onHandshake(e){this.emitReserved(`handshake`,e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!==`closed`&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);let e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose(`ping timeout`)},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved(`drain`):this.flush()}flush(){if(this.readyState!==`closed`&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){let e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved(`flush`)}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name===`polling`&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let t=0;t<this.writeBuffer.length;t++){let n=this.writeBuffer[t].data;if(n&&(e+=Le(n)),t>0&&e>this._maxPayload)return this.writeBuffer.slice(0,t);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;let e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,b(()=>{this._onClose(`ping timeout`)},this.setTimeoutFn)),e}write(e,t,n){return this._sendPacket(`message`,e,t,n),this}send(e,t,n){return this._sendPacket(`message`,e,t,n),this}_sendPacket(e,t,n,r){if(typeof t==`function`&&(r=t,t=void 0),typeof n==`function`&&(r=n,n=null),this.readyState===`closing`||this.readyState===`closed`)return;n||={},n.compress=!1!==n.compress;let i={type:e,data:t,options:n};this.emitReserved(`packetCreate`,i),this.writeBuffer.push(i),r&&this.once(`flush`,r),this.flush()}close(){let e=()=>{this._onClose(`forced close`),this.transport.close()},t=()=>{this.off(`upgrade`,t),this.off(`upgradeError`,t),e()},n=()=>{this.once(`upgrade`,t),this.once(`upgradeError`,t)};return(this.readyState===`opening`||this.readyState===`open`)&&(this.readyState=`closing`,this.writeBuffer.length?this.once(`drain`,()=>{this.upgrading?n():e()}):this.upgrading?n():e()),this}_onError(t){if(e.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState===`opening`)return this.transports.shift(),this._open();this.emitReserved(`error`,t),this._onClose(`transport error`,t)}_onClose(e,t){if(this.readyState===`opening`||this.readyState===`open`||this.readyState===`closing`){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners(`close`),this.transport.close(),this.transport.removeAllListeners(),ot&&(this._beforeunloadEventListener&&removeEventListener(`beforeunload`,this._beforeunloadEventListener,!1),this._offlineEventListener)){let e=st.indexOf(this._offlineEventListener);e!==-1&&st.splice(e,1)}this.readyState=`closed`,this.id=null,this.emitReserved(`close`,e,t),this.writeBuffer=[],this._prevBufferLen=0}}};ct.protocol=4;var lt=class extends ct{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState===`open`&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),n=!1;ct.priorWebsocketSuccess=!1;let r=()=>{n||(t.send([{type:`ping`,data:`probe`}]),t.once(`packet`,e=>{if(!n)if(e.type===`pong`&&e.data===`probe`){if(this.upgrading=!0,this.emitReserved(`upgrading`,t),!t)return;ct.priorWebsocketSuccess=t.name===`websocket`,this.transport.pause(()=>{n||this.readyState!==`closed`&&(l(),this.setTransport(t),t.send([{type:`upgrade`}]),this.emitReserved(`upgrade`,t),t=null,this.upgrading=!1,this.flush())})}else{let e=Error(`probe error`);e.transport=t.name,this.emitReserved(`upgradeError`,e)}}))};function i(){n||(n=!0,l(),t.close(),t=null)}let a=e=>{let n=Error(`probe error: `+e);n.transport=t.name,i(),this.emitReserved(`upgradeError`,n)};function o(){a(`transport closed`)}function s(){a(`socket closed`)}function c(e){t&&e.name!==t.name&&i()}let l=()=>{t.removeListener(`open`,r),t.removeListener(`error`,a),t.removeListener(`close`,o),this.off(`close`,s),this.off(`upgrading`,c)};t.once(`open`,r),t.once(`error`,a),t.once(`close`,o),this.once(`close`,s),this.once(`upgrading`,c),this._upgrades.indexOf(`webtransport`)!==-1&&e!==`webtransport`?this.setTimeoutFn(()=>{n||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){let t=[];for(let n=0;n<e.length;n++)~this.transports.indexOf(e[n])&&t.push(e[n]);return t}},ut=class extends lt{constructor(e,t={}){let n=typeof e==`object`?e:t;(!n.transports||n.transports&&typeof n.transports[0]==`string`)&&(n.transports=(n.transports||[`polling`,`websocket`,`webtransport`]).map(e=>et[e]).filter(e=>!!e)),super(e,n)}};ut.protocol;function dt(e,t=``,n){let r=e;n||=typeof location<`u`&&location,e??=n.protocol+`//`+n.host,typeof e==`string`&&(e.charAt(0)===`/`&&(e=e.charAt(1)===`/`?n.protocol+e:n.host+e),/^(https?|wss?):\/\//.test(e)||(e=n===void 0?`https://`+e:n.protocol+`//`+e),r=rt(e)),r.port||(/^(http|ws)$/.test(r.protocol)?r.port=`80`:/^(http|ws)s$/.test(r.protocol)&&(r.port=`443`)),r.path=r.path||`/`;let i=r.host.indexOf(`:`)===-1?r.host:`[`+r.host+`]`;return r.id=r.protocol+`://`+i+`:`+r.port+t,r.href=r.protocol+`://`+i+(n&&n.port===r.port?``:`:`+r.port),r}var ft=typeof ArrayBuffer==`function`,pt=e=>typeof ArrayBuffer.isView==`function`?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,mt=Object.prototype.toString,ht=typeof Blob==`function`||typeof Blob<`u`&&mt.call(Blob)===`[object BlobConstructor]`,gt=typeof File==`function`||typeof File<`u`&&mt.call(File)===`[object FileConstructor]`;function _t(e){return ft&&(e instanceof ArrayBuffer||pt(e))||ht&&e instanceof Blob||gt&&e instanceof File}function vt(e,t){if(!e||typeof e!=`object`)return!1;if(Array.isArray(e)){for(let t=0,n=e.length;t<n;t++)if(vt(e[t]))return!0;return!1}if(_t(e))return!0;if(e.toJSON&&typeof e.toJSON==`function`&&arguments.length===1)return vt(e.toJSON(),!0);for(let t in e)if(Object.prototype.hasOwnProperty.call(e,t)&&vt(e[t]))return!0;return!1}function yt(e){let t=[],n=e.data,r=e;return r.data=bt(n,t),r.attachments=t.length,{packet:r,buffers:t}}function bt(e,t){if(!e)return e;if(_t(e)){let n={_placeholder:!0,num:t.length};return t.push(e),n}else if(Array.isArray(e)){let n=Array(e.length);for(let r=0;r<e.length;r++)n[r]=bt(e[r],t);return n}else if(typeof e==`object`&&!(e instanceof Date)){let n={};for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(n[r]=bt(e[r],t));return n}return e}function xt(e,t){return e.data=St(e.data,t),delete e.attachments,e}function St(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num==`number`&&e.num>=0&&e.num<t.length)return t[e.num];throw Error(`illegal attachments`)}else if(Array.isArray(e))for(let n=0;n<e.length;n++)e[n]=St(e[n],t);else if(typeof e==`object`)for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&(e[n]=St(e[n],t));return e}var Ct=o({Decoder:()=>Et,Encoder:()=>Tt,PacketType:()=>T,isPacketValid:()=>Nt,protocol:()=>5}),wt=[`connect`,`connect_error`,`disconnect`,`disconnecting`,`newListener`,`removeListener`],T;(function(e){e[e.CONNECT=0]=`CONNECT`,e[e.DISCONNECT=1]=`DISCONNECT`,e[e.EVENT=2]=`EVENT`,e[e.ACK=3]=`ACK`,e[e.CONNECT_ERROR=4]=`CONNECT_ERROR`,e[e.BINARY_EVENT=5]=`BINARY_EVENT`,e[e.BINARY_ACK=6]=`BINARY_ACK`})(T||={});var Tt=class{constructor(e){this.replacer=e}encode(e){return(e.type===T.EVENT||e.type===T.ACK)&&vt(e)?this.encodeAsBinary({type:e.type===T.EVENT?T.BINARY_EVENT:T.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=``+e.type;return(e.type===T.BINARY_EVENT||e.type===T.BINARY_ACK)&&(t+=e.attachments+`-`),e.nsp&&e.nsp!==`/`&&(t+=e.nsp+`,`),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){let t=yt(e),n=this.encodeAsString(t.packet),r=t.buffers;return r.unshift(n),r}},Et=class e extends y{constructor(e){super(),this.opts=Object.assign({reviver:void 0,maxAttachments:10},typeof e==`function`?{reviver:e}:e)}add(e){let t;if(typeof e==`string`){if(this.reconstructor)throw Error(`got plaintext data when reconstructing a packet`);t=this.decodeString(e);let n=t.type===T.BINARY_EVENT;n||t.type===T.BINARY_ACK?(t.type=n?T.EVENT:T.ACK,this.reconstructor=new Dt(t),t.attachments===0&&super.emitReserved(`decoded`,t)):super.emitReserved(`decoded`,t)}else if(_t(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved(`decoded`,t));else throw Error(`got binary data when not reconstructing a packet`);else throw Error(`Unknown type: `+e)}decodeString(t){let n=0,r={type:Number(t.charAt(0))};if(T[r.type]===void 0)throw Error(`unknown packet type `+r.type);if(r.type===T.BINARY_EVENT||r.type===T.BINARY_ACK){let e=n+1;for(;t.charAt(++n)!==`-`&&n!=t.length;);let i=t.substring(e,n);if(i!=Number(i)||t.charAt(n)!==`-`)throw Error(`Illegal attachments`);let a=Number(i);if(!kt(a)||a<0)throw Error(`Illegal attachments`);if(a>this.opts.maxAttachments)throw Error(`too many attachments`);r.attachments=a}if(t.charAt(n+1)===`/`){let e=n+1;for(;++n&&!(t.charAt(n)===`,`||n===t.length););r.nsp=t.substring(e,n)}else r.nsp=`/`;let i=t.charAt(n+1);if(i!==``&&Number(i)==i){let e=n+1;for(;++n;){let e=t.charAt(n);if(e==null||Number(e)!=e){--n;break}if(n===t.length)break}r.id=Number(t.substring(e,n+1))}if(t.charAt(++n)){let i=this.tryParse(t.substr(n));if(e.isPayloadValid(r.type,i))r.data=i;else throw Error(`invalid payload`)}return r}tryParse(e){try{return JSON.parse(e,this.opts.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case T.CONNECT:return jt(t);case T.DISCONNECT:return t===void 0;case T.CONNECT_ERROR:return typeof t==`string`||jt(t);case T.EVENT:case T.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&wt.indexOf(t[0])===-1);case T.ACK:case T.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&=(this.reconstructor.finishedReconstruction(),null)}},Dt=class{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){let e=xt(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}};function Ot(e){return typeof e==`string`}var kt=Number.isInteger||function(e){return typeof e==`number`&&isFinite(e)&&Math.floor(e)===e};function At(e){return e===void 0||kt(e)}function jt(e){return Object.prototype.toString.call(e)===`[object Object]`}function Mt(e,t){switch(e){case T.CONNECT:return t===void 0||jt(t);case T.DISCONNECT:return t===void 0;case T.EVENT:return Array.isArray(t)&&(typeof t[0]==`number`||typeof t[0]==`string`&&wt.indexOf(t[0])===-1);case T.ACK:return Array.isArray(t);case T.CONNECT_ERROR:return typeof t==`string`||jt(t);default:return!1}}function Nt(e){return Ot(e.nsp)&&At(e.id)&&Mt(e.type,e.data)}function Pt(e,t,n){return e.on(t,n),function(){e.off(t,n)}}var Ft=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1}),It=class extends y{constructor(e,t,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;let e=this.io;this.subs=[Pt(e,`open`,this.onopen.bind(this)),Pt(e,`packet`,this.onpacket.bind(this)),Pt(e,`error`,this.onerror.bind(this)),Pt(e,`close`,this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState===`open`&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift(`message`),this.emit.apply(this,e),this}emit(e,...t){if(Ft.hasOwnProperty(e))throw Error(`"`+e.toString()+`" is a reserved event name`);if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;let n={type:T.EVENT,data:t};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof t[t.length-1]==`function`){let e=this.ids++,r=t.pop();this._registerAckCallback(e,r),n.id=e}let r=this.io.engine?.transport?.writable,i=this.connected&&!this.io.engine?._hasPingExpired();return this.flags.volatile&&!r||(i?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(e,t){let n=this.flags.timeout??this._opts.ackTimeout;if(n===void 0){this.acks[e]=t;return}let r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let t=0;t<this.sendBuffer.length;t++)this.sendBuffer[t].id===e&&this.sendBuffer.splice(t,1);t.call(this,Error(`operation has timed out`))},n),i=(...e)=>{this.io.clearTimeoutFn(r),t.apply(this,e)};i.withError=!0,this.acks[e]=i}emitWithAck(e,...t){return new Promise((n,r)=>{let i=(e,t)=>e?r(e):n(t);i.withError=!0,t.push(i),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]==`function`&&(t=e.pop());let n={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((e,...r)=>(this._queue[0],e===null?(this._queue.shift(),t&&t(null,...r)):n.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(e)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;let t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth==`function`?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:T.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved(`connect_error`,e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved(`disconnect`,e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(t=>String(t.id)===e)){let t=this.acks[e];delete this.acks[e],t.withError&&t.call(this,Error(`socket has been disconnected`))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case T.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved(`connect_error`,Error(`It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)`));break;case T.EVENT:case T.BINARY_EVENT:this.onevent(e);break;case T.ACK:case T.BINARY_ACK:this.onack(e);break;case T.DISCONNECT:this.ondisconnect();break;case T.CONNECT_ERROR:this.destroy();let t=Error(e.data.message);t.data=e.data.data,this.emitReserved(`connect_error`,t);break}}onevent(e){let t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){let t=this._anyListeners.slice();for(let n of t)n.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]==`string`&&(this._lastOffset=e[e.length-1])}ack(e){let t=this,n=!1;return function(...r){n||(n=!0,t.packet({type:T.ACK,id:e,data:r}))}}onack(e){let t=this.acks[e.id];typeof t==`function`&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved(`connect`)}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose(`io server disconnect`)}destroy(){this.subs&&=(this.subs.forEach(e=>e()),void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:T.DISCONNECT}),this.destroy(),this.connected&&this.onclose(`io client disconnect`),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){let t=this._anyListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){let t=this._anyOutgoingListeners;for(let n=0;n<t.length;n++)if(e===t[n])return t.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){let t=this._anyOutgoingListeners.slice();for(let n of t)n.apply(this,e.data)}}};function Lt(e){e||={},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}Lt.prototype.duration=function(){var e=this.ms*this.factor**+ this.attempts++;if(this.jitter){var t=Math.random(),n=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+n:e-n}return Math.min(e,this.max)|0},Lt.prototype.reset=function(){this.attempts=0},Lt.prototype.setMin=function(e){this.ms=e},Lt.prototype.setMax=function(e){this.max=e},Lt.prototype.setJitter=function(e){this.jitter=e};var Rt=class extends y{constructor(e,t){super(),this.nsps={},this.subs=[],e&&typeof e==`object`&&(t=e,e=void 0),t||={},t.path=t.path||`/socket.io`,this.opts=t,Fe(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor(t.randomizationFactor??.5),this.backoff=new Lt({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState=`closed`,this.uri=e;let n=t.parser||Ct;this.encoder=new n.Encoder,this.decoder=new n.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)==null||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)==null||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)==null||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf(`open`))return this;this.engine=new ut(this.uri,this.opts);let t=this.engine,n=this;this._readyState=`opening`,this.skipReconnect=!1;let r=Pt(t,`open`,function(){n.onopen(),e&&e()}),i=t=>{this.cleanup(),this._readyState=`closed`,this.emitReserved(`error`,t),e?e(t):this.maybeReconnectOnOpen()},a=Pt(t,`error`,i);if(!1!==this._timeout){let e=this._timeout,n=this.setTimeoutFn(()=>{r(),i(Error(`timeout`)),t.close()},e);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}return this.subs.push(r),this.subs.push(a),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState=`open`,this.emitReserved(`open`);let e=this.engine;this.subs.push(Pt(e,`ping`,this.onping.bind(this)),Pt(e,`data`,this.ondata.bind(this)),Pt(e,`error`,this.onerror.bind(this)),Pt(e,`close`,this.onclose.bind(this)),Pt(this.decoder,`decoded`,this.ondecoded.bind(this)))}onping(){this.emitReserved(`ping`)}ondata(e){try{this.decoder.add(e)}catch(e){this.onclose(`parse error`,e)}}ondecoded(e){b(()=>{this.emitReserved(`packet`,e)},this.setTimeoutFn)}onerror(e){this.emitReserved(`error`,e)}socket(e,t){let n=this.nsps[e];return n?this._autoConnect&&!n.active&&n.connect():(n=new It(this,e,t),this.nsps[e]=n),n}_destroy(e){let t=Object.keys(this.nsps);for(let e of t)if(this.nsps[e].active)return;this._close()}_packet(e){let t=this.encoder.encode(e);for(let n=0;n<t.length;n++)this.engine.write(t[n],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose(`forced close`)}disconnect(){return this._close()}onclose(e,t){var n;this.cleanup(),(n=this.engine)==null||n.close(),this.backoff.reset(),this._readyState=`closed`,this.emitReserved(`close`,e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;let e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved(`reconnect_failed`),this._reconnecting=!1;else{let t=this.backoff.duration();this._reconnecting=!0;let n=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved(`reconnect_attempt`,e.backoff.attempts),!e.skipReconnect&&e.open(t=>{t?(e._reconnecting=!1,e.reconnect(),this.emitReserved(`reconnect_error`,t)):e.onreconnect()}))},t);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){let e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved(`reconnect`,e)}},zt={};function Bt(e,t){typeof e==`object`&&(t=e,e=void 0),t||={};let n=dt(e,t.path||`/socket.io`),r=n.source,i=n.id,a=n.path,o=zt[i]&&a in zt[i].nsps,s=t.forceNew||t[`force new connection`]||!1===t.multiplex||o,c;return s?c=new Rt(r,t):(zt[i]||(zt[i]=new Rt(r,t)),c=zt[i]),n.query&&!t.query&&(t.query=n.queryKey),c.socket(n.path,t)}Object.assign(Bt,{Manager:Rt,Socket:It,io:Bt,connect:Bt});var Vt=({apiBaseUrl:e,userId:t,chatId:n,siteId:r})=>Bt(e,{transports:[`polling`,`websocket`],upgrade:!0,rememberUpgrade:!1,auth:{userId:t,chatId:n,siteId:r},query:{chatId:n,siteId:r}}),Ht=({socket:e,chatId:t})=>{if(!e||!t||typeof window>`u`)return()=>{};let n=window.location.pathname+window.location.search,r=Date.now(),i=()=>{console.log(`[FlowEngageTracking] visitor:session_start`,{chatId:t,path:n}),e.emit(`visitor:session_start`,{chatId:t,path:n,title:document.title,referrer:document.referrer,userAgent:navigator.userAgent,timestamp:Date.now()})},a=()=>{console.log(`[FlowEngageTracking] visitor:page_enter`,{chatId:t,path:n}),e.emit(`visitor:page_enter`,{chatId:t,path:n,title:document.title,timestamp:Date.now()})},o=(n,r)=>{console.log(`[FlowEngageTracking] visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3))}),e.emit(`visitor:page_leave`,{chatId:t,path:n,duration:Math.max(0,Math.floor((Date.now()-r)/1e3)),timestamp:Date.now()})},s=()=>{console.log(`[FlowEngageTracking] visitor:heartbeat`,{chatId:t,path:n}),e.emit(`visitor:heartbeat`,{chatId:t,timestamp:Date.now()})},c=()=>{let e=window.location.pathname+window.location.search;if(e===n){console.log(`[FlowEngageTracking] route unchanged`,{currentPath:n});return}console.log(`[FlowEngageTracking] route changed`,{from:n,to:e}),o(n,r),n=e,r=Date.now(),a()},l=window.history.pushState.bind(window.history),u=window.history.replaceState.bind(window.history);window.history.pushState=(...e)=>{l(...e),c()},window.history.replaceState=(...e)=>{u(...e),c()};let d=window.setInterval(s,p),f=()=>{o(n,r),e.emit(`visitor:session_end`,{chatId:t,timestamp:Date.now()})};return window.addEventListener(`popstate`,c),window.addEventListener(`hashchange`,c),window.addEventListener(`beforeunload`,f),i(),s(),{notifyRouteChange:c,cleanup:()=>{window.clearInterval(d),window.history.pushState=l,window.history.replaceState=u,window.removeEventListener(`popstate`,c),window.removeEventListener(`hashchange`,c),window.removeEventListener(`beforeunload`,f)}}},Ut=(0,l.createContext)(null),Wt=()=>{let e=(0,l.useContext)(Ut);if(!e)throw Error(`useFlowEngage must be used inside FlowEngageProvider`);return e},Gt=()=>{if(typeof document>`u`||document.getElementById(`fe-highlight-styles`))return;let e=document.createElement(`style`);e.id=`fe-highlight-styles`,e.textContent=`
2
2
  .fe-highlight-section {
3
3
  outline: 3px solid #7c3aed !important;
4
4
  box-shadow: 0 0 15px rgba(124, 58, 237, 0.6) !important;
@@ -311,15 +311,15 @@ class ScribeAudioProcessor extends AudioWorkletProcessor {
311
311
 
312
312
  registerProcessor("scribeAudioProcessor", ScribeAudioProcessor);
313
313
 
314
- `),eh,th;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(eh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(th||={});var nh=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new Qm(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await $m(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};nh.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var rh=class extends Om{static startSession(e){return e.textOnly?Gm.startSession(e):Xm.startSession(e)}},ih={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},ah={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function oh({agentId:e,chatId:t,onEnd:n,historyRef:r,hasSyncedRef:i,onMessageSync:a,onStartSync:o}){let[s,c]=(0,l.useState)(`idle`),[d,f]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),[ee,te]=(0,l.useState)([]),h=(0,l.useRef)(null),ne=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=!1,n=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let i=await rh.startSession({agentId:e,onModeChange:({mode:e})=>{t||c(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,i=e.message||e.text||e.content||``;if(!i)return;let a={sender:n,message:i,timestamp:new Date().toISOString()};r.current=[...r.current,a],te(e=>[...e,a])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),c(`error`),f(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),m(!1),c(`idle`))}});if(t){i.endSession().catch(()=>{});return}n=i,h.current=i,m(!0),c(`listening`),typeof o==`function`&&o()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),c(`error`),f(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,n?n.endSession().catch(()=>{}):h.current&&h.current.endSession().catch(()=>{})}},[e,r,o]);let g=(0,l.useCallback)(async()=>{try{await h.current?.endSession?.()}catch{}h.current=null,m(!1),c(`idle`),typeof a==`function`&&await a(r.current),typeof n==`function`&&n()},[r,a,n]),re=s===`listening`||s===`speaking`,ie=ah[s]||ah.idle,ae=ih[s]||ih.idle;return(0,u.jsxs)(`div`,{ref:ne,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,u.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[re&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${ie}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),re&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${ie}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,u.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:ae,border:`3px solid ${ie}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:s===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${ae}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,u.jsx)(an,{size:44,color:ie})})]}),(0,u.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:s===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[s===`idle`&&`Starting voice session…`,s===`listening`&&`Listening…`,s===`speaking`&&`AI is speaking…`,s===`error`&&(d||`Error`)]}),ee.length>0&&(0,u.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:ee.map((e,t)=>(0,u.jsx)(`div`,{style:{display:`flex`,justifyContent:e.role===`user`?`flex-end`:`flex-start`},children:(0,u.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.role===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.role===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,u.jsxs)(`button`,{onClick:g,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,u.jsx)(on,{size:18}),`End Voice Session`]}),(0,u.jsx)(`style`,{children:`
314
+ `),eh,th;(function(e){e.PCM_8000=`pcm_8000`,e.PCM_16000=`pcm_16000`,e.PCM_22050=`pcm_22050`,e.PCM_24000=`pcm_24000`,e.PCM_44100=`pcm_44100`,e.PCM_48000=`pcm_48000`,e.ULAW_8000=`ulaw_8000`})(eh||={}),function(e){e.MANUAL=`manual`,e.VAD=`vad`}(th||={});var nh=class e{static getWebSocketUri(t=e.DEFAULT_BASE_URI){return`${t}/v1/speech-to-text/realtime`}static buildWebSocketUri(t){let n=e.getWebSocketUri(t.baseUri),r=new URLSearchParams;if(r.append(`model_id`,t.modelId),r.append(`token`,t.token),t.commitStrategy!==void 0&&r.append(`commit_strategy`,t.commitStrategy),t.audioFormat!==void 0&&r.append(`audio_format`,t.audioFormat),t.vadSilenceThresholdSecs!==void 0){if(t.vadSilenceThresholdSecs<=.3||t.vadSilenceThresholdSecs>3)throw Error(`vadSilenceThresholdSecs must be between 0.3 and 3.0`);r.append(`vad_silence_threshold_secs`,t.vadSilenceThresholdSecs.toString())}if(t.vadThreshold!==void 0){if(t.vadThreshold<.1||t.vadThreshold>.9)throw Error(`vadThreshold must be between 0.1 and 0.9`);r.append(`vad_threshold`,t.vadThreshold.toString())}if(t.minSpeechDurationMs!==void 0){if(t.minSpeechDurationMs<=50||t.minSpeechDurationMs>2e3)throw Error(`minSpeechDurationMs must be between 50 and 2000`);r.append(`min_speech_duration_ms`,t.minSpeechDurationMs.toString())}if(t.minSilenceDurationMs!==void 0){if(t.minSilenceDurationMs<=50||t.minSilenceDurationMs>2e3)throw Error(`minSilenceDurationMs must be between 50 and 2000`);r.append(`min_silence_duration_ms`,t.minSilenceDurationMs.toString())}t.languageCode!==void 0&&r.append(`language_code`,t.languageCode),t.includeTimestamps!==void 0&&r.append(`include_timestamps`,t.includeTimestamps?`true`:`false`);let i=r.toString();return i?`${n}?${i}`:n}static connect(t){if(!t.modelId)throw Error(`modelId is required`);let n=new Qm(`microphone`in t&&t.microphone?16e3:t.sampleRate),r=e.buildWebSocketUri(t),i=new WebSocket(r);return`microphone`in t&&t.microphone&&i.addEventListener(`open`,()=>{e.streamFromMicrophone(t,n)}),n.setWebSocket(i),n}static async streamFromMicrophone(e,t){try{var n,r,i;let a=await navigator.mediaDevices.getUserMedia({audio:{deviceId:e.microphone?.deviceId,echoCancellation:(n=e.microphone?.echoCancellation)==null||n,noiseSuppression:(r=e.microphone?.noiseSuppression)==null||r,autoGainControl:(i=e.microphone?.autoGainControl)==null||i,channelCount:e.microphone?.channelCount??1,sampleRate:{ideal:16e3}}}),o=new AudioContext({sampleRate:16e3});await $m(o.audioWorklet);let s=o.createMediaStreamSource(a),c=new AudioWorkletNode(o,`scribeAudioProcessor`);c.port.onmessage=e=>{let{audioData:n}=e.data,r=new Uint8Array(n),i=``;for(let e=0;e<r.length;e++)i+=String.fromCharCode(r[e]);let a=btoa(i);t.send({audioBase64:a})},s.connect(c),o.state===`suspended`&&await o.resume(),t._audioCleanup=()=>{a.getTracks().forEach(e=>{e.stop()}),s.disconnect(),c.disconnect(),o.close()}}catch(e){throw console.error(`Failed to start microphone streaming:`,e),e}}};nh.DEFAULT_BASE_URI=`wss://api.elevenlabs.io`;var rh=class extends Om{static startSession(e){return e.textOnly?Gm.startSession(e):Xm.startSession(e)}};function ih(e){if(e.labels&&e.labels.length)return e.labels[0].textContent?.trim()||null;let t=e.id;if(t)try{let e=document.querySelector(`label[for="${CSS.escape(t)}"]`);if(e)return e.textContent?.trim()||null}catch{let e=document.querySelector(`label[for="${t.replace(/"/g,`\\"`)}"]`);if(e)return e.textContent?.trim()||null}let n=e.parentElement;for(let e=0;e<4&&n;e+=1){if(n.tagName===`LABEL`)return n.textContent?.trim()||null;n=n.parentElement}return null}function ah(){let e=Array.from(document.querySelectorAll(`form`)),t=[];return e.forEach((e,n)=>{Array.from(e.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}).forEach((e,r)=>{t.push({formIndex:n,fieldIndex:r,tag:e.tagName,type:e.type||`text`,name:e.name||null,id:e.id||null,label:ih(e),placeholder:e.placeholder||null})})}),t}function oh(e,t){let n=String(t||``).toLowerCase().trim();return n?[e.name,e.id,e.placeholder,ih(e),e.getAttribute(`aria-label`)].filter(Boolean).map(e=>String(e).toLowerCase()).some(e=>e.includes(n)||n.includes(e)):!1}function sh(e,t){let n=e.tagName,r=(e.type||``).toLowerCase();return n===`SELECT`?(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):r===`checkbox`||r===`radio`?(e.checked=[`1`,`true`,`yes`,`on`].includes(String(t).toLowerCase().trim()),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0):(e.value=String(t),e.dispatchEvent(new Event(`input`,{bubbles:!0})),e.dispatchEvent(new Event(`change`,{bubbles:!0})),!0)}function ch(e){let t=e.siteId||null,n=(e.apiBaseUrl||``).replace(/\/$/,``);return{navigate_to_page:async e=>{let t=e?.url,n=e?.section_text||e?.sectionText;if(!t||typeof t!=`string`)return`Missing url`;if(await Yt(t),await new Promise(e=>setTimeout(e,350)),n&&typeof n==`string`){let e=Kt(null,n);e&&qt(e)}return`Navigated to ${t}`},highlight_on_page:async e=>{let t=e?.section_id||e?.sectionId,n=e?.section_text||e?.sectionText,r=Kt(t||null,n||null);return r?(qt(r),`Highlighted the section.`):`Could not find that section on the page.`},search_site_content:async e=>{let r=e?.query;if(!r||typeof r!=`string`)return`Missing query parameter.`;if(!t)return`Site is not configured for search.`;if(!n)return`API base URL is missing; cannot search.`;try{let e=await(await fetch(`${n}/api/site-tools/search`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({siteId:t,query:r,currentUrl:typeof window<`u`?window.location.href:``})})).json();return e.success?JSON.stringify(e.results||[]):e.error||`Search failed.`}catch(e){return`Search error: ${e.message||`network`}`}},list_page_forms:async()=>JSON.stringify(ah()),fill_form_fields:async e=>{let t=e?.fields;if(!Array.isArray(t)||t.length===0)return`No fields provided. Use list_page_forms first.`;let n=Array.from(document.querySelectorAll(`input, select, textarea`)).filter(e=>{let t=(e.type||``).toLowerCase();return![`hidden`,`submit`,`button`,`image`].includes(t)}),r=[];for(let e of t){let t=e?.field_key??e?.fieldKey,i=e?.value;if(t==null||i==null)continue;let a=n.find(e=>oh(e,t));a&&(sh(a,i),r.push(String(t)))}return r.length?`Filled fields: ${r.join(`, `)}`:`Could not match any fields. Call list_page_forms and use matching field_key values.`}}}var lh={idle:`rgba(99,102,241,0.18)`,listening:`rgba(16,185,129,0.25)`,speaking:`rgba(245,158,11,0.25)`,error:`rgba(239,68,68,0.2)`},uh={idle:`#6366f1`,listening:`#10b981`,speaking:`#f59e0b`,error:`#ef4444`};function dh({agentId:e,chatId:t,siteId:n,apiBaseUrl:r,onEnd:i,historyRef:a,hasSyncedRef:o,onMessageSync:s,onStartSync:c}){let[d,f]=(0,l.useState)(`idle`),[p,m]=(0,l.useState)(null),[ee,te]=(0,l.useState)(!1),[h,ne]=(0,l.useState)([]),g=(0,l.useRef)(null),re=(0,l.useRef)(null);(0,l.useEffect)(()=>{let t=!1,i=null;return(async()=>{try{if(await navigator.mediaDevices.getUserMedia({audio:!0}),t)return;let o=ch({siteId:n||null,apiBaseUrl:r||null}),s=await rh.startSession({agentId:e,clientTools:o,onModeChange:({mode:e})=>{t||f(e===`speaking`?`speaking`:`listening`)},onMessage:e=>{if(t)return;let n=e.role===`user`?`user`:`bot`,r=e.message||e.text||e.content||``;if(!r)return;let i={sender:n,message:r,timestamp:new Date().toISOString()};a.current=[...a.current,i],ne(e=>[...e,i])},onError:e=>{t||(console.error(`[VoiceInterface] ElevenLabs error`,e),f(`error`),m(`Voice session encountered an error.`))},onDisconnect:()=>{t||(console.log(`[VoiceInterface] session disconnected`),te(!1),f(`idle`))}});if(t){s.endSession().catch(()=>{});return}i=s,g.current=s,te(!0),f(`listening`);try{let e=typeof window<`u`?window.location.href:``,t=``;try{t=await o.list_page_forms()}catch{t=`[]`}s.sendContextualUpdate(`Current page URL: ${e}. Site ID: ${n||`unknown`}. Form fields JSON: ${t}`)}catch{}typeof c==`function`&&c()}catch(e){t||(console.error(`[VoiceInterface] startSession failed`,e),f(`error`),m(`Could not start voice session. Please try again.`))}})(),()=>{t=!0,i?i.endSession().catch(()=>{}):g.current&&g.current.endSession().catch(()=>{})}},[e,n,r,a,c]);let ie=(0,l.useCallback)(async()=>{try{await g.current?.endSession?.()}catch{}g.current=null,te(!1),f(`idle`),typeof s==`function`&&await s(a.current),typeof i==`function`&&i()},[a,s,i]),ae=d===`listening`||d===`speaking`,oe=uh[d]||uh.idle,_=lh[d]||lh.idle;return(0,u.jsxs)(`div`,{ref:re,style:{display:`flex`,flexDirection:`column`,alignItems:`center`,justifyContent:`center`,flex:1,gap:`24px`,padding:`24px 20px`,background:`transparent`},children:[(0,u.jsxs)(`div`,{style:{position:`relative`,width:`140px`,height:`140px`,display:`flex`,alignItems:`center`,justifyContent:`center`},children:[ae&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-16px`,borderRadius:`50%`,border:`2px solid ${oe}`,animation:`fe-orb-pulse 1.4s ease-in-out infinite`,opacity:.6}}),ae&&(0,u.jsx)(`div`,{style:{position:`absolute`,inset:`-8px`,borderRadius:`50%`,border:`2px solid ${oe}`,animation:`fe-orb-pulse 1.4s ease-in-out 0.35s infinite`,opacity:.4}}),(0,u.jsx)(`div`,{style:{width:`140px`,height:`140px`,borderRadius:`50%`,background:_,border:`3px solid ${oe}`,display:`flex`,alignItems:`center`,justifyContent:`center`,transition:`all 0.35s ease`,transform:d===`speaking`?`scale(1.08)`:`scale(1)`,boxShadow:`0 0 40px ${_}, 0 8px 32px rgba(0,0,0,0.08)`},children:(0,u.jsx)(an,{size:44,color:oe})})]}),(0,u.jsxs)(`div`,{style:{fontSize:`15px`,fontWeight:600,color:d===`error`?`#ef4444`:`#374151`,letterSpacing:`0.01em`,textAlign:`center`},children:[d===`idle`&&`Starting voice session…`,d===`listening`&&`Listening…`,d===`speaking`&&`AI is speaking…`,d===`error`&&(p||`Error`)]}),h.length>0&&(0,u.jsx)(`div`,{style:{width:`100%`,maxHeight:`160px`,overflowY:`auto`,display:`flex`,flexDirection:`column`,gap:`8px`,padding:`0 4px`},children:h.map((e,t)=>(0,u.jsx)(`div`,{style:{display:`flex`,justifyContent:e.sender===`user`?`flex-end`:`flex-start`},children:(0,u.jsx)(`div`,{style:{maxWidth:`85%`,padding:`8px 12px`,borderRadius:`14px`,fontSize:`13px`,lineHeight:1.5,background:e.sender===`user`?`var(--flowengage-primary)`:`#f3f4f6`,color:e.sender===`user`?`#fff`:`#111827`},children:e.message})},t))}),(0,u.jsxs)(`button`,{onClick:ie,style:{display:`flex`,alignItems:`center`,gap:`8px`,padding:`12px 24px`,borderRadius:`999px`,background:`#fee2e2`,color:`#dc2626`,border:`1px solid #fca5a5`,fontWeight:600,fontSize:`14px`,cursor:`pointer`,transition:`all 0.2s ease`},onMouseEnter:e=>{e.currentTarget.style.background=`#fecaca`},onMouseLeave:e=>{e.currentTarget.style.background=`#fee2e2`},children:[(0,u.jsx)(on,{size:18}),`End Voice Session`]}),(0,u.jsx)(`style`,{children:`
315
315
  @keyframes fe-orb-pulse {
316
316
  0% { transform: scale(1); opacity: 0.6; }
317
317
  50% { transform: scale(1.18); opacity: 0.15; }
318
318
  100% { transform: scale(1); opacity: 0.6; }
319
319
  }
320
- `})]})}var sh=[{key:`become_client`,label:`Become a Client`},{key:`sales_enquiry`,label:`Sales Enquiry`},{key:`learn_services`,label:`Learn about our Services`},{key:`get_support`,label:`Get Support`},{key:`looking_for_job`,label:`Looking for a Job`}],ch=()=>(0,u.jsx)(`div`,{className:`flex mb-3 justify-start`,children:(0,u.jsxs)(`div`,{className:`px-4 py-3 rounded-[18px] bg-white text-gray-900 shadow-[0_2px_6px_rgba(0,0,0,0.04)]`,style:{display:`flex`,alignItems:`center`,gap:`5px`},children:[[0,1,2].map(e=>(0,u.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e)),(0,u.jsx)(`style`,{children:`
320
+ `})]})}var fh=[{key:`become_client`,label:`Become a Client`},{key:`sales_enquiry`,label:`Sales Enquiry`},{key:`learn_services`,label:`Learn about our Services`},{key:`get_support`,label:`Get Support`},{key:`looking_for_job`,label:`Looking for a Job`}],ph=()=>(0,u.jsx)(`div`,{className:`flex mb-3 justify-start`,children:(0,u.jsxs)(`div`,{className:`px-4 py-3 rounded-[18px] bg-white text-gray-900 shadow-[0_2px_6px_rgba(0,0,0,0.04)]`,style:{display:`flex`,alignItems:`center`,gap:`5px`},children:[[0,1,2].map(e=>(0,u.jsx)(`span`,{style:{width:`7px`,height:`7px`,borderRadius:`50%`,background:`#9ca3af`,animation:`fe-dot-bounce 1.2s ease-in-out ${e*.2}s infinite`,display:`inline-block`}},e)),(0,u.jsx)(`style`,{children:`
321
321
  @keyframes fe-dot-bounce {
322
322
  0%, 80%, 100% { transform: translateY(0); opacity: 0.5; }
323
323
  40% { transform: translateY(-5px); opacity: 1; }
324
324
  }
325
- `})]})});function lh(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatId:r,chatHistory:i,isOpen:a,activeScreen:o,isHumanHandled:s,agentName:c,isAgentTyping:d,isAiTyping:f,isLoading:p,isVoiceMode:m,isRateLimited:ee,rateLimitMessage:te,isConversationEnded:h,incomingCall:ne,activeCallId:g,callConnectionState:re,callConnectedAt:ie,isCallMuted:ae,webRTCError:oe,language:_,historyRef:v,onMessageSync:se,endConversation:ce,acceptCall:le,rejectCall:ue,endWebRTCCall:de,toggleCallMute:fe,dismissCallError:pe,openWidget:me,closeWidget:he,sendMessage:ge,setVoiceMode:_e,startTyping:ve,stopTyping:ye,updateTypingDraft:be}=Wt(),[xe,Se]=(0,l.useState)(``),[Ce,we]=(0,l.useState)(null),[Te,Ee]=(0,l.useState)(null),[De,Oe]=(0,l.useState)(null),[ke,y]=(0,l.useState)(0),Ae=t?.widgetSettings||{},b=n?.widgetSettings||{},x={...Ae.branding||{},...b.branding||{}},je={...Ae.theme||{},...b.theme||{}},Me=je.primaryColor||`#3B82F6`,Ne=je.accentColor||`#1D4ED8`,Pe=(je.position||`bottom-right`)===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},Fe={"--flowengage-primary":Me,"--flowengage-accent":Ne,position:`fixed`,zIndex:999999,border:`none`,outline:`none`,fontFamily:`ui-sans-serif, system-ui, sans-serif`,...a?{inset:0,...window.innerWidth>=768?{inset:`auto`,right:`1.5rem`,bottom:`1.5rem`}:{}}:Pe},Ie=b.recommendations?.[_]||Ae.recommendations?.[_]||sh,Le=b.greetings?.[_]||Ae.greetings?.[_],Re=x.chatButtonText||`Chat with us`,ze=x.headerName||t?.websiteName||`OpenSense Labs`,Be=x.logoUrl||null,S=x.hideWatermark||!1,C=b.elevenLabsAgentId||t?.elevenLabsAgentId||null,w=x.fallbackAgentName||`Agent`,Ve=ne?.agentName||c||w;(0,l.useEffect)(()=>{if(!ie||re!==`connected`){y(0);return}let e=()=>{let e=new Date(ie).getTime();isNaN(e)||y(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[ie,re]),(0,l.useEffect)(()=>{if(!s||m||h){be(``),ye();return}if(!xe.trim()){be(``),ye();return}ve();let e=window.setTimeout(()=>{be(xe)},120),t=window.setTimeout(()=>{ye()},1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[xe,s,m,h,ve,ye,be]);let He=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null;return e===`ready`?(0,u.jsxs)(`div`,{className:`flowengage-shell`,style:Fe,children:[(0,u.jsx)(dn,{isOpen:a,openWidget:me,launcherText:Re,primaryColor:Me,posInline:Pe}),a&&(0,u.jsxs)(`div`,{className:`relative w-full h-full md:w-[min(423px,calc(100vw-40px))] md:h-[min(700px,calc(100vh-120px))] flex flex-col md:rounded-[24px] overflow-hidden shadow-[0_20px_50px_rgba(0,0,0,0.15)] border-none outline-none transition-all duration-300 ${i.length===0&&!m?`bg-gradient-to-b from-[var(--flowengage-primary)] from-0% via-[var(--flowengage-primary)] via-70% to-white to-85%`:`bg-white`}`,children:[(0,u.jsx)(mn,{logoUrl:Be,brandName:ze,agentName:c,fallbackAgentName:w,activeScreen:o,branding:x,isConversationEnded:h,endConversation:ce,closeWidget:he,isInitial:i.length===0&&!m}),(0,u.jsx)(`div`,{className:`flex-1 overflow-y-auto flex flex-col`,children:m?(0,u.jsx)(oh,{agentId:C,chatId:r,historyRef:v,onMessageSync:se,onEnd:()=>{Ce&&(Ce.getTracks().forEach(e=>e.stop()),we(null)),_e(!1)}}):i.length===0?(0,u.jsx)(_n,{greetings:Le,recommendations:Ie,onSendMessage:ge}):(0,u.jsx)(gn,{chatHistory:i,isAiTyping:f,isAgentTyping:d,setReplyContext:Oe,TypingDots:ch})}),(0,u.jsx)(xn,{webRTCError:oe,micError:Te,setMicError:Ee,dismissCallError:pe,incomingCall:ne,rejectCall:ue,acceptCall:le,activeCallId:g,callConnectionState:re,formatCallDuration:e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`},callDurationSeconds:ke,endWebRTCCall:de,isCallMuted:ae,toggleCallMute:fe,isAIVoiceActive:m,currentCallAgentName:Ve,isRateLimited:ee,rateLimitMessage:te}),!m&&(0,u.jsx)(vn,{input:xe,setInput:Se,onSubmit:async e=>{if(e.preventDefault(),!xe.trim()||h)return;let t=xe.trim(),n=He(De);Se(``),Oe(null),await ge(t,``,n)},isConversationEnded:h,callUiActive:!!(ne||g),handleToggleVoice:async()=>{if(m){_e(!1);return}Ee(null);try{we(await navigator.mediaDevices.getUserMedia({audio:!0})),_e(!0)}catch(e){Ee(e.message||`Could not access microphone.`)}},activeScreen:o,inputDisabled:p||ee||h,replyContext:De,clearReplyContext:()=>Oe(null)}),!S&&(0,u.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-3 pb-4 text-[12px] text-gray-400`,children:(0,u.jsxs)(`div`,{children:[`Powered by `,(0,u.jsx)(`span`,{className:`text-blue-500`,children:`Open`}),(0,u.jsx)(`span`,{className:`text-red-500`,children:`Sense`}),` `,(0,u.jsx)(`span`,{className:`text-amber-500`,children:`Labs`})]})})]})]}):null}exports.FlowEngageProvider=nn,exports.FlowEngageWidget=lh,exports.useFlowEngage=Wt;
325
+ `})]})});function mh(){let{status:e,runtimeConfig:t,resolvedConfig:n,chatId:r,chatHistory:i,isOpen:a,activeScreen:o,isHumanHandled:s,agentName:c,isAgentTyping:d,isAiTyping:f,isLoading:p,isVoiceMode:m,isRateLimited:ee,rateLimitMessage:te,isConversationEnded:h,incomingCall:ne,activeCallId:g,callConnectionState:re,callConnectedAt:ie,isCallMuted:ae,webRTCError:oe,language:_,historyRef:v,onMessageSync:se,endConversation:ce,acceptCall:le,rejectCall:ue,endWebRTCCall:de,toggleCallMute:fe,dismissCallError:pe,openWidget:me,closeWidget:he,sendMessage:ge,setVoiceMode:_e,startTyping:ve,stopTyping:ye,updateTypingDraft:be}=Wt(),[xe,Se]=(0,l.useState)(``),[Ce,we]=(0,l.useState)(null),[Te,Ee]=(0,l.useState)(null),[De,Oe]=(0,l.useState)(null),[ke,y]=(0,l.useState)(0),Ae=t?.widgetSettings||{},b=n?.widgetSettings||{},x={...Ae.branding||{},...b.branding||{}},je={...Ae.theme||{},...b.theme||{}},Me=je.primaryColor||`#3B82F6`,Ne=je.accentColor||`#1D4ED8`,Pe=(je.position||`bottom-right`)===`bottom-left`?{left:`1.5rem`,bottom:`1.5rem`}:{right:`1.5rem`,bottom:`1.5rem`},Fe={"--flowengage-primary":Me,"--flowengage-accent":Ne,position:`fixed`,zIndex:999999,border:`none`,outline:`none`,fontFamily:`ui-sans-serif, system-ui, sans-serif`,...a?{}:Pe},Ie=b.recommendations?.[_]||Ae.recommendations?.[_]||fh,Le=b.greetings?.[_]||Ae.greetings?.[_],Re=x.chatButtonText||`Chat with us`,ze=x.headerName||t?.websiteName||`OpenSense Labs`,Be=x.logoUrl||null,S=x.hideWatermark||!1,C=b.elevenLabsAgentId||t?.elevenLabsAgentId||null,w=t?.siteId||n?.siteId||null,Ve=t?.apiBaseUrl||``,He=x.fallbackAgentName||`Agent`,Ue=ne?.agentName||c||He;(0,l.useEffect)(()=>{if(!ie||re!==`connected`){y(0);return}let e=()=>{let e=new Date(ie).getTime();isNaN(e)||y(Math.max(0,Math.floor((Date.now()-e)/1e3)))};e();let t=window.setInterval(e,1e3);return()=>window.clearInterval(t)},[ie,re]),(0,l.useEffect)(()=>{if(!s||m||h){be(``),ye();return}if(!xe.trim()){be(``),ye();return}ve();let e=window.setTimeout(()=>{be(xe)},120),t=window.setTimeout(()=>{ye()},1200);return()=>{window.clearTimeout(e),window.clearTimeout(t)}},[xe,s,m,h,ve,ye,be]);let We=e=>e?{replyTo:e.messageId||e.id||null,replyToContent:(e.replyToContent||e.message||``).replace(/<[^>]+>/g,``).trim().slice(0,200),replyToSender:e.sender||null}:null,Ge=async e=>{if(e.preventDefault(),!xe.trim()||h)return;let t=xe.trim(),n=We(De);Se(``),Oe(null),await ge(t,``,n)},Ke=async()=>{if(m){_e(!1);return}Ee(null);try{we(await navigator.mediaDevices.getUserMedia({audio:!0})),_e(!0)}catch(e){Ee(e.message||`Could not access microphone.`)}},qe=()=>{Ce&&(Ce.getTracks().forEach(e=>e.stop()),we(null)),_e(!1)},Je=e=>{let t=Math.floor(e/60),n=e%60;return`${t.toString().padStart(2,`0`)}:${n.toString().padStart(2,`0`)}`};return e===`ready`?(0,u.jsxs)(`div`,{className:`flowengage-shell`,"data-open":a?`true`:`false`,style:Fe,children:[(0,u.jsx)(dn,{isOpen:a,openWidget:me,launcherText:Re,primaryColor:Me,posInline:Pe}),a&&(0,u.jsxs)(`div`,{className:`flowengage-chat-panel`,style:{background:i.length===0&&!m?`linear-gradient(to bottom, ${Me} 0%, ${Me} 70%, white 85%)`:`white`},children:[(0,u.jsx)(mn,{logoUrl:Be,brandName:ze,agentName:c,fallbackAgentName:He,activeScreen:o,branding:x,isConversationEnded:h,endConversation:ce,closeWidget:he,isInitial:i.length===0&&!m}),(0,u.jsx)(`div`,{className:`flex-1 overflow-y-auto flex flex-col`,children:m?(0,u.jsx)(dh,{agentId:C,chatId:r,siteId:w,apiBaseUrl:Ve,historyRef:v,onMessageSync:se,onEnd:qe}):i.length===0?(0,u.jsx)(_n,{greetings:Le,recommendations:Ie,onSendMessage:ge}):(0,u.jsx)(gn,{chatHistory:i,isAiTyping:f,isAgentTyping:d,setReplyContext:Oe,TypingDots:ph})}),(0,u.jsx)(xn,{webRTCError:oe,micError:Te,setMicError:Ee,dismissCallError:pe,incomingCall:ne,rejectCall:ue,acceptCall:le,activeCallId:g,callConnectionState:re,formatCallDuration:Je,callDurationSeconds:ke,endWebRTCCall:de,isCallMuted:ae,toggleCallMute:fe,isAIVoiceActive:m,currentCallAgentName:Ue,isRateLimited:ee,rateLimitMessage:te}),!m&&(0,u.jsx)(vn,{input:xe,setInput:Se,onSubmit:Ge,isConversationEnded:h,callUiActive:!!(ne||g),handleToggleVoice:Ke,activeScreen:o,inputDisabled:p||ee||h,replyContext:De,clearReplyContext:()=>Oe(null)}),!S&&(0,u.jsx)(`div`,{className:`flex items-center justify-center gap-3 pt-3 pb-4 text-[12px] text-gray-400`,children:(0,u.jsxs)(`div`,{children:[`Powered by `,(0,u.jsx)(`span`,{className:`text-blue-500`,children:`Open`}),(0,u.jsx)(`span`,{className:`text-red-500`,children:`Sense`}),` `,(0,u.jsx)(`span`,{className:`text-amber-500`,children:`Labs`})]})})]})]}):null}exports.FlowEngageProvider=nn,exports.FlowEngageWidget=mh,exports.useFlowEngage=Wt;
@@ -1,3 +1,3 @@
1
1
  /*! tailwindcss v4.2.2 | MIT License | https://tailwindcss.com */
2
- @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-gradient-position:initial;--tw-gradient-from:#0000;--tw-gradient-via:#0000;--tw-gradient-to:#0000;--tw-gradient-stops:initial;--tw-gradient-via-stops:initial;--tw-gradient-from-position:0%;--tw-gradient-via-position:50%;--tw-gradient-to-position:100%;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}:root:not(#\#):not(#\#),:host:not(#\#):not(#\#){--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.absolute:not(#\#):not(#\#){position:absolute}.fixed:not(#\#):not(#\#){position:fixed}.relative:not(#\#):not(#\#){position:relative}.start:not(#\#):not(#\#){inset-inline-start:var(--spacing)}.end:not(#\#):not(#\#){inset-inline-end:var(--spacing)}.container:not(#\#):not(#\#){width:100%}@media (width>=40rem){.container:not(#\#):not(#\#){max-width:40rem}}@media (width>=48rem){.container:not(#\#):not(#\#){max-width:48rem}}@media (width>=64rem){.container:not(#\#):not(#\#){max-width:64rem}}@media (width>=80rem){.container:not(#\#):not(#\#){max-width:80rem}}@media (width>=96rem){.container:not(#\#):not(#\#){max-width:96rem}}.mx-5:not(#\#):not(#\#){margin-inline:calc(var(--spacing) * 5)}.my-2:not(#\#):not(#\#){margin-block:calc(var(--spacing) * 2)}.mt-0\.5:not(#\#):not(#\#){margin-top:calc(var(--spacing) * .5)}.mt-1:not(#\#):not(#\#){margin-top:calc(var(--spacing) * 1)}.mt-\[30px\]:not(#\#):not(#\#){margin-top:30px}.mb-0\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * .5)}.mb-1:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 1.5)}.mb-2:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 2.5)}.mb-3:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 3)}.mb-auto:not(#\#):not(#\#){margin-bottom:auto}.ml-1:not(#\#):not(#\#){margin-left:calc(var(--spacing) * 1)}.ml-1\.5:not(#\#):not(#\#){margin-left:calc(var(--spacing) * 1.5)}.block:not(#\#):not(#\#){display:block}.flex:not(#\#):not(#\#){display:flex}.hidden:not(#\#):not(#\#){display:none}.inline:not(#\#):not(#\#){display:inline}.inline-block:not(#\#):not(#\#){display:inline-block}.h-7:not(#\#):not(#\#){height:calc(var(--spacing) * 7)}.h-8:not(#\#):not(#\#){height:calc(var(--spacing) * 8)}.h-9:not(#\#):not(#\#){height:calc(var(--spacing) * 9)}.h-11:not(#\#):not(#\#){height:calc(var(--spacing) * 11)}.h-\[34px\]:not(#\#):not(#\#){height:34px}.h-full:not(#\#):not(#\#){height:100%}.w-7:not(#\#):not(#\#){width:calc(var(--spacing) * 7)}.w-8:not(#\#):not(#\#){width:calc(var(--spacing) * 8)}.w-11:not(#\#):not(#\#){width:calc(var(--spacing) * 11)}.w-\[34px\]:not(#\#):not(#\#){width:34px}.w-auto:not(#\#):not(#\#){width:auto}.w-full:not(#\#):not(#\#){width:100%}.max-w-\[88px\]:not(#\#):not(#\#){max-width:88px}.max-w-full:not(#\#):not(#\#){max-width:100%}.min-w-0:not(#\#):not(#\#){min-width:calc(var(--spacing) * 0)}.flex-1:not(#\#):not(#\#){flex:1}.flex-shrink-0:not(#\#):not(#\#),.shrink-0:not(#\#):not(#\#){flex-shrink:0}.transform:not(#\#):not(#\#){transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse:not(#\#):not(#\#){animation:var(--animate-pulse)}.cursor-pointer:not(#\#):not(#\#){cursor:pointer}.flex-col:not(#\#):not(#\#){flex-direction:column}.items-center:not(#\#):not(#\#){align-items:center}.items-end:not(#\#):not(#\#){align-items:flex-end}.items-start:not(#\#):not(#\#){align-items:flex-start}.justify-between:not(#\#):not(#\#){justify-content:space-between}.justify-center:not(#\#):not(#\#){justify-content:center}.justify-end:not(#\#):not(#\#){justify-content:flex-end}.justify-start:not(#\#):not(#\#){justify-content:flex-start}.gap-1:not(#\#):not(#\#){gap:calc(var(--spacing) * 1)}.gap-2:not(#\#):not(#\#){gap:calc(var(--spacing) * 2)}.gap-2\.5:not(#\#):not(#\#){gap:calc(var(--spacing) * 2.5)}.gap-3:not(#\#):not(#\#){gap:calc(var(--spacing) * 3)}.truncate:not(#\#):not(#\#){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden:not(#\#):not(#\#){overflow:hidden}.overflow-y-auto:not(#\#):not(#\#){overflow-y:auto}.rounded-2xl:not(#\#):not(#\#){border-radius:var(--radius-2xl)}.rounded-\[14px\]:not(#\#):not(#\#){border-radius:14px}.rounded-\[18px\]:not(#\#):not(#\#){border-radius:18px}.rounded-\[20px\]:not(#\#):not(#\#){border-radius:20px}.rounded-full:not(#\#):not(#\#){border-radius:3.40282e38px}.rounded-lg:not(#\#):not(#\#){border-radius:var(--radius-lg)}.rounded-md:not(#\#):not(#\#){border-radius:var(--radius-md)}.rounded-xl:not(#\#):not(#\#){border-radius:var(--radius-xl)}.rounded-t-\[inherit\]:not(#\#):not(#\#){border-top-left-radius:inherit;border-top-right-radius:inherit}.border:not(#\#):not(#\#){border-style:var(--tw-border-style);border-width:1px}.border-0:not(#\#):not(#\#){border-style:var(--tw-border-style);border-width:0}.border-b:not(#\#):not(#\#){border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2:not(#\#):not(#\#){border-left-style:var(--tw-border-style);border-left-width:2px}.border-none:not(#\#):not(#\#){--tw-border-style:none;border-style:none}.border-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){border-color:var(--flowengage-primary)}.border-black\/5:not(#\#):not(#\#){border-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.border-black\/5:not(#\#):not(#\#){border-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.border-red-100:not(#\#):not(#\#){border-color:var(--color-red-100)}.border-white\/80:not(#\#):not(#\#){border-color:#fffc}@supports (color:color-mix(in lab, red, red)){.border-white\/80:not(#\#):not(#\#){border-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){background-color:var(--flowengage-primary)}.bg-gray-50:not(#\#):not(#\#){background-color:var(--color-gray-50)}.bg-gray-100:not(#\#):not(#\#){background-color:var(--color-gray-100)}.bg-red-50:not(#\#):not(#\#){background-color:var(--color-red-50)}.bg-red-100:not(#\#):not(#\#){background-color:var(--color-red-100)}.bg-transparent:not(#\#):not(#\#){background-color:#0000}.bg-white:not(#\#):not(#\#){background-color:var(--color-white)}.bg-white\/15:not(#\#):not(#\#){background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.bg-white\/15:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.bg-white\/20:not(#\#):not(#\#){background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\/95:not(#\#):not(#\#){background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.bg-gradient-to-b:not(#\#):not(#\#){--tw-gradient-position:to bottom in oklab;background-image:linear-gradient(var(--tw-gradient-stops))}.from-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){--tw-gradient-from:var(--flowengage-primary);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.from-0\%:not(#\#):not(#\#){--tw-gradient-from-position:0%}.via-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){--tw-gradient-via:var(--flowengage-primary);--tw-gradient-via-stops:var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-via) var(--tw-gradient-via-position), var(--tw-gradient-to) var(--tw-gradient-to-position);--tw-gradient-stops:var(--tw-gradient-via-stops)}.via-70\%:not(#\#):not(#\#){--tw-gradient-via-position:70%}.to-white:not(#\#):not(#\#){--tw-gradient-to:var(--color-white);--tw-gradient-stops:var(--tw-gradient-via-stops,var(--tw-gradient-position), var(--tw-gradient-from) var(--tw-gradient-from-position), var(--tw-gradient-to) var(--tw-gradient-to-position))}.to-85\%:not(#\#):not(#\#){--tw-gradient-to-position:85%}.object-contain:not(#\#):not(#\#){object-fit:contain}.p-\[2px\]:not(#\#):not(#\#){padding:2px}.px-1:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 1)}.px-1\.5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 1.5)}.px-2:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 2)}.px-2\.5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 2.5)}.px-3:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 3)}.px-4:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 4)}.px-5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 5)}.px-\[18px\]:not(#\#):not(#\#){padding-inline:18px}.py-1:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 1)}.py-1\.5:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 1.5)}.py-2:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 2)}.py-3:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 3)}.py-\[3px\]:not(#\#):not(#\#){padding-block:3px}.pt-2\.5:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 2.5)}.pt-3:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 3)}.pt-4:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 4)}.pb-1:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 1)}.pb-4:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 4)}.pb-5:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 5)}.pl-3:not(#\#):not(#\#){padding-left:calc(var(--spacing) * 3)}.text-center:not(#\#):not(#\#){text-align:center}.text-left:not(#\#):not(#\#){text-align:left}.font-\[inherit\]:not(#\#):not(#\#){font-family:inherit}.text-lg:not(#\#):not(#\#){font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xl:not(#\#):not(#\#){font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-\[10px\]:not(#\#):not(#\#){font-size:10px}.text-\[11px\]:not(#\#):not(#\#){font-size:11px}.text-\[12px\]:not(#\#):not(#\#){font-size:12px}.text-\[13px\]:not(#\#):not(#\#){font-size:13px}.text-\[14px\]:not(#\#):not(#\#){font-size:14px}.text-\[16px\]:not(#\#):not(#\#){font-size:16px}.text-\[34px\]:not(#\#):not(#\#){font-size:34px}.leading-\[1\.5\]:not(#\#):not(#\#){--tw-leading:1.5;line-height:1.5}.leading-\[1\.15\]:not(#\#):not(#\#){--tw-leading:1.15;line-height:1.15}.leading-none:not(#\#):not(#\#){--tw-leading:1;line-height:1}.font-bold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.5px\]:not(#\#):not(#\#){--tw-tracking:.5px;letter-spacing:.5px}.whitespace-nowrap:not(#\#):not(#\#){white-space:nowrap}.whitespace-pre-wrap:not(#\#):not(#\#){white-space:pre-wrap}.text-\(--flowengage-primary\):not(#\#):not(#\#),.text-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){color:var(--flowengage-primary)}.text-amber-500:not(#\#):not(#\#){color:var(--color-amber-500)}.text-black:not(#\#):not(#\#){color:var(--color-black)}.text-blue-500:not(#\#):not(#\#){color:var(--color-blue-500)}.text-emerald-500:not(#\#):not(#\#){color:var(--color-emerald-500)}.text-gray-400:not(#\#):not(#\#){color:var(--color-gray-400)}.text-gray-500:not(#\#):not(#\#){color:var(--color-gray-500)}.text-gray-900:not(#\#):not(#\#){color:var(--color-gray-900)}.text-red-400:not(#\#):not(#\#){color:var(--color-red-400)}.text-red-500:not(#\#):not(#\#){color:var(--color-red-500)}.text-red-700:not(#\#):not(#\#){color:var(--color-red-700)}.text-red-800:not(#\#):not(#\#){color:var(--color-red-800)}.text-white:not(#\#):not(#\#){color:var(--color-white)}.text-white\/90:not(#\#):not(#\#){color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90:not(#\#):not(#\#){color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.placeholder-gray-400:not(#\#):not(#\#)::placeholder{color:var(--color-gray-400)}.opacity-0:not(#\#):not(#\#){opacity:0}.opacity-70:not(#\#):not(#\#){opacity:.7}.opacity-95:not(#\#):not(#\#){opacity:.95}.shadow-\[0_2px_6px_rgba\(0\,0\,0\,0\.04\)\]:not(#\#):not(#\#){--tw-shadow:0 2px 6px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_4px_12px_rgba\(0\,0\,0\,0\.06\)\]:not(#\#):not(#\#){--tw-shadow:0 4px 12px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_8px_24px_rgba\(0\,0\,0\,0\.05\)\]:not(#\#):not(#\#){--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_20px_50px_rgba\(0\,0\,0\,0\.15\)\]:not(#\#):not(#\#){--tw-shadow:0 20px 50px var(--tw-shadow-color,#00000026);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm:not(#\#):not(#\#){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring:not(#\#):not(#\#){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline:not(#\#):not(#\#){outline-style:var(--tw-outline-style);outline-width:1px}.filter:not(#\#):not(#\#){filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm:not(#\#):not(#\#){--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition:not(#\#):not(#\#){transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all:not(#\#):not(#\#){transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors:not(#\#):not(#\#){transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity:not(#\#):not(#\#){transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform:not(#\#):not(#\#){transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200:not(#\#):not(#\#){--tw-duration:.2s;transition-duration:.2s}.duration-300:not(#\#):not(#\#){--tw-duration:.3s;transition-duration:.3s}.ease-in-out:not(#\#):not(#\#){--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none:not(#\#):not(#\#){--tw-outline-style:none;outline-style:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *):not(#\#):not(#\#){opacity:1}.hover\:-translate-y-0\.5:hover:not(#\#):not(#\#){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:bg-black\/5:hover:not(#\#):not(#\#){background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/5:hover:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\:bg-gray-100:hover:not(#\#):not(#\#){background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover:not(#\#):not(#\#){background-color:var(--color-gray-200)}.hover\:bg-white\/10:hover:not(#\#):not(#\#){background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/10:hover:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.hover\:text-gray-600:hover:not(#\#):not(#\#){color:var(--color-gray-600)}.hover\:text-gray-700:hover:not(#\#):not(#\#){color:var(--color-gray-700)}.hover\:text-red-600:hover:not(#\#):not(#\#){color:var(--color-red-600)}.hover\:shadow-\[0_6px_16px_rgba\(0\,0\,0\,0\.1\)\]:hover:not(#\#):not(#\#){--tw-shadow:0 6px 16px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.enabled\:hover\:bg-\[var\(--flowengage-primary\)\]:enabled:hover:not(#\#):not(#\#){background-color:var(--flowengage-primary)}.enabled\:hover\:text-white:enabled:hover:not(#\#):not(#\#){color:var(--color-white)}}.disabled\:cursor-not-allowed:disabled:not(#\#):not(#\#){cursor:not-allowed}.disabled\:border-gray-300:disabled:not(#\#):not(#\#){border-color:var(--color-gray-300)}.disabled\:text-gray-300:disabled:not(#\#):not(#\#){color:var(--color-gray-300)}.disabled\:opacity-50:disabled:not(#\#):not(#\#){opacity:.5}@media (width>=48rem){.md\:h-\[min\(700px\,calc\(100vh-120px\)\)\]:not(#\#):not(#\#){height:min(700px,100vh - 120px)}.md\:w-\[min\(423px\,calc\(100vw-40px\)\)\]:not(#\#):not(#\#){width:min(423px,100vw - 40px)}.md\:rounded-\[24px\]:not(#\#):not(#\#){border-radius:24px}}.\[\&\>svg\]\:h-full:not(#\#):not(#\#)>svg{height:100%}.\[\&\>svg\]\:w-full:not(#\#):not(#\#)>svg{width:100%}.flowengage-shell:not(#\#),.flowengage-shell:not(#\#) *{font-family:inherit}.flowengage-logo-fallback:not(#\#):not(#\#){background:conic-gradient(from 180deg, var(--flowengage-primary) 0%, #2b70b5 50%, #f59e0b 100%)}.fe-bot-message:not(#\#):not(#\#) p{margin:0 0 .5em}.fe-bot-message:not(#\#):not(#\#) p:last-child{margin-bottom:0}.fe-bot-message:not(#\#):not(#\#) ul,.fe-bot-message:not(#\#):not(#\#) ol{margin:.4em 0 .4em 1.2em;padding:0}.fe-bot-message:not(#\#):not(#\#) li{margin-bottom:.25em}.fe-bot-message:not(#\#):not(#\#) strong{font-weight:600}.fe-bot-message:not(#\#):not(#\#) a{color:var(--flowengage-primary);text-decoration:underline}.fe-bot-message:not(#\#):not(#\#) a:hover{opacity:.8}.incoming-call-overlay:not(#\#):not(#\#){z-index:1000;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#1a1a2ef2;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:flex;position:absolute;left:0;right:0}.incoming-call-overlay.bottom-mode:not(#\#):not(#\#){border-top:2px solid #ffffff1a;min-height:120px;animation:.4s cubic-bezier(.16,1,.3,1) slideUpBanner;top:auto;bottom:0;box-shadow:0 -10px 30px #00000080}.incoming-call-overlay.header-mode:not(#\#):not(#\#){border-bottom:2px solid #ffffff1a;min-height:80px;animation:.4s cubic-bezier(.16,1,.3,1) slideDownBanner;top:0;bottom:auto;box-shadow:0 10px 30px #00000080}.incoming-call-container:not(#\#):not(#\#){justify-content:space-between;align-items:center;gap:14px;width:100%;padding:14px 16px;display:flex}.incoming-call-container.connected-layout:not(#\#):not(#\#){flex-direction:column;justify-content:center;align-items:stretch;gap:14px}.call-connected-top:not(#\#):not(#\#){justify-content:space-between;align-items:center;gap:16px;width:100%;display:flex}.call-connected-identity:not(#\#):not(#\#){flex:1;align-items:center;gap:14px;min-width:0;display:flex}.call-icon-wrapper:not(#\#):not(#\#){color:#fff;z-index:1;border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;width:54px;height:54px;margin-right:4px;display:flex;position:relative}.call-icon-wrapper.incoming:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049);animation:1s ease-in-out infinite bounce}.call-icon-wrapper.connecting:not(#\#):not(#\#){background:linear-gradient(135deg,#2196f3,#1976d2)}.call-icon-wrapper.connected:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049)}.call-pulse-animation:not(#\#):not(#\#){z-index:-1;background:#4caf504d;border-radius:50%;width:120px;height:120px;animation:1.5s ease-out infinite pulse;position:absolute}.call-connecting-animation:not(#\#):not(#\#){z-index:-1;border:3px solid #0000;border-top-color:#2196f3;border-radius:50%;width:100px;height:100px;animation:1s linear infinite spin;position:absolute}.call-info-group:not(#\#):not(#\#){flex-direction:column;flex:1;min-width:0;margin-right:8px;display:flex}.call-title:not(#\#):not(#\#){color:#fff;white-space:normal;text-overflow:clip;margin:0;font-size:16px;font-weight:700;line-height:1.2;overflow:visible}.call-subtitle:not(#\#):not(#\#){color:#ffffffb3;white-space:normal;text-overflow:clip;margin:4px 0 0;font-size:12px;line-height:1.35;overflow:visible}.call-timer:not(#\#):not(#\#){text-align:center;color:#fff;flex-shrink:0;min-width:54px;font-size:13px;font-weight:700}.call-actions:not(#\#):not(#\#){flex-shrink:0;align-items:center;gap:8px;display:flex}.call-actions.connected:not(#\#):not(#\#){justify-content:center;width:100%}.flowengage-call-btn:not(#\#):not(#\#){cursor:pointer;color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-width:92px;padding:8px 12px;font-size:12px;font-weight:600;line-height:1;transition:transform .2s,box-shadow .2s,background .2s;display:flex}.flowengage-call-btn:not(#\#):not(#\#) svg{flex-shrink:0;display:block}.flowengage-call-btn:not(#\#):not(#\#) span{justify-content:center;align-items:center;line-height:1;display:flex}.flowengage-call-btn-accept:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049);box-shadow:0 8px 24px #4caf5066}.flowengage-call-btn-reject:not(#\#):not(#\#),.flowengage-call-btn-end:not(#\#):not(#\#){background:linear-gradient(135deg,#f44336,#d32f2f);box-shadow:0 4px 12px #f4433666}.flowengage-call-btn-mute:not(#\#):not(#\#){background:#ffffff1a;border:2px solid #fff3}.flowengage-call-btn-mute.active:not(#\#):not(#\#){background:#f443364d;border-color:#f44336}.flowengage-call-btn:hover:not(:disabled):not(#\#):not(#\#){transform:scale(1.05)}.incoming-call-overlay.header-mode .flowengage-call-btn{border-radius:9999px!important;width:36px!important;min-width:36px!important;height:36px!important;padding:0!important}.incoming-call-overlay.header-mode .flowengage-call-btn span{display:none!important}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-icon-wrapper{width:40px;height:40px;margin-right:0}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-info-group{min-width:0}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-title,.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-subtitle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=640px){.incoming-call-container:not(#\#):not(#\#){align-items:flex-start;gap:10px;padding:12px 14px}.incoming-call-container.connected-layout:not(#\#):not(#\#){align-items:stretch}.call-connected-top:not(#\#):not(#\#){flex-direction:column;align-items:flex-start;gap:10px}.call-connected-identity:not(#\#):not(#\#){width:100%}.call-info-group:not(#\#):not(#\#){margin-right:0}.call-actions:not(#\#):not(#\#){flex-wrap:wrap;align-self:stretch;gap:6px}.call-actions.connected:not(#\#):not(#\#){justify-content:stretch}.call-actions.connected:not(#\#):not(#\#) .flowengage-call-btn{flex:1}.flowengage-call-btn:not(#\#):not(#\#){min-width:78px;padding:8px 10px}}@keyframes slideUpBanner{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDownBanner{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(360deg)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-gradient-position{syntax:"*";inherits:false}@property --tw-gradient-from{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-via{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-to{syntax:"<color>";inherits:false;initial-value:#0000}@property --tw-gradient-stops{syntax:"*";inherits:false}@property --tw-gradient-via-stops{syntax:"*";inherits:false}@property --tw-gradient-from-position{syntax:"<length-percentage>";inherits:false;initial-value:0%}@property --tw-gradient-via-position{syntax:"<length-percentage>";inherits:false;initial-value:50%}@property --tw-gradient-to-position{syntax:"<length-percentage>";inherits:false;initial-value:100%}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
2
+ @supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-border-style:solid;--tw-leading:initial;--tw-font-weight:initial;--tw-tracking:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-outline-style:solid;--tw-blur:initial;--tw-brightness:initial;--tw-contrast:initial;--tw-grayscale:initial;--tw-hue-rotate:initial;--tw-invert:initial;--tw-opacity:initial;--tw-saturate:initial;--tw-sepia:initial;--tw-drop-shadow:initial;--tw-drop-shadow-color:initial;--tw-drop-shadow-alpha:100%;--tw-drop-shadow-size:initial;--tw-backdrop-blur:initial;--tw-backdrop-brightness:initial;--tw-backdrop-contrast:initial;--tw-backdrop-grayscale:initial;--tw-backdrop-hue-rotate:initial;--tw-backdrop-invert:initial;--tw-backdrop-opacity:initial;--tw-backdrop-saturate:initial;--tw-backdrop-sepia:initial;--tw-duration:initial;--tw-ease:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0}}:root:not(#\#):not(#\#),:host:not(#\#):not(#\#){--color-red-50:oklch(97.1% .013 17.38);--color-red-100:oklch(93.6% .032 17.717);--color-red-400:oklch(70.4% .191 22.216);--color-red-500:oklch(63.7% .237 25.331);--color-red-600:oklch(57.7% .245 27.325);--color-red-700:oklch(50.5% .213 27.518);--color-red-800:oklch(44.4% .177 26.899);--color-amber-500:oklch(76.9% .188 70.08);--color-emerald-500:oklch(69.6% .17 162.48);--color-blue-500:oklch(62.3% .214 259.815);--color-gray-50:oklch(98.5% .002 247.839);--color-gray-100:oklch(96.7% .003 264.542);--color-gray-200:oklch(92.8% .006 264.531);--color-gray-300:oklch(87.2% .01 258.338);--color-gray-400:oklch(70.7% .022 261.325);--color-gray-500:oklch(55.1% .027 264.364);--color-gray-600:oklch(44.6% .03 256.802);--color-gray-700:oklch(37.3% .034 259.733);--color-gray-900:oklch(21% .034 264.665);--color-black:#000;--color-white:#fff;--spacing:.25rem;--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--radius-2xl:1rem;--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--blur-sm:8px;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1)}.absolute:not(#\#):not(#\#){position:absolute}.fixed:not(#\#):not(#\#){position:fixed}.relative:not(#\#):not(#\#){position:relative}.start:not(#\#):not(#\#){inset-inline-start:var(--spacing)}.end:not(#\#):not(#\#){inset-inline-end:var(--spacing)}.container:not(#\#):not(#\#){width:100%}@media (width>=40rem){.container:not(#\#):not(#\#){max-width:40rem}}@media (width>=48rem){.container:not(#\#):not(#\#){max-width:48rem}}@media (width>=64rem){.container:not(#\#):not(#\#){max-width:64rem}}@media (width>=80rem){.container:not(#\#):not(#\#){max-width:80rem}}@media (width>=96rem){.container:not(#\#):not(#\#){max-width:96rem}}.mx-5:not(#\#):not(#\#){margin-inline:calc(var(--spacing) * 5)}.my-2:not(#\#):not(#\#){margin-block:calc(var(--spacing) * 2)}.mt-0\.5:not(#\#):not(#\#){margin-top:calc(var(--spacing) * .5)}.mt-1:not(#\#):not(#\#){margin-top:calc(var(--spacing) * 1)}.mt-\[30px\]:not(#\#):not(#\#){margin-top:30px}.mb-0\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * .5)}.mb-1:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 1)}.mb-1\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 1.5)}.mb-2:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 2)}.mb-2\.5:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 2.5)}.mb-3:not(#\#):not(#\#){margin-bottom:calc(var(--spacing) * 3)}.mb-auto:not(#\#):not(#\#){margin-bottom:auto}.ml-1:not(#\#):not(#\#){margin-left:calc(var(--spacing) * 1)}.ml-1\.5:not(#\#):not(#\#){margin-left:calc(var(--spacing) * 1.5)}.block:not(#\#):not(#\#){display:block}.flex:not(#\#):not(#\#){display:flex}.hidden:not(#\#):not(#\#){display:none}.inline:not(#\#):not(#\#){display:inline}.inline-block:not(#\#):not(#\#){display:inline-block}.h-7:not(#\#):not(#\#){height:calc(var(--spacing) * 7)}.h-8:not(#\#):not(#\#){height:calc(var(--spacing) * 8)}.h-9:not(#\#):not(#\#){height:calc(var(--spacing) * 9)}.h-11:not(#\#):not(#\#){height:calc(var(--spacing) * 11)}.h-\[34px\]:not(#\#):not(#\#){height:34px}.h-full:not(#\#):not(#\#){height:100%}.w-7:not(#\#):not(#\#){width:calc(var(--spacing) * 7)}.w-8:not(#\#):not(#\#){width:calc(var(--spacing) * 8)}.w-11:not(#\#):not(#\#){width:calc(var(--spacing) * 11)}.w-\[34px\]:not(#\#):not(#\#){width:34px}.w-auto:not(#\#):not(#\#){width:auto}.w-full:not(#\#):not(#\#){width:100%}.max-w-\[88px\]:not(#\#):not(#\#){max-width:88px}.max-w-full:not(#\#):not(#\#){max-width:100%}.min-w-0:not(#\#):not(#\#){min-width:calc(var(--spacing) * 0)}.flex-1:not(#\#):not(#\#){flex:1}.flex-shrink-0:not(#\#):not(#\#),.shrink-0:not(#\#):not(#\#){flex-shrink:0}.transform:not(#\#):not(#\#){transform:var(--tw-rotate-x,) var(--tw-rotate-y,) var(--tw-rotate-z,) var(--tw-skew-x,) var(--tw-skew-y,)}.animate-pulse:not(#\#):not(#\#){animation:var(--animate-pulse)}.cursor-pointer:not(#\#):not(#\#){cursor:pointer}.flex-col:not(#\#):not(#\#){flex-direction:column}.items-center:not(#\#):not(#\#){align-items:center}.items-end:not(#\#):not(#\#){align-items:flex-end}.items-start:not(#\#):not(#\#){align-items:flex-start}.justify-between:not(#\#):not(#\#){justify-content:space-between}.justify-center:not(#\#):not(#\#){justify-content:center}.justify-end:not(#\#):not(#\#){justify-content:flex-end}.justify-start:not(#\#):not(#\#){justify-content:flex-start}.gap-1:not(#\#):not(#\#){gap:calc(var(--spacing) * 1)}.gap-2:not(#\#):not(#\#){gap:calc(var(--spacing) * 2)}.gap-2\.5:not(#\#):not(#\#){gap:calc(var(--spacing) * 2.5)}.gap-3:not(#\#):not(#\#){gap:calc(var(--spacing) * 3)}.truncate:not(#\#):not(#\#){text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.overflow-hidden:not(#\#):not(#\#){overflow:hidden}.overflow-y-auto:not(#\#):not(#\#){overflow-y:auto}.rounded-2xl:not(#\#):not(#\#){border-radius:var(--radius-2xl)}.rounded-\[14px\]:not(#\#):not(#\#){border-radius:14px}.rounded-\[18px\]:not(#\#):not(#\#){border-radius:18px}.rounded-\[20px\]:not(#\#):not(#\#){border-radius:20px}.rounded-full:not(#\#):not(#\#){border-radius:3.40282e38px}.rounded-lg:not(#\#):not(#\#){border-radius:var(--radius-lg)}.rounded-md:not(#\#):not(#\#){border-radius:var(--radius-md)}.rounded-xl:not(#\#):not(#\#){border-radius:var(--radius-xl)}.rounded-t-\[inherit\]:not(#\#):not(#\#){border-top-left-radius:inherit;border-top-right-radius:inherit}.border:not(#\#):not(#\#){border-style:var(--tw-border-style);border-width:1px}.border-0:not(#\#):not(#\#){border-style:var(--tw-border-style);border-width:0}.border-b:not(#\#):not(#\#){border-bottom-style:var(--tw-border-style);border-bottom-width:1px}.border-l-2:not(#\#):not(#\#){border-left-style:var(--tw-border-style);border-left-width:2px}.border-none:not(#\#):not(#\#){--tw-border-style:none;border-style:none}.border-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){border-color:var(--flowengage-primary)}.border-black\/5:not(#\#):not(#\#){border-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.border-black\/5:not(#\#):not(#\#){border-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.border-red-100:not(#\#):not(#\#){border-color:var(--color-red-100)}.border-white\/80:not(#\#):not(#\#){border-color:#fffc}@supports (color:color-mix(in lab, red, red)){.border-white\/80:not(#\#):not(#\#){border-color:color-mix(in oklab, var(--color-white) 80%, transparent)}}.bg-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){background-color:var(--flowengage-primary)}.bg-gray-50:not(#\#):not(#\#){background-color:var(--color-gray-50)}.bg-gray-100:not(#\#):not(#\#){background-color:var(--color-gray-100)}.bg-red-50:not(#\#):not(#\#){background-color:var(--color-red-50)}.bg-red-100:not(#\#):not(#\#){background-color:var(--color-red-100)}.bg-transparent:not(#\#):not(#\#){background-color:#0000}.bg-white:not(#\#):not(#\#){background-color:var(--color-white)}.bg-white\/15:not(#\#):not(#\#){background-color:#ffffff26}@supports (color:color-mix(in lab, red, red)){.bg-white\/15:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 15%, transparent)}}.bg-white\/20:not(#\#):not(#\#){background-color:#fff3}@supports (color:color-mix(in lab, red, red)){.bg-white\/20:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 20%, transparent)}}.bg-white\/95:not(#\#):not(#\#){background-color:#fffffff2}@supports (color:color-mix(in lab, red, red)){.bg-white\/95:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 95%, transparent)}}.object-contain:not(#\#):not(#\#){object-fit:contain}.p-\[2px\]:not(#\#):not(#\#){padding:2px}.px-1:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 1)}.px-1\.5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 1.5)}.px-2:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 2)}.px-2\.5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 2.5)}.px-3:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 3)}.px-4:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 4)}.px-5:not(#\#):not(#\#){padding-inline:calc(var(--spacing) * 5)}.px-\[18px\]:not(#\#):not(#\#){padding-inline:18px}.py-1:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 1)}.py-1\.5:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 1.5)}.py-2:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 2)}.py-3:not(#\#):not(#\#){padding-block:calc(var(--spacing) * 3)}.py-\[3px\]:not(#\#):not(#\#){padding-block:3px}.pt-2\.5:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 2.5)}.pt-3:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 3)}.pt-4:not(#\#):not(#\#){padding-top:calc(var(--spacing) * 4)}.pb-1:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 1)}.pb-4:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 4)}.pb-5:not(#\#):not(#\#){padding-bottom:calc(var(--spacing) * 5)}.pl-3:not(#\#):not(#\#){padding-left:calc(var(--spacing) * 3)}.text-center:not(#\#):not(#\#){text-align:center}.text-left:not(#\#):not(#\#){text-align:left}.font-\[inherit\]:not(#\#):not(#\#){font-family:inherit}.text-lg:not(#\#):not(#\#){font-size:var(--text-lg);line-height:var(--tw-leading,var(--text-lg--line-height))}.text-xl:not(#\#):not(#\#){font-size:var(--text-xl);line-height:var(--tw-leading,var(--text-xl--line-height))}.text-\[10px\]:not(#\#):not(#\#){font-size:10px}.text-\[11px\]:not(#\#):not(#\#){font-size:11px}.text-\[12px\]:not(#\#):not(#\#){font-size:12px}.text-\[13px\]:not(#\#):not(#\#){font-size:13px}.text-\[14px\]:not(#\#):not(#\#){font-size:14px}.text-\[16px\]:not(#\#):not(#\#){font-size:16px}.text-\[34px\]:not(#\#):not(#\#){font-size:34px}.leading-\[1\.5\]:not(#\#):not(#\#){--tw-leading:1.5;line-height:1.5}.leading-\[1\.15\]:not(#\#):not(#\#){--tw-leading:1.15;line-height:1.15}.leading-none:not(#\#):not(#\#){--tw-leading:1;line-height:1}.font-bold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-bold);font-weight:var(--font-weight-bold)}.font-extrabold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-extrabold);font-weight:var(--font-weight-extrabold)}.font-medium:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-medium);font-weight:var(--font-weight-medium)}.font-semibold:not(#\#):not(#\#){--tw-font-weight:var(--font-weight-semibold);font-weight:var(--font-weight-semibold)}.tracking-\[0\.5px\]:not(#\#):not(#\#){--tw-tracking:.5px;letter-spacing:.5px}.whitespace-nowrap:not(#\#):not(#\#){white-space:nowrap}.whitespace-pre-wrap:not(#\#):not(#\#){white-space:pre-wrap}.text-\(--flowengage-primary\):not(#\#):not(#\#),.text-\[var\(--flowengage-primary\)\]:not(#\#):not(#\#){color:var(--flowengage-primary)}.text-amber-500:not(#\#):not(#\#){color:var(--color-amber-500)}.text-black:not(#\#):not(#\#){color:var(--color-black)}.text-blue-500:not(#\#):not(#\#){color:var(--color-blue-500)}.text-emerald-500:not(#\#):not(#\#){color:var(--color-emerald-500)}.text-gray-400:not(#\#):not(#\#){color:var(--color-gray-400)}.text-gray-500:not(#\#):not(#\#){color:var(--color-gray-500)}.text-gray-900:not(#\#):not(#\#){color:var(--color-gray-900)}.text-red-400:not(#\#):not(#\#){color:var(--color-red-400)}.text-red-500:not(#\#):not(#\#){color:var(--color-red-500)}.text-red-700:not(#\#):not(#\#){color:var(--color-red-700)}.text-red-800:not(#\#):not(#\#){color:var(--color-red-800)}.text-white:not(#\#):not(#\#){color:var(--color-white)}.text-white\/90:not(#\#):not(#\#){color:#ffffffe6}@supports (color:color-mix(in lab, red, red)){.text-white\/90:not(#\#):not(#\#){color:color-mix(in oklab, var(--color-white) 90%, transparent)}}.placeholder-gray-400:not(#\#):not(#\#)::placeholder{color:var(--color-gray-400)}.opacity-0:not(#\#):not(#\#){opacity:0}.opacity-70:not(#\#):not(#\#){opacity:.7}.opacity-95:not(#\#):not(#\#){opacity:.95}.shadow-\[0_2px_6px_rgba\(0\,0\,0\,0\.04\)\]:not(#\#):not(#\#){--tw-shadow:0 2px 6px var(--tw-shadow-color,#0000000a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_4px_12px_rgba\(0\,0\,0\,0\.06\)\]:not(#\#):not(#\#){--tw-shadow:0 4px 12px var(--tw-shadow-color,#0000000f);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-\[0_8px_24px_rgba\(0\,0\,0\,0\.05\)\]:not(#\#):not(#\#){--tw-shadow:0 8px 24px var(--tw-shadow-color,#0000000d);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.shadow-sm:not(#\#):not(#\#){--tw-shadow:0 1px 3px 0 var(--tw-shadow-color,#0000001a), 0 1px 2px -1px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.ring:not(#\#):not(#\#){--tw-ring-shadow:var(--tw-ring-inset,) 0 0 0 calc(1px + var(--tw-ring-offset-width)) var(--tw-ring-color,currentcolor);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.outline:not(#\#):not(#\#){outline-style:var(--tw-outline-style);outline-width:1px}.filter:not(#\#):not(#\#){filter:var(--tw-blur,) var(--tw-brightness,) var(--tw-contrast,) var(--tw-grayscale,) var(--tw-hue-rotate,) var(--tw-invert,) var(--tw-saturate,) var(--tw-sepia,) var(--tw-drop-shadow,)}.backdrop-blur-sm:not(#\#):not(#\#){--tw-backdrop-blur:blur(var(--blur-sm));-webkit-backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,);backdrop-filter:var(--tw-backdrop-blur,) var(--tw-backdrop-brightness,) var(--tw-backdrop-contrast,) var(--tw-backdrop-grayscale,) var(--tw-backdrop-hue-rotate,) var(--tw-backdrop-invert,) var(--tw-backdrop-opacity,) var(--tw-backdrop-saturate,) var(--tw-backdrop-sepia,)}.transition:not(#\#):not(#\#){transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to,opacity,box-shadow,transform,translate,scale,rotate,filter,-webkit-backdrop-filter,backdrop-filter,display,content-visibility,overlay,pointer-events;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-all:not(#\#):not(#\#){transition-property:all;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-colors:not(#\#):not(#\#){transition-property:color,background-color,border-color,outline-color,text-decoration-color,fill,stroke,--tw-gradient-from,--tw-gradient-via,--tw-gradient-to;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-opacity:not(#\#):not(#\#){transition-property:opacity;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.transition-transform:not(#\#):not(#\#){transition-property:transform,translate,scale,rotate;transition-timing-function:var(--tw-ease,var(--default-transition-timing-function));transition-duration:var(--tw-duration,var(--default-transition-duration))}.duration-200:not(#\#):not(#\#){--tw-duration:.2s;transition-duration:.2s}.duration-300:not(#\#):not(#\#){--tw-duration:.3s;transition-duration:.3s}.ease-in-out:not(#\#):not(#\#){--tw-ease:var(--ease-in-out);transition-timing-function:var(--ease-in-out)}.outline-none:not(#\#):not(#\#){--tw-outline-style:none;outline-style:none}@media (hover:hover){.group-hover\:opacity-100:is(:where(.group):hover *):not(#\#):not(#\#){opacity:1}.hover\:-translate-y-0\.5:hover:not(#\#):not(#\#){--tw-translate-y:calc(var(--spacing) * -.5);translate:var(--tw-translate-x) var(--tw-translate-y)}.hover\:bg-black\/5:hover:not(#\#):not(#\#){background-color:#0000000d}@supports (color:color-mix(in lab, red, red)){.hover\:bg-black\/5:hover:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-black) 5%, transparent)}}.hover\:bg-gray-100:hover:not(#\#):not(#\#){background-color:var(--color-gray-100)}.hover\:bg-gray-200:hover:not(#\#):not(#\#){background-color:var(--color-gray-200)}.hover\:bg-white\/10:hover:not(#\#):not(#\#){background-color:#ffffff1a}@supports (color:color-mix(in lab, red, red)){.hover\:bg-white\/10:hover:not(#\#):not(#\#){background-color:color-mix(in oklab, var(--color-white) 10%, transparent)}}.hover\:text-gray-600:hover:not(#\#):not(#\#){color:var(--color-gray-600)}.hover\:text-gray-700:hover:not(#\#):not(#\#){color:var(--color-gray-700)}.hover\:text-red-600:hover:not(#\#):not(#\#){color:var(--color-red-600)}.hover\:shadow-\[0_6px_16px_rgba\(0\,0\,0\,0\.1\)\]:hover:not(#\#):not(#\#){--tw-shadow:0 6px 16px var(--tw-shadow-color,#0000001a);box-shadow:var(--tw-inset-shadow), var(--tw-inset-ring-shadow), var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow)}.enabled\:hover\:bg-\[var\(--flowengage-primary\)\]:enabled:hover:not(#\#):not(#\#){background-color:var(--flowengage-primary)}.enabled\:hover\:text-white:enabled:hover:not(#\#):not(#\#){color:var(--color-white)}}.disabled\:cursor-not-allowed:disabled:not(#\#):not(#\#){cursor:not-allowed}.disabled\:border-gray-300:disabled:not(#\#):not(#\#){border-color:var(--color-gray-300)}.disabled\:text-gray-300:disabled:not(#\#):not(#\#){color:var(--color-gray-300)}.disabled\:opacity-50:disabled:not(#\#):not(#\#){opacity:.5}.\[\&\>svg\]\:h-full:not(#\#):not(#\#)>svg{height:100%}.\[\&\>svg\]\:w-full:not(#\#):not(#\#)>svg{width:100%}.flowengage-shell:not(#\#),.flowengage-shell:not(#\#) *{font-family:inherit}.flowengage-chat-panel:not(#\#):not(#\#){border:none;border-radius:0;outline:none;flex-direction:column;width:100%;height:100%;display:flex;position:relative;overflow:hidden;box-shadow:0 20px 50px #00000026}@media (width>=768px){.flowengage-chat-panel:not(#\#):not(#\#){border-radius:24px;width:min(423px,100vw - 40px);height:min(700px,100vh - 120px)}}.flowengage-shell[data-open=true]:not(#\#):not(#\#){inset:0}@media (width>=768px){.flowengage-shell[data-open=true]:not(#\#):not(#\#){inset:auto 1.5rem 1.5rem auto}}.flowengage-logo-fallback:not(#\#):not(#\#){background:conic-gradient(from 180deg, var(--flowengage-primary) 0%, #2b70b5 50%, #f59e0b 100%)}.fe-bot-message:not(#\#):not(#\#) p{margin:0 0 .5em}.fe-bot-message:not(#\#):not(#\#) p:last-child{margin-bottom:0}.fe-bot-message:not(#\#):not(#\#) ul,.fe-bot-message:not(#\#):not(#\#) ol{margin:.4em 0 .4em 1.2em;padding:0}.fe-bot-message:not(#\#):not(#\#) li{margin-bottom:.25em}.fe-bot-message:not(#\#):not(#\#) strong{font-weight:600}.fe-bot-message:not(#\#):not(#\#) a{color:var(--flowengage-primary);text-decoration:underline}.fe-bot-message:not(#\#):not(#\#) a:hover{opacity:.8}.incoming-call-overlay:not(#\#):not(#\#){z-index:1000;-webkit-backdrop-filter:blur(10px);backdrop-filter:blur(10px);background:#1a1a2ef2;justify-content:center;align-items:center;transition:all .3s ease-in-out;display:flex;position:absolute;left:0;right:0}.incoming-call-overlay.bottom-mode:not(#\#):not(#\#){border-top:2px solid #ffffff1a;min-height:120px;animation:.4s cubic-bezier(.16,1,.3,1) slideUpBanner;top:auto;bottom:0;box-shadow:0 -10px 30px #00000080}.incoming-call-overlay.header-mode:not(#\#):not(#\#){border-bottom:2px solid #ffffff1a;min-height:80px;animation:.4s cubic-bezier(.16,1,.3,1) slideDownBanner;top:0;bottom:auto;box-shadow:0 10px 30px #00000080}.incoming-call-container:not(#\#):not(#\#){justify-content:space-between;align-items:center;gap:14px;width:100%;padding:14px 16px;display:flex}.incoming-call-container.connected-layout:not(#\#):not(#\#){flex-direction:column;justify-content:center;align-items:stretch;gap:14px}.call-connected-top:not(#\#):not(#\#){justify-content:space-between;align-items:center;gap:16px;width:100%;display:flex}.call-connected-identity:not(#\#):not(#\#){flex:1;align-items:center;gap:14px;min-width:0;display:flex}.call-icon-wrapper:not(#\#):not(#\#){color:#fff;z-index:1;border-radius:9999px;flex-shrink:0;justify-content:center;align-items:center;width:54px;height:54px;margin-right:4px;display:flex;position:relative}.call-icon-wrapper.incoming:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049);animation:1s ease-in-out infinite bounce}.call-icon-wrapper.connecting:not(#\#):not(#\#){background:linear-gradient(135deg,#2196f3,#1976d2)}.call-icon-wrapper.connected:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049)}.call-pulse-animation:not(#\#):not(#\#){z-index:-1;background:#4caf504d;border-radius:50%;width:120px;height:120px;animation:1.5s ease-out infinite pulse;position:absolute}.call-connecting-animation:not(#\#):not(#\#){z-index:-1;border:3px solid #0000;border-top-color:#2196f3;border-radius:50%;width:100px;height:100px;animation:1s linear infinite spin;position:absolute}.call-info-group:not(#\#):not(#\#){flex-direction:column;flex:1;min-width:0;margin-right:8px;display:flex}.call-title:not(#\#):not(#\#){color:#fff;white-space:normal;text-overflow:clip;margin:0;font-size:16px;font-weight:700;line-height:1.2;overflow:visible}.call-subtitle:not(#\#):not(#\#){color:#ffffffb3;white-space:normal;text-overflow:clip;margin:4px 0 0;font-size:12px;line-height:1.35;overflow:visible}.call-timer:not(#\#):not(#\#){text-align:center;color:#fff;flex-shrink:0;min-width:54px;font-size:13px;font-weight:700}.call-actions:not(#\#):not(#\#){flex-shrink:0;align-items:center;gap:8px;display:flex}.call-actions.connected:not(#\#):not(#\#){justify-content:center;width:100%}.flowengage-call-btn:not(#\#):not(#\#){cursor:pointer;color:#fff;border:none;border-radius:8px;justify-content:center;align-items:center;gap:6px;min-width:92px;padding:8px 12px;font-size:12px;font-weight:600;line-height:1;transition:transform .2s,box-shadow .2s,background .2s;display:flex}.flowengage-call-btn:not(#\#):not(#\#) svg{flex-shrink:0;display:block}.flowengage-call-btn:not(#\#):not(#\#) span{justify-content:center;align-items:center;line-height:1;display:flex}.flowengage-call-btn-accept:not(#\#):not(#\#){background:linear-gradient(135deg,#4caf50,#45a049);box-shadow:0 8px 24px #4caf5066}.flowengage-call-btn-reject:not(#\#):not(#\#),.flowengage-call-btn-end:not(#\#):not(#\#){background:linear-gradient(135deg,#f44336,#d32f2f);box-shadow:0 4px 12px #f4433666}.flowengage-call-btn-mute:not(#\#):not(#\#){background:#ffffff1a;border:2px solid #fff3}.flowengage-call-btn-mute.active:not(#\#):not(#\#){background:#f443364d;border-color:#f44336}.flowengage-call-btn:hover:not(:disabled):not(#\#):not(#\#){transform:scale(1.05)}.incoming-call-overlay.header-mode .flowengage-call-btn{border-radius:9999px!important;width:36px!important;min-width:36px!important;height:36px!important;padding:0!important}.incoming-call-overlay.header-mode .flowengage-call-btn span{display:none!important}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-icon-wrapper{width:40px;height:40px;margin-right:0}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-info-group{min-width:0}.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-title,.incoming-call-overlay.header-mode:not(#\#):not(#\#) .call-subtitle{white-space:nowrap;text-overflow:ellipsis;overflow:hidden}@media (width<=640px){.incoming-call-container:not(#\#):not(#\#){align-items:flex-start;gap:10px;padding:12px 14px}.incoming-call-container.connected-layout:not(#\#):not(#\#){align-items:stretch}.call-connected-top:not(#\#):not(#\#){flex-direction:column;align-items:flex-start;gap:10px}.call-connected-identity:not(#\#):not(#\#){width:100%}.call-info-group:not(#\#):not(#\#){margin-right:0}.call-actions:not(#\#):not(#\#){flex-wrap:wrap;align-self:stretch;gap:6px}.call-actions.connected:not(#\#):not(#\#){justify-content:stretch}.call-actions.connected:not(#\#):not(#\#) .flowengage-call-btn{flex:1}.flowengage-call-btn:not(#\#):not(#\#){min-width:78px;padding:8px 10px}}@keyframes slideUpBanner{0%{transform:translateY(100%)}to{transform:translateY(0)}}@keyframes slideDownBanner{0%{transform:translateY(-100%)}to{transform:translateY(0)}}@keyframes bounce{0%,to{animation-timing-function:cubic-bezier(.8,0,1,1);transform:translateY(-25%)}50%{animation-timing-function:cubic-bezier(0,0,.2,1);transform:none}}@keyframes pulse{50%{opacity:.5}}@keyframes spin{to{transform:rotate(360deg)}}@property --tw-rotate-x{syntax:"*";inherits:false}@property --tw-rotate-y{syntax:"*";inherits:false}@property --tw-rotate-z{syntax:"*";inherits:false}@property --tw-skew-x{syntax:"*";inherits:false}@property --tw-skew-y{syntax:"*";inherits:false}@property --tw-border-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-leading{syntax:"*";inherits:false}@property --tw-font-weight{syntax:"*";inherits:false}@property --tw-tracking{syntax:"*";inherits:false}@property --tw-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-shadow-color{syntax:"*";inherits:false}@property --tw-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-inset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-shadow-color{syntax:"*";inherits:false}@property --tw-inset-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-ring-color{syntax:"*";inherits:false}@property --tw-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-inset-ring-color{syntax:"*";inherits:false}@property --tw-inset-ring-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-ring-inset{syntax:"*";inherits:false}@property --tw-ring-offset-width{syntax:"<length>";inherits:false;initial-value:0}@property --tw-ring-offset-color{syntax:"*";inherits:false;initial-value:#fff}@property --tw-ring-offset-shadow{syntax:"*";inherits:false;initial-value:0 0 #0000}@property --tw-outline-style{syntax:"*";inherits:false;initial-value:solid}@property --tw-blur{syntax:"*";inherits:false}@property --tw-brightness{syntax:"*";inherits:false}@property --tw-contrast{syntax:"*";inherits:false}@property --tw-grayscale{syntax:"*";inherits:false}@property --tw-hue-rotate{syntax:"*";inherits:false}@property --tw-invert{syntax:"*";inherits:false}@property --tw-opacity{syntax:"*";inherits:false}@property --tw-saturate{syntax:"*";inherits:false}@property --tw-sepia{syntax:"*";inherits:false}@property --tw-drop-shadow{syntax:"*";inherits:false}@property --tw-drop-shadow-color{syntax:"*";inherits:false}@property --tw-drop-shadow-alpha{syntax:"<percentage>";inherits:false;initial-value:100%}@property --tw-drop-shadow-size{syntax:"*";inherits:false}@property --tw-backdrop-blur{syntax:"*";inherits:false}@property --tw-backdrop-brightness{syntax:"*";inherits:false}@property --tw-backdrop-contrast{syntax:"*";inherits:false}@property --tw-backdrop-grayscale{syntax:"*";inherits:false}@property --tw-backdrop-hue-rotate{syntax:"*";inherits:false}@property --tw-backdrop-invert{syntax:"*";inherits:false}@property --tw-backdrop-opacity{syntax:"*";inherits:false}@property --tw-backdrop-saturate{syntax:"*";inherits:false}@property --tw-backdrop-sepia{syntax:"*";inherits:false}@property --tw-duration{syntax:"*";inherits:false}@property --tw-ease{syntax:"*";inherits:false}@property --tw-translate-x{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-y{syntax:"*";inherits:false;initial-value:0}@property --tw-translate-z{syntax:"*";inherits:false;initial-value:0}
3
3
  /*$vite$:1*/