1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3532],{1151:(e,t,r)=>{r.r(t),r.d(t,{default:()=>z});var o=r(4848),n=r(6540),i=r(3540),a=r(1529),c=r(1),s=r(641),l=r(265),d=r(5998),u=r(6806),p=r(3256),h=r(6715);let m=e=>{let{isMuted:t=!1,isSecret:r=!1,skipPermissionCheck:i=!1}=e,s=(0,h.useRouter)(),[m,z]=(0,n.useState)(null),[U,R]=(0,n.useState)(null),[L,D]=(0,n.useState)(null),[M,P]=(0,n.useState)(!1),[O,F]=(0,n.useState)(""),[T,N]=(0,n.useState)("#D1C1A1"),[B,W]=(0,n.useState)(!1),[$,q]=(0,n.useState)(!0),[G,V]=(0,n.useState)(!1),[J,X]=(0,n.useState)(!1),[Y,H]=(0,n.useState)(0),[K,Q]=(0,n.useState)(!1),[Z,ee]=(0,n.useState)(!1),[et,er]=(0,n.useState)(!1),eo=(0,n.useRef)(null),en=(0,n.useRef)(null),ei=(0,n.useRef)(null),ea=(0,n.useRef)(null),ec=(0,n.useRef)(null),es=(0,n.useRef)(null),el=(0,p.L)({onConnect:()=>{z(null),W(!0),q(!1),r||eh()||Q(!0)},onDisconnect:()=>{W(!1),Q(!1)},onError:e=>{r&&console.error("ElevenLabs error:",e),z("Connection error: ".concat(e)),q(!1),Q(!1)},onMessage:e=>{if("speech-start"===e.event?P(!0):"speech-end"===e.event&&P(!1),"ai"==e.source&&e.message){let t=e.message||"";F(t),t&&N((0,d.s4)(t))}},onSpeechStart:()=>{P(!0)},onSpeechEnd:()=>{P(!1)}}),ed=async()=>{try{if(navigator.permissions){let e=await navigator.permissions.query({name:"microphone"});return"granted"===e.state}try{return(await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}})).getTracks().forEach(e=>e.stop()),!0}catch(e){return!1}}catch(e){return!1}},eu=async()=>{try{var e,t;let o=await fetch("".concat(u.pm,"/api/webdemo/signed-url"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(!o.ok){let e=await o.json();throw Error(e.message||"Failed to get WebSocket URL")}let n=await o.json();if(!(null===(e=n.data)||void 0===e?void 0:e.token)||!(null===(t=n.data)||void 0===t?void 0:t.wsUrl))throw Error("Invalid response format");return r&&console.log("DEBUG: received WebSocket URL for secure connection"),n.data.wsUrl}catch(e){return r&&console.error("Error getting WebSocket URL:",e),z("Failed to get WebSocket URL: ".concat(e instanceof Error?e.message:"Unknown error")),q(!1),null}},ep=async()=>{try{await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0}}),V(!1),X(!0),ec.current||(ec.current=await eu());let e=ec.current;e&&await el.startSession({signedUrl:e})}catch(e){e instanceof DOMException&&"NotAllowedError"===e.name?z("Please allow microphone access to start the conversation."):z("Failed to start conversation: ".concat(e instanceof Error?e.message:"Unknown error")),q(!1)}};(0,n.useEffect)(()=>{{let e=window.AudioContext||window.webkitAudioContext;eo.current=new e;let t=eo.current.createAnalyser();t.fftSize=256,en.current=t;let r=new Uint8Array(t.frequencyBinCount);ei.current=r}return()=>{eo.current&&eo.current.close(),ea.current&&cancelAnimationFrame(ea.current)}},[]),(0,n.useEffect)(()=>((async()=>{if(q(!0),!r&&eh()){ee(!0),er(!0),q(!1);return}try{let e=await eu();if(ec.current=e,e){if(i)try{await ep();return}catch(e){r&&console.log("Permission check failed on restart, falling back to normal flow")}if(await ed()){X(!0),await ep();return}if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)){V(!0),q(!1);return}await ep()}}catch(e){e instanceof DOMException&&"NotAllowedError"===e.name?V(!0):z("Failed to start conversation: ".concat(e instanceof Error?e.message:"Unknown error")),q(!1)}})(),()=>{el.endSession(),es.current&&clearTimeout(es.current)}),[i]),(0,n.useEffect)(()=>()=>{ea.current&&cancelAnimationFrame(ea.current)},[]),(0,n.useEffect)(()=>{if(el)try{t?el.setVolume({volume:0}):el.setVolume({volume:1})}catch(e){r&&console.error("Error setting volume:",e)}},[t,el]);let eh=()=>!r&&"true"===localStorage.getItem("webdemo_expired"),em=()=>{r||localStorage.setItem("webdemo_expired","true")},eg=()=>{if(!r)try{let e=new Audio("/demo/completed.wav");e.volume=.7,e.play().catch(e=>{console.log("Could not play completion sound:",e)})}catch(e){console.log("Error creating audio:",e)}};(0,n.useEffect)(()=>(!r&&K&&Y<120?es.current=setTimeout(()=>{H(e=>e+1)},1e3):!r&&K&&Y>=120&&(async()=>{Q(!1),ee(!0),em(),await (0,a.$s)("web_chat_expired",{}),await (0,c.u)("[Demo] User conversation hit time limit",localStorage.getItem("user_location")||null),eg(),er(!0),el&&el.endSession()})(),()=>{es.current&&clearTimeout(es.current)}),[Y,K,r,el]);let ef=async()=>{await (0,a.$s)("web_chat_click_continue",{}),await (0,a.$s)("web_redirect_to_signup_form",{from:"talk_expired_continue"}),await (0,c.u)("[Demo] User clicked continue after conversation expired",localStorage.getItem("user_location")||null),s.push("/")};return(0,o.jsxs)(g,{children:[m&&(0,o.jsx)(w,{children:m}),!r&&K&&(0,o.jsx)(v,{children:(0,o.jsx)(k,{children:(e=>{let t=Math.floor(e/60);return"".concat(t,":").concat((e%60).toString().padStart(2,"0"))})(Y)})}),(0,o.jsx)(f,{children:G?(0,o.jsxs)(b,{children:[(0,o.jsx)(x,{children:"To start the conversation, we need access to your microphone."}),(0,o.jsx)(y,{onClick:ep,children:"Allow Microphone & Start"})]}):(0,o.jsx)(o.Fragment,{children:(0,o.jsx)(l.default,{audioSrc:null,type:"circular",color:T,size:350,autoPlay:!1,loop:!1,isActive:B&&(el.isSpeaking||M),amplitude:2.5,showPlayButton:!1,isLoading:$})})}),et&&(0,o.jsx)(S,{onClick:()=>er(!1),children:(0,o.jsxs)(C,{onClick:e=>e.stopPropagation(),children:[(0,o.jsx)(_,{onClick:()=>er(!1),children:"\xd7"}),(0,o.jsxs)(j,{children:[(0,o.jsx)(A,{children:"We're just getting started!"}),(0,o.jsx)(E,{children:"Let's continue this conversation. I'll give you a call right now."}),(0,o.jsx)(I,{onClick:ef,children:"Yes"})]})]})})]})};m.displayName="ElevenLabsConversationComponent";let g=i.Ay.div.withConfig({componentId:"sc-b27cc204-0"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;width:100%;height:100vh;background-color:transparent;"]),f=i.Ay.div.withConfig({componentId:"sc-b27cc204-1"})(["display:flex;flex-direction:column;justify-content:center;align-items:center;width:100%;height:100%;position:relative;"]),w=i.Ay.div.withConfig({componentId:"sc-b27cc204-2"})(["position:absolute;top:20px;background-color:rgba(255,0,0,0.7);color:white;padding:0.75rem;border-radius:8px;text-align:center;z-index:10;"]),b=i.Ay.div.withConfig({componentId:"sc-b27cc204-3"})(["display:flex;flex-direction:column;align-items:center;justify-content:center;padding:2rem;background-color:rgba(255,255,255,0.9);border-radius:12px;box-shadow:0 4px 12px rgba(0,0,0,0.1);text-align:center;max-width:90%;"]),x=i.Ay.p.withConfig({componentId:"sc-b27cc204-4"})(["font-size:1.2rem;margin-bottom:1.5rem;color:#333;line-height:1.5;"]),y=i.Ay.button.withConfig({componentId:"sc-b27cc204-5"})(["background-color:var(--color-primary-600,#39796b);color:white;border:none;border-radius:8px;padding:0.75rem 1.5rem;font-size:1.1rem;font-weight:600;cursor:pointer;transition:background-color 0.2s ease;&:hover{background-color:var(--color-primary-700,#2d6256);}"]),v=i.Ay.div.withConfig({componentId:"sc-b27cc204-6"})(["position:absolute;top:120px;left:50%;transform:translateX(-50%);z-index:10;"]),k=i.Ay.p.withConfig({componentId:"sc-b27cc204-7"})(["font-size:1.4rem;margin:0;color:#333;font-weight:600;background-color:rgba(255,255,255,0.9);padding:0.75rem 2rem;border-radius:12px;box-shadow:0 2px 8px rgba(0,0,0,0.1);
1min-width:200px;text-align:center;white-space:nowrap;@media (max-width:768px){font-size:1.2rem;padding:0.6rem 3rem;min-width:280px;max-width:90vw;}@media (max-width:480px){font-size:1.1rem;padding:0.5rem 2.5rem;min-width:260px;}"]),S=i.Ay.div.withConfig({componentId:"sc-b27cc204-8"})(["position:fixed;top:0;left:0;width:100%;height:100%;background-color:rgba(0,0,0,0.7);display:flex;justify-content:center;align-items:center;z-index:9999;"]),C=i.Ay.div.withConfig({componentId:"sc-b27cc204-9"})(["position:relative;background-color:white;padding:3.5rem 2rem 2rem 2rem;border-radius:16px;max-width:90%;width:420px;box-shadow:0 20px 60px rgba(0,0,0,0.3);"]),j=i.Ay.div.withConfig({componentId:"sc-b27cc204-10"})(["text-align:center;"]),A=i.Ay.h2.withConfig({componentId:"sc-b27cc204-11"})(["font-size:1.6rem;margin-bottom:1.2rem;color:#2c3e50;font-weight:600;line-height:1.3;"]),E=i.Ay.p.withConfig({componentId:"sc-b27cc204-12"})(["font-size:1.1rem;margin-bottom:2rem;color:#555;line-height:1.6;"]),I=(0,i.Ay)(s.$n).withConfig({componentId:"sc-b27cc204-13"})(["font-size:1.25rem;overflow:hidden;position:relative;font-weight:600;flex:1;text-decoration:none;width:100% !important;&::after{content:'';position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient( 90deg,rgba(255,255,255,0) 0%,rgba(255,255,255,0.2) 50%,rgba(255,255,255,0) 100% );transition:all 0.6s ease;}&:hover::after{left:100%;}"]),_=i.Ay.button.withConfig({componentId:"sc-b27cc204-14"})(["position:absolute;top:15px;right:15px;background:none;border:none;font-size:1.8rem;color:#999;cursor:pointer;width:30px;height:30px;display:flex;align-items:center;justify-content:center;border-radius:50%;transition:all 0.2s ease;&:hover{background-color:#f0f0f0;color:#666;}"]),z=m},5998:(e,t,r)=>{r.d(t,{s4:()=>i});let o={neutral:"#4285f4",happy:"#34a853",sad:"#5d52c7",angry:"#ea4335",excited:"#fbbc05",calm:"#42b6f4",worried:"#9e55f7",surprised:"#ff6d01"},n={happy:["happy","joy","delighted","glad","cheerful","pleased","thrilled","smile","laugh","wonderful","great"],sad:["sad","unhappy","disappointed","upset","miserable","down","depressed","heartbroken","sorry","regret"],angry:["angry","mad","furious","outraged","annoyed","irritated","frustrat","upset","hate","damn","stop"],excited:["excited","thrilled","enthusiastic","eager","amazing","wow","fantastic","incredible","awesome"],calm:["calm","peaceful","relaxed","tranquil","gentle","patient","understand","nice","ok","fine"],worried:["worried","anxious","concerned","nervous","afraid","scared","fear","stress","trouble","problem"],surprised:["surprised","shocked","amazed","astonished","startled","unexpected","whoa","oh my","seriously"],neutral:[]};function i(e){return o[function(e){if(!e)return"neutral";let t=e.toLowerCase(),r=Object.entries(n).reduce((e,r)=>{let[o,n]=r,i=n.reduce((e,r)=>{let o=RegExp("\\b".concat(r,"\\w*\\b"),"gi"),n=t.match(o);return e+(n?n.length:0)},0);return e[o]=i,e},{}),o=0,i="neutral";return Object.entries(r).forEach(e=>{let[t,r]=e;r>o&&(o=r,i=t)}),i}(e)]}}}]);
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.