sentifyd-bot 1.3.1 ā 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/dist/AzureTalkingAvatar-DwFpnwON.js +1 -0
- package/dist/LiveCaptions-CxsuwP4M.js +1 -0
- package/dist/TalkingAvatar--N4jOsLi.js +1 -0
- package/dist/index-DY_KYJkq.js +3016 -0
- package/dist/index.es.js +1 -2583
- package/package.json +2 -2
|
@@ -0,0 +1,3016 @@
|
|
|
1
|
+
import{io as t}from"socket.io-client";import{AudioConfig as e,SpeechRecognizer as a,ResultReason as i,CancellationReason as n,CancellationErrorCode as s,SpeechConfig as o,PropertyId as r,AutoDetectSourceLanguageConfig as c}from"microsoft-cognitiveservices-speech-sdk";import"js-cookie";import{jwtDecode as l}from"jwt-decode";import{v4 as h}from"uuid";import{createMachine as d,assign as u,fromPromise as p,createActor as g}from"xstate";import{html as v,nothing as m,css as _,LitElement as b}from"lit";import f from"toastify-js";import{styleMap as y}from"lit/directives/style-map.js";const w=t=>new Promise((e=>setTimeout(e,t))),S=t=>{if(t){let e=t;return e=e.replace(/<(prosody|emphasis|say-as|phoneme|sub|voice|lang|p|s|w|audio|mark|desc)[^>]*>([\s\S]*?)<\/\1>/gi,"$2"),e=e.replace(/<(break|mark|audio)[^>]*\/?>/gi,""),e=e.replace(/<\/?[a-zA-Z][^>]*>/g,""),e.replace(/#\*[\s\S]*?\*#/g,"").trim()}return t},C=t=>(t instanceof Date?t:new Date(t)).toLocaleTimeString("en-GB",{hour:"2-digit",minute:"2-digit",second:"2-digit",hour12:!1});function A(){return"undefined"!=typeof window&&window.VITE_APP_SOCKET_URL?window.VITE_APP_SOCKET_URL:"https://sentifyd-serve.agreeablestone-0bc8c055.swedencentral.azurecontainerapps.io"}const k=A(),T={auth:{tokenRefreshInterval:6e5,speechTokenInterval:42e4,maxLoginRetries:3,loginRetryDelay:5e3,closeToExpirationLimit:6e4,speechTokenRetries:5,serverBaseURL:A()},avatar:{type:"gltf"},constants:{HEADROLL_BLENDSHAPE_INDEX:52,LEFTEYE_BLENDSHAPE_INDEX:53,RIGHTEYE_BLENDSHAPE_INDEX:54,FRAME_RATE:60},dom:{avatarDivId:"#avatar-container",toastifyDivId:"#toastify-container",canvasWidth:400,canvasHeight:500,headerAndFooterHeight:166,controlsHeight:90,smallDisplayWidth:768,smallScreenSafetyPadding:24},renderer:{alpha:!0,antialias:!0},speech:{authorizationEndPoint:"/api/v1/chatbot/get-speech-token",maxDurationTimeout:6e5,vad:{segmentationSilenceMs:1700,initialSilenceMs:12e3,semantic:!0},bargeIn:{enabled:!0,debug:!1}},captions:{wordsPerMinute:140,maxCharactersPerCaption:40,minCharactersPerCaption:15,captionChangeDelay:200,captionTimeout:1500},alerts:{maxAlerts:3,dismissableAlertDuration:4500},chatbot:{streaming:!1,thinkingTimeout:15e3,speakingTimeout:24e4},test:{stateTestMode:!1,enableDiagnostics:!1},connection:{reconnectInitialDelay:2e3,reconnectMaxDelay:3e4,reconnectFactor:1.6},videoAvatar:{idleDisconnectEnabled:!0,idleDisconnectMs:6e4,idleDisconnectPollMs:5e3,debug:!1}},x=async(t,e)=>{for(const a of t){const{name:t}=a;switch(t){case"RequestUserData":await I(e);break;case"EndConversation":await E(e);break;case"DisableCaptions":await D(e);break;case"EnableCaptions":await M(e);break;case"SwitchToChatMode":await R(e);break;case"SwitchToAvatarMode":await P(e);break;case"SetAvatarView":await z(e,a.view);break;case"SetAvatarMood":await O(e,a.mood);break;case"PlayOrStopAvatarGesture":await L(e,a.gesture,a.dur||3,a.mirror||!1,a.ms||1e3);break;case"PlayOrStopAvatarAnimation":await N(e,a.animation,a.dur||3);break;case"ControlAvatarLookAt":await B(e,a.target,a.t||1e3,a.x||0,a.y||0)}}},I=async t=>{t.emit("event_command_UI_RequestUserData")},E=async t=>{t.emit("event_command_UI_EndConversation")},D=async t=>{t.emit("event_command_UI_DisableCaptions")},M=async t=>{t.emit("event_command_UI_EnableCaptions")},R=async t=>{t.emit("event_command_UI_SwitchToChatMode")},P=async t=>{t.emit("event_command_UI_SwitchToAvatarMode")},z=async(t,e)=>{t.emit("event_command_Avatar_SetAvatarView",{view:e})},O=async(t,e)=>{t.emit("event_command_Avatar_SetAvatarMood",{mood:e})},L=async(t,e,a,i,n)=>{t.emit("event_command_Avatar_PlayOrStopGesture",{gesture:e,duration:a,mirror:i,ms:n})},N=async(t,e,a)=>{t.emit("event_command_Avatar_PlayOrStopAnimation",{animation:e,dur:a})},B=async(t,e,a,i,n)=>{t.emit("event_command_Avatar_ControlAvatarLookAt",{target:e,t:a,x:i,y:n})};class V{constructor(t,e=null){this.validateDependencies({auth:t}),this.socketUrl=k,this.auth=t,this.socket=null,this.isAuthenticating=!1,this.onConnectionStatusChange=e}validateDependencies(t){const e=Object.entries(t).filter((([t,e])=>!e)).map((([t])=>t));if(e.length>0)throw new Error(`Cannot initialize WebSocketManager due to missing dependencies: ${e.join(", ")}`)}async connect(){this.socket?.connected&&this.disconnect();const e=this.auth.getAccessToken();return new Promise(((a,i)=>{this.socket=t(this.socketUrl,{auth:{token:`Bearer ${e}`},path:"/socket.io",reconnection:!0,reconnectionAttempts:5,reconnectionDelay:500,reconnectionDelayMax:1e4}),this.registerWebsocketEventHandlers(a,i)}))}isSocketConnected(){return this.socket?.connected}isInitialised(){return null!==this.socket}disconnect(){this.socket&&(this.socket.disconnect(),this.socket.removeAllListeners(),this.socket=null)}registerWebsocketEventHandlers(t,e){this.socket.removeAllListeners(),this.socket.io.on("error",(t=>{})),this.socket.io.on("reconnect",(()=>{this.onConnectionStatusChange&&this.onConnectionStatusChange("connected")})),this.socket.io.on("reconnect_attempt",(t=>{})),this.socket.io.on("reconnect_error",(t=>{})),this.socket.io.on("reconnect_failed",(()=>{this.onConnectionStatusChange&&this.onConnectionStatusChange("failed"),this.socket=null,e(new Error("Websocket connection failed after maximum retries."))})),this.socket.on("connect",(()=>{this.socket.io.engine,this.onConnectionStatusChange&&this.onConnectionStatusChange("connected"),t()})),this.socket.on("connect_error",(t=>{t.message.includes("Token expired")||t.message.includes("Invalid token")?this.reAuthenticate():(this.onConnectionStatusChange&&this.onConnectionStatusChange("disconnected"),e?.(t))})),this.socket.on("disconnect",(t=>{this.socket&&this.socket.active||this.onConnectionStatusChange&&this.onConnectionStatusChange("disconnected")})),this.socket.onAny(((t,...e)=>{}))}reAuthenticate(){this.isAuthenticating||(this.isAuthenticating=!0,this.auth.authenticate().then((()=>{this.connect(),this.isAuthenticating=!1})).catch((t=>{this.isAuthenticating=!1,this.onConnectionStatusChange("failed")})))}on(t,e){this.socket&&this.socket.on(t,e)}off(t,e){this.socket&&(e?this.socket.off(t,e):this.socket.off(t))}emit(t,e,a){this.isSocketConnected()?a?this.socket.emit(t,e,a):this.socket.emit(t,e):this.onConnectionStatusChange&&this.onConnectionStatusChange("disconnected")}async emitWithResponse(t,e){return new Promise(((a,i)=>{this.isSocketConnected()?this.socket.emit(t,e,(t=>{a(t)})):(this.onConnectionStatusChange&&this.onConnectionStatusChange("disconnected"),i(new Error("Socket not connected")))}))}timeoutEmit(t,e,a,i){this.isSocketConnected()?i?this.socket.timeout(a).emit(t,e,i):this.socket.timeout(a).emit(t,e):this.onConnectionStatusChange&&this.onConnectionStatusChange("disconnected")}destroy(){this.socket&&(this.socket.disconnect(),this.socket.removeAllListeners(),this.socket=null),this.isAuthenticating=!1,this.onConnectionStatusChange=null}}class F{constructor(t,e={}){if(!t||"string"!=typeof t)throw new Error("ConnectionModule requires a valid name");this.name=t,this.connectionState="disconnected",this.blocking=!1!==e?.blocking,this.autoReconnect=!1!==e?.autoReconnect,this.subscribers=[]}isConnecting(){return"connecting"===this.connectionState}isDisconnected(){return"disconnected"===this.connectionState}isReconnecting(){return"reconnecting"===this.connectionState}isConnected(){return"connected"===this.connectionState}isFailed(){return"failed"===this.connectionState}setConnected(){this.updateConnectionState("connected")}setDisconnected(){this.updateConnectionState("disconnected")}setConnecting(){this.updateConnectionState("connecting")}setReconnecting(){this.updateConnectionState("reconnecting")}setFailed(){this.updateConnectionState("failed")}updateConnectionState(t){return!!["connected","connecting","reconnecting","disconnected","failed"].includes(t)&&this.connectionState!==t&&(this.connectionState,this.connectionState=t,this.notifySubscribers(),!0)}reconnect(){}subscribe(t){return"function"==typeof t&&!this.subscribers.includes(t)&&(this.subscribers.push(t),!0)}unsubscribe(t){if("function"!=typeof t)return!1;const e=this.subscribers.length;return this.subscribers=this.subscribers.filter((e=>e!==t)),this.subscribers.length<e}notifySubscribers(){0!==this.subscribers.length&&[...this.subscribers].forEach(((t,e)=>{try{t(this.connectionState,this.name)}catch(a){}}))}destroy(){try{this.subscribers=[],this.connectionState="disconnected"}catch(t){}}getStateInfo(){return{name:this.name,state:this.connectionState,subscriberCount:this.subscribers.length}}}class ${constructor(t,e,a){this.id=t,this.state="CREATED",this.abortController=new AbortController,this.audio=(t=>{let e,a=!1;return{readable:new ReadableStream({start(i){e=i,t?.addEventListener("abort",(()=>{try{e.error(new DOMException("Aborted","AbortError"))}catch{}a=!0}))}}),push:t=>{if(!a)try{e?.enqueue(t)}catch(i){}},close:()=>{if(!a)try{e?.close(),a=!0}catch(t){}},get isClosed(){return a}}})(this.abortController.signal),this.lipsync=(t=>{let e,a=!1;return{readable:new ReadableStream({start(a){e=a,t?.addEventListener("abort",(()=>{try{e.error(new DOMException("Aborted","AbortError"))}catch{}}))}}),push:t=>{if(!a)try{e?.enqueue(t)}catch(i){}},close:()=>{if(!a)try{e?.close(),a=!0}catch(t){}},get isClosed(){return a}}})(this.abortController.signal),this._watchdog=setTimeout((()=>{this._watchdog=null,a?.(this)}),e)}activate(){this.state="ACTIVE"}finish(){if("FINISHED"!==this.state){this.state="FINISHED",clearTimeout(this._watchdog);try{this.audio.close()}catch{}try{this.lipsync.close()}catch{}this.abortController.abort("turn finished")}}abort(){"FINISHED"!==this.state&&(this.state="STOPPING",this.abortController.abort("turn interrupted"),clearTimeout(this._watchdog))}get isActive(){return"ACTIVE"===this.state}get done(){return"FINISHED"===this.state}}const U={THREE_D:"3d",VIDEO:"video"},H={Azure:U.VIDEO,Simli:U.VIDEO,ReadyPlayerMe:U.THREE_D,Avaturn:U.THREE_D};function j(t){return t&&H[t.trim()]||U.THREE_D}function q(t){return j(t)===U.VIDEO}function G(t){return!!t&&"Azure"===t.trim()}const W=12e4;class K extends F{static _instance=null;constructor(t,e,a,i){if(K._instance)return K._instance;super("chatSocket"),this.validateDependencies({bus:t,auth:e,sessionData:a,avatarOrchestrator:i}),this.socketManager=new V(e,(t=>this.updateConnectionState(t))),this.isChatbotShown=!0,this._chatbotMode="AVATAR",this.bus=t,this.sessionData=a,this.auth=e,this.avatarOrchestrator=i,this.pendingDelayedActions=null,this.turn=null,this.INTERRUPT_WATCHDOG=15e3,K._instance=this}get chatbotMode(){return this._chatbotMode}set chatbotMode(t){const e="string"==typeof t&&t?t:this._chatbotMode,a=this._chatbotMode;if(this._chatbotMode=e,a!==e)try{this.bus?.emit?.("event_status_ChatbotMode_Changed",{chatbotMode:e})}catch(i){}}static getInstance(t,e,a,i){return K._instance||(K._instance=new K(t,e,a,i)),K._instance}_isDataForCurrentTurn(){return!!this.turn&&!this.turn.done&&this.turn.id===this.sessionData.conversation.currentTurnId}finishCurrentTurn(){this.turn&&!this.turn.done&&(this.turn.finish(),this.turn=null)}static resetInstance(){K._instance&&(K._instance._cleanup(),K._instance=null)}_cleanup(){this.cleanupActiveStreams(),this.removeTTSEventHandlers(),this.socketManager?.disconnect(),this.pendingDelayedActions=null,this.turn=null,this.audioStream=null,this.lipsyncStream=null}validateDependencies(t){const e=Object.entries(t).filter((([t,e])=>!e)).map((([t])=>t));if(e.length>0)throw new Error(`Cannot initialize ChatSocket due to missing dependencies: ${e.join(", ")}`)}async init(){if(!this.sessionData||!this.sessionData.avatarName||!this.sessionData.language)throw new Error("Missing required session data for chat connection.");this.sessionData.trainingId;try{this.setConnecting(),await this.socketManager.connect()}catch(t){this.setDisconnected()}this.registerTTSEventHandlers()}async reconnect(){if(!this.isConnected()&&!this.isReconnecting()){this.isFailed()?this.setReconnecting():this.setConnecting();try{if(await this.socketManager.connect(),!this.socketManager.isSocketConnected())throw new Error("Socket still not connected after connect()");this.registerTTSEventHandlers(),this.setConnected()}catch(t){this.setFailed()}}}removeTTSEventHandlers(){this.socketManager&&["conversation_ai_reply","tts_stream_start","tts_viseme","tts_word","tts_blend","tts_error","tts_chunk","tts_stream_end"].forEach((t=>{this.socketManager.off(t)}))}registerTTSEventHandlers(){this.removeTTSEventHandlers(),this.socketManager.on("conversation_ai_reply",(t=>this.handleConversationResponse(t))),this.socketManager.on("tts_stream_start",(t=>{t?.turnId,this.turn&&this.turn.id===this.sessionData.conversation.currentTurnId||this.prepareStreamsForTurn(this.sessionData.conversation.currentTurnId),this.turn.activate(),this.avatarOrchestrator&&this.avatarOrchestrator.sendEvent("STREAM_START",{audioStream:this.audioStream,lipsyncStream:this.lipsyncStream,turnId:this.turn.id})})),this.socketManager.on("tts_viseme",(t=>{if(this._isDataForCurrentTurn()&&this.lipsyncStream&&!this.lipsyncStream.isClosed&&this.turn&&this.turn.isActive)try{this.lipsyncStream.push({type:"viseme",...t})}catch(e){if(e.message?.includes("closed readable stream"))return}})),this.socketManager.on("tts_word",(t=>{if(this._isDataForCurrentTurn()&&this.lipsyncStream&&!this.lipsyncStream.isClosed){if(!this.turn||!this.turn.isActive||!this.lipsyncStream)return;try{this.lipsyncStream.push({type:"word",...t})}catch(e){e.message?.includes("closed readable stream")}}})),this.socketManager.on("tts_blend",(t=>{if(this._isDataForCurrentTurn()&&this.lipsyncStream&&!this.lipsyncStream.isClosed){if(!this.turn||!this.turn.isActive||!this.lipsyncStream)return;try{this.lipsyncStream.push({type:"blend",...t})}catch(e){e.message?.includes("closed readable stream")}}})),this.socketManager.on("tts_error",(t=>{this.avatarOrchestrator&&this.avatarOrchestrator.sendEvent("TTS_ERROR",{error:t})})),this.socketManager.on("tts_chunk",(t=>{if(this._isDataForCurrentTurn()&&this.audioStream&&!this.audioStream.isClosed){if(!this.turn||!this.turn.isActive||!this.audioStream)return;try{this.audioStream.push(t)}catch(e){e.message?.includes("closed readable stream")}}})),this.socketManager.on("tts_stream_end",(t=>{const e=t?.turnId;t?.reason,this.turn&&e===this.turn.id&&(this.turn.finish(),this.avatarOrchestrator.sendEvent("STREAM_END"),this.turn=null)}))}async handleConversationResponse(t){if(this.sessionData?.conversation?.conversationId)if("success"===t?.status)t?.error,await this.processAIResponse(t);else if("error"===t?.status){const e={...t.error};t.conversationId&&!e.conversationId&&(e.conversationId=t.conversationId),this.avatarOrchestrator.sendEvent("CONVERSATION_ERROR",{error:e,chatbotMode:this.chatbotMode})}else this.avatarOrchestrator.sendEvent("CONVERSATION_ERROR",{error:{message:"No response from server. Please try again."},chatbotMode:this.chatbotMode})}async sendInitConversationEvent(){if(!this.socketManager.isSocketConnected())throw new Error("Socket not available.");return new Promise(((t,e)=>{this.socketManager.timeoutEmit("init_conversation",{avatarId:this.sessionData.avatarId,trainingId:this.sessionData.trainingId,conversationId:this.sessionData.conversation.conversationId,chatbotMode:this.chatbotMode,streaming:!1},W,((a,i)=>{a||"success"!==i?.status?e(new Error(a||i?.error?.message||"Conversation init failed")):t({initialized:!0})}))}))}async sendStartConversationEvent(t=!1,e={}){if(!this.socketManager.isSocketConnected())throw new Error("Socket not available.");const a=e.avatarSource??this.sessionData?.avatarItem?.avatarSource,i="boolean"==typeof e.isVideoAvatar?e.isVideoAvatar:!!a&&q(a),n=e.skipWelcome??i;return new Promise(((e,a)=>{this.socketManager.timeoutEmit("start_conversation",{avatarId:this.sessionData.avatarId,trainingId:this.sessionData.trainingId,conversationId:this.sessionData.conversation.conversationId,chatbotMode:this.chatbotMode,detectedLanguage:this.sessionData.language||"en-US",voice:this.sessionData.voice||"",lipsyncType:this.sessionData.lipsyncType,turnId:this.sessionData.conversation.currentTurnId,streaming:!1,isTermsAccepted:!0===this.sessionData.isTermsAccepted,isResume:t,skipWelcome:n},W,(async(t,i)=>{if(t||"success"!==i?.status){const e=i?.error?.code,n=t||i?.error?.message||"Conversation start failed";a(new Error(e?`${e}: ${n}`:n))}else try{await this.processAIResponse(i),e(i)}catch(n){a(n)}}))}))}async sendEndConversationEvent(t,e){if(!this.socketManager.isSocketConnected())throw new Error("Socket not available.");try{q(this.sessionData?.avatarItem?.avatarSource)?await new Promise((e=>{const a=setTimeout(e,2e3);this.bus?.emit?.("event_status_Conversation_Ending",{conversationId:t,onDisconnectComplete:()=>{clearTimeout(a),e()}})})):this.bus?.emit?.("event_status_Conversation_Ending",{conversationId:t})}catch(a){}this.socketManager.emit("end_conversation",{conversationId:t,satisfactionScore:e,chatbotMode:this.chatbotMode},(e=>{"success"===e?.status?this.avatarOrchestrator.sendEvent("CLEAR_CONVERSATION",{conversationId:t}):e?.status}))}prepareStreamsForTurn(t){this.turn&&!this.turn.done&&this.turn.abort(),this.turn=new $(t,this.INTERRUPT_WATCHDOG,(t=>{this.socketManager.emit("interrupt_tts",{turnId:t.id})})),this.audioStream=this.turn.audio,this.lipsyncStream=this.turn.lipsync}async processAIResponse(t){try{const e=t?.data?.actions||[],a=e.filter((t=>!1!==t.immediate)),i=e.filter((t=>!1===t.immediate)),n=a.some((t=>"SwitchToAvatarMode"===t.name));if(a.length>0&&await x(a,this.bus),i.length>0&&(this.pendingDelayedActions=i),"resume_silent"===t.data?.dataType)return;if("message"===t.data?.dataType?await this.receiveMessage(t.data,t.timestamp,{switchedToAvatar:n}):"avatar_structured_response"===t.data?.dataType?await this.receiveAvatarStructuredResponse(t.data,t.timestamp,{switchedToAvatar:n}):t?.data?.messageContent&&await this.receiveMessage(t.data,t.timestamp,{switchedToAvatar:n}),"CHAT"===this.chatbotMode&&this.pendingDelayedActions&&this.pendingDelayedActions.length>0)try{await x(this.pendingDelayedActions,this.bus)}finally{this.pendingDelayedActions=null}}catch(e){this.avatarOrchestrator.sendEvent("CONVERSATION_ERROR",{error:{message:"Error getting a response. Please try again."},chatbotMode:this.chatbotMode})}}async receiveAvatarStructuredResponse(t,e,a={}){if(!t?.structuredResponse)throw new Error("Avatar response is invalid");const i=C(e);this.avatarOrchestrator.sendEvent("AI_MESSAGE_RECEIVED",{message:t.messageContent,time:i,structuredResponse:t.structuredResponse,chatbotMode:this.chatbotMode,switchedToAvatar:a.switchedToAvatar})}async receiveMessage(t,e,a={}){if(!t?.messageContent)throw new Error("Message is invalid");const i=C(e);this.avatarOrchestrator.sendEvent("AI_MESSAGE_RECEIVED",{message:t.messageContent,time:i,chatbotMode:this.chatbotMode,switchedToAvatar:a.switchedToAvatar})}async sendMessage(t,e="CHAT"){if(this.pendingDelayedActions=null,!this.sessionData.trainingId||!t?.messageText)return{success:!1,error:"Missing required field(s)"};if(!this.sessionData.conversation.conversationId)return{success:!1,error:"No conversation found. Start a conversation first."};try{const a=this.sessionData.conversation.incrementTurnId();"AVATAR"===e?this.prepareStreamsForTurn(a):this.turn&&(this.turn.abort(),this.turn=null),this.socketManager.emit("user_chat_message",{trainingId:this.sessionData.trainingId,avatarId:this.sessionData.avatarId,userName:this.sessionData.username,conversationId:this.sessionData.conversation.conversationId,turnId:a,message:t.messageText,messageDuration:t?.messageDuration||0,chatbotMode:e,detectedLanguage:t?.detectedLanguage||this.sessionData.language,voice:this.sessionData.voice||"",lipsyncType:this.sessionData.lipsyncType,streaming:T.chatbot.streaming||!1});const i=C(new Date);return this.avatarOrchestrator.sendEvent("USER_MESSAGE_SENT",{message:t.messageText,time:i,chatbotMode:e}),this.sessionData.conversation.lastDetectedLanguage=t?.detectedLanguage,{success:!0}}catch(a){return{success:!1,error:a.message||"An error occurred while sending the message"}}}sendUserData(){const t=this.sessionData.conversation.incrementTurnId();if(this.prepareStreamsForTurn(t),this.avatarOrchestrator){const t=this.avatarOrchestrator.getSnapshot(),e=t?.matches("lifecycle.conversation.inProgress.thinking");e||this.avatarOrchestrator.sendEvent("USER_MESSAGE_SENT",{message:"[User data update]",time:C(new Date),chatbotMode:this.chatbotMode})}if(!this.socketManager.isSocketConnected())throw new Error("Socket not available.");this.socketManager.emit("update_user_data",{conversationId:this.sessionData.conversation.conversationId,turnId:t,detectedLanguage:this.sessionData.language||"en-US",voice:this.sessionData.voice||"",chatbotMode:this.chatbotMode,lipsyncType:this.sessionData.lipsyncType,userData:{username:this.sessionData.username,phoneNumber:this.sessionData.phoneNumber,email:this.sessionData.email,isTermsAccepted:this.sessionData.isTermsAccepted}},(async t=>{"success"===t?.status?this.processAIResponse(t):t?.status}))}cleanupActiveStreams(){this.turn&&this.turn.abort()}async interruptCurrentTurn(){if(!this.turn)return{status:"warning",message:"No active turn"};try{return this.turn.abort(),await this.socketManager.emitWithResponse("interrupt_tts",{turnId:this.turn.id,chatbotMode:this.chatbotMode})}catch(t){return{status:"error",message:"Interruption failed"}}}destroy(){this.socketManager?.destroy()}}class Q{constructor({recognizer:t,speechConfig:e,audioConfig:a,bus:i,avatarOrchestrator:n,autoDetectLanguage:s}={}){this.validateDependencies({recognizer:t,speechConfig:e,audioConfig:a,bus:i,avatarOrchestrator:n}),this.bus=i,this.avatarOrchestrator=n,this.speechConfig=e,this.recognizer=t,this.audioConfig=a,this.messageText="",this.messageDuration=0,this.detectedLanguage="",this.isMessageSent=!1,this.isListening=!1,this.isMicDetected=!0,this.autoDetectLanguage=s,this.languageDurations={},this._isStopping=!1,this.maxDurationTimeoutId=null}_isFsmListening(){try{const t=this.avatarOrchestrator?.getSnapshot?.();return!(!t||!("function"==typeof t.matches&&t.matches("lifecycle.conversation.inProgress.listening")||"function"==typeof t.hasTag&&t.hasTag("listening")))}catch(t){return!1}}validateDependencies(t){const e=Object.entries(t).filter((([t,e])=>!e)).map((([t])=>t));if(e.length>0)throw new Error(`Cannot initialize SpeechRecognition due to missing dependencies: ${e.join(", ")}`)}static async build(t,e,a,i){if(!t)throw new Error("speechConfig is required");const{recognizer:n,audioConfig:s}=await this.init(t,e),o=new Q({recognizer:n,speechConfig:t,audioConfig:s,bus:a,avatarOrchestrator:i,autoDetectLanguage:!!e});return o._registerRecognizerEvents(),o}static async init(t,i){try{const n=e.fromDefaultMicrophoneInput();let s=null;return s=i?a.FromConfig(t,i,n):new a(t,n),{recognizer:s,audioConfig:n}}catch(n){throw new Error("Error in SpeechRecognition initialization: "+n)}}static async checkMicrophoneAccess(){try{if(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)throw new Error("Media devices not supported");if(0===(await navigator.mediaDevices.enumerateDevices()).filter((t=>"audioinput"===t.kind)).length)throw new Error("No microphone devices found");return(await navigator.mediaDevices.getUserMedia({audio:!0})).getTracks().forEach((t=>t.stop())),!0}catch(t){throw new Error(`Microphone access issue: ${t.message}`)}}start(){try{this._isStopping=!1,clearTimeout(this.maxDurationTimeoutId),this.messageText="",this.messageDuration=0,this.isMessageSent=!1,this.autoDetectLanguage&&(this.languageDurations={}),this.recognizeNewMessage(),this._setMaxDurationTimeout()}catch(t){this.stop()}}stop(){if(!this._isStopping){this._isStopping=!0;try{this.recognizer&&this.recognizer.stopContinuousRecognitionAsync()}catch(t){}finally{this.isListening=!1,this._isStopping=!1}clearTimeout(this.maxDurationTimeoutId)}}sendMessage(){if(!this.isMessageSent&&this.messageText&&this.messageText.trim())try{this.autoDetectLanguage?this.detectedLanguage=this._determineMainLanguage():this.detectedLanguage=this.speechConfig.speechRecognitionLanguage,this.avatarOrchestrator.sendEvent("SPEECH_RECOGNITION_COMPLETE",{messageText:this.messageText,messageDuration:this.messageDuration,detectedLanguage:this.detectedLanguage}),this.isMessageSent=!0}catch(t){}}simulateRecognition(){this.avatarOrchestrator.transitionToListening(),this.messageText="Hello, how are you doing today?",this.avatarOrchestrator.sendEvent("SPEECH_RECOGNITION_COMPLETE",{messageText:this.messageText,messageDuration:3e3,detectedLanguage:"en-US"})}recognizeNewMessage(){try{this._startRecognizer()}catch(t){this._emitAlert("alertMicrophoneStartFailed"),this.stop()}}_startRecognizer(){this.recognizer.startContinuousRecognitionAsync((()=>{this._isFsmListening(),this.isListening=!0}),(async t=>{await this._handleRecognitionStartupError(t),this.isMicDetected=!1,this.stop()}))}async _handleRecognitionStartupError(t){let e="alertMicrophoneCheckSettings";try{await Q.checkMicrophoneAccess(),e="alertSpeechRecognitionSetupFailed"}catch(a){e=this._isBrowserPermissionError(a)?"alertMicrophoneAccessDenied":this._isBrowserDeviceError(a)?"alertNoMicrophoneDetected":"alertMicrophoneError"}this._emitAlert(e)}_isBrowserPermissionError(t){if(t&&"object"==typeof t)return"NotAllowedError"===t.name||"PermissionDeniedError"===t.name||"SecurityError"===t.name;const e=t.toString().toLowerCase();return e.includes("permission")||e.includes("notallowed")||e.includes("denied")}_isBrowserDeviceError(t){if(t&&"object"==typeof t)return"NotFoundError"===t.name||"DevicesNotFoundError"===t.name;const e=t.toString().toLowerCase();return e.includes("notfound")||e.includes("device")||e.includes("microphone not found")}close(){this.stop(),this.recognizer&&(this.recognizer.close(),this.recognizer.dispose(!0),this.recognizer=void 0)}_registerRecognizerEvents(){this.recognizer.sessionStarted=(t,e)=>{},this.recognizer.sessionStopped=(t,e)=>{if(!this._isStopping&&(this.isListening=!1,this._isFsmListening()))try{this.avatarOrchestrator.transitionToIdle()}catch(a){}},this.recognizer.recognized=(t,e)=>{if(!this._isStopping&&this.isListening&&!this.isMessageSent)if(e.result.reason===i.RecognizedSpeech){if(""!==e.result.text){if(this.messageText=(this.messageText?this.messageText+" ":"")+e.result.text,this.messageDuration+=e.result.duration,this.autoDetectLanguage){const t=e.result.language,a=e.result.duration;this.languageDurations[t]?this.languageDurations[t]+=a:this.languageDurations[t]=a}this.bus.emit("event_command_UI_UpdateSTTCaption",{STTCaption:this.messageText}),this._completeRecognitionTurn()}}else e.result.reason,i.NoMatch},this.recognizer.recognizing=(t,e)=>{this._isStopping||!this.isListening||this.isMessageSent||""!==e.result.text&&this.bus.emit("event_command_UI_UpdateSTTCaption",{STTCaption:this.messageText+" "+e.result.text})},this.recognizer.speechStartDetected=(t,e)=>{},this.recognizer.speechEndDetected=(t,e)=>{this._isStopping||!this.isListening||this.isMessageSent||this.messageText?.trim()&&this._completeRecognitionTurn()},this.recognizer.canceled=(t,e)=>{if(e.reason===n.Error&&this._handleAzureSpeechError(e),this.stop(),this._isFsmListening())try{this.avatarOrchestrator.transitionToIdle()}catch(a){}}}_handleAzureSpeechError(t){const e=t.errorCode,a=t.errorDetails||"No additional details available";let i="",n=!1;switch(e){case s.NoError:i="alertSomeErrorOccurred";break;case s.AuthenticationFailure:i="alertVoiceServicesUnavailable",n=!0;break;case s.BadRequestParameters:i="alertServiceTemporarilyUnavailable";break;case s.TooManyRequests:i="alertTooManyRequests";break;case s.ConnectionFailure:i="alertConnectionIssue";break;case s.ServiceTimeout:i="alertResponseTimeout";break;case s.ServiceError:i="alertServiceTemporarilyUnavailable";break;case s.RuntimeError:i="alertSomeErrorOccurred";break;case s.Forbidden:i="alertServiceBusy";break;default:i="alertSomeErrorOccurred"}n&&this.bus.emit("event_error_VoiceBot_ExpiredOrInvalidToken",a),this.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:i})}_emitAlert(t,e={}){if("string"!=typeof t||!this.bus)return;if(["alertMicrophoneStartFailed","alertMicrophoneCheckSettings","alertMicrophoneAccessDenied","alertNoMicrophoneDetected","alertMicrophoneError"].includes(t)&&this._isChatModeActive())return;const a={messageKey:t,...e};this.bus.emit("event_command_Alerts_ShowDismissableAlert",a)}_isChatModeActive(){try{const t=this.avatarOrchestrator?.getSnapshot?.(),e=t?.context?.chatSocket?.chatbotMode;return"CHAT"===e}catch(t){return!1}}_setMaxDurationTimeout(){this.maxDurationTimeoutId=setTimeout((()=>{this._completeRecognitionTurn({reason:"maxDuration"})}),T.speech.maxDurationTimeout)}_completeRecognitionTurn({reason:t}={}){if(this._isStopping||this.stop(),this.sendMessage(),"maxDuration"===t&&(!this.messageText||!this.messageText.trim())&&this._isFsmListening())try{this.avatarOrchestrator.transitionToIdle()}catch(e){}}_determineMainLanguage(){let t=null,e=0;for(const[a,i]of Object.entries(this.languageDurations))i>e&&(e=i,t=a);return t}destroy(){try{this.close()}catch(t){}}}class Y extends F{constructor(t,e){super("speech-token",{blocking:!1}),this.auth=t,this.refreshTokenCallback=e,this.tokenRefreshLoop=null}async requestAuthorizationToken(t=T.auth.speechTokenRetries){for(let a=1;a<=t;a++)try{const t=await this.fetchSpeechToken();return this.setConnected(),t}catch(e){if(a===t)throw this.setFailed(),new Error(`Failed to fetch speech token after ${t} attempts`)}}async fetchSpeechToken(){try{const t=await this.auth.callSentifydApi(T.speech.authorizationEndPoint,"POST"),{token:e}=t.data;if(!e)throw new Error("Invalid token structure received from API.");return t.data}catch(t){throw new Error("Failed to fetch data from API.")}}async startTokenRefreshLoop(){await this.stopTokenRefreshLoop(),this.tokenRefreshLoop=setInterval((async()=>{try{const{token:t}=await this.requestAuthorizationToken();this.refreshTokenCallback(t),this.setConnected()}catch(t){}}),T.auth.speechTokenInterval)}async stopTokenRefreshLoop(){this.tokenRefreshLoop&&(clearInterval(this.tokenRefreshLoop),this.tokenRefreshLoop=null)}async reconnect(){if(!this.isConnected()&&!this.isReconnecting()){this.isFailed()?this.setReconnecting():this.setConnecting(),await this.stopTokenRefreshLoop();try{const{token:t}=await this.requestAuthorizationToken();this.refreshTokenCallback(t),await this.startTokenRefreshLoop()}catch(t){this.setFailed()}}}}class X{constructor({speechService:t,speechConfig:e,autoDetectSourceLanguageConfig:a,speechRecognizer:i,bus:n,auth:s,avatarOrchestrator:o,sessionData:r}={}){this.validateDependencies({speechService:t,speechConfig:e,speechRecognizer:i,bus:n,auth:s,avatarOrchestrator:o,sessionData:r}),this.sessionData=r,this.speechService=t,this.speechConfig=e,this.speechRecognizer=i,this.bus=n,this.avatarOrchestrator=o,this.autoDetectSourceLanguageConfig=a,this._currentTurnId=0,this._expectedTurnId=0,this._lastInterruptionTime=0,this.INTERRUPTION_DEBOUNCE=100,this._isHandlingAudioEnd=!1,this.registerEventListeners(),this.speechService.startTokenRefreshLoop()}validateDependencies(t){const e=Object.entries(t).filter((([t,e])=>!e)).map((([t])=>t));if(e.length>0)throw new Error(`Cannot initialize VoiceBot due to missing dependencies: ${e.join(", ")}`)}registerEventListeners(){this._busHandlers=this._busHandlers||[];const t=t=>{this.getNewSpeechToken()};this.bus.on("event_error_VoiceBot_ExpiredOrInvalidToken",t),this._busHandlers.push(["event_error_VoiceBot_ExpiredOrInvalidToken",t])}static async build(t,e,a,i){const{speechService:n,speechConfig:s,autoDetectSourceLanguageConfig:o,speechRecognizer:r}=await this.init(i,t,a,e);return new X({speechService:n,speechConfig:s,autoDetectSourceLanguageConfig:o,speechRecognizer:r,bus:t,auth:a,avatarOrchestrator:e,sessionData:i})}static async init(t,e,a,i){try{const n=t?.language||"en-US",s=(t?.voice,t?.autodetectLanguages||[]);let l=null,h=null;const d=new Y(a,(t=>{l&&(l.authorizationToken=t)})),{token:u,region:p}=await d.requestAuthorizationToken();if(!u||!p)throw new Error("Failed to get authorization token");l=o.fromAuthorizationToken(u,p);const g=T?.speech?.vad??{},v=t?.speech?.vad??t?.vad??{},m=v.segmentationSilenceMs??g.segmentationSilenceMs??800,_=v.initialSilenceMs??g.initialSilenceMs??8e3;l.setProperty(r.Speech_SegmentationSilenceTimeoutMs,String(m)),l.setProperty(r.SpeechServiceConnection_InitialSilenceTimeoutMs,String(_));const b=v.strategy??g.strategy,f=v.semantic??g.semantic,y="string"==typeof b?b:!0===f?"Semantic":null;y&&l.setProperty(r.Speech_SegmentationStrategy,y),"multilingual"===n?s.length>0?h=c.fromLanguages(s):l.speechRecognitionLanguage="en-US":l.speechRecognitionLanguage=n;const w=await Q.build(l,h,e,i);return{speechService:d,speechConfig:l,autoDetectSourceLanguageConfig:h,speechRecognizer:w}}catch(n){throw new Error("Error in VoiceBot initialization",{cause:n})}}async getNewSpeechToken(){try{const{token:t}=await this.speechService.requestAuthorizationToken();this.speechConfig.authorizationToken=t}catch(t){}}isConversationInProgress(){return!!this.sessionData?.conversation?.conversationId}async startListening(){if(this.speechRecognizer.isListening)return{success:!0,alreadyListening:!0};try{return this.speechRecognizer.isMicDetected||(this.speechRecognizer.close(),this.speechRecognizer=await Q.build(this.speechConfig,this.autoDetectSourceLanguageConfig,this.bus,this.avatarOrchestrator),this.speechRecognizer.isMicDetected=!0),this.speechRecognizer.start(),{success:!0,started:!0}}catch(t){return{success:!1,error:t.message||"Failed to start speech recognition"}}}stopListening(){try{return this.speechRecognizer.stop(),{success:!0}}catch(t){return{success:!1,error:t.message||"Failed to stop speech recognition"}}}async updateSpeechLanguage(t){this.speechConfig.speechRecognitionLanguage=t,this.speechRecognizer.close(),this.speechRecognizer=await Q.build(this.speechConfig,this.autoDetectSourceLanguageConfig,this.bus,this.avatarOrchestrator)}destroy(){this._busHandlers?.forEach((([t,e])=>this.bus.off(t,e))),this._busHandlers=[],this.speechRecognizer?.destroy(),this.speechService?.stopTokenRefreshLoop()}}const Z={enabled:!0,micThreshold:.0033,avatarQuietFloor:.009,minSignalRatio:1.2,minSignalRatioWhileSpeaking:.38,minSignalDelta:.0028,absoluteMicOverride:.012,minDurationMs:200,cooldownMs:1500,envelopeAttack:.6,envelopeRelease:.8,leakAdaptRate:.06,leakFloor:0,leakCeil:.25,leakMargin:.012,leakDecayHoldMs:300,leakDecayRate:.2,leakMinAvatar:.01,noiseStdK:3.4,minSnr:3.2,noiseMinSamples:90,warmupMs:400,speakingGuardMs:200,minConsecutive:3,hangoverMs:100,minAbsQuiet:.0032,bandpassHz:[350,3400],minDurationWhileSpeakingMs:260,debug:!1};class J{constructor({talkingAvatar:t,avatarOrchestrator:e,config:a}={}){this.talkingAvatar=t,this.avatarOrchestrator=e,this.config={...Z,...a||{}},this._audioCtx=null,this._micStream=null,this._micSource=null,this._micBpf=null,this._micAnalyser=null,this._micBuffer=null,this._avatarAnalyser=null,this._avatarBuffer=null,this._avatarAnalyserMissing=!1,this._armed=!1,this._candidateSince=null,this._lastTriggerTime=0,this._rafId=null,this._projectionUnsub=null,this._isDestroyed=!1,this._lastTickLog=0,this._micEnvelope=0,this._avatarEnvelope=0,this._leakEstimate=this.config.leakFloor??0,this._lastAvatarBelowMin=null,this._lastFrameTs=0,this._lastAudioResumeAttempt=0,this._armedAt=0,this._consecHits=0,this._lastQualifyTs=0,this._resetNoiseStats()}async init(){if(this.config.enabled)try{await this._ensureMicAnalyser(),this._subscribeToState()}catch(t){this._teardown()}}destroy(){this._isDestroyed=!0,this._unsubscribe(),this._disarm(),this._teardown()}async _ensureMicAnalyser(){if(this._micAnalyser)return;if("undefined"==typeof navigator||!navigator.mediaDevices?.getUserMedia)throw new Error("Media devices API not available");let t;this._audioCtx=this._audioCtx||new(window.AudioContext||window.webkitAudioContext);try{const e={audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!1}};t=await navigator.mediaDevices.getUserMedia(e)}catch(l){try{t=await navigator.mediaDevices.getUserMedia({audio:!0})}catch(h){throw l}}this._micStream=t,this._micSource=this._audioCtx.createMediaStreamSource(t),this._micBpf=this._audioCtx.createBiquadFilter(),this._micBpf.type="bandpass";const[e,a]=Array.isArray(this.config.bandpassHz)&&2===this.config.bandpassHz.length?this.config.bandpassHz:[300,3e3],i=Math.max(10,Math.min(e,a||e)),n=Math.max(1.5*i,a||10*i),s=Math.sqrt(i*n);this._micBpf.frequency.value=Number.isFinite(s)?s:1e3;const o=Math.log2(n/i),r=Math.sinh(Math.log(2)/2*Math.max(o,.01)),c=r>0?1/(2*r):1;this._micBpf.Q.value=Math.max(.5,Math.min(4,c||1)),this._micAnalyser=this._audioCtx.createAnalyser(),this._micAnalyser.fftSize=512,this._micAnalyser.smoothingTimeConstant=.4,this._micSource.connect(this._micBpf).connect(this._micAnalyser),this._micBuffer=new Float32Array(this._micAnalyser.fftSize),this._debugEvent("mic-ready",{sampleRate:this._audioCtx.sampleRate,fftSize:this._micAnalyser.fftSize})}_subscribeToState(){this.avatarOrchestrator?.subscribeProjected&&(this._projectionUnsub=this.avatarOrchestrator.subscribeProjected((t=>{if(this._isDestroyed)return;const e=t?.lifecycle?.conversationSubstate;"speaking"===e?this._arm():this._disarm()})))}_unsubscribe(){if("function"==typeof this._projectionUnsub){try{this._projectionUnsub()}catch(t){}this._projectionUnsub=null}}_arm(){if(!this._micAnalyser)return;if(!this._avatarAnalyser&&!this._avatarAnalyserMissing){if(this._avatarAnalyser=this.talkingAvatar?.getSpeechAnalyzerNode?.()??null,!this._avatarAnalyser)return this._debugEvent("avatar-analyser-missing",{}),this._avatarAnalyserMissing=!0,void(this._armed=!1);this._avatarAnalyser.smoothingTimeConstant=Math.min(this._avatarAnalyser.smoothingTimeConstant??.4,.6),this._avatarBuffer=new Float32Array(this._avatarAnalyser.fftSize),this._debugEvent("avatar-analyser-ready",{fftSize:this._avatarAnalyser.fftSize})}if(this._armed)return;this._armed=!0,this._candidateSince=null,this._micEnvelope=0,this._avatarEnvelope=0,this._resetNoiseStats(),this._lastFrameTs=0,this._leakEstimate=Math.max(this.config.leakFloor??0,Math.min(this._leakEstimate,this.config.leakCeil??1));const t="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();this._armedAt=t,this._consecHits=0,this._lastQualifyTs=0,this._lastAvatarBelowMin=null,this._rafId||(this._rafId=requestAnimationFrame(this._monitorLoop)),this._debugEvent("armed",{micThreshold:this.config.micThreshold,avatarQuietFloor:this.config.avatarQuietFloor,minSignalRatio:this.config.minSignalRatio,minSignalRatioWhileSpeaking:this.config.minSignalRatioWhileSpeaking,minSignalDelta:this.config.minSignalDelta,absoluteMicOverride:this.config.absoluteMicOverride,minDurationMs:this.config.minDurationMs,cooldownMs:this.config.cooldownMs,warmupMs:this.config.warmupMs,speakingGuardMs:this.config.speakingGuardMs,minConsecutive:this.config.minConsecutive,hangoverMs:this.config.hangoverMs,bandpassHz:this.config.bandpassHz})}_disarm(){(this._armed||this._rafId)&&(this._armed=!1,this._candidateSince=null,this._micEnvelope=0,this._avatarEnvelope=0,this._resetNoiseStats(),this._lastFrameTs=0,this._leakEstimate=Math.max(this.config.leakFloor??0,Math.min(this._leakEstimate,this.config.leakCeil??1)),this._armedAt=0,this._consecHits=0,this._lastQualifyTs=0,this._lastAvatarBelowMin=null,this._rafId&&(cancelAnimationFrame(this._rafId),this._rafId=null),this._debugEvent("disarmed",{}))}_monitorLoop=()=>{if(this._isDestroyed)return;if(!this._armed)return void(this._rafId=null);const t=performance.now(),e=this._lastFrameTs?t-this._lastFrameTs:16.7;this._lastFrameTs=t,"suspended"===this._audioCtx?.state&&(0===this._lastAudioResumeAttempt||t-this._lastAudioResumeAttempt>=1e3)&&(this._lastAudioResumeAttempt=t,this._audioCtx.resume().catch((()=>{})));const a=this._clamp01(this._readRms(this._micAnalyser,this._micBuffer)),i=this._avatarAnalyser?this._readRms(this._avatarAnalyser,this._avatarBuffer):0,n=this._clamp01(i),s=this._updateEnvelope("_micEnvelope",a,e),o=this._updateEnvelope("_avatarEnvelope",n,e),r=this._updateLeakEstimate({micSignal:s,avatarSignal:o,candidateActive:!!this._candidateSince}),c=o>(this.config.leakMinAvatar??.01)?.85*(r+(this.config.leakMargin??.012)):0,l=Math.max(0,s-o*c),h=o>5e-4?l/Math.max(o,5e-4):1/0,d=l-o,u=o<=this.config.avatarQuietFloor,p=l>=this.config.micThreshold,g=s>=this.config.absoluteMicOverride,v=t-(this._armedAt||t),m=v<(this.config.warmupMs??400),_=!u&&v<(this.config.speakingGuardMs??250);!g&&!this._candidateSince&&u&&!m&&0===this._consecHits&&l<1.2*this.config.micThreshold&&this._updateNoiseStats(l);const b=this._noiseCount>=(this.config.noiseMinSamples??90),f=this._noiseMean,y=this._getNoiseStd(),w=b?(l+1e-7)/(f+1e-7):0,S=this.config.noiseStdK??3.2,C=b&&l>=f+S*y,A=b&&w>=(this.config.minSnr??3),k=!!u||g||h>=(this.config.minSignalRatioWhileSpeaking??this.config.minSignalRatio)||d>=this.config.minSignalDelta,T=this.config.minAbsQuiet??0,x=!u||l>=T,I=u?x&&(g||(b?C||A:p)):g||p,E=!m&&!_,D=E&&I&&k,M=this.config.minConsecutive??4;if(D)this._consecHits+=1,this._lastQualifyTs=t;else{const e=this.config.hangoverMs??120,a=t-this._lastQualifyTs<=e;this._consecHits=a?this._consecHits:0}this._debugTick({micLevel:a,avatarLevel:n,micSignal:s,avatarSignal:o,effectiveMic:l,leak:r,leakApply:c,noiseMean:f,noiseStd:y,noiseSamples:this._noiseCount,snr:w,exceedsNoise:C,snrDominates:A,ratio:h,delta:d,meetsMicThreshold:p,avatarQuiet:u,absoluteOverride:g,absQuietOK:x,energyOK:I,energyQualified:I,competitionOK:k,noiseReady:b,warmup:m,speakingGuard:_,frameAllowed:E,frameQualifies:D,qualifies:D,consecutiveHits:this._consecHits,requiredHits:M,candidateDuration:this._candidateSince?t-this._candidateSince:0,cooldownRemaining:Math.max(0,this.config.cooldownMs-(t-this._lastTriggerTime))}),this._consecHits>=M?this._candidateSince||(this._candidateSince=t,this._debugEvent("candidate-start",{micLevel:a,avatarLevel:n,micSignal:s,avatarSignal:o,effectiveMic:l,leak:r,noiseMean:f,noiseStd:y,snr:w,ratio:h,delta:d})):this._candidateSince&&!D&&t-this._lastQualifyTs>(this.config.hangoverMs??120)&&(this._debugEvent("candidate-reset",{micLevel:a,avatarLevel:n,micSignal:s,avatarSignal:o,effectiveMic:l,leak:r,noiseMean:f,noiseStd:y,snr:w,ratio:h,delta:d}),this._candidateSince=null,this._consecHits=0);const R=u?this.config.minDurationMs??200:this.config.minDurationWhileSpeakingMs??(this.config.minDurationMs??200)+60,P=this._candidateSince&&t-this._candidateSince>=R,z=t-this._lastTriggerTime>=this.config.cooldownMs;P&&z?this._emitBargeIn({micLevel:a,avatarLevel:n,micSignal:s,avatarSignal:o,effectiveMic:l,leak:r,noiseMean:f,noiseStd:y,snr:w,ratio:h,delta:d,timestamp:t}):P&&!z&&this._debugEvent("cooldown-block",{micLevel:a,avatarLevel:n,micSignal:s,avatarSignal:o,effectiveMic:l,leak:r,noiseMean:f,noiseStd:y,snr:w,ratio:h,delta:d,cooldownRemaining:Math.max(0,this.config.cooldownMs-(t-this._lastTriggerTime))}),this._rafId=requestAnimationFrame(this._monitorLoop)};_emitBargeIn({micLevel:t,avatarLevel:e,micSignal:a,avatarSignal:i,effectiveMic:n,leak:s,noiseMean:o,noiseStd:r,snr:c,ratio:l,delta:h,timestamp:d}){this._lastTriggerTime=d,this._candidateSince=null,this._consecHits=0,this._lastQualifyTs=0,this._debugEvent("trigger",{micLevel:t,avatarLevel:e,micSignal:a,avatarSignal:i,effectiveMic:n,leak:s,noiseMean:o,noiseStd:r,snr:c,ratio:l,delta:h,timestamp:d});try{this.avatarOrchestrator?.sendEvent?.("VOICE_BARGE_IN",{micLevel:t,avatarLevel:e,micSignal:a,avatarSignal:i,effectiveMic:n,leak:s,noiseMean:o,noiseStd:r,snr:c,ratio:l,delta:h,timestamp:d})}catch(u){}}_readRms(t,e){if(!t)return 0;try{t.getFloatTimeDomainData(e)}catch(i){return 0}let a=0;for(let n=0;n<e.length;n++){const t=e[n];a+=t*t}return Math.sqrt(a/e.length)}_teardown(){if(this._micStream&&(this._micStream.getTracks().forEach((t=>{try{t.stop()}catch(e){}})),this._micStream=null),this._micSource){try{this._micSource.disconnect()}catch(t){}this._micSource=null}if(this._micBpf){try{this._micBpf.disconnect()}catch(t){}this._micBpf=null}if(this._micAnalyser){try{this._micAnalyser.disconnect()}catch(t){}this._micAnalyser=null}if(this._audioCtx){try{this._audioCtx.close()}catch(t){}this._audioCtx=null}this._micBuffer=null,this._avatarAnalyser=null,this._avatarBuffer=null,this._avatarAnalyserMissing=!1,this._lastTickLog=0,this._micEnvelope=0,this._avatarEnvelope=0,this._leakEstimate=this.config.leakFloor??0,this._lastAvatarBelowMin=null,this._armedAt=0,this._consecHits=0,this._lastQualifyTs=0,this._resetNoiseStats(),this._lastFrameTs=0,this._lastAudioResumeAttempt=0}_debugTick(t){if(!this.config.debug)return;const e=performance.now?performance.now():Date.now();e-this._lastTickLog<150||(this._lastTickLog=e)}_debugEvent(t,e){this.config.debug}_updateEnvelope(t,e,a=16.7){const i="number"==typeof this[t]?this[t]:e,n=Math.min(Math.max(this.config.envelopeAttack,0),.999),s=Math.min(Math.max(this.config.envelopeRelease,0),.999),o=e>=i?n:s,r=Math.max(a/16.7,.1),c=i+(e-i)*(1-Math.pow(o,r)),l=this._clamp01(c);return this[t]=l,l}_updateLeakEstimate({micSignal:t,avatarSignal:e,candidateActive:a}){const i=this.config.leakMinAvatar??0,n=this.config.leakAdaptRate??.1,s=this.config.leakFloor??0,o=this.config.leakCeil??1,r="undefined"!=typeof performance&&"function"==typeof performance.now?performance.now():Date.now();let c=this._leakEstimate??s;if(a||this._consecHits>0)return c;const l=this._noiseCount>=(this.config.noiseMinSamples??90),h=this._getNoiseStd(),d=this._noiseMean,u=l&&t>=d+(this.config.noiseStdK??3.2)*h;if(e>i&&t<.8*this.config.absoluteMicOverride&&!u){const a=t/Math.max(e,1e-5);c+=(Math.max(s,Math.min(a,o))-c)*n,this._leakEstimate=c,this._debugLeakUpdate({ratio:a,estimate:c}),this._lastAvatarBelowMin=null}else if(e<=i&&c>s){const t=this.config.leakDecayHoldMs??1e3,a=this.config.leakDecayRate??.1*n;null==this._lastAvatarBelowMin&&(this._lastAvatarBelowMin=r),e<=i?r-this._lastAvatarBelowMin>=t&&(c+=(s-c)*a):this._lastAvatarBelowMin=r,this._leakEstimate=Math.max(s,c)}return this._leakEstimate??s}_debugLeakUpdate({ratio:t,estimate:e}){this.config.debug&&this._debugEvent("leak-update",{ratio:t,estimate:e})}_resetNoiseStats(){this._noiseMean=0,this._noiseVar=0,this._noiseCount=0}_updateNoiseStats(t){const e=this._clamp01(t);if(!Number.isFinite(e))return;this._noiseCount>=500&&(this._noiseCount=Math.floor(350),this._noiseMean*=.95,this._noiseVar*=.9),this._noiseCount+=1;const a=e-this._noiseMean;this._noiseMean+=a/this._noiseCount;const i=e-this._noiseMean;this._noiseVar+=a*i}_getNoiseStd(){return this._noiseCount<2?0:Math.sqrt(Math.max(this._noiseVar/(this._noiseCount-1),0))}_clamp01(t){return Number.isFinite(t)?t<=0?0:t>=1?1:t:0}}let tt=null;const et={setInstance(t){tt=t},getItem:async t=>{if(!tt)throw new Error("Storage instance not initialized");return tt.getItem(t)},setItem:async(t,e)=>{if(!tt)throw new Error("Storage instance not initialized");return tt.setItem(t,e)},removeItem:async t=>{if(!tt)throw new Error("Storage instance not initialized");return tt.removeItem(t)}};class at extends Error{constructor(t,{statusCode:e=null,reason:a=null}={}){super(t),this.name="LoginError",this.statusCode=e,this.reason=a}}async function it(t){try{const e=await fetch(`${t.serverBaseURL}/api/v1/chatbot/login`,{method:"POST",headers:{"Content-Type":"application/json","X-Sentifyd-Origin":t.targetApp},body:JSON.stringify({avatar_api_key:t.getAvatarAPIKey()})});if(!e.ok){const a=function(t){switch(t){case 404:return{message:"Avatar not found.",reason:"avatar-not-found",shouldStopRetrying:!0};case 401:return{message:"Unauthorized avatar login attempt.",reason:"unauthorized",shouldStopRetrying:!1};case 429:return{message:"Too many login attempts. Please retry later.",reason:"rate-limited",shouldStopRetrying:!1};default:return{message:`Login failed with status code ${t}.`,reason:"login-failed",shouldStopRetrying:!1}}}(e.status);throw a.shouldStopRetrying&&(t.retries=T.auth.maxLoginRetries),new at(a.message,{statusCode:e.status,reason:a.reason})}const a=await e.json();await async function(t,e){try{const a=e?.data?.avatar_params;if(!a||!a.avatarId)throw new Error("Invalid avatar parameters received in login response.");const i=a.avatarId;t.id=i;const n={accessToken:e.data.access_token,refreshToken:e.data.refresh_token,avatarParameters:a};await t.updateAuthData(n),t.setConnected()}catch(a){throw new Error(`Failed to process login response: ${a.message}`)}}(t,a)}catch(e){throw e}}const nt=new class{constructor(t=1){this.max=t,this._fns=[],this._active=0}get remaining(){return this._fns.length}get active(){return this._active}take(t){this._fns.push(t),this._try()}_done(){this._active-=1,this._try()}_try(){if(this._active===this.max||0===this._fns.length)return;const t=this._fns.shift();this._active+=1,t&&t(this._done.bind(this))}}(1);class st{constructor({serverBaseURL:t,getRefreshToken:e,updateAccessToken:a,onSuccess:i,onError:n}){this.serverBaseURL=t,this.getRefreshToken=e,this.onSuccess=i,this.onError=n,this.tokenRefreshIntervalId=null,this.updateAccessToken=a}startTokenRefreshInterval(){this.tokenRefreshIntervalId&&clearInterval(this.tokenRefreshIntervalId),this.tokenRefreshIntervalId=setInterval((async()=>{try{await this.refreshAccessToken()}catch(t){}}),T.auth.tokenRefreshInterval)}stopTokenRefreshInterval(){this.tokenRefreshIntervalId&&(clearInterval(this.tokenRefreshIntervalId),this.tokenRefreshIntervalId=null)}async refreshAccessToken(){return new Promise(((t,e)=>{nt.take((async a=>{try{const e=this.getRefreshToken();if(!e)throw new Error("No refresh token available");const a=await fetch(`${this.serverBaseURL}/api/v1/chatbot/token_exchange`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+e}});if(!a.ok){const t=`Failed to refresh JWT token (Status: ${a.status} ${a.statusText})`;throw"function"==typeof this.onError&&this.onError(new Error(t)),new Error(t)}const i=await a.json();if(!i?.data?.access_token)throw new Error("Invalid token data received during refresh.");this.updateAccessToken&&await this.updateAccessToken(i.data.access_token),"function"==typeof this.onSuccess&&this.onSuccess(i.data.access_token),t(!0)}catch(i){"function"==typeof this.onError&&this.onError(i),e(i)}finally{a()}}))}))}}class ot extends F{#t;#e;#a;constructor(t="",e="",a=""){if(ot._instance)return ot._instance;super("authentication"),ot._instance=this,this.#t=t,this.tokenEndpoint=e,this.#e=null,this.#a=null,this.avatarParameters=null,this.id=a,this.serverBaseURL=T.auth.serverBaseURL||"",this.targetApp="",this.lastFailureDetails=null,this.tokenRefresher=new st({serverBaseURL:this.serverBaseURL,getRefreshToken:()=>this.#a,updateAccessToken:async t=>await this.updateAuthData({accessToken:t}),onSuccess:()=>{},onError:t=>{this.handleAuthenticationFailure("Error refreshing access token",t)}})}async init(t="web",e="",a="",i=""){this.id=i,this.targetApp=t,this.#t=e,this.tokenEndpoint=a;try{await this.authenticate();try{await this.updateAvatarParametersFromServer()}catch(n){}return this.startTokenRefreshInterval(),!0}catch(s){return this.handleAuthenticationFailure(`Error during authentication initialization: ${s.message}`,s),!1}}async authenticate(){for(this.retries=0,this.setConnecting();this.retries<T.auth.maxLoginRetries;)try{if(this.#t?.trim())await it(this);else{if(!this.tokenEndpoint?.trim()){const t="authenticate: No API key or token endpoint provided for authentication.";throw this.handleAuthenticationFailure(t),new Error(t)}await this.requestDataFromServer()}return void this.clearFailureDetails()}catch(t){if(this.setDisconnected(),this.recordFailure({message:`authenticate: Attempt #${this.retries+1} failed`,reason:t instanceof at?t.reason:t?.message||null,statusCode:t instanceof at&&"number"==typeof t.statusCode?t.statusCode:null}),this.retries++,this.retries>=T.auth.maxLoginRetries){const e=`authenticate: All ${T.auth.maxLoginRetries} authentication attempts failed.`;if(this.handleAuthenticationFailure(e,t),t instanceof Error)throw t;throw new Error(`${e} Last error: ${t}`)}await w(T.auth.loginRetryDelay)}}startTokenRefreshInterval(){this.tokenRefresher.startTokenRefreshInterval()}stopTokenRefreshInterval(){this.tokenRefresher.stopTokenRefreshInterval()}isTokenCloseToExpiration(){if(!this.#e)return!0;try{const{exp:t}=l(this.#e);if(!t)return!0;if(1e3*t-Date.now()<=T.auth.closeToExpirationLimit)return!0}catch(t){return!0}return!1}async callSentifydApi(t,e="POST",a=null){if(!this.isConnected())throw new Error("Cannot call the API without active authentication");const i=`${this.serverBaseURL}${t}`,n=new Headers({"Content-Type":"application/json"}),s=this.getAccessToken();if(!s)throw new Error("Cannot call the API without an access token");n.append("Authorization",`Bearer ${s}`);const o={method:e,headers:n,body:a?JSON.stringify(a):void 0};try{let t=await fetch(i,o);if(401===t.status)try{await this.authenticate();const e={...o,headers:{...o.headers,Authorization:`Bearer ${this.getAccessToken()}`}};if(t=await fetch(i,e),401===t.status)throw this.handleAuthenticationFailure("callSentifydApi: Authentication failed in API call. Not authorized."),new Error(`API call failed: ${t.statusText} (Status: ${t.status})`)}catch(r){throw this.handleAuthenticationFailure("callSentifydApi: Authentication failed in API call. Not authorized."),new Error("API call failed")}if(!t.ok)throw new Error(`API call failed: ${t.statusText} (Status: ${t.status})`);return await t.json()}catch(r){throw r}}async isAuthRequired(){const t=this.#i();return!(t&&t.accessToken&&t.refreshToken&&t.avatarParameters&&!this.isTokenCloseToExpiration())}async logout(){this.id&&await async function(t){if(t)try{await et.removeItem(`authData_${t}`)}catch(e){}}(this.id),this.stopTokenRefreshInterval(),this.#e=null,this.#a=null,this.avatarParameters=null,this.clearFailureDetails(),this.setDisconnected()}async#n(){if(!this.id)return!1;const t=await async function(t){if(!t)return null;try{const e=await et.getItem(`authData_${t}`);return e?JSON.parse(e):null}catch(e){return null}}(this.id);if(!t)return!1;try{return this.#e=t.accessToken,this.#a=t.refreshToken,this.avatarParameters=t.avatarParameters,!(await this.isAuthRequired())||(this.setDisconnected(),!1)}catch(e){return this.setDisconnected(),!1}}#i(){return this.id&&this.#e&&this.#a&&this.avatarParameters?{accessToken:this.#e,refreshToken:this.#a,avatarParameters:this.avatarParameters}:null}getAccessToken(){return this.#e||null}getRefreshToken(){return this.#a||null}getAvatarAPIKey(){return this.#t}async updateAccessToken(t){await this.updateAuthData({accessToken:t})}getAvatarParameters(){return this.avatarParameters||null}async updateAuthData({accessToken:t,refreshToken:e,avatarParameters:a}){const i=this.#i()||{};t&&(this.#e=t,i.accessToken=t),e&&(this.#a=e,i.refreshToken=e),a&&(this.avatarParameters=a,i.avatarParameters=a);try{await async function(t,e){if(t)try{await et.setItem(`authData_${t}`,JSON.stringify(e))}catch(a){}}(this.id,i),this.clearFailureDetails()}catch(n){}}async requestDataFromServer(){if(!this.tokenEndpoint?.trim())throw new Error("requestDataFromServer: Token URL is not specified.");try{const t=await fetch(this.tokenEndpoint,{method:"GET"});if(!t.ok)throw new Error(`requestDataFromServer: Failed to request tokens (Status: ${t.status} ${t.statusText})`);const e=await t.json();if(!this.#s(e))throw new Error("requestDataFromServer: Invalid token response received from server.");await this.updateAuthData({accessToken:e.tokens.accessToken,refreshToken:e.tokens.refreshToken,avatarParameters:e.avatarParameters}),this.setConnected()}catch(t){throw this.setDisconnected(),t}}#s(t){return t?.tokens?.accessToken&&t?.tokens?.refreshToken&&t?.avatarParameters}async updateAvatarParametersFromServer(){try{const t=await this.callSentifydApi("/api/v1/chatbot/get-avatar-params","POST");if(!t||!t.data||!t.data.avatar_params)return;this.avatarParameters=t.data.avatar_params,this.updateAuthData({avatarParameters:this.avatarParameters})}catch(t){}}handleAuthenticationFailure(t,e=null){this.recordFailure({message:t,reason:e instanceof at?e.reason:e instanceof Error?e.message:null,statusCode:e instanceof at&&"number"==typeof e.statusCode?e.statusCode:null}),this.setFailed()}recordFailure({message:t,reason:e=null,statusCode:a=null}={}){this.lastFailureDetails={message:t||"Unknown authentication error",reason:e??(t||"Unknown authentication error"),statusCode:a,timestamp:Date.now()}}clearFailureDetails(){this.lastFailureDetails=null}getLastFailureDetails(){return this.lastFailureDetails?{...this.lastFailureDetails}:null}async reconnect(){if(!this.isConnected()&&!this.isReconnecting()){this.stopTokenRefreshInterval(),this.isFailed()?this.setReconnecting():this.setConnecting();try{if(await this.authenticate(),this.isConnected()){try{await this.updateAvatarParametersFromServer()}catch(t){}this.startTokenRefreshInterval()}else this.setFailed()}catch(e){this.handleAuthenticationFailure("Authentication reconnect failed",e)}}}static resetInstance(){ot._instance=null}}class rt{constructor(t,e=h){this.avatarId=t,this.conversationData={id:void 0,transcript:[],currentTurnId:0},this.lastDetectedLanguage=null,this.uuidGenerator=e,this.lastStartWasResumeAttempt=!1,this.transcriptLengthBeforeResume=0}get conversationId(){return this.conversationData.id}set conversationId(t){this.conversationData.id=t}get transcript(){return this.conversationData.transcript}set transcript(t){this.conversationData.transcript=t}get currentTurnId(){return this.conversationData.currentTurnId}set currentTurnId(t){this.conversationData.currentTurnId=t}incrementTurnId(){return this.conversationData.currentTurnId++,this.conversationData.currentTurnId}async getConversationData(){if(!this.avatarId)return null;const t=await et.getItem(`conversationData_${this.avatarId}`),e={id:void 0,transcript:[],currentTurnId:0};return this.conversationData=t?{...e,...JSON.parse(t)}:e,this.conversationData}async saveConversationData(){this.avatarId&&await et.setItem(`conversationData_${this.avatarId}`,JSON.stringify(this.conversationData))}async notifyConversationInit(){await this.getConversationData(),this.conversationId||(await this.clearOngoingConversation(),await this.generateNewConversationId())}async notifyConversationStart(t=!1){if(t)this.lastStartWasResumeAttempt=!1,this.transcriptLengthBeforeResume=0,await this.clearOngoingConversation(),await this.generateNewConversationId(),this.incrementTurnId();else{await this.getConversationData();const t=!!this.conversationId,e=Array.isArray(this.transcript)&&this.transcript.length>0;this.lastStartWasResumeAttempt=t&&e,this.transcriptLengthBeforeResume=e?this.transcript.length:0,this.conversationId||(await this.clearOngoingConversation(),await this.generateNewConversationId()),this.incrementTurnId()}}async notifyConversationEnd(){this.lastStartWasResumeAttempt=!1,await this.clearOngoingConversation()}async clearOngoingConversation(){this.conversationData={id:void 0,transcript:[],currentTurnId:0};try{await et.removeItem(`conversationData_${this.avatarId}`)}catch(t){await this.saveConversationData()}}async discardConversationHistory(){const t=this.conversationId,e=this.currentTurnId;this.conversationData={id:t,transcript:[],currentTurnId:e},await this.saveConversationData()}async generateNewConversationId(){const t=this.uuidGenerator();this.conversationId=t,await this.saveConversationData()}async appendMessage(t,e,a){if(!this.conversationId)return null;const i={speaker:a,messageText:S(t),time:e};return this.transcript.push(i),await this.saveConversationData(),i}async handleConversationSuccessfulStart(t){const e=t?.isInProgress,a=t?.conversationId,i=this.conversationId,n=!!this.lastStartWasResumeAttempt;let s=!1;if(!1===e&&(s=!0),a&&i&&a!==i&&(this.conversationId=a,s=!0),n&&s){const t=this.transcript.slice(this.transcriptLengthBeforeResume);this.conversationData.transcript=t,await this.saveConversationData()}return{serverStartedNew:s,resumeAttempt:n,resumeFailed:s&&n}}}class ct{constructor(){if(ct._instance)return ct._instance;this._avatarId=null,this._avatarName="",this._avatarItem=null,this._trainingId=null,this._language="",this._autodetectLanguages=[],this._voice="",this._lipsyncType="words",this._wordsPerMinute=150,this._userData={username:"",phoneNumber:"",email:"",isTermsAccepted:!1},this.conversation=null,ct._instance=this,Object.seal(this)}static getInstance(){return ct._instance||(ct._instance=new ct),ct._instance}static hasInstance(){return null!==ct._instance&&void 0!==ct._instance}static resetInstance(){if(ct._instance)try{return ct._instance.destroy(),ct._instance=null,!0}catch(t){return!1}return!0}async init(t,e){const{avatarId:a,avatarName:i,trainingId:n,language:s,autodetectLanguages:o,voice:r,wordsPerMinute:c}=t;if(![a,i,e,s,r].every((t=>null!=t&&""!==t))||!Array.isArray(o))return!1;this._trainingId=null===n||""===n?null:n,this._avatarId=a,this._avatarName=i,this._avatarItem=e,this._language=s,this._autodetectLanguages=o,this._voice=r,this._lipsyncType=e?.lipsyncType||"words",this._wordsPerMinute=c||150;try{return this.conversation=new rt(this._avatarId),!0}catch(l){return!1}}get isUserDataDefined(){return this._userData.username&&!0===this._userData.isTermsAccepted}get avatarId(){return this._avatarId}set avatarId(t){this._avatarId=t,this.conversation&&(this.conversation.avatarId=t)}get avatarName(){return this._avatarName}set avatarName(t){"string"==typeof t&&""!==t.trim()&&(this._avatarName=t)}get avatarItem(){return this._avatarItem}set avatarItem(t){t&&"object"==typeof t&&(this._avatarItem=t)}get trainingId(){return this._trainingId}set trainingId(t){(null==t||"string"==typeof t&&""!==t.trim())&&(this._trainingId=t)}get language(){return this._language}set language(t){"string"==typeof t&&""!==t.trim()&&(this._language=t)}get autodetectLanguages(){return this._autodetectLanguages}set autodetectLanguages(t){Array.isArray(t)&&(this._autodetectLanguages=t)}get voice(){return this._voice}set voice(t){"string"==typeof t&&""!==t.trim()&&(this._voice=t)}get lipsyncType(){return this._lipsyncType}set lipsyncType(t){["words","visemes","blendshapes"].includes(t)&&(this._lipsyncType=t)}get wordsPerMinute(){return this._wordsPerMinute}set wordsPerMinute(t){"number"!=typeof t||t<=0||(this._wordsPerMinute=t)}get username(){return this._userData.username}set username(t){"string"==typeof t&&""!==t.trim()&&(this._userData.username=t)}get phoneNumber(){return this._userData.phoneNumber}set phoneNumber(t){"string"==typeof t&&""!==t.trim()&&(this._userData.phoneNumber=t)}get email(){return this._userData.email}set email(t){"string"==typeof t&&""!==t.trim()&&(this._userData.email=t)}get isTermsAccepted(){return this._userData.isTermsAccepted}set isTermsAccepted(t){"boolean"==typeof t&&(this._userData.isTermsAccepted=t)}destroy(){try{this.conversation&&"function"==typeof this.conversation.destroy&&this.conversation.destroy()}catch(t){}}}function lt(t){try{t?.talkingAvatar?.liveCaptions?.clearCaptions?.()}catch(e){}try{t?.bus?.emit?.("event_command_UI_ClearCaptions")}catch(e){}}ct._instance=null;const ht=d({id:"avatarOrchestrator",context:({input:t})=>({bus:t?.bus??null,talkingAvatar:t?.talkingAvatar??null,chatSocket:t?.chatSocket??null,voiceBot:t?.voiceBot??null,conversation:t?.conversation??null,speakingAvatar:t?.speakingAvatar??null,eventPayload:null,isPageVisible:!0,currentPage:"LoaderPage",pendingStart:null,userSilenced:!1,initFailed:!1,firstConnectionCompleted:!1}),type:"parallel",states:{lifecycle:{initial:"init",states:{init:{initial:"initializing",states:{initializing:{id:"initializing",on:{READY:{target:"complete",actions:["onLeaveInitializing"]},FAIL:{target:"failed",actions:u({initFailed:!0})}}},failed:{id:"failed",on:{RETRY:{target:"initializing"},CONNECT:{target:"initializing"}}},complete:{always:{target:"#avatarOrchestrator.lifecycle.conversation.stopped"}}}},checkingResume:{id:"checkingResume",invoke:{id:"checkResumeOnStart",src:"checkResumeActor",input:({context:t})=>({conversation:t.conversation,bus:t.bus}),onDone:[{target:"conversation.autoResuming",guard:({event:t})=>!!t.output?.resumable},{target:"conversation.stopped"}],onError:{target:"conversation.stopped"}}},conversation:{initial:"stopped",on:{CONVERSATION_TIMEOUT:{target:".timedOut"}},states:{stopped:{id:"stopped",entry:["armVideoIdleDisconnectOnStopped"],exit:["disarmVideoIdleDisconnect"],on:{START_CONVERSATION:[{guard:({context:t})=>!t.isPageVisible,actions:"onDeferStart",target:void 0},{target:"inProgress.startingConversation",actions:u({eventPayload:({event:t})=>t.payload})}],INIT_CONVERSATION:{target:"initializingConversation"},END_CONVERSATION:{target:"endingConversation"},CLEAR_CONVERSATION:{target:"clearingConversation"},RESTORED_CONNECTION:{target:"#checkingResume"},AVATAR_INITIALIZED:{target:"#checkingResume"},CONVERSATION_INIT_SUCCESS:{actions:["onConversationInitSuccess"]},CONVERSATION_INIT_FAILED:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})},CONVERSATION_TIMEOUT:{target:"#avatarOrchestrator.lifecycle.conversation.timedOut"},DISCONNECT:{actions:[]},FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}}},timedOut:{id:"timedOut",entry:[({context:t,event:e})=>{try{const a=e?.payload?.conversationId??t?.conversation?.conversationId;t.bus?.emit?.("event_status_Conversation_TimedOut",{conversationId:a})}catch(a){}},"armVideoIdleDisconnectOnStopped"],exit:["disarmVideoIdleDisconnect"],on:{START_CONVERSATION:[{guard:({context:t})=>!t.isPageVisible,actions:"onDeferStart",target:void 0},{target:"inProgress.startingConversation",actions:u({eventPayload:({event:t})=>t.payload})}],INIT_CONVERSATION:{target:"initializingConversation"},END_CONVERSATION:{target:"endingConversation"},CLEAR_CONVERSATION:{target:"clearingConversation"},RESTORED_CONNECTION:{target:"#checkingResume"},AVATAR_INITIALIZED:{target:"#checkingResume"},CONVERSATION_INIT_SUCCESS:{actions:["onConversationInitSuccess"]},CONVERSATION_INIT_FAILED:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})},FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}}},autoResuming:{id:"autoResuming",tags:["thinking","inputs_blocked"],entry:["onStartingConversation"],invoke:{id:"autoResumeService",src:"startConversationService",input:({context:t})=>({isNew:!1,skipFallback:!0,bus:t.bus,conversation:t.conversation,chatSocket:t.chatSocket,talkingAvatar:t.talkingAvatar,speakingAvatar:t.speakingAvatar}),onDone:[{guard:({context:t,event:e})=>"resume_silent"===e.output?.data?.dataType&&!0===t.talkingAvatar?.isVideoAvatar,target:"inProgress.listening",actions:["onConversationStartSuccess","onAutoResumeToListening"]},{guard:({event:t})=>"resume_silent"===t.output?.data?.dataType,target:"inProgress.idle",actions:"onConversationStartSuccess"},{target:"inProgress.thinking",actions:"onConversationStartSuccess"}],onError:{target:"resumeExpired",actions:["onAutoResumeFailed"]}},on:{AI_MESSAGE_RECEIVED:{actions:"handleAiMessage"},AUDIO_END:{actions:["onAudioEnd"]},STREAM_START:{target:"inProgress.pendingAudioStart",actions:["onStreamStart"]},IDLE:"inProgress.idle"}},resumeExpired:{id:"resumeExpired",entry:[({context:t})=>{try{const e=t?.conversation?.conversationId;t.bus?.emit?.("event_status_Conversation_ResumeExpired",{conversationId:e})}catch(e){}}],on:{START_NEW_CONVERSATION:{target:"inProgress.startingConversation",actions:u({eventPayload:{fresh:!0}})},DISMISS:{target:"stopped",actions:[({context:t})=>{try{t.conversation?.clearOngoingConversation?.()}catch(e){}}]},CLEAR_CONVERSATION:{target:"clearingConversation"},END_CONVERSATION:{target:"endingConversation"},FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}}},paused:{id:"paused",entry:["onConversationPaused"],tags:["conversation_paused","inputs_blocked"],on:{AUDIO_END:{actions:["onAudioEnd"]},RECONNECT:[{target:"inProgress.idle",guard:"hasActiveConversation"},{target:"clearingConversation"}],RESTORED_CONNECTION:[{target:"inProgress.idle",guard:"hasActiveConversation"},{target:"clearingConversation"}],END_CONVERSATION:{target:"endingConversation"},CLEAR_CONVERSATION:{target:"clearingConversation"},FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}}},initializingConversation:{id:"initializingConversation",invoke:{id:"initConversationActor",src:"initConversationActor",input:({context:t})=>({conversation:t.conversation,chatSocket:t.chatSocket,bus:t.bus}),onDone:{target:"stopped",actions:"onConversationInitSuccess"},onError:{target:"stopped",actions:[u({initFailed:!0}),"onConversationInitFailed"]}},on:{FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}}},inProgress:{id:"inProgress",tags:["conversation_in_progress"],on:{STOP:{target:"stopped",actions:["onStop"]},END_CONVERSATION:{target:"endingConversation"},CLEAR_CONVERSATION:{target:"clearingConversation"},DISCONNECT:[{target:"paused",guard:"hasActiveConversation"},{target:"stopped"}],AUDIO_START:{target:"#speaking",actions:["onAudioStarted"]},AI_MESSAGE_RECEIVED:{actions:"handleAiMessage"},FAIL:{target:"#avatarOrchestrator.lifecycle.init.failed",actions:u({initFailed:!0})}},initial:"idle",states:{idle:{id:"idle",entry:["onIdle","armVideoIdleDisconnect"],exit:["disarmVideoIdleDisconnect"],on:{STREAM_START:{target:"pendingAudioStart",actions:["onStreamStart"]},LISTEN:"listening",THINK:"thinking",START_CONVERSATION:{target:"startingConversation",actions:u({eventPayload:({event:t})=>t.payload})},SEND_TEXT_MESSAGE:{target:"processingTextMessage"},MIC_BUTTON:[{guard:"isRequestBlocked",actions:["onMicButtonBlocked"]},{target:"listening",actions:["onMicButtonStartListening"]}],AUDIO_END:{actions:["onAudioEnd"]}}},listening:{id:"listening",tags:["listening"],entry:["onListenEntry"],invoke:{id:"listenActor",src:"listenActor",input:({context:t})=>({voiceBot:t.voiceBot,talkingAvatar:t.talkingAvatar,bus:t.bus,currentPage:t.currentPage,isPageVisible:t.isPageVisible,chatbotMode:t.chatSocket?.chatbotMode}),onDone:[{guard:({event:t})=>!t?.output?.started,target:"idle"}],onError:{target:"idle",actions:["onListenFailed"]}},on:{STREAM_START:{target:"pendingAudioStart",actions:["onStreamStart"]},THINK:"thinking",START_CONVERSATION:{target:"startingConversation",actions:["onIdle",u({eventPayload:({event:t})=>t.payload})]},SPEECH_RECOGNITION_COMPLETE:{target:"processingSpeechRecognition"},SEND_TEXT_MESSAGE:{target:"processingTextMessage",actions:[({context:t})=>{if(t.voiceBot){t.voiceBot.stopListening();try{t.talkingAvatar?.liveCaptions?.clearCaptions?.()}catch(e){}try{t.bus.emit("event_command_UI_ClearCaptions")}catch(e){}}}]},MIC_BUTTON:{target:"idle",actions:["setUserSilencedTrue","onMicButtonStopListening"]},IDLE:"idle",AUDIO_END:{actions:["onAudioEnd"]}}},processingSpeechRecognition:{id:"processingSpeechRecognition",invoke:{id:"speechRecognitionActor",src:"speechRecognitionActor",input:({context:t,event:e})=>({chatSocket:t.chatSocket,payload:e.payload,conversation:t.conversation,bus:t.bus}),onDone:{target:"thinking"},onError:{target:"idle",actions:["onSpeechRecognitionFailed"]}},on:{AUDIO_END:{actions:["onAudioEnd"]}}},processingTextMessage:{id:"processingTextMessage",invoke:{id:"sendTextMessageActor",src:"sendTextMessageActor",input:({context:t,event:e})=>({chatSocket:t.chatSocket,payload:e.payload,conversation:t.conversation,bus:t.bus}),onDone:{target:"thinking"},onError:{target:"idle",actions:["onSendTextMessageFailed"]}},on:{AUDIO_END:{actions:["onAudioEnd"]}}},thinking:{id:"thinking",tags:["thinking","inputs_blocked"],on:{AUDIO_END:{actions:["onAudioEnd"]},STREAM_START:{target:"pendingAudioStart",actions:["onStreamStart"]},IDLE:"idle",START_CONVERSATION:{target:"startingConversation",actions:u({eventPayload:({event:t})=>t.payload})}}},startingConversation:{id:"startingConversation",tags:["thinking","inputs_blocked"],entry:["onStartingConversation"],invoke:{id:"startConversationService",src:"startConversationService",input:({context:t})=>({isNew:t.eventPayload?.fresh||!1,bus:t.bus,conversation:t.conversation,chatSocket:t.chatSocket,talkingAvatar:t.talkingAvatar,speakingAvatar:t.speakingAvatar}),onDone:[{guard:({context:t,event:e})=>"resume_silent"===e.output?.data?.dataType&&!0===t.talkingAvatar?.isVideoAvatar,target:"listening",actions:["onConversationStartSuccess","onAutoResumeToListening"]},{guard:({event:t})=>"resume_silent"===t.output?.data?.dataType,target:"idle",actions:"onConversationStartSuccess"},{target:"thinking",actions:"onConversationStartSuccess"}],onError:{target:"#avatarOrchestrator.lifecycle.conversation.stopped",actions:[u({initFailed:!0}),"onConversationStartFailed"]}},on:{AI_MESSAGE_RECEIVED:{actions:"handleAiMessage"},AUDIO_END:{actions:["onAudioEnd"]},STREAM_START:{target:"pendingAudioStart",actions:["onStreamStart"]},IDLE:"idle"}},pendingAudioStart:{id:"pendingAudioStart",tags:["thinking","inputs_blocked"],after:{speechStartTimeout:{guard:"isPendingAudioStart",target:"#speaking",actions:["onAudioStartedFallback"]}},on:{SEND_TEXT_MESSAGE:{target:"#inProgress.processingTextMessage",actions:["onInterruptSpeaking"]},MIC_BUTTON:{target:"#inProgress.listening",actions:["onInterruptSpeaking","onMicButtonInterruptSpeaking"]},INTERRUPT:{target:"#inProgress.listening",actions:["onInterruptSpeaking"]},VOICE_BARGE_IN:{target:"#inProgress.listening",actions:["emitVoiceBargeInEvent","onVoiceBargeIn","onInterruptSpeaking"]},AUDIO_END:[{target:"#inProgress.listening",guard:({context:t})=>!!t.isPageVisible&&!!t.voiceBot&&t.voiceBot.isConversationInProgress?.(),actions:["onAudioEnd"]},{target:"#inProgress.idle",actions:["onAudioEnd"]}],IDLE:{target:"#inProgress.idle"},LISTEN:{target:"#inProgress.listening",actions:["onInterruptSpeaking"]},START_CONVERSATION:{target:"#inProgress.interruptingForRestart",actions:["onInterruptSpeaking",u({eventPayload:({event:t})=>t.payload})]}}},speaking:{id:"speaking",tags:["speaking"],on:{SEND_TEXT_MESSAGE:{target:"#inProgress.processingTextMessage",actions:["onInterruptSpeaking"]},MIC_BUTTON:{target:"#inProgress.listening",actions:["onInterruptSpeaking","onMicButtonInterruptSpeaking"]},INTERRUPT:{target:"#inProgress.listening",actions:["onInterruptSpeaking"]},VOICE_BARGE_IN:{target:"#inProgress.listening",actions:["emitVoiceBargeInEvent","onVoiceBargeIn","onInterruptSpeaking"]},STREAM_END:{actions:["onStreamEnd"],internal:!0},AUDIO_END:[{target:"#inProgress.listening",guard:({context:t})=>!!t.isPageVisible&&!!t.voiceBot&&t.voiceBot.isConversationInProgress?.(),actions:["onAudioEnd"]},{target:"#inProgress.idle",actions:["onAudioEnd"]}],IDLE:{target:"#inProgress.idle"},LISTEN:{target:"#inProgress.listening",actions:["onInterruptSpeaking"]},START_CONVERSATION:{target:"#inProgress.interruptingForRestart",actions:["onInterruptSpeaking",u({eventPayload:({event:t})=>t.payload})]}}},interruptingForRestart:{id:"interruptingForRestart",entry:["onEnsureCleanupComplete"],invoke:{src:"cleanupInterruptionActor",input:({context:t})=>({talkingAvatar:t.talkingAvatar,chatSocket:t.chatSocket,voiceBot:t.voiceBot}),onDone:{target:"startingConversation"},onError:{target:"#avatarOrchestrator.lifecycle.conversation.stopped"}},tags:["inputs_blocked"],on:{AUDIO_END:{actions:["onAudioEnd"]}}}}},endingConversation:{id:"endingConversation",tags:["inputs_blocked"],invoke:{id:"endConversationActor",src:"endConversationActor",input:({context:t,event:e})=>({conversation:t.conversation,chatSocket:t.chatSocket,talkingAvatar:t.talkingAvatar,voiceBot:t.voiceBot,payload:e?.payload}),onDone:{target:"stopped",actions:[({context:t})=>{try{t.bus.emit("event_command_UI_ClearConversation")}catch(e){}}]},onError:{target:"stopped",actions:[({context:t})=>{try{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertFailedEndConversation"})}catch(e){}}]}}},clearingConversation:{id:"clearingConversation",tags:["inputs_blocked"],invoke:{id:"clearConversationActor",src:"clearConversationActor",input:({context:t,event:e})=>({conversation:t.conversation,talkingAvatar:t.talkingAvatar,payload:e?.payload}),onDone:{target:"stopped",actions:[({context:t})=>{try{t.bus.emit("event_command_UI_ClearConversation")}catch(e){}}]},onError:{target:"stopped",actions:[({context:t})=>{try{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertFailedClearConversation"})}catch(e){}}]}}}}}}},connection:{initial:"connected",states:{connected:{id:"connected",on:{DISCONNECT:"disconnected"}},disconnected:{id:"disconnected",on:{RECONNECT:{target:"connected",actions:["onLeaveDisconnected",u({firstConnectionCompleted:()=>!0})]},CONNECT:{target:"connected",actions:["onLeaveDisconnected",u({firstConnectionCompleted:()=>!0})]}}}}}},on:{INJECT_MODULES:{actions:[u((({context:t,event:e})=>({talkingAvatar:e.payload?.talkingAvatar??t.talkingAvatar,chatSocket:e.payload?.chatSocket??t.chatSocket,voiceBot:e.payload?.voiceBot??t.voiceBot,conversation:e.payload?.conversation??t.conversation,speakingAvatar:e.payload?.speakingAvatar??t.speakingAvatar}))),({context:t,self:e,event:a})=>{try{const n=e.getSnapshot?.(),s=n?.matches?.("lifecycle.conversation.stopped")||n?.matches?.("lifecycle.conversation.timedOut");s&&t.conversation&&e.send({type:"AVATAR_INITIALIZED"});const o=!!n?.matches?.("lifecycle.conversation.inProgress.idle"),r=a.payload?.talkingAvatar;if(o&&r?.isVideoAvatar){const e="AvatarPage"===t.currentPage,a="AVATAR"===t.chatSocket?.chatbotMode,n=!1!==t.chatSocket?.isChatbotShown;if(t.isPageVisible&&e&&a&&n)try{r.armIdleDisconnect?.()}catch(i){}}if(s&&r?.isVideoAvatar){const e="AvatarPage"===t.currentPage,a="AVATAR"===t.chatSocket?.chatbotMode,n=!1!==t.chatSocket?.isChatbotShown;if(t.isPageVisible&&e&&a&&n)try{r.armIdleDisconnect?.()}catch(i){}}}catch(i){}}]},PAGE_CHANGED:{actions:["onPageChanged","setCurrentPage"]},DEFER_START:{actions:["onDeferStart"]},VISIBILITY_CHANGED:{actions:["onVisibilityChanged"]},UI_CHATBOT_MODE:{actions:["onUiChatbotMode"]},CONVERSATION_ERROR:{actions:["onConversationError"]},TTS_ERROR:{actions:["onTtsError"]},INTERRUPT:{actions:[({context:t})=>{try{t.talkingAvatar?.interruptSpeaking?.()}catch{}try{t.chatSocket?.interruptCurrentTurn?.()}catch{}try{t.voiceBot?.stopListening?.()}catch{}try{t.bus?.emit?.("event_command_UI_ClearCaptions")}catch{}}]}}},{actions:{onPageChanged:({context:t,event:e,self:a})=>{try{const n=e?.payload?.newPage;if(!n)return;const s=a.getSnapshot?.(),o=!!s?.hasTag?.("speaking")||s?.matches?.("lifecycle.conversation.inProgress.speaking")||s?.matches?.("lifecycle.conversation.inProgress.pendingAudioStart"),r=!!s?.hasTag?.("listening")||s?.matches?.("lifecycle.conversation.inProgress.listening");if("AvatarPage"!==n&&(o||r)&&(o?a.send({type:"INTERRUPT"}):r&&a.send({type:"IDLE"})),"AvatarPage"===n)try{const e="AVATAR"===t.chatSocket?.chatbotMode,n=!1!==t.chatSocket?.isChatbotShown;e&&n&&t.isPageVisible&&t.talkingAvatar?.resumeRendering?.({forceReconnect:!0});const s=a.getSnapshot?.();s?.matches?.("lifecycle.conversation.inProgress.idle")&&t.voiceBot&&e&&n&&t.isPageVisible&&a.send({type:"LISTEN"});const o=a.getSnapshot?.(),r=!!o?.matches?.("lifecycle.conversation.inProgress.idle"),c=!!o?.matches?.("lifecycle.conversation.stopped"),l=!!o?.matches?.("lifecycle.conversation.timedOut");if(r||c||l){const e=o?.context,a=e?.talkingAvatar??t.talkingAvatar;if(a?.isVideoAvatar)try{a.armIdleDisconnect?.()}catch(i){}}}catch(i){}}catch(n){}},setCurrentPage:u((({event:t})=>{const e=t?.payload?.newPage;return e?{currentPage:e}:{}})),onDeferStart:u((({context:t,event:e})=>{if(!t.isPageVisible){const a=e.payload?.fresh??!1;return null!==t.pendingStart&&t.pendingStart,{pendingStart:a}}return null!==t.pendingStart?{pendingStart:null}:{}})),onVisibilityChanged:u((({context:t,event:e,self:a})=>{const i=e&&(e.payload?.isVisible??e.isVisible),n=void 0===i?!!t.isPageVisible:!!i,s=n&&!t.isPageVisible;if(!n&&t.isPageVisible){if(t.voiceBot&&(lt(t),t.voiceBot.stopListening?.()),t.talkingAvatar){t.talkingAvatar.interruptSpeaking?.();try{t.talkingAvatar.suspendRendering?.("visibility")}catch(o){}}a.send({type:"IDLE"})}else{if(s&&null!==t.pendingStart){const e=t.pendingStart;return a.send({type:"START_CONVERSATION",payload:{fresh:e}}),{isPageVisible:n,pendingStart:null}}s&&t.voiceBot&&"AvatarPage"===t.currentPage&&a.getSnapshot().matches("lifecycle.conversation.inProgress.idle")&&a.send({type:"LISTEN"})}try{if(n&&"AvatarPage"===t.currentPage){const e="AVATAR"===t.chatSocket?.chatbotMode,i=!1!==t.chatSocket?.isChatbotShown;e&&i&&t.talkingAvatar?.resumeRendering?.();const n=a.getSnapshot?.(),s=!!n?.matches?.("lifecycle.conversation.inProgress.idle"),r=!!n?.matches?.("lifecycle.conversation.stopped")||!!n?.matches?.("lifecycle.conversation.timedOut");if(s||r){const e=n?.context,a=e?.talkingAvatar??t.talkingAvatar;if(a?.isVideoAvatar)try{a.armIdleDisconnect?.()}catch(o){}}}}catch(o){}return{isPageVisible:n}})),onListenEntry:({context:t})=>{t.voiceBot&<(t)},onListenFailed:({context:t,event:e})=>{try{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertCouldNotStartListening"})}catch(a){}},onIdle:({context:t})=>{t.voiceBot&&(lt(t),t.voiceBot.stopListening().success)},armVideoIdleDisconnect:({context:t})=>{try{const e=t.talkingAvatar;if(!e?.isVideoAvatar)return;T?.videoAvatar?.idleDisconnectEnabled;const a="AvatarPage"===t.currentPage,i="AVATAR"===t.chatSocket?.chatbotMode,n=!1!==t.chatSocket?.isChatbotShown;if(!(t.isPageVisible&&a&&i&&n))return;const s=T?.videoAvatar?.idleDisconnectMs;!0===T?.videoAvatar?.debug||T?.test?.enableDiagnostics,e.armIdleDisconnect?.(s)}catch(e){}},armVideoIdleDisconnectOnStopped:({context:t})=>{try{const e=t.talkingAvatar;if(!e?.isVideoAvatar)return;T?.videoAvatar?.idleDisconnectEnabled;const a="AvatarPage"===t.currentPage,i="AVATAR"===t.chatSocket?.chatbotMode,n=!1!==t.chatSocket?.isChatbotShown;if(!(t.isPageVisible&&a&&i&&n))return;const s=T?.videoAvatar?.idleDisconnectMs;!0===T?.videoAvatar?.debug||T?.test?.enableDiagnostics,e.armIdleDisconnect?.(s)}catch(e){}},disarmVideoIdleDisconnect:({context:t})=>{try{t.talkingAvatar?.isVideoAvatar&&(!0===T?.videoAvatar?.debug||T?.test?.enableDiagnostics,t.talkingAvatar.disarmIdleDisconnect?.())}catch(e){}},onStop:({context:t})=>{t.voiceBot&&(lt(t),t.voiceBot.stopListening())},onAudioStarted:({context:t,event:e})=>{const a=e?.payload?.audioStartTime??("undefined"!=typeof performance?performance.now():Date.now());try{t.bus?.emit?.("event_command_UI_PlayCaptions",{audioStartTime:a})}catch(i){}},onAudioStartedFallback:({context:t})=>{const e="undefined"!=typeof performance?performance.now():Date.now();try{t.bus?.emit?.("event_command_UI_PlayCaptions",{audioStartTime:e})}catch(a){}},onStreamStart:({context:t,event:e})=>{const{audioStream:a,lipsyncStream:i,turnId:n}=e.payload||{},s=!0===t.talkingAvatar?.isVideoAvatar;t.voiceBot&&void 0!==n&&(t.voiceBot._currentTurnId=n,t.voiceBot._expectedTurnId=n),t.talkingAvatar&&(s?t.talkingAvatar.startStreaming(a??null,i??null,n):a&&i&&t.talkingAvatar.startStreaming(a,i,n))},onInterruptSpeaking:({context:t,self:e})=>{if(t.voiceBot){const a=Date.now();if(a-t.voiceBot._lastInterruptionTime<t.voiceBot.INTERRUPTION_DEBOUNCE)return;const i=-1!==t.voiceBot._expectedTurnId,n=t.voiceBot._isHandlingAudioEnd,s=e.getSnapshot(),o=s?.hasTag?.("speaking")||s?.matches?.("lifecycle.conversation.inProgress.speaking")||s?.matches?.("lifecycle.conversation.inProgress.pendingAudioStart");i&&o&&!n&&(t.voiceBot._expectedTurnId=-1,t.voiceBot._lastInterruptionTime=a),lt(t),t.voiceBot.stopListening().success}t.talkingAvatar&&t.talkingAvatar.interruptSpeaking(),t.chatSocket&&t.chatSocket.interruptCurrentTurn()},onEnsureCleanupComplete:({context:t,self:e})=>{},onSpeechRecognitionFailed:({context:t,event:e})=>{try{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertCouldNotStartListening"})}catch(a){}},onSendTextMessageFailed:({context:t,event:e})=>{try{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertSomeErrorOccurred"})}catch(a){}},onUiChatbotMode:({context:t,event:e,self:a})=>{const i=e.payload;if(!i||void 0===i.isShown&&!i.chatbotMode)return;const n=i.chatbotMode;if(t.chatSocket&&(void 0!==n&&(t.chatSocket.chatbotMode=n),void 0!==i.isShown&&(t.chatSocket.isChatbotShown=i.isShown)),"CHAT"===n){const e=a.getSnapshot();if(e.matches("lifecycle.conversation.inProgress.speaking")||e.matches("lifecycle.conversation.inProgress.pendingAudioStart")){try{t.talkingAvatar?.interruptSpeaking()}catch(s){}try{t.chatSocket?.interruptCurrentTurn?.()}catch(s){}t.voiceBot&&(lt(t),t.voiceBot.stopListening?.(),t.voiceBot._expectedTurnId=-1),a.send({type:"IDLE"})}else e.matches("lifecycle.conversation.inProgress.listening")&&(t.voiceBot&&(lt(t),t.voiceBot.stopListening?.()),a.send({type:"IDLE"}));try{t.talkingAvatar?.suspendRendering?.("chat")}catch(s){}}else if("AVATAR"===n)try{const e=a.getSnapshot(),i=e.matches?.("lifecycle.conversation.inProgress"),n=e.matches?.("lifecycle.conversation.inProgress.idle"),s=!!t.isPageVisible;i&&n&&s&&a.send({type:"LISTEN"})}catch(s){}if(!1===i.isShown)try{const e=a.getSnapshot();if(e.matches?.("lifecycle.conversation.inProgress.speaking")||e.matches?.("lifecycle.conversation.inProgress.pendingAudioStart")){try{t.talkingAvatar?.interruptSpeaking?.()}catch(s){}try{t.chatSocket?.interruptCurrentTurn?.()}catch(s){}t.voiceBot&&(lt(t),t.voiceBot.stopListening?.(),t.voiceBot._expectedTurnId=-1),a.send({type:"IDLE"})}else e.matches?.("lifecycle.conversation.inProgress.listening")&&(t.voiceBot&&(lt(t),t.voiceBot.stopListening?.()),a.send({type:"IDLE"}));try{t.talkingAvatar?.suspendRendering?.("ui-hidden")}catch(s){}}catch(s){}else if(!0===i.isShown)try{const e=a.getSnapshot(),i=e.matches?.("lifecycle.conversation.inProgress"),s=e.matches?.("lifecycle.conversation.inProgress.idle"),o=!!t.isPageVisible;"AVATAR"===(void 0!==n?n:t.chatSocket?.chatbotMode)&&i&&s&&o&&"AvatarPage"===t.currentPage&&a.send({type:"LISTEN"})}catch(s){}try{const e=void 0!==n?n:t.chatSocket?.chatbotMode,a=void 0!==i.isShown?i.isShown:!1!==t.chatSocket?.isChatbotShown;if("AVATAR"===e&&a&&t.isPageVisible&&"AvatarPage"===t.currentPage)t.talkingAvatar?.resumeRendering?.({forceReconnect:!0});else if("AVATAR"===e&&a&&t.isPageVisible);else if(t.talkingAvatar?.isRenderingActive?.()&&("CHAT"===e||!a||!t.isPageVisible))try{t.talkingAvatar?.suspendRendering?.("conditions-change")}catch(s){}}catch(s){}},onLeaveDisconnected:({self:t})=>t.send({type:"RESTORED_CONNECTION"}),onLeaveInitializing:({self:t})=>t.send({type:"AVATAR_INITIALIZED"}),onStartingConversation:({context:t,event:e})=>{t.voiceBot&&(lt(t),t.voiceBot.stopListening(),t.voiceBot._expectedTurnId=-1),t.talkingAvatar&&t.talkingAvatar.interruptSpeaking()},onConversationStartSuccess:({context:t,event:e})=>{try{t.bus?.emit?.("event_status_Conversation_Started",{conversationId:t.conversation?.conversationId})}catch(a){}},onConversationStartFailed:({context:t,event:e})=>{try{const a=e.error?.message||String(e.error)||"Failed to start conversation";t.bus?.emit?.("event_status_Conversation_StartFailed",{error:e.error,message:a})}catch(a){}},onAutoResumeFailed:({context:t,event:e})=>{},onAutoResumeToListening:({context:t})=>{try{t.bus?.emit?.("event_status_Conversation_AutoResumedToListening",{conversationId:t.conversation?.conversationId})}catch(e){}},onConversationInitFailed:({context:t,event:e})=>{},onConversationInitSuccess:({context:t,event:e})=>{},handleAiMessage:({context:t,event:e,self:a})=>{const{message:i,time:n,structuredResponse:s}=e.payload||{};if("string"==typeof i&&""!==i.trim())try{t.bus.emit("event_command_UI_UpdateCurrentMessage",{speaker:"assistant",messageText:S(i)})}catch(h){}const o=s?.avatar_mood??e.payload?.structuredResponse?.avatar_mood;if(o)try{t.bus.emit("event_command_Avatar_SetAvatarMood",{mood:o})}catch(h){}t.conversation&&i&&Promise.resolve().then((async()=>{try{const a=n||(new Date).toLocaleTimeString(),s=await t.conversation.appendMessage(i,a,"assistant");try{t.bus.emit("event_status_Conversation_MessageAppended",s)}catch(e){}}catch(h){}}));const r="AVATAR"===t.chatSocket?.chatbotMode,c=e.payload?.switchedToAvatar,l=!0===t.talkingAvatar?.isVideoAvatar;if(r&&l&&!c&&i){const e=t.chatSocket?.sessionData?.conversation?.currentTurnId;try{t.talkingAvatar.setPendingMessage(i,e)}catch(h){}setTimeout((()=>{try{a?.send?.({type:"STREAM_START",payload:{audioStream:null,lipsyncStream:null,turnId:e}})}catch(h){}}),0)}else r&&!c||setTimeout((()=>{try{const t=a.getSnapshot?.();(t?.matches?.("lifecycle.conversation.inProgress.thinking")||t?.matches?.("lifecycle.conversation.inProgress.startingConversation")||t?.matches?.("lifecycle.conversation.autoResuming"))&&a?.send?.({type:"IDLE"})}catch(t){}}),0)},onAudioEnd:({context:t,event:e})=>{const{turnId:a}=e.payload||{};lt(t);try{!0===t.talkingAvatar?.isVideoAvatar&&a&&t.chatSocket?.turn?.id===a&&t.chatSocket?.finishCurrentTurn?.()}catch(i){}if(t.voiceBot){if(-1===t.voiceBot._expectedTurnId||a!==t.voiceBot._expectedTurnId)return;t.voiceBot._expectedTurnId=-1,t.voiceBot._isHandlingAudioEnd=!0}t.chatSocket?.pendingDelayedActions?.length>0&&(x(t.chatSocket.pendingDelayedActions,t.bus),t.chatSocket.pendingDelayedActions=null),t.voiceBot&&setTimeout((()=>{t.voiceBot._isHandlingAudioEnd=!1}),50)},onStreamEnd:({context:t})=>{try{t.talkingAvatar?.finalizeTurn?.()}catch(e){}if(t.chatSocket?.pendingDelayedActions?.length>0){try{x(t.chatSocket.pendingDelayedActions,t.bus)}catch(e){}t.chatSocket.pendingDelayedActions=null}},onMicButtonBlocked:({context:t})=>{t.bus.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertWaitForAIResponse"})},onMicButtonStartListening:u((()=>({userSilenced:!1}))),setUserSilencedTrue:u((()=>({userSilenced:!0}))),onMicButtonStopListening:({context:t})=>{},onMicButtonInterruptSpeaking:u((()=>({userSilenced:!1}))),emitVoiceBargeInEvent:({context:t,event:e})=>{const a=e?.payload||{};try{t.bus?.emit?.("event_status_Speech_BargeInTriggered",{micLevel:a.micLevel,avatarLevel:a.avatarLevel,ratio:a.ratio,delta:a.delta,timestamp:a.timestamp})}catch(i){}},onVoiceBargeIn:u((()=>({userSilenced:!1}))),onAssistantMessage:({context:t,event:e})=>{try{t.bus.emit("event_command_UI_AutoScrollChat",{message:e?.payload?.message||e?.message})}catch(a){}},onConversationError:({context:t,event:e,self:a})=>{const{error:i,chatbotMode:n}=e.payload||{};if(!i)return;if((908===i.code||404===i.code||408===i.code)&&void 0!==i.conversationId)return void a.send({type:"CONVERSATION_TIMEOUT",payload:{conversationId:i.conversationId}});const s=i.message?{errorMessage:i.message}:{messageKey:"alertSomeErrorOccurred"};t.bus.emit("event_command_Alerts_ShowDismissableAlert",s);const o=a.getSnapshot();o.matches("lifecycle.conversation.inProgress.thinking")&&a.send({type:"IDLE"}),"AVATAR"===n&&o.matches("lifecycle.conversation.inProgress.idle")&&a.send({type:"LISTEN"})},onTtsError:({context:t,self:e})=>{t.chatSocket?.cleanupActiveStreams();const a=e.getSnapshot();a.matches("lifecycle.conversation.inProgress.speaking")||a.matches("lifecycle.conversation.inProgress.pendingAudioStart")?(t.talkingAvatar?.interruptSpeaking&&t.talkingAvatar.interruptSpeaking(),e.send({type:"IDLE"})):e.send({type:"IDLE"})},onConversationPaused:({context:t})=>{t.voiceBot&&(lt(t),t.voiceBot.stopListening()),t.talkingAvatar&&t.talkingAvatar.interruptSpeaking()}},guards:{isRequestBlocked:({self:t})=>{try{const e=t.getSnapshot?.();return!!e?.hasTag?.("thinking")}catch(e){return!1}},isAvatarMode:({context:t})=>{try{return"AVATAR"===t?.chatSocket?.chatbotMode}catch(e){return!1}},hasActiveConversation:({context:t})=>{if(!t.conversation)return!1;try{const e=!!t.conversation.conversationId,a=(t.conversation.conversationData?.currentTurnId||0)>0,i=Array.isArray(t.conversation.conversationData?.transcript)&&t.conversation.conversationData.transcript.length>0;return e&&(a||i)}catch(e){return!1}},isPendingAudioStart:({self:t})=>{try{return t.getSnapshot?.().matches?.("lifecycle.conversation.inProgress.pendingAudioStart")}catch(e){return!1}}},actors:{startConversationService:p((async({input:t})=>{const{isNew:e,skipFallback:a,bus:i,conversation:n,chatSocket:s,talkingAvatar:o,speakingAvatar:r}=t||{};if(!n||!s)throw new Error("Conversation or ChatSocket module not available");if(await Promise.resolve(),o?.conversationStreamActive)try{await(o.stopConversationStream?.())}catch(d){}e&&n.conversationId&&await n.notifyConversationEnd(),await n.notifyConversationStart(e);const c=!e;let l;try{l=await s.sendStartConversationEvent(c,{isVideoAvatar:!0===o?.isVideoAvatar})}catch(u){const t=u?.message?.includes("404")||u?.message?.includes("408");if(c&&t&&!a){try{await n.clearOngoingConversation()}catch(d){}await n.notifyConversationStart(!0),l=await s.sendStartConversationEvent(!1,{isVideoAvatar:!0===o?.isVideoAvatar});try{i?.emit?.("event_status_Conversation_ResumeFailedAndRestarted",{conversationId:n.conversationId})}catch(d){}return r?.isVideoAvatarInitPending?.()&&await r.initializeVideoAvatarScene(),o&&await o.startConversationStream(),l}throw u}r?.isVideoAvatarInitPending?.()&&await r.initializeVideoAvatarScene(),o&&await o.startConversationStream();const h=await(n.handleConversationSuccessfulStart?.(l))||{};if(h.resumeFailed)try{i?.emit?.("event_status_Conversation_ResumeFailedAndRestarted",{conversationId:n.conversationId})}catch(d){}else if(h.resumeAttempt&&!h.serverStartedNew)try{i?.emit?.("event_status_Conversation_ResumedSuccessfully",{conversationId:n.conversationId})}catch(d){}return l})),initConversationActor:p((async({input:t})=>{const{conversation:e,chatSocket:a}=t||{};if(!e)throw new Error("Conversation module not available");return await e.notifyConversationInit(),a&&await a.sendInitConversationEvent(),{initialized:!0}})),listenActor:p((async({input:t})=>{const{voiceBot:e,talkingAvatar:a,currentPage:i,isPageVisible:n,chatbotMode:s}=t||{};if(!e)return{started:!1};if(!n||"AvatarPage"!==i||"AVATAR"!==s)return{started:!1};if(a?.isVideoAvatar&&"function"==typeof a.isRenderingActive){const t=8e3,e=250,i=Date.now();for(;!a.isRenderingActive()&&Date.now()-i<t;)await new Promise((t=>setTimeout(t,e)));if(!a.isRenderingActive())return{started:!1}}const o=await e.startListening();if(!o.success)throw new Error(o.error||"Failed to start listening");return{started:!0}})),speechRecognitionActor:p((async({input:t})=>{const{chatSocket:e,payload:a,conversation:i,bus:n}=t||{};if(!e||!i)throw new Error("Dependencies not available");if(!a||!a.messageText)throw new Error("Invalid speech payload");const s=await i.appendMessage(a.messageText,C(new Date),"user");try{n?.emit("event_status_Conversation_MessageAppended",s)}catch(r){}const o=await e.sendMessage(a,"AVATAR");if(!o.success)throw n?.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertSomeErrorOccurred"}),new Error(o.error||"Failed to process speech input");return{sent:!0}})),sendTextMessageActor:p((async({input:t})=>{const{chatSocket:e,payload:a,conversation:i,bus:n}=t||{};if(!e||!i)throw new Error("Dependencies not available");if(!a||!a.message)throw new Error("Invalid text payload");const s=await i.appendMessage(a.message,C(new Date),"user");try{n?.emit("event_status_Conversation_MessageAppended",s)}catch(l){}const o={messageText:a.message},r=a.chatbotMode||"CHAT",c=await e.sendMessage(o,r);if(!c.success)throw n?.emit("event_command_Alerts_ShowDismissableAlert",{messageKey:"alertSomeErrorOccurred"}),new Error(c.error||"Failed to send text message");return{sent:!0}})),endConversationActor:p((async({input:t})=>{const{conversation:e,chatSocket:a,talkingAvatar:i,voiceBot:n,payload:s}=t||{};if(!e)return!0;const o=e.conversationId,{satisfactionScore:r=0}=s||{};if(await e.notifyConversationEnd(),a&&o)try{a.sendEndConversationEvent(o,r)}catch(c){}try{i?.interruptSpeaking?.()}catch(c){}try{await(i?.stopConversationStream?.())}catch(c){}try{i?.liveCaptions?.clearCaptions?.(),n?.stopListening?.()}catch(c){}return!0})),clearConversationActor:p((async({input:t})=>{const{conversation:e,talkingAvatar:a,payload:i}=t||{};if(!e)return!0;const{conversationId:n}=i||{};if(n===e.conversationId){await e.clearOngoingConversation();try{await(a?.stopConversationStream?.())}catch(s){}}return!0})),checkResumeActor:p((async({input:t})=>{const{conversation:e,bus:a}=t||{};if(!e)return{resumable:!1};try{const t=await(e.getConversationData?.());if(t?.id&&Array.isArray(t.transcript)&&t.transcript.length>0)return{resumable:!0}}catch(i){throw i}return{resumable:!1}})),cleanupInterruptionActor:p((async({input:t})=>{const{talkingAvatar:e,chatSocket:a,voiceBot:i}=t||{};try{try{e?.liveCaptions?.clearCaptions?.()}catch(n){}if(i)try{i.stopListening?.()}catch(n){}try{e?.interruptSpeaking?.()}catch(n){}try{a?.interruptCurrentTurn?.()}catch(n){}return await new Promise((t=>setTimeout(t,10))),!0}catch(s){throw s}}))},delays:{thinkingTimeout:T?.chatbot?.thinkingTimeout,speechStartTimeout:Math.min(Math.max(T?.chatbot?.speechStartTimeout??8e3,2e3),6e4)}});class dt{constructor(t){if(!t)throw new Error("Cannot initialize AvatarOrchestrator: missing bus instance");this.bus=t,this.actor=null,this._pendingEvents=[],this._deferredModules=null,this.diagnostics=null}start(t={}){if(this._deferredModules&&(t={...t,...this._deferredModules},this._deferredModules=null),this.actor)t&&Object.keys(t).length>0&&this.injectModules(t);else if(this.actor=g(ht,{input:{bus:this.bus,...t}}).start(),this.actor.subscribe((t=>{this.handleStateTransition(t)})),this._pendingEvents.length>0){for(const t of this._pendingEvents)this.actor.send(t);this._pendingEvents.length=0}}handleStateTransition(t){t&&this.diagnostics&&t?.changed&&(this.diagnostics.logStateTransition(t.history?.value,t.value),t.matches?.("lifecycle.conversation.stopped")&&this.diagnostics.displayDiagnosticsInConsole())}sendEvent(t,e=null){const a={type:t,payload:e};this.actor?this.actor.send(a):this._pendingEvents.push(a)}is(t){return!!this.actor&&this.actor.getSnapshot().matches(t)}getCurrentState(){return this.actor?.getSnapshot().value}getSnapshot(){return this.actor?this.actor.getSnapshot():null}destroy(){this.actor?.stop(),this.actor=null,this.diagnostics=null,this._pendingEvents=[]}interruptSpeaking(){this.sendEvent("INTERRUPT")}transitionToListening(){this.sendEvent("LISTEN")}transitionToIdle(){this.sendEvent("IDLE")}injectModules(t={}){this.actor?this.actor.send({type:"INJECT_MODULES",payload:t}):this._deferredModules={...this._deferredModules||{},...t}}subscribeProjected(t){if(!this.actor)return()=>{};let e={};const a=this.actor.subscribe((a=>{const i={lifecycle:{initInitializing:a.matches?.("lifecycle.init.initializing")||!1,initFailed:a.matches?.("lifecycle.init.failed")||!1,convoStopped:a.matches?.("lifecycle.conversation.stopped")||!1,convoAutoResuming:a.matches?.("lifecycle.conversation.autoResuming")||!1,convoResumeExpired:a.matches?.("lifecycle.conversation.resumeExpired")||!1,convoInProgress:a.matches?.("lifecycle.conversation.inProgress")||!1,convoStarting:a.matches?.("lifecycle.conversation.inProgress.startingConversation")||!1,convoInitializing:a.matches?.("lifecycle.conversation.initializingConversation")||!1,conversationSubstate:a.matches?.("lifecycle.conversation.inProgress.pendingAudioStart")?"pendingAudioStart":a.matches?.("lifecycle.conversation.inProgress.speaking")?"speaking":a.matches?.("lifecycle.conversation.inProgress.listening")?"listening":a.matches?.("lifecycle.conversation.inProgress.thinking")?"thinking":a.matches?.("lifecycle.conversation.inProgress.startingConversation")?"startingConversation":a.matches?.("lifecycle.conversation.inProgress.idle")?"idle":""},connection:{connected:a.matches?.("connection.connected")||!1,disconnected:a.matches?.("connection.disconnected")||!1},flags:{userSilenced:a.context?.userSilenced||!1,isPageVisible:!!a.context?.isPageVisible,pendingStart:"boolean"==typeof a.context?.pendingStart?a.context.pendingStart:null}};!function(t,e){if(t===e)return!0;if(!t||!e)return!1;const a=t.lifecycle,i=e.lifecycle;if(!a||!i)return!1;if(a.initInitializing!==i.initInitializing||a.initFailed!==i.initFailed||a.convoStopped!==i.convoStopped||a.convoResumable!==i.convoResumable||a.convoInProgress!==i.convoInProgress||a.convoStarting!==i.convoStarting||a.convoInitializing!==i.convoInitializing||a.conversationSubstate!==i.conversationSubstate)return!1;const n=t.connection,s=e.connection;if(!n||!s)return!1;if(n.connected!==s.connected||n.disconnected!==s.disconnected)return!1;const o=t.flags,r=e.flags;return!(!o||!r)&&o.userSilenced===r.userSilenced&&o.isPageVisible===r.isPageVisible&&o.pendingStart===r.pendingStart}(i,e)&&(e=i,t(i,a))}));return()=>a.unsubscribe()}}class ut{constructor(t,e){if(!t||!e)throw new Error("Cannot initialize connectionManager due to missing bus or avatarOrchestrator");this.connectionModules={},this._allConnectionsReady=!1,this._wasAllReady=!1,this.isReconnecting=!1,this.bus=t,this.avatarOrchestrator=e,this._reconnectTimer=null,this._retryDelay=T?.connection?.reconnectInitialDelay,this._maxDelay=T?.connection?.reconnectMaxDelay,this._factor=T?.connection?.reconnectFactor,this._reconnectHandler=async()=>{try{this._resetBackoff(),await this.reconnectFailedModules(!0)}catch(t){}},this.bus.on("event_command_ConnectionManager_ReconnectFailedModules",this._reconnectHandler)}get allConnectionsReady(){return this._allConnectionsReady}set allConnectionsReady(t){this._allConnectionsReady=t}registerNewConnectionModule(t,e=null){try{const a=new F(t);e&&(a.reconnect=e),a.subscribe((()=>this.updateAvatarState())),this.connectionModules[t]=a}catch(a){}}registerConnectionModule(t){try{if(!t||!t.name||"function"!=typeof t.subscribe)throw new Error("Invalid module: must have 'name' property and 'subscribe' method");t.subscribe((()=>this.updateAvatarState())),this.connectionModules[t.name]=t,this.updateAvatarState()}catch(e){}}setReconnectFunction(t,e){try{const a=this.connectionModules[t];if(!a)return;a.reconnect=e}catch(a){}}waitUntilReady(t=15e3){return new Promise(((e,a)=>{if(this._allConnectionsReady)return e(!0);let i,n;const s=()=>{i&&clearTimeout(i),n&&this.bus.off("connectionStateChanged",n)};i=setTimeout((()=>{s(),a(new Error("Connection timeout"))}),t),n=()=>{this._allConnectionsReady&&(s(),e(!0))},this.bus.on("connectionStateChanged",n)}))}updateAvatarState(){if(!this.avatarOrchestrator)return;const t=Object.values(this.connectionModules).filter((t=>!1!==t?.blocking)),e=t.every((t=>t.isConnected())),a=t.filter((t=>!1!==t?.autoReconnect));if(this.allConnectionsReady=e,this.bus.emit("connectionStateChanged"),e){if(this._clearReconnectTimer(),!this._wasAllReady)try{const t=this.avatarOrchestrator.getSnapshot?.();this.avatarOrchestrator.sendEvent("RECONNECT"),(t?.matches?.("lifecycle.init.failed")||t?.matches?.("lifecycle.init.initializing"))&&this.avatarOrchestrator.sendEvent("CONNECT")}catch(i){}this._wasAllReady=!0}else{if(a.some((t=>!t.isConnected()))&&this._scheduleAutoReconnect(),this._wasAllReady)try{this.avatarOrchestrator.sendEvent("DISCONNECT")}catch(i){}this._wasAllReady=!1}}async reconnectFailedModules(t=!1){if(this.isReconnecting)return;this.isReconnecting=!0;const e=Object.values(this.connectionModules).filter((t=>!1!==t?.autoReconnect&&(t.isFailed()||t.isDisconnected()))).map((async t=>{try{await(t.reconnect?.())}catch(e){}}));await Promise.allSettled(e),this.isReconnecting=!1,this.updateAvatarState(),t||this._stepBackoff()}async reconnectDisconnectedModules(){if(this.isReconnecting)return;this.isReconnecting=!0;const t=Object.values(this.connectionModules).filter((t=>!1!==t?.autoReconnect&&!t.isConnected())).map((async t=>{try{await(t.reconnect?.())}catch(e){}}));await Promise.allSettled(t),this.isReconnecting=!1,this.updateAvatarState()}getConnectionReport(){let t=`System is ${this.allConnectionsReady?"Ready":"Not Ready"}\n\n`;for(const e of Object.values(this.connectionModules))t+=`${e.name}: ${e.isConnected()?"connected":"disconnected"}, \n`;return t}_scheduleAutoReconnect(){this._reconnectTimer||(this._reconnectTimer=setTimeout((async()=>{this._reconnectTimer=null,await this.reconnectFailedModules()}),this._retryDelay))}_clearReconnectTimer(){this._reconnectTimer&&(clearTimeout(this._reconnectTimer),this._reconnectTimer=null),this._resetBackoff()}_resetBackoff(){this._retryDelay=T?.connection?.reconnectInitialDelay}_stepBackoff(){this._retryDelay=Math.min(Math.ceil(this._retryDelay*this._factor),this._maxDelay)}destroy(){try{this._reconnectHandler&&(this.bus?.off("event_command_ConnectionManager_ReconnectFailedModules",this._reconnectHandler),this._reconnectHandler=null),this._clearReconnectTimer()}catch(t){}}}class pt{constructor({bus:t,socketManager:e,getConversationId:a,getChatbotMode:i,provider:n="Azure"}){this.provider=n.trim(),this.bus=t,this.socketManager=e,this.getConversationId=a,this.getChatbotMode=i,this._webrtcConnected=!1,this._chatbotMode="CHAT",this._conversationId=null,this._sentConnectEvent=!1,this.webRtcEventName=this._getWebRtcEventName(),this._onWebRtcConnectionChanged=t=>{const e=!!t?.connected,a=this._webrtcConnected;this._webrtcConnected=e,!a&&e?this._sendConnectEvent():a&&!e&&this._sendDisconnectEvent("webrtc_disconnected")},this._onChatbotModeChanged=t=>{const e=t?.chatbotMode,a="AVATAR"===this._chatbotMode;"string"==typeof e&&e&&(this._chatbotMode=e),a&&"AVATAR"!==this._chatbotMode&&this._webrtcConnected&&this._sentConnectEvent&&this._sendDisconnectEvent("mode_changed_to_chat")},this._onPageHide=()=>{this._webrtcConnected&&this._sentConnectEvent&&this._sendDisconnectEvent("page_hide",{keepalive:!0})},this._onBeforeUnload=()=>{this._webrtcConnected&&this._sentConnectEvent&&this._sendDisconnectEvent("before_unload",{keepalive:!0})},this._onVisibilityChange=()=>{},this._onConversationEnding=async t=>{try{await this.notifyBeforeEndConversation()}finally{try{"function"==typeof t?.onDisconnectComplete&&t.onDisconnectComplete()}catch(e){}}},this._onConversationStarted=t=>{this._webrtcConnected&&!this._sentConnectEvent&&this._sendConnectEvent()},this._bind();try{const t=this.getChatbotMode?.();"string"==typeof t&&t&&(this._chatbotMode=t)}catch(s){}}_getWebRtcEventName(){return"Azure"===this.provider?"event_status_AzureAvatar_WebRtcConnectionChanged":`event_status_${this.provider.charAt(0).toUpperCase()+this.provider.slice(1)}Avatar_WebRtcConnectionChanged`}_bind(){try{this.bus?.on?.(this.webRtcEventName,this._onWebRtcConnectionChanged)}catch(t){}try{this.bus?.on?.("event_status_ChatbotMode_Changed",this._onChatbotModeChanged)}catch(e){}try{this.bus?.on?.("event_status_Conversation_Ending",this._onConversationEnding)}catch(e){}try{this.bus?.on?.("event_status_Conversation_Started",this._onConversationStarted)}catch(e){}try{"undefined"!=typeof window&&window.addEventListener&&(window.addEventListener("pagehide",this._onPageHide,{capture:!0}),window.addEventListener("beforeunload",this._onBeforeUnload,{capture:!0}))}catch(e){}try{"undefined"!=typeof document&&document.addEventListener&&document.addEventListener("visibilitychange",this._onVisibilityChange,{capture:!0})}catch(e){}}_refreshConversationId(){let t=null;try{t=this.getConversationId?.()??null}catch(e){}return t&&"string"==typeof t?(this._conversationId=t,t):null}_sendConnectEvent(){const t=this._refreshConversationId();if(!t)return;if("AVATAR"!==this._chatbotMode)return;const e=this.socketManager?.isSocketConnected?.();if(e)try{this.socketManager.emit("video_avatar_connected",{conversationId:t,chatbotMode:this._chatbotMode,timestamp:Date.now(),provider:this.provider}),this._sentConnectEvent=!0}catch(a){}}async _sendDisconnectEvent(t,e={}){const a=this._conversationId;if(!a||!this._sentConnectEvent)return!1;if(!this.socketManager?.isSocketConnected?.())return this._sentConnectEvent=!1,!1;try{return await this.socketManager.emitWithResponse("video_avatar_disconnected",{conversationId:a,reason:t,timestamp:Date.now(),provider:this.provider}),this._sentConnectEvent=!1,!0}catch(i){return this._sentConnectEvent=!1,!1}}async notifyBeforeEndConversation(){return!(!this._webrtcConnected||!this._sentConnectEvent)&&await this._sendDisconnectEvent("conversation_ending")}async destroy(){this._webrtcConnected&&this._sentConnectEvent&&this._sendDisconnectEvent("meter_destroyed");try{this.bus?.off?.(this.webRtcEventName,this._onWebRtcConnectionChanged)}catch(t){}try{this.bus?.off?.("event_status_ChatbotMode_Changed",this._onChatbotModeChanged)}catch(t){}try{this.bus?.off?.("event_status_Conversation_Ending",this._onConversationEnding)}catch(t){}try{this.bus?.off?.("event_status_Conversation_Started",this._onConversationStarted)}catch(t){}try{"undefined"!=typeof window&&window.removeEventListener&&(window.removeEventListener("pagehide",this._onPageHide,{capture:!0}),window.removeEventListener("beforeunload",this._onBeforeUnload,{capture:!0}))}catch(t){}try{"undefined"!=typeof document&&document.removeEventListener&&document.removeEventListener("visibilitychange",this._onVisibilityChange,{capture:!0})}catch(t){}this.bus=null,this.socketManager=null,this.getConversationId=null,this.getChatbotMode=null}}const gt={...U};class vt{constructor(t){if(!t)throw new Error("Cannot initialize SpeakingAvatar due to missing bus instance");this.voiceBot=null,this.chatSocket=null,this.bus=t,this.avatarOrchestrator=new dt(t),this.avatarOrchestrator.start(),this.connectionManager=this.createConnectionManager(this.bus,this.avatarOrchestrator),this.sessionData=ct.getInstance(),this.auth=new ot,this.connectionManager.registerConnectionModule(this.auth),this.voiceBargeInDetector=null,this.avatarType=gt.THREE_D,this.videoUsageMeter=null}createConnectionManager(t,e){if(!t||!e)throw new Error("Missing dependencies for ConnectionManager creation.");return new ut(t,e)}async init(t){if(!t?.avatarContainer||!t.avatarAPIKey&&!t.tokenEndpoint||!t.avatarId||!t.targetApp)return!1;try{await this.initializeAuthentication(t);const{avatarParameters:e,avatarItem:a}=await this.setupAvatarData();if(!e||!a)return!1;const i=e.avatarSource;if(this.avatarType=t.avatarType||j(i)||T?.avatar?.avatarType||gt.THREE_D,this.avatarType===gt.VIDEO&&G(i)){const i=e.avatarSourceId||t.azureCharacter||"lisa:casual-sitting",[n,s]=i.includes(":")?i.split(":"):[i,"casual-sitting"];a.azureCharacter=n,a.azureStyle=s||e.bodyType||t.azureStyle||"casual-sitting",a.azureBackendUrl=T?.azure?.backendUrl||A()}return this.avatarModule=await this._createAvatarModule(e.avatarSource),await this.sessionData.init(e,a),this.avatarType===gt.VIDEO?(await this.initializeVoiceBot(),await this.initializeChatSocket(),this._deferredVideoAvatarParams={avatarItem:a,avatarContainer:t.avatarContainer,initOptions:{speechConfig:this.voiceBot?.speechConfig,auth:this.auth},provider:e.avatarSource},this.bus?.emit?.("event_status_VideoAvatar_ShowPlaceholder",{avatarId:e.avatarId,avatarSource:e.avatarSource})):await Promise.all([this.initializeChatSocket(),this.initializeVoiceBot(),this.initializeAvatarScene(a,t.avatarContainer)]),this.avatarOrchestrator.injectModules({talkingAvatar:this.avatarModule,chatSocket:this.chatSocket,voiceBot:this.voiceBot,conversation:this.sessionData.conversation,speakingAvatar:this.avatarType===gt.VIDEO?this:null}),await this.initializeVoiceBargeInDetector(),await this.connectionManager.waitUntilReady(),this.avatarOrchestrator.sendEvent("READY","SpeakingAAvatar.init"),!0}catch(e){return!1}}async _createAvatarModule(t){try{switch(this.avatarType){case gt.VIDEO:{if(G(t)){const{AzureTalkingAvatar:t}=await import("./AzureTalkingAvatar-DwFpnwON.js");return new t(this.bus,this.avatarOrchestrator)}const{AzureTalkingAvatar:e}=await import("./AzureTalkingAvatar-DwFpnwON.js");return new e(this.bus,this.avatarOrchestrator)}case gt.THREE_D:default:{const{TalkingAvatar:t}=await import("./TalkingAvatar--N4jOsLi.js");return new t(this.bus,this.avatarOrchestrator)}}}catch(e){throw new Error(`SpeakingAvatar: Failed to load avatar module for source '${t}'. Please verify that the requested avatar provider is correctly configured and available.`)}}async initializeAuthentication(t){if(!(await this.auth.init(t.targetApp,t.avatarAPIKey||"",t.tokenEndpoint||"",t.avatarId)))throw new Error("Authentication initialization failed.")}async setupAvatarData(){const t=await this.auth.getAvatarParameters();if(!t)throw new Error("Failed to retrieve avatar parameters from authentication");return{avatarParameters:t,avatarItem:this.constructAvatarItem(t)}}constructAvatarItem(t){let e=t.avatarUrl;"ReadyPlayerMe"===t.avatarSource&&e&&e.includes("models.readyplayer.me")&&(e+="?morphTargets=ARKit,Oculus+Visemes,mouthOpen,mouthSmile,eyesClosed,eyesLookUp,eyesLookDown&textureSizeLimit=1024&textureFormat=png");let a=t.lipsyncType||"visemes";return{id:t.avatarSourceId,type:T?.avatar?.type,url:e,source:t.avatarSource,bodyType:t.bodyType,gender:t.gender,voice:t.voice,lipsyncType:a}}async initializeChatSocket(){try{K.resetInstance?.()}catch{}this.chatSocket=K.getInstance(this.bus,this.auth,this.sessionData,this.avatarOrchestrator),await this.chatSocket.init(),this.connectionManager.registerConnectionModule(this.chatSocket)}async initializeVoiceBot(){this.voiceBot=await X.build(this.bus,this.avatarOrchestrator,this.auth,this.sessionData),this.connectionManager.registerConnectionModule(this.voiceBot.speechService)}async initializeVoiceBargeInDetector(){if(!this.voiceBargeInDetector&&!1!==T?.speech?.bargeIn?.enabled)try{this.voiceBargeInDetector=new J({talkingAvatar:this.avatarModule,avatarOrchestrator:this.avatarOrchestrator,config:T?.speech?.bargeIn}),await this.voiceBargeInDetector.init()}catch(t){this.voiceBargeInDetector=null}}async setBargeInEnabled(t){if(T?.speech?.bargeIn&&(T.speech.bargeIn.enabled=t),t)this.voiceBargeInDetector||this.avatarModule&&this.avatarOrchestrator&&await this.initializeVoiceBargeInDetector();else if(this.voiceBargeInDetector){try{this.voiceBargeInDetector.destroy()}catch(e){}this.voiceBargeInDetector=null}}async initializeAvatarScene(t,e,a=void 0){try{if(!this.avatarModule)throw new Error("Avatar module not initialized.");await this.avatarModule.init(t,e,a),this.connectionManager.registerConnectionModule(this.avatarModule)}catch(i){throw i}}async initializeVideoAvatarScene(){if(!this._deferredVideoAvatarParams)return!0;const{avatarItem:t,avatarContainer:e,initOptions:a,provider:i}=this._deferredVideoAvatarParams;try{this.videoUsageMeter?.destroy?.()}catch(n){}return this.videoUsageMeter=new pt({bus:this.bus,socketManager:this.chatSocket?.socketManager,getConversationId:()=>this.sessionData?.conversation?.conversationId,getChatbotMode:()=>this.chatSocket?.chatbotMode,provider:i}),await this.initializeAvatarScene(t,e,a),this._deferredVideoAvatarParams=null,this.bus?.emit?.("event_status_VideoAvatar_HidePlaceholder",{}),!0}isVideoAvatarInitPending(){return!!this._deferredVideoAvatarParams}destroy(){try{this.videoUsageMeter?.destroy?.()}catch{}this.videoUsageMeter=null;try{K.resetInstance?.()}catch{}this.voiceBot?.destroy?.(),this.voiceBargeInDetector?.destroy?.(),this.voiceBargeInDetector=null,this.avatarModule?.destroy?.(),this.connectionManager?.destroy?.(),this.sessionData?.destroy?.(),this.auth?.destroy?.(),this.avatarOrchestrator?.destroy?.()}async refreshAvatar(){return!!this.avatarModule&&(this.avatarModule.refreshAvatar?.()??!1)}getAvatarType(){return this.avatarType}isVideoAvatar(){return this.avatarType===gt.VIDEO}isAzureAvatar(){return!!this.isVideoAvatar()&&(!!this.avatarModule?.isAzureAvatar||!!this.sessionData?.avatarItem?.source&&G(this.sessionData.avatarItem.source))}}class mt extends EventTarget{constructor(){super(),this._listeners=new Map,this._disposers=new Set,this._isDisposed=!1,this._globalListeners=new Set}on(t,e){if(this._isDisposed)return()=>{};if("*"===t)return this.onAll(e);const a=t=>{try{const a=t.detail;e(a)}catch(a){}};this._listeners.has(t)||this._listeners.set(t,new Map),this._listeners.get(t).set(e,a),this.addEventListener(t,a);const i=()=>{this._isDisposed||(this.removeEventListener(t,a),this._listeners.get(t)?.delete(e),this._disposers.delete(i))};return this._disposers.add(i),i}off(t,e){if("*"===t)return this.offAll(e);const a=this._listeners.get(t)?.get(e);a&&(this.removeEventListener(t,a),this._listeners.get(t)?.delete(e))}emit(t,e=void 0){if(this._isDisposed)return;const a=new CustomEvent(t,{detail:e,bubbles:!1,cancelable:!1});this.dispatchEvent(a),this._globalListeners.forEach((a=>{try{a(t,e)}catch(i){}}))}onAll(t){if(this._isDisposed)return()=>{};this._globalListeners.add(t);const e=()=>{this._isDisposed||(this._globalListeners.delete(t),this._disposers.delete(e))};return this._disposers.add(e),e}offAll(t){this._globalListeners.delete(t)}clear(){this._listeners.forEach(((t,e)=>{t.forEach(((t,a)=>{this.removeEventListener(e,t)}))})),this._listeners.clear(),this._globalListeners.clear(),this._disposers.clear()}dispose(){this._isDisposed||(this._disposers.forEach((t=>{try{t()}catch(e){}})),this._listeners.clear(),this._globalListeners.clear(),this._disposers.clear(),this._isDisposed=!0)}get disposerCount(){return this._disposers.size}get isDisposed(){return this._isDisposed}get listenerCount(){let t=this._globalListeners.size;return this._listeners.forEach((e=>{t+=e.size})),t}}const _t="en",bt={en:{start:"Start Conversation",connect:"Connect",endConversation:"End Conversation",restartConversation:"Restart Conversation",hideTyping:"Hide typing input",showTyping:"Show typing input",reconnecting:"Reconnecting...",waitForResponse:"Please wait for response...",typeHere:"Type here.",noMessagesYet:"No messages yet...",conversationStatus:"Conversation Status",conversationInProgress:"Conversation In Progress",conversationStopped:"Conversation Stopped",startConversation:"Start Conversation",downloadConversation:"Download Conversation",liveCaptions:"Live captions",toggleChatbot:"Toggle avatar chatbot",avatar:"Avatar",switchToAvatar:"Back to avatar",switchToChat:"Switch to chat",chat:"Chat",statusInitializing:"Hang tight, we're waking up the avatar!",statusReconnecting:"Connection issue, attempting to reconnect...",statusFailed:"Connection failed. Manual action may be required.",statusInvalidConfiguration:"The avatar is not configured correctly, contact the admin.",avatarIdleDisconnected:"The avatar is resting.",reconnectAvatar:"Wake up Avatar",close:"Close",lastAssistantMessage:"Last message",fullBodyView:"Full body view",upperBodyView:"Upper body view",secureFormTitle:"Secure Form",secureFormDescription:"Enter your information.",name:"Name*",namePlaceholder:"Enter your name",phoneNumber:"Phone Number",phonePlaceholder:"Enter your phone number",email:"Email",emailPlaceholder:"Enter your email",secureFormNote:"Your information will not be shared with the LLM and will not be stored after this session. By sending you agree to share your info to get additional support.",save:"Save",send:"Send",cancel:"Cancel",conversationEndedPrompt:"Conversation ended. Please rate your satisfaction with the conversation.",submit:"Submit",skip:"Skip and end",consentTitle:"Consent for AI conversation",consentInfo1:"For general information only ā no medical, legal, financial, or safety advice.",consentInfo2:"We use session storage and send your input to provide replies. We donāt keep your conversation or personal info after this session.",consentReadOur:"Read our",consentTermsLabel:"Terms",consentAnd:"and",consentPrivacyLabel:"Privacy Policy",consentMoreDetails:"for more details.",consentInfo4:"(Your consent applies to this session only and clears when you close the tab/window)",consentAccept:"I agree",consentDecline:"Decline",consentAcceptAria:"I agree ā start chat",consentDeclineAria:"Decline",interruptSpeaking:"Interrupt speaking avatar",turnOnMic:"Turn on microphone",turnOffMic:"Turn off microphone",tapToSpeak:"Tap to speak",thinking:"Thinking...",startConversationReminder:"Start a conversation to chat.",chatPlaceholderTitle:"Ready to chat?",chatPlaceholderDescription:"Start a conversation to continue in text mode.",enterInfoOnMobile:"Enter your information in User Information page",waitCurrentResponse:"Please wait for the current response before sending another message.",resumeConversationFailedNewStarted:"We couldn't resume your previous conversation. A new one has been started instead.",end:"End",endConversationPrompt:"Would you like to end the conversation? Ending it will permanently delete the conversation history.",restartConversationPrompt:"Are you sure you want to start a new conversation? Current conversation will be deleted.",newConversation:"New",conversationExpiredPrompt:"This conversation has expired and cannot be resumed. Would you like to download a copy and end or end only?",conversationExpiredResumePrompt:"Your previous conversation has expired and cannot be resumed. Would you like to download a copy of your conversation history?",downloadAndClear:"Download & Clear",downloadAndStartNew:"Download & Start New",startNew:"Start New",ok:"OK",download:"Download",onlyClear:"Only Clear",confirm:"Confirm",alertGenericError:"An error occurred.",alertFailedEndConversation:"Failed to end the conversation. Please try again.",alertFailedClearConversation:"Failed to clear the conversation.",alertCouldNotStartListening:"Could not start listening. Please try again.",alertSomeErrorOccurred:"Some error occurred. Please try again.",alertWaitForAIResponse:"Please wait for the AI response before starting to speak.",alertVoiceServicesUnavailable:"Unable to connect to voice services. Please try again later.",alertServiceTemporarilyUnavailable:"Service is temporarily unavailable. Please try again.",alertTooManyRequests:"Too many simultaneous requests. Please wait a moment and try again.",alertConnectionIssue:"Connection issue detected. Please check your internet connection and try again.",alertResponseTimeout:"Response timeout. Please try again.",alertServiceBusy:"Voice service is currently busy. Please try again in a few minutes.",alertMicrophoneStartFailed:"Failed to start listening. Make sure your microphone is working.",alertMicrophoneCheckSettings:"Failed to start listening. Please check your microphone settings.",alertSpeechRecognitionSetupFailed:"Speech recognition setup failed. Please refresh the page and try again.",alertMicrophoneAccessDenied:"Microphone access denied. Please allow microphone access in your browser settings and refresh the page.",alertNoMicrophoneDetected:"No microphone detected. Please connect a microphone and refresh the page.",alertMicrophoneError:"Microphone error. Please check your microphone.",conversationStartFailed:"Failed to start conversation. Please try again.",insufficientBalanceError:"Insufficient credits to start the conversation. Please add more credits to continue."},fr:{start:"DĆ©marrer la conversation",connect:"Se connecter",endConversation:"Terminer la conversation",restartConversation:"RedĆ©marrer la conversation",hideTyping:"Masquer la saisie",showTyping:"Afficher la saisie",reconnecting:"Reconnexion...",waitForResponse:"Veuillez attendre la rĆ©ponse...",typeHere:"Tapez ici.",noMessagesYet:"Pas encore de messages...",conversationStatus:"Ćtat de la conversation",conversationInProgress:"Conversation en cours",conversationStopped:"Conversation terminĆ©e",startConversation:"Commencer la conversation",downloadConversation:"TĆ©lĆ©charger la conversation",liveCaptions:"Sous-titres en direct",toggleChatbot:"Afficher/Masquer l'avatar",avatar:"Avatar",switchToAvatar:"Retour Ć l'avatar",switchToChat:"Passer au chat",chat:"Chat",statusInitializing:"Patientez, nous rĆ©veillons l'avatar !",statusReconnecting:"ProblĆØme de connexion, tentative de reconnexion...",statusFailed:"Ćchec de la connexion. Une action manuelle peut ĆŖtre nĆ©cessaire.",statusInvalidConfiguration:"L'avatar n'est pas configurĆ© correctement, contactez l'administrateur.",avatarIdleDisconnected:"L'avatar se repose.",reconnectAvatar:"RĆ©veiller l'avatar",close:"Fermer",lastAssistantMessage:"Dernier message",fullBodyView:"Vue du corps entier",upperBodyView:"Vue du haut du corps",secureFormTitle:"Formulaire sĆ©curisĆ©",secureFormDescription:"Saisissez vos informations.",name:"Nom*",namePlaceholder:"Entrez votre nom",phoneNumber:"NumĆ©ro de tĆ©lĆ©phone",phonePlaceholder:"Entrez votre numĆ©ro de tĆ©lĆ©phone",email:"E-mail",emailPlaceholder:"Entrez votre e-mail",secureFormNote:"Vos informations ne seront pas partagĆ©es avec le LLM et ne seront pas conservĆ©es aprĆØs cette session. En envoyant, vous acceptez de partager vos informations pour obtenir un support supplĆ©mentaire.",save:"Enregistrer",send:"Envoyer",cancel:"Annuler",conversationEndedPrompt:"Conversation terminĆ©e. Veuillez Ć©valuer votre satisfaction.",submit:"Envoyer",skip:"Ignorer et terminer",consentTitle:"Consentement pour la conversation IA",consentInfo1:"Ć titre informatif uniquement ā aucun conseil mĆ©dical, juridique, financier ou de sĆ©curitĆ©.",consentInfo2:"Nous utilisons le stockage de session et envoyons votre saisie pour fournir des rĆ©ponses. Nous ne conservons pas votre conversation ni vos informations personnelles aprĆØs cette session.",consentReadOur:"Lisez nos",consentTermsLabel:"Conditions",consentAnd:"et",consentPrivacyLabel:"Politique de confidentialitĆ©",consentMoreDetails:"pour plus de dĆ©tails.",consentInfo4:"(Votre consentement s'applique uniquement Ć cette session et est rĆ©initialisĆ© lorsque vous fermez l'onglet ou la fenĆŖtre)",consentAccept:"J'accepte",consentDecline:"Refuser",consentAcceptAria:"J'accepte ā dĆ©marrer le chat",consentDeclineAria:"Refuser",interruptSpeaking:"Interrompre l'avatar",turnOnMic:"Activer le microphone",turnOffMic:"DĆ©sactiver le microphone",tapToSpeak:"Appuyez pour parler",thinking:"RĆ©flexion...",startConversationReminder:"DĆ©marrez une conversation pour discuter.",chatPlaceholderTitle:"PrĆŖt Ć discuter ?",chatPlaceholderDescription:"Lancez une conversation pour continuer en mode texte.",enterInfoOnMobile:"Saisissez vos informations dans la page Informations utilisateur",waitCurrentResponse:"Veuillez attendre la rĆ©ponse en cours avant d'envoyer un autre message.",resumeConversationFailedNewStarted:"Nous n'avons pas pu reprendre votre conversation prĆ©cĆ©dente. Une nouvelle a Ć©tĆ© dĆ©marrĆ©e Ć la place.",end:"Terminer",endConversationPrompt:"Souhaitez-vous terminer la conversation ? Cela supprimera dĆ©finitivement l'historique de la conversation.",restartConversationPrompt:"Voulez-vous dĆ©marrer une nouvelle conversation ? La conversation actuelle sera supprimĆ©e.",newConversation:"Nouveau",conversationExpiredPrompt:"Cette conversation a expirĆ© et ne peut pas ĆŖtre reprise. Voulez-vous en tĆ©lĆ©charger une copie puis la supprimer, ou simplement la supprimer ?",conversationExpiredResumePrompt:"Votre conversation prĆ©cĆ©dente a expirĆ© et ne peut pas ĆŖtre reprise. Voulez-vous tĆ©lĆ©charger une copie de votre historique de conversation ?",downloadAndClear:"TĆ©lĆ©charger et effacer",downloadAndStartNew:"TĆ©lĆ©charger et dĆ©marrer",startNew:"Nouvelle conv.",onlyClear:"Effacer uniquement",confirm:"Confirmer",ok:"OK",download:"TĆ©lĆ©charger",alertGenericError:"Une erreur s'est produite.",alertFailedEndConversation:"Ćchec de la fin de la conversation. Veuillez rĆ©essayer.",alertFailedClearConversation:"Ćchec de l'effacement de la conversation.",alertCouldNotStartListening:"Impossible de dĆ©marrer l'Ć©coute. Veuillez rĆ©essayer.",alertSomeErrorOccurred:"Une erreur s'est produite. Veuillez rĆ©essayer.",alertWaitForAIResponse:"Veuillez attendre la rĆ©ponse de l'IA avant de commencer Ć parler.",alertVoiceServicesUnavailable:"Impossible de se connecter aux services vocaux. Veuillez rĆ©essayer plus tard.",alertServiceTemporarilyUnavailable:"Service temporairement indisponible. Veuillez rĆ©essayer.",alertTooManyRequests:"Trop de demandes simultanĆ©es. Veuillez patienter un instant et rĆ©essayer.",alertConnectionIssue:"ProblĆØme de connexion dĆ©tectĆ©. Veuillez vĆ©rifier votre connexion internet et rĆ©essayer.",alertResponseTimeout:"DĆ©lai de rĆ©ponse dĆ©passĆ©. Veuillez rĆ©essayer.",alertServiceBusy:"Le service vocal est actuellement occupĆ©. Veuillez rĆ©essayer dans quelques minutes.",alertMicrophoneStartFailed:"Impossible de dĆ©marrer l'Ć©coute. Assurez-vous que votre microphone fonctionne.",alertMicrophoneCheckSettings:"Impossible de dĆ©marrer l'Ć©coute. Veuillez vĆ©rifier les paramĆØtres de votre microphone.",alertSpeechRecognitionSetupFailed:"Ćchec de la configuration de la reconnaissance vocale. Veuillez actualiser la page et rĆ©essayer.",alertMicrophoneAccessDenied:"AccĆØs au microphone refusĆ©. Veuillez autoriser l'accĆØs au microphone dans les paramĆØtres de votre navigateur et actualiser la page.",alertNoMicrophoneDetected:"Aucun microphone dĆ©tectĆ©. Veuillez connecter un microphone et actualiser la page.",alertMicrophoneError:"Erreur de microphone. Veuillez vĆ©rifier votre microphone.",conversationStartFailed:"Ćchec du dĆ©marrage de la conversation. Veuillez rĆ©essayer.",insufficientBalanceError:"CrĆ©dits insuffisants pour dĆ©marrer la conversation. Veuillez ajouter des crĆ©dits pour continuer."},de:{start:"Starten Sie die Konversation",connect:"Verbinden",endConversation:"GesprƤch beenden",restartConversation:"GesprƤch neu starten",hideTyping:"Eingabefeld ausblenden",showTyping:"Eingabefeld anzeigen",reconnecting:"Verbindung wird wiederhergestellt...",waitForResponse:"Bitte auf die Antwort warten...",typeHere:"Hier eingeben.",noMessagesYet:"Noch keine Nachrichten...",conversationStatus:"GesprƤchsstatus",conversationInProgress:"GesprƤch lƤuft",conversationStopped:"GesprƤch beendet",startConversation:"GesprƤch starten",downloadConversation:"GesprƤch herunterladen",liveCaptions:"Live-Untertitel",toggleChatbot:"Avatar-Chatbot ein-/ausblenden",avatar:"Avatar",switchToAvatar:"Zurück zum Avatar",switchToChat:"Zum Chat wechseln",chat:"Chat",statusInitializing:"Einen Moment, der Avatar wird gestartet!",statusReconnecting:"Verbindungsproblem, versuche erneut zu verbinden...",statusFailed:"Verbindung fehlgeschlagen. Mƶglicherweise ist ein manueller Eingriff erforderlich.",statusInvalidConfiguration:"Der Avatar ist nicht korrekt konfiguriert, wenden Sie sich an den Administrator.",avatarIdleDisconnected:"Der Avatar ruht.",reconnectAvatar:"Avatar aufwecken",close:"SchlieĆen",lastAssistantMessage:"Letzte Nachricht",fullBodyView:"Ganzkƶrperansicht",upperBodyView:"Oberkƶrperansicht",secureFormTitle:"Sicheres Formular",secureFormDescription:"Geben Sie Ihre Informationen ein.",name:"Name*",namePlaceholder:"Geben Sie Ihren Namen ein",phoneNumber:"Telefonnummer",phonePlaceholder:"Geben Sie Ihre Telefonnummer ein",email:"E-Mail",emailPlaceholder:"Geben Sie Ihre E-Mail ein",secureFormNote:"Ihre Informationen werden nicht mit dem LLM geteilt und nach dieser Sitzung nicht gespeichert. Mit dem Absenden erklƤren Sie sich einverstanden, Ihre Daten zu teilen, um zusƤtzliche Unterstützung zu erhalten.",save:"Speichern",send:"Senden",cancel:"Abbrechen",conversationEndedPrompt:"GesprƤch beendet. Bitte bewerten Sie Ihre Zufriedenheit.",submit:"Senden",skip:"Ćberspringen und beenden",consentTitle:"Einwilligung für das KI-GesprƤch",consentInfo1:"Nur zu allgemeinen Informationszwecken ā keine medizinischen, rechtlichen, finanziellen oder sicherheitsrelevanten RatschlƤge.",consentInfo2:"Wir verwenden den Sitzungspeicher und senden Ihre Eingaben, um Antworten bereitzustellen. Wir speichern Ihr GesprƤch oder persƶnliche Daten nach dieser Sitzung nicht.",consentReadOur:"Lesen Sie unsere",consentTermsLabel:"Nutzungsbedingungen",consentAnd:"und",consentPrivacyLabel:"DatenschutzerklƤrung",consentMoreDetails:"für weitere Informationen.",consentInfo4:"(Ihre Einwilligung gilt nur für diese Sitzung und wird zurückgesetzt, wenn Sie den Tab oder das Fenster schlieĆen)",consentAccept:"Ich stimme zu",consentDecline:"Ablehnen",consentAcceptAria:"Ich stimme zu ā Chat starten",consentDeclineAria:"Ablehnen",interruptSpeaking:"Sprechenden Avatar unterbrechen",turnOnMic:"Mikrofon einschalten",turnOffMic:"Mikrofon ausschalten",tapToSpeak:"Tippen zum Sprechen",thinking:"Nachdenken...",startConversationReminder:"Starten Sie ein GesprƤch, um zu chatten.",chatPlaceholderTitle:"Bereit zum Chatten?",chatPlaceholderDescription:"Starten Sie ein GesprƤch, um im Textmodus fortzufahren.",enterInfoOnMobile:"Geben Sie Ihre Daten auf der Seite Benutzerinformationen ein",waitCurrentResponse:"Bitte warten Sie die aktuelle Antwort ab, bevor Sie eine weitere Nachricht senden.",resumeConversationFailedNewStarted:"Wir konnten Ihr vorheriges GesprƤch nicht fortsetzen. Stattdessen wurde ein neues gestartet.",end:"Beenden",endConversationPrompt:"Mƶchten Sie das GesprƤch beenden? Dadurch wird der GesprƤchsverlauf dauerhaft gelƶscht.",restartConversationPrompt:"Mƶchten Sie ein neues GesprƤch beginnen? Das aktuelle GesprƤch wird gelƶscht.",newConversation:"Neu",conversationExpiredPrompt:"Dieses GesprƤch ist abgelaufen und kann nicht fortgesetzt werden. Mƶchten Sie eine Kopie herunterladen und lƶschen oder nur lƶschen?",conversationExpiredResumePrompt:"Ihr vorheriges GesprƤch ist abgelaufen und kann nicht fortgesetzt werden. Mƶchten Sie eine Kopie Ihres GesprƤchsverlaufs herunterladen?",downloadAndClear:"Herunterladen & lƶschen",downloadAndStartNew:"Herunterladen & Neu starten",startNew:"Neu starten",onlyClear:"Nur lƶschen",confirm:"BestƤtigen",ok:"OK",download:"Herunterladen",alertGenericError:"Ein Fehler ist aufgetreten.",alertFailedEndConversation:"Das GesprƤch konnte nicht beendet werden. Bitte versuchen Sie es erneut.",alertFailedClearConversation:"Das GesprƤch konnte nicht gelƶscht werden.",alertCouldNotStartListening:"Zuhƶren konnte nicht gestartet werden. Bitte versuchen Sie es erneut.",alertSomeErrorOccurred:"Ein Fehler ist aufgetreten. Bitte versuchen Sie es erneut.",alertWaitForAIResponse:"Bitte warten Sie auf die KI-Antwort, bevor Sie zu sprechen beginnen.",alertVoiceServicesUnavailable:"Verbindung zu Sprachdiensten nicht mƶglich. Bitte versuchen Sie es spƤter erneut.",alertServiceTemporarilyUnavailable:"Der Dienst ist vorübergehend nicht verfügbar. Bitte versuchen Sie es erneut.",alertTooManyRequests:"Zu viele gleichzeitige Anfragen. Bitte warten Sie einen Moment und versuchen Sie es erneut.",alertConnectionIssue:"Verbindungsproblem erkannt. Bitte überprüfen Sie Ihre Internetverbindung und versuchen Sie es erneut.",alertResponseTimeout:"Zeitüberschreitung bei der Antwort. Bitte versuchen Sie es erneut.",alertServiceBusy:"Der Sprachdienst ist derzeit ausgelastet. Bitte versuchen Sie es in einigen Minuten erneut.",alertMicrophoneStartFailed:"Zuhƶren konnte nicht gestartet werden. Stellen Sie sicher, dass Ihr Mikrofon funktioniert.",alertMicrophoneCheckSettings:"Zuhƶren konnte nicht gestartet werden. Bitte überprüfen Sie Ihre Mikrofoneinstellungen.",alertSpeechRecognitionSetupFailed:"Einrichtung der Spracherkennung fehlgeschlagen. Bitte aktualisieren Sie die Seite und versuchen Sie es erneut.",alertMicrophoneAccessDenied:"Mikrofonzugriff verweigert. Bitte erlauben Sie den Mikrofonzugriff in Ihren Browsereinstellungen und aktualisieren Sie die Seite.",alertNoMicrophoneDetected:"Kein Mikrofon erkannt. Bitte schlieĆen Sie ein Mikrofon an und aktualisieren Sie die Seite.",alertMicrophoneError:"Mikrofonfehler. Bitte überprüfen Sie Ihr Mikrofon.",conversationStartFailed:"Konversation konnte nicht gestartet werden. Bitte versuchen Sie es erneut.",insufficientBalanceError:"Nicht genügend Guthaben, um die Konversation zu starten. Bitte fügen Sie mehr Guthaben hinzu."},es:{start:"Iniciar conversación",connect:"Conectar",endConversation:"Terminar conversación",restartConversation:"Reiniciar conversación",hideTyping:"Ocultar entrada de texto",showTyping:"Mostrar entrada de texto",reconnecting:"Reconectando...",waitForResponse:"Espere la respuesta...",typeHere:"Escriba aquĆ.",noMessagesYet:"TodavĆa no hay mensajes...",conversationStatus:"Estado de la conversación",conversationInProgress:"Conversación en curso",conversationStopped:"Conversación detenida",startConversation:"Iniciar conversación",downloadConversation:"Descargar conversación",liveCaptions:"SubtĆtulos en vivo",toggleChatbot:"Mostrar/ocultar avatar",avatar:"Avatar",switchToAvatar:"Volver al avatar",switchToChat:"Cambiar al chat",chat:"Chat",statusInitializing:"Espere, estamos iniciando el avatar",statusReconnecting:"Problema de conexión, intentando reconectar...",statusFailed:"La conexión falló. Puede ser necesaria una acción manual.",statusInvalidConfiguration:"El avatar no estĆ” configurado correctamente, contacte al administrador.",avatarIdleDisconnected:"El avatar estĆ” descansando.",reconnectAvatar:"Despertar el avatar",close:"Cerrar",lastAssistantMessage:"Ćltimo mensaje",fullBodyView:"Vista de cuerpo completo",upperBodyView:"Vista de torso",secureFormTitle:"Formulario seguro",secureFormDescription:"Ingrese su información.",name:"Nombre*",namePlaceholder:"Ingrese su nombre",phoneNumber:"NĆŗmero de telĆ©fono",phonePlaceholder:"Ingrese su nĆŗmero de telĆ©fono",email:"Correo electrónico",emailPlaceholder:"Ingrese su correo electrónico",secureFormNote:"Su información no se compartirĆ” con el LLM ni se almacenarĆ” despuĆ©s de esta sesión. Al enviar, acepta compartir su información para obtener soporte adicional.",save:"Guardar",send:"Enviar",cancel:"Cancelar",conversationEndedPrompt:"Conversación finalizada. Califique su satisfacción.",submit:"Enviar",skip:"Omitir y terminar",consentTitle:"Consentimiento para conversación con IA",consentInfo1:"Solo con fines informativos ā sin consejos mĆ©dicos, legales, financieros ni de seguridad.",consentInfo2:"Usamos almacenamiento de sesión y enviamos su entrada para responder. No guardamos su conversación ni datos personales tras esta sesión.",consentReadOur:"Lea nuestros",consentTermsLabel:"TĆ©rminos",consentAnd:"y",consentPrivacyLabel:"PolĆtica de privacidad",consentMoreDetails:"para mĆ”s detalles.",consentInfo4:"(Su consentimiento se aplica solo a esta sesión y se borra al cerrar la pestaƱa o ventana)",consentAccept:"Acepto",consentDecline:"Rechazar",consentAcceptAria:"Acepto ā iniciar chat",consentDeclineAria:"Rechazar",interruptSpeaking:"Interrumpir avatar que habla",turnOnMic:"Activar micrófono",turnOffMic:"Desactivar micrófono",tapToSpeak:"Toca para hablar",thinking:"Pensando...",startConversationReminder:"Inicie una conversación para chatear.",chatPlaceholderTitle:"ĀæListo para chatear?",chatPlaceholderDescription:"Inicia una conversación para continuar en modo texto.",enterInfoOnMobile:"Ingrese su información en la pĆ”gina de usuario",waitCurrentResponse:"Espere la respuesta actual antes de enviar otro mensaje.",resumeConversationFailedNewStarted:"No pudimos reanudar su conversación anterior. En su lugar, se ha iniciado una nueva.",end:"Terminar",endConversationPrompt:"ĀæDesea terminar la conversación? Esto eliminarĆ” el historial permanentemente.",restartConversationPrompt:"ĀæSeguro que quiere iniciar una nueva conversación? La conversación actual se eliminarĆ”.",newConversation:"Nueva",conversationExpiredPrompt:"Esta conversación ha expirado y no se puede reanudar. ĀæDesea descargar una copia y borrar o solo borrar?",conversationExpiredResumePrompt:"Su conversación anterior ha expirado y no se puede reanudar. ĀæDesea descargar una copia de su historial de conversación?",downloadAndClear:"Descargar y borrar",downloadAndStartNew:"Descargar e iniciar",startNew:"Iniciar nueva",onlyClear:"Solo borrar",confirm:"Confirmar",ok:"OK",download:"Descargar",alertGenericError:"Se produjo un error.",alertFailedEndConversation:"No se pudo terminar la conversación. Por favor, intĆ©ntelo de nuevo.",alertFailedClearConversation:"No se pudo borrar la conversación.",alertCouldNotStartListening:"No se pudo iniciar la escucha. Por favor, intĆ©ntelo de nuevo.",alertSomeErrorOccurred:"Se produjo un error. Por favor, intĆ©ntelo de nuevo.",alertWaitForAIResponse:"Por favor, espere la respuesta de la IA antes de comenzar a hablar.",alertVoiceServicesUnavailable:"No se puede conectar a los servicios de voz. Por favor, intĆ©ntelo mĆ”s tarde.",alertServiceTemporarilyUnavailable:"El servicio no estĆ” disponible temporalmente. Por favor, intĆ©ntelo de nuevo.",alertTooManyRequests:"Demasiadas solicitudes simultĆ”neas. Por favor, espere un momento e intĆ©ntelo de nuevo.",alertConnectionIssue:"Problema de conexión detectado. Por favor, verifique su conexión a internet e intĆ©ntelo de nuevo.",alertResponseTimeout:"Tiempo de respuesta agotado. Por favor, intĆ©ntelo de nuevo.",alertServiceBusy:"El servicio de voz estĆ” ocupado actualmente. Por favor, intĆ©ntelo en unos minutos.",alertMicrophoneStartFailed:"No se pudo iniciar la escucha. AsegĆŗrese de que su micrófono funcione.",alertMicrophoneCheckSettings:"No se pudo iniciar la escucha. Por favor, verifique la configuración de su micrófono.",alertSpeechRecognitionSetupFailed:"Error en la configuración del reconocimiento de voz. Por favor, actualice la pĆ”gina e intĆ©ntelo de nuevo.",alertMicrophoneAccessDenied:"Acceso al micrófono denegado. Por favor, permita el acceso al micrófono en la configuración de su navegador y actualice la pĆ”gina.",alertNoMicrophoneDetected:"No se detectó ningĆŗn micrófono. Por favor, conecte un micrófono y actualice la pĆ”gina.",alertMicrophoneError:"Error de micrófono. Por favor, verifique su micrófono.",conversationStartFailed:"No se pudo iniciar la conversación. Por favor, intĆ©ntelo de nuevo.",insufficientBalanceError:"CrĆ©ditos insuficientes para iniciar la conversación. Por favor, agregue mĆ”s crĆ©ditos para continuar."},ar:{start:"Ų§ŲØŲÆŲ£ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",connect:"Ų§ŲŖŲµŁ",endConversation:"Ų„ŁŁŲ§Ų” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",restartConversation:"Ų„Ų¹Ų§ŲÆŲ© ŲØŲÆŲ” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",hideTyping:"Ų„Ų®ŁŲ§Ų” ŲŁŁ Ų§ŁŁŲŖŲ§ŲØŲ©",showTyping:"Ų„ŲøŁŲ§Ų± ŲŁŁ Ų§ŁŁŲŖŲ§ŲØŲ©",reconnecting:"جار٠؄عادة Ų§ŁŲ§ŲŖŲµŲ§Ł...",waitForResponse:"ŁŲ±Ų¬Ł Ų§ŁŲŖŲøŲ§Ų± Ų§ŁŲ±ŲÆ...",typeHere:"Ų§ŁŲŖŲØ ŁŁŲ§.",noMessagesYet:"ŁŲ§ ŲŖŁŲ¬ŲÆ Ų±Ų³Ų§Ų¦Ł ŲØŲ¹ŲÆ...",conversationStatus:"ŲŲ§ŁŲ© Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",conversationInProgress:"Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų© Ų¬Ų§Ų±ŁŲ©",conversationStopped:"Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų© Ł
ŲŖŁŁŁŲ©",startConversation:"Ų§ŲØŲÆŲ£ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",downloadConversation:"ŲŖŁŲ²ŁŁ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",liveCaptions:"ŲŖŲ¹ŁŁŁŲ§ŲŖ ŁŲµŁŲ© Ł
ŲØŲ§Ų“Ų±Ų©",toggleChatbot:"Ų„ŲøŁŲ§Ų±/Ų„Ų®ŁŲ§Ų” Ų±ŁŲØŁŲŖ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",avatar:"Ų£ŁŲ§ŲŖŲ§Ų±",switchToAvatar:"Ų§ŁŲ¹ŁŲÆŲ© Ų„ŁŁ Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų±",switchToChat:"Ų§ŁŲŖŲØŲÆŁŁ Ų„ŁŁ Ų§ŁŲÆŲ±ŲÆŲ“Ų©",chat:"ŲÆŲ±ŲÆŲ“Ų©",statusInitializing:"ŁŲ±Ų¬Ł Ų§ŁŲ§ŁŲŖŲøŲ§Ų±Ų ŁŁŁŁ
ŲØŲŖŲ“ŲŗŁŁ Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų±!",statusReconnecting:"Ł
Ų“ŁŁŲ© ŁŁ Ų§ŁŲ§ŲŖŲµŲ§ŁŲ Ų¬Ų§Ų±Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų¬ŲÆŲÆŁŲ§...",statusFailed:"ŁŲ“Ł Ų§ŁŲ§ŲŖŲµŲ§Ł. ŁŲÆ ŁŲŖŲ·ŁŲØ Ų§ŁŲ£Ł
Ų± ŲŖŲÆŲ®ŁŲ§Ł ŁŲÆŁŁŁŲ§.",statusInvalidConfiguration:"Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų± ŲŗŁŲ± Ł
ŁŁŲ£ ŲØŲ“ŁŁ ŲµŲŁŲŲ ŁŲ±Ų¬Ł Ų§ŁŲŖŁŲ§ŲµŁ Ł
Ų¹ Ų§ŁŁ
Ų³Ų¤ŁŁ.",avatarIdleDisconnected:"Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų± ŁŲ³ŲŖŲ±ŁŲ.",reconnectAvatar:"Ų„ŁŁŲ§Ųø Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų±",close:"Ų„ŲŗŁŲ§Ł",lastAssistantMessage:"Ų¢Ų®Ų± Ų±Ų³Ų§ŁŲ©",fullBodyView:"Ų¹Ų±Ų¶ ŁŲ§Ł
Ł ŁŁŲ¬Ų³Ł
",upperBodyView:"Ų¹Ų±Ų¶ ŁŁŲ¬Ų²Ų” Ų§ŁŲ¹ŁŁŁ",secureFormTitle:"ŁŁ
ŁŲ°Ų¬ Ų¢Ł
Ł",secureFormDescription:"أدخ٠Ł
Ų¹ŁŁŁ
Ų§ŲŖŁ.",name:"Ų§ŁŲ§Ų³Ł
*",namePlaceholder:"أدخ٠اسŁ
Ł",phoneNumber:"Ų±ŁŁ
Ų§ŁŁŲ§ŲŖŁ",phonePlaceholder:"Ų£ŲÆŲ®Ł Ų±ŁŁ
ŁŲ§ŲŖŁŁ",email:"Ų§ŁŲØŲ±ŁŲÆ Ų§ŁŲ„ŁŁŲŖŲ±ŁŁŁ",emailPlaceholder:"أدخ٠برŁŲÆŁ Ų§ŁŲ„ŁŁŲŖŲ±ŁŁŁ",secureFormNote:"ŁŁ ŲŖŲŖŁ
Ł
Ų“Ų§Ų±ŁŲ© Ł
Ų¹ŁŁŁ
Ų§ŲŖŁ Ł
Ų¹ ŁŁ
ŁŲ°Ų¬ Ų§ŁŁŲŗŲ© ŁŁŁ ŁŲŖŁ
ŲŖŲ®Ų²ŁŁŁŲ§ ŲØŲ¹ŲÆ ŁŲ°Ł Ų§ŁŲ¬ŁŲ³Ų©. ŲØŲ§ŁŲ„Ų±Ų³Ų§Ł ŁŲ„ŁŁ ŲŖŁŲ§ŁŁ Ų¹ŁŁ Ł
Ų“Ų§Ų±ŁŲ© Ł
Ų¹ŁŁŁ
Ų§ŲŖŁ ŁŁŲŲµŁŁ Ų¹ŁŁ ŲÆŲ¹Ł
Ų„Ų¶Ų§ŁŁ.",save:"ŲŁŲø",send:"Ų„Ų±Ų³Ų§Ł",cancel:"Ų„ŁŲŗŲ§Ų”",conversationEndedPrompt:"Ų§ŁŲŖŁŲŖ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©. ŁŲ±Ų¬Ł ŲŖŁŁŁŁ
Ł
ŲÆŁ Ų±Ų¶Ų§Ł.",submit:"Ų„Ų±Ų³Ų§Ł",skip:"ŲŖŲ®Ų·Ł ŁŲ„ŁŁŲ§Ų”",consentTitle:"Ł
ŁŲ§ŁŁŲ© Ų¹ŁŁ Ł
ŲŲ§ŲÆŲ«Ų© Ų§ŁŲ°ŁŲ§Ų” Ų§ŁŲ§ŲµŲ·ŁŲ§Ų¹Ł",consentInfo1:"ŁŁŁ
Ų¹ŁŁŁ
Ų§ŲŖ Ų§ŁŲ¹Ų§Ł
Ų© ŁŁŲ· ā ŲØŲÆŁŁ ŁŲµŲ§Ų¦Ų Ų·ŲØŁŲ© أ٠ŁŲ§ŁŁŁŁŲ© أ٠Ł
Ų§ŁŁŲ© أ٠أŁ
ŁŁŲ©.",consentInfo2:"ŁŲ³ŲŖŲ®ŲÆŁ
ŲŖŲ®Ų²ŁŁ Ų§ŁŲ¬ŁŲ³Ų© ŁŁŲ±Ų³Ł Ł
ŲÆŲ®ŁŲ§ŲŖŁ ŁŲŖŁŲÆŁŁ
Ų§ŁŲ±ŲÆŁŲÆ. ŁŲ§ ŁŲŲŖŁŲø ŲØŁ
Ųادثت٠أ٠بŁŲ§ŁŲ§ŲŖŁ Ų§ŁŲ“Ų®ŲµŁŲ© ŲØŲ¹ŲÆ ŁŲ°Ł Ų§ŁŲ¬ŁŲ³Ų©.",consentReadOur:"Ų§ŁŲ±Ų£",consentTermsLabel:"Ų§ŁŲ“Ų±ŁŲ·",consentAnd:"Ł",consentPrivacyLabel:"Ų³ŁŲ§Ų³Ų© Ų§ŁŲ®ŲµŁŲµŁŲ©",consentMoreDetails:"ŁŁŁ
Ų²ŁŲÆ Ł
Ł Ų§ŁŲŖŁŲ§ŲµŁŁ.",consentInfo4:"(ŲŖŁŲ·ŲØŁ Ł
ŁŲ§ŁŁŲŖŁ Ų¹ŁŁ Ų¬ŁŲ³Ų© Ų§ŁŲŖŲµŁŲ Ų§ŁŲŲ§ŁŁŲ© ŁŁŲ· ŁŁŲŖŁ
Ł
Ų³ŲŁŲ§ Ų¹ŁŲÆ Ų„ŲŗŁŲ§Ł Ų§ŁŲµŁŲŲ© Ų£Ł Ų§ŁŁŲ§ŁŲ°Ų©)",consentAccept:"Ų£ŁŲ§ŁŁ",consentDecline:"Ų±ŁŲ¶",consentAcceptAria:"Ų£ŁŲ§ŁŁ - Ų§ŲØŲÆŲ£ Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©",consentDeclineAria:"Ų±ŁŲ¶",interruptSpeaking:"Ų„ŁŁŲ§Ł Ų§ŁŲ£ŁŲ§ŲŖŲ§Ų± Ų§ŁŁ
ŲŖŁŁŁ
",turnOnMic:"ŲŖŲ“ŲŗŁŁ Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ",turnOffMic:"Ų„ŁŁŲ§Ł Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ",tapToSpeak:"Ų§ŁŁŲ± ŁŁŲŖŲŲÆŲ«",thinking:"جار٠اŁŲŖŁŁŁŲ±...",startConversationReminder:"Ų§ŲØŲÆŲ£ Ł
ŲŲ§ŲÆŲ«Ų© ŁŁŲŖŲŲÆŲ«.",chatPlaceholderTitle:"Ł
Ų³ŲŖŲ¹ŲÆ ŁŁŲÆŲ±ŲÆŲ“Ų©Ų",chatPlaceholderDescription:"Ų§ŲØŲÆŲ£ Ł
ŲŲ§ŲÆŲ«Ų© ŁŁŁ
ŲŖŲ§ŲØŲ¹Ų© ŁŁ ŁŲ¶Ų¹ Ų§ŁŁŲµ.",enterInfoOnMobile:"أدخ٠Ł
Ų¹ŁŁŁ
Ų§ŲŖŁ ŁŁ ŲµŁŲŲ© Ł
Ų¹ŁŁŁ
Ų§ŲŖ Ų§ŁŁ
Ų³ŲŖŲ®ŲÆŁ
",waitCurrentResponse:"ŁŲ±Ų¬Ł Ų§ŁŲŖŲøŲ§Ų± Ų§ŁŲ±ŲÆ Ų§ŁŲŲ§ŁŁ ŁŲØŁ Ų„Ų±Ų³Ų§Ł Ų±Ų³Ų§ŁŲ© Ų£Ų®Ų±Ł.",resumeConversationFailedNewStarted:"ŁŁ
ŁŲŖŁ
ŁŁ Ł
Ł Ų§Ų³ŲŖŲ¦ŁŲ§Ł Ł
ŲŲ§ŲÆŲ«ŲŖŁ Ų§ŁŲ³Ų§ŲØŁŲ©. ŲŖŁ
ŲØŲÆŲ” Ł
ŲŲ§ŲÆŲ«Ų© Ų¬ŲÆŁŲÆŲ© ŲØŲÆŁŲ§Ł Ł
Ł Ų°ŁŁ. ",end:"Ų„ŁŁŲ§Ų”",endConversationPrompt:"ŁŁ ŲŖŲ±ŲŗŲØ ŁŁ Ų„ŁŁŲ§Ų” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©Ų Ų³ŁŲ¤ŲÆŁ Ų°ŁŁ Ų„ŁŁ ŲŲ°Ł Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų© ŁŁŲ§Ų¦ŁŁŲ§.",restartConversationPrompt:"ŁŁ Ų£ŁŲŖ Ł
ŲŖŲ£ŁŲÆ Ł
Ł ŲØŲÆŲ” Ł
ŲŲ§ŲÆŲ«Ų© Ų¬ŲÆŁŲÆŲ©Ų Ų³ŁŲŖŁ
ŲŲ°Ł Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų© Ų§ŁŲŲ§ŁŁŲ©.",newConversation:"Ų¬ŲÆŁŲÆŲ©",conversationExpiredPrompt:"Ų§ŁŲŖŁŲŖ ŲµŁŲ§ŲŁŲ© ŁŲ°Ł Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų© ŁŁŲ§ ŁŁ
ŁŁ Ų§Ų³ŲŖŲ¦ŁŲ§ŁŁŲ§. ŁŁ ŲŖŲ±ŁŲÆ ŲŖŁŲ²ŁŁ ŁŲ³Ų®Ų© Ų«Ł
ŲŲ°ŁŁŲ§ أ٠اŁŲŲ°Ł ŁŁŲ·Ų",conversationExpiredResumePrompt:"Ų§ŁŲŖŁŲŖ ŲµŁŲ§ŲŁŲ© Ł
ŲŲ§ŲÆŲ«ŲŖŁ Ų§ŁŲ³Ų§ŲØŁŲ© ŁŁŲ§ ŁŁ
ŁŁ Ų§Ų³ŲŖŲ¦ŁŲ§ŁŁŲ§. ŁŁ ŲŖŲ±ŲŗŲØ ŁŁ ŲŖŁŲ²ŁŁ ŁŲ³Ų®Ų© Ł
Ł Ų³Ų¬Ł Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©Ų",downloadAndClear:"ŲŖŁŲ²ŁŁ ŁŲŲ°Ł",downloadAndStartNew:"ŲŖŁŲ²ŁŁ ŁŲØŲÆŲ” Ų¬ŲÆŁŲÆŲ©",startNew:"ŲØŲÆŲ” Ų¬ŲÆŁŲÆŲ©",onlyClear:"ŲŲ°Ł ŁŁŲ·",confirm:"ŲŖŲ£ŁŁŲÆ",ok:"Ł
ŁŲ§ŁŁ",download:"ŲŖŁŲ²ŁŁ",alertGenericError:"ŲŲÆŲ« Ų®Ų·Ų£.",alertFailedEndConversation:"ŁŲ“Ł ŁŁ Ų„ŁŁŲ§Ų” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertFailedClearConversation:"ŁŲ“Ł ŁŁ Ł
Ų³Ų Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©.",alertCouldNotStartListening:"ŲŖŲ¹Ų°Ų± ŲØŲÆŲ” Ų§ŁŲ§Ų³ŲŖŁ
Ų§Ų¹. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertSomeErrorOccurred:"ŲŲÆŲ« Ų®Ų·Ų£ Ł
Ų§. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertWaitForAIResponse:"ŁŲ±Ų¬Ł Ų§ŁŲŖŲøŲ§Ų± Ų±ŲÆ Ų§ŁŲ°ŁŲ§Ų” Ų§ŁŲ§ŲµŲ·ŁŲ§Ų¹Ł ŁŲØŁ Ų§ŁŲØŲÆŲ” ŁŁ Ų§ŁŲŖŲŲÆŲ«.",alertVoiceServicesUnavailable:"ŲŖŲ¹Ų°Ų± Ų§ŁŲ§ŲŖŲµŲ§Ł ŲØŲ®ŲÆŁ
Ų§ŲŖ Ų§ŁŲµŁŲŖ. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© ŁŲ§ŲŁŲ§Ł.",alertServiceTemporarilyUnavailable:"Ų§ŁŲ®ŲÆŁ
Ų© ŲŗŁŲ± Ł
ŲŖŲ§ŲŲ© Ł
Ų¤ŁŲŖŲ§Ł. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertTooManyRequests:"Ų·ŁŲØŲ§ŲŖ Ł
ŲŖŲ²Ų§Ł
ŁŲ© ŁŲ«ŁŲ±Ų© Ų¬ŲÆŲ§Ł. ŁŲ±Ų¬Ł Ų§ŁŲ§ŁŲŖŲøŲ§Ų± ŁŲŲøŲ© ŁŲ§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertConnectionIssue:"ŲŖŁ
Ų§ŁŲŖŲ“Ų§Ł Ł
Ų“ŁŁŲ© ŁŁ Ų§ŁŲ§ŲŖŲµŲ§Ł. ŁŲ±Ų¬Ł Ų§ŁŲŖŲŁŁ Ł
Ł Ų§ŲŖŲµŲ§ŁŁ ŲØŲ§ŁŲ„ŁŲŖŲ±ŁŲŖ ŁŲ§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertResponseTimeout:"Ų§ŁŲŖŁŲŖ Ł
ŁŁŲ© Ų§ŁŲ§Ų³ŲŖŲ¬Ų§ŲØŲ©. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertServiceBusy:"Ų®ŲÆŁ
Ų© Ų§ŁŲµŁŲŖ Ł
Ų“ŲŗŁŁŲ© ŲŲ§ŁŁŲ§Ł. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© ŲØŲ¹ŲÆ ŲØŲ¶Ų¹ ŲÆŁŲ§Ų¦Ł.",alertMicrophoneStartFailed:"ŲŖŲ¹Ų°Ų± ŲØŲÆŲ” Ų§ŁŲ§Ų³ŲŖŁ
Ų§Ų¹. ŲŖŲ£ŁŲÆ Ł
Ł Ų£Ł Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ ŁŲ¹Ł
Ł.",alertMicrophoneCheckSettings:"ŲŖŲ¹Ų°Ų± ŲØŲÆŲ” Ų§ŁŲ§Ų³ŲŖŁ
Ų§Ų¹. ŁŲ±Ų¬Ł Ų§ŁŲŖŲŁŁ Ł
Ł Ų„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ.",alertSpeechRecognitionSetupFailed:"ŁŲ“Ł Ų„Ų¹ŲÆŲ§ŲÆ Ų§ŁŲŖŲ¹Ų±Ł Ų¹ŁŁ Ų§ŁŁŁŲ§Ł
. ŁŲ±Ų¬Ł ŲŖŲŲÆŁŲ« Ų§ŁŲµŁŲŲ© ŁŲ§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",alertMicrophoneAccessDenied:"ŲŖŁ
Ų±ŁŲ¶ Ų§ŁŁŲµŁŁ Ų„ŁŁ Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ. ŁŲ±Ų¬Ł Ų§ŁŲ³Ł
Ų§Ų ŲØŲ§ŁŁŲµŁŁ Ų„ŁŁ Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ ŁŁ Ų„Ų¹ŲÆŲ§ŲÆŲ§ŲŖ Ų§ŁŁ
ŲŖŲµŁŲ ŁŲŖŲŲÆŁŲ« Ų§ŁŲµŁŲŲ©.",alertNoMicrophoneDetected:"ŁŁ
ŁŲŖŁ
Ų§ŁŲŖŲ“Ų§Ł Ł
ŁŁŲ±ŁŁŁŁ. ŁŲ±Ų¬Ł ŲŖŁŲµŁŁ Ł
ŁŁŲ±ŁŁŁŁ ŁŲŖŲŲÆŁŲ« Ų§ŁŲµŁŲŲ©.",alertMicrophoneError:"Ų®Ų·Ų£ ŁŁ Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ. ŁŲ±Ų¬Ł Ų§ŁŲŖŲŁŁ Ł
Ł Ų§ŁŁ
ŁŁŲ±ŁŁŁŁ.",conversationStartFailed:"ŁŲ“Ł ŲØŲÆŲ” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©. ŁŲ±Ų¬Ł Ų§ŁŁ
ŲŲ§ŁŁŲ© Ł
Ų±Ų© Ų£Ų®Ų±Ł.",insufficientBalanceError:"Ų±ŲµŁŲÆ ŲŗŁŲ± ŁŲ§ŁŁ ŁŲØŲÆŲ” Ų§ŁŁ
ŲŲ§ŲÆŲ«Ų©. ŁŲ±Ų¬Ł Ų„Ų¶Ų§ŁŲ© Ų§ŁŁ
Ų²ŁŲÆ Ł
Ł Ų§ŁŲ±ŲµŁŲÆ ŁŁŁ
ŲŖŲ§ŲØŲ¹Ų©."},zh:{start:"å¼å§åƹčÆ",connect:"čæę„",endConversation:"ē»ę对čÆ",restartConversation:"éę°å¼å§åƹčÆ",hideTyping:"éčč¾å
„ę”",showTyping:"ę¾ē¤ŗč¾å
„ę”",reconnecting:"ę£åØéę°čæę„...",waitForResponse:"请ēå¾
åå¤...",typeHere:"åØę¤č¾å
„ć",noMessagesYet:"ęę ę¶ęÆ...",conversationStatus:"对čÆē¶ę",conversationInProgress:"对čÆčæč”äø",conversationStopped:"对čÆå·²åę¢",startConversation:"å¼å§åƹčÆ",downloadConversation:"äøč½½åƹčÆ",liveCaptions:"å®ę¶åå¹",toggleChatbot:"ę¾ē¤ŗ/éččę形豔å©ę",avatar:"čę形豔",switchToAvatar:"čæåčę形豔",switchToChat:"åę¢å°č天",chat:"č天",statusInitializing:"请ēØåļ¼ę们ę£åØå¤éčę形豔ļ¼",statusReconnecting:"čæę„åŗē°é®é¢ļ¼ę£åØå°čÆéę°čæę„...",statusFailed:"čæę„失蓄ćåÆč½éč¦ęåØå¤ēć",statusInvalidConfiguration:"čę形豔é
ē½®äøę£ē”®ļ¼čÆ·č系箔ēåć",avatarIdleDisconnected:"čę形豔ę£åØä¼ęÆć",reconnectAvatar:"å¤éčę形豔",close:"å
³é",lastAssistantMessage:"å©ęēäøäøę”ę¶ęÆ",fullBodyView:"å
Øčŗ«č§å¾",upperBodyView:"åčŗ«č§å¾",secureFormTitle:"å®å
Øč”Øå",secureFormDescription:"请č¾å
„ęØēäæ”ęÆć",name:"å§å*",namePlaceholder:"请č¾å
„å§å",phoneNumber:"ēµčÆå·ē ",phonePlaceholder:"请č¾å
„ēµčÆå·ē ",email:"ēµåé®ä»¶",emailPlaceholder:"请č¾å
„ēµåé®ä»¶",secureFormNote:"ęØēäæ”ęÆäøä¼äøå¤§čÆčØęØ”åå
±äŗ«ļ¼ä¼čÆē»ęåä¹äøä¼č¢«ååØćåéå³č”Øē¤ŗęØåęå
±äŗ«ęØēäæ”ęÆä»„č·å¾é¢å¤ęÆęć",save:"äæå",send:"åé",cancel:"åę¶",conversationEndedPrompt:"对čÆå·²ē»ęć请čÆä»·ęØēę»”ęåŗ¦ć",submit:"ęäŗ¤",skip:"č·³čæå¹¶ē»ę",consentTitle:"åęčæč”äŗŗå·„ęŗč½åƹčÆ",consentInfo1:"ä»
ä¾äøč¬äæ”ęÆåčāāäøęä¾å»ēćę³å¾ćč“¢å”ęå®å
Øå»ŗč®®ć",consentInfo2:"ę们使ēØä¼čÆååØå¹¶åéęØēč¾å
„仄ęä¾åå¤ćę¬ę¬”ä¼čÆē»ęåę们äøä¼äæēęØē对čÆęäøŖäŗŗäæ”ęÆć",consentReadOur:"é
读ę们ē",consentTermsLabel:"ę”款",consentAnd:"å",consentPrivacyLabel:"éē§ęæē",consentMoreDetails:"äŗč§£ę“å¤čƦę
ć",consentInfo4:"ļ¼ęØēåęä»
éēØäŗę¬ę¬”ä¼čÆļ¼å
³éę ē¾é”µęēŖå£åå°č¢«ęø
é¤ļ¼",consentAccept:"åę",consentDecline:"ęē»",consentAcceptAria:"åęāāå¼å§č天",consentDeclineAria:"ęē»",interruptSpeaking:"ęęčę形豔讲čÆ",turnOnMic:"å¼åÆéŗ¦å
é£",turnOffMic:"å
³ééŗ¦å
é£",tapToSpeak:"ē¹å»čÆ“čÆ",thinking:"ęčäø...",startConversationReminder:"å¼å§åƹčÆä»„便č天ć",chatPlaceholderTitle:"åå¤å„½č天äŗåļ¼",chatPlaceholderDescription:"å¼å§åƹčÆä»„ē»§ē»ä½æēØęå樔å¼ć",enterInfoOnMobile:"请åØēØę·äæ”ęÆé”µé¢č¾å
„ęØēäæ”ęÆ",waitCurrentResponse:"请ēå¾
å½ååå¤åååéę°ę¶ęÆć",resumeConversationFailedNewStarted:"ę们ę ę³ę¢å¤ęØä¹åē对čÆćå·²åÆåØäøäøŖę°ē对čÆć",end:"ē»ę",endConversationPrompt:"ęÆå¦ē»ę对čÆļ¼ē»ęåå°ę°øä¹
å é¤åå²č®°å½ć",restartConversationPrompt:"ē”®å®č¦å¼å§ę°ē对čÆåļ¼å½å对čÆå°č¢«å é¤ć",newConversation:"ę°",conversationExpiredPrompt:"ę¤åƹčÆå·²čæęäøę ę³ę¢å¤ćęØč¦äøč½½åÆę¬å¹¶ęø
é¤ļ¼čæęÆä»
ęø
é¤ļ¼",conversationExpiredResumePrompt:"ęØä¹åē对čÆå·²čæęäøę ę³ę¢å¤ćęØęÆå¦č¦äøč½½åƹčÆč®°å½ēåÆę¬ļ¼",downloadAndClear:"äøč½½å¹¶ęø
é¤",downloadAndStartNew:"äøč½½å¹¶å¼å§ę°åƹčÆ",startNew:"å¼å§ę°åƹčÆ",onlyClear:"ä»
ęø
é¤",confirm:"甮认",ok:"ē”®å®",download:"äøč½½",alertGenericError:"åēé误ć",alertFailedEndConversation:"ę ę³ē»ę对čÆć请éčÆć",alertFailedClearConversation:"ę ę³ęø
é¤åƹčÆć",alertCouldNotStartListening:"ę ę³å¼å§čå¬ć请éčÆć",alertSomeErrorOccurred:"åēäŗé误ć请éčÆć",alertWaitForAIResponse:"请ēå¾
AIåå¤ååå¼å§čÆ“čÆć",alertVoiceServicesUnavailable:"ę ę³čæę„å°čÆé³ęå”ć请ēØåéčÆć",alertServiceTemporarilyUnavailable:"ęå”ęę¶äøåÆēØć请éčÆć",alertTooManyRequests:"åę¶čÆ·ę±čæå¤ć请ēØēēå»åéčÆć",alertConnectionIssue:"ę£ęµå°čæę„é®é¢ć请ę£ę„ęØēē½ē»čæę„åéčÆć",alertResponseTimeout:"ååŗč¶
ę¶ć请éčÆć",alertServiceBusy:"čÆé³ęå”å½åē¹åæć请å åéåéčÆć",alertMicrophoneStartFailed:"ę ę³å¼å§čå¬ć请甮äæęØēéŗ¦å
é£ę£åøøå·„ä½ć",alertMicrophoneCheckSettings:"ę ę³å¼å§čå¬ć请ę£ę„ęØēéŗ¦å
é£č®¾ē½®ć",alertSpeechRecognitionSetupFailed:"čÆé³čÆå«č®¾ē½®å¤±č“„ć请å·ę°é”µé¢åéčÆć",alertMicrophoneAccessDenied:"éŗ¦å
é£č®æé®č¢«ęē»ć请åØęµč§åØč®¾ē½®äøå
许麦å
é£č®æé®å¹¶å·ę°é”µé¢ć",alertNoMicrophoneDetected:"ęŖę£ęµå°éŗ¦å
é£ć请čæę„éŗ¦å
é£å¹¶å·ę°é”µé¢ć",alertMicrophoneError:"éŗ¦å
é£é误ć请ę£ę„ęØēéŗ¦å
é£ć",conversationStartFailed:"ę ę³å¼å§åƹčÆć请éčÆć",insufficientBalanceError:"ä½é¢äøč¶³ļ¼ę ę³å¼å§åƹčÆć请å
å¼åē»§ē»ć"}};function ft(t,e){const a=function(t){if(!t||"string"!=typeof t)return _t;const e=t.toLowerCase();if(bt[e])return e;const a=e.split("-")[0];return bt[a]?a:_t}(t),i=bt[a]?.[e];return void 0!==i?i:bt[_t]?.[e]??e}class yt{constructor(t,e,a){this.bus=t,this.dismissableContainer=e,this._getLanguage=a||(()=>"en"),this.dismissableAlerts=new Map,this.bus.on("event_command_Alerts_ShowDismissableAlert",(t=>{let e;e=t?.messageKey?ft(this._getLanguage(),t.messageKey):t?.errorMessage||ft(this._getLanguage(),"alertGenericError");const a=t?.className||"alert-danger";this.showDismissableAlert(e,a)}))}showDismissableAlert(t,e){if(this.dismissableAlerts.has(t))return;if(this.dismissableAlerts.size>=T.alerts.maxAlerts){const t=this.dismissableAlerts.keys().next().value,e=this.dismissableAlerts.get(t);e&&(e.hideToast(),this.dismissableAlerts.delete(t))}const a=f({text:t,duration:T.alerts.dismissableAlertDuration,close:!0,gravity:"top",position:"left",stopOnFocus:!0,className:`alert ${e}`,selector:this.dismissableContainer,callback:()=>{this.dismissableAlerts.delete(t)}});a.showToast(),this.dismissableAlerts.set(t,a)}}const wt=t=>/[\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]/.test(t);class St{#o=null;#r="wakeLock"in navigator;get isActive(){return!!this.#o}get isSupported(){return this.#r}async request(){const t="undefined"!=typeof process&&process.env&&"test"===process.env.NODE_ENV,e="undefined"!=typeof document&&"visible"===document.visibilityState;if(this.#r&&!this.isActive&&!t&&e)try{this.#o=await navigator.wakeLock.request("screen"),this.#o.addEventListener("release",(()=>{this.#o=null}))}catch(a){}}async release(){try{await(this.#o?.release())}finally{this.#o=null,this.#r}}}const Ct=v`
|
|
2
|
+
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
3
|
+
width="25px" height="30.42px" viewBox="0 0 1052.000000 1280.000000"
|
|
4
|
+
preserveAspectRatio="xMidYMid meet">
|
|
5
|
+
<metadata>
|
|
6
|
+
Created by potrace 1.15, written by Peter Selinger 2001-2017
|
|
7
|
+
</metadata>
|
|
8
|
+
<g transform="translate(0.000000,1280.000000) scale(0.100000,-0.100000)"
|
|
9
|
+
fill="#000000" stroke="none">
|
|
10
|
+
<path d="M4950 12790 c-25 -4 -63 -15 -85 -23 -22 -8 -67 -20 -100 -27 -33 -7
|
|
11
|
+
-99 -27 -147 -46 -48 -19 -105 -34 -126 -34 -60 0 -199 -27 -277 -53 -137 -47
|
|
12
|
+
-256 -119 -365 -222 -36 -33 -103 -83 -149 -110 -107 -64 -199 -154 -343 -335
|
|
13
|
+
-63 -80 -125 -154 -138 -165 -49 -43 -80 -106 -80 -163 0 -29 5 -62 10 -73 9
|
|
14
|
+
-16 2 -28 -53 -83 -35 -35 -86 -97 -112 -137 -27 -41 -64 -92 -82 -114 -48
|
|
15
|
+
-56 -120 -206 -143 -299 -11 -43 -25 -120 -30 -170 -6 -50 -17 -146 -26 -213
|
|
16
|
+
-11 -90 -12 -137 -5 -185 21 -132 51 -441 61 -622 6 -103 17 -222 26 -264 18
|
|
17
|
+
-90 61 -186 102 -225 36 -35 34 -77 -4 -77 -64 0 -127 -51 -166 -135 -22 -47
|
|
18
|
+
-23 -61 -22 -240 2 -219 18 -331 68 -475 91 -257 114 -300 233 -433 47 -52 86
|
|
19
|
+
-109 116 -170 55 -109 116 -174 208 -221 53 -27 65 -38 73 -67 25 -94 131
|
|
20
|
+
-408 171 -509 l46 -115 14 -400 c21 -616 23 -712 15 -680 -4 17 -8 57 -9 90
|
|
21
|
+
-2 57 -3 59 -17 40 -9 -11 -106 -202 -215 -425 -110 -223 -212 -429 -227 -459
|
|
22
|
+
l-27 -54 -215 -119 c-332 -184 -779 -441 -1170 -671 -1067 -630 -1651 -1038
|
|
23
|
+
-1688 -1182 -45 -170 -72 -1000 -72 -2227 l0 -698 5262 0 5261 0 -6 993 c-9
|
|
24
|
+
1486 -29 1887 -99 1991 -125 190 -978 745 -2323 1512 -192 110 -435 247 -538
|
|
25
|
+
305 -188 104 -189 104 -212 155 -60 134 -439 894 -446 894 -4 0 -10 -19 -12
|
|
26
|
+
-42 -2 -24 -3 9 -1 72 2 63 9 293 15 510 l12 395 47 120 c47 119 120 335 160
|
|
27
|
+
472 l20 71 63 30 c97 46 137 88 201 209 37 72 80 134 125 185 91 101 131 160
|
|
28
|
+
157 233 13 33 38 101 58 150 62 161 79 270 80 510 l1 210 -29 58 c-33 68 -97
|
|
29
|
+
117 -153 117 -29 0 -33 3 -33 26 0 14 14 43 30 64 69 87 104 211 115 405 8
|
|
30
|
+
143 53 622 65 701 7 40 6 89 0 140 -6 43 -17 141 -26 217 -25 226 -77 374
|
|
31
|
+
-177 504 -29 37 -76 102 -105 143 -28 41 -73 97 -101 124 -43 43 -48 52 -40
|
|
32
|
+
73 12 32 12 105 -1 138 -6 15 -34 52 -64 83 -29 31 -107 125 -173 207 -66 83
|
|
33
|
+
-147 176 -181 207 -55 51 -170 128 -190 128 -5 0 -41 32 -82 70 -176 168 -369
|
|
34
|
+
256 -615 281 -79 8 -128 18 -175 38 -36 16 -90 34 -120 41 -30 7 -90 24 -134
|
|
35
|
+
38 -116 36 -205 22 -276 -44 -24 -22 -33 -24 -104 -20 -61 3 -82 8 -99 24 -46
|
|
36
|
+
44 -132 65 -207 52z"/>
|
|
37
|
+
</g>
|
|
38
|
+
</svg>`,At=v`
|
|
39
|
+
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
|
|
40
|
+
width="25px" height="50px" viewBox="0 0 640.000000 1280.000000"
|
|
41
|
+
preserveAspectRatio="xMidYMid meet">
|
|
42
|
+
<metadata>
|
|
43
|
+
Created by potrace 1.15, written by Peter Selinger 2001-2017
|
|
44
|
+
</metadata>
|
|
45
|
+
<g transform="translate(0.000000,1280.000000) scale(0.100000,-0.100000)"
|
|
46
|
+
fill="#000000" stroke="none">
|
|
47
|
+
<path d="M3108 12784 c-90 -19 -148 -45 -225 -100 -142 -102 -221 -254 -243
|
|
48
|
+
-472 -12 -114 -6 -197 17 -252 8 -19 19 -84 24 -145 14 -181 68 -335 148 -427
|
|
49
|
+
35 -39 41 -53 47 -109 8 -82 -9 -175 -38 -206 -75 -80 -270 -140 -598 -183
|
|
50
|
+
-335 -44 -430 -65 -524 -114 -113 -59 -172 -199 -213 -511 -24 -179 -23 -743
|
|
51
|
+
1 -1040 30 -372 84 -809 126 -1013 16 -82 17 -98 5 -132 -39 -110 -50 -211
|
|
52
|
+
-49 -460 1 -303 6 -351 114 -975 62 -366 76 -461 100 -710 21 -216 77 -371
|
|
53
|
+
178 -492 49 -58 52 -66 52 -117 0 -130 45 -615 91 -976 35 -273 57 -419 101
|
|
54
|
+
-655 l31 -170 -21 -165 c-47 -366 -59 -628 -43 -930 18 -321 43 -500 141 -995
|
|
55
|
+
67 -342 100 -552 100 -642 0 -51 3 -64 19 -73 11 -5 25 -26 31 -45 16 -49 1
|
|
56
|
+
-116 -71 -310 -33 -87 -62 -178 -66 -200 -5 -38 -2 -43 35 -77 65 -59 138 -81
|
|
57
|
+
267 -82 154 -1 254 29 309 94 33 40 34 86 5 213 -20 84 -21 119 -20 407 0 173
|
|
58
|
+
3 338 6 365 14 129 86 920 100 1085 31 383 45 663 45 920 0 156 5 283 11 310
|
|
59
|
+
7 27 12 179 14 375 1 182 7 389 13 460 19 213 82 1447 82 1604 0 46 3 81 6 78
|
|
60
|
+
12 -11 33 -769 33 -1172 1 -387 -2 -427 -34 -600 -13 -67 -19 -182 -25 -455
|
|
61
|
+
-5 -201 -14 -437 -20 -525 -14 -193 -8 -792 16 -1390 24 -628 23 -715 -10
|
|
62
|
+
-945 -15 -107 -28 -231 -27 -275 0 -44 -9 -141 -20 -215 -12 -74 -19 -152 -16
|
|
63
|
+
-173 11 -84 96 -128 260 -135 165 -7 296 26 375 94 38 32 42 40 42 80 0 26
|
|
64
|
+
-21 109 -51 202 -34 104 -53 181 -56 227 -5 66 -3 73 22 103 23 28 28 45 36
|
|
65
|
+
139 15 161 43 326 105 611 30 142 69 320 85 397 119 551 179 1076 179 1561 0
|
|
66
|
+
82 6 140 25 220 98 439 178 1007 216 1554 l13 175 42 45 c135 146 180 285 214
|
|
67
|
+
660 6 68 15 140 20 160 5 19 13 71 20 115 6 44 39 211 75 370 120 543 145 714
|
|
68
|
+
145 980 0 169 -15 299 -44 382 -8 23 -10 49 -5 66 13 47 47 396 66 662 12 175
|
|
69
|
+
17 384 17 695 1 463 -7 597 -45 828 -34 206 -74 303 -152 365 -103 82 -206
|
|
70
|
+
119 -522 186 -322 69 -467 120 -542 191 -32 29 -38 59 -38 196 l0 121 42 46
|
|
71
|
+
c94 101 142 246 150 447 4 107 9 144 25 178 19 40 20 50 9 155 -26 245 -121
|
|
72
|
+
392 -315 487 -135 67 -274 85 -418 54z m-964 -3709 c46 -256 95 -614 112 -822
|
|
73
|
+
6 -76 4 -86 -25 -156 -35 -86 -74 -206 -94 -292 -14 -58 -14 -56 -9 85 3 86 0
|
|
74
|
+
160 -6 182 -8 30 -6 49 9 97 10 33 24 119 30 191 16 175 -2 488 -47 815 -14
|
|
75
|
+
100 5 36 30 -100z m2176 -690 c14 -123 35 -223 55 -272 11 -27 13 -44 6 -63
|
|
76
|
+
-25 -66 -51 -272 -51 -404 0 -33 -2 -57 -5 -54 -3 3 -12 58 -20 124 -16 130
|
|
77
|
+
-58 374 -80 470 -16 70 -11 137 41 539 l29 220 6 -230 c4 -126 12 -275 19
|
|
78
|
+
-330z"/>
|
|
79
|
+
</g>
|
|
80
|
+
</svg>`,kt=v`
|
|
81
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 304" aria-hidden="true" focusable="false">
|
|
82
|
+
<path fill="currentColor" opacity="1.000000" stroke="none"
|
|
83
|
+
d="
|
|
84
|
+
M1.000000,288.470459
|
|
85
|
+
C4.336832,282.053436 4.111762,275.237854 5.412516,268.835938
|
|
86
|
+
C9.171879,250.333588 12.256336,231.695190 15.732928,213.134018
|
|
87
|
+
C20.612299,187.083603 25.519182,161.037720 30.578411,135.021805
|
|
88
|
+
C34.731358,113.666214 48.112289,99.843201 67.283409,90.909126
|
|
89
|
+
C75.588669,87.038719 84.634201,86.823570 93.477028,85.684494
|
|
90
|
+
C103.980019,84.331566 114.508003,83.170403 125.029549,81.964516
|
|
91
|
+
C134.897934,80.833488 144.770737,79.740570 154.643967,78.652489
|
|
92
|
+
C167.640717,77.220169 180.643631,75.843018 193.636826,74.379372
|
|
93
|
+
C207.287781,72.841637 220.930206,71.228279 234.576675,69.650711
|
|
94
|
+
C247.073685,68.206024 259.608582,67.028587 272.059296,65.258904
|
|
95
|
+
C289.515259,62.777817 311.662506,68.169601 320.750824,87.776169
|
|
96
|
+
C321.000000,103.687561 321.000000,119.375122 320.863403,135.868958
|
|
97
|
+
C316.264496,158.378265 311.369873,180.004089 307.475647,201.808578
|
|
98
|
+
C304.316284,219.498672 298.646210,235.390030 283.605621,246.605179
|
|
99
|
+
C273.533966,254.115143 262.694183,259.369141 249.831314,259.369751
|
|
100
|
+
C196.869217,259.372223 143.907104,259.350830 90.945038,259.387451
|
|
101
|
+
C84.199684,259.392120 77.875465,260.870514 72.208954,264.918091
|
|
102
|
+
C61.420639,272.624237 50.447315,280.070831 39.624340,287.729126
|
|
103
|
+
C31.661816,293.363373 23.058926,298.128632 16.000000,305.000000
|
|
104
|
+
C11.069987,305.000000 6.139974,305.000000 1.000000,305.000000
|
|
105
|
+
C1.000000,299.648193 1.000000,294.294556 1.000000,288.470459
|
|
106
|
+
M275.033142,85.223404
|
|
107
|
+
C261.697052,86.618607 248.357925,87.985428 235.025940,89.418671
|
|
108
|
+
C225.656281,90.425941 216.291748,91.484985 206.933121,92.590202
|
|
109
|
+
C193.793808,94.141907 180.663681,95.771080 167.526703,97.342773
|
|
110
|
+
C154.387085,98.914795 141.245880,100.474091 128.101654,102.007111
|
|
111
|
+
C115.450096,103.482681 102.819870,105.228951 90.133003,106.292244
|
|
112
|
+
C73.891426,107.653465 62.091988,115.644218 53.905109,129.331238
|
|
113
|
+
C48.555580,138.274689 48.386028,148.694748 46.454941,158.543243
|
|
114
|
+
C40.881393,186.968201 35.619186,215.456558 30.531080,243.972916
|
|
115
|
+
C28.920919,252.997086 26.530741,261.929657 25.918119,272.252594
|
|
116
|
+
C36.635975,264.858246 46.765110,258.271790 56.444744,251.080322
|
|
117
|
+
C66.348396,243.722427 76.826538,239.448746 89.501419,239.526108
|
|
118
|
+
C141.147202,239.841385 192.798050,239.398087 244.442627,239.800262
|
|
119
|
+
C261.984772,239.936874 281.514282,227.005966 285.644775,207.139023
|
|
120
|
+
C292.085327,176.161133 298.743103,145.214188 304.327423,114.078094
|
|
121
|
+
C307.426147,96.800697 293.495605,83.732857 275.033142,85.223404
|
|
122
|
+
z"/>
|
|
123
|
+
<path fill="currentColor" opacity="1.000000" stroke="none"
|
|
124
|
+
d="
|
|
125
|
+
M192.532394,1.000000
|
|
126
|
+
C198.885437,3.923073 203.176651,8.184974 205.187256,14.653214
|
|
127
|
+
C208.319366,24.729303 203.666061,36.642429 194.050446,41.903614
|
|
128
|
+
C191.173523,43.477734 189.510925,45.181450 189.158447,48.664070
|
|
129
|
+
C188.728455,52.912342 187.194672,57.038986 186.596146,61.282810
|
|
130
|
+
C185.959412,65.797729 183.572113,67.820358 179.205505,68.640800
|
|
131
|
+
C176.553574,69.139076 173.958298,69.407784 171.312668,69.340088
|
|
132
|
+
C166.723129,69.222649 164.992142,67.162018 165.843384,62.631424
|
|
133
|
+
C166.882172,57.102543 168.063232,51.597549 169.321182,46.113976
|
|
134
|
+
C169.895721,43.609554 169.353165,41.690746 167.635925,39.742435
|
|
135
|
+
C156.688034,27.321487 158.771332,12.419515 172.627487,3.362831
|
|
136
|
+
C173.595947,2.729820 174.576691,2.115573 175.775848,1.246300
|
|
137
|
+
C181.354935,1.000000 186.709854,1.000000 192.532394,1.000000
|
|
138
|
+
M178.466064,43.194557
|
|
139
|
+
C181.738434,43.962490 184.899261,44.061489 187.786880,41.793179
|
|
140
|
+
C184.632401,38.947304 176.496841,37.868542 173.029633,39.773766
|
|
141
|
+
C173.948669,41.843548 175.914566,42.277782 178.466064,43.194557
|
|
142
|
+
z"/>
|
|
143
|
+
<path fill="currentColor" opacity="1.000000" stroke="none"
|
|
144
|
+
d="
|
|
145
|
+
M173.396362,219.107773
|
|
146
|
+
C160.763672,219.844223 148.703918,219.893875 137.623154,213.420822
|
|
147
|
+
C131.992325,210.131485 131.001694,206.611771 134.787186,201.285965
|
|
148
|
+
C140.284882,193.551270 141.590897,193.347229 150.244125,196.974045
|
|
149
|
+
C162.473145,202.099594 173.937256,200.460480 184.371277,192.233063
|
|
150
|
+
C190.470139,187.423981 200.297089,190.002045 202.970245,197.391357
|
|
151
|
+
C204.333099,201.158630 202.500916,204.293793 199.573578,206.589478
|
|
152
|
+
C191.914856,212.595642 183.503372,217.124847 173.396362,219.107773
|
|
153
|
+
z"/>
|
|
154
|
+
<path fill="currentColor" opacity="1.000000" stroke="none"
|
|
155
|
+
d="
|
|
156
|
+
M231.931488,115.814880
|
|
157
|
+
C232.718384,116.499748 233.215561,116.943787 233.683640,117.416611
|
|
158
|
+
C240.780563,124.585335 240.799484,126.221283 233.876999,133.186096
|
|
159
|
+
C225.797806,141.314667 225.797806,141.314667 234.738693,148.488159
|
|
160
|
+
C242.166809,154.447922 240.659515,164.336533 231.641388,167.987823
|
|
161
|
+
C227.904327,169.500900 224.864883,167.448578 222.159653,165.126251
|
|
162
|
+
C216.626480,160.376236 211.124985,155.586761 205.700455,150.713333
|
|
163
|
+
C198.421768,144.174057 198.716476,138.061127 206.050339,131.712906
|
|
164
|
+
C211.563812,126.940407 216.752579,121.786278 221.985779,116.699028
|
|
165
|
+
C224.990524,113.778091 228.029648,112.640854 231.931488,115.814880
|
|
166
|
+
z"/>
|
|
167
|
+
<path fill="currentColor" opacity="1.000000" stroke="none"
|
|
168
|
+
d="
|
|
169
|
+
M138.709229,129.454376
|
|
170
|
+
C143.972031,137.631577 143.546768,146.953293 137.345932,152.521545
|
|
171
|
+
C131.264923,157.982208 121.845360,160.255585 114.151199,154.600388
|
|
172
|
+
C108.040939,150.109360 108.031036,143.842911 108.868034,137.581924
|
|
173
|
+
C109.740639,131.054550 114.375092,127.080360 120.324982,124.957504
|
|
174
|
+
C127.137169,122.526985 133.365952,123.659859 138.709229,129.454376
|
|
175
|
+
z"/>
|
|
176
|
+
</svg>`,Tt=v`
|
|
177
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 100 100" width="80" height="80" aria-hidden="true" focusable="false">
|
|
178
|
+
<!-- Main chat bubble -->
|
|
179
|
+
<rect x="10" y="15" width="55" height="40" rx="8" ry="8" fill="currentColor" opacity="0.15"/>
|
|
180
|
+
<!-- Secondary chat bubble -->
|
|
181
|
+
<rect x="35" y="40" width="55" height="40" rx="8" ry="8" fill="currentColor" opacity="0.3"/>
|
|
182
|
+
<!-- Dots in main bubble -->
|
|
183
|
+
<circle cx="25" cy="35" r="4" fill="currentColor" opacity="0.4"/>
|
|
184
|
+
<circle cx="38" cy="35" r="4" fill="currentColor" opacity="0.4"/>
|
|
185
|
+
<circle cx="51" cy="35" r="4" fill="currentColor" opacity="0.4"/>
|
|
186
|
+
</svg>`,xt=kt,It=v`<span class="material-icons">call_end</span>`,Et=v`<span class="material-icons last-message-icon">history</span>`,Dt=v`<span class="material-icons switch-chat-icon">chat</span>`,Mt=v`<span class="material-icons">refresh</span>`,Rt=v`<span class="material-icons">send</span>`,Pt=v`<span class="material-icons chat-bubble-icon">chat_bubble</span>`,zt=v`<span class="material-icons">close</span>`,Ot=v`<span class="material-icons">menu</span>`,Lt=v`<span class="material-icons error-icon">error</span>`,Nt=v`<span class="material-icons"> content_copy</span>`,Bt=v`<span class="material-icons">check</span>`,Vt=v`<span class="material-icons">keyboard</span>`,Ft=t=>v`
|
|
187
|
+
<div class="button-container">
|
|
188
|
+
<button @click="${t._handleStartConversationBtn}" type="button" class="btn start-button" id="start_conversation_button" title="${t._t("start")}">${t._t("start")}</button>
|
|
189
|
+
</div>
|
|
190
|
+
`,$t=t=>v`
|
|
191
|
+
<div class="button-container">
|
|
192
|
+
<button @click="${t._handleConnectBtn}" type="button" class="btn-lg start-button" id="connect_button" title="${t._t("connect")}">${t._t("connect")}</button>
|
|
193
|
+
</div>`,Ut=t=>{const e=(t=>t._isConversationPaused?"paused":t._isSpeaking?"speaking":t._isThinking?"thinking":t._isListening?"listening":"idle")(t),a=((t,e)=>{switch(e){case"paused":return t._t("reconnecting");case"speaking":return t._t("interruptSpeaking");case"thinking":return t._t("waitForResponse");case"listening":return t._t("turnOffMic");default:return t._t("turnOnMic")}})(t,e),i=t._inputsBlocked&&"idle"===e,n="paused"===e,s="idle"===e&&!i;return v`
|
|
194
|
+
<div class="voice-visualizer-wrapper">
|
|
195
|
+
<div
|
|
196
|
+
class="voice-visualizer state-${e} ${i||n?"visualizer-disabled":""}"
|
|
197
|
+
@click="${i||n?m:t._handleMicBtn}"
|
|
198
|
+
title="${a}"
|
|
199
|
+
role="button"
|
|
200
|
+
tabindex="${i||n?-1:0}"
|
|
201
|
+
aria-label="${a}"
|
|
202
|
+
>
|
|
203
|
+
<div class="audio-bar"></div>
|
|
204
|
+
<div class="audio-bar"></div>
|
|
205
|
+
<div class="audio-bar"></div>
|
|
206
|
+
<div class="audio-bar"></div>
|
|
207
|
+
<div class="audio-bar"></div>
|
|
208
|
+
</div>
|
|
209
|
+
${s?v`<span class="visualizer-hint">${t._t("tapToSpeak")}</span>`:m}
|
|
210
|
+
</div>
|
|
211
|
+
`},Ht=t=>v`
|
|
212
|
+
<div id="chatbot-container" class="${t._showChatbot||!t.toggler?"show-chatbot":""}${t.toggler?"":" embedded"}">
|
|
213
|
+
${t.toggler?(t=>v`
|
|
214
|
+
<button id="chatbot-toggler" @click="${t._handleToggleChatbot}" aria-label="${t._t("toggleChatbot")}">
|
|
215
|
+
${xt}
|
|
216
|
+
${zt}
|
|
217
|
+
</button>
|
|
218
|
+
`)(t):m}
|
|
219
|
+
${(()=>m)()}
|
|
220
|
+
<div class="chatbot-layout ${t._stateTestMode?"with-test-stats":""}">
|
|
221
|
+
${t._stateTestMode?(t=>{const e=t._actorSnapshot,a="function"==typeof t.initStatus?t.initStatus():"UNKNOWN",i=!!t._isStartingConversation,n=!!t._isInitializingConversation,s=!!t._isConversationInProgress,o=!!t._isConversationPaused,r=!!t._isAutoResuming,c=!!t._isConversationStopped,l=!!t._isFailed,h=l?"FAILED":i?"STARTING":n?"INITIALIZING":s?"IN_PROGRESS":o?"PAUSED":r?"AUTO_RESUMING":c?"STOPPED":"CLEARED",d=!!t._isSpeaking,u=!!t._isThinking||!!t._isStartingConversation,p=s&&!d&&!u&&!t._isListening,g=!!t._isListening,_=d?"speaking":u?"thinking":g?"listening":p?"idle":i?"startingConversation":"",b=!!t._inputsBlocked||u,f=t._speakingAvatar?.connectionManager,y=!0===f?.allConnectionsReady,w=!!t._isDisconnected,S=y?"connected":w?"disconnected":l?"recovering":"connecting",C=function(t){const e=t?.value;if(!e)return"";const a=(t,e=[])=>{if("string"==typeof t)return[e.concat(t).join(".")];if(t&&"object"==typeof t){const i=[];for(const n of Object.keys(t))i.push(...a(t[n],e.concat(n)));return i}return[]};try{return a(e).join(" | ")}catch(i){try{return JSON.stringify(e)}catch{return String(e)}}}(e),A=!t.toggler||t._showChatbot,k="AvatarPage"===t._shownPage?"AVATAR":"CHAT",T=e?.context?.chatSocket?.chatbotMode||"unknown";return v`
|
|
222
|
+
<div class="test-mode-states">
|
|
223
|
+
<div><b>FSM</b>: ${C||"(no state)"}</div>
|
|
224
|
+
<div><b>UI</b>: Chatbot Visible=${String(A)}, Mode (UI ā FSM)=${k} ā ${T}</div>
|
|
225
|
+
<div>Initialization: ${a}</div>
|
|
226
|
+
<div>Conversation: ${h}</div>
|
|
227
|
+
<div>Substate: ${_}</div>
|
|
228
|
+
<div>AvatarRunning: ${String(t._avatarRunning)}</div>
|
|
229
|
+
<div>InputsBlocked: ${b}</div>
|
|
230
|
+
<div>isPageVisible: ${t._actorSnapshot?.context?.isPageVisible}</div>
|
|
231
|
+
<div>pendingStart: ${String(t._actorSnapshot?.context?.pendingStart)}</div>
|
|
232
|
+
<div>Connection: ${S}</div>
|
|
233
|
+
<pre style="white-space: pre-wrap; margin: 4px 0;">${f?.getConnectionReport?.()}</pre>
|
|
234
|
+
<div style="display:flex; flex-wrap: wrap; gap: 6px; width:50%;">
|
|
235
|
+
<button @click="${()=>t._testSetAuthConnected("disconnected")}">Disconnect Auth</button>
|
|
236
|
+
<button @click="${()=>t._testSetAuthConnected("failed")}">Fail Auth</button>
|
|
237
|
+
<button @click="${()=>t._testSetAuthConnected()}">Connect Auth</button>
|
|
238
|
+
<button @click="${()=>t._testSetSocketConnected("disconnected")}">Disconnect Socket</button>
|
|
239
|
+
<button @click="${()=>t._testSetSocketConnected("failed")}">Fail Socket</button>
|
|
240
|
+
<button @click="${()=>t._testSetSocketConnected()}">Connect Socket</button>
|
|
241
|
+
<button @click="${()=>t._testSetSpeechConnected("disconnected")}">Disconnect Speech</button>
|
|
242
|
+
<button @click="${()=>t._testSetSpeechConnected("failed")}">Fail Speech</button>
|
|
243
|
+
<button @click="${()=>t._testSetSpeechConnected()}">Connect Speech</button>
|
|
244
|
+
${f?.reconnectFailedModules?v`<button @click="${()=>f.reconnectFailedModules(!0)}">Reconnect Failed</button>`:m}
|
|
245
|
+
${f?.reconnectDisconnectedModules?v`<button @click="${()=>f.reconnectDisconnectedModules()}">Reconnect All</button>`:m}
|
|
246
|
+
</div>
|
|
247
|
+
</div>
|
|
248
|
+
`})(t):m}
|
|
249
|
+
<div
|
|
250
|
+
class="chatbot ${t.target_app} ${t.compact?"compact":""}"
|
|
251
|
+
@click="${t._handleChatbotClick}"
|
|
252
|
+
style="
|
|
253
|
+
${t.toggler||"mobile"===t.target_app?`width: ${t._canvasWidth}px; height: ${"mobile"===t.target_app||t.toggler&&window.innerWidth<768?"calc(var(--chatbot-dynamic-height) - var(--chatbot-bottom-offset, 0px))":`${t._chatbotHeight}px`};`:t._stateTestMode?`width: ${t._canvasWidth}px; height: ${t._chatbotHeight}px;`:`width: 100%; height: ${t._chatbotHeight}px;`}
|
|
254
|
+
"
|
|
255
|
+
>
|
|
256
|
+
${t.compact?m:(t=>v`
|
|
257
|
+
<header @click="${t=>t.stopPropagation()}">
|
|
258
|
+
<div class="header-container">
|
|
259
|
+
<div class="header-left">
|
|
260
|
+
<div class="menu-icon" @click="${t._handleToggleMenu}">
|
|
261
|
+
${t._showMenu?zt:Ot}
|
|
262
|
+
</div>
|
|
263
|
+
${(t=>{const e=t._isConversationInProgress,a=t._isStartingConversation||t._isInitializingConversation,i=t._isConversationStopped,n=t._isAutoResuming;return v`
|
|
264
|
+
${t._showMenu?v`<div class="menu-backdrop" @click="${t._handleToggleMenu}"></div>`:null}
|
|
265
|
+
<div id="menu" class="${t._showMenu?"show":"hide"}">
|
|
266
|
+
<div class="menu-items" >
|
|
267
|
+
<div class="conversation-details">
|
|
268
|
+
<span class="conversation-status" title="${t._t("conversationStatus")}">${e?v`<small>${t._t("conversationInProgress")}</small>`:v`<small>${t._t("conversationStopped")}</small>`}</span>
|
|
269
|
+
</div>
|
|
270
|
+
<div ?hidden=${!i||e||a||n}>
|
|
271
|
+
<button type="button" class="menu-button" @click="${t._handleStartConversationMenuBtn}">${t._t("startConversation")}</button>
|
|
272
|
+
</div>
|
|
273
|
+
<div ?hidden=${!e}>
|
|
274
|
+
<button type="button" class="menu-button" @click="${t._handleEndConversationBtn}">${t._t("endConversation")}</button>
|
|
275
|
+
</div>
|
|
276
|
+
<hr>
|
|
277
|
+
<div ?hidden=${!t._canDownloadTranscript()}>
|
|
278
|
+
<button type="button" class="menu-button" @click="${t._handleDownloadTranscriptMenuBtn}">${t._t("downloadConversation")}</button>
|
|
279
|
+
</div>
|
|
280
|
+
<div class="labels-container">
|
|
281
|
+
<label>${t._t("liveCaptions")}</label>
|
|
282
|
+
<label class="captions-switch">
|
|
283
|
+
<input type="checkbox" .checked=${t.enable_captions} @click="${t._handleToggleCaptionsSwitch}">
|
|
284
|
+
<span class="captions-slider round"></span>
|
|
285
|
+
</label>
|
|
286
|
+
</div>
|
|
287
|
+
<div class="menu-switch-container">
|
|
288
|
+
${(t=>"AvatarPage"===t._shownPage||"ChatPage"===t._shownPage?v`
|
|
289
|
+
<div class="switches-container" dir="ltr">
|
|
290
|
+
<input type="radio" id="switchAvatar" name="switchMode" value="Avatar" .checked=${"AvatarPage"===t._shownPage} />
|
|
291
|
+
<input type="radio" id="switchChat" name="switchMode" value="Chat" .checked=${"ChatPage"===t._shownPage}/>
|
|
292
|
+
<label for="switchAvatar" @click="${t._handleShowAvatarPage}">${t._t("avatar")}</label>
|
|
293
|
+
<label for="switchChat" @click="${t._handleShowChatPage}">${t._t("chat")}</label>
|
|
294
|
+
<div class="switch-wrapper">
|
|
295
|
+
<div class="switch">
|
|
296
|
+
<div>${t._t("avatar")}</div>
|
|
297
|
+
<div>${t._t("chat")}</div>
|
|
298
|
+
</div>
|
|
299
|
+
</div>
|
|
300
|
+
</div>
|
|
301
|
+
`:m)(t)}
|
|
302
|
+
</div>
|
|
303
|
+
</div>
|
|
304
|
+
</div>
|
|
305
|
+
`})(t)}
|
|
306
|
+
</div>
|
|
307
|
+
<div class="header-center">
|
|
308
|
+
<h3 id="avatar-name">${t._avatarName}</h3>
|
|
309
|
+
</div>
|
|
310
|
+
<div class="header-right">
|
|
311
|
+
${t.brand_logo?v`
|
|
312
|
+
<div>
|
|
313
|
+
<img src="${t.brand_logo}" class="logo-image">
|
|
314
|
+
</div>
|
|
315
|
+
`:m}
|
|
316
|
+
</div>
|
|
317
|
+
</div>
|
|
318
|
+
</header>
|
|
319
|
+
`)(t)}
|
|
320
|
+
|
|
321
|
+
<div
|
|
322
|
+
class="chatbot-body ${"ChatPage"===t._shownPage?"chat-mode":""} ${t.target_app} ${t.compact?"compact":""}"
|
|
323
|
+
>
|
|
324
|
+
${(t=>{const e=t._statusBarStatus;if(!e||"connected"===e)return m;const a={initializing:t._t("statusInitializing"),disconnected:t._t("statusReconnecting"),recovering:t._t("statusReconnecting"),failed:t._t("statusFailed"),invalidConfiguration:t._t("statusInvalidConfiguration")}[e]||"";return a?v`
|
|
325
|
+
<div class="status-bar status--${e}" role="status">
|
|
326
|
+
${a}
|
|
327
|
+
</div>
|
|
328
|
+
`:m})(t)}
|
|
329
|
+
<div id="toastify-dismissable-alerts"></div>
|
|
330
|
+
${(t=>"LoaderPage"===t._shownPage?v`
|
|
331
|
+
<div class="page-wrapper" id="loader_page">
|
|
332
|
+
<div class="page-center">
|
|
333
|
+
<div class="lds-dual-ring"></div>
|
|
334
|
+
</div>
|
|
335
|
+
</div>
|
|
336
|
+
`:m)(t)}
|
|
337
|
+
${(t=>{const e=t._isVideoAvatar&&"AvatarPage"===t._shownPage&&(t._isVideoAvatarReconnecting||t._isStartingConversation&&!t._avatarRunning&&!t._isConversationInProgress),a=t._isVideoAvatar&&t._isVideoAvatarIdleDisconnected&&!t._isVideoAvatarReconnecting&&"AvatarPage"===t._shownPage&&t._isConversationInProgress&&!t._isStartingConversation,i=t._isVideoAvatar&&!t._avatarRunning&&"AvatarPage"===t._shownPage;return v`
|
|
338
|
+
<div class="page-wrapper avatar-wrapper" id="avatar-page" ?hidden=${"AvatarPage"!==t._shownPage}>
|
|
339
|
+
<div class="avatarbox">
|
|
340
|
+
<div id="avatar-container" style=${y(t._getAvatarBackgroundStyleObj())}></div>
|
|
341
|
+
${e?v`
|
|
342
|
+
<div class="video-avatar-loading-overlay">
|
|
343
|
+
<div class="lds-dual-ring"></div>
|
|
344
|
+
</div>
|
|
345
|
+
`:m}
|
|
346
|
+
${i?v`
|
|
347
|
+
<div class="video-avatar-placeholder-overlay">
|
|
348
|
+
<div class="video-avatar-placeholder-content">
|
|
349
|
+
${t._videoAvatarPlaceholderImageUrl?v`
|
|
350
|
+
<img
|
|
351
|
+
class="video-avatar-placeholder-image"
|
|
352
|
+
src="${t._videoAvatarPlaceholderImageUrl}"
|
|
353
|
+
alt="${t._avatarName||"Avatar"}"
|
|
354
|
+
@error=${t._handlePlaceholderImageError}
|
|
355
|
+
/>
|
|
356
|
+
<svg class="video-avatar-placeholder-icon video-avatar-placeholder-fallback" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="64" height="64" style="display: none;">
|
|
357
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/>
|
|
358
|
+
</svg>
|
|
359
|
+
`:v`
|
|
360
|
+
<svg class="video-avatar-placeholder-icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" width="64" height="64">
|
|
361
|
+
<path d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm0 3c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3zm0 14.2c-2.5 0-4.71-1.28-6-3.22.03-1.99 4-3.08 6-3.08 1.99 0 5.97 1.09 6 3.08-1.29 1.94-3.5 3.22-6 3.22z"/>
|
|
362
|
+
</svg>
|
|
363
|
+
`}
|
|
364
|
+
</div>
|
|
365
|
+
</div>
|
|
366
|
+
`:m}
|
|
367
|
+
${a?v`
|
|
368
|
+
<div class="video-avatar-idle-overlay">
|
|
369
|
+
<div class="video-avatar-idle-content">
|
|
370
|
+
<p class="video-avatar-idle-message">${t._t("avatarIdleDisconnected")}</p>
|
|
371
|
+
<button class="video-avatar-reconnect-btn" @click=${t._handleVideoAvatarReconnect}>
|
|
372
|
+
${t._t("reconnectAvatar")}
|
|
373
|
+
</button>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
`:m}
|
|
377
|
+
${(t=>v`
|
|
378
|
+
${t._isLiveCaptionsVisible&&t._liveCaption&&""!==t._liveCaption.trim()?v`
|
|
379
|
+
<div id="captions-wrapper" class="center-aligned">
|
|
380
|
+
<div class="${"assistant"===t._liveCaptionSpeaker?"assistant-live-caption":"user-live-caption"}" style="direction: ${wt(t._liveCaption)?"rtl":"ltr"}" @click="${t._openLastMessage}">
|
|
381
|
+
<div class="caption-content ${t._liveCaption.split(" ").length>5?"long-text":t._liveCaption.length<10?"short-text":""}">
|
|
382
|
+
<span class="${"assistant"===t._liveCaptionSpeaker?"caption-highlight":""}">${t._liveCaption}</span>
|
|
383
|
+
</div>
|
|
384
|
+
</div>
|
|
385
|
+
</div>
|
|
386
|
+
`:m}
|
|
387
|
+
`)(t)}
|
|
388
|
+
${(t=>{const e=t._isConversationInProgress;return v`
|
|
389
|
+
<div class="conversation-buttons-overlay">
|
|
390
|
+
${e?(t=>v`
|
|
391
|
+
<button @click="${t._handleEndConversationBtn}" type="button" title="${t._t("endConversation")}" class="secondary-button stop-button">
|
|
392
|
+
${It}
|
|
393
|
+
</button>
|
|
394
|
+
`)(t):m}
|
|
395
|
+
${e?(t=>v`
|
|
396
|
+
<button @click="${t._handleRestartConversation}" type="button" class="secondary-button restart-button" id="restart_button" title="${t._t("restartConversation")}">
|
|
397
|
+
${Mt}
|
|
398
|
+
</button>
|
|
399
|
+
`)(t):m}
|
|
400
|
+
${e?(t=>{const e=t._currentMessage,a=e&&"string"==typeof e.messageText&&""!==e.messageText.trim();return v`
|
|
401
|
+
${a?v`
|
|
402
|
+
<div @click="${t._openLastMessage}" class="last-message-button" title="${t._t("lastAssistantMessage")}">
|
|
403
|
+
${Et}
|
|
404
|
+
</div>
|
|
405
|
+
`:m}
|
|
406
|
+
`})(t):m}
|
|
407
|
+
${(t=>v`
|
|
408
|
+
<div
|
|
409
|
+
@click="${t._handleSwitchToChat}"
|
|
410
|
+
class="switch-chat-button"
|
|
411
|
+
title="${t._t("switchToChat")}"
|
|
412
|
+
aria-label="${t._t("switchToChat")}"
|
|
413
|
+
role="button"
|
|
414
|
+
tabindex="0">
|
|
415
|
+
${Dt}
|
|
416
|
+
</div>
|
|
417
|
+
`)(t)}
|
|
418
|
+
</div>
|
|
419
|
+
`})(t)}
|
|
420
|
+
${t._isVideoAvatar?m:v`
|
|
421
|
+
<div class="body-icons-overlay">
|
|
422
|
+
${t._isFullBody?(t=>v`
|
|
423
|
+
<div id="body-icons-wrapper" class="button-container vertical-icons">
|
|
424
|
+
<div class="icon-button" @click="${t._handleFullBodyIcon}" title="${t._t("fullBodyView")}">
|
|
425
|
+
${At}
|
|
426
|
+
</div>
|
|
427
|
+
<div class="icon-button" @click="${t._handleUpperBodyIcon}" title="${t._t("upperBodyView")}">
|
|
428
|
+
${Ct}
|
|
429
|
+
</div>
|
|
430
|
+
</div>
|
|
431
|
+
`)(t):m}
|
|
432
|
+
</div>
|
|
433
|
+
`}
|
|
434
|
+
<div class="voice-controls-container">
|
|
435
|
+
${(t=>{const e=t._isVideoAvatar&&!t._isVideoAvatarIdleDisconnected&&(t._isVideoAvatarReconnecting||t._isStartingConversation&&!t._avatarRunning||t._isConversationInProgress&&!t._avatarRunning||t._isConversationPaused&&!t._avatarRunning);if(t._isConversationPaused)return e?v`
|
|
436
|
+
<div class="button-container active-conversation">
|
|
437
|
+
<div class="state-control">
|
|
438
|
+
<div class="voice-visualizer-wrapper">
|
|
439
|
+
<div class="voice-visualizer state-thinking" title="${t._t("reconnecting")}" role="button" tabindex="-1" aria-label="${t._t("reconnecting")}">
|
|
440
|
+
<div class="audio-bar"></div>
|
|
441
|
+
<div class="audio-bar"></div>
|
|
442
|
+
<div class="audio-bar"></div>
|
|
443
|
+
<div class="audio-bar"></div>
|
|
444
|
+
<div class="audio-bar"></div>
|
|
445
|
+
</div>
|
|
446
|
+
</div>
|
|
447
|
+
</div>
|
|
448
|
+
</div>
|
|
449
|
+
`:v`
|
|
450
|
+
<div class="button-container active-conversation">
|
|
451
|
+
<div class="state-control">
|
|
452
|
+
${Ut(t)}
|
|
453
|
+
</div>
|
|
454
|
+
</div>
|
|
455
|
+
`;if(t._isConversationInProgress)return e?v`
|
|
456
|
+
<div class="button-container active-conversation">
|
|
457
|
+
<div class="state-control">
|
|
458
|
+
<div class="voice-visualizer-wrapper">
|
|
459
|
+
<div class="voice-visualizer state-thinking" title="${t._t("reconnecting")}" role="button" tabindex="-1" aria-label="${t._t("reconnecting")}">
|
|
460
|
+
<div class="audio-bar"></div>
|
|
461
|
+
<div class="audio-bar"></div>
|
|
462
|
+
<div class="audio-bar"></div>
|
|
463
|
+
<div class="audio-bar"></div>
|
|
464
|
+
<div class="audio-bar"></div>
|
|
465
|
+
</div>
|
|
466
|
+
</div>
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
`:v`
|
|
470
|
+
<div class="button-container active-conversation">
|
|
471
|
+
<div class="state-control">
|
|
472
|
+
${Ut(t)}
|
|
473
|
+
</div>
|
|
474
|
+
${t._showTyping?m:v`
|
|
475
|
+
<div
|
|
476
|
+
class="state-control"
|
|
477
|
+
@click="${t._handleToggleTyping}"
|
|
478
|
+
@keydown="${e=>{"Enter"!==e.key&&" "!==e.key||(e.preventDefault(),t._handleToggleTyping(e))}}"
|
|
479
|
+
title="${t._t("showTyping")}"
|
|
480
|
+
role="button"
|
|
481
|
+
tabindex="0"
|
|
482
|
+
aria-label="${t._t("showTyping")}"
|
|
483
|
+
style="cursor: pointer;"
|
|
484
|
+
>
|
|
485
|
+
${Vt}
|
|
486
|
+
</div>
|
|
487
|
+
`}
|
|
488
|
+
</div>
|
|
489
|
+
${t._showTyping?(t=>{const e=t._isConversationPaused?t._t("reconnecting"):t._inputsBlocked?t._t("waitForResponse"):t._t("typeHere");return v`
|
|
490
|
+
<div class="typing-input ${t._inputsBlocked?"input-blocked":""}">
|
|
491
|
+
<div class="close-input-button" @click="${t._handleToggleTyping}" aria-label="Close typing input" role="button">
|
|
492
|
+
${zt}
|
|
493
|
+
</div>
|
|
494
|
+
<textarea
|
|
495
|
+
@keyup="${t._handleTypingKeyUp}"
|
|
496
|
+
type="text"
|
|
497
|
+
id="typed_input"
|
|
498
|
+
placeholder="${e}"
|
|
499
|
+
?disabled="${t._inputsBlocked}"
|
|
500
|
+
></textarea>
|
|
501
|
+
<div
|
|
502
|
+
@click="${t._handleSendTypedInput}"
|
|
503
|
+
id="typing_send_button"
|
|
504
|
+
class="${t._inputsBlocked?"send-button-disabled":""}"
|
|
505
|
+
>
|
|
506
|
+
${Rt}
|
|
507
|
+
</div>
|
|
508
|
+
</div>
|
|
509
|
+
`})(t):m}
|
|
510
|
+
`;if(t._isCheckingResume||t._isAutoResuming)return t._isVideoAvatar?v`
|
|
511
|
+
<div class="button-container active-conversation">
|
|
512
|
+
<div class="state-control">
|
|
513
|
+
<div class="voice-visualizer-wrapper">
|
|
514
|
+
<div class="voice-visualizer state-thinking" title="${t._t("reconnecting")}" role="button" tabindex="-1" aria-label="${t._t("reconnecting")}">
|
|
515
|
+
<div class="audio-bar"></div>
|
|
516
|
+
<div class="audio-bar"></div>
|
|
517
|
+
<div class="audio-bar"></div>
|
|
518
|
+
<div class="audio-bar"></div>
|
|
519
|
+
<div class="audio-bar"></div>
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
</div>
|
|
524
|
+
`:m;const a=t._speakingAvatar?.connectionManager;return a?.connectionModules&&Object.values(a.connectionModules).some((t=>t.isFailed()))?$t(t):Ft(t)})(t)}
|
|
525
|
+
</div>
|
|
526
|
+
</div>
|
|
527
|
+
</div>
|
|
528
|
+
`})(t)}
|
|
529
|
+
${(t=>{let e,a="";const i=t._isStartingConversation,n=t._isInitializingConversation,s=t._isConversationInProgress,o=t._isConversationPaused,r=t._isAutoResuming;return i||n||r?(e=v`
|
|
530
|
+
<div class="chat-start-container center-aligned">
|
|
531
|
+
<div class="lds-dual-ring small"></div>
|
|
532
|
+
</div>`,a="center-aligned"):s||o?e=v`
|
|
533
|
+
<ul class="chatbox">
|
|
534
|
+
${t._conversationTranscript.length?t._conversationTranscript.map((t=>((t,{speaker:e,messageText:a,time:i})=>{const n=wt(a)?"rtl":"ltr";return v`
|
|
535
|
+
<li class="chat ${e}">
|
|
536
|
+
${"assistant"===e?Pt:""}
|
|
537
|
+
<div style="direction: ${n}; text-align: ${"rtl"===n?"right":"left"}" class="message-container">
|
|
538
|
+
<p class="message-bubble" style="word-wrap: break-word; word-break: break-word;">${a}</p>
|
|
539
|
+
<small class="message-time ${"rtl"===n?"time-left":"time-right"}">${i}</small>
|
|
540
|
+
</div>
|
|
541
|
+
</li>
|
|
542
|
+
`})(0,t))):(t=>v`<h3 id="no-msgs-head">${t._t("noMessagesYet")}</h3>`)(t)}
|
|
543
|
+
</ul>
|
|
544
|
+
${(t=>{const e=t._isConversationPaused?t._t("reconnecting"):t._inputsBlocked?t._t("waitForResponse"):t._t("typeHere");return v`
|
|
545
|
+
<div class="chat-input ${t._inputsBlocked?"input-blocked":""}">
|
|
546
|
+
${t._inputsBlocked?v`
|
|
547
|
+
<div class="input-loading-dots">
|
|
548
|
+
<div class="dot"></div>
|
|
549
|
+
<div class="dot"></div>
|
|
550
|
+
<div class="dot"></div>
|
|
551
|
+
</div>
|
|
552
|
+
`:m}
|
|
553
|
+
<textarea
|
|
554
|
+
@keyup="${t._handleChatKeyUp}"
|
|
555
|
+
type="text"
|
|
556
|
+
id="message_input"
|
|
557
|
+
placeholder="${e}"
|
|
558
|
+
?disabled="${t._inputsBlocked}"
|
|
559
|
+
></textarea>
|
|
560
|
+
<div
|
|
561
|
+
@click="${t._handleSendTextMessage}"
|
|
562
|
+
id="chat_send_button"
|
|
563
|
+
class="${t._inputsBlocked?"send-button-disabled":""}"
|
|
564
|
+
>
|
|
565
|
+
${Rt}
|
|
566
|
+
</div>
|
|
567
|
+
</div>
|
|
568
|
+
`})(t)}
|
|
569
|
+
`:(e=v`
|
|
570
|
+
<div class="chat-placeholder-container">
|
|
571
|
+
<div class="chat-placeholder-content">
|
|
572
|
+
<div class="chat-placeholder-icon">
|
|
573
|
+
${Tt}
|
|
574
|
+
</div>
|
|
575
|
+
<h3 class="chat-placeholder-title">${t._t("chatPlaceholderTitle")}</h3>
|
|
576
|
+
<p class="chat-placeholder-description">${t._t("chatPlaceholderDescription")}</p>
|
|
577
|
+
</div>
|
|
578
|
+
<div class="chat-placeholder-button">
|
|
579
|
+
${Ft(t)}
|
|
580
|
+
</div>
|
|
581
|
+
</div>`,a="placeholder-mode"),v`
|
|
582
|
+
<div class="page-wrapper" id="chat-page" ?hidden=${"ChatPage"!==t._shownPage}>
|
|
583
|
+
<div class="chat-wrapper ${a}">
|
|
584
|
+
${(t=>v`
|
|
585
|
+
<button
|
|
586
|
+
@click="${t._handleBackToAvatar}"
|
|
587
|
+
class="floating-avatar-button"
|
|
588
|
+
title="${t._t("switchToAvatar")}"
|
|
589
|
+
aria-label="${t._t("switchToAvatar")}"
|
|
590
|
+
>
|
|
591
|
+
${At}
|
|
592
|
+
</button>
|
|
593
|
+
`)(t)}
|
|
594
|
+
${e}
|
|
595
|
+
</div>
|
|
596
|
+
</div>
|
|
597
|
+
`})(t)}
|
|
598
|
+
${(t=>"ErrorPage"===t._shownPage?v`
|
|
599
|
+
<div class="page-wrapper" id="error_page">
|
|
600
|
+
<div class="page-center">
|
|
601
|
+
${Lt}
|
|
602
|
+
</div>
|
|
603
|
+
</div>
|
|
604
|
+
`:m)(t)}
|
|
605
|
+
${(t=>"DisconnectedPage"===t._shownPage?v`
|
|
606
|
+
<div class="page-wrapper" id="disconnected_page">
|
|
607
|
+
<div class="page-center">
|
|
608
|
+
${$t(t)}
|
|
609
|
+
</div>
|
|
610
|
+
</div>
|
|
611
|
+
`:m)(t)}
|
|
612
|
+
</div>
|
|
613
|
+
${"mobile"===t.target_app||t.compact?m:(t=>{const e=t.brand_name||"Sentifyd",a=!!t.brand_name;return v`
|
|
614
|
+
<footer>
|
|
615
|
+
${a?v`<small>${e}</small>`:v`<small><a href="https://sentifyd.io" target="_blank">Sentifyd</a></small>`}
|
|
616
|
+
</footer>
|
|
617
|
+
`})(t)}
|
|
618
|
+
${(t=>t._showLastMessage?v`
|
|
619
|
+
<div class="last-message" @click="${t._closeLastMessage}">
|
|
620
|
+
<div class="last-message-content">
|
|
621
|
+
<div style="direction: ${wt(t._lastMessageText)?"rtl":"ltr"}" class="last-message-scrollable">
|
|
622
|
+
${t._lastMessageText}
|
|
623
|
+
<button class="last-message-copy-button" @click="${e=>((t,e)=>{t.stopPropagation();const a=e._lastMessageText;a&&navigator.clipboard.writeText(a).then((()=>{e._showCopyTick=!0,setTimeout((()=>{e._showCopyTick=!1}),1500)})).catch((t=>{}))})(e,t)}">
|
|
624
|
+
${t._showCopyTick?Bt:Nt}
|
|
625
|
+
</button>
|
|
626
|
+
</div>
|
|
627
|
+
</div>
|
|
628
|
+
</div>
|
|
629
|
+
`:m)(t)}
|
|
630
|
+
${(t=>t._showConfirmationDialog?v`
|
|
631
|
+
<div class="dialog-overlay">
|
|
632
|
+
<div class="dialog">
|
|
633
|
+
|
|
634
|
+
<p>${t._dialogMessage}</p>
|
|
635
|
+
<div class="dialog-button-wrapper">
|
|
636
|
+
<button class="confirm-button" @click="${t._handleConfirm}">${t._confirmButtonLabel}</button>
|
|
637
|
+
<button class="cancel-button" @click="${t._handleCancel}">${t._cancelButtonLabel}</button>
|
|
638
|
+
</div>
|
|
639
|
+
</div>
|
|
640
|
+
</div>
|
|
641
|
+
`:m)(t)}
|
|
642
|
+
${(t=>t._showUserData?v`
|
|
643
|
+
<div class="dialog-overlay">
|
|
644
|
+
<div class="dialog">
|
|
645
|
+
<h3>${t._t("secureFormTitle")}</h3>
|
|
646
|
+
<p>${t._t("secureFormDescription")}</p>
|
|
647
|
+
<div class="form-group">
|
|
648
|
+
<label for="username">${t._t("name")}</label>
|
|
649
|
+
<input @input="${e=>t.username=e.target.value}" type="text" id="username" placeholder="${t._t("namePlaceholder")}" .value=${t.username} required>
|
|
650
|
+
</div>
|
|
651
|
+
<div class="form-group">
|
|
652
|
+
<label for="email">${t._t("email")}*</label>
|
|
653
|
+
<input @input="${e=>t.email=e.target.value}" type="email" id="email" placeholder="${t._t("emailPlaceholder")}" .value=${t.email} required>
|
|
654
|
+
</div>
|
|
655
|
+
<div class="form-group">
|
|
656
|
+
<label for="phoneNumber">${t._t("phoneNumber")}</label>
|
|
657
|
+
<input @input="${e=>t.phoneNumber=e.target.value}" type="tel" id="phoneNumber" placeholder="${t._t("phonePlaceholder")}" .value=${t.phoneNumber}>
|
|
658
|
+
</div>
|
|
659
|
+
<div> <p style="font-size: 0.8em;">${t._t("secureFormNote")}</p></div>
|
|
660
|
+
<div class="dialog-button-group" style="text-align: start;">
|
|
661
|
+
<button class="button-save" @click="${t._handleSaveClick}" type="button" ?disabled="${!t.username?.trim()||!t.email?.trim()}">${t._t("send")}</button>
|
|
662
|
+
<button class="button-cancel" @click="${t._handleCancelClick}">${t._t("cancel")}</button>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
</div>
|
|
666
|
+
`:m)(t)}
|
|
667
|
+
${(t=>t._showSatisfactionScore?v`
|
|
668
|
+
<div class="dialog-overlay">
|
|
669
|
+
<div class="dialog">
|
|
670
|
+
<p>${t._t("conversationEndedPrompt")}</p>
|
|
671
|
+
<div class="radio-group">
|
|
672
|
+
${[1,2,3,4,5].map((e=>v`
|
|
673
|
+
<label class="radio-label">
|
|
674
|
+
<input
|
|
675
|
+
class="radio-input"
|
|
676
|
+
type="radio"
|
|
677
|
+
name="satisfactionScore"
|
|
678
|
+
value="${e}"
|
|
679
|
+
@change="${e=>t._satisfactionScore=parseInt(e.target.value)}"
|
|
680
|
+
?checked="${t._satisfactionScore===e}"
|
|
681
|
+
/>
|
|
682
|
+
${e}
|
|
683
|
+
</label>
|
|
684
|
+
`))}
|
|
685
|
+
</div>
|
|
686
|
+
<div class="dialog-button-group">
|
|
687
|
+
<button
|
|
688
|
+
class="button-save"
|
|
689
|
+
@click="${t._handleSubmitScoreClick}"
|
|
690
|
+
type="button"
|
|
691
|
+
?disabled="${null==t._satisfactionScore}"
|
|
692
|
+
>
|
|
693
|
+
${t._t("submit")}
|
|
694
|
+
</button>
|
|
695
|
+
<button class="button-cancel" @click="${t._handleCancelScoreClick}">
|
|
696
|
+
${t._t("skip")}
|
|
697
|
+
</button>
|
|
698
|
+
</div>
|
|
699
|
+
</div>
|
|
700
|
+
</div>
|
|
701
|
+
`:m)(t)}
|
|
702
|
+
${(t=>t._showChatConsentDialog?v`
|
|
703
|
+
<div class="dialog-overlay">
|
|
704
|
+
<div class="dialog consent-dialog" role="dialog" aria-modal="true" aria-labelledby="chat-consent-title">
|
|
705
|
+
<p id="chat-consent-title" class="label"><b>${t._t("consentTitle")}</b></p>
|
|
706
|
+
<div class="consent-text scrollable" tabindex="0" aria-label="${t._t("consentScrollableAria")||t._t("consentTitle")}">
|
|
707
|
+
<p>${t._t("consentInfo1")}</p>
|
|
708
|
+
<p>${t._t("consentInfo2")}</p>
|
|
709
|
+
<p>
|
|
710
|
+
${t._t("consentReadOur")}
|
|
711
|
+
<a href="${t.terms_href}" target="_blank" rel="noopener noreferrer">${t._t("consentTermsLabel")}</a>
|
|
712
|
+
${t._t("consentAnd")}
|
|
713
|
+
<a href="${t.privacy_href}" target="_blank" rel="noopener noreferrer">${t._t("consentPrivacyLabel")}</a>
|
|
714
|
+
${t._t("consentMoreDetails")}
|
|
715
|
+
</p>
|
|
716
|
+
<p><small>${t._t("consentInfo4")}</small></p>
|
|
717
|
+
</div>
|
|
718
|
+
<div class="dialog-button-group" style="text-align: center;">
|
|
719
|
+
<button class="button-save" aria-label="${t._t("consentAcceptAria")}" @click="${t._handleConsentAccept}" type="button">${t._t("consentAccept")}</button>
|
|
720
|
+
<button class="button-cancel" aria-label="${t._t("consentDeclineAria")}" @click="${t._handleConsentDecline}" type="button">${t._t("consentDecline")}</button>
|
|
721
|
+
</div>
|
|
722
|
+
</div>
|
|
723
|
+
</div>`:m)(t)}
|
|
724
|
+
</div>
|
|
725
|
+
</div>
|
|
726
|
+
</div>
|
|
727
|
+
`,jt=_`
|
|
728
|
+
|
|
729
|
+
:host {
|
|
730
|
+
--z-chatbot: 100; /* the widget panel */
|
|
731
|
+
--z-toggler: 110; /* floating open/close button (outside .chatbot) */
|
|
732
|
+
|
|
733
|
+
--z-controls: 200; /* in-widget controls over the canvas (buttons/icons) */
|
|
734
|
+
--z-status: 600; /* inline status bar at top of .chatbot-body */
|
|
735
|
+
--z-toasts: 700; /* dismissable alerts above status, below menus/modals */
|
|
736
|
+
|
|
737
|
+
--z-menu-backdrop: 1100; /* menu scrim (header) - below modal */
|
|
738
|
+
--z-menu: 1150; /* menu panel - below modal */
|
|
739
|
+
|
|
740
|
+
--z-overlay: 1200; /* modal backdrops (last-message, dialogs) - topmost */
|
|
741
|
+
/* modal content uses overlay+1 */
|
|
742
|
+
|
|
743
|
+
width: 100%;
|
|
744
|
+
height: 100%;
|
|
745
|
+
display: block;
|
|
746
|
+
|
|
747
|
+
font-size: 16px;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
/* Prevent flash of icon text (FOUT) for ligature-based Material Icons */
|
|
751
|
+
:host(:not(.icons-ready)) .material-icons {
|
|
752
|
+
/* Keep layout space but hide fallback text until the icon font loads */
|
|
753
|
+
visibility: hidden;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
.material-icons {
|
|
757
|
+
font-family: 'Material Icons';
|
|
758
|
+
font-weight: normal;
|
|
759
|
+
font-style: normal;
|
|
760
|
+
font-size: 24px;
|
|
761
|
+
display: inline-block;
|
|
762
|
+
line-height: 1;
|
|
763
|
+
text-transform: none;
|
|
764
|
+
letter-spacing: normal;
|
|
765
|
+
word-wrap: normal;
|
|
766
|
+
white-space: nowrap;
|
|
767
|
+
direction: ltr;
|
|
768
|
+
|
|
769
|
+
/* Optional: use this for better rendering */
|
|
770
|
+
-webkit-font-smoothing: antialiased;
|
|
771
|
+
text-rendering: optimizeLegibility;
|
|
772
|
+
-moz-osx-font-smoothing: grayscale;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
* {
|
|
776
|
+
margin: 0;
|
|
777
|
+
padding: 0;
|
|
778
|
+
box-sizing: border-box;
|
|
779
|
+
font-family: "Poppins", sans-serif;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
[hidden] {
|
|
783
|
+
display: none;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
.center-text {
|
|
787
|
+
text-align: center;
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
.center-aligned {
|
|
791
|
+
display: flex;
|
|
792
|
+
justify-content: center;
|
|
793
|
+
align-items: center;
|
|
794
|
+
}
|
|
795
|
+
|
|
796
|
+
.btn {
|
|
797
|
+
margin-right: 10px;
|
|
798
|
+
}
|
|
799
|
+
|
|
800
|
+
.page-wrapper {
|
|
801
|
+
width: 100%;
|
|
802
|
+
height: 100%;
|
|
803
|
+
flex-grow: 1;
|
|
804
|
+
min-height: 0;
|
|
805
|
+
display: flex;
|
|
806
|
+
flex-direction: column;
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
.page-wrapper[hidden] {
|
|
810
|
+
display: none !important;
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
|
|
814
|
+
.page-center {
|
|
815
|
+
margin-top: 150px;
|
|
816
|
+
text-align: center;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
.lds-dual-ring {
|
|
820
|
+
display: inline-block;
|
|
821
|
+
width: 80px;
|
|
822
|
+
height: 80px;
|
|
823
|
+
margin-left: auto;
|
|
824
|
+
margin-right: auto;
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
.lds-dual-ring:after {
|
|
828
|
+
content: " ";
|
|
829
|
+
display: block;
|
|
830
|
+
width: 64px;
|
|
831
|
+
height: 64px;
|
|
832
|
+
margin: 8px;
|
|
833
|
+
border-radius: 50%;
|
|
834
|
+
border: 6px solid var(--secondary-color, #801bea);
|
|
835
|
+
border-color: var(--secondary-color, #801bea) transparent var(--secondary-color, #801bea) transparent;
|
|
836
|
+
animation: lds-dual-ring 1.2s linear infinite;
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
.lds-dual-ring.small {
|
|
840
|
+
width: 40px;
|
|
841
|
+
height: 40px;
|
|
842
|
+
}
|
|
843
|
+
|
|
844
|
+
.lds-dual-ring.small:after {
|
|
845
|
+
width: 32px;
|
|
846
|
+
height: 32px;
|
|
847
|
+
margin: 4px;
|
|
848
|
+
border-width: 4px;
|
|
849
|
+
}
|
|
850
|
+
|
|
851
|
+
@keyframes lds-dual-ring {
|
|
852
|
+
0% {
|
|
853
|
+
transform: rotate(0deg);
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
100% {
|
|
857
|
+
transform: rotate(360deg);
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
.error-icon {
|
|
862
|
+
color: #f8d7da;
|
|
863
|
+
font-size: 96px;
|
|
864
|
+
}
|
|
865
|
+
|
|
866
|
+
.test-mode-states {
|
|
867
|
+
display: flex;
|
|
868
|
+
flex-direction: column;
|
|
869
|
+
justify-content: center;
|
|
870
|
+
height: 100%;
|
|
871
|
+
margin: 20px;
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
`,qt=_`
|
|
875
|
+
#chatbot-container {
|
|
876
|
+
height: 100%;
|
|
877
|
+
width: 100%;
|
|
878
|
+
max-height: 100vh;
|
|
879
|
+
max-width: 100vw;
|
|
880
|
+
margin: 0;
|
|
881
|
+
padding: 0;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
/* Test mode: show module/states panel beside chatbot (embedded only) */
|
|
885
|
+
#chatbot-container.embedded .chatbot-layout.with-test-stats {
|
|
886
|
+
display: flex;
|
|
887
|
+
align-items: stretch;
|
|
888
|
+
justify-content: center;
|
|
889
|
+
gap: 12px;
|
|
890
|
+
width: 100%;
|
|
891
|
+
height: 100%;
|
|
892
|
+
box-sizing: border-box;
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
#chatbot-container.embedded .chatbot-layout.with-test-stats .test-mode-states {
|
|
896
|
+
flex: 0 0 min(340px, 45%);
|
|
897
|
+
max-height: 100%;
|
|
898
|
+
overflow: auto;
|
|
899
|
+
margin: 0;
|
|
900
|
+
}
|
|
901
|
+
|
|
902
|
+
#chatbot-toggler {
|
|
903
|
+
position: fixed;
|
|
904
|
+
bottom: 30px;
|
|
905
|
+
right: 35px;
|
|
906
|
+
outline: none;
|
|
907
|
+
border: none;
|
|
908
|
+
height: 72px; /* slightly larger for better visibility */
|
|
909
|
+
width: 72px; /* slightly larger for better visibility */
|
|
910
|
+
display: flex;
|
|
911
|
+
cursor: pointer;
|
|
912
|
+
align-items: center;
|
|
913
|
+
justify-content: center;
|
|
914
|
+
border-radius: 50%;
|
|
915
|
+
background: var(--secondary-color, #801bea);
|
|
916
|
+
color: var(--text-color-secondary-bg, #fff); /* controls inline SVG/logo and close icon color */
|
|
917
|
+
transition: all 0.2s ease;
|
|
918
|
+
z-index: var(--z-toggler);
|
|
919
|
+
user-select: none; /* avoid text selection */
|
|
920
|
+
-webkit-user-select: none;
|
|
921
|
+
-ms-user-select: none;
|
|
922
|
+
-moz-user-select: none;
|
|
923
|
+
caret-color: transparent; /* hide blinking caret when focused */
|
|
924
|
+
-webkit-tap-highlight-color: transparent; /* remove mobile tap highlight */
|
|
925
|
+
-webkit-appearance: none;
|
|
926
|
+
-moz-appearance: none;
|
|
927
|
+
appearance: none;
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
#chatbot-container.show-chatbot #chatbot-toggler {
|
|
931
|
+
transform: rotate(90deg);
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
/* Center immediate children (icon and close glyph) and disable pointer events on them */
|
|
935
|
+
#chatbot-toggler > * {
|
|
936
|
+
position: absolute;
|
|
937
|
+
pointer-events: none; /* ensure clicks hit the button, not the icon/svg */
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
/* Material icon sizing (close icon) */
|
|
941
|
+
#chatbot-toggler > span {
|
|
942
|
+
color: currentColor; /* inherit from button color variable */
|
|
943
|
+
font-size: 34px; /* scale icon with larger button */
|
|
944
|
+
}
|
|
945
|
+
|
|
946
|
+
/* Size the inline SVG logo to fit the button */
|
|
947
|
+
#chatbot-toggler > svg {
|
|
948
|
+
width: var(--toggler-icon-size, 38px);
|
|
949
|
+
height: var(--toggler-icon-size, 38px);
|
|
950
|
+
display: block;
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
|
|
954
|
+
#chatbot-toggler > :last-child,
|
|
955
|
+
#chatbot-container.show-chatbot #chatbot-toggler > :first-child {
|
|
956
|
+
opacity: 0;
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
#chatbot-container.show-chatbot #chatbot-toggler > :last-child {
|
|
960
|
+
opacity: 1;
|
|
961
|
+
}
|
|
962
|
+
|
|
963
|
+
.chatbot {
|
|
964
|
+
position: fixed;
|
|
965
|
+
right: 35px;
|
|
966
|
+
bottom: 112px; /* toggler bottom (30) + toggler size (72) + 10px clearance */
|
|
967
|
+
max-height: var(--chatbot-max-height, calc(100vh - 100px));
|
|
968
|
+
background: #F8F8FF;
|
|
969
|
+
border-radius: var(--corner-radius, 15px);
|
|
970
|
+
overflow: hidden;
|
|
971
|
+
opacity: 0;
|
|
972
|
+
pointer-events: none;
|
|
973
|
+
transform: scale(0.5);
|
|
974
|
+
transform-origin: bottom right;
|
|
975
|
+
box-shadow: 0 0 128px 0 rgba(0, 0, 0, 0.1), 0 32px 64px -48px rgba(0, 0, 0, 0.5);
|
|
976
|
+
transition: all 0.1s ease;
|
|
977
|
+
z-index: var(--z-chatbot);
|
|
978
|
+
display: flex;
|
|
979
|
+
flex-direction: column;
|
|
980
|
+
align-items: center;
|
|
981
|
+
/* width/height are now set inline by JS; allow flex to handle internals */
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
/* Global cursor policy inside chatbot: default everywhere, text only in inputs, pointer for clickable */
|
|
985
|
+
.chatbot :where(*) {
|
|
986
|
+
cursor: default;
|
|
987
|
+
caret-color: transparent; /* hide blinking caret by default */
|
|
988
|
+
}
|
|
989
|
+
.chatbot :where(input, textarea) {
|
|
990
|
+
cursor: text;
|
|
991
|
+
caret-color: auto; /* allow caret in real text fields */
|
|
992
|
+
}
|
|
993
|
+
.chatbot :where(button, a, [role="button"], .clickable, .voice-visualizer, .restart-button, .stop-button, .last-message-button, .input-toggle-button, .close-icon, .menu-icon, #chat_send_button, #typing_send_button) {
|
|
994
|
+
cursor: pointer;
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
|
|
998
|
+
#chatbot-container.show-chatbot .chatbot {
|
|
999
|
+
opacity: 1;
|
|
1000
|
+
pointer-events: auto;
|
|
1001
|
+
transform: scale(1);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
#chatbot-container.embedded .chatbot {
|
|
1005
|
+
position: relative;
|
|
1006
|
+
right: 0;
|
|
1007
|
+
bottom: 0;
|
|
1008
|
+
transform: scale(1);
|
|
1009
|
+
opacity: 1;
|
|
1010
|
+
pointer-events: auto;
|
|
1011
|
+
z-index: auto;
|
|
1012
|
+
width: 100%;
|
|
1013
|
+
height: 100%;
|
|
1014
|
+
max-height: 100%;
|
|
1015
|
+
min-height: 420px; /* safety: ensures decent space before JS computes height */
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
#chatbot-container .chatbot.mobile {
|
|
1019
|
+
position: fixed;
|
|
1020
|
+
top: var(--chatbot-dynamic-top, 0) !important;
|
|
1021
|
+
right: 0;
|
|
1022
|
+
bottom: auto;
|
|
1023
|
+
left: 0;
|
|
1024
|
+
margin: 0 !important;
|
|
1025
|
+
width: 100vw !important;
|
|
1026
|
+
max-width: 100vw !important;
|
|
1027
|
+
/* Fallback to dynamic height CSS var when dvh unsupported */
|
|
1028
|
+
height: calc(var(--chatbot-dynamic-height, 100vh) - var(--chatbot-bottom-offset, 0px)) !important;
|
|
1029
|
+
max-height: calc(var(--chatbot-dynamic-height, 100vh) - var(--chatbot-bottom-offset, 0px)) !important;
|
|
1030
|
+
/* Prefer dvh for accurate viewport height on mobile */
|
|
1031
|
+
height: calc(100dvh - var(--chatbot-bottom-offset, 0px)) !important;
|
|
1032
|
+
max-height: calc(100dvh - var(--chatbot-bottom-offset, 0px)) !important;
|
|
1033
|
+
border-radius: 0;
|
|
1034
|
+
transform: none !important;
|
|
1035
|
+
opacity: 1;
|
|
1036
|
+
pointer-events: auto;
|
|
1037
|
+
z-index: var(--z-chatbot);
|
|
1038
|
+
overflow: hidden;
|
|
1039
|
+
}
|
|
1040
|
+
|
|
1041
|
+
#chatbot-container .chatbot.page {
|
|
1042
|
+
position: fixed;
|
|
1043
|
+
height: 100%;
|
|
1044
|
+
max-height: 100vh !important;
|
|
1045
|
+
border-radius: 0;
|
|
1046
|
+
transform: none;
|
|
1047
|
+
opacity: 1;
|
|
1048
|
+
pointer-events: auto;
|
|
1049
|
+
z-index: var(--z-chatbot);
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
.chatbot :where(.avatarbox, .chatbox, .chatbot-body, textarea, .last-message-content)::-webkit-scrollbar {
|
|
1053
|
+
width: 6px;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
.chatbot :where(.avatarbox, .chatbox, .chatbot-body, textarea, .last-message-content)::-webkit-scrollbar-track {
|
|
1057
|
+
background: #fff;
|
|
1058
|
+
border-radius: 25px;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
.chatbot :where(.avatarbox, .chatbox, .chatbot-body, textarea, .last-message-content)::-webkit-scrollbar-thumb {
|
|
1062
|
+
background: #ccc;
|
|
1063
|
+
border-radius: 25px;
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
.chatbot-body {
|
|
1067
|
+
width: 100%;
|
|
1068
|
+
height: 100%;
|
|
1069
|
+
overflow-y: auto;
|
|
1070
|
+
overflow-x: hidden;
|
|
1071
|
+
min-height: 0;
|
|
1072
|
+
flex-grow: 1;
|
|
1073
|
+
position: relative;
|
|
1074
|
+
display: flex;
|
|
1075
|
+
flex-direction: column;
|
|
1076
|
+
/* align-items: center;*/
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
.chatbot-body.chat-mode, .chatbot-body.compact {
|
|
1080
|
+
overflow-y: auto;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
.chatbot-body.mobile {
|
|
1084
|
+
height: 100%;
|
|
1085
|
+
width: 100%;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
@media (max-width: 768px) {
|
|
1089
|
+
#chatbot-toggler {
|
|
1090
|
+
right: 20px;
|
|
1091
|
+
bottom: 20px;
|
|
1092
|
+
}
|
|
1093
|
+
|
|
1094
|
+
#chatbot-container.show-chatbot #chatbot-toggler {
|
|
1095
|
+
display: none !important;
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
#chatbot-container.show-chatbot:not(.embedded) .chatbot {
|
|
1099
|
+
position: fixed;
|
|
1100
|
+
top: var(--chatbot-dynamic-top, 0);
|
|
1101
|
+
left: 0;
|
|
1102
|
+
bottom: auto;
|
|
1103
|
+
width: 100vw;
|
|
1104
|
+
/* Fallback to dynamic height CSS var when dvh unsupported */
|
|
1105
|
+
height: calc(var(--chatbot-dynamic-height, 100vh) - var(--chatbot-bottom-offset, 0px));
|
|
1106
|
+
max-height: calc(var(--chatbot-dynamic-height, 100vh) - var(--chatbot-bottom-offset, 0px));
|
|
1107
|
+
/* Prefer dvh; provide fallback CSS var */
|
|
1108
|
+
height: calc(100dvh - var(--chatbot-bottom-offset, 0px));
|
|
1109
|
+
max-height: calc(100dvh - var(--chatbot-bottom-offset, 0px));
|
|
1110
|
+
border-radius: 0;
|
|
1111
|
+
transform: none;
|
|
1112
|
+
display: flex;
|
|
1113
|
+
flex-direction: column;
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
#chatbot-container.embedded .chatbot {
|
|
1117
|
+
position: relative;
|
|
1118
|
+
width: 100%;
|
|
1119
|
+
height: 100%;
|
|
1120
|
+
max-width: 100%;
|
|
1121
|
+
|
|
1122
|
+
}
|
|
1123
|
+
|
|
1124
|
+
.chatbot-body {
|
|
1125
|
+
flex-grow: 1;
|
|
1126
|
+
min-height: 0;
|
|
1127
|
+
width: 100%;
|
|
1128
|
+
overflow-y: auto;
|
|
1129
|
+
overflow-x: hidden;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
`,Gt=_`
|
|
1135
|
+
.chatbot header {
|
|
1136
|
+
padding: 16px 0;
|
|
1137
|
+
text-align: center;
|
|
1138
|
+
color: #fff;
|
|
1139
|
+
background: var(--secondary-color, #801bea);
|
|
1140
|
+
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
|
|
1141
|
+
flex: none;
|
|
1142
|
+
width: 100%;
|
|
1143
|
+
min-height: 90px;
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
.chatbot header .header-container {
|
|
1147
|
+
display: flex;
|
|
1148
|
+
justify-content: space-between;
|
|
1149
|
+
align-items: end;
|
|
1150
|
+
width: 100%;
|
|
1151
|
+
margin: 0 auto;
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
.chatbot header .header-left, .chatbot header .header-right {
|
|
1155
|
+
margin: 10px;
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
.header-right {
|
|
1159
|
+
display: flex;
|
|
1160
|
+
flex-direction: column;
|
|
1161
|
+
justify-content: flex-start;
|
|
1162
|
+
align-items: end;
|
|
1163
|
+
gap: 10px;
|
|
1164
|
+
}
|
|
1165
|
+
|
|
1166
|
+
#avatar-name {
|
|
1167
|
+
font-size: 18px;
|
|
1168
|
+
margin-bottom: 10px;
|
|
1169
|
+
color: var(--text-color-secondary-bg, white);
|
|
1170
|
+
}
|
|
1171
|
+
|
|
1172
|
+
.logo-image {
|
|
1173
|
+
max-height: 30px;
|
|
1174
|
+
/* Maximum height for the logo */
|
|
1175
|
+
width: auto;
|
|
1176
|
+
/* Maintain aspect ratio */
|
|
1177
|
+
}
|
|
1178
|
+
|
|
1179
|
+
.header-right .close-icon {
|
|
1180
|
+
cursor: pointer;
|
|
1181
|
+
}
|
|
1182
|
+
|
|
1183
|
+
.header-left .menu-icon {
|
|
1184
|
+
display: block;
|
|
1185
|
+
cursor: pointer;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
/* menu */
|
|
1190
|
+
|
|
1191
|
+
.menu-backdrop {
|
|
1192
|
+
position: fixed;
|
|
1193
|
+
top: 0;
|
|
1194
|
+
bottom: 0;
|
|
1195
|
+
left: 0;
|
|
1196
|
+
right: 0;
|
|
1197
|
+
/* Backdrop should sit above alerts and status bar but below the menu panel */
|
|
1198
|
+
z-index: var(--z-menu-backdrop);
|
|
1199
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
1200
|
+
}
|
|
1201
|
+
|
|
1202
|
+
#menu {
|
|
1203
|
+
position: absolute;
|
|
1204
|
+
background-color: #f9f9f9;
|
|
1205
|
+
min-width: 200px;
|
|
1206
|
+
box-shadow: 0px 8px 16px 0px rgba(0, 0, 0, 0.2);
|
|
1207
|
+
padding: 12px 8px;
|
|
1208
|
+
/* Menu panel should be topmost among app chrome */
|
|
1209
|
+
z-index: var(--z-menu);
|
|
1210
|
+
border-radius: 10px;
|
|
1211
|
+
animation: fadeIn 0.5s;
|
|
1212
|
+
display: none; /* Initially hide the menu */
|
|
1213
|
+
opacity: 0; /* Ensure opacity is set to 0 initially */
|
|
1214
|
+
visibility: hidden; /* Ensure visibility is set to hidden initially */
|
|
1215
|
+
transition: opacity 0.5s, visibility 0.5s, display 0s 0.5s;
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
|
|
1219
|
+
#menu.show {
|
|
1220
|
+
opacity: 1;
|
|
1221
|
+
visibility: visible;
|
|
1222
|
+
display: block;
|
|
1223
|
+
transition: opacity 0.5s, visibility 0.5s;
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
#menu.hide {
|
|
1227
|
+
opacity: 0;
|
|
1228
|
+
visibility: hidden;
|
|
1229
|
+
display: none; /* Ensure menu is hidden from layout */
|
|
1230
|
+
transition: opacity 0.5s, visibility 0.5s, display 0s 0.5s; /* Delay display change */
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
|
|
1234
|
+
@keyframes fadeIn {
|
|
1235
|
+
0% {
|
|
1236
|
+
opacity: 0;
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
100% {
|
|
1240
|
+
opacity: 1;
|
|
1241
|
+
}
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
@keyframes fadeOut {
|
|
1245
|
+
0% {
|
|
1246
|
+
opacity: 1;
|
|
1247
|
+
}
|
|
1248
|
+
|
|
1249
|
+
100% {
|
|
1250
|
+
opacity: 0;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
#menu label {
|
|
1257
|
+
color: black;
|
|
1258
|
+
margin-bottom: 8px;
|
|
1259
|
+
display: inline-block;
|
|
1260
|
+
font-weight: 400;
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
.menu-items>div,
|
|
1264
|
+
.menu-items a {
|
|
1265
|
+
text-align: start;
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
#menu .menu-items a {
|
|
1269
|
+
color: black;
|
|
1270
|
+
padding: 12px 8px;
|
|
1271
|
+
text-decoration: none;
|
|
1272
|
+
display: block;
|
|
1273
|
+
text-align: start;
|
|
1274
|
+
white-space: nowrap;
|
|
1275
|
+
}
|
|
1276
|
+
|
|
1277
|
+
/* Menu button styling - matches anchor tag appearance */
|
|
1278
|
+
#menu .menu-items .menu-button {
|
|
1279
|
+
color: black;
|
|
1280
|
+
padding: 12px 8px;
|
|
1281
|
+
text-decoration: none;
|
|
1282
|
+
display: block;
|
|
1283
|
+
text-align: start;
|
|
1284
|
+
white-space: nowrap;
|
|
1285
|
+
background: none;
|
|
1286
|
+
border: none;
|
|
1287
|
+
cursor: pointer;
|
|
1288
|
+
font-size: inherit;
|
|
1289
|
+
font-family: inherit;
|
|
1290
|
+
width: 100%;
|
|
1291
|
+
}
|
|
1292
|
+
|
|
1293
|
+
#menu .menu-items .menu-button:hover {
|
|
1294
|
+
background-color: rgba(0, 0, 0, 0.05);
|
|
1295
|
+
}
|
|
1296
|
+
|
|
1297
|
+
#menu .menu-items hr {
|
|
1298
|
+
border: none;
|
|
1299
|
+
border-top: 1px solid #d3d3d3;
|
|
1300
|
+
background: transparent;
|
|
1301
|
+
margin: 8px 0;
|
|
1302
|
+
width: 100%;
|
|
1303
|
+
}
|
|
1304
|
+
|
|
1305
|
+
#menu:not([hidden]) {
|
|
1306
|
+
display: block;
|
|
1307
|
+
}
|
|
1308
|
+
|
|
1309
|
+
|
|
1310
|
+
|
|
1311
|
+
.conversation-details {
|
|
1312
|
+
display: inline-block;
|
|
1313
|
+
background-color: rgba(0, 0, 0, 0.3);
|
|
1314
|
+
border-radius: 12px;
|
|
1315
|
+
padding: 4px 12px;
|
|
1316
|
+
margin-top: 2px;
|
|
1317
|
+
margin-bottom: 8px;
|
|
1318
|
+
}
|
|
1319
|
+
|
|
1320
|
+
.conversation-status small {
|
|
1321
|
+
color: rgba(255, 255, 255, 0.9);
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
|
|
1325
|
+
/* mode switch */
|
|
1326
|
+
|
|
1327
|
+
.switches-container {
|
|
1328
|
+
width: 12rem;
|
|
1329
|
+
position: relative;
|
|
1330
|
+
display: flex;
|
|
1331
|
+
padding: 0;
|
|
1332
|
+
position: relative;
|
|
1333
|
+
background: var(--primary-color, #00bfdb);
|
|
1334
|
+
line-height: 2rem;
|
|
1335
|
+
border-radius: 2rem;
|
|
1336
|
+
margin-left: auto;
|
|
1337
|
+
margin-right: auto;
|
|
1338
|
+
}
|
|
1339
|
+
|
|
1340
|
+
/* input (radio) for toggling. hidden - use labels for clicking on */
|
|
1341
|
+
.switches-container input {
|
|
1342
|
+
visibility: hidden;
|
|
1343
|
+
position: absolute;
|
|
1344
|
+
top: 0;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/* labels for the input (radio) boxes - something to click on */
|
|
1348
|
+
.switches-container label {
|
|
1349
|
+
width: 50%;
|
|
1350
|
+
padding: 0;
|
|
1351
|
+
margin: 0;
|
|
1352
|
+
text-align: center;
|
|
1353
|
+
cursor: pointer;
|
|
1354
|
+
color: var(--text-color-primary-bg, white);
|
|
1355
|
+
position: relative;
|
|
1356
|
+
z-index: 1;
|
|
1357
|
+
}
|
|
1358
|
+
|
|
1359
|
+
.menu-switch-container .switches-container label {
|
|
1360
|
+
color: #333; /* Dark text for light menu background */
|
|
1361
|
+
}
|
|
1362
|
+
|
|
1363
|
+
/* switch highlighters wrapper (sliding left / right)
|
|
1364
|
+
- need wrapper to enable the even margins around the highlight box
|
|
1365
|
+
*/
|
|
1366
|
+
.switch-wrapper {
|
|
1367
|
+
position: absolute;
|
|
1368
|
+
top: 0;
|
|
1369
|
+
bottom: 0;
|
|
1370
|
+
width: 50%;
|
|
1371
|
+
padding: 0.1rem;
|
|
1372
|
+
z-index: 3;
|
|
1373
|
+
pointer-events: none;
|
|
1374
|
+
transition: transform .5s cubic-bezier(.77, 0, .175, 1);
|
|
1375
|
+
/* transition: transform 1s; */
|
|
1376
|
+
}
|
|
1377
|
+
|
|
1378
|
+
/* switch box highlighter */
|
|
1379
|
+
.switch {
|
|
1380
|
+
border-radius: 1.5rem;
|
|
1381
|
+
background: white;
|
|
1382
|
+
height: 100%;
|
|
1383
|
+
width: 100%;
|
|
1384
|
+
font-weight: bold;
|
|
1385
|
+
pointer-events: none;
|
|
1386
|
+
}
|
|
1387
|
+
|
|
1388
|
+
.menu-switch-container .switch {
|
|
1389
|
+
background: var(--secondary-color, #801bea); /* Colored highlight for menu */
|
|
1390
|
+
}
|
|
1391
|
+
|
|
1392
|
+
/* switch box labels
|
|
1393
|
+
- default setup
|
|
1394
|
+
- toggle afterwards based on radio:checked status
|
|
1395
|
+
*/
|
|
1396
|
+
.switch div {
|
|
1397
|
+
width: 100%;
|
|
1398
|
+
text-align: center;
|
|
1399
|
+
opacity: 0;
|
|
1400
|
+
display: block;
|
|
1401
|
+
color: var(--secondary-color, #00bfdb);
|
|
1402
|
+
transition: opacity .2s cubic-bezier(.77, 0, .175, 1) .125s;
|
|
1403
|
+
will-change: opacity;
|
|
1404
|
+
position: absolute;
|
|
1405
|
+
top: 0;
|
|
1406
|
+
left: 0;
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
.menu-switch-container .switch div {
|
|
1410
|
+
color: white; /* White text on colored highlight */
|
|
1411
|
+
}
|
|
1412
|
+
|
|
1413
|
+
/* slide the switch box from right to left */
|
|
1414
|
+
.switches-container input:nth-of-type(1):checked~.switch-wrapper {
|
|
1415
|
+
transform: translateX(0%);
|
|
1416
|
+
}
|
|
1417
|
+
|
|
1418
|
+
/* slide the switch box from left to right */
|
|
1419
|
+
.switches-container input:nth-of-type(2):checked~.switch-wrapper {
|
|
1420
|
+
transform: translateX(100%);
|
|
1421
|
+
}
|
|
1422
|
+
|
|
1423
|
+
/* toggle the switch box labels - first checkbox:checked - show first switch div */
|
|
1424
|
+
.switches-container input:nth-of-type(1):checked~.switch-wrapper .switch div:nth-of-type(1) {
|
|
1425
|
+
opacity: 1;
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
/* toggle the switch box labels - second checkbox:checked - show second switch div */
|
|
1429
|
+
.switches-container input:nth-of-type(2):checked~.switch-wrapper .switch div:nth-of-type(2) {
|
|
1430
|
+
opacity: 1;
|
|
1431
|
+
}
|
|
1432
|
+
|
|
1433
|
+
.labels-container {
|
|
1434
|
+
display: flex;
|
|
1435
|
+
justify-content: space-between;
|
|
1436
|
+
align-items: center;
|
|
1437
|
+
gap: 10px;
|
|
1438
|
+
color: black;
|
|
1439
|
+
padding: 12px 8px;
|
|
1440
|
+
text-decoration: none;
|
|
1441
|
+
white-space: nowrap;
|
|
1442
|
+
}
|
|
1443
|
+
|
|
1444
|
+
.menu-switch-container {
|
|
1445
|
+
padding: 12px 8px;
|
|
1446
|
+
}
|
|
1447
|
+
|
|
1448
|
+
.menu-switch-container .switches-container {
|
|
1449
|
+
background: #eee; /* Light background for the track in menu */
|
|
1450
|
+
border: 1px solid #ddd;
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
.captions-switch {
|
|
1454
|
+
position: relative;
|
|
1455
|
+
display: inline-block;
|
|
1456
|
+
width: 45px;
|
|
1457
|
+
height: 26px;
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
.captions-switch input {
|
|
1461
|
+
opacity: 0;
|
|
1462
|
+
width: 0;
|
|
1463
|
+
height: 0;
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1466
|
+
.captions-slider {
|
|
1467
|
+
position: absolute;
|
|
1468
|
+
cursor: pointer;
|
|
1469
|
+
top: 0;
|
|
1470
|
+
left: 0;
|
|
1471
|
+
right: 0;
|
|
1472
|
+
bottom: 0;
|
|
1473
|
+
background-color: #ccc;
|
|
1474
|
+
-webkit-transition: .4s;
|
|
1475
|
+
transition: .4s;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
.captions-slider:before {
|
|
1479
|
+
position: absolute;
|
|
1480
|
+
content: "";
|
|
1481
|
+
height: 20px;
|
|
1482
|
+
width: 20px;
|
|
1483
|
+
left: 3px;
|
|
1484
|
+
bottom: 3px;
|
|
1485
|
+
background-color: white;
|
|
1486
|
+
-webkit-transition: .4s;
|
|
1487
|
+
transition: .4s;
|
|
1488
|
+
}
|
|
1489
|
+
|
|
1490
|
+
input:checked+.captions-slider {
|
|
1491
|
+
background-color: var(--secondary-color, #801bea);
|
|
1492
|
+
}
|
|
1493
|
+
|
|
1494
|
+
input:focus+.captions-slider {
|
|
1495
|
+
box-shadow: 0 0 1px var(--secondary-color, #801bea);
|
|
1496
|
+
}
|
|
1497
|
+
|
|
1498
|
+
input:checked+.captions-slider:before {
|
|
1499
|
+
-webkit-transform: translateX(20px);
|
|
1500
|
+
-ms-transform: translateX(20px);
|
|
1501
|
+
transform: translateX(20px);
|
|
1502
|
+
}
|
|
1503
|
+
|
|
1504
|
+
.captions-slider.round {
|
|
1505
|
+
border-radius: 28px;
|
|
1506
|
+
}
|
|
1507
|
+
|
|
1508
|
+
.captions-slider.round:before {
|
|
1509
|
+
border-radius: 50%;
|
|
1510
|
+
}
|
|
1511
|
+
`,Wt=_`
|
|
1512
|
+
|
|
1513
|
+
.avatar-wrapper {
|
|
1514
|
+
position: relative;
|
|
1515
|
+
display: flex;
|
|
1516
|
+
flex-direction: column;
|
|
1517
|
+
/* Let flex manage spacing */
|
|
1518
|
+
height: 100%;
|
|
1519
|
+
width: 100%;
|
|
1520
|
+
overflow: hidden;
|
|
1521
|
+
flex-grow: 1;
|
|
1522
|
+
min-height: 0;
|
|
1523
|
+
}
|
|
1524
|
+
|
|
1525
|
+
.chatbot .avatarbox {
|
|
1526
|
+
display: flex;
|
|
1527
|
+
flex-direction: column;
|
|
1528
|
+
align-items: center;
|
|
1529
|
+
justify-content: center;
|
|
1530
|
+
width: 100%;
|
|
1531
|
+
/* Let flex grow fill remaining height */
|
|
1532
|
+
flex-grow: 1;
|
|
1533
|
+
min-height: 0;
|
|
1534
|
+
position: relative;
|
|
1535
|
+
overflow: hidden;
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
#avatar-container {
|
|
1539
|
+
width: 100%;
|
|
1540
|
+
height: 100%;
|
|
1541
|
+
margin: 0;
|
|
1542
|
+
padding: 0;
|
|
1543
|
+
display: flex;
|
|
1544
|
+
align-items: center;
|
|
1545
|
+
justify-content: center;
|
|
1546
|
+
overflow: hidden;
|
|
1547
|
+
box-sizing: border-box;
|
|
1548
|
+
}
|
|
1549
|
+
|
|
1550
|
+
/* No special casing needed for embedded mode */
|
|
1551
|
+
|
|
1552
|
+
#avatar-container canvas {
|
|
1553
|
+
max-width: 100%;
|
|
1554
|
+
max-height: 100%;
|
|
1555
|
+
/* width/height set by renderer via ResizeObserver */
|
|
1556
|
+
display: block;
|
|
1557
|
+
touch-action: auto;
|
|
1558
|
+
}
|
|
1559
|
+
|
|
1560
|
+
/* ========================================
|
|
1561
|
+
* STATUS BAR - Reactive template component
|
|
1562
|
+
* ======================================== */
|
|
1563
|
+
/* Embedded status bar overlay (single, non-dismissable) */
|
|
1564
|
+
.chatbot-body > .status-bar {
|
|
1565
|
+
width: 100%;
|
|
1566
|
+
max-width: 100%;
|
|
1567
|
+
min-height: 36px;
|
|
1568
|
+
padding: 8px 16px;
|
|
1569
|
+
border-radius: 0;
|
|
1570
|
+
font-weight: 600;
|
|
1571
|
+
text-align: center;
|
|
1572
|
+
border: 1px solid transparent;
|
|
1573
|
+
pointer-events: none; /* never block avatar controls/icons */
|
|
1574
|
+
display: flex;
|
|
1575
|
+
align-items: center;
|
|
1576
|
+
justify-content: center;
|
|
1577
|
+
position: absolute;
|
|
1578
|
+
top: 0;
|
|
1579
|
+
left: 0;
|
|
1580
|
+
right: 0;
|
|
1581
|
+
z-index: var(--z-status);
|
|
1582
|
+
}
|
|
1583
|
+
|
|
1584
|
+
/* Status bar variants */
|
|
1585
|
+
.chatbot-body > .status-bar.status--initializing {
|
|
1586
|
+
color: #664d03;
|
|
1587
|
+
background-color: #fff3cd;
|
|
1588
|
+
border-color: #ffe69c;
|
|
1589
|
+
}
|
|
1590
|
+
.chatbot-body > .status-bar.status--recovering {
|
|
1591
|
+
color: #664d03;
|
|
1592
|
+
background-color: #fff3cd;
|
|
1593
|
+
border-color: #ffe69c;
|
|
1594
|
+
}
|
|
1595
|
+
.chatbot-body > .status-bar.status--disconnected,
|
|
1596
|
+
.chatbot-body > .status-bar.status--failed,
|
|
1597
|
+
.chatbot-body > .status-bar.status--invalidConfiguration {
|
|
1598
|
+
color: #58151c;
|
|
1599
|
+
background-color: #f8d7da;
|
|
1600
|
+
border-color: #f1aeb5;
|
|
1601
|
+
}
|
|
1602
|
+
|
|
1603
|
+
/* ========================================
|
|
1604
|
+
* TOASTIFY DISMISSABLE ALERTS - Managed by Alerts.js
|
|
1605
|
+
* ======================================== */
|
|
1606
|
+
#toastify-container,
|
|
1607
|
+
#toastify-dismissable-alerts {
|
|
1608
|
+
position: absolute;
|
|
1609
|
+
top: 0;
|
|
1610
|
+
left: 0;
|
|
1611
|
+
right: 0;
|
|
1612
|
+
display: flex;
|
|
1613
|
+
flex-direction: column;
|
|
1614
|
+
align-items: center;
|
|
1615
|
+
gap: 8px;
|
|
1616
|
+
padding: 12px 16px 0;
|
|
1617
|
+
pointer-events: none;
|
|
1618
|
+
z-index: var(--z-toasts);
|
|
1619
|
+
}
|
|
1620
|
+
|
|
1621
|
+
#toastify-container .toastify,
|
|
1622
|
+
#toastify-dismissable-alerts .toastify {
|
|
1623
|
+
width: min(420px, calc(100% - 32px));
|
|
1624
|
+
pointer-events: auto;
|
|
1625
|
+
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
|
|
1626
|
+
border-radius: 12px;
|
|
1627
|
+
overflow: hidden;
|
|
1628
|
+
}
|
|
1629
|
+
|
|
1630
|
+
.alert-danger {
|
|
1631
|
+
color: #721c24;
|
|
1632
|
+
background-color: #f8d7da;
|
|
1633
|
+
border-color: #f5c6cb;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.alert-warning {
|
|
1637
|
+
color: #856404;
|
|
1638
|
+
background-color: #fff3cd;
|
|
1639
|
+
border-color: #ffeeba;
|
|
1640
|
+
}
|
|
1641
|
+
|
|
1642
|
+
.alert {
|
|
1643
|
+
position: relative;
|
|
1644
|
+
padding: .75rem 1.25rem;
|
|
1645
|
+
margin-bottom: 1rem;
|
|
1646
|
+
border: 1px solid transparent;
|
|
1647
|
+
border-radius: .25rem;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
.toast-close {
|
|
1651
|
+
font-weight: bold;
|
|
1652
|
+
font-size: 18px;
|
|
1653
|
+
background: transparent;
|
|
1654
|
+
border: none;
|
|
1655
|
+
margin: 5px;
|
|
1656
|
+
}
|
|
1657
|
+
|
|
1658
|
+
.voice-controls-container {
|
|
1659
|
+
display: flex;
|
|
1660
|
+
flex-direction: column;
|
|
1661
|
+
width: 100%;
|
|
1662
|
+
align-items: center;
|
|
1663
|
+
justify-content: center;
|
|
1664
|
+
flex-shrink: 0;
|
|
1665
|
+
position: absolute;
|
|
1666
|
+
bottom: 10px;
|
|
1667
|
+
left: 0;
|
|
1668
|
+
right: 0;
|
|
1669
|
+
pointer-events: none; /* Allow clicks through to canvas */
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
.voice-controls-container > * {
|
|
1673
|
+
pointer-events: auto; /* Re-enable clicks on actual controls */
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1676
|
+
.button-container {
|
|
1677
|
+
display: flex;
|
|
1678
|
+
justify-content: center;
|
|
1679
|
+
align-items: center;
|
|
1680
|
+
position: relative;
|
|
1681
|
+
min-height: 40px;
|
|
1682
|
+
}
|
|
1683
|
+
|
|
1684
|
+
/* Only show glass background when conversation is active (has visualizer) */
|
|
1685
|
+
.button-container.active-conversation {
|
|
1686
|
+
background: rgba(255, 255, 255, 1);
|
|
1687
|
+
backdrop-filter: blur(8px);
|
|
1688
|
+
border-radius: 35px;
|
|
1689
|
+
padding: 4px 16px;
|
|
1690
|
+
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.12);
|
|
1691
|
+
}
|
|
1692
|
+
|
|
1693
|
+
.state-control {
|
|
1694
|
+
display: flex;
|
|
1695
|
+
justify-content: center;
|
|
1696
|
+
align-items: center;
|
|
1697
|
+
margin: 2px 12px;
|
|
1698
|
+
min-height: 40px;
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
.btn-lg {
|
|
1702
|
+
padding: .5em 1em;
|
|
1703
|
+
font-size: 1.25em;
|
|
1704
|
+
line-height: 1.5;
|
|
1705
|
+
}
|
|
1706
|
+
|
|
1707
|
+
.button-primary,
|
|
1708
|
+
.button-secondary {
|
|
1709
|
+
border-radius: 100%;
|
|
1710
|
+
border: none;
|
|
1711
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
1712
|
+
position: relative;
|
|
1713
|
+
transition: transform 0.3s, box-shadow 0.3s;
|
|
1714
|
+
}
|
|
1715
|
+
|
|
1716
|
+
.button-primary:hover,
|
|
1717
|
+
.button-secondary:hover {
|
|
1718
|
+
transform: scale(1.05);
|
|
1719
|
+
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
|
|
1720
|
+
}
|
|
1721
|
+
|
|
1722
|
+
.button-primary {
|
|
1723
|
+
padding: .7rem .7rem;
|
|
1724
|
+
background-color: var(--primary-color, #00bfdb);
|
|
1725
|
+
color: var(--text-color-primary-bg, #fff);
|
|
1726
|
+
}
|
|
1727
|
+
|
|
1728
|
+
.button-secondary {
|
|
1729
|
+
padding: .4rem .4rem;
|
|
1730
|
+
background-color: var(--secondary-color, #801bea);
|
|
1731
|
+
color: var(--text-color-secondary-bg, white);
|
|
1732
|
+
}
|
|
1733
|
+
|
|
1734
|
+
.start-button {
|
|
1735
|
+
background-color: var(--secondary-color, #801bea);
|
|
1736
|
+
border-radius: 25px;
|
|
1737
|
+
border: none;
|
|
1738
|
+
color: var(--text-color-secondary-bg, white);
|
|
1739
|
+
padding: .65rem 1.5rem;
|
|
1740
|
+
line-height: 1.4;
|
|
1741
|
+
cursor: pointer;
|
|
1742
|
+
box-shadow: 0 4px 16px rgba(128, 27, 234, 0.3);
|
|
1743
|
+
position: relative;
|
|
1744
|
+
transition: transform 0.3s, box-shadow 0.3s, background-color 0.3s;
|
|
1745
|
+
max-width: 220px;
|
|
1746
|
+
font-weight: 500;
|
|
1747
|
+
}
|
|
1748
|
+
|
|
1749
|
+
.start-button:hover {
|
|
1750
|
+
filter: brightness(90%);
|
|
1751
|
+
transform: scale(1.02);
|
|
1752
|
+
box-shadow: 0 6px 20px rgba(128, 27, 234, 0.4);
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
.voice-controls-container {
|
|
1756
|
+
/* sits over the canvas as an overlay */
|
|
1757
|
+
z-index: var(--z-controls);
|
|
1758
|
+
}
|
|
1759
|
+
|
|
1760
|
+
.restart-button {
|
|
1761
|
+
z-index: var(--z-controls);
|
|
1762
|
+
cursor: pointer;
|
|
1763
|
+
outline: none;
|
|
1764
|
+
user-select: none;
|
|
1765
|
+
margin-top: 0.5rem;
|
|
1766
|
+
background: transparent;
|
|
1767
|
+
border: none;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
.stop-button {
|
|
1771
|
+
z-index: var(--z-controls);
|
|
1772
|
+
cursor: pointer;
|
|
1773
|
+
outline: none;
|
|
1774
|
+
user-select: none;
|
|
1775
|
+
border: none;
|
|
1776
|
+
background: transparent;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
.last-message-button {
|
|
1780
|
+
z-index: var(--z-controls);
|
|
1781
|
+
cursor: pointer;
|
|
1782
|
+
outline: none;
|
|
1783
|
+
user-select: none;
|
|
1784
|
+
margin-top: 0.5rem;
|
|
1785
|
+
}
|
|
1786
|
+
|
|
1787
|
+
.switch-chat-button {
|
|
1788
|
+
z-index: var(--z-controls);
|
|
1789
|
+
cursor: pointer;
|
|
1790
|
+
outline: none;
|
|
1791
|
+
user-select: none;
|
|
1792
|
+
margin-top: 0.5rem;
|
|
1793
|
+
}
|
|
1794
|
+
|
|
1795
|
+
.time-right,
|
|
1796
|
+
.time-left {
|
|
1797
|
+
position: absolute;
|
|
1798
|
+
bottom: 5px;
|
|
1799
|
+
color: #aaa;
|
|
1800
|
+
font-size: 0.7rem;
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
.time-right {
|
|
1804
|
+
right: 10px;
|
|
1805
|
+
}
|
|
1806
|
+
|
|
1807
|
+
.time-left {
|
|
1808
|
+
left: 10px;
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
/* Live caption styles */
|
|
1812
|
+
|
|
1813
|
+
.captions-overlay {
|
|
1814
|
+
position: absolute;
|
|
1815
|
+
bottom: 100px; /* Above voice controls */
|
|
1816
|
+
width: 100%;
|
|
1817
|
+
z-index: var(--z-controls);
|
|
1818
|
+
}
|
|
1819
|
+
|
|
1820
|
+
/* Position captions overlay over the canvas without affecting layout */
|
|
1821
|
+
#captions-wrapper {
|
|
1822
|
+
position: absolute;
|
|
1823
|
+
bottom: 100px; /* Above voice controls */
|
|
1824
|
+
left: 0;
|
|
1825
|
+
right: 0;
|
|
1826
|
+
margin-left: auto;
|
|
1827
|
+
margin-right: auto;
|
|
1828
|
+
width: 90%;
|
|
1829
|
+
max-width: 500px;
|
|
1830
|
+
z-index: calc(var(--z-controls) - 1);
|
|
1831
|
+
pointer-events: none; /* allow clicks through by default */
|
|
1832
|
+
display: flex;
|
|
1833
|
+
justify-content: center;
|
|
1834
|
+
}
|
|
1835
|
+
|
|
1836
|
+
/* Allow interaction with caption bubble itself if needed */
|
|
1837
|
+
#captions-wrapper > div {
|
|
1838
|
+
pointer-events: auto;
|
|
1839
|
+
}
|
|
1840
|
+
|
|
1841
|
+
.user-live-caption,
|
|
1842
|
+
.assistant-live-caption {
|
|
1843
|
+
display: inline-block;
|
|
1844
|
+
position: relative;
|
|
1845
|
+
padding: 10px;
|
|
1846
|
+
border-radius: 15px;
|
|
1847
|
+
width: 80%;
|
|
1848
|
+
min-width: 100px;
|
|
1849
|
+
text-overflow: ellipsis;
|
|
1850
|
+
}
|
|
1851
|
+
|
|
1852
|
+
.user-live-caption {
|
|
1853
|
+
color: var(--text-color-secondary-bg, #fff);
|
|
1854
|
+
background-color: var(--secondary-color, #801bea);
|
|
1855
|
+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
|
1856
|
+
}
|
|
1857
|
+
|
|
1858
|
+
.user-live-caption::after { display: none; }
|
|
1859
|
+
|
|
1860
|
+
.assistant-live-caption {
|
|
1861
|
+
color: white !important;
|
|
1862
|
+
font-size: 1.2em;
|
|
1863
|
+
text-align: center;
|
|
1864
|
+
margin: 0 auto;
|
|
1865
|
+
}
|
|
1866
|
+
.caption-highlight {
|
|
1867
|
+
background-color: #000;
|
|
1868
|
+
padding: 0.2rem;
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1871
|
+
.caption-content {
|
|
1872
|
+
position: relative;
|
|
1873
|
+
max-height: 70vh;
|
|
1874
|
+
transition: opacity 0.3s ease, max-height 0.3s ease;
|
|
1875
|
+
opacity: 1;
|
|
1876
|
+
}
|
|
1877
|
+
|
|
1878
|
+
.caption-content.short-text {
|
|
1879
|
+
white-space: nowrap;
|
|
1880
|
+
}
|
|
1881
|
+
|
|
1882
|
+
.caption-content.long-text {
|
|
1883
|
+
display: -webkit-box;
|
|
1884
|
+
-webkit-box-orient: vertical;
|
|
1885
|
+
-webkit-line-clamp: 3;
|
|
1886
|
+
word-wrap: break-word;
|
|
1887
|
+
}
|
|
1888
|
+
|
|
1889
|
+
.caption-content.hidden {
|
|
1890
|
+
opacity: 0;
|
|
1891
|
+
}
|
|
1892
|
+
|
|
1893
|
+
.caption-content.visible {
|
|
1894
|
+
opacity: 1;
|
|
1895
|
+
}
|
|
1896
|
+
|
|
1897
|
+
|
|
1898
|
+
/* Last message styles */
|
|
1899
|
+
|
|
1900
|
+
.conversation-buttons-overlay {
|
|
1901
|
+
display: flex;
|
|
1902
|
+
flex-direction: column;
|
|
1903
|
+
position: absolute;
|
|
1904
|
+
top: 50px;
|
|
1905
|
+
right: 5%;
|
|
1906
|
+
z-index: var(--z-controls);
|
|
1907
|
+
background: rgba(255, 255, 255, 0.85);
|
|
1908
|
+
backdrop-filter: blur(8px);
|
|
1909
|
+
border-radius: 12px;
|
|
1910
|
+
padding: 8px;
|
|
1911
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
1912
|
+
}
|
|
1913
|
+
|
|
1914
|
+
.last-message {
|
|
1915
|
+
position: absolute;
|
|
1916
|
+
width: 100%;
|
|
1917
|
+
height: 100%;
|
|
1918
|
+
top: 0;
|
|
1919
|
+
left: 0;
|
|
1920
|
+
right: 0;
|
|
1921
|
+
bottom: 0;
|
|
1922
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
1923
|
+
z-index: var(--z-overlay);
|
|
1924
|
+
}
|
|
1925
|
+
|
|
1926
|
+
.last-message-content {
|
|
1927
|
+
position: absolute; /* or fixed, depending on your design */
|
|
1928
|
+
top: 25%;
|
|
1929
|
+
left: 50%;
|
|
1930
|
+
transform: translateX(-50%); /* center horizontally */
|
|
1931
|
+
max-width: 50%;
|
|
1932
|
+
max-height: 50%;
|
|
1933
|
+
padding: 20px;
|
|
1934
|
+
box-sizing: border-box;
|
|
1935
|
+
background-color: white;
|
|
1936
|
+
border-radius: 15px;
|
|
1937
|
+
z-index: calc(var(--z-overlay) + 1);
|
|
1938
|
+
overflow-y: auto;
|
|
1939
|
+
scrollbar-width: thin;
|
|
1940
|
+
scrollbar-color: #ccc #fff;
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
.last-message-scrollable {
|
|
1944
|
+
position: relative;
|
|
1945
|
+
width: 100%;
|
|
1946
|
+
height: 100%;
|
|
1947
|
+
}
|
|
1948
|
+
|
|
1949
|
+
.last-message-copy-button {
|
|
1950
|
+
display: block;
|
|
1951
|
+
background: none;
|
|
1952
|
+
border: none;
|
|
1953
|
+
cursor: pointer;
|
|
1954
|
+
margin-top: 20px;
|
|
1955
|
+
}
|
|
1956
|
+
|
|
1957
|
+
/* Body icons */
|
|
1958
|
+
.body-icons-overlay {
|
|
1959
|
+
position: absolute;
|
|
1960
|
+
top: 50px;
|
|
1961
|
+
left: 3%;
|
|
1962
|
+
z-index: var(--z-controls);
|
|
1963
|
+
background: rgba(255, 255, 255, 0.85);
|
|
1964
|
+
backdrop-filter: blur(8px);
|
|
1965
|
+
border-radius: 12px;
|
|
1966
|
+
padding: 8px;
|
|
1967
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
|
|
1968
|
+
}
|
|
1969
|
+
|
|
1970
|
+
.vertical-icons {
|
|
1971
|
+
display: flex;
|
|
1972
|
+
flex-direction: column;
|
|
1973
|
+
align-items: center;
|
|
1974
|
+
}
|
|
1975
|
+
|
|
1976
|
+
.icon-button {
|
|
1977
|
+
margin: 5px 0;
|
|
1978
|
+
}
|
|
1979
|
+
|
|
1980
|
+
.typing-input {
|
|
1981
|
+
display: flex;
|
|
1982
|
+
gap: 5px;
|
|
1983
|
+
position: relative;
|
|
1984
|
+
width: 90%;
|
|
1985
|
+
max-width: 400px;
|
|
1986
|
+
background: rgba(255, 255, 255, 0.95);
|
|
1987
|
+
padding: 6px 12px;
|
|
1988
|
+
border-radius: 25px;
|
|
1989
|
+
box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
|
|
1990
|
+
overflow: hidden;
|
|
1991
|
+
margin-top: 8px;
|
|
1992
|
+
}
|
|
1993
|
+
|
|
1994
|
+
.typing-input .close-input-button {
|
|
1995
|
+
display: flex;
|
|
1996
|
+
align-items: center;
|
|
1997
|
+
justify-content: center;
|
|
1998
|
+
cursor: pointer;
|
|
1999
|
+
color: #999;
|
|
2000
|
+
padding-right: 5px;
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
.typing-input .close-input-button:hover {
|
|
2004
|
+
color: #666;
|
|
2005
|
+
}
|
|
2006
|
+
|
|
2007
|
+
.typing-input textarea {
|
|
2008
|
+
height: 36px;
|
|
2009
|
+
width: 100%;
|
|
2010
|
+
border: none;
|
|
2011
|
+
outline: none;
|
|
2012
|
+
resize: none;
|
|
2013
|
+
padding: 8px 10px 8px 4px;
|
|
2014
|
+
font-size: 0.9em;
|
|
2015
|
+
cursor: text;
|
|
2016
|
+
caret-color: auto;
|
|
2017
|
+
background: transparent;
|
|
2018
|
+
overflow-y: auto;
|
|
2019
|
+
scrollbar-width: none;
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.typing-input textarea::-webkit-scrollbar {
|
|
2023
|
+
display: none;
|
|
2024
|
+
}
|
|
2025
|
+
|
|
2026
|
+
.typing-input #typing_send_button {
|
|
2027
|
+
visibility: visible;
|
|
2028
|
+
}
|
|
2029
|
+
|
|
2030
|
+
.typing-input #typing_send_button span {
|
|
2031
|
+
align-self: flex-end;
|
|
2032
|
+
color: var(--secondary-color, #801bea);
|
|
2033
|
+
cursor: pointer;
|
|
2034
|
+
height: 55px;
|
|
2035
|
+
display: flex;
|
|
2036
|
+
align-items: center;
|
|
2037
|
+
font-size: 1.35rem;
|
|
2038
|
+
}
|
|
2039
|
+
|
|
2040
|
+
/* Disabled input styles */
|
|
2041
|
+
.typing-input.input-blocked {
|
|
2042
|
+
opacity: 0.6;
|
|
2043
|
+
background-color: #f5f5f5;
|
|
2044
|
+
}
|
|
2045
|
+
|
|
2046
|
+
.typing-input.input-blocked textarea {
|
|
2047
|
+
|
|
2048
|
+
cursor: not-allowed;
|
|
2049
|
+
}
|
|
2050
|
+
|
|
2051
|
+
.typing-input .send-button-disabled {
|
|
2052
|
+
pointer-events: none;
|
|
2053
|
+
opacity: 0.5;
|
|
2054
|
+
}
|
|
2055
|
+
|
|
2056
|
+
.typing-input .send-button-disabled span {
|
|
2057
|
+
color: #ccc !important;
|
|
2058
|
+
cursor: not-allowed !important;
|
|
2059
|
+
}
|
|
2060
|
+
|
|
2061
|
+
/* ========================================
|
|
2062
|
+
* VOICE VISUALIZER - Animated audio bars
|
|
2063
|
+
* ======================================== */
|
|
2064
|
+
.voice-visualizer {
|
|
2065
|
+
display: flex;
|
|
2066
|
+
justify-content: center;
|
|
2067
|
+
align-items: center;
|
|
2068
|
+
width: 70px;
|
|
2069
|
+
height: 40px;
|
|
2070
|
+
background: transparent;
|
|
2071
|
+
border-radius: 22px;
|
|
2072
|
+
padding: 6px;
|
|
2073
|
+
cursor: pointer;
|
|
2074
|
+
transition: background 0.3s ease;
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
.voice-visualizer-wrapper {
|
|
2078
|
+
display: flex;
|
|
2079
|
+
flex-direction: column;
|
|
2080
|
+
align-items: center;
|
|
2081
|
+
gap: 4px;
|
|
2082
|
+
position: relative;
|
|
2083
|
+
min-height: 40px; /* Compact height for overlay */
|
|
2084
|
+
}
|
|
2085
|
+
|
|
2086
|
+
.voice-visualizer.visualizer-disabled {
|
|
2087
|
+
opacity: 0.5;
|
|
2088
|
+
cursor: not-allowed;
|
|
2089
|
+
pointer-events: none;
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
.visualizer-hint,
|
|
2093
|
+
.thinking-label {
|
|
2094
|
+
position: absolute;
|
|
2095
|
+
bottom: -2px;
|
|
2096
|
+
left: 50%;
|
|
2097
|
+
transform: translateX(-50%);
|
|
2098
|
+
white-space: nowrap;
|
|
2099
|
+
}
|
|
2100
|
+
|
|
2101
|
+
.visualizer-hint {
|
|
2102
|
+
font-size: 0.6rem;
|
|
2103
|
+
color: var(--text-color-muted, #888);
|
|
2104
|
+
opacity: 0.8;
|
|
2105
|
+
text-align: center;
|
|
2106
|
+
animation: fadeInHint 0.5s ease-in-out;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
@keyframes fadeInHint {
|
|
2110
|
+
from { opacity: 0; transform: translateX(-50%) translateY(-5px); }
|
|
2111
|
+
to { opacity: 0.8; transform: translateX(-50%) translateY(0); }
|
|
2112
|
+
}
|
|
2113
|
+
|
|
2114
|
+
/* Thinking label shown below visualizer during processing */
|
|
2115
|
+
.thinking-label {
|
|
2116
|
+
font-size: 0.6rem;
|
|
2117
|
+
color: var(--primary-color, #00bfdb);
|
|
2118
|
+
text-align: center;
|
|
2119
|
+
animation: thinkingPulse 1.5s infinite ease-in-out;
|
|
2120
|
+
letter-spacing: 0.5px;
|
|
2121
|
+
font-weight: 400;
|
|
2122
|
+
}
|
|
2123
|
+
|
|
2124
|
+
@keyframes thinkingPulse {
|
|
2125
|
+
0%, 100% { opacity: 0.6; }
|
|
2126
|
+
50% { opacity: 1; }
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
.audio-bar {
|
|
2130
|
+
width: 6px;
|
|
2131
|
+
margin: 0 3px;
|
|
2132
|
+
background: linear-gradient(180deg, var(--primary-color, #00bfdb), var(--secondary-color, #801bea));
|
|
2133
|
+
border-radius: 99px;
|
|
2134
|
+
transform-origin: center;
|
|
2135
|
+
height: 10px;
|
|
2136
|
+
transition: all 0.3s ease;
|
|
2137
|
+
}
|
|
2138
|
+
|
|
2139
|
+
/* --- STATE: IDLE --- */
|
|
2140
|
+
.state-idle .audio-bar {
|
|
2141
|
+
height: 8px;
|
|
2142
|
+
opacity: 0.5;
|
|
2143
|
+
animation: none;
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
/* --- STATE: LISTENING (Microphone active) --- */
|
|
2147
|
+
@keyframes listen-wave {
|
|
2148
|
+
0%, 100% { transform: scaleY(1); opacity: 0.8; }
|
|
2149
|
+
50% { transform: scaleY(1.8); opacity: 1; }
|
|
2150
|
+
}
|
|
2151
|
+
.state-listening .audio-bar {
|
|
2152
|
+
animation: listen-wave 1.5s infinite ease-in-out;
|
|
2153
|
+
}
|
|
2154
|
+
.state-listening .audio-bar:nth-child(1) { animation-delay: 0.0s; }
|
|
2155
|
+
.state-listening .audio-bar:nth-child(2) { animation-delay: 0.2s; }
|
|
2156
|
+
.state-listening .audio-bar:nth-child(3) { animation-delay: 0.4s; }
|
|
2157
|
+
.state-listening .audio-bar:nth-child(4) { animation-delay: 0.2s; }
|
|
2158
|
+
.state-listening .audio-bar:nth-child(5) { animation-delay: 0.0s; }
|
|
2159
|
+
|
|
2160
|
+
/* --- STATE: THINKING (Processing) --- */
|
|
2161
|
+
/* Distinct "loading" style: sequential pulse sweep left-to-right with glow */
|
|
2162
|
+
@keyframes think-pulse {
|
|
2163
|
+
0%, 100% {
|
|
2164
|
+
height: 8px;
|
|
2165
|
+
opacity: 0.4;
|
|
2166
|
+
background: linear-gradient(180deg, var(--primary-color, #00bfdb), var(--secondary-color, #801bea));
|
|
2167
|
+
}
|
|
2168
|
+
40%, 60% {
|
|
2169
|
+
height: 24px;
|
|
2170
|
+
opacity: 1;
|
|
2171
|
+
background: linear-gradient(180deg, #00e5ff, #aa55ff);
|
|
2172
|
+
box-shadow: 0 0 8px rgba(0, 229, 255, 0.6);
|
|
2173
|
+
}
|
|
2174
|
+
}
|
|
2175
|
+
.state-thinking .audio-bar {
|
|
2176
|
+
animation: think-pulse 1.2s infinite ease-in-out;
|
|
2177
|
+
}
|
|
2178
|
+
/* Sequential cascade from left to right */
|
|
2179
|
+
.state-thinking .audio-bar:nth-child(1) { animation-delay: 0.0s; }
|
|
2180
|
+
.state-thinking .audio-bar:nth-child(2) { animation-delay: 0.15s; }
|
|
2181
|
+
.state-thinking .audio-bar:nth-child(3) { animation-delay: 0.30s; }
|
|
2182
|
+
.state-thinking .audio-bar:nth-child(4) { animation-delay: 0.45s; }
|
|
2183
|
+
.state-thinking .audio-bar:nth-child(5) { animation-delay: 0.60s; }
|
|
2184
|
+
|
|
2185
|
+
/* --- STATE: SPEAKING (Voice Output) --- */
|
|
2186
|
+
@keyframes speak-wave {
|
|
2187
|
+
0% { height: 15%; }
|
|
2188
|
+
20% { height: 60%; }
|
|
2189
|
+
40% { height: 35%; }
|
|
2190
|
+
50% { height: 100%; }
|
|
2191
|
+
100% { height: 15%; }
|
|
2192
|
+
}
|
|
2193
|
+
.state-speaking .audio-bar {
|
|
2194
|
+
height: 30px;
|
|
2195
|
+
animation: speak-wave 0.8s infinite ease-in-out;
|
|
2196
|
+
}
|
|
2197
|
+
.state-speaking .audio-bar:nth-child(1) { animation-duration: 0.7s; }
|
|
2198
|
+
.state-speaking .audio-bar:nth-child(2) { animation-duration: 0.9s; }
|
|
2199
|
+
.state-speaking .audio-bar:nth-child(3) { animation-duration: 0.6s; }
|
|
2200
|
+
.state-speaking .audio-bar:nth-child(4) { animation-duration: 0.8s; }
|
|
2201
|
+
.state-speaking .audio-bar:nth-child(5) { animation-duration: 1.0s; }
|
|
2202
|
+
|
|
2203
|
+
/* --- STATE: PAUSED (Disconnected) --- */
|
|
2204
|
+
.state-paused .audio-bar {
|
|
2205
|
+
height: 8px;
|
|
2206
|
+
opacity: 0.3;
|
|
2207
|
+
animation: none;
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2210
|
+
@media (max-width: 768px) {
|
|
2211
|
+
.chatbot .avatarbox {
|
|
2212
|
+
flex-grow: 1;
|
|
2213
|
+
width: 100%;
|
|
2214
|
+
height: 100%;
|
|
2215
|
+
overflow: hidden;
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
#avatar-container {
|
|
2219
|
+
width: 100%;
|
|
2220
|
+
height: 100%;
|
|
2221
|
+
/* On small screens, remove any top padding in embedded or mobile to avoid letterboxing */
|
|
2222
|
+
padding-top: 0;
|
|
2223
|
+
}
|
|
2224
|
+
|
|
2225
|
+
:host([toggler="false"]) #avatar-container {
|
|
2226
|
+
padding: 0 !important;
|
|
2227
|
+
}
|
|
2228
|
+
|
|
2229
|
+
:host(.mobile) #avatar-container,
|
|
2230
|
+
:host([target_app="mobile"]) #avatar-container {
|
|
2231
|
+
padding: 0 !important;
|
|
2232
|
+
}
|
|
2233
|
+
|
|
2234
|
+
#avatar-container canvas {
|
|
2235
|
+
width: 100%;
|
|
2236
|
+
height: 100%;
|
|
2237
|
+
touch-action: pan-y pinch-zoom !important;
|
|
2238
|
+
}
|
|
2239
|
+
|
|
2240
|
+
/* Compact voice controls on mobile */
|
|
2241
|
+
.voice-controls-container {
|
|
2242
|
+
bottom: 10px;
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2245
|
+
.button-container {
|
|
2246
|
+
padding: 6px 12px;
|
|
2247
|
+
border-radius: 28px;
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
.typing-input {
|
|
2251
|
+
width: 85%;
|
|
2252
|
+
max-width: 320px;
|
|
2253
|
+
padding: 4px 10px;
|
|
2254
|
+
}
|
|
2255
|
+
|
|
2256
|
+
.typing-input textarea {
|
|
2257
|
+
height: 32px;
|
|
2258
|
+
font-size: 0.85em;
|
|
2259
|
+
}
|
|
2260
|
+
|
|
2261
|
+
#captions-wrapper {
|
|
2262
|
+
bottom: 85px; /* Adjust for mobile voice controls */
|
|
2263
|
+
}
|
|
2264
|
+
|
|
2265
|
+
.captions-overlay {
|
|
2266
|
+
bottom: 85px;
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
|
|
2270
|
+
/* Ensure conversation buttons are visible on mobile */
|
|
2271
|
+
.chatbot.mobile .conversation-buttons-overlay {
|
|
2272
|
+
top: 10px;
|
|
2273
|
+
right: 10px;
|
|
2274
|
+
z-index: 1000;
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2277
|
+
/* Video avatar loading overlay */
|
|
2278
|
+
.video-avatar-loading-overlay {
|
|
2279
|
+
position: absolute;
|
|
2280
|
+
top: 0;
|
|
2281
|
+
left: 0;
|
|
2282
|
+
width: 100%;
|
|
2283
|
+
height: 100%;
|
|
2284
|
+
display: flex;
|
|
2285
|
+
align-items: center;
|
|
2286
|
+
justify-content: center;
|
|
2287
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
2288
|
+
z-index: 1;
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
/* Video avatar placeholder overlay (shown before conversation starts) */
|
|
2292
|
+
.video-avatar-placeholder-overlay {
|
|
2293
|
+
position: absolute;
|
|
2294
|
+
top: 0;
|
|
2295
|
+
left: 0;
|
|
2296
|
+
width: 100%;
|
|
2297
|
+
height: 100%;
|
|
2298
|
+
display: flex;
|
|
2299
|
+
align-items: center;
|
|
2300
|
+
justify-content: center;
|
|
2301
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
2302
|
+
z-index: 1;
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
.video-avatar-placeholder-content {
|
|
2306
|
+
display: flex;
|
|
2307
|
+
flex-direction: column;
|
|
2308
|
+
align-items: center;
|
|
2309
|
+
gap: 16px;
|
|
2310
|
+
padding: 30px;
|
|
2311
|
+
text-align: center;
|
|
2312
|
+
width: 100%;
|
|
2313
|
+
height: 100%;
|
|
2314
|
+
box-sizing: border-box;
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
.video-avatar-placeholder-image {
|
|
2318
|
+
max-width: 100%;
|
|
2319
|
+
max-height: 100%;
|
|
2320
|
+
width: auto;
|
|
2321
|
+
height: auto;
|
|
2322
|
+
object-fit: contain;
|
|
2323
|
+
border-radius: 8px;
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
.video-avatar-placeholder-icon {
|
|
2327
|
+
color: rgba(255, 255, 255, 0.3);
|
|
2328
|
+
width: 80px;
|
|
2329
|
+
height: 80px;
|
|
2330
|
+
}
|
|
2331
|
+
|
|
2332
|
+
.video-avatar-placeholder-fallback {
|
|
2333
|
+
display: none;
|
|
2334
|
+
}
|
|
2335
|
+
|
|
2336
|
+
/* Video avatar idle disconnect overlay */
|
|
2337
|
+
.video-avatar-idle-overlay {
|
|
2338
|
+
position: absolute;
|
|
2339
|
+
top: 0;
|
|
2340
|
+
left: 0;
|
|
2341
|
+
width: 100%;
|
|
2342
|
+
height: 100%;
|
|
2343
|
+
display: flex;
|
|
2344
|
+
align-items: center;
|
|
2345
|
+
justify-content: center;
|
|
2346
|
+
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
2347
|
+
z-index: 1;
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
.video-avatar-idle-content {
|
|
2351
|
+
display: flex;
|
|
2352
|
+
flex-direction: column;
|
|
2353
|
+
align-items: center;
|
|
2354
|
+
gap: 20px;
|
|
2355
|
+
padding: 30px;
|
|
2356
|
+
text-align: center;
|
|
2357
|
+
}
|
|
2358
|
+
|
|
2359
|
+
.video-avatar-idle-message {
|
|
2360
|
+
color: #e0e0e0;
|
|
2361
|
+
font-size: 1.1rem;
|
|
2362
|
+
margin: 0;
|
|
2363
|
+
max-width: 300px;
|
|
2364
|
+
line-height: 1.5;
|
|
2365
|
+
}
|
|
2366
|
+
|
|
2367
|
+
.video-avatar-reconnect-btn {
|
|
2368
|
+
background: linear-gradient(135deg, #4a90d9 0%, #357abd 100%);
|
|
2369
|
+
color: white;
|
|
2370
|
+
border: none;
|
|
2371
|
+
padding: 12px 28px;
|
|
2372
|
+
border-radius: 25px;
|
|
2373
|
+
font-size: 1rem;
|
|
2374
|
+
font-weight: 500;
|
|
2375
|
+
cursor: pointer;
|
|
2376
|
+
transition: all 0.2s ease;
|
|
2377
|
+
box-shadow: 0 4px 15px rgba(74, 144, 217, 0.3);
|
|
2378
|
+
}
|
|
2379
|
+
|
|
2380
|
+
.video-avatar-reconnect-btn:hover {
|
|
2381
|
+
transform: translateY(-2px);
|
|
2382
|
+
box-shadow: 0 6px 20px rgba(74, 144, 217, 0.4);
|
|
2383
|
+
background: linear-gradient(135deg, #5a9fe9 0%, #4589cd 100%);
|
|
2384
|
+
}
|
|
2385
|
+
|
|
2386
|
+
.video-avatar-reconnect-btn:active {
|
|
2387
|
+
transform: translateY(0);
|
|
2388
|
+
box-shadow: 0 2px 10px rgba(74, 144, 217, 0.3);
|
|
2389
|
+
}
|
|
2390
|
+
`,Kt=_`
|
|
2391
|
+
|
|
2392
|
+
#chat-page {
|
|
2393
|
+
height: 100%;
|
|
2394
|
+
width: 100%;
|
|
2395
|
+
}
|
|
2396
|
+
|
|
2397
|
+
.chat-wrapper {
|
|
2398
|
+
display: flex;
|
|
2399
|
+
flex-direction: column;
|
|
2400
|
+
justify-content: space-between;
|
|
2401
|
+
height: 100%;
|
|
2402
|
+
position: relative;
|
|
2403
|
+
}
|
|
2404
|
+
|
|
2405
|
+
.chat-start-container {
|
|
2406
|
+
padding: 20px;
|
|
2407
|
+
display: flex;
|
|
2408
|
+
align-items: center;
|
|
2409
|
+
width: 100%;
|
|
2410
|
+
position: absolute;
|
|
2411
|
+
bottom: 0px;
|
|
2412
|
+
}
|
|
2413
|
+
|
|
2414
|
+
.chatbot .chatbox {
|
|
2415
|
+
overflow-y: auto;
|
|
2416
|
+
padding: 30px 20px 10px;
|
|
2417
|
+
flex-grow: 1;
|
|
2418
|
+
min-height: 0;
|
|
2419
|
+
}
|
|
2420
|
+
|
|
2421
|
+
|
|
2422
|
+
.chatbox .chat {
|
|
2423
|
+
display: flex;
|
|
2424
|
+
list-style: none;
|
|
2425
|
+
margin-bottom: 1rem;
|
|
2426
|
+
align-items: flex-end;
|
|
2427
|
+
}
|
|
2428
|
+
|
|
2429
|
+
#no-msgs-head {
|
|
2430
|
+
color: #ccc;
|
|
2431
|
+
font-size: 20px;
|
|
2432
|
+
text-align: center;
|
|
2433
|
+
width: 100%;
|
|
2434
|
+
}
|
|
2435
|
+
|
|
2436
|
+
.chatbox .user {
|
|
2437
|
+
margin: 20px 0;
|
|
2438
|
+
justify-content: flex-end;
|
|
2439
|
+
}
|
|
2440
|
+
|
|
2441
|
+
.chatbox .assistant {
|
|
2442
|
+
justify-content: flex-start;
|
|
2443
|
+
}
|
|
2444
|
+
|
|
2445
|
+
/* Assistant Icon Styling */
|
|
2446
|
+
.chatbox .assistant span:first-child {
|
|
2447
|
+
width: 32px;
|
|
2448
|
+
height: 32px;
|
|
2449
|
+
color: #fff;
|
|
2450
|
+
cursor: default;
|
|
2451
|
+
text-align: center;
|
|
2452
|
+
line-height: 32px;
|
|
2453
|
+
background: var(--secondary-color, #801bea);
|
|
2454
|
+
border-radius: 4px;
|
|
2455
|
+
margin: 0 10px 0 0;
|
|
2456
|
+
flex-shrink: 0;
|
|
2457
|
+
}
|
|
2458
|
+
|
|
2459
|
+
.chatbox .assistant span.chat-bubble-icon {
|
|
2460
|
+
flex-shrink: 0;
|
|
2461
|
+
flex-grow: 0;
|
|
2462
|
+
}
|
|
2463
|
+
|
|
2464
|
+
.material-icons.chat-bubble-icon {
|
|
2465
|
+
font-size: 1.3rem;
|
|
2466
|
+
}
|
|
2467
|
+
|
|
2468
|
+
/* Message Container - controls max width and relative positioning context */
|
|
2469
|
+
.message-container {
|
|
2470
|
+
display: block;
|
|
2471
|
+
max-width: 75%;
|
|
2472
|
+
position: relative; /* Establish positioning context for the timestamp */
|
|
2473
|
+
}
|
|
2474
|
+
|
|
2475
|
+
.chatbox .chat p.message-bubble {
|
|
2476
|
+
max-width: 100%;
|
|
2477
|
+
white-space: pre-wrap;
|
|
2478
|
+
word-wrap: break-word;
|
|
2479
|
+
word-break: break-word;
|
|
2480
|
+
padding: 12px 16px; /* Original padding */
|
|
2481
|
+
padding-bottom: 24px;
|
|
2482
|
+
min-height: 1.2em; /* Approx 1 line height + timestamp space */
|
|
2483
|
+
min-width: 80px;
|
|
2484
|
+
border-radius: 10px;
|
|
2485
|
+
font-size: 0.95em;
|
|
2486
|
+
box-sizing: border-box;
|
|
2487
|
+
position: relative; /* Needed if any ::before/::after are used */
|
|
2488
|
+
/* Base styles */
|
|
2489
|
+
background: #f0f0f0;
|
|
2490
|
+
color: #333;
|
|
2491
|
+
}
|
|
2492
|
+
|
|
2493
|
+
/* Timestamp Span (Absolute Positioned) */
|
|
2494
|
+
.message-container .message-time { /* Target based on container */
|
|
2495
|
+
position: absolute;
|
|
2496
|
+
bottom: 5px; /* Position from bottom */
|
|
2497
|
+
font-size: 0.7rem;
|
|
2498
|
+
color: #aaa; /* Default time color */
|
|
2499
|
+
white-space: nowrap;
|
|
2500
|
+
}
|
|
2501
|
+
|
|
2502
|
+
/* Timestamp alignment classes */
|
|
2503
|
+
.message-container .message-time.time-right {
|
|
2504
|
+
right: 10px; /* Align to right */
|
|
2505
|
+
}
|
|
2506
|
+
.message-container .message-time.time-left {
|
|
2507
|
+
left: 10px; /* Align to left */
|
|
2508
|
+
}
|
|
2509
|
+
|
|
2510
|
+
/* USER specific bubble styles */
|
|
2511
|
+
.chatbox .user p.message-bubble {
|
|
2512
|
+
border-radius: 10px 10px 0 10px;
|
|
2513
|
+
background: var(--secondary-color, #801bea);
|
|
2514
|
+
color: var(--text-color-secondary-bg, #fff);
|
|
2515
|
+
}
|
|
2516
|
+
/* User timestamp color (slightly lighter) */
|
|
2517
|
+
.chatbox .user .message-container .message-time {
|
|
2518
|
+
color: #eee;
|
|
2519
|
+
}
|
|
2520
|
+
|
|
2521
|
+
/* ASSISTANT specific bubble styles */
|
|
2522
|
+
.chatbox .assistant p.message-bubble {
|
|
2523
|
+
border-radius: 10px 10px 10px 0;
|
|
2524
|
+
color: #000 !important;
|
|
2525
|
+
background: #f2f2f2 !important;
|
|
2526
|
+
}
|
|
2527
|
+
.chatbox .assistant .message-container .message-time {
|
|
2528
|
+
color: #aaa;
|
|
2529
|
+
}
|
|
2530
|
+
|
|
2531
|
+
/* Error Styling */
|
|
2532
|
+
.chatbox .chat p.error.message-bubble {
|
|
2533
|
+
color: #721c24 !important;
|
|
2534
|
+
background: #f8d7da !important;
|
|
2535
|
+
}
|
|
2536
|
+
/* Error timestamp color */
|
|
2537
|
+
.chatbox .chat p.error.message-bubble + .message-time { /* Select sibling time */
|
|
2538
|
+
color: #b85c65 !important;
|
|
2539
|
+
}
|
|
2540
|
+
|
|
2541
|
+
.chatbot .chat-input {
|
|
2542
|
+
display: flex;
|
|
2543
|
+
gap: 5px;
|
|
2544
|
+
position: relative;
|
|
2545
|
+
width: 100%;
|
|
2546
|
+
background: #fff;
|
|
2547
|
+
padding: 3px 10px;
|
|
2548
|
+
border-top: 1px solid #ddd;
|
|
2549
|
+
flex-shrink: 0;
|
|
2550
|
+
}
|
|
2551
|
+
|
|
2552
|
+
.chat-input textarea {
|
|
2553
|
+
height: 55px;
|
|
2554
|
+
width: 100%;
|
|
2555
|
+
border: none;
|
|
2556
|
+
outline: none;
|
|
2557
|
+
resize: none;
|
|
2558
|
+
max-height: 180px;
|
|
2559
|
+
padding: 15px 15px 15px 0;
|
|
2560
|
+
font-size: 0.95em;
|
|
2561
|
+
cursor: text;
|
|
2562
|
+
caret-color: auto;
|
|
2563
|
+
background: transparent;
|
|
2564
|
+
}
|
|
2565
|
+
|
|
2566
|
+
.chat-input.input-blocked textarea {
|
|
2567
|
+
padding-left: 45px;
|
|
2568
|
+
}
|
|
2569
|
+
|
|
2570
|
+
.chat-input #chat_send_button {
|
|
2571
|
+
visibility: visible;
|
|
2572
|
+
}
|
|
2573
|
+
|
|
2574
|
+
.chat-input #chat_send_button span {
|
|
2575
|
+
align-self: flex-end;
|
|
2576
|
+
color: var(--secondary-color, #801bea);
|
|
2577
|
+
cursor: pointer;
|
|
2578
|
+
height: 55px;
|
|
2579
|
+
display: flex;
|
|
2580
|
+
align-items: center;
|
|
2581
|
+
font-size: 1.35rem;
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
/* Disabled input styles */
|
|
2585
|
+
.chat-input.input-blocked {
|
|
2586
|
+
opacity: 0.6;
|
|
2587
|
+
background-color: #f5f5f5;
|
|
2588
|
+
}
|
|
2589
|
+
|
|
2590
|
+
.chat-input.input-blocked textarea {
|
|
2591
|
+
cursor: not-allowed;
|
|
2592
|
+
background-color: #f5f5f5;
|
|
2593
|
+
}
|
|
2594
|
+
|
|
2595
|
+
.chat-input .send-button-disabled {
|
|
2596
|
+
pointer-events: none;
|
|
2597
|
+
opacity: 0.5;
|
|
2598
|
+
}
|
|
2599
|
+
|
|
2600
|
+
.chat-input .send-button-disabled span {
|
|
2601
|
+
color: #ccc !important;
|
|
2602
|
+
cursor: not-allowed !important;
|
|
2603
|
+
}
|
|
2604
|
+
|
|
2605
|
+
/* Loading dots animation in input */
|
|
2606
|
+
.chat-input .input-loading-dots {
|
|
2607
|
+
position: absolute;
|
|
2608
|
+
left: 15px;
|
|
2609
|
+
top: 50%;
|
|
2610
|
+
transform: translateY(-50%);
|
|
2611
|
+
display: flex;
|
|
2612
|
+
gap: 4px;
|
|
2613
|
+
pointer-events: none;
|
|
2614
|
+
}
|
|
2615
|
+
|
|
2616
|
+
.chat-input .input-loading-dots .dot {
|
|
2617
|
+
width: 6px;
|
|
2618
|
+
height: 6px;
|
|
2619
|
+
background: var(--secondary-color, #801bea);
|
|
2620
|
+
border-radius: 50%;
|
|
2621
|
+
animation: dot-bounce 1.4s infinite ease-in-out both;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
.chat-input .input-loading-dots .dot:nth-child(1) {
|
|
2625
|
+
animation-delay: -0.32s;
|
|
2626
|
+
}
|
|
2627
|
+
|
|
2628
|
+
.chat-input .input-loading-dots .dot:nth-child(2) {
|
|
2629
|
+
animation-delay: -0.16s;
|
|
2630
|
+
}
|
|
2631
|
+
|
|
2632
|
+
@keyframes dot-bounce {
|
|
2633
|
+
0%, 80%, 100% {
|
|
2634
|
+
transform: scale(0.6);
|
|
2635
|
+
opacity: 0.5;
|
|
2636
|
+
}
|
|
2637
|
+
40% {
|
|
2638
|
+
transform: scale(1);
|
|
2639
|
+
opacity: 1;
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
|
|
2643
|
+
@media (max-width: 768px) {
|
|
2644
|
+
.chatbot .chatbox {
|
|
2645
|
+
flex-grow: 1;
|
|
2646
|
+
padding: 25px 15px;
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
.chatbot .chat-input {
|
|
2650
|
+
padding: 5px 15px;
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
.message-container {
|
|
2654
|
+
max-width: 85%;
|
|
2655
|
+
}
|
|
2656
|
+
}
|
|
2657
|
+
|
|
2658
|
+
/* Chat Placeholder Styles */
|
|
2659
|
+
.chat-placeholder-container {
|
|
2660
|
+
display: flex;
|
|
2661
|
+
flex-direction: column;
|
|
2662
|
+
justify-content: space-between;
|
|
2663
|
+
align-items: center;
|
|
2664
|
+
height: 100%;
|
|
2665
|
+
padding: 40px 20px 20px;
|
|
2666
|
+
box-sizing: border-box;
|
|
2667
|
+
}
|
|
2668
|
+
|
|
2669
|
+
.chat-placeholder-content {
|
|
2670
|
+
display: flex;
|
|
2671
|
+
flex-direction: column;
|
|
2672
|
+
align-items: center;
|
|
2673
|
+
justify-content: center;
|
|
2674
|
+
flex-grow: 1;
|
|
2675
|
+
text-align: center;
|
|
2676
|
+
max-width: 300px;
|
|
2677
|
+
}
|
|
2678
|
+
|
|
2679
|
+
.chat-placeholder-icon {
|
|
2680
|
+
color: var(--primary-color, #00bfdb);
|
|
2681
|
+
margin-bottom: 24px;
|
|
2682
|
+
opacity: 0.9;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
.chat-placeholder-icon svg {
|
|
2686
|
+
width: 80px;
|
|
2687
|
+
height: 80px;
|
|
2688
|
+
}
|
|
2689
|
+
|
|
2690
|
+
.chat-placeholder-title {
|
|
2691
|
+
font-size: 1.4rem;
|
|
2692
|
+
font-weight: 600;
|
|
2693
|
+
color: var(--secondary-color, #333);
|
|
2694
|
+
margin: 0 0 12px 0;
|
|
2695
|
+
letter-spacing: -0.02em;
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
.chat-placeholder-description {
|
|
2699
|
+
font-size: 0.95rem;
|
|
2700
|
+
color: #666;
|
|
2701
|
+
margin: 0;
|
|
2702
|
+
line-height: 1.5;
|
|
2703
|
+
opacity: 0.85;
|
|
2704
|
+
}
|
|
2705
|
+
|
|
2706
|
+
.chat-placeholder-button {
|
|
2707
|
+
width: 100%;
|
|
2708
|
+
padding-top: 20px;
|
|
2709
|
+
}
|
|
2710
|
+
|
|
2711
|
+
.chat-placeholder-button .button-container {
|
|
2712
|
+
width: 100%;
|
|
2713
|
+
}
|
|
2714
|
+
|
|
2715
|
+
.chat-placeholder-button .start-button {
|
|
2716
|
+
width: 100%;
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2719
|
+
.chat-wrapper.placeholder-mode {
|
|
2720
|
+
height: 100%;
|
|
2721
|
+
}
|
|
2722
|
+
|
|
2723
|
+
@media (max-width: 500px) {
|
|
2724
|
+
.chat-placeholder-container {
|
|
2725
|
+
padding: 30px 15px 15px;
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
.chat-placeholder-icon svg {
|
|
2729
|
+
width: 60px;
|
|
2730
|
+
height: 60px;
|
|
2731
|
+
}
|
|
2732
|
+
|
|
2733
|
+
.chat-placeholder-title {
|
|
2734
|
+
font-size: 1.2rem;
|
|
2735
|
+
}
|
|
2736
|
+
|
|
2737
|
+
.chat-placeholder-description {
|
|
2738
|
+
font-size: 0.9rem;
|
|
2739
|
+
}
|
|
2740
|
+
}
|
|
2741
|
+
|
|
2742
|
+
.floating-avatar-button {
|
|
2743
|
+
position: absolute;
|
|
2744
|
+
bottom: 80px;
|
|
2745
|
+
right: 16px;
|
|
2746
|
+
width: 40px;
|
|
2747
|
+
height: 40px;
|
|
2748
|
+
border-radius: 50%;
|
|
2749
|
+
background-color: var(--secondary-color, #801bea);
|
|
2750
|
+
color: white;
|
|
2751
|
+
border: none;
|
|
2752
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
|
|
2753
|
+
display: flex;
|
|
2754
|
+
align-items: center;
|
|
2755
|
+
justify-content: center;
|
|
2756
|
+
cursor: pointer;
|
|
2757
|
+
z-index: 100;
|
|
2758
|
+
transition: transform 0.2s, box-shadow 0.2s;
|
|
2759
|
+
}
|
|
2760
|
+
|
|
2761
|
+
.floating-avatar-button:hover {
|
|
2762
|
+
transform: scale(1.05);
|
|
2763
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
.floating-avatar-button svg,
|
|
2767
|
+
.floating-avatar-button svg g,
|
|
2768
|
+
.floating-avatar-button svg path {
|
|
2769
|
+
width: 24px;
|
|
2770
|
+
height: 24px;
|
|
2771
|
+
fill: currentColor;
|
|
2772
|
+
}
|
|
2773
|
+
|
|
2774
|
+
/* Ensure floating button is visible on mobile */
|
|
2775
|
+
.chatbot.mobile .floating-avatar-button {
|
|
2776
|
+
bottom: 100px;
|
|
2777
|
+
right: 20px;
|
|
2778
|
+
z-index: 1000;
|
|
2779
|
+
}
|
|
2780
|
+
`,Qt=_`
|
|
2781
|
+
.chatbot footer {
|
|
2782
|
+
text-align: center;
|
|
2783
|
+
padding: 5px;
|
|
2784
|
+
background-color: var(--primary-color, #00bfdb);
|
|
2785
|
+
color: var(--text-color-primary-bg, #fff);
|
|
2786
|
+
border-top: 1px solid #ddd;
|
|
2787
|
+
border-bottom-left-radius: var(--corner-radius, 10px);
|
|
2788
|
+
border-bottom-right-radius: var(--corner-radius, 10px);
|
|
2789
|
+
width: 100%;
|
|
2790
|
+
min-height: 30px;
|
|
2791
|
+
flex: none;
|
|
2792
|
+
}
|
|
2793
|
+
|
|
2794
|
+
.chatbot footer.page {
|
|
2795
|
+
border-bottom-left-radius: 0px;
|
|
2796
|
+
border-bottom-right-radius: 0px;
|
|
2797
|
+
}
|
|
2798
|
+
`,Yt=_`
|
|
2799
|
+
.form-group {
|
|
2800
|
+
display: flex;
|
|
2801
|
+
flex-direction: column;
|
|
2802
|
+
margin-bottom: 15px;
|
|
2803
|
+
}
|
|
2804
|
+
|
|
2805
|
+
.radio-group {
|
|
2806
|
+
margin: 20px 0;
|
|
2807
|
+
display: flex;
|
|
2808
|
+
justify-content: space-between;
|
|
2809
|
+
}
|
|
2810
|
+
|
|
2811
|
+
label {
|
|
2812
|
+
margin-bottom: 5px;
|
|
2813
|
+
font-weight: bold;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
input, select {
|
|
2817
|
+
width: 100%;
|
|
2818
|
+
max-width: 300px;
|
|
2819
|
+
padding: 8px;
|
|
2820
|
+
border: 1px solid #ccc;
|
|
2821
|
+
border-radius: 4px;
|
|
2822
|
+
}
|
|
2823
|
+
|
|
2824
|
+
.checkbox-group {
|
|
2825
|
+
display: flex;
|
|
2826
|
+
align-items: center;
|
|
2827
|
+
margin-top: 15px;
|
|
2828
|
+
}
|
|
2829
|
+
|
|
2830
|
+
|
|
2831
|
+
|
|
2832
|
+
.checkbox-label {
|
|
2833
|
+
display: block;
|
|
2834
|
+
padding-left: 15px;
|
|
2835
|
+
text-indent: -15px;
|
|
2836
|
+
}
|
|
2837
|
+
|
|
2838
|
+
.checkbox-input {
|
|
2839
|
+
width: 15px;
|
|
2840
|
+
height: 15px;
|
|
2841
|
+
padding: 0;
|
|
2842
|
+
margin: 0;
|
|
2843
|
+
vertical-align: bottom;
|
|
2844
|
+
position: relative;
|
|
2845
|
+
top: -1px;
|
|
2846
|
+
}
|
|
2847
|
+
|
|
2848
|
+
.dialog-overlay {
|
|
2849
|
+
/* Constrain overlay to the chatbot container to avoid leaking outside */
|
|
2850
|
+
position: absolute;
|
|
2851
|
+
inset: 0;
|
|
2852
|
+
background: rgba(0, 0, 0, 0.5);
|
|
2853
|
+
display: flex;
|
|
2854
|
+
justify-content: center;
|
|
2855
|
+
align-items: center;
|
|
2856
|
+
z-index: var(--z-overlay, 1200);
|
|
2857
|
+
pointer-events: auto;
|
|
2858
|
+
}
|
|
2859
|
+
|
|
2860
|
+
.dialog {
|
|
2861
|
+
width: 60%;
|
|
2862
|
+
max-width: 400px;
|
|
2863
|
+
min-width: 200px;
|
|
2864
|
+
height: auto;
|
|
2865
|
+
background: white;
|
|
2866
|
+
border-radius: 10px;
|
|
2867
|
+
padding: 15px;
|
|
2868
|
+
box-shadow: 0px 2px 4px rgba(0, 0, 0, 0.08), 0px 4px 8px rgba(0, 0, 0, 0.12);
|
|
2869
|
+
display: flex;
|
|
2870
|
+
flex-direction: column;
|
|
2871
|
+
justify-content: space-between;
|
|
2872
|
+
z-index: calc(var(--z-overlay, 1200) + 1);
|
|
2873
|
+
}
|
|
2874
|
+
|
|
2875
|
+
.dialog p {
|
|
2876
|
+
overflow: hidden;
|
|
2877
|
+
text-overflow: ellipsis;
|
|
2878
|
+
white-space: normal;
|
|
2879
|
+
text-align: center;
|
|
2880
|
+
max-height: 220px;
|
|
2881
|
+
margin-bottom: 15px;
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
.dialog .dialog-button-wrapper {
|
|
2885
|
+
display: flex;
|
|
2886
|
+
justify-content: center;
|
|
2887
|
+
flex-wrap: wrap;
|
|
2888
|
+
gap: 10px;
|
|
2889
|
+
}
|
|
2890
|
+
|
|
2891
|
+
.dialog button {
|
|
2892
|
+
border: none;
|
|
2893
|
+
padding: 10px 25px;
|
|
2894
|
+
border-radius: 5px;
|
|
2895
|
+
cursor: pointer;
|
|
2896
|
+
transition: transform 0.3s;
|
|
2897
|
+
width: 100px;
|
|
2898
|
+
}
|
|
2899
|
+
|
|
2900
|
+
.dialog button:hover {
|
|
2901
|
+
transform: scale(1.05);
|
|
2902
|
+
}
|
|
2903
|
+
|
|
2904
|
+
.dialog button.confirm-button {
|
|
2905
|
+
background-color: var(--secondary-color, #801bea);
|
|
2906
|
+
color: white;
|
|
2907
|
+
}
|
|
2908
|
+
|
|
2909
|
+
.dialog button.cancel-button {
|
|
2910
|
+
background-color: #ccc;
|
|
2911
|
+
color: black;
|
|
2912
|
+
}
|
|
2913
|
+
|
|
2914
|
+
/* Styles for radio labels */
|
|
2915
|
+
.radio-label {
|
|
2916
|
+
display: flex;
|
|
2917
|
+
align-items: center;
|
|
2918
|
+
font-size: 16px;
|
|
2919
|
+
cursor: pointer;
|
|
2920
|
+
}
|
|
2921
|
+
|
|
2922
|
+
/* Styles for radio inputs */
|
|
2923
|
+
.radio-input {
|
|
2924
|
+
margin-right: 8px;
|
|
2925
|
+
cursor: pointer;
|
|
2926
|
+
}
|
|
2927
|
+
|
|
2928
|
+
.dialog-button-group {
|
|
2929
|
+
display: flex;
|
|
2930
|
+
justify-content: center;
|
|
2931
|
+
flex-wrap: wrap;
|
|
2932
|
+
gap: 10px;
|
|
2933
|
+
margin-top: 20px;
|
|
2934
|
+
}
|
|
2935
|
+
|
|
2936
|
+
.button-save {
|
|
2937
|
+
margin-top: .6rem;
|
|
2938
|
+
padding: 15px 32px;
|
|
2939
|
+
border-radius: 5%;
|
|
2940
|
+
background-color: var(--secondary-color, #801bea);
|
|
2941
|
+
color: #fff;
|
|
2942
|
+
border: none;
|
|
2943
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
2944
|
+
position: relative;
|
|
2945
|
+
transition: transform 0.3s, box-shadow 0.3s;
|
|
2946
|
+
}
|
|
2947
|
+
|
|
2948
|
+
.button-save:active {
|
|
2949
|
+
transform: translateY(2px);
|
|
2950
|
+
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
|
2951
|
+
}
|
|
2952
|
+
|
|
2953
|
+
.button-save:active:hover {
|
|
2954
|
+
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 50px 0 rgba(0, 0, 0, 0.19);
|
|
2955
|
+
}
|
|
2956
|
+
|
|
2957
|
+
.button-save:disabled {
|
|
2958
|
+
opacity: 0.5;
|
|
2959
|
+
cursor: not-allowed;
|
|
2960
|
+
}
|
|
2961
|
+
|
|
2962
|
+
.button-cancel {
|
|
2963
|
+
margin-top: .6rem;
|
|
2964
|
+
padding: 15px 32px;
|
|
2965
|
+
border-radius: 5%;
|
|
2966
|
+
background-color: rgba(0, 0, 0, 0.1);
|
|
2967
|
+
border: none;
|
|
2968
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
2969
|
+
position: relative;
|
|
2970
|
+
transition: transform 0.3s, box-shadow 0.3s;
|
|
2971
|
+
}
|
|
2972
|
+
|
|
2973
|
+
/* Consent dialog specific adjustments */
|
|
2974
|
+
.consent-dialog {
|
|
2975
|
+
/* Inherit base .dialog sizing, just allow vertical scrolling region and spacing */
|
|
2976
|
+
gap: 0.75rem; /* rely on flex column from base .dialog */
|
|
2977
|
+
max-height: 80vh;
|
|
2978
|
+
width: 75%;
|
|
2979
|
+
max-width: 500px;
|
|
2980
|
+
}
|
|
2981
|
+
/* Compact mode overrides when chatbot has compact class */
|
|
2982
|
+
.chatbot.compact .consent-dialog {
|
|
2983
|
+
max-height: 70vh;
|
|
2984
|
+
}
|
|
2985
|
+
/* Consent title styling - ensure it doesn't get cut off */
|
|
2986
|
+
.consent-dialog #chat-consent-title {
|
|
2987
|
+
max-height: none;
|
|
2988
|
+
white-space: normal;
|
|
2989
|
+
overflow: visible;
|
|
2990
|
+
text-overflow: unset;
|
|
2991
|
+
flex-shrink: 0;
|
|
2992
|
+
margin-bottom: 0.5rem;
|
|
2993
|
+
}
|
|
2994
|
+
/* Scrollable consent text area */
|
|
2995
|
+
.consent-dialog .consent-text.scrollable {
|
|
2996
|
+
flex: 1 1 auto;
|
|
2997
|
+
overflow-y: auto;
|
|
2998
|
+
max-height: 60vh;
|
|
2999
|
+
padding-right: 4px; /* space for scrollbar */
|
|
3000
|
+
}
|
|
3001
|
+
.chatbot.compact .consent-dialog .consent-text.scrollable {
|
|
3002
|
+
max-height: 40vh;
|
|
3003
|
+
font-size: 0.85rem;
|
|
3004
|
+
line-height: 1.3;
|
|
3005
|
+
}
|
|
3006
|
+
/* Improve focus visibility for scrollable region */
|
|
3007
|
+
.consent-dialog .consent-text.scrollable:focus {
|
|
3008
|
+
outline: 2px solid var(--secondary-color, #801bea);
|
|
3009
|
+
outline-offset: 2px;
|
|
3010
|
+
}
|
|
3011
|
+
/* Ensure buttons remain visible even if content overflows */
|
|
3012
|
+
.consent-dialog .dialog-button-group {
|
|
3013
|
+
margin-top: 0;
|
|
3014
|
+
padding-top: 0.25rem;
|
|
3015
|
+
}
|
|
3016
|
+
`;class Xt extends(function(t=Object){return class extends t{constructor(...t){super(...t),this._eventBus=new mt,this._domDisposers=[]}get bus(){return this._eventBus}_onBus(t,e){return this._eventBus.on(t,e)}_onDom(t,e,a,i){t.addEventListener(e,a,i);const n=()=>t.removeEventListener(e,a,i);return this._domDisposers.push(n),n}pushDisposer(t){if("function"!=typeof t)throw new TypeError("Disposer must be a function");this._domDisposers.push(t)}_disposeListeners(){this._eventBus.dispose(),this._domDisposers.forEach((t=>{try{t()}catch(e){}})),this._domDisposers.length=0}_createChildBus(){return new mt}}}(b)){static#c=!1;static _injectFontLinks(){if(Xt.#c)return;if("undefined"==typeof document||!document.head)return;Xt.#c=!0;const t=document.createElement("link");t.rel="preconnect",t.href="https://fonts.googleapis.com",t.crossOrigin="anonymous",document.head.appendChild(t);const e=document.createElement("link");e.rel="preconnect",e.href="https://fonts.gstatic.com",e.crossOrigin="anonymous",document.head.appendChild(e);const a=document.createElement("link");a.href="https://fonts.googleapis.com/icon?family=Material+Icons&display=block",a.rel="stylesheet",document.head.appendChild(a);const i=document.createElement("link");i.href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600&display=swap",i.rel="stylesheet",document.head.appendChild(i)}static get properties(){return{api_key:{type:String,attribute:"api-key"},token_endpoint:{type:String,attribute:"token-endpoint"},avatar_id:{type:String,attribute:"avatar-id"},toggler:{type:Boolean,reflect:!0,converter:t=>"false"!==t},barge_in:{type:Boolean,reflect:!0,attribute:"barge-in",converter:t=>"false"!==t},terms_href:{type:String,attribute:"terms-href"},privacy_href:{type:String,attribute:"privacy-href"},brand_name:{type:String,attribute:"brand-name"},brand_logo:{type:String,attribute:"brand-logo"},username:{type:String},phoneNumber:{type:String},email:{type:String},isTermsAccepted:{type:Boolean,attribute:"terms-accepted"},compact:{type:Boolean,reflect:!0,converter:t=>"false"!==t},target_app:{type:String,attribute:"target-app"},enable_captions:{type:Boolean,reflect:!0,attribute:"enable-captions",converter:t=>"false"!==t},uiLanguage:{type:String,attribute:"ui-language"},canvasWidth:{type:Number,reflect:!0,attribute:"canvas-width"},canvasHeight:{type:Number,reflect:!0,attribute:"canvas-height"},chatbotHeight:{type:Number,reflect:!0,attribute:"chatbot-height"},avatarBackground:{type:String,reflect:!0,attribute:"avatar-background"},cornerRadius:{type:String,reflect:!0,attribute:"corner-radius"},_canvasWidth:{type:Number,attribute:!1},_canvasHeight:{type:Number,attribute:!1},_chatbotHeight:{type:Number,attribute:!1},_language:{type:String,attribute:!1},_avatarName:{type:String,attribute:!1},_currentMessage:{type:Object,attribute:!1},_actorSnapshot:{type:Object,attribute:!1},_conversationTranscript:{type:Array,attribute:!1},_showConversationPanel:{type:Boolean,attribute:!1},_showChatbot:{type:Boolean,attribute:!1},_showMenu:{type:Boolean,attribute:!1},_shownPage:{type:String,attribute:!1},_showUserData:{type:Boolean,attribute:!1},_showSatisfactionScore:{type:Boolean,attribute:!1},_showLastMessage:{type:Boolean,attribute:!1},_satisfactionScore:{type:Number,attribute:!1},_lastMessageText:{type:String,attribute:!1},_liveCaption:{type:String,attribute:!1},_liveCaptionSpeaker:{type:String,attribute:!1},_isLiveCaptionsVisible:{type:Boolean,attribute:!1,reflect:!1},_showConfirmationDialog:{type:Boolean,attribute:!1},_dialogMessage:{type:String,attribute:!1},_confirmButtonLabel:{type:String,attribute:!1},_cancelButtonLabel:{type:String,attribute:!1},_showCopyTick:{type:Boolean,attribute:!1},_isFullBody:{type:Boolean,attribute:!1},_isVideoAvatar:{type:Boolean,attribute:!1},_isVideoAvatarIdleDisconnected:{type:Boolean,attribute:!1},_isVideoAvatarReconnecting:{type:Boolean,attribute:!1},_videoAvatarPlaceholderImageUrl:{type:String,attribute:!1},_showTyping:{type:Boolean,attribute:!1},_statusBarStatus:{type:String,attribute:!1},_inputsBlocked:{type:Boolean,attribute:!1},_isThinking:{type:Boolean,attribute:!1},_isListening:{type:Boolean,attribute:!1},_isSpeaking:{type:Boolean,attribute:!1},_isConversationInProgress:{type:Boolean,attribute:!1},_isConversationPaused:{type:Boolean,attribute:!1},_isAutoResuming:{type:Boolean,attribute:!1},_isCheckingResume:{type:Boolean,attribute:!1},_isResumeExpired:{type:Boolean,attribute:!1},_isInitializingConversation:{type:Boolean,attribute:!1},_isConversationTimedOut:{type:Boolean,attribute:!1},_isStartingConversation:{type:Boolean,attribute:!1},_isConversationStopped:{type:Boolean,attribute:!1},_isDisconnected:{type:Boolean,attribute:!1},_isFailed:{type:Boolean,attribute:!1},_avatarRunning:{type:Boolean,attribute:!1},_avatarResuming:{type:Boolean,attribute:!1},_showChatConsentDialog:{type:Boolean,attribute:!1}}}static get observedAttributes(){const t=super.observedAttributes??[];return[...new Set([...t,"api_key","token_endpoint","avatar_id","terms_href","privacy_href","brand_name","brand_logo","target_app","enable_captions","barge_in"])]}attributeChangedCallback(t,e,a){if(super.attributeChangedCallback&&super.attributeChangedCallback(t,e,a),t in{api_key:"api-key",token_endpoint:"token-endpoint",avatar_id:"avatar-id",terms_href:"terms-href",privacy_href:"privacy-href",brand_name:"brand-name",brand_logo:"brand-logo",target_app:"target-app",enable_captions:"enable-captions",barge_in:"barge-in",avatar_background:"avatar-background"}){try{this._deprecatedAttrWarnings=this._deprecatedAttrWarnings||new Set,this._deprecatedAttrWarnings.has(t)||this._deprecatedAttrWarnings.add(t)}catch(i){}switch(t){case"enable_captions":case"barge_in":{const e=null!==a&&"false"!==a;this[t]=e;break}case"avatar_background":this.avatarBackground=a;break;default:this[t]=a}}}static styles=[jt,qt,Gt,Kt,Wt,Yt,Qt];constructor(){super(),this.api_key="",this.token_endpoint="",this.avatar_id="",this.toggler=!0,this.barge_in=!1,this.terms_href="",this.privacy_href="",this.brand_name="",this.brand_logo="",this.compact=!1,this.target_app="web",this.enable_captions=!0,this.uiLanguage=_t,this.canvasWidth=T.dom.canvasWidth,this.canvasHeight=T.dom.canvasHeight,this.chatbotHeight=T.dom.canvasHeight+T.dom.headerAndFooterHeight,this._canvasWidth=T.dom.canvasWidth,this._canvasHeight=T.dom.canvasHeight,this._chatbotHeight=T.dom.canvasHeight+T.dom.headerAndFooterHeight,this._speakingAvatar=null,this._language="",this.username="",this.phoneNumber="",this.email="",this.isTermsAccepted=!1,this._avatarName="Assistant",this._conversationTranscript=[],this._currentMessage=null,this._actorSnapshot={value:"initializing",context:{transcript:[]},matches:()=>!1},this._showConversationPanel=!1,this._showChatbot=!1,this._showMenu=!1,this._shownPage="LoaderPage",this._savedChatbotMode=null,(this.api_key||this.token_endpoint)&&this.avatar_id?this._statusBarStatus="initializing":(this._shownPage="ErrorPage",this._statusBarStatus="invalidConfiguration"),this._showUserData=!1,this._showSatisfactionScore=!1,this._showLastMessage=!1,this._satisfactionScore=null,this._lastMessageText="",this._liveCaption="",this._liveCaptionSpeaker="",this._isLiveCaptionsVisible=!0,this._alerts=null,this._showConfirmationDialog=!1,this._dialogMessage="",this._confirmButtonLabel=this._t("confirm"),this._cancelButtonLabel=this._t("cancel"),this._stateTestMode=T.test.stateTestMode,this._showCopyTick=!1,this._isFullBody=!0,this._isVideoAvatar=!1,this._isVideoAvatarIdleDisconnected=!1,this._isVideoAvatarReconnecting=!1,this._videoAvatarReconnectTimeoutId=null,this._videoAvatarReconnectAttempt=0,this._videoAvatarReconnectCooldownUntil=0,this._videoAvatarPlaceholderImageUrl=null,this._showTyping=!1,this._wakeLock=new St,this._focusTimeoutId=null,this.captionsTimeoutId=null,this._userCaptionClearTimeoutId=null,this._fontRevealTimeoutId=null,this._captionSwitchTimeoutId=null,this._menuHideTimeoutId=null,this._connection="unknown",this._initTriggered=!1,this._initInProgress=!1,this._initPromise=null,this._inputsBlocked=!1,this._isThinking=!1,this._isListening=!1,this._isSpeaking=!1,this._isConversationInProgress=!1,this._isConversationPaused=!1,this._isAutoResuming=!1,this._isResumeExpired=!1,this._isInitializingConversation=!1,this._isConversationTimedOut=!1,this._isStartingConversation=!1,this._isConversationStopped=!1,this._isDisconnected=!1,this._isFailed=!1,this._avatarRunning=!1,this._avatarResuming=!1,this._showChatConsentDialog=!1,this.avatarBackground="",this.cornerRadius=void 0,this._dirManagedByUiLanguage=!1,this._lastUiChatbotMode={isShown:null,chatbotMode:null},this._chatScrollTimeoutId=null,this._speakingAvatar=new vt(this.bus),this._applyBargeInPreference(),this._setupAvatarStateSubscription()}_t(t){return ft(this.uiLanguage,t)}_applyUiLanguage(){this._confirmButtonLabel=this._t("confirm"),this._cancelButtonLabel=this._t("cancel")}_applyDirectionFromUiLanguage(){const t=!0===this._dirManagedByUiLanguage,e=this.getAttribute("dir");if(!t&&("rtl"===e||"ltr"===e||"auto"===e))return;const a=(this.uiLanguage||_t).toLowerCase().split("-")[0],i=["ar","he","fa","ur"].includes(a)?"rtl":"ltr";this.dir!==i?(this.dir=i,this._dirManagedByUiLanguage=!0):t||(this._dirManagedByUiLanguage=!0)}_getAvatarBackgroundStyleObj(){const t=(this.avatarBackground??"").toString().trim();if(!t)return{};const e=t.toLowerCase();if(e.includes("url(")||e.includes("expression(")||e.includes("@import")||e.includes("@supports")||e.includes("@media"))return{};if(this._bgTestEl??="undefined"!=typeof document&&document?.createElement?document.createElement("div"):null,!this._bgTestEl)return{};const a=this._bgTestEl;if(/^(linear-gradient|radial-gradient|conic-gradient)\(/i.test(t)){if("undefined"!=typeof CSS&&CSS.supports?.("background-image",t))return a.style.backgroundImage="",a.style.backgroundImage=t,a.style.backgroundImage?{backgroundImage:a.style.backgroundImage}:{};try{return a.style.backgroundImage="",a.style.backgroundImage=t,a.style.backgroundImage?{backgroundImage:a.style.backgroundImage}:{}}catch(i){return{}}}if("undefined"!=typeof CSS&&CSS.supports?.("color",t))return a.style.backgroundColor="",a.style.backgroundColor=t,a.style.backgroundColor?{backgroundColor:a.style.backgroundColor}:{};try{return a.style.backgroundColor="",a.style.backgroundColor=t,a.style.backgroundColor?{backgroundColor:a.style.backgroundColor}:{}}catch(i){return{}}}_applyBargeInPreference(){const t=!1!==this.barge_in;try{T?.speech?.bargeIn&&(T.speech.bargeIn.enabled=t)}catch(e){}if(this._speakingAvatar?.setBargeInEnabled)try{const e=this._speakingAvatar.setBargeInEnabled(t);e&&"function"==typeof e.catch&&e.catch((t=>{}))}catch(e){}}firstUpdated(){const t=this.renderRoot.querySelector("#toastify-dismissable-alerts");this._alerts=new yt(this.bus,t,(()=>this.uiLanguage));try{const t=()=>{this._fontRevealTimeoutId=null,this.classList.add("icons-ready")};document.fonts&&document.fonts.ready?document.fonts.ready.then(t).catch((()=>t())):this._fontRevealTimeoutId=setTimeout(t,300)}catch(e){}this._unlockAudioHandler=()=>{this._unlockAudioContext()},window.addEventListener("click",this._unlockAudioHandler,{once:!0}),window.addEventListener("touchstart",this._unlockAudioHandler,{once:!0}),window.addEventListener("keydown",this._unlockAudioHandler,{once:!0})}_unlockAudioContext(){this._unlockAudioHandler&&(window.removeEventListener("click",this._unlockAudioHandler),window.removeEventListener("touchstart",this._unlockAudioHandler),window.removeEventListener("keydown",this._unlockAudioHandler),this._unlockAudioHandler=null),this._speakingAvatar?.avatarModule?.resumeAudioContext?.()}_setupAvatarStateSubscription(){if(this._speakingAvatar?.avatarOrchestrator){if(this._orchestratorUnsub){try{this._orchestratorUnsub()}catch{}this._orchestratorUnsub=null}this._orchestratorUnsub=this._speakingAvatar.avatarOrchestrator.subscribeProjected(((t,e)=>{if(!e)return;const a=this._actorSnapshot;this._actorSnapshot=e;let i=!1;const n=(t,e)=>{this[t]!==e&&(this[t]=e,i=!0)};try{n("_isConversationInProgress",!!e.hasTag?.("conversation_in_progress")),n("_isConversationPaused",!!e.hasTag?.("conversation_paused")),n("_isSpeaking",!!e.hasTag?.("speaking")),n("_isListening",!!e.hasTag?.("listening")),n("_isThinking",!!e.hasTag?.("thinking")),n("_inputsBlocked",!!e.hasTag?.("inputs_blocked")),n("_isAutoResuming",!!e.matches?.("lifecycle.conversation.autoResuming")),n("_isCheckingResume",!!e.matches?.("lifecycle.checkingResume")),n("_isResumeExpired",!!e.matches?.("lifecycle.conversation.resumeExpired")),n("_isInitializingConversation",!(!e.matches?.("lifecycle.conversation.initializingConversation")&&!e.matches?.("lifecycle.conversation.initializing"))),n("_isConversationTimedOut",!!e.matches?.("lifecycle.conversation.timedOut")),n("_isStartingConversation",!!(e.matches?.("lifecycle.conversation.inProgress.startingConversation")||e.matches?.("lifecycle.conversation.starting")||e.matches?.("lifecycle.conversation.autoResuming"))),n("_isConversationStopped",!!e.matches?.("lifecycle.conversation.stopped")),n("_isDisconnected",!!e.matches?.("connection.disconnected")),n("_isFailed",!(!e.matches?.("lifecycle.init.failed")&&!e.matches?.("lifecycle.failed")))}catch(s){}(i||a!==e)&&this.updateAlertStatus()}))}}updated(t){if(this.__postUpdateQueue||(this.__postUpdateQueue=[]),(t.has("toggler")||t.has("compact"))&&this.toggler&&this.compact&&(this.compact=!1),(t.has("target_app")||t.has("toggler"))&&"mobile"===this.target_app&&this.toggler&&(this.toggler=!1),t.has("uiLanguage")&&(this._applyUiLanguage(),this._applyDirectionFromUiLanguage()),t.has("barge_in")&&this.__postUpdateQueue.push((()=>this._applyBargeInPreference())),this.isInitialized()&&this._speakingAvatar?.sessionData&&(t.has("username")&&this.username!==this._speakingAvatar.sessionData.username&&(this._speakingAvatar.sessionData.username=this.username),t.has("phoneNumber")&&this.phoneNumber!==this._speakingAvatar.sessionData.phoneNumber&&(this._speakingAvatar.sessionData.phoneNumber=this.phoneNumber),t.has("email")&&this.email!==this._speakingAvatar.sessionData.email&&(this._speakingAvatar.sessionData.email=this.email),t.has("isTermsAccepted")&&this.isTermsAccepted!==this._speakingAvatar.sessionData.isTermsAccepted&&(this._speakingAvatar.sessionData.isTermsAccepted=this.isTermsAccepted)),t.has("api_key")||t.has("token_endpoint")||t.has("avatar_id")){const t=!(!this.api_key&&!this.token_endpoint||!this.avatar_id);t&&!this._initTriggered?(this._initTriggered=!0,this.__postUpdateQueue.push((()=>this._initialize()))):t||(this._initTriggered=!1,this.__postUpdateQueue.push((()=>this.updateAlertStatus("ErrorPage"))))}if((t.has("_showChatbot")||t.has("_shownPage"))&&(this.__postUpdateQueue.push((()=>{this._speakingAvatar?.chatSocket&&this._syncUiChatbotMode()})),t.has("_shownPage")&&this.__postUpdateQueue.push((()=>this._speakingAvatar?.avatarOrchestrator?.sendEvent("PAGE_CHANGED",{newPage:this._shownPage}))),t.has("_showChatbot")&&this.__postUpdateQueue.push((()=>{if(!("mobile"===this.target_app||this.toggler&&window.innerWidth<768))try{this.style.removeProperty("--chatbot-dynamic-height")}catch(t){}requestAnimationFrame((()=>{this.updateSize(),requestAnimationFrame((()=>{try{this._speakingAvatar?.avatarModule?.onResize?.()}catch(t){}}))}))}))),this.toggler&&t.has("_showChatbot")&&this._showChatbot&&!this._isConversationInProgress&&!this._isAutoResuming&&!this._isResumeExpired&&this._startOrResumeConversation(!0),t.has("_shownPage")&&("ChatPage"===this._shownPage?(this._scheduleInputFocus("chat"),this._scheduleChatScroll(),this._chatScrollTimeoutId&&clearTimeout(this._chatScrollTimeoutId),this._chatScrollTimeoutId=setTimeout((()=>{this._chatScrollTimeoutId=null,this._scheduleChatScroll()}),80)):"AvatarPage"===this._shownPage&&this._showTyping&&this._scheduleInputFocus("typing")),t.has("_showTyping")&&"AvatarPage"===this._shownPage&&this._showTyping&&this._scheduleInputFocus("typing"),t.has("_inputsBlocked")&&!this._inputsBlocked&&!0===t.get("_inputsBlocked")&&this._scheduleInputFocus(),t.has("canvasWidth")||t.has("canvasHeight")||t.has("chatbotHeight")){const t=()=>this.updateSize();this.__postUpdateQueue.push((()=>requestAnimationFrame(t)))}if(this.__postUpdateQueue.length){const t=this.__postUpdateQueue.splice(0);Promise.resolve().then((()=>{for(const a of t)try{a()}catch(e){}}))}if(t.has("_showChatConsentDialog")&&(this._showChatConsentDialog?this._activateConsentFocusTrap():this._deactivateConsentFocusTrap()),t.has("cornerRadius"))try{const t=this.cornerRadius;if(null==t||""===t)this.style.removeProperty("--corner-radius");else{const e=String(t).trim(),a=/^-?\d+(?:\.\d+)?$/.test(e)?`${e}px`:e;this.style.setProperty("--corner-radius",a)}}catch(e){}}render(){return Ht(this)}_scheduleInputFocus(t=null){this._focusTimeoutId&&(cancelAnimationFrame(this._focusTimeoutId),this._focusTimeoutId=null),this._focusTimeoutId=requestAnimationFrame((()=>{try{const e=t||this._getCurrentInputType();if(!e)return void(this._focusTimeoutId=null);const a="chat"===e?"#message_input":"#typed_input",i=this.shadowRoot.querySelector(a);i&&!i.disabled&&this._isElementFocusable(i)&&document.activeElement!==i&&i.focus()}catch(e){}finally{this._focusTimeoutId=null}}))}_getCurrentInputType(){return"ChatPage"===this._shownPage?"chat":"AvatarPage"===this._shownPage&&this._showTyping?"typing":null}_isElementFocusable(t){if(!t)return!1;if(null===t.offsetParent)return!1;if("none"===t.style.display||"hidden"===t.style.visibility)return!1;try{const e=window.getComputedStyle(t);return"none"!==e.display&&"hidden"!==e.visibility}catch(e){return!0}}async connectedCallback(){super.connectedCallback(),Xt._injectFontLinks(),["visibilitychange","pagehide","freeze"].forEach((t=>{this._onDom(document,t,(t=>this._handleVisibilityChange(t)))})),this._onDom(window,"focus",(t=>this._handleVisibilityChange(t))),this._onDom(window,"pageshow",(t=>this._handleVisibilityChange(t))),this._handleVisibilityChange({type:"init"}),requestAnimationFrame((()=>{this.updateSize(),requestAnimationFrame((()=>this.updateSize()))})),this._onBus("event_command_UI_UpdateCurrentMessage",(t=>{this._currentMessage={speaker:t.speaker,messageText:t.messageText,time:(new Date).toLocaleTimeString("en-US",{hour12:!1})}})),this._onBus("event_command_UI_UpdateSTTCaption",(t=>{if(this.enable_captions){const e=(t=>{if(t.length<=40)return t;const e=t.length-40,a=t.indexOf(" ",e);return-1!==a?t.slice(a).trim():t.slice(0,e).trim()})(t.STTCaption);this._updateLiveCaption(!0,e,"user")}})),this._onBus("event_command_UI_PlayCaptions",(t=>{if(this.enable_captions){const e=this._speakingAvatar?.avatarModule?.liveCaptions;e&&e.playCaptions(((t,e="",a=!1)=>{this._updateLiveCaption(t,e,"assistant",a)}),t.audioStartTime)}})),this._onBus("event_command_UI_ClearCaptions",(()=>{this._updateLiveCaption(!1,"","")})),this._onBus("event_command_UI_ClearConversation",(()=>{document.hidden||this._idleSpeakingAvatar(),this._speakingAvatar?.sessionData?.conversation?.transcript&&(this._conversationTranscript=[...this._speakingAvatar.sessionData.conversation.transcript]),this._updateLiveCaption(!1),this._currentMessage=null})),this._onBus("event_status_Conversation_MessageAppended",(t=>{try{this._speakingAvatar?.sessionData?.conversation?.transcript&&(this._conversationTranscript=[...this._speakingAvatar.sessionData.conversation.transcript])}catch(e){}if("user"===t?.speaker){this._userCaptionClearTimeoutId&&clearTimeout(this._userCaptionClearTimeoutId);const t=T?.captions?.captionTimeout;this._userCaptionClearTimeoutId=setTimeout((()=>{try{"user"===this._liveCaptionSpeaker&&this._updateLiveCaption(!1,"","")}finally{this._userCaptionClearTimeoutId=null}}),t)}this._scheduleChatScroll(),this._chatScrollTimeoutId&&clearTimeout(this._chatScrollTimeoutId),this._chatScrollTimeoutId=setTimeout((()=>{this._chatScrollTimeoutId=null,this._scheduleChatScroll()}),80)})),this._onBus("event_status_Conversation_TimedOut",(t=>{this.showConfirmationDialog(this._t("conversationExpiredPrompt"),(()=>{this._callDownloadTranscript(),this._speakingAvatar?.avatarOrchestrator?.sendEvent("CLEAR_CONVERSATION",{conversationId:t.conversationId})}),(()=>{this._speakingAvatar?.avatarOrchestrator?.sendEvent("CLEAR_CONVERSATION",{conversationId:t.conversationId})}),this._t("downloadAndClear"),this._t("onlyClear"))})),this._onBus("event_status_Conversation_StartFailed",(t=>{const e=t?.message||this._t("conversationStartFailed"),a=e.includes("403")||e.includes("permission")||e.includes("balance");this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:a?this._t("insufficientBalanceError"):e,className:"alert-danger"})})),this._onBus("event_status_Conversation_ResumedSuccessfully",(()=>{try{const t=this._speakingAvatar?.sessionData?.conversation;this._conversationTranscript=Array.isArray(t?.transcript)?t.transcript:[]}catch(t){this._conversationTranscript=[]}})),this._onBus("event_status_Conversation_ResumeFailedAndRestarted",(()=>{try{const t=this._speakingAvatar?.sessionData?.conversation;this._conversationTranscript=Array.isArray(t?.transcript)?t.transcript:[]}catch(t){this._conversationTranscript=[]}this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:this._t("resumeConversationFailedNewStarted"),className:"alert-warning"})})),this._onBus("event_status_Conversation_ResumeExpired",(()=>{this.showConfirmationDialog(this._t("conversationExpiredResumePrompt"),(()=>{this._callDownloadTranscript(),this._speakingAvatar?.avatarOrchestrator?.sendEvent("DISMISS")}),(()=>{this._speakingAvatar?.avatarOrchestrator?.sendEvent("DISMISS")}),this._t("download"),this._t("ok"))})),this._onBus("event_command_UI_RequestUserData",(()=>{"mobile"===this.target_app?this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:this._t("enterInfoOnMobile"),className:"alert-warning"}):this._showUserData=!0})),this._onBus("event_command_UI_EnableCaptions",(()=>{this.enable_captions=!0})),this._onBus("event_command_UI_DisableCaptions",(()=>{this.enable_captions=!1})),this._onBus("event_status_Avatar_RenderingStateChanged",(t=>{const e=!!t?.running,a=t?.reason;"resume_start"===a?this._avatarResuming=!0:"resume"===a&&(this._avatarResuming=!1),e&&this._avatarResuming&&(this._avatarResuming=!1),this._avatarRunning!==e&&(this._avatarRunning=e),e&&(this._videoAvatarReconnectAttempt=0,this._videoAvatarReconnectCooldownUntil=0,this._isVideoAvatarIdleDisconnected&&(this._isVideoAvatarIdleDisconnected=!1),this._isVideoAvatarReconnecting&&(this._isVideoAvatarReconnecting=!1,this._clearVideoAvatarReconnectTimeout()))})),this._onBus("event_status_VideoAvatar_IdleDisconnected",(()=>{this._isVideoAvatarIdleDisconnected=!0,this._isVideoAvatarReconnecting=!1})),this._onBus("event_status_Avatar_Error",(t=>{this._isVideoAvatarReconnecting&&this._isConversationInProgress&&(this._isVideoAvatarReconnecting=!1,this._isVideoAvatarIdleDisconnected=!0)})),this._onBus("event_command_UI_SwitchToChatMode",(()=>{"ChatPage"!==this._shownPage?this._shownPage="ChatPage":this._syncUiChatbotMode()})),this._onBus("event_command_UI_SwitchToAvatarMode",(()=>{"AvatarPage"!==this._shownPage?this._shownPage="AvatarPage":this._syncUiChatbotMode();try{this._startListening()}catch(t){}})),this._onBus("event_command_UI_EndConversation",(()=>{this._endConversation()})),this._onDom(window,"resize",this.handleWindowResize.bind(this));try{const t="undefined"!=typeof window&&window.visualViewport?window.visualViewport:null;t&&(this._onDom(t,"resize",this.handleWindowResize.bind(this)),this._onDom(t,"scroll",this.handleWindowResize.bind(this)))}catch(e){}this.resizeObserver=new ResizeObserver((t=>{if(!t||!t.length)return;const a=t[0],{width:i,height:n}=a.contentRect||{};if((!this.toggler||!1!==this._showChatbot)&&i>120&&n>120&&(T.dom.canvasWidth=Math.round(i),T.dom.canvasHeight=Math.round(n),this._speakingAvatar&&this._speakingAvatar.avatarModule))try{this._speakingAvatar.avatarModule.onResize()}catch(e){}}));const t=this.renderRoot.querySelector("#avatar-container");t&&(this.resizeObserver.observe(t),this._avatarContainerClickHandler=()=>{this._speakingAvatar?.avatarModule?.resumeAudioContext?.()},t.addEventListener("click",this._avatarContainerClickHandler));try{this.hostResizeObserver=new ResizeObserver((()=>{requestAnimationFrame((()=>this.updateSize()))})),this.hostResizeObserver.observe(this)}catch(e){}}disconnectedCallback(){if(super.disconnectedCallback(),this._unlockAudioHandler&&(window.removeEventListener("click",this._unlockAudioHandler),window.removeEventListener("touchstart",this._unlockAudioHandler),window.removeEventListener("keydown",this._unlockAudioHandler),this._unlockAudioHandler=null),this._disposeListeners(),this.captionsTimeoutId&&(clearTimeout(this.captionsTimeoutId),this.captionsTimeoutId=null),this._userCaptionClearTimeoutId&&(clearTimeout(this._userCaptionClearTimeoutId),this._userCaptionClearTimeoutId=null),this._fontRevealTimeoutId&&(clearTimeout(this._fontRevealTimeoutId),this._fontRevealTimeoutId=null),this._captionSwitchTimeoutId&&(clearTimeout(this._captionSwitchTimeoutId),this._captionSwitchTimeoutId=null),this._menuHideTimeoutId&&(clearTimeout(this._menuHideTimeoutId),this._menuHideTimeoutId=null),this._chatScrollTimeoutId&&(clearTimeout(this._chatScrollTimeoutId),this._chatScrollTimeoutId=null),this._clearVideoAvatarReconnectTimeout(),this._orchestratorUnsub){try{this._orchestratorUnsub()}catch{}this._orchestratorUnsub=null}if(this._focusTimeoutId&&(cancelAnimationFrame(this._focusTimeoutId),this._focusTimeoutId=null),this._bgTestEl=null,this._speakingAvatar?.destroy?.(),this.resizeObserver&&(this.resizeObserver.disconnect(),this.resizeObserver=null),this.hostResizeObserver){try{this.hostResizeObserver.disconnect()}catch(t){}this.hostResizeObserver=null}if(this._avatarContainerClickHandler){const t=this.renderRoot?.querySelector("#avatar-container");t?.removeEventListener("click",this._avatarContainerClickHandler),this._avatarContainerClickHandler=null}this._deactivateConsentFocusTrap()}updateSize(){const t="undefined"!=typeof window&&window.visualViewport?window.visualViewport:null,e=t?Math.round(t.width):window.innerWidth,a=t?Math.round(t.height):window.innerHeight,i=t?Math.round(t.offsetTop):0,n=e<T.dom.smallDisplayWidth;let s,o;const r=t=>{const e=Number(t);return Number.isFinite(e)&&e>0?e:null},c=r(this.canvasWidth),l=r(this.canvasHeight),h=r(this.chatbotHeight),d=(this.compact?0:T.dom.headerAndFooterHeight)+T.dom.controlsHeight;if("mobile"===this.target_app){s=e,o=a;try{this.style.setProperty("--chatbot-dynamic-height",`${a}px`),this.style.setProperty("--chatbot-dynamic-top",`${i}px`)}catch(u){}}else if(this.toggler)if(n){s=e,o=a;try{this.style.setProperty("--chatbot-dynamic-height",`${a}px`),this.style.setProperty("--chatbot-dynamic-top",`${i}px`)}catch(u){}}else{const t=Math.max(120,c??(T.dom.canvasWidth||400)),e=Math.max(120,l??(T.dom.canvasHeight||500));s=t,o=Math.max(120,h??e+d)}else{const t=this.getBoundingClientRect?.()||{},i=Math.round(t.width||this.offsetWidth||this.clientWidth||e),n=Math.round(t.height||this.offsetHeight||this.clientHeight||a),r=Math.max(120,c??i),u=Math.max(120,l??(T.dom.canvasHeight||n));s=r;const p=n>=120?n:u+d;o=Math.max(120,h??(l?u+d:p))}this._canvasWidth===s&&this._chatbotHeight===o||(this._canvasWidth=s,this._chatbotHeight=o)}async _initialize(){if(this._initInProgress&&this._initPromise)return this._initPromise;this._initInProgress=!0;const t=(async()=>{if(""===this.api_key&&""===this.token_endpoint||""===this.avatar_id)this.updateAlertStatus("ErrorPage");else{this.updateAlertStatus("LoaderPage");try{const t=await this._getChatbotState();this._showChatbot=t.isVisible,this._savedChatbotMode=t.mode,null!==t.enableCaptions&&(this.enable_captions=t.enableCaptions),await this.updateComplete,await this._initializeSpeakingAvatar()}catch(t){this.updateAlertStatus("DisconnectedPage")}}})();this._initPromise=t;try{await this._initPromise}finally{this._initInProgress=!1,this._initPromise=null}}async _initializeSpeakingAvatar(){const t={avatarAPIKey:this.api_key,avatarId:this.avatar_id,avatarContainer:this.renderRoot.querySelector("#avatar-container"),tokenEndpoint:this.token_endpoint,targetApp:this.target_app};this._wakeLock.request();try{if(!(await this._speakingAvatar.init(t)))throw new Error("Initialization failed");this._avatarName=this._speakingAvatar.sessionData.avatarName,this._language=this._speakingAvatar.sessionData.language,this.username=this._speakingAvatar.sessionData.username,this.phoneNumber=this._speakingAvatar.sessionData.phoneNumber,this.email=this._speakingAvatar.sessionData.email,!0===this.isTermsAccepted?this._speakingAvatar.sessionData.isTermsAccepted=!0:this.isTermsAccepted=this._speakingAvatar.sessionData.isTermsAccepted,this._isFullBody=this._speakingAvatar?.avatarModule?.isFullBody,this._isVideoAvatar=this._speakingAvatar?.isVideoAvatar?.()??!1,this._isVideoAvatar&&(this._videoAvatarPlaceholderImageUrl=this._getVideoAvatarPlaceholderImageUrl(),null===(await this._getChatbotState().catch((()=>({enableCaptions:null})))).enableCaptions&&(this.enable_captions=!1)),this._setupAvatarStateSubscription();const e=null!==this._speakingAvatar?.sessionData?.trainingId;e&&(this._initConversation(),this._syncUiChatbotMode()),e?"CHAT"===this._savedChatbotMode?this._shownPage="ChatPage":this._shownPage="AvatarPage":this._shownPage="ErrorPage"}catch(e){throw e}}handleWindowResize(){this.updateSize()}_handleVisibilityChange(t){let e=!0;try{const a="string"==typeof t?t:t?.type;e=!(document.hidden||"hidden"===document.visibilityState),"pagehide"!==a&&"freeze"!==a||(e=!1),"pageshow"!==a&&"focus"!==a||(e=!0)}catch(i){e=!0}const a=this._speakingAvatar?.avatarOrchestrator;a&&"function"==typeof a.sendEvent?a.sendEvent("VISIBILITY_CHANGED",{isVisible:e}):e?this._resumeAfterForeground():this._pauseAvatarForBackground()}_pauseAvatarForBackground(){this._speakingAvatar?.avatarOrchestrator?(this._speakingAvatar.avatarOrchestrator.is("speaking")&&this._speakingAvatar.avatarOrchestrator.sendEvent("INTERRUPT"),this._speakingAvatar.avatarOrchestrator.is("listening")&&this._speakingAvatar.avatarOrchestrator.sendEvent("IDLE"),this._speakingAvatar.avatarOrchestrator.is("idle")||this._speakingAvatar.avatarOrchestrator.is("stopped")||this._idleSpeakingAvatar(),this._wakeLock.release()):this._wakeLock.release()}_resumeAfterForeground(){}_idleSpeakingAvatar(){this._speakingAvatar&&this._speakingAvatar.avatarOrchestrator&&(this._speakingAvatar.avatarOrchestrator.is("idle")||this._speakingAvatar.avatarOrchestrator.is("stopped")||this._speakingAvatar.avatarOrchestrator.sendEvent("IDLE"))}_startListening(){this._inputsBlocked||this._isConversationInProgress&&this._speakingAvatar?.avatarOrchestrator?.is("idle")&&this._speakingAvatar?.avatarOrchestrator?.sendEvent("LISTEN")}_initConversation(){this.isInitialized()&&this._speakingAvatar?.avatarOrchestrator?.sendEvent("INIT_CONVERSATION")}_startOrResumeConversation(t=!1){Promise.resolve(this._hasChatConsent()).then((e=>{e?this._proceedStartConversation(t):this._showChatConsentDialog=!0})).catch((()=>{this._showChatConsentDialog=!0}))}_proceedStartConversation(t){try{const t=!(document.hidden||"hidden"===document.visibilityState);this._speakingAvatar?.avatarOrchestrator?.sendEvent("VISIBILITY_CHANGED",{isVisible:t})}catch(e){}this._speakingAvatar?.sessionData&&!0===this.isTermsAccepted&&(this._speakingAvatar.sessionData.isTermsAccepted=!0),this._speakingAvatar?.avatarOrchestrator?.sendEvent("START_CONVERSATION",{fresh:t,termsAccepted:!0===this.isTermsAccepted})}_endConversation(t=!0){t?this._showSatisfactionScore=!0:this._speakingAvatar?.avatarOrchestrator?.sendEvent("END_CONVERSATION",{satisfactionScore:0})}_updateLiveCaption(t,e="",a="",i=!1,n=!1){const s=T?.captions??{},o=s.captionChangeDelay??200,r=s.captionTimeout??1500,c=this._liveCaptionSpeaker;t&&"user"===a&&this._userCaptionClearTimeoutId&&(clearTimeout(this._userCaptionClearTimeoutId),this._userCaptionClearTimeoutId=null),n?(this._isLiveCaptionsVisible=!1,this._captionSwitchTimeoutId&&clearTimeout(this._captionSwitchTimeoutId),this._captionSwitchTimeoutId=setTimeout((()=>{this._captionSwitchTimeoutId=null,this._isLiveCaptionsVisible=t,this._liveCaption=e,this._liveCaptionSpeaker=a}),o)):(this.captionsTimeoutId&&(clearTimeout(this.captionsTimeoutId),this.captionsTimeoutId=null),this._isLiveCaptionsVisible=t,this._liveCaption=e,this._liveCaptionSpeaker=a),t||"user"===(a||c)&&this._userCaptionClearTimeoutId&&(clearTimeout(this._userCaptionClearTimeoutId),this._userCaptionClearTimeoutId=null),i&&(this.captionsTimeoutId=setTimeout((()=>{this._isLiveCaptionsVisible=!1,this._liveCaption="",this._liveCaptionSpeaker="",this._userCaptionClearTimeoutId&&(clearTimeout(this._userCaptionClearTimeoutId),this._userCaptionClearTimeoutId=null),this.captionsTimeoutId=null}),r))}updateAlertStatus(t=null){const e=this._actorSnapshot,a=!(!this.api_key&&!this.token_endpoint||!this.avatar_id),i=this._speakingAvatar?.sessionData&&null===this._speakingAvatar.sessionData.trainingId,n=!0===this._avatarResuming,s=(()=>{try{const t=this._speakingAvatar?.avatarModule;if(t?.isVideoAvatar&&t?.isRenderingActive?.())return!0}catch(t){}return!1})();let o=null;if(o=a?e?.matches?.("lifecycle.init.initializing")?s?"connected":"initializing":e?.matches?.("lifecycle.init.failed")?"failed":i?"invalidConfiguration":e?.matches?.("connection.connected")?"connected":"recovering":"invalidConfiguration","initializing"===o&&!e?.matches?.("lifecycle.init.initializing")&&e?.matches?.("connection.connected"))try{const t=this._speakingAvatar?.avatarModule?.isRenderingActive?.();!0===t&&(o="connected",this._avatarResuming=!1)}catch(r){}n||"initializing"!==o||"connected"!==this._statusBarStatus&&"recovering"!==this._statusBarStatus||(o=this._statusBarStatus),this._isVideoAvatarIdleDisconnected&&"recovering"===o&&(o="connected"),this._isVideoAvatar&&!this._isConversationInProgress&&"recovering"===o&&(o="connected"),this._statusBarStatus!==o&&(this._statusBarStatus=o),null!==t&&this._shownPage!==t&&(this._shownPage=t)}get initStatusValue(){return this.initStatus()}initStatus(){const t=this._actorSnapshot;if(!t)return"INITIALIZING";if(!this.api_key&&!this.token_endpoint||!this.avatar_id)return"INVALID";if(t.matches?.("lifecycle.init.failed"))return"FAILED";if(t.context?.initFailed&&t.matches?.("lifecycle.init.initializing"))return"FAILED";if(t.matches?.("lifecycle.init.initializing"))return"INITIALIZING";const e=this._speakingAvatar?.sessionData;return e&&e.avatarId&&null===e.trainingId?"INVALID":"COMPLETED"}isInitialized(){return"COMPLETED"===this.initStatus()}isInitializing(){return"INITIALIZING"===this.initStatus()}_handleToggleChatbot(){this._showChatbot||this._isConversationInProgress||this._isInitializingConversation?this._updateChatbotVisibility(!this._showChatbot):(this._updateChatbotVisibility(!0),this.isInitialized()&&this._startOrResumeConversation())}_updateChatbotVisibility(t){this._showChatbot=t,this._saveChatbotState()}_saveChatbotState(){const t="ChatPage"===this._shownPage?"CHAT":"AVATAR",e={isVisible:this._showChatbot,mode:t,enableCaptions:this.enable_captions};et.setItem("chatbotState_"+this.avatar_id,JSON.stringify(e))}async _getChatbotState(){try{const t=await et.getItem("chatbotState_"+this.avatar_id);if(t){const e=JSON.parse(t);return{isVisible:!0===e.isVisible,mode:e.mode||"AVATAR",enableCaptions:void 0!==e.enableCaptions?e.enableCaptions:null}}}catch(t){}return{isVisible:!1,mode:"AVATAR",enableCaptions:null}}_openLastMessage(t){this._lastMessageText=this._currentMessage.messageText,this._showLastMessage=!0}_closeLastMessage(){this._showLastMessage=!1}_showMenuOnHover(){window.matchMedia("(hover: hover)").matches&&(this._showMenu=!0,this.shadowRoot.getElementById("menu").classList.remove("hidden"))}_handleChatbotClick(){if(!this.compact){const t=this.shadowRoot.getElementById("menu");t?.classList.add("hide"),this._menuHideTimeoutId&&clearTimeout(this._menuHideTimeoutId),this._menuHideTimeoutId=setTimeout((()=>{this._menuHideTimeoutId=null,t?.classList.contains("hide")&&(this._showMenu=!1)}),500)}}_closeChatbot(){this._updateChatbotVisibility(!1)}_handleToggleMenu(){this._showMenu=!this._showMenu}_handleMicBtn(){const t=this._speakingAvatar?.avatarOrchestrator;t&&(this._isConversationInProgress||this._isStartingConversation)?(this._speakingAvatar?.avatarModule?.resumeAudioContext?.(),t.sendEvent("MIC_BUTTON")):this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:this._t("startConversationReminder")})}_handleShowChatPage(){this.isInitialized()&&(this._shownPage="ChatPage",this._showMenu=!1,this._saveChatbotState())}_handleShowAvatarPage(){this.isInitialized()&&(this._shownPage="AvatarPage",this._showMenu=!1,this._saveChatbotState())}_handleBackToAvatar(){this._handleShowAvatarPage()}_handleSwitchToChat(){this._handleShowChatPage()}_handleShowUserData(t){t.preventDefault(),this._showUserData=!0,this._showMenu=!1}_handleEndConversationBtn(t){t&&(t.preventDefault(),t.stopPropagation()),this.showConfirmationDialog(this._t("endConversationPrompt"),(()=>{this._endConversation()}),(()=>{}),this._t("end"),this._t("cancel")),this._showMenu=!1}_handleStartConversationMenuBtn(t){t.preventDefault(),t.stopPropagation(),this._shouldConfirmRestart()?this._handleRestartConversation():(this._startOrResumeConversation(!0),this._showMenu=!1)}_handleStartConversationBtn(t){t.preventDefault(),this._shouldConfirmRestart()?this._handleRestartConversation():this._startOrResumeConversation(!0)}_handleRestartConversation(){this.showConfirmationDialog(this._t("restartConversationPrompt"),(()=>{this._idleSpeakingAvatar(),this._startOrResumeConversation(!0)}),(()=>{}),this._t("newConversation"),this._t("cancel"))}_consentStorageKey(){return`chatConsent_${this.avatar_id||"unknown"}`}async _hasChatConsent(){if(!0===this.isTermsAccepted)return!0;try{return"accepted"===await et.getItem(this._consentStorageKey())}catch(t){return!1}}async _handleConsentAccept(){try{await et.setItem(this._consentStorageKey(),"accepted")}catch(t){}this._showChatConsentDialog=!1;try{this.isTermsAccepted=!0,this._speakingAvatar?.sessionData&&(this._speakingAvatar.sessionData.isTermsAccepted=!0)}catch(t){}this._shouldConfirmRestart()?this._handleRestartConversation():this._startOrResumeConversation(!0)}async _handleConsentDecline(){try{await et.setItem(this._consentStorageKey(),"declined")}catch(t){}this._showChatConsentDialog=!1}_activateConsentFocusTrap(){requestAnimationFrame((()=>{try{this.shadowRoot?.querySelector(".dialog .button-save")?.focus()}catch(t){}}));const t=t=>{if(this._showChatConsentDialog&&("Escape"===t.key&&(this._showChatConsentDialog=!1,t.stopPropagation()),"Tab"===t.key)){const e=Array.from(this.shadowRoot.querySelectorAll(".dialog button"));if(!e.length)return;const a=e.indexOf(document.activeElement);t.preventDefault(),(t.shiftKey?a<=0?e[e.length-1]:e[a-1]:a===e.length-1?e[0]:e[a+1]).focus()}};this._consentKeyHandler=t,this.addEventListener("keydown",t)}_deactivateConsentFocusTrap(){this._consentKeyHandler&&(this.removeEventListener("keydown",this._consentKeyHandler),this._consentKeyHandler=null)}_canDownloadTranscript(){return this._conversationTranscript.length>0}_handleDownloadTranscriptMenuBtn(t){t.preventDefault(),this._callDownloadTranscript(),this._showMenu=!1}_callDownloadTranscript(){((t,e,a,i)=>{const n=(new Date).toLocaleString().replace(/[/:, ]/g,"-");let s=`\ufeff\nCONVERSATION TRANSCRIPT\n\n\nš
Date: ${(new Date).toLocaleString()}\nš¤ Assistant: ${e}\nš¤ User: ${a||"User"}${t?`\nā” Powered by ${t}`:""}\n\n`;i.forEach((t=>{const{speaker:i,messageText:n,time:o}=t;let r,c;if("user"===i)r=a||"User",c="š¤";else{if("assistant"!==i)return;r=e,c="š¤"}s+=`${c} ${r} [${o}]\n${n}\n\nāāāāāāāāāāāāāāāāāāāāā\n\n`}));const o=new Blob([s],{type:"text/plain;charset=utf-8"}),r=document.createElement("a");r.href=URL.createObjectURL(o),r.download=`transcript-${e}-${n}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r)})(this.brand_name,this._speakingAvatar.sessionData.avatarName,this._speakingAvatar.sessionData.username,this._conversationTranscript)}async _handleSaveClick(){this._speakingAvatar.sessionData.username=this.username,this._speakingAvatar.sessionData.phoneNumber=this.phoneNumber,this._speakingAvatar.sessionData.email=this.email,this._speakingAvatar.sessionData.isTermsAccepted=this.isTermsAccepted,this._speakingAvatar?.chatSocket?.sendUserData(),this._showUserData=!1}_handleCancelClick(){this._showUserData=!1}_handleChatKeyUp(t){"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),this._handleSendTextMessage())}_handleSendTextMessage(){if(this._inputsBlocked)return void this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:this._t("waitCurrentResponse")});const t=this.renderRoot.querySelector("#message_input"),e=t.value;e&&""!==e.trim()&&(this._speakingAvatar?.avatarModule?.resumeAudioContext?.(),t.value="",this._speakingAvatar?.avatarOrchestrator?.sendEvent("SEND_TEXT_MESSAGE",{message:e}))}_handleTypingKeyUp(t){"Enter"!==t.key&&13!==t.keyCode||(t.preventDefault(),this._handleSendTypedInput())}_handleSendTypedInput(){if(this._inputsBlocked)return void this.bus.emit("event_command_Alerts_ShowDismissableAlert",{errorMessage:this._t("waitCurrentResponse")});const t=this.renderRoot.querySelector("#typed_input"),e=t.value;e&&""!==e.trim()&&(this._speakingAvatar?.avatarModule?.resumeAudioContext?.(),t.value="",this._speakingAvatar?.avatarOrchestrator?.sendEvent("SEND_TEXT_MESSAGE",{message:e,chatbotMode:"AVATAR"}))}showConfirmationDialog(t,e,a,i,n){this._dialogMessage=t,this._confirmDialog=e,this._cancelDialog=a,this._confirmButtonLabel=i??this._t("confirm"),this._cancelButtonLabel=n??this._t("cancel"),this._showConfirmationDialog=!0}_handleConfirm(){this._confirmDialog&&this._confirmDialog(),this._resetDialog()}_handleCancel(){this._cancelDialog&&this._cancelDialog(),this._resetDialog()}_resetDialog(){this._showConfirmationDialog=!1,this._confirmDialog=()=>{},this._cancelDialog=()=>{},this._dialogMessage="",this._confirmButtonLabel=this._t("confirm"),this._cancelButtonLabel=this._t("cancel")}_handleToggleCaptionsSwitch(t){this.enable_captions=t.target.checked,this._saveChatbotState()}_handleVisemeButtonClick(t){this.bus.emit("event_command_visemeButtonClick",{visemeId:t.target.getAttribute("data-viseme-id")})}_handleFacialButtonClick(t){this.bus.emit("event_command_facialButtonClick",{facialId:t.target.getAttribute("data-facial-id")})}_handleConnectBtn(){"COMPLETED"!==this.initStatus()?this._initialize():this._speakingAvatar?.isVideoAvatar?.()?this.bus.emit("event_command_Avatar_UserReconnect"):this.bus.emit("event_command_ConnectionManager_ReconnectFailedModules")}_handleUpperBodyIcon(){this._speakingAvatar?.avatarModule?.setView("upper")}_handleFullBodyIcon(){this._speakingAvatar?.avatarModule?.setView("full")}_handleMidBodyIcon(){this._speakingAvatar?.avatarModule?.setView("mid")}_handleHeadBodyIcon(){this._speakingAvatar?.avatarModule?.setView("head")}_handlePlaceholderImageError(t){const e=t?.target;if(!(e instanceof HTMLImageElement&&e.classList.contains("video-avatar-placeholder-image")))return;e.style.display="none";const a=this.renderRoot?.querySelector(".video-avatar-placeholder-fallback");a&&(a.style.display="block")}_handleVideoAvatarReconnect(){if(this._isVideoAvatarReconnecting)return;const t=Date.now();if(t<(this._videoAvatarReconnectCooldownUntil||0))return;this._videoAvatarReconnectAttempt=(this._videoAvatarReconnectAttempt||0)+1;const e=Math.min(3e4,2e3*2**(this._videoAvatarReconnectAttempt-1));this._videoAvatarReconnectCooldownUntil=t+e,this._speakingAvatar?.avatarModule?.resumeAudioContext?.(),this._isVideoAvatarIdleDisconnected=!1,this._isVideoAvatarReconnecting=!0,this._clearVideoAvatarReconnectTimeout(),this._videoAvatarReconnectTimeoutId=setTimeout((()=>{this._isVideoAvatarReconnecting&&!this._avatarRunning&&(this._isVideoAvatarReconnecting=!1,this._isVideoAvatarIdleDisconnected=!0)}),3e4),this.bus.emit("event_command_Avatar_UserReconnect")}_clearVideoAvatarReconnectTimeout(){this._videoAvatarReconnectTimeoutId&&(clearTimeout(this._videoAvatarReconnectTimeoutId),this._videoAvatarReconnectTimeoutId=null)}_getVideoAvatarPlaceholderImageUrl(){try{const t=this._speakingAvatar?.auth?.getAvatarParameters?.();if(!t)return null;const e=t.avatarSource?.toLowerCase?.();if("azure"!==e)return null;const a=t.avatarSourceId;if(!a)return null;const[i,n]=a.includes(":")?a.split(":"):[a,"casual-sitting"];return i&&n?`https://sentifydavatars.blob.core.windows.net/azure/${i}-${n}.png`:null}catch(t){return null}}_handleSubmitScoreClick(){this._speakingAvatar?.avatarOrchestrator?.sendEvent("END_CONVERSATION",{satisfactionScore:this._satisfactionScore}),this._showSatisfactionScore=!1}_handleCancelScoreClick(){this._speakingAvatar?.avatarOrchestrator?.sendEvent("END_CONVERSATION",{satisfactionScore:0}),this._showSatisfactionScore=!1}_scheduleChatScroll(){try{if("ChatPage"!==this._shownPage)return;requestAnimationFrame((()=>{try{const t=this.shadowRoot?.querySelector(".chatbox");t&&(t.scrollTop=t.scrollHeight)}catch(t){}}))}catch(t){}}_syncUiChatbotMode(){if(!this._speakingAvatar?.avatarOrchestrator||!this._speakingAvatar?.chatSocket)return;const t={isShown:!this.toggler||this._showChatbot,chatbotMode:"AvatarPage"===this._shownPage?"AVATAR":"CHAT"};t.isShown===this._lastUiChatbotMode.isShown&&t.chatbotMode===this._lastUiChatbotMode.chatbotMode||(this._speakingAvatar.avatarOrchestrator.sendEvent("UI_CHATBOT_MODE",t),this._lastUiChatbotMode=t)}_handleToggleTyping(){this._showTyping=!this._showTyping}_testSetAuthConnected(t="connected"){this._speakingAvatar?.connectionManager?.connectionModules.authentication.updateConnectionState(t)}_testSetSocketConnected(t="connected"){this._speakingAvatar?.connectionManager?.connectionModules.chatSocket.updateConnectionState(t)}_testSetSpeechConnected(t="connected"){this._speakingAvatar?.connectionManager?.connectionModules["speech-token"].updateConnectionState(t)}_shouldConfirmRestart(){return!!(this._isConversationInProgress||this._isConversationPaused||this._isAutoResuming||this._isConversationTimedOut||this._isInitializingConversation)}}const Zt="undefined"!=typeof window&&void 0!==window.sessionStorage,Jt={getItem:t=>Promise.resolve(Zt?window.sessionStorage.getItem(t):null),setItem:(t,e)=>Promise.resolve(Zt?window.sessionStorage.setItem(t,e):void 0),removeItem:t=>Promise.resolve(Zt?window.sessionStorage.removeItem(t):void 0)};function te(t){et.setInstance(t)}function ee(){"undefined"!=typeof window&&void 0!==window.customElements&&(customElements.get("sentifyd-bot")||customElements.define("sentifyd-bot",Xt))}function ae(t){if(ee(),t.containerId&&document.querySelector(`#${t.containerId} sentifyd-bot`))return document.querySelector(`#${t.containerId} sentifyd-bot`);let e=document.body;if(t.containerId){const a=document.getElementById(t.containerId);a&&(e=a)}const a=document.createElement("sentifyd-bot");return Object.keys(t).forEach((e=>{if("containerId"===e||"customAttributes"===e)return;const i=t[e];if(null!=i&&""!==i){const t=e.replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase();a.setAttribute(t,"boolean"==typeof i?String(i):i)}})),t.customAttributes&&Object.keys(t.customAttributes).forEach((e=>{const i=t.customAttributes[e];null!=i&&""!==i&&a.setAttribute(e,String(i))})),e.appendChild(a),a}et.setInstance(Jt),"undefined"!=typeof window&&ee();export{F as C,Xt as S,ae as a,T as c,te as i,ee as r};
|