PageSourceSearch

https://ailikeme.ai/static/2278.46fec5593672808e31b9.js

js ailikeme.ai collected 2026-10-05 15:28:15 UTC 45,309 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkmy_webpack_project=self.webpackChunkmy_webpack_project||[]).push([[2278,5852],{72629(e,t,n){var a=n(88569);t.A=void 0;var r=a(n(89987)),o=n(47671);t.A=(0,r.default)((0,o.jsx)("path",{d:"M20 15.5c-1.25 0-2.45-.2-3.57-.57-.35-.11-.74-.03-1.02.24l-2.2 2.2c-2.83-1.44-5.15-3.75-6.59-6.59l2.2-2.21c.28-.26.36-.65.25-1C8.7 6.45 8.5 5.25 8.5 4c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1 0 9.39 7.61 17 17 17 .55 0 1-.45 1-1v-3.5c0-.55-.45-1-1-1M21 6h-3V3h-2v3h-3v2h3v3h2V8h3z"}),"AddIcCall")},44100(e,t,n){var a=n(88569);t.A=void 0;var r=a(n(89987)),o=n(47671);t.A=(0,r.default)((0,o.jsx)("path",{d:"M15 8v8H5V8zm1-2H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4V7c0-.55-.45-1-1-1"}),"VideocamOutlined")},28288(e,t,n){n.r(t),n.d(t,{default:()=>ee});var a=n(39471),r=n(28923),o=n(82390),s=n(32972),i=n(18467),l=n(28374),c=n(58616),u=n(33724),d=n(88477),v=n(62064),h=n(78854),m=(n(21812),n(85635)),f=n(35256),p=n(90234),g=n(45457),b=n(86822),w=n(45345),y=n(35710),k=n(45034),E=n(37558),S=n(72629),A=n(44100),C=n(47281),x=n(60705),_=n(62077),I=n(51794),L=n(43353),O=n(28152),T=n(27714),P=(n(23059),n(63421),n(7392),n(32223)),N=n(78061),D=n(16243),R=n(34126),B=n(57282),j=n(5185),H=n(80472),W=n(89996),M=n(40317),q=n(34646);function F(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,o,s,i=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(i.push(a.value),i.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return z(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?z(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function z(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}const V=e=>{let t=e.influencerId,n=e.onPersonalityChange;const r=F((0,a.useState)([]),2),o=r[0],s=r[1],i=F((0,a.useState)(null),2),l=i[0],c=i[1],u=F((0,a.useState)(!0),2),d=u[0],v=u[1],h=F((0,a.useState)(null),2),m=h[0],f=h[1];(0,a.useEffect)(()=>{t&&p()},[t]);const p=async()=>{try{v(!0),f(null);const e=await(0,I.gD)(t);if(e.data&&e.data.success){const t=e.data.personalities||[],n=e.data.selected_personality_id;s(t),c(n||null)}}catch(e){console.error("Error fetching personalities:",e),f("Failed to load personalities")}finally{v(!1)}};return d?a.createElement(j.A,{variant:"caption",color:"textSecondary",sx:{fontSize:"0.75rem",marginTop:"4px"}},"Loading..."):m?a.createElement(j.A,{variant:"caption",color:"error",sx:{fontSize:"0.75rem",marginTop:"4px"}},m):0===o.length?null:a.createElement(b.A,{sx:{minWidth:140}},a.createElement(H.A,{fullWidth:!0,size:"small"},a.createElement(W.A,{id:"personality-selector",value:null===l?"":l,displayEmpty:!0,onChange:e=>async function(e){let a=arguments.length>1&&void 0!==arguments[1]&&arguments[1];try{const s=await(0,I.dL)(t,e);if(s.data&&s.data.success){if(c(e),!a){var r;const t=null===e?"Default Mode":(null===(r=o.find(t=>t.id===e))||void 0===r?void 0:r.name)||"Personality";q.Ay.success("Switched to ".concat(t))}if(n){const t=null===e?null:o.find(t=>t.id===e);n(t)}}}catch(e){console.error("Error setting personality:",e),q.Ay.error("Failed to update personality")}}(""===e.target.value?null:e.target.value),sx:{fontSize:"0.75rem",height:"40px",backgroundColor:"#fff",borderRadius:"12px","& .MuiSelect-select":{paddingTop:"8px",paddingBottom:"8px",paddingLeft:"16px",paddingRight:"32px",display:"flex",alignItems:"center"},"& .MuiOutlinedInput-notchedOutline":{borderColor:"#B7B7B7",borderWidth:"1px"},"&:hover .MuiOutlinedInput-notchedOutline":{borderColor:"#B7B7B7",borderWidth:"1px"},"&.Mui-focused .MuiOutlinedInput-notchedOutline":{borderColor:"#B7B7B7",borderWidth:"1px"}
1,"& .MuiSvgIcon-root":{color:"#747881"}},renderValue:e=>{if(""===e||null===e)return a.createElement(j.A,{variant:"caption",sx:{fontSize:"0.75rem",fontWeight:400,color:"#747881"}},"Default Mode");const t=o.find(t=>t.id===e);return t?a.createElement(j.A,{variant:"caption",sx:{fontSize:"0.75rem",fontWeight:400,color:"#747881"}},t.name):a.createElement(j.A,{variant:"caption",sx:{fontSize:"0.75rem",fontWeight:400,color:"#747881"}},"Select personality")},MenuProps:{PaperProps:{sx:{borderRadius:"8px",marginTop:"4px",boxShadow:"0 4px 12px rgba(0,0,0,0.15)","& .MuiMenuItem-root":{fontSize:"0.875rem","&:hover":{backgroundColor:"#E8F8F7"},"&.Mui-selected":{background:"linear-gradient(120deg,#9ac1bf,#34b5b1)",color:"#0d2422","&:hover":{backgroundColor:"#D0F0FF"}}}}}}},a.createElement(M.A,{key:"default",value:""},a.createElement(b.A,null,a.createElement(j.A,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#2B2A2A"}},"Default Mode"),a.createElement(j.A,{variant:"caption",color:"textSecondary",sx:{fontSize:"0.7rem",color:"#747881"}},"Use system default personality"))),o.map(e=>a.createElement(M.A,{key:e.id,value:e.id},a.createElement(b.A,null,a.createElement(j.A,{variant:"body2",sx:{fontWeight:500,fontSize:"0.875rem",color:"#2B2A2A"}},e.name),a.createElement(j.A,{variant:"caption",color:"textSecondary",sx:{fontSize:"0.7rem",color:"#747881"}},e.description)))))))};var K=n(8127);const U=class{constructor(){this.avatar=null,this.sessionId=null,this.sessionToken=null,this.queueKey=null,this.skinId=null,this.isConnected=!1,this.websocket=null,this.eventHandlers={},this.heartbeatIntervalId=null}setWebSocket(e){this.websocket=e}async createSession(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en";return new Promise((a,r)=>{if(!this.websocket||this.websocket.readyState!==WebSocket.OPEN)return void r(new Error("WebSocket not connected"));const o=e=>{try{const t=JSON.parse(e.data);"liveavatar_session_created"===t.type?(this.sessionId=t.session_id,this.sessionToken=t.session_token,this.queueKey=t.queue_key,this.skinId=t.skin_id,this.websocket.removeEventListener("message",o),this.websocket.removeEventListener("message",s),console.log("✅ LiveAvatar session created:",{sessionId:this.sessionId,queueKey:this.queueKey,skinId:this.skinId}),a({sessionId:this.sessionId,sessionToken:this.sessionToken,queueKey:this.queueKey,skinId:this.skinId,webrtcDetails:t.webrtc_details})):"liveavatar_session_error"===t.type&&(this.websocket.removeEventListener("message",o),this.websocket.removeEventListener("message",s),console.error("❌ LiveAvatar session error:",t),r(new Error(t.error||"Failed to create session")))}catch(e){console.error("Error parsing WebSocket message:",e)}},s=e=>{this.websocket.removeEventListener("message",o),this.websocket.removeEventListener("message",s),r(new Error("LiveAvatar session creation failed"))};this.websocket.addEventListener("message",o),this.websocket.addEventListener("error",s),this.websocket.send(JSON.stringify({type:"liveavatar_session_create",influencer_id:e,skin_id:t,language:n})),setTimeout(()=>{this.websocket.removeEventListener("message",o),this.websocket.removeEventListener("message",s),r(new Error("Session creation timeout"))},3e4)})}setSessionData(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;this.sessionId=e,this.sessionToken=t,this.queueKey=n,this.skinId=a,console.log("✅ LiveAvatar session data set manually:",{sessionId:this.sessionId,queueKey:this.queueKey,skinId:this.skinId})}async startAvatarStream(){throw new Error("Legacy startAvatarStream removed — live video uses @heygen/liveavatar-web-sdk.")}async speak(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"repeat",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!this.avatar||!this.isConnected)throw new Error("Avatar not connected. Start stream first.");if(!this.sessionId||!this.queueKey)throw new Error("Missing session data");try{console.log('🗣️ Avatar speaking via SDK: "'.concat(e.substring(0,50),'..."'));const o=Date.now();return await this.avatar.speak({text:e,taskType:a}),this._trackSpeakOnBackend(e,t,n,a,r).catch(e=>{console.error("⚠️ Token tracking failed (avatar already spoke):",e)}),{success:!0,duration_ms:Date.now()-o}}catch(e){throw console.error("❌ Error making avatar speak:",e),e}}async _trackSpeakOnBackend(e,t,n,a,r){if(this.websocket&&this.websocket.readyState===WebSocket.OPEN)return new Promise((o,s)=>{const i=e=>{try{const t=JSON.parse(e.data);"liveavatar_speak_tracked"===t.type?(this.websocket.removeEventListener("message",i),this.websocket.removeEventListener("message",l),console.log("✅ Tokens tracked:",{consumed:t.token_consumed,available:t.available_token,duration:t.duration_ms}),r&&r({consumed:t.token_consumed,available:t.available_token,duration_ms:t.duration_ms}),o(t)):"liveavatar_speak_error"===t.type&&(this.websocket.removeEventListener("message",i),this.websocket.removeEventListener("message",l),console.error("❌ Token tracking error:",t.error),s(new Error(t.error)))}catch(e){console.error("Error parsing WebSocket message:",e)}},l=e=>{this.websocket.removeEventListener("message",i),this.websocket.removeEventListener("message",l),s(new Error("Token tracking failed"))};this.websocket.addEventListener("message",i),this.websocket.addEventListener("error",l),this.websocket.send(JSON.stringify({type:"liveavatar_track_speak",session_id:this.sessionId,text:e,influencer_id:t,skin_id:n,queue_key:this.queueKey,task_type:a})),setTimeout(()=>{this.websocket.removeEventListener("message",i),this.websocket.removeEventListener("message",l),s(new Error("Token tracking timeout"))},1e4)});console.warn("⚠️ WebSocket not available for token tracking")}async interrupt(){if(!this.avatar||!this.isConnected)throw new Error("Avatar not connected");try{return console.log("⏸️ Interrupting avatar..."),await this.avatar.interrupt(),{success:!0}}catch(e){throw console.error("❌ Error interrupting avatar:",e),e}}async sendHeartbeat(){if(!this.sessionId)return console.warn("⚠️ No session ID for heartbeat"),null;if(this.websocket&&this.websocket.readyState===WebSocket.OPEN)try{return await this._sendHeartbeatViaWebSocket()}catch(e){console.warn("⚠️ WebSocket heartbeat failed, falling back to HTTP API:",e)}return await this._sendHeartbeatViaAPI()}async _sendHeartbeatViaWebSocket(){return new Promise((e,t)=>
1{const n=setTimeout(()=>{this.websocket.removeEventListener("message",a),t(new Error("WebSocket heartbeat timeout"))},5e3),a=r=>{try{const o=JSON.parse(r.data);"video_session_heartbeat_response"===o.type&&o.session_id===this.sessionId?(clearTimeout(n),this.websocket.removeEventListener("message",a),o.low_credits&&console.warn("⚠️ Low credits: Less than 2 minutes remaining"),o.should_disconnect&&console.error("❌ Out of credits - session should disconnect"),e(o)):"video_session_heartbeat_error"===o.type&&(clearTimeout(n),this.websocket.removeEventListener("message",a),t(new Error(o.error||"Heartbeat failed")))}catch(e){}};this.websocket.addEventListener("message",a),this.websocket.send(JSON.stringify({type:"video_session_heartbeat",session_id:this.sessionId})),console.log("💓 Heartbeat sent via WebSocket")})}async _sendHeartbeatViaAPI(){try{const e=(await Promise.resolve().then(n.bind(n,51794))).Http,t=(await e.post("/interface/liveavatar/session/heartbeat/",{session_id:this.sessionId})).data;return t.low_credits&&console.warn("⚠️ Low credits: Less than 2 minutes remaining"),t.should_disconnect&&console.error("❌ Out of credits - session should disconnect"),console.log("💓 Heartbeat sent via HTTP API"),t}catch(e){throw console.error("❌ HTTP API heartbeat failed:",e),e}}startHeartbeat(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this.heartbeatIntervalId&&this.stopHeartbeat(),console.log("💓 Starting automatic heartbeat (every 30 seconds)"),this.sendHeartbeat().catch(e=>{console.error("Initial heartbeat failed:",e)}),this.heartbeatIntervalId=setInterval(()=>{this.sendHeartbeat().then(n=>{n&&n.should_disconnect&&t?t(n):n&&n.low_credits&&e&&e(n)}).catch(e=>{var t;console.error("Auto heartbeat failed:",e),404===(null===(t=e.response)||void 0===t?void 0:t.status)&&(console.warn("Session not found, stopping heartbeat"),this.stopHeartbeat())})},3e4),this.heartbeatIntervalId}stopHeartbeat(){this.heartbeatIntervalId&&(console.log("🛑 Stopping automatic heartbeat"),clearInterval(this.heartbeatIntervalId),this.heartbeatIntervalId=null)}async closeSession(){this.stopHeartbeat();try{if(this.avatar&&(console.log("🛑 Stopping avatar stream..."),await this.avatar.stopAvatar(),this.avatar=null,this.isConnected=!1),this.websocket&&this.sessionId&&this.skinId&&this.queueKey)return new Promise((e,t)=>{const n=a=>{try{const r=JSON.parse(a.data);"liveavatar_session_closed"===r.type?(this.websocket.removeEventListener("message",n),console.log("✅ LiveAvatar session closed"),this.sessionId=null,this.sessionToken=null,this.queueKey=null,this.skinId=null,e({success:!0})):"liveavatar_error"===r.type&&(this.websocket.removeEventListener("message",n),t(new Error(r.message||"Failed to close session")))}catch(e){console.error("Error parsing WebSocket message:",e)}};this.websocket.addEventListener("message",n),this.websocket.send(JSON.stringify({type:"liveavatar_session_close",session_id:this.sessionId,skin_id:this.skinId,queue_key:this.queueKey})),setTimeout(()=>{this.websocket.removeEventListener("message",n),e({success:!0})},5e3)})}catch(e){throw console.error("❌ Error closing session:",e),e}}on(e,t){this.eventHandlers[e]||(this.eventHandlers[e]=[]),this.eventHandlers[e].push(t)}off(e,t){this.eventHandlers[e]&&(this.eventHandlers[e]=this.eventHandlers[e].filter(e=>e!==t))}_triggerEvent(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;this.eventHandlers[e]&&this.eventHandlers[e].forEach(n=>{try{n(t)}catch(t){console.error("Error in ".concat(e," handler:"),t)}})}getStatus(){return{isConnected:this.isConnected,hasSession:!!this.sessionId,sessionId:this.sessionId,queueKey:this.queueKey,skinId:this.skinId}}resetLocalState(){if(this.stopHeartbeat(),this.avatar){const e=this.avatar;this.avatar=null,"function"==typeof e.stopAvatar&&Promise.resolve(e.stopAvatar()).catch(()=>{})}this.isConnected=!1,this.sessionId=null,this.sessionToken=null,this.queueKey=null,this.skinId=null}};function J(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,o,s,i=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(i.push(a.value),i.length!==t);l=!0);}catch(e){c=!0,r=e}
1finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return $(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?$(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function $(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function Y(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),n.push.apply(n,a)}return n}function Q(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?Y(Object(n),!0).forEach(function(t){Z(e,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Y(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function Z(e,t,n){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function G(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var a,r,o,s,i=[],l=!0,c=!1;try{if(o=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(a=o.call(n)).done)&&(i.push(a.value),i.length!==t);l=!0);}catch(e){c=!0,r=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw r}}return i}}(e,t)||function(e,t){if(e){if("string"==typeof e)return X(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?X(e,t):void 0}}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function X(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}const ee=(0,v.iN)(e=>{var t,n,j,H,W;const M=(0,i.wA)(),q=(0,B.h)(),F=q.messages,z=q.isConnected,$=q.hasQueuePromotionFor,Y=G(a.useState(""),2),Z=Y[0],X=Y[1],ee=(0,i.d4)(e=>e.chats),te=ee.data,ne=te.all,ae=te.selected,re=ee.api.loading,oe=(0,s.Zp)(),se=G(a.useState(!1),2),ie=se[0],le=se[1],ce=G(a.useState(null),2),ue=ce[0],de=ce[1],ve=G(a.useState(null),2),he=ve[0],me=ve[1],fe=G(a.useState(null),2),pe=fe[0],ge=fe[1],be=G(a.useState([]),2),we=be[0],ye=be[1],ke=G(a.useState(),2),Ee=ke[0],Se=ke[1],Ae=G(a.useState(!1),2),Ce=Ae[0],xe=Ae[1],_e=G(a.useState(null),2),Ie=_e[0],Le=_e[1],Oe=G(a.useState(!1),2),Te=Oe[0],Pe=Oe[1],Ne=G(a.useState(null),2),De=Ne[0],Re=Ne[1],Be=G(a.useState(null),2),je=Be[0],He=Be[1],We=G(a.useState(!1),2),Me=We[0],qe=We[1],Fe=G(a.useState(!1),2),ze=Fe[0],Ve=Fe[1],Ke=G(a.useState(!1),2),Ue=Ke[0],Je=Ke[1],$e=G(a.useState(!1),2),Ye=$e[0],Qe=$e[1],Ze=G(a.useState(""),2),Ge=Ze[0],Xe=Ze[1],et=G(a.useState(null),2),tt=et[0],nt=et[1],at=G((0,a.useState)({open:!1,message:null,autoHideDuration:5e3,subMessage:null}),2),rt=at[0],ot=at[1],st=G((0,a.useState)(!0),2),it=st[0],lt=st[1],ct=G((0,a.useState)(),2),ut=(ct[0],ct[1]),dt=G((0,a.useState)(null),2),vt=(dt[0],dt[1],G((0,a.useState)(),2)),ht=vt[0],mt=vt[1],ft=G((0,a.useState)("centerOutward"),2),pt=(ft[0],ft[1]);(0,a.useEffect)(()=>{lt(!0)},[null==ae||null===(t=ae.custom)||void 0===t?void 0:t.profileUrl]);const gt=G(a.useState(null),2),bt=gt[0],wt=gt[1],yt=G(a.useState("error"),2),kt=yt[0],Et=yt[1],St=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"error";
1console.log("showNotification:",e),wt(e),Et(t)},At=(0,a.useRef)(),Ct=(0,a.useRef)(),xt=(0,a.useRef)(null),_t=e=>Ot.current=e,It=(0,a.useRef)(null),Lt=new AbortController,Ot=(0,a.useRef)("new"),Tt=(0,i.d4)(e=>{var t;return(null===(t=e.chats)||void 0===t?void 0:t.data)||{selected:{}}}).selected,Pt=(null==Tt?void 0:Tt.inf_id)||null,Nt=(null==Tt||Tt.name,(null==Tt?void 0:Tt.skin_id)||null),Dt=(0,a.useRef)(null),Rt=(0,a.useRef)(null),Bt=(0,a.useRef)(null),jt=(0,a.useRef)(null),Ht=(0,a.useRef)(null),Wt=(0,a.useRef)(null),Mt=(()=>{const e=(0,K.S$)().ws,t=J((0,a.useState)(!1),2),n=t[0],r=t[1],o=J((0,a.useState)(!1),2),s=o[0],i=o[1],l=J((0,a.useState)(null),2),c=l[0],u=l[1],d=J((0,a.useState)(null),2),v=d[0],h=d[1],m=J((0,a.useState)(!1),2),f=m[0],p=m[1],g=(0,a.useRef)(null);(0,a.useEffect)(()=>(g.current||(g.current=new U),()=>{g.current&&n&&g.current.closeSession().catch(e=>{console.error("Error closing session on unmount:",e)})}),[n]),(0,a.useEffect)(()=>{e&&g.current&&g.current.setWebSocket(e)},[e]);const b=(0,a.useCallback)(async function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"en";if(!g.current)throw new Error("LiveAvatar service not initialized");p(!0),h(null);try{const a=await g.current.createSession(e,t,n);return u(a),r(!0),p(!1),a}catch(e){throw h(e.message||"Failed to create session"),p(!1),e}},[]),w=(0,a.useCallback)(function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;if(!g.current)throw new Error("LiveAvatar service not initialized");g.current.setSessionData(e,t,n,a),r(!0),u({sessionId:e,sessionToken:t,queueKey:n,skinId:a})},[]),y=(0,a.useCallback)(async function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"high";if(!g.current)throw new Error("LiveAvatar service not initialized");if(!n)throw new Error("No active session. Set session data first.");p(!0),h(null);try{await g.current.startAvatarStream(e,t,a),i(!0),p(!1)}catch(e){throw h(e.message||"Failed to start avatar stream"),p(!1),e}},[n]),k=(0,a.useCallback)(async function(e,t,n){let a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"repeat",r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;if(!g.current)throw new Error("LiveAvatar service not initialized");try{return await g.current.speak(e,t,n,a,r)}catch(e){throw h(e.message||"Failed to make avatar speak"),e}},[]),E=(0,a.useCallback)(async()=>{if(!g.current)throw new Error("LiveAvatar service not initialized");try{return await g.current.interrupt()}catch(e){throw h(e.message||"Failed to interrupt avatar"),e}},[]),S=(0,a.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return g.current?g.current.startHeartbeat(e,t):(console.warn("LiveAvatar service not initialized"),null)},[]),A=(0,a.useCallback)(()=>{g.current&&g.current.stopHeartbeat()},[]),C=(0,a.useCallback)(async()=>{if(g.current){p(!0),h(null);try{await g.current.closeSession(),r(!1),i(!1),u(null),p(!1)}catch(e){throw h(e.message||"Failed to close session"),p(!1),e}}},[]),x=(0,a.useCallback)((e,t)=>{g.current&&g.current.on(e,t)},[]),_=(0,a.useCallback)((e,t)=>{g.current&&g.current.off(e,t)},[]),I=(0,a.useCallback)(()=>g.current?g.current.getStatus():null,[]),L=(0,a.useCallback)(()=>{g.current&&g.current.resetLocalState(),r(!1),i(!1),u(null),h(null),p(!1)},[]);return{isSessionActive:n,isAvatarConnected:s,sessionData:c,error:v,loading:f,createSession:b,setExistingSession:w,startAvatarStream:y,speak:k,interrupt:E,closeSession:C,startHeartbeat:S,stopHeartbeat:A,on:x,off:_,getStatus:I,resetLocalSessionState:L}})(),qt=()=>{Wt.current&&(clearInterval(Wt.current),Wt.current=null)},Ft=()=>{Ht.current&&(clearInterval(Ht.current),Ht.current=null)},zt=async(e,t,n)=>{Ft(),qt();const a=e||jt.current;if(a)try{await I.uc.EndLiveAvatarSession(a,t,n),console.log("[SESSION] Backend session ended, tokens deducted")}catch(e){console.warn("[SESSION] Failed to call end endpoint:",null==e?void 0:e.message)}if(jt.current=null,Bt.current)try{await Bt.current.stop(),Bt.current=null,console.log("[
1SESSION] LiveAvatar SDK session stopped")}catch(e){console.error("[SESSION] Error stopping SDK session:",e)}xt.current&&(xt.current(),xt.current=null),Ct.current&&(Ct.current.srcObject=null);try{delete window.__avatarAudioStream}catch(e){}try{delete window.__liveAvatarSessionReady__,(0,L.fM)()}catch(e){}try{localStorage.removeItem("sessionInfo")}catch(e){}if("function"==typeof(null==Mt?void 0:Mt.resetLocalSessionState)&&Mt.resetLocalSessionState(),Rt.current&&(Rt.current.getTracks().forEach(e=>e.stop()),Rt.current=null),Dt.current){try{Dt.current.disconnect()}catch(e){}Dt.current=null}},Vt=async e=>{let t=!1,n=null;try{le(!0),Pe(!1),console.log("[VIDEO] 🚀 Creating LiveAvatar session...");const a=await I.uc.CreateLiveAvatarSession(Pt,e,"en",Lt.signal);let r,o,s;if(console.log("[VIDEO] 📦 LiveAvatar session response:",a.data),console.log("[VIDEO] 📦 LiveAvatar API flag:",a.data.liveavatar_api),a.data.liveavatar_api){console.log("[VIDEO] ✅ Using NEW LiveAvatar API (@heygen/liveavatar-web-sdk)");const t=a.data.session_token;if(s=a.data.session_id,jt.current=s,!t||!s)throw new Error("LiveAvatar session_token or session_id is missing.");mt(a.data.queue_key);const n=a.data.video_modal_load_direction_label||"centerOutward";console.log("[VIDEO] 🎬 Modal Reveal Direction (LiveAvatar):",n),pt(n);const r=a.data.data||{session_id:s};localStorage.setItem("sessionInfo",JSON.stringify(r)),(0,L.ik)(t,a.data.data||{}),Mt.setExistingSession(s,t,a.data.queue_key,e);const o=new N.i5(t,{voiceChat:!1});Bt.current=o,nt(new MediaStream),Ot.current="running",Qt("video");const i=()=>{const e=async e=>{o.attach(e),console.log("[VIDEO] ✅ LiveAvatar stream attached to video element");try{var t;await new Promise(e=>setTimeout(e,100));const n=e.srcObject,a=(null==n||null===(t=n.getAudioTracks)||void 0===t?void 0:t.call(n))||[];if(a.length>0){const t=new MediaStream(a);window.__avatarAudioStream=t;const n=await async function(e){const t=navigator.userAgent.includes("Firefox"),n=/iPad|iPhone|iPod/.test(navigator.userAgent)||"MacIntel"===navigator.platform&&navigator.maxTouchPoints>1;if(t||n)return console.log("[AEC Loopback] Skipping — not needed on this browser/platform"),{outputStream:e,cleanup:()=>{}};const a=new RTCPeerConnection,r=new RTCPeerConnection,o=new MediaStream;a.onicecandidate=e=>{if(e.candidate){if(e.candidate.candidate&&e.candidate.candidate.includes(".local"))return;r.addIceCandidate(e.candidate).catch(()=>{})}},r.onicecandidate=e=>{if(e.candidate){if(e.candidate.candidate&&e.candidate.candidate.includes(".local"))return;a.addIceCandidate(e.candidate).catch(()=>{})}},r.ontrack=e=>{e.streams&&e.streams[0]?e.streams[0].getTracks().forEach(e=>o.addTrack(e)):e.track&&o.addTrack(e.track)},e.getTracks().forEach(t=>{a.addTrack(t,e)});try{const e=await a.createOffer();await a.setLocalDescription(e),await r.setRemoteDescription(e);const t=await r.createAnswer();await r.setLocalDescription(t),await a.setRemoteDescription(t)}catch(t){return console.error("[AEC Loopback] Setup failed, falling back to direct stream:",t),a.close(),r.close(),{outputStream:e,cleanup:()=>{}}}try{await Promise.race([new Promise(e=>{if("connected"===r.connectionState)return e();r.onconnectionstatechange=()=>{"connected"===r.connectionState&&e()}}),new Promise((e,t)=>setTimeout(()=>t(new Error("Loopback connection timeout")),5e3))])}catch(t){return console.warn("[AEC Loopback] Connection timeout, falling back:",t),a.close(),r.close(),{outputStream:e,cleanup:()=>{}}}return console.log("[AEC Loopback] Connected — Chrome AEC should now have reference signal"),{outputStream:o,cleanup:()=>{try{a.close()}catch(e){}try{r.close()}catch(e){}}}}(t),r=n.outputStream,o=n.cleanup;xt.current=o,Ct.current&&(Ct.current.srcObject=r,Ct.current.play().catch(e=>console.warn("[AEC Loopback] audio.play() failed:",e))),e.muted=!0,console.log("[AEC Loopback] Avatar audio routed through loopback → Chrome AEC active")}else console.log("[AEC Loopback] No audio tracks found on video element, skipping")}catch(e){console.warn("[AEC Loopback] Setup failed, using direct audio:",e)}};null!=At&&At.current?e(At.current):(console.warn("[VIDEO] ⚠️ videoRef not ready on stream_ready, will retry"),setTimeout(()=>{null!=At&&At.current&&e(At.current)},300)),_t("running"),Qt("video"),le(!1);try{window.__liveAvatarSessionReady__=!0,window.dispatchEvent(new CustomEvent("liveavatar-session-ready"))}catch(e){}};o.on(N.b9.SESSION_STREAM_READY,i);const l=()=>{try{window.dispatchEvent(new CustomEvent("liveavatar-avatar-speak",{detail:{speaking:!0}}))}catch(e){}},c=()=>{try{window.dispatchEvent(new CustomEvent("liveavatar-avatar-speak",{detail:{speaking:!1}}))}catch(e){}};return o.on(N.Oz.AVATAR_SPEAK_STARTED,l),o.on(N.Oz.AVATAR_SPEAK_ENDED,c),await o.start(),console.log("[VIDEO] ✅ LiveAvatar session started (stream will attach when ready)"),((e,t,n)=>{Ft(),Ht.current=setInterval(async()=>{try{const a=(await I.uc.LiveAvatarHeartbeat(e)).data;if(a.should_disconnect)return console.warn("[HEARTBEAT] Out of credits — disconnecting session"),Ft(),ot({open:!0,message:"You have run out of credits. The session has ended.",autoHideDuration:8e3,subMessage:null}),void await zt(e,t,n);a.low_credits&&(console.warn("[HEARTBEAT] Low credits warning"),St("You have less than 2 minutes of credits remaining.","warning"))}catch(e){var a;404===(null==e||null===(a=e.response)||void 0===a?void 0:a.status)?(console.warn("[HEARTBEAT] Session not found — stopping heartbeat"),Ft()):console.error("[HEARTBEAT] Error:",e)}},3e4)})(s,a.data.queue_key,e),qt(),void(Wt.current=setInterval(()=>{try{const e=Bt.current;e&&"function"==typeof e.keepAlive&&Promise.resolve(e.keepAlive()).catch(e=>console.warn("[KEEPALIVE] ping failed:",(null==e?void 0:e.message)||e))}catch(e){console.warn("[KEEPALIVE] ping error:",(null==e?void 0:e.message)||e)}},12e4))}{if(console.log("⚠️ Using OLD HeyGen Interactive Avatar API (fallback)"),100!==a.data.code)throw new Error(a.data.message);const e=a.data.data;mt(a.data.queue_key);const t=a.data.video_modal_load_direction_label||"centerOutward";if(pt(t),!e)throw new Error("Session info is missing!");localStorage.setItem("sessionInfo",JSON.stringify(e)),r=e.url,o=e.access_token,s=e.session_id}const i=new P.Wv;Dt.current=i,Ot.current="running",console.log("✅ Connected to LiveKit Room.");const l=new MediaStream;i.on(P.u9.TrackSubscribed,e=>{console.log("🎥 Track subscribed:",e),"video"!==e.kind&&"audio"!==e.kind||(l.addTrack(e.mediaStreamTrack),console.log("🎥 Media--------Stream:",e.mediaStreamTrack),console.log("🎥 MediaStream:",l),nt(l),l.getTracks().some(e=>e.enabled||e.active)?t=!0:n=new Error("Media stream tracks are invalid."))}),await i.connect(r,o);const c=await navigator.mediaDevices.getUserMedia({audio:!0});Rt.current=c;const u=new P.J(c.getAudioTracks()[0]);await i.localParticipant.publishTrack(u),await new Promise((e,a)=>{const r=setTimeout(()=>{t||a(new Error("Couldn't connect your call at the moment. Please try again."))},1e4),o=()=>{t?(clearTimeout(r),e()):n?(clearTimeout(r),a(n)):setTimeout(o,100)};o()}),_t("running"),Qt("video"),le(!1);try{window.__liveAvatarSessionReady__=!0,window.dispatchEvent(new CustomEvent("liveavatar-session-ready"))}catch(e){}}catch(e){var a,r,o,s,i,l,c,u,d;if(console.error("❌ Error in createAndStartSession:",e),le(!1),403===(null==e?void 0:e.status)&&null!=e&&null!==(a=e.response)&&void 0!==a&&null!==(a=a.data)&&void 0!==a&&a.subscription_required)return void Ve(!0);if("rejected"===(null==e||null===(r=e.response)||void 0===r||null===(r=r.data)||void 0===r?void 0:r.status))return Xe("You are already in a call. Please end the current call to start a new one."),void Qe(!0);if(null!=e&&null!==(o=e.response)&&void 0!==o&&null!==(o=o.data)&&void 0!==o&&o.queue_required)return Je(!0),void ut(null==e||null===(d=e.response)||void 0===d||null===(d=d.data)||void 0===d?void 0:d.position);let t="Unable to start video session.",n="An unexpected error occurred. Please try again.";const v=(null==e||null===(s=e.response)||void 0===s||null===(s=s.data)||void 0===s?void 0:s.error)||(null==e||null===(i=e.response)||void 0===i||null===(i=i.data)||void 0===i?void 0:i.detail);v?n=v:500===(null==e||null===(l=e.response)||void 0===l?void 0:l.status)?n="The avatar service encountered an internal error. Please try again in a few moments.":403===(null==e||null===(c=e.response)||void 0===c?void 0:c.status)?n="The avatar service is currently unavailable. Please contact support if this persists.":404===(null==e||null===(u=e.response)||void 0===u?void 0:u.status)?n="This companion doesn't have a video avatar set up yet. Please pick another companion or contact support.":null!=e&&e.message&&(n=e.message),Xe("".concat(t,"\n\n").concat(n)),Qe(!0)}},Kt=()=>{ot(Q(Q({},rt),{},{open:!1}))};(0,a.useEffect)(()=>
1{e.fetchChatsData()},[]),(0,a.useEffect)(()=>{const e=()=>{console.log("[VIDEO-FLOW] user-interrupt-avatar received");const e=null==Ct?void 0:Ct.current,t=null==At?void 0:At.current;let n=null;try{null!=e&&e.srcObject?(e.muted=!0,n=e):t&&(t.muted=!0,n=t)}catch(e){}try{"undefined"!=typeof window&&(window.__liveAvatarSpeaking__=!1,window.dispatchEvent(new CustomEvent("liveavatar-avatar-speak",{detail:{speaking:!1,interrupted:!0}})))}catch(e){}const a=Bt.current;if(a&&"function"==typeof a.interrupt)try{console.log("[VIDEO-FLOW] → liveAvatarSessionRef.interrupt()"),Promise.resolve(a.interrupt()).catch(e=>{console.warn("[VIDEO-FLOW] sdkSession.interrupt() failed:",e)})}catch(e){console.warn("[VIDEO-FLOW] sdkSession.interrupt() threw:",e)}if("function"==typeof(null==Mt?void 0:Mt.interrupt))try{Promise.resolve(Mt.interrupt()).catch(e=>{console.debug("[VIDEO-FLOW] legacy liveAvatar.interrupt() skipped:",(null==e?void 0:e.message)||e)})}catch(e){}setTimeout(()=>{try{n&&(n.muted=!1)}catch(e){}},100)};return window.addEventListener("user-interrupt-avatar",e),()=>window.removeEventListener("user-interrupt-avatar",e)},[Mt]),(0,a.useEffect)(()=>{console.log("useEffect triggered with inf_id:",Pt,"refetchData:",Ce),(async()=>{if(Pt){console.log("inf_id exists, fetching skins for:",Pt);try{const e=await(0,I.ZW)(Pt),t=e.data.findIndex(e=>e.is_default);me(e.data[t].id),ge(e.data[t]),Le(t),Re(e.data[t].id),He(e.data[t].id),de(e.data),console.log("Raw skins response data:",e.data);const n=e.data.map(e=>({id:e.id,skin_avatar:e.skin_avatar,is_default:e.is_default}));ye(n),console.log("All skin avatar URLs:",n),console.log("Total skins found:",e.data.length),console.log("🖼️ Starting image preloading..."),n.forEach((e,t)=>{if(e.skin_avatar){const a=new Image;a.onload=()=>{console.log("✅ Preloaded skin ".concat(t+1,"/").concat(n.length,":"),e.skin_avatar)},a.onerror=()=>{console.warn("❌ Failed to preload skin ".concat(t+1,":"),e.skin_avatar)},a.src=e.skin_avatar}}),console.log("🚀 Image preloading initiated for",n.length,"skins")}catch(e){console.error("Error fetching influencer skins:",e)}}})()},[Pt,Ce]),(0,a.useEffect)(()=>{(async()=>{if(Pt)try{const e=await(0,I.ZW)(Pt);de(e.data)}catch(e){console.error("Error fetching influencer skins:",e)}})()},[Ce]),(0,a.useEffect)(()=>{if(!z||!Nt||!Ue)return;const e=$();console.log("🎯 hasQueuePromotionFor result:",e),e?(console.log("🎉 Queue promotion detected! Closing modal and starting session..."),Je(!1),Vt(Nt)):console.log("⏭️ No queue promotion message found")},[F,z,Nt,Ue]);const Ut=e=>{let t=e.activeIndex;if(console.log("activeIndex:",t),null===he)console.log("currentSkin is null, setting activeCall to 0"),Le(0);else{var n;const e=ue[t];console.log("activeRoom:",e),Le(t),me(e.id),ge(e);const a=null===(n=we.find(t=>t.id===e.id))||void 0===n?void 0:n.skin_avatar;a&&(Se(a),console.log("Updated overlay image URL:",a))}},Jt=e=>{var t;t=e,M((0,l.BR)(t)),o.Fr&&oe(h.bw.mobileChats.route)},$t=a.useMemo(()=>(0,v.sg)(e.fetchChatsData,500),[e.fetchChatsData]),Yt=e=>{X(e),e.length>=3&&$t(e),0===e.length&&$t()},Qt=e=>M((0,C.Db)(e));let Zt=o.Fr?null!=ae&&ae.id?a.createElement(u.default,{snackConfig:rt,setSnackConfig:ot,stream:tt,videoRef:At,setSessionStage:_t,peerConnectionRef:It,abortController:Lt,refetchData:e.fetchChatsData,setLoading:le,sessionStageRef:Ot,roomRef:Dt,skins:ue,handleSlideChange:Ut,currentSkin:he,createAndStartSession:Vt,activeCall:Ie,setCurrentSkin:me,currentSkinDataObject:pe,setCurrentSkinDataObject:ge,setActiveCall:Le,callSwitch:Te,setIsCallSwitch:Pe,showNotification:St,setRefetchData:xe,setActiveSkin:He,activeSkin:je,queueKey:ht,liveAvatar:Mt,liveAvatarSessionRef:Bt,onEndSession:()=>zt(jt.current,ht,he)}):a.createElement(c.default,{onSelectChannel:Jt,fetchChatsData:e.fetchChatsData}):a.createElement(a.Fragment,null,a.createElement(c.default,{onSelectChannel:Jt,fetchChatsData:e.fetchChatsData}),Pt?a.createElement(u.default,{snackConfig:rt,setSnackConfig:ot,stream:tt,videoRef:At,setSessionStage:_t,peerConnectionRef:It,abortController:Lt,refetchData:e.fetchChatsData,setLoading:le,sessionStageRef:Ot,roomRef:Dt,skins:ue,handleSlideChange:Ut,currentSkin:he,createAndStartSession:Vt,activeCall:Ie,setCurrentSkin:me,currentSkinDataObject:pe,setCurrentSkinDataObject:ge,setActiveCall:Le,callSwitch:Te,setIsCallSwitch:Pe,showNotification:St,setRefetchData:xe,setActiveSkin:He,activeSkin:je,queueKey:ht,liveAvatar:Mt,liveAvatarSessionRef:Bt,onEndSession:()=>zt(jt.current,ht,he)}):a.createElement("div",{className:"m-auto flex flex-col items-center text-center ",style:{justifyContent:"center"}},a.createElement("div",{className:"text-lg text-black-600"},"You haven’t started a chat with any influencer yet"),a.createElement("div",{className:"mt-4"},a.createElement(d.$n,{variant:"contained",label:"Go to Influencer gallery",style:{width:"200px"},onClick:()=>oe(h.bw.influencer.route)}))));return re?a.createElement(d.y$,null):a.createElement("main",{className:"main-wrapper",style:{paddingLeft:0,paddingRight:0},"data-show-list":!1},a.createElement(_.A,{kind:"audio",id:"pip-aec-audio",mediaRef:Ct,hostStyle:{display:"none"}}),a.createElement(x.A,{isLoading:ie,usePixelReveal:!1,imageUrl:Ee,loadingText:"Starting a new video chat..."}),a.createElement("div",{className:"chat-header"},a.createElement("div",{className:"chat-top-bar flex flex-row justify-between w-full sm:h-[100px] border-b border-b-[#2B2A2A] p-[20px] box-border"},o.Fr?Pt?a.createElement("div",{className:"flex flex-col gap-4 w-full"},a.createElement("div",{className:"flex flex-row justify-between items-center w-full"},a.createElement("div",{className:"flex items-center w-[100px] gap-3"},it&&a.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"rgb(179 161 142)",zIndex:10}},a.createElement(f.A,{size:22,thickness:4,style:{color:"rgb(160,249,198)"}})),!it&&a.createElement("img",{src:(null==ae||null===(n=ae.custom)||void 0===n?void 0:n.profileUrl)||"",alt:"avatar",className:"w-[40px] h-[40p
1x] rounded-[5px] border-3 border-solid border-[#A0F9C6] object-contain",onLoad:()=>lt(!1),onError:()=>lt(!1)}),a.createElement("img",{src:(null==ae||null===(j=ae.custom)||void 0===j?void 0:j.profileUrl)||"",alt:"avatar",style:{display:"none"},onLoad:()=>lt(!1),onError:()=>lt(!1)}),a.createElement("div",{className:"flex flex-col"},a.createElement("span",{className:"text-[16px] font-medium"},(null==ae?void 0:ae.name)||"Iris"))),a.createElement("div",{className:"flex items-center gap-2"},Pt&&a.createElement(V,{influencerId:Pt,onPersonalityChange:e=>{console.log("Personality changed to:",e)}}),a.createElement(p.A,{title:"Start Audio Call",placement:"top",arrow:!0},a.createElement(g.A,{onClick:()=>Qt("audio"),style:{background:"#34B5B1",marginLeft:"10px"},className:"bg-[#34B5B1] w-[50px] h-[50px] ml-[10px]"},a.createElement(S.A,{style:{color:"#fff"}}))),a.createElement(p.A,{title:"Start Video Call",placement:"top",arrow:!0},a.createElement(g.A,{onClick:()=>qe(!0),style:{background:"#34B5B1",marginLeft:"10px"},className:"bg-[#34B5B1] w-[50px] h-[50px] ml-[10px]"},a.createElement(A.A,{style:{color:"#fff"}}))))),a.createElement("div",null,a.createElement(b.A,{className:"sm:hidden block"},a.createElement(d.$n,{variant:"contained",label:"End Chat",style:{width:"100%",color:"#34B5B1",background:"linear-gradient(120deg,#9ac1bf,#34b5b1)",color:"#0d2422",borderColor:"transparent",minWidth:"90px",height:"40px",fontSize:"14px",padding:"8px 16px"},onClick:()=>{oe("/influencer")}})))):a.createElement("div",{className:"flex items-center justify-left w-full"},a.createElement(E.Ay,{size:"small",placeholder:"Search Chat",endAdornment:a.createElement(m.A,{onClick:()=>Yt(""),position:"start"},a.createElement(k.A,{className:"font-black"})),slotProps:{div:{className:"!h-full"},input:{className:"!p-0 !text-[#747881] placeholder-secondary placeholder-text-[12px]"}},value:Z,onChange:e=>Yt(e.target.value),className:"p-2 pl-4 w-full rounded-[12px] bg-white sm:bg-[#fff] !border-solid !border !border-[#B7B7B7]"})):a.createElement(a.Fragment,null,a.createElement("div",{className:"flex items-center justify-left w-[25%]"},a.createElement(E.Ay,{size:"small",placeholder:"Search Chat",endAdornment:a.createElement(m.A,{onClick:()=>Yt(""),position:"start"},a.createElement(k.A,{className:"font-black"})),slotProps:{div:{className:"!h-full"},input:{className:"!p-0 !text-[#747881] placeholder-secondary placeholder-text-[12px]"}},value:Z,onChange:e=>Yt(e.target.value),className:"p-2 pl-4 w-[90%] !flex rounded-[12px] bg-white sm:bg-[#fff] !border-solid !border !border-[#B7B7B7] sm:!border-solid sm:!border sm:!border-[#272A30]"})),Pt&&a.createElement("div",{className:"flex items-center justify-center "},a.createElement("div",{className:"flex flex-row gap-2"},it&&a.createElement("div",{style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",background:"rgb(179 161 142)"}},a.createElement(f.A,{size:22,thickness:4,style:{color:"rgb(160,249,198)"}})),!it&&a.createElement("img",{src:(null==ae||null===(H=ae.custom)||void 0===H?void 0:H.profileUrl)||"",alt:"avatar",className:"w-fit h-[36px] rounded-[5px] border-3 border-solid border-[#A0F9C6] object-contain",onLoad:()=>lt(!1),onError:()=>lt(!1)}),a.createElement("img",{src:(null==ae||null===(W=ae.custom)||void 0===W?void 0:W.profileUrl)||"",alt:"avatar",style:{display:"none"},onLoad:()=>lt(!1),onError:()=>lt(!1)}),a.createElement("span",{className:"flex gap-1 mt-[10px]"},a.createElement("span",{className:"hidden sm:block"},"You're texting with"," ")," ",a.createElement("span",null,null==ae?void 0:ae.name,".")))),a.createElement(w.A,{open:rt.open,onClose:Kt,autoHideDuration:1e4,anchorOrigin:{vertical:"top",horizontal:"right"}},a.createElement(y.A,{severity:"error",onClose:Kt,sx:{width:"100%"}},rt.message,a.createElement("br",null),a.createElement("span",{style:{fontWeight:"bold",color:"#d32f2f"}},rt.subMessage))),Pt&&a.createElement("div",{className:"flex items-center justify-end gap-2"},a.createElement(V,{influencerId:Pt,onPersonalityChange:e=>{console.log("Personality changed to:",e)}}),a.createElement(p.A,{title:"Start Audio Call",placement:"top",arrow:!0},a.createElement(g.A,{onClick:()=>Qt("audio"),style:{background:"#34B5B1",marginLeft:"10px"},className:"bg-[#34B5B1] w-[50px] h-[50px] ml-[10px]"},a.createElement(S.A,{style:{color:"#fff"}}))),a.createElement(p.A,{title:"Start Video Call",placement:"top",arrow:!0},a.createElement(g.A,{onClick:()=>qe(!0),style:{background:"#34B5B1",marginLeft:"10px"},className:"bg-[#34B5B1] w-[50px] h-[50px] ml-[10px]"},a.createElement(A.A,{style:{color:"#fff"}})))))),a.createElement("div",{className:"main-wrapper xs:flex xs:flex-col",style:{padding:0}},ne?a.createElement(a.Fragment,null,a.createElement(r.ry,{theme:"light",currentChannel:null==ae?void 0:ae.id},Zt)):a.createElement("div",{className:"m-auto flex flex-col items-center text-center "},a.createElement("div",null,"Oops, you haven't added any influencers !"),a.createElement("div",{className:"mt-[20px]"},a.createElement(d.$n,{variant:"contained",label:"Add Influencer",style:{width:"200px"},onClick:()=>oe(h.bw.influencer.route)})))),ne&&a.createElement("div",{className:"sm:flex self-end hidden"},a.createElement("div",{className:" w-full p-[20px] ",style:{border:"none"}},a.createElement(d.$n,{variant:"contained",label:"End Chat",style:{width:"fit-content",color:"#34B5B1",background:"linear-gradient(120deg,#9ac1bf,#34b5b1)",color:"#0d2422",borderColor:"transparent",minWidth:"110px",height:"40px",fontSize:"16px"},onClick:()=>{oe("/influencer")}})))),a.createElement(O.A,{message:bt,severity:kt,onClose:()=>wt(null),backgroundColor:"#34B5B1",icon:a.createElement(T.A,null),textColor:"#fff",width:"600px"}),Me&&a.createElement(D.A,{open:Me,onCancel:()=>qe(!1),onConfirm:()=>{qe(!1);const e=null==ue?void 0:ue.findIndex(e=>e.id===De);if(-1!==e){var t,n;me(De),ge(ue[e]),Le(e),He(null===(t=ue[e])||void 0===t?void 0:t.id);const a=null===(n=we.find(e=>e.id===De))||void 0===n?void 0:n.skin_avatar;a?Se(a):Se()}Vt(De)},title:"Do you really want to initiate a video call?",confirmText:"Initiate Video Call",cancelText:"Cancel"}),ze&&a.createElement(R.A,{open:ze,onClose:()=>Ve(!1)}),Ue&&a.createElement(D.A,{open:Ue,description:a.createElement(a.Fragment,null,"You are in the queue to video chat. When our companions are ready, you will automatically be dropped into the video chat."),firstDescription:"Thanks for your patience.",cancelText:"No, thanks. I want to leave queue.",onCancel:()=>{Je(!1),(async e=>{try{await(0,I.HS)({skin_id:e})}catch(e){console.error("Error leaving queue:",e)}})(Nt)},showConfirmButton:!1}),Ye&&a.createElement(D.A,{open:Ye,description:Ge,cancelText:"Close",onCancel:()=>{Qe(!1),Xe("")},showConfirmButton:!1}))})}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.