PageSourceSearch

https://intro.co/_next/static/chunks/pages/meetings/[meetingId]-fdd4718dfa55c5a3.js

js intro.co collected 2026-09-24 18:41:01 UTC 214,215 bytes, 5 lines download raw bytes

1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="54fa651d-63e8-45a2-8fbf-d83f179527c1",e._sentryDebugIdIdentifier="sentry-dbid-54fa651d-63e8-45a2-8fbf-d83f179527c1")}catch(e){}}(),(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4449],{2372:(e,t,r)=>{"use strict";r.d(t,{kV:()=>o,o$:()=>l,tc:()=>s});var i=r(14232),n=r(37876);let a=(0,i.createContext)(null),s=({children:e})=>{let[t,r]=(0,i.useState)(null);return(0,n.jsx)(a.Provider,{value:(0,i.useMemo)(()=>({openDropdownId:t,setOpenDropdownId:r}),[t]),children:e})},o=()=>(0,i.useContext)(a),l=()=>{let e=o();if(!e)throw Error("useDropdownContext must be used within a DropdownProvider");return e}},4319:(e,t,r)=>{"use strict";r.d(t,{A:()=>a});var i=r(14232),n=r(37443);let a=function(e,t,r,a){let s=(0,i.useRef)(t);(0,n.A)(()=>{s.current=t},[t]),(0,i.useEffect)(()=>{let t=r?.current||window;if(!(t&&t.addEventListener))return;let i=e=>s.current(e);return t.addEventListener(e,i,a),()=>{t.removeEventListener(e,i,a)}},[e,r,a])}},6245:(e,t,r)=>{"use strict";r.r(t),r.d(t,{__N_SSP:()=>tQ,default:()=>t0});var i=r(14232),n=r(89099),a=r(77328),s=r.n(a),o=r(29454),l=r(19297),c=r(69505),d=r(64392),p=r(56044),u=r(55031),h=r(94410),m=r.n(h);let x={IDLE:"IDLE",PENDING:"PENDING",FULFILLED:"FULFILLED",REJECTED:"REJECTED"},f={audio:{deviceId:""},video:{facingMode:"user",width:1280,height:720,frameRate:{ideal:60,min:10},deviceId:""}};var w=r(78991),g=r(56557),b=r.n(g),v=r(39889),S=r(81724),y=r(37443),j=r(4319),k=r(16476),E=r(19316),N=r(60514);let I="@publisher-device-cache",C=()=>{let e=window.sessionStorage;if(!e)return{};try{let t=e.getItem(I);if(!t)return{};return JSON.parse(t)}catch(e){return{}}},D=e=>{(e=>{let t=window.sessionStorage;if(t)try{t.setItem(I,JSON.stringify(e))}catch(e){}})({...C(),...e})};var A=r(30580),T=r(37876);function P({targetDate:e,onComplete:t,className:r}){return(0,T.jsx)(v.Ay,{date:e,onComplete:t,renderer:({hours:e,days:t,minutes:i,seconds:n,completed:a})=>{if(a||e>0||t>0||i>20)return null;let s=n>0?i+1:i,o=s>0;return(0,T.jsxs)(c.P.p,{initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:10},transition:{duration:.5},className:`text-[#8c8c8c] text-[17px] md:text-[14px] font-normal leading-none mb-[28px] ${r||""} pt-[16px]`,children:["Session joinable in"," ",(0,T.jsxs)("span",{className:"",children:[o?`${s} minute${s>1?"s":""}`:""," ",o?"":`${n} second${n>1?"s":""}`]})]})}})}function M({onEnterMeeting:e,setDefaultMute:t,setDefaultVideoOff:r,setDefaultAudioOutput:a,setDefaultCameraSource:s,setDefaultAudioSource:o,meeting:c}){let h=(0,n.useRouter)(),{currentUser:g,fetchingCurrentUser:v}=(0,p.A)();(0,N.A)();let{stop:E,getMediaDevices:I,isSupported:D,isStreaming:M,isAudioMuted:R,isVideoMuted:V,muteVideo:$,unmuteVideo:F,updateMediaDeviceConstraints:L,devices:_,attachSinkId:O,stopAllMediaTracks:z}=(e=>{let t=!!navigator?.mediaDevices?.getUserMedia,[r,n]=(0,i.useState)(()=>m()(f,(void 0)??{})),[a,s]=(0,i.useState)(x.IDLE),[o,l]=(0,i.useState)(x.IDLE),[c,d]=(0,i.useState)(!1),[p,u]=(0,i.useState)(null),[h,w]=(0,i.useState)([]),[g,b]=(0,i.useState)(!1),[v,S]=(0,i.useState)(!1),y=(0,i.useRef)(null),j=[],k=[],E=[];h.forEach(e=>{"audioinput"===e.kind?j.push(e):"audiooutput"===e.kind?k.push(e):"videoinput"===e.kind&&E.push(e)});let N=y.current?.getAudioTracks()[0],I=y.current?.getVideoTracks()[0],C=N?.getSettings(),D=I?.getSettings(),A=C?.deviceId,T=D?.deviceId,P=D?.width,M=D?.height,R=D?.aspectRatio,V=(0,i.useCallback)(()=>{S(!0)},[]),$=(0,i.useCallback)(()=>{b(!0)},[]),F=(0,i.useCallback)(()=>{d(!1)},[]),L=async(e=r)=>{u(null),s(x.PENDING);try{let t=await navigator.mediaDevices.getUserMedia(e);return t.getVideoTracks().forEach(async e=>{e.addEventListener("ended",F),e.addEventListener("mute",V)}),t.getAudioTracks().forEach(e=>{e.addEventListener("ended",F),e.addEventListener("mute",$)}),y.current=t,s(x.FULFILLED),t}catch(e){return console.error("Error while fetching the stream:",e),s(x.REJECTED),u(e),null}},_=async()=>
1{if(c)return y.current;let e=y.current||null;return e||(e=await L()),e&&d(!0),e},O=()=>{if(!c)return;let e=y.current;e&&(e.getVideoTracks().forEach(e=>{e.removeEventListener("ended",F),e.removeEventListener("mute",V)}),e.getAudioTracks().forEach(e=>{e.removeEventListener("ended",F),e.removeEventListener("mute",$)}),e.getTracks().forEach(e=>e.stop()),y.current=null,d(!1),s(x.IDLE),u(null))},z=async()=>{if(!t)return l(x.REJECTED),u(Error("getUserMedia is not supported in this browser")),[];u(null),l(x.PENDING);try{y.current||await L();let e=await navigator.mediaDevices.enumerateDevices();return w(e),l(x.FULFILLED),e}catch(e){return l(x.REJECTED),u(e),[]}},B=async({constraints:e,resetStream:t=!1})=>{let i=m()(r,e);n(i),t&&(d(!1),O(),await L(i),d(c))};return{stream:y.current,isSupported:t,isStreaming:c,isAudioMuted:g,isVideoMuted:v,devices:h,audioInputDevices:j,audioOutputDevices:k,videoInputDevices:E,selectedAudioTrackDeviceId:A,selectedVideoTrackDeviceId:T,selectedVideoTrackDeviceWidth:P,selectedVideoTrackDeviceHeight:M,selectedVideoTrackDeviceAspectRatio:R,getStreamRequest:a,getMediaDevicesRequest:o,error:p,start:_,stop:O,getMediaDevices:z,updateMediaDeviceConstraints:B,stopAllMediaTracks:()=>{let e=y.current;e&&(e.getTracks().forEach(e=>e.stop()),e=null)},updateStream:e=>{y.current=e},muteAudio:()=>{y.current&&(y.current.getAudioTracks().forEach(e=>{e.enabled=!1}),b(!0))},unmuteAudio:()=>{y.current&&(y.current.getAudioTracks().forEach(e=>{e.enabled=!0}),b(!1))},muteVideo:()=>{y.current&&(y.current.getVideoTracks().forEach(e=>{e.enabled=!1}),S(!0))},unmuteVideo:()=>{y.current&&(y.current.getVideoTracks().forEach(e=>{e.enabled=!0}),S(!1))},addVideoEndedEventListener:e=>{y.current?.getVideoTracks().forEach(t=>{t.addEventListener("ended",e)})},addAudioEndedEventListener:e=>{y.current?.getAudioTracks().forEach(t=>{t.addEventListener("ended",e)})},addVideoMuteEventListener:e=>{y.current?.getVideoTracks().forEach(t=>{t.addEventListener("mute",e)})},addAudioMuteEventListener:e=>{y.current?.getAudioTracks().forEach(t=>{t.addEventListener("mute",e)})},removeVideoEndedEventListener:e=>{y.current?.getVideoTracks().forEach(t=>{t.removeEventListener("ended",e)})},removeAudioEndedEventListener:e=>{y.current?.getAudioTracks().forEach(t=>{t.removeEventListener("ended",e)})},removeVideoMuteEventListener:e=>{y.current?.getVideoTracks().forEach(t=>{t.removeEventListener("mute",e)})},removeAudioMuteEventListener:e=>{y.current?.getAudioTracks().forEach(t=>{t.removeEventListener("mute",e)})},attachSinkId:(e,t)=>{void 0!==e.sinkId?e.setSinkId?.(t).catch(e=>{let t=e;"SecurityError"===e.name&&(t=`You need to use HTTPS for selecting audio output device: ${e}`),console.error(t)}):console.warn("Browser does not support output device selection.")}}})(),B=(0,i.useRef)(null),U=(0,i.useRef)(null),{width:H}=(0,k.A)(),W=H<800,[q,Y]=(0,i.useState)(null),[J,K]=(0,i.useState)(!1),[G,Z]=(0,i.useState)([]),[X,Q]=(0,i.useState)([]),[ee,et]=(0,i.useState)([]),[er,ei]=(0,i.useState)(!1),[en,ea]=(0,i.useState)(!1),[es,eo]=(0,i.useState)(!1),[el,ec]=(0,i.useState)(!1),[ed,ep]=(0,i.useState)(!1),[eu,eh]=(0,i.useState)(!1),[em,ex]=(0,i.useState)(!1),[ef,ew]=(0,i.useState)(!1),[eg,eb]=(0,i.useState)(!1),[ev,eS]=(0,i.useState)({width:0,height:0}),[ey,ej]=(0,i.useState)(!0),[ek,eE]=(0,i.useState)(!1),[eN,eI]=(0,i.useState)(null),[eC,eD]=(0,i.useState)(!1),[eA]=(0,i.useState)(()=>C()),eT=(0,i.useMemo)(()=>b()(c?.StartAt).tz(b().tz.guess()).subtract(5,"minute"),[c?.StartAt]),eP=(0,i.useCallback)(()=>{if(B.current&&(B.current.getTracks().forEach(e=>{e.stop(),e.enabled=!1,B.current?.removeTrack(e)}),B.current=null),U.current&&(U.current.getTracks().forEach(e=>{e.stop(),e.enabled=!1,U.current?.removeTrack(e)}),U.current=null),q?.srcObject){let{srcObject:e}=q;e instanceof MediaStream&&(e.getTracks().forEach(t=>{t.stop(),t.enabled=!1,e.removeTrack(t)}),q.srcObject=null)}navigator.mediaDevices&&navigator.mediaDevices.getUserMedia&&navigator.mediaDevices.enumerateDevices().then(()=>{}).catch(()=>{})},[q]),eM=()=>{ed?(ep(!1),t(!1)):(ep(!0),t(!0))},eR=()=>{ex(!0),z();let e=eA?.videoInputDeviceId;navigator.mediaDevices.getUserMedia(e?{video:{deviceId:{exact:e}}}:{video:!0}).catch(t=>{if(e)return navigator.mediaDevices.getUserMedia({video:!0});throw t}).then(e=>{B.current=e,ei(!0),q&&(q.srcObject=e);let t=e.getVideoTracks()[0];if(t){let{deviceId:e}=t.getSettings();e&&s(e)}}).catch(e=>{console.log("error",e.message),eo(!0)}).finally(()=>{ex(!1)})},eV=()=>
1{V?(ej(!0),F(),B.current?.getVideoTracks().forEach(()=>{eR()}),r(!1),setTimeout(()=>{ej(!1)},1e3)):($(),B.current?.getVideoTracks().forEach(e=>{e.stop()}),r(!0))},e$=()=>{eb(!0),E(),z(),eP(),q&&Y(null),e()},eF=e=>{if("videoinput"===e.kind){var t;L({constraints:{video:{deviceId:{exact:e.value}}},resetStream:!0}),t=e.value,eE(!0),z(),navigator.mediaDevices.getUserMedia({video:{deviceId:{exact:t}}}).then(e=>{B.current=e,q&&(q.srcObject=e)}).catch(e=>{console.log("error",e.message),eo(!0)}).finally(()=>{eE(!1)}),s(e.value)}else"audioinput"===e.kind?o(e.value):"audiooutput"===e.kind&&(a(e.value),O(q,e.value))},eL=async()=>{eh(!0);try{await I()}catch(e){console.log("error",e)}finally{eh(!1)}},e_=()=>{ew(!0);let e=eA?.audioInputDeviceId;navigator.mediaDevices.getUserMedia(e?{audio:{deviceId:{exact:e}}}:{audio:!0}).catch(t=>{if(e)return navigator.mediaDevices.getUserMedia({audio:!0});throw t}).then(e=>{U.current=e,ea(!0)}).catch(e=>{console.log("error",e),ec(!0)}).finally(()=>{ew(!1)})};(0,i.useEffect)(()=>{er&&en&&eL()},[er,en]),(0,i.useEffect)(()=>b()().isBefore(eT)&&!q?()=>{}:(K(!0),navigator.permissions&&navigator.permissions.query?(navigator.permissions.query({name:"camera"}).then(e=>{"granted"===e.state?(eR(),ei(!0)):"prompt"===e.state?ei(!1):"denied"===e.state&&(ei(!1),eo(!0))}),navigator.permissions.query({name:"microphone"}).then(e=>{"granted"===e.state?(e_(),ea(!0)):"prompt"===e.state?ea(!1):"denied"===e.state&&(ea(!1),ec(!0))})):eL(),()=>{E(),z()}),[eT,q]);let eO=()=>{if(!q)return;let{width:e,height:t}=q.getBoundingClientRect();eS({width:e,height:t})};(0,y.A)(()=>{eO()},[q]),(0,j.A)("resize",eO),(0,i.useEffect)(()=>(_&&(e=>{let t=e.filter(e=>"audioinput"===e.kind),r=e.filter(e=>"videoinput"===e.kind),i=e.filter(e=>"audiooutput"===e.kind);if(Z((0,S.AR)(t)),Q((0,S.AR)(r)),et((0,S.AR)(i)),B.current){let e=B.current.getVideoTracks()[0];if(e){let{deviceId:t}=e.getSettings();t&&s(t)}}if(U.current){let e=U.current.getAudioTracks()[0];if(e){let{deviceId:t}=e.getSettings();t&&o(t)}}let n=eA?.audioOutputDeviceId;n&&i.some(e=>e.deviceId===n)&&(a(n),O(q,n))})(_),()=>{z()}),[_]);let ez=(0,i.useRef)(()=>{});ez.current=(0,i.useCallback)(()=>{E(),z(),eP()},[E,z,eP]),(0,i.useEffect)(()=>{let e=e=>{e.preventDefault(),ez.current(),window.location.replace("/meetings")},t=()=>{ez.current()};return window.history.pushState(null,"",window.location.href),window.addEventListener("popstate",e),window.addEventListener("beforeunload",t),()=>{ez.current(),window.removeEventListener("popstate",e),window.removeEventListener("beforeunload",t)}},[]),(0,i.useEffect)(()=>{D&&eO()},[M,D,V,R]);let eB=c?.Expert?.Id===g?.Id,eU=c&&!b()().isBefore(b()(c.StartAt).subtract(5,"minute"));(0,S.AZ)(h.query)&&(eU=!0),(0,i.useEffect)(()=>{if(!c?.StartAt)return;let e=b()(),t=b()(c.StartAt).subtract(5,"minute");e.isBefore(t)?eI(t.toDate()):eI(null)},[c?.StartAt,c?.Duration]);let eH=()=>{eD(!0),setTimeout(()=>{window.location.reload()},3e3)};if(eg||v&&!g?.FirstName)return(0,T.jsx)("div",{className:"min-h-full flex flex-col items-center justify-center w-full",children:(0,T.jsx)(w.A,{width:64,height:64})});let eW=er?(0,T.jsx)("img",{alt:"checkmark",src:"/checkmark-in-white-circle.svg",className:"w-[24px] h-[24px] mx-auto"}):"Enable camera",eq=en?(0,T.jsx)("img",{alt:"microphone enabled checkmark",src:"/checkmark-in-white-circle.svg",className:"w-[24px] h-[24px] mx-auto"}):"Enable microphone";return(0,T.jsx)("div",{className:"relative w-full h-screen flex flex-col overflow-scroll pt-[6px]",children:(0,T.jsxs)("div",{className:"lg:px-15 md:px-10 px-[10px] max-w-[1080px] xl:max-w-[1280px] mx-auto relative w-full flex flex-col h-full",children:[(0,T.jsxs)("div",{className:"flex relative z-10 items-center w-full bg-white",children:[(0,T.jsx)("button",{type:"button",className:"mr-6 cursor-pointer",onClick:()=>{window.location.href="/meetings"},children:(0,T.jsx)("img",{alt:"back arrow",width:13,height:21,src:"/intro-back.svg"})}),(0,T.jsx)(l.A,{width:70,height:26,onClick:()=>{window.location.href="/meetings"}})]}),(0,T.jsx)("div",{className:"flex flex-col md:flex-row flex-1 items-center justify-start mt-[20px] md:mt-0 md:justify-center relative md:pb-[40px]",children:(()=>
1{if(eT.isAfter(b()())){let e=b()(c?.StartAt).tz(b().tz.guess()),t=e.format("dddd, M/D");return(e.isToday()?t="Today":e.isTomorrow()&&(t="Tomorrow"),eC)?(0,T.jsx)(A.v,{title:"Joining...",description:"Please wait while we connect you to the call",buttonText:"Back to calls",buttonOnClick:()=>{window.location.href="/meetings"}}):(0,T.jsxs)("div",{className:"text-center",children:[(0,T.jsx)(A.v,{title:`${g?.FirstName??"Hey"}, you're a bit early!`,description:`This call will unlock five minutes before your call at ${e.format("h:mma z  —")} ${t}`,buttonText:"Back to calls",buttonOnClick:()=>{window.location.href="/meetings"}}),eN&&(0,T.jsx)("div",{className:"mt-4",children:(0,T.jsx)(P,{targetDate:eN,onComplete:eH})})]})}return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("div",{className:`w-full md:px-[20px] max-w-[660px] ${!er||!en?"block":"hidden"}`,children:(0,T.jsxs)("div",{className:"bg-[#000000] md:px-[60px] px-[26px] pt-[24px] pb-[34px] md:pt-[50px] md:pb-[60px] rounded-[8px] relative",children:[(0,T.jsx)("p",{className:"pb-[15px] text-[#8C8C8C] border-b border-[#8C8C8C] mb-[25px] md:mb-[20px] text-[17px]",children:"Please enable camera and microphone permissions in your browser or device settings to join the call"}),(0,T.jsxs)("div",{className:`flex w-full ${er?"opacity-60":""}`,children:[(0,T.jsx)("span",{className:"w-[28px] h-[28px] rounded-full border border-[#8C8C8C] leading-[25px] text-center text-[17px] font-normal text-[#8C8C8C] mr-[12px] md:mr-[18px] select-none shrink-0",children:"1"}),(0,T.jsxs)("div",{className:"relative w-auto",children:[(0,T.jsx)("p",{className:"font-normal text-[17px] text-[#8C8C8C]",children:"Enable your camera"}),(0,T.jsx)("p",{className:"font-light text-[15px] mt-[-2px] text-[#8C8C8C] hidden md:block",children:"So other participants can see you :-)"}),(0,T.jsx)(d.A,{cta:em?(0,T.jsx)(w.A,{color:"#ffffff",width:24,height:24,className:"mx-auto"}):eW,onClick:er?void 0:eR,classes:`text-[17px] !font-medium !py-2 mt-[12px] w-[250px] md:w-[275px] h-[48px] select-none ${er?"pointer-events-none":""}`,isActive:!0}),!er&&(0,T.jsx)("img",{src:"/three-arrows.svg",alt:"arrows",className:"w-[53px] h-[59px] absolute right-[-70px] bottom-[-8px] hidden md:block"})]})]}),(0,T.jsxs)("div",{className:`flex justify-start md:justify-end w-full mt-[25px] ${en||!en&&!er?"opacity-60":""}`,children:[(0,T.jsx)("span",{className:"w-[28px] h-[28px] rounded-full border border-[#8C8C8C] leading-[25px] text-center text-[15px] font-normal text-[#8C8C8C] mr-[12px] md:mr-[18px] select-none shrink-0",children:"2"}),(0,T.jsxs)("div",{className:"relative w-auto",children:[(0,T.jsx)("p",{className:"font-normal text-[17px] text-[#8C8C8C]",children:"Enable your audio/microphone"}),(0,T.jsx)("p",{className:"font-light text-[15px] mt-[-2px] text-[#8C8C8C] hidden md:block",children:"So other participants can hear you :-)"}),(0,T.jsx)(d.A,{cta:ef?(0,T.jsx)(w.A,{color:"#ffffff",width:24,height:24,className:"mx-auto"}):eq,onClick:e_,classes:`text-[17px] !font-medium !py-2 mt-[12px] w-[250px] md:w-[275px] h-[48px] select-none ${en?"pointer-events-none":""}`,isActive:!0}),!en&&er&&(0,T.jsx)("img",{src:"/three-arrows.svg",alt:"arrows",className:"w-[53px] h-[59px] rotate-180 absolute left-[-70px] bottom-[-4px] hidden md:block"})]})]}),(0,T.jsx)("p",{className:"text-center text-[#8C8C8C] font-normal text-[16px] bottom-[-40px] w-full left-0 absolute hidden md:block",children:"You can always turn off your camera once enabled"})]})}),(0,T.jsxs)("div",{className:`w-full text-center md:px-[20px] max-w-[660px] ${er&&en?"block":"hidden"}`,children:[!eB&&(0,T.jsx)("p",{className:"text-[#666666] font-normal mb-[20px] text-[16px] hidden md:block",children:"Pro tip: keep your questions as concise as possible"}),(0,T.jsxs)("div",{className:"md:bg-gradient-to-t from-[#EAEAEA] to-[#f8f8f8] md:p-[14px] rounded-[22px] relative",children:[(0,T.jsx)("div",{className:`absolute z-3 ${V?"flex":"hidden"} items-center justify-center left-0 w-full h-full md:left-[14px] bg-[#202020] rounded-[14px]`,style:{width:`${ev.width}px`,height:`${ev.height}px`},children:(0,T.jsx)("div",{className:"max-w-[200px] mx-auto text-center flex-col items-center relative top-[-28px] md:top-0",children:(0,T.jsx)("img",{alt:"participant video off",src:"/participant-video-off.svg",className:"md:w-[180px] md:h-[180px] w-[120px] h-[120px] [@media(max-height:900px)]:w-[120px] [@media(max-height:900px)]:h-[120px] mx-auto"})})}),(0,T.jsxs)("div",{className:"relative",children:[(ey||ek)&&(0,T.jsx)("div",{className:`absolute z-4 flex items-center justify-center w-full left-0 h-full bg-[#202020] rounded-[14px] ${ek?"bg-[#202020]/60":""}`,children:(0,T.jsx)(w.A,{width:32,height:32,color:"#ffffff"})}),(0,T.jsx)("video",{id:"previewVideo",ref:Y,className:`scale-x-[-1] h-[268px] md:h-[428px] w-full object-cover rounded-[12px] z-2 relative bg-[#202020] ${V?"video-off":""}
1`,autoPlay:!0,playsInline:!0,muted:!0,onPlay:()=>{ej(!1)}}),(0,T.jsx)("div",{className:"absolute top-0 left-0 h-[268px] md:h-[428px] w-full bg-[#202020] rounded-[12px] z-1 flex items-center justify-center",children:(0,T.jsx)(w.A,{width:32,height:32,color:"#ffffff"})})]}),(0,T.jsxs)("div",{className:`${W?"flex":"hidden"} items-center justify-center absolute bottom-[15px] left-0 right-0 z-4`,children:[(0,T.jsxs)("button",{type:"button",onClick:eV,className:"w-[50px] h-[50px] rounded-[14px] bg-transparent border-[1.5px] border-white mr-[8px] flex items-center justify-center relative videoCall-media-toggle-btn",children:[V&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[30px] rounded-[4px] ring-transparent! -rotate-45 ring-2 absolute z-10 left-[21px] top-[9px] cursor-pointer"}),(0,T.jsx)("img",{alt:"camera",className:"w-[20px] h-[20px] absolute",src:"/camera-on-icon-white.svg"})]}),(0,T.jsxs)("button",{type:"button",onClick:eM,className:"w-[50px] h-[50px] rounded-[14px] bg-transparent border-[1.5px] border-white flex items-center justify-center relative videoCall-media-toggle-btn",children:[ed&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[30px] rounded-[4px] ring-transparent! -rotate-45 ring-2 absolute z-10 left-[23px] top-[10px] cursor-pointer"}),(0,T.jsx)("img",{alt:"microphone",className:"w-[18px] h-[20px] absolute",src:"/microphone-on-icon-white.svg"})]})]})]}),(0,T.jsxs)("div",{className:`${W?"hidden":"flex"} items-center justify-center mt-[12px]`,children:[(0,T.jsxs)("button",{type:"button",onClick:eV,className:"w-[70px] h-[70px] md:w-[60px] md:h-[60px] rounded-[20px] bg-[#EAEAEA] hover:bg-[#dddddd] mr-[8px] flex items-center justify-center relative videoCall-media-toggle-btn",children:[V&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[35px] md:h-[30px] rounded-[4px] ring-[#EAEAEA] -rotate-45 ring-2 absolute z-10 md:left-[27px] md:top-[15px] left-[32px] top-[17px] red-strikethrough cursor-pointer"}),(0,T.jsx)("img",{alt:"camera",className:"w-[28px] h-[26px] md:w-[24px] md:h-[22px] ml-[2px] absolute",src:"/camera-on-icon.svg"})]}),(0,T.jsxs)("button",{type:"button",onClick:eM,className:"w-[70px] h-[70px] md:w-[60px] md:h-[60px] rounded-[20px] bg-[#EAEAEA] hover:bg-[#dddddd] flex items-center justify-center relative videoCall-media-toggle-btn",children:[ed&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[35px] md:h-[30px] rounded-[4px] ring-[#EAEAEA] -rotate-45 ring-2 absolute z-10 md:left-[30px] md:top-[15px] left-[34px] top-[17px] red-strikethrough cursor-pointer"}),(0,T.jsx)("img",{alt:"microphone",className:"w-[24px] h-[26px] md:w-[20px] md:h-[22px] absolute",src:"/microphone-on-icon.svg"})]})]})]}),er&&en?(0,T.jsxs)("div",{className:"text-center md:pl-[30px] mb-0 mt-[28px] md:mt-[-28px]",children:[eC?(0,T.jsx)("p",{className:"text-charcoal text-[30px] md:text-[27px] font-normal leading-none mb-[12px]",children:"Joining..."}):(0,T.jsxs)("p",{className:"text-charcoal text-[30px] md:text-[27px] font-normal leading-none mb-[12px]",children:[g.FirstName?`${g.FirstName}, `:"","ready to join?"]}),!eC&&eN&&(0,T.jsx)(P,{targetDate:eN,onComplete:eH}),!eC&&eU&&(0,T.jsx)(d.A,{onClick:e$,classes:"w-[250px] !font-medium md:text-[17px] text-[21px] h-[57px] md:h-[48px] md:mb-[35px] pt-[11px]",cta:"Join video call",isActive:!0}),(0,T.jsx)("div",{className:"bg-[#F3F3F3] p-[14px] rounded-[6px] w-[340px] hidden md:block",children:eu?(0,T.jsx)("div",{className:"min-h-[140px] flex items-center justify-center",children:(0,T.jsx)(w.A,{width:40,height:40})}):(0,T.jsxs)("div",{children:[X.length>0&&(0,T.jsx)("div",{children:(0,T.jsx)(u.A,{id:"videoInputDropdown",options:X,defaultSelected:(()=>{if(B.current){let e=B.current.getVideoTracks()[0];if(e){let t=e.getSettings().deviceId,r=X.find(e=>e.value===t);if(r)return r}}let e=X.find(e=>e.value===eA?.videoInputDeviceId);return e||X[0]})(),wrapperClasses:"media-src-options-dropdown",classes:"w-full rounded-[4px] text-[#727272] text-[11px] font-normal",optionsWrapperClasses:"!bg-[#1E1E1E]",optionClasses:"!bg-transparent hover:!bg-[#3F3F3F] !text-white",labelIcon:(0,T.jsx)("img",{alt:"camera",className:"w-[18px] h-[14px] mr-[15px]",src:"/camera-on-icon.svg"}),onChange:e=>eF(e)})}),G.length>0&&(0,T.jsx)("div",{className:"mt-[10px]",children:(0,T.jsx)(u.A,{id:"audioInputDropdown",options:G,defaultSelected:(()=>
1{if(U.current){let e=U.current.getAudioTracks()[0];if(e){let t=e.getSettings().deviceId,r=G.find(e=>e.value===t);if(r)return r}}let e=G.find(e=>e.value===eA?.audioInputDeviceId);return e||G[0]})(),wrapperClasses:"media-src-options-dropdown",classes:"rounded-[6px] text-[#727272] text-[11px] font-normal",optionsWrapperClasses:"!bg-[#1E1E1E]",optionClasses:"!bg-transparent hover:!bg-[#3F3F3F] !text-white",labelIcon:(0,T.jsx)("img",{alt:"microphone",className:"w-[16px] h-[17px] mr-[16px] ml-px",src:"/microphone-on-icon.svg"}),onChange:e=>eF(e)})}),ee.length>0&&(0,T.jsx)("div",{className:"mt-[10px]",children:(0,T.jsx)(u.A,{id:"audioOutputDropdown",options:ee,defaultSelected:ee.find(e=>e.value===eA?.audioOutputDeviceId)??ee[0],wrapperClasses:"media-src-options-dropdown",classes:"rounded-[6px] text-[#727272] text-[11px] font-normal",optionsWrapperClasses:"!bg-[#1E1E1E]",optionClasses:"!bg-transparent hover:!bg-[#3F3F3F] !text-white",labelIcon:(0,T.jsx)("img",{alt:"speaker",className:"w-[18px] h-[13px] mr-[15px]",src:"/select-audio-output-icon.svg"}),onChange:e=>eF(e)})})]})})]}):(0,T.jsx)("div",{className:"text-center md:pl-[40px] mt-[20px] md:mt-0 flex-col shrink-0 max-w-[300px]",children:es||el?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:"text-center text-[#F25757] font-medium text-[18px] md:text-[20px] leading-none text-wrap-balance pb-4",children:"Camera and microphone access was denied."})," ",(0,T.jsx)("p",{className:"text-[#F25757] text-[16px] leading-5 font-normal",children:"Please update your permissions in your browser or device settings to join the call."})]}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:"text-charcoal text-[30px] font-normal leading-none mb-[12px] hidden md:block",children:"Almost there!"}),(0,T.jsx)("p",{className:"text-[#8C8C8C] text-[16px] leading-5 font-normal",children:"To access the video call, please enable your camera and audio"})]})})]})})()})]})})}b().extend(E.q,{shortMeridiem:!0,stripZeros:!0}),M.displayName="CallWaitingRoom";var R=r(21188),V=r(94886),$=r(19357);function F({isOpen:e,returnPath:t,onComplete:r}){let{currentUser:n,getCurrentUser:a}=(0,p.A)(),s=(0,V.yP)(),[o,l]=(0,i.useState)(""),[c,d]=(0,i.useState)(""),[u,h]=(0,i.useState)(""),[m,x]=(0,i.useState)(!1),[f,g]=(0,i.useState)(!1),b=async()=>{let e=o.trim(),t=c.trim();if(!e||!t)return void h("Add your first and last name.");h(""),x(!0);try{let i=await s.mutateAsync({firstName:e,lastName:t});if(!i.ok)throw Error(`Name update failed with status ${i.status}`);await a(),await r?.()}catch(e){h("Something went wrong saving your name. Please try again.")}finally{x(!1)}},v=async()=>{g(!0),await (0,$.y4)(`/login?from=${encodeURIComponent(t)}`)},y=e=>{"Enter"===e.key&&b()},j=n?.Phone?(0,S.r)(n.Phone):"",k=(0,T.jsxs)("div",{className:"flex flex-col gap-[12px]",children:[(0,T.jsxs)("div",{className:"flex w-full gap-[10px]",children:[(0,T.jsx)("input",{autoFocus:!0,id:"callNameFirst",autoComplete:"given-name",placeholder:"First name",value:o,onChange:e=>l(e.target.value),onKeyUp:y,disabled:m||f,className:"flex-1 font-sofia text-[17px] rounded-[8px] border border-solid border-black shadow-none pl-3 h-forty w-full"}),(0,T.jsx)("input",{id:"callNameLast",autoComplete:"family-name",placeholder:"Last name",value:c,onChange:e=>d(e.target.value),onKeyUp:y,disabled:m||f,className:"flex-1 font-sofia text-[17px] rounded-[8px] border border-solid border-black shadow-none pl-3 h-forty w-full"})]}),u&&(0,T.jsx)("p",{className:"text-error font-medium text-[14px]",children:u}),(0,T.jsx)("button",{type:"button",onClick:b,disabled:m||f,className:"w-full text-white text-[16px] font-medium py-[15px] rounded-[8px] bg-charcoal hover:bg-[#0a090c] transition-colors disabled:opacity-50 disabled:cursor-not-allowed flex items-center justify-center",children:m?(0,T.jsx)(w.A,{width:20,height:20,color:"#ffffff"}):"Continue"}),(0,T.jsxs)("div",{className:"mt-[6px] border-t border-[#e5e7eb] pt-[14px] text-center",children:[j&&(0,T.jsxs)("p",{className:"text-[14px] text-[#807F7F]",children:["You signed in with ",j]}),(0,T.jsxs)("p",{className:"text-[14px] text-[#807F7F]",children:["Not you?"," ",(0,T.jsx)("button",{type:"button",onClick:v,disabled:m||f,className:"text-charcoal font-medium underline disabled:opacity-50",children:f?"
1Switching":"Switch accounts"})]})]})]});return(0,T.jsx)(R.A,{visible:e,header:"What's your name?",subHeader:"Add your name so others know who's on the call.",dialogOptions:k,onRequestClose:()=>{},hideCta:!0,hideClose:!0,closeMaskOnClick:!1,closeOnEsc:!1,hideDialogOptionsDivider:!0})}F.displayName="EnterNameBeforeCallModal";var L=r(2372),_=r(39324),O=r.n(_),z=r(47888),B=r(46794),U=r(59103),H=r(65411),W=r(18334);let q=e=>({identity:e,callLegId:"undefined"!=typeof crypto&&"function"==typeof crypto.randomUUID?crypto.randomUUID():`${Date.now()}-${Math.random().toString(36).slice(2)}`,attemptStartedAt:Date.now(),joinedTracked:!1,connectedTracked:!1,failedStages:new Set}),Y=e=>{let t=e.current;if(!t)throw Error("useWebCallTelemetry read its call-leg state before the hook body created it");return t},J=e=>e instanceof Error?e:Error(String(e)),K=e=>/^[A-Za-z][\w.-]{0,99}$/.test(e)?e:"Error",G=e=>{if(!e||"object"!=typeof e||!("code"in e))return;let{code:t}=e;if("number"==typeof t&&Number.isFinite(t)||"string"==typeof t&&/^[\w.-]{1,100}$/.test(t))return t};var Z=r(27498),X=r(61956),Q=r(48230),ee=r.n(Q);function et(e){let[t,r]=(0,i.useState)(!1),[n]=(0,i.useState)(()=>{let t=new Audio(e);return t.preload="auto",t});return(0,i.useEffect)(()=>{if(!n)return()=>{};let e=()=>{r(!0)},t=()=>{r(!1)};return n.addEventListener("play",e),n.addEventListener("pause",t),()=>{n.removeEventListener("play",e),n.removeEventListener("pause",t)}},[n]),(0,i.useMemo)(()=>(n.addEventListener("play",()=>{n.currentTime=0}),{addEventListener:(e,t)=>{n.addEventListener(e,t)},removeEventListener:(e,t)=>{n.removeEventListener(e,t)},pause:()=>t?n.pause():Promise.resolve(),play:async()=>t?Promise.resolve():n.play()}),[n,t])}var er=r(13799);function ei(e){return(...t)=>new Promise((r,i)=>{e(...t,(e,...t)=>{e?i(e):r(t[0])})})}let en=["host","srflx","prflx","relay"],ea=e=>en.find(t=>t===e)??"unknown",es=e=>e?Array.isArray(e)?es(e[0]):"function"==typeof e.forEach?e:e.rtcStatsReport?es(e.rtcStatsReport):null:null,eo=async e=>{if("function"!=typeof e?.getRtcStatsReport)return null;try{return(e=>{let t,r,i=es(e);if(!i)return null;let n=new Map;if(i.forEach(e=>{e?.id&&n.set(e.id,e),e?.type==="transport"&&"string"==typeof e.selectedCandidatePairId&&(t=e.selectedCandidatePairId)}),t&&(r=n.get(t)),r||n.forEach(e=>{r||"candidate-pair"!==e.type||(!0===e.selected||!0===e.nominated&&"succeeded"===e.state)&&(r=e)}),!r)return null;let a=n.get(String(r.localCandidateId??"")),s=n.get(String(r.remoteCandidateId??""));return{localCandidateType:ea(a?.candidateType),remoteCandidateType:ea(s?.candidateType),protocol:"string"==typeof a?.protocol?a.protocol:void 0,relayProtocol:"string"==typeof a?.relayProtocol?a.relayProtocol:void 0}})(await e.getRtcStatsReport())}catch(e){return null}};class el{timer=null;lastBytes=null;lastSampleAt=null;stalledSince=null;state="healthy";constructor({subscriber:e,isExpectingMedia:t,onChange:r,pollMs:i=3e4,noMediaThresholdMs:n=3e4}){this.subscriber=e,this.isExpectingMedia=t,this.onChange=r,this.pollMs=i,this.noMediaThresholdMs=n}get currentState(){return this.state}start=()=>{null===this.timer&&(this.subscriber.on("networkConditionChanged",this.handleNetworkConditionChanged),this.timer=window.setInterval(this.sample,this.pollMs),this.sample())};stop=()=>{null!==this.timer&&(window.clearInterval(this.timer),this.timer=null),this.subscriber?.off?.("networkConditionChanged",this.handleNetworkConditionChanged),this.reset()};reset=()=>{this.lastBytes=null,this.lastSampleAt=null,this.stalledSince=null,this.state="healthy"};resetSampleWindow=()=>{this.lastBytes=null,this.lastSampleAt=null,this.stalledSince=null};resetForMediaExpectationChange=()=>{this.resetSampleWindow(),"healthy"!==this.state&&this.transition("healthy","recovered")};handleNetworkConditionChanged=e=>{let t=e?.stats?.mediaLink?.transport;if(this.lastCondition=t?.networkCondition,this.lastConditionReason=t?.networkConditionReason,this.lastDegradationSource=e?.stats?.mediaLink?.networkDegradationSource,!this.isExpectingMedia())return void this.resetForMediaExpectationChange();"noMedia"!==this.state&&("critical"===this.lastCondition?this.transition("degraded","criticalNetworkCondition"):"degraded"===this.state&&this.transition("healthy","recovered"))};sample=()=>{try{this.subscriber.getStats(this.handleStats)}catch(e){this.stopAfterStatsFailure()}};stopAfterStatsFailure=()=>{"healthy"!==this.state&&this.transition("healthy","recovered"),this.stop()};handleStats=(e,t)=>{if(e||!t)return void this.stopAfterStatsFailure();let r=(e=>(e?.audio?.bytesReceived??0)+(e?.video?.bytesReceived??0))(t),i=t.t
1imestamp??Date.now();if(this.lastDegradationSource=t.mediaLink?.networkDegradationSource??this.lastDegradationSource,this.lastCondition=t.mediaLink?.transport?.networkCondition??this.lastCondition,this.lastConditionReason=t.mediaLink?.transport?.networkConditionReason??this.lastConditionReason,!this.isExpectingMedia())return void this.resetForMediaExpectationChange();let n=this.lastBytes,a=this.lastSampleAt;if(this.lastBytes=r,this.lastSampleAt=i,null===n||r>n){this.stalledSince=null,"noMedia"===this.state&&this.transition("healthy","recovered");return}null===this.stalledSince&&(this.stalledSince=a??i);let s=i-this.stalledSince;s>=this.noMediaThresholdMs&&"noMedia"!==this.state&&this.transition("noMedia","noInboundBytes",s)};transition=(e,t,r)=>{this.state!==e&&(this.state=e,this.onChange({state:e,reason:t,stalledForMs:r,degradationSource:this.lastDegradationSource,networkCondition:this.lastCondition,networkConditionReason:this.lastConditionReason}))}}let ec=(e,{meetingId:t,service:r,iceTransport:i,attempt:n,durationMs:a,stalledForMs:s,context:o})=>{let l=(e=>{if(!e||"object"!=typeof e)return;let{code:t}=e;if("number"==typeof t||"string"==typeof t&&t)return String(t)})(e),c=(e=>{if(!e||"object"!=typeof e)return;let{name:t}=e;return"string"==typeof t&&t?t:void 0})(e),d={meetingId:t.toString()},p={meetingId:t.toString()};l&&(p.otErrorCode=l),c&&(p.otErrorName=c),o&&(p.videoCallContext=o),void 0!==i&&(p.iceTransport=(e=>{if(!e)return"unknown";let t=`${e.localCandidateType}/${e.protocol??"unknown"}`;return e.relayProtocol?`${t}(${e.relayProtocol})`:t})(i)),"undefined"!=typeof navigator&&(d.userAgent=navigator.userAgent),"number"==typeof n&&(d.attempt=n),"number"==typeof a&&(d.durationMs=a),"number"==typeof s&&(d.stalledForMs=s),i&&(d.iceTransport=i),r&&"OpenTok"in r&&(d.callId=r?.session?.sessionId,d.streamIds=r?.streams?.map(e=>e.streamId).join(", "),d.cameraPublisherId=r?.mainPublisherStream?.streamId,d.screenPublisherId=r?.screenPublisherStream?.streamId,r?.session?.sessionId&&(p.callId=r.session.sessionId)),(0,U.C)(e,d,p)};var ed=r(50360);class ep{connectionData=null;subscribedToVideo=!0;loading=!1;_subscriptionTimeouts=[];mediaHealthMonitor=null;mediaHealth="healthy";constructor(e,t){this.stream=e,this.service=t.service,this.publisher=t.publisher,this.emitter=new er.A,this.publisher&&this.publisher.on("audioLevelUpdated",e=>{this.emitter.emit("audioLevelChanged",{audioLevel:e.audioLevel})})}get streamType(){return this.stream.videoType}get streamId(){return this.stream.streamId}get hasAudio(){return this.stream.hasAudio}get hasVideo(){return this.stream.hasVideo}get isConnected(){return void 0!==this.subscriber}get isExpectingMedia(){return!!this.stream?.hasAudio||!!this.stream?.hasVideo&&this.subscribedToVideo}get name(){return this.stream.name}get creationTime(){return this.stream.creationTime}get videoDimensions(){let e=this.stream.videoDimensions;if(this.publisher){let t=this.publisher.getVideoSource().track;if(t){let r=t.getSettings();if((e.width!==r.width||e.height!==r.height&&r.height&&r.width)&&(console.warn(`${this.streamId} stream dimensions mismatch, updating to ${r.width}x${r.height} from ${e.width}x${e.height}`),this.publisher.stream?.setVideoDimensions(r.width,r.height)),r.width&&r.height)return{width:r.width,height:r.height}}}return e}setResolution=e=>{this.subscriber?.setPreferredResolution(e)};get shouldReconnectVideo(){return!!this.stream.hasVideo&&!this.service.unsubscribedStreams.includes(this.streamId)}get userId(){return(this.connectionData??this.parseConnectionData()).userId}parseConnectionData=()=>{try{let e=(this?.stream?.connection?.data??"").split(",").map(e=>{let t=e.split("=");return[t[0],parseInt(t[1],10)]}),t={userId:e.find(([e])=>"UserId"===e)?.[1]};this.connectionData=t}catch(e){this.connectionData={}}return this.connectionData};handledAudioEvents=e=>{switch(e){case"blocked":this.service.emitter.emit("audioBlocked",this);break;case"unblocked":this.service.emitter.emit("audioUnblocked",this)}};subscribe=async({elementId:e,...t},r=0,i=2e3)=>
1{0===r&&((this._subscriptionTimeouts??[]).forEach(e=>{window.clearTimeout(e)}),this._subscriptionTimeouts=[]);let n=this.publisher?.element;if(this.publisher)n?e.appendChild(n):console.warn(`Publisher for stream ${this.streamId} has no element to attach`);else if(this.baseElement)e.appendChild(this.baseElement);else{if(this.cleanup?.(),this.subscriber)try{this.service.session?.unsubscribe(this.subscriber)}catch(e){console.error(`Error unsubscribing from stream: ${(0,ed.u)(e,"Unknown error")}`,{cause:e})}this.loading=!0,this.service.updateUI(),this.baseElement=document.createElement("div"),this.baseElement.classList.add("w-full","h-full"),e.appendChild(this.baseElement);let{session:n}=this.service;if(!n)throw Error(`Cannot subscribe to stream ${this.streamId}: the call has no session`);let a=Date.now(),s=()=>{},o=()=>{},l=new Promise((e,t)=>{s=e,o=t}),c=n.subscribe(this.stream,this.baseElement,{...this.service.DEFAULT_OPTIONS,...t},e=>{e?o(e):s(!0)});this.subscriber=c,c.on("audioBlocked",()=>{this.handledAudioEvents("blocked"),this.emitter.emit("audioBlocked")}),c.on("audioUnblocked",()=>{this.handledAudioEvents("unblocked"),this.emitter.emit("audioUnblocked")}),c.on("audioLevelUpdated",e=>{this.emitter.emit("audioLevelChanged",{audioLevel:e.audioLevel})});try{await l}catch(n){if(this.service.meetingId&&ec(n,{meetingId:this.service.meetingId,service:this.service,context:"subscribe",attempt:r,durationMs:Date.now()-a,iceTransport:await eo(this.subscriber??{})}),this.service.streams.some(e=>e.streamId===this.streamId)&&r<this.service.MAX_PUBLISH_RETRIES)return console.warn(`Error subscribing to stream, retrying ${r+1}/${this.service.MAX_PUBLISH_RETRIES}`,n),(this._subscriptionTimeouts??[]).forEach(e=>{window.clearTimeout(e)}),this._subscriptionTimeouts=[],this.teardownSubscriber(),this.baseElement?.remove(),this.baseElement=void 0,this.loading=!1,this.service.updateUI(),new Promise((n,a)=>{this._subscriptionTimeouts.push(window.setTimeout(()=>{this.subscribe({elementId:e,...t},r+1,2*i).then(n).catch(a)},i))});throw this.teardownSubscriber(),this.baseElement?.remove(),this.baseElement=void 0,this.loading=!1,this.service.updateUI(),n}this.cleanup=()=>{this.subscriber?.off?.("audioBlocked"),this.subscriber?.off?.("audioUnblocked"),this.subscriber?.off?.("audioLevelUpdated")},this.startMediaHealthMonitor()}this.loading=!1,this.service.updateUI()};startMediaHealthMonitor=()=>{this.mediaHealthMonitor?.stop(),this.subscriber&&(this.mediaHealthMonitor=new el({subscriber:this.subscriber,isExpectingMedia:()=>this.isExpectingMedia,onChange:e=>{this.mediaHealth=e.state,this.service.reportStreamMediaHealth(this,e)}}),this.mediaHealthMonitor.start())};getIceTransport=async()=>this.subscriber?eo(this.subscriber):null;teardownSubscriber=()=>{if(this.mediaHealthMonitor?.stop(),this.mediaHealthMonitor=null,this.mediaHealth="healthy",this.subscriber){try{this.subscriber.off("audioBlocked"),this.subscriber.off("audioUnblocked"),this.subscriber.off("audioLevelUpdated"),this.service.session?.unsubscribe(this.subscriber)}catch(e){console.error(`Error unsubscribing from stream: ${(0,ed.u)(e,"Unknown error")}`,{cause:e})}this.subscriber=void 0}this.service.reportStreamMediaHealth(this,{state:"healthy",reason:"recovered"})};unsubscribe=async()=>{if((this._subscriptionTimeouts??[]).forEach(e=>{window.clearTimeout(e)}),this._subscriptionTimeouts=[],!this.subscriber)return void console.warn(`Subscriber for stream ${this.streamId} does not exist`);this.teardownSubscriber(),this.baseElement?.remove(),this.baseElement=void 0};attachElement=e=>{this.element=e};subscribeToVideo=(e,t=!1)=>{if(!this.subscriber)return void console.warn(`Subscriber for stream ${this.streamId} does not exist`);try{if(this.subscriber.subscribeToVideo(e),this.subscribedToVideo=e,this.mediaHealthMonitor?.resetForMediaExpectationChange(),this.mediaHealth="healthy",this.service.reportStreamMediaHealth(this,{state:"healthy",reason:"recovered"}),!t){let t=this.service.unsubscribedStreams.indexOf(this.streamId);-1!==t&&this.service.unsubscribedStreams.splice(t,1),e||this.service.unsubscribedStream
1s.push(this.streamId)}this.service.updateUI()}catch(e){console.error(`Error subscribing to video: ${(0,ed.u)(e,"Unknown error")}`,{cause:e})}};static isMediaStream=e=>e instanceof MediaStream;getAudioTrack=()=>{let e=this.element?.querySelector("video")?.srcObject??null;return ep.isMediaStream(e)?e.getAudioTracks()?.[0]??null:null};on=(e,t)=>{this.emitter.on(e,t)};off=e=>{this.emitter.off(e)}}function eu(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}let eh=()=>{};class em{get connectionId(){return this.session?.connection?.connectionId}isInitialized=!1;readyResolve=eh;readyReject=eh;streams=[];isConnecting=!1;_screensharePublisherTimeouts=[];_publishVideoInFlight=null;_publishVideoDesired=null;_publishVideoTarget=null;isAttemptingScreenShare=!1;unsubscribedStreams=[];mediaHealth="healthy";streamMediaHealth=new Map;lastLoggedMediaHealth="healthy";_snapshot={};onStoreChange=eh;MAX_PUBLISH_RETRIES=3;DEFAULT_OPTIONS={insertMode:"append",height:"100%",width:"100%",fitMode:"cover",maxResolution:{width:1920,height:1080},resolution:"1280x720",style:{nameDisplayMode:"off",buttonDisplayMode:"off",archiveStatusDisplayMode:"off",videoDisabledDisplayMode:"off",audioLevelDisplayMode:"off"}};NoPublisherError=Error("Publisher not initialized");get isConnected(){return!!this.session?.connection?.connectionId}get cameraEnabled(){return!!this.mainPublisher?.getVideoSource()?.track?.enabled}get requestedCameraEnabled(){return this._publishVideoTarget??this.cameraEnabled}get audioEnabled(){return!!this.mainPublisher?.getAudioSource()?.enabled}get screenShareEnabled(){return!!this.screenPublisher?.getVideoSource()?.track?.enabled}get mainPublisherStream(){return this.mainPublisher&&this.mainPublisher.stream&&!this._mainPublisherStream&&(this._mainPublisherStream=new ep(this.mainPublisher.stream,{service:this,publisher:this.mainPublisher})),this._mainPublisherStream??null}get mainPublisherVideoDimensions(){if(!this.mainPublisher)return{width:0,height:0};let e=this.mainPublisher.element?.querySelector("video");return{width:e?.videoWidth??0,height:e?.videoHeight??0}}get screenPublisherStream(){return this.screenPublisher&&this.screenPublisher.stream&&!this._screenPublisherStream&&(this._screenPublisherStream=new ep(this.screenPublisher.stream,{service:this,publisher:this.screenPublisher})),this._screenPublisherStream??null}get screenPublisherDimensions(){if(!this.screenPublisher)return{width:0,height:0};let e=this.screenPublisher.element?.querySelector("video");return{width:e?.videoWidth??0,height:e?.videoHeight??0}}loadOpenTok(){return r.e(7614).then(r.t.bind(r,78176,23)).then(e=>(this.OpenTok=e.default,e.default))}constructor(){this.emitter=new er.A,this.ready=new Promise(e=>{this.readyResolve=e})}createPublisher=async(e,{audioInputDeviceId:t,videoInputDeviceId:r,audioOutputDeviceId:i,videoEnabled:n=!0,audioEnabled:a=!0,type:s="camera",autoAttach:o=!0,echoCancellation:l=!0,noiseSuppression:c=!0,autoGainControl:d=!0})=>{let p=this.OpenTok??await this.loadOpenTok(),u="screen"!==s&&a,h=p.initPublisher(e,{...this.DEFAULT_OPTIONS,publishAudio:u,videoSource:"screen"===s?"screen":r,facingMode:"camera"===s?"user":void 0,publishVideo:n,audioSource:"screen"===s?null:t??void 0,scalableVideo:"camera"===s,resolution:"camera"===s?"1280x720":"1920x1080",echoCancellation:l,noiseSuppression:c,autoGainControl:d},e=>{e&&"code"in e&&1500===e.code&&"OT_USER_MEDIA_ACCESS_DENIED"===e.name||e&&(this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),this.emitter.emit("publisherCreateError",{error:e,type:s}))});switch(h.on("streamDestroyed",e=>{if("reset"===e.reason&&"screen"===s)return;let t=this.streams.find(t=>t?.streamId===e.stream?.streamId);this.emitter.emit("streamDestroyed",{type:s,userId:t?.userId})}),h.on("mediaStopped",e=>{let t=function(e){if(eu(e)&&eu(e.track)&&"function"==typeof e.track.getCapabilities)try{let t=e.track.getCapabilities.call(e.track);return eu(t)&&"string"==typeof t.deviceId?t.deviceId:void 0}catch(e){return}}(e);"camera"===s&&t&&this.maybeFallbackCamera(t).catch(e=>{this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),console.error("Error selecting fallback camera",e)}),this.emitter.emit("mediaStopped",{type:s})}),h.on("accessDenied",()=>{this.emitter.emit("accessDenied",{type:s})}),s){case"camera":if(this.mainPublisher)try{this.mainPublisher.destroy()}catch(e){console.error("Error destroying main publisher",e)}this.mainPublisher=h,i&&await this.setAudioOutputDevice(i);break;case"screen":if(this.screenPublisher)try{this.screenPublisher.destroy()}catch(e){console.error("Error destroying screen publisher",e)}this.screenPublisher=h}if(u)try{await h.applyAudioFilter({type:"advancedNoiseSuppression"})}catch(e){this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),console.error("Error applying audio filter",e)}if(o)try{await this.attachPublisher(h)}catch(e){throw this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),e}"screen"===s&&this.emitter.emit("screenShareStarted")};initialize=async({apiKey:e,sessionId:t,options:r={},meetingId:i})=>{let n=this.OpenTok??await this.loadOpenTok();if(this.isInitialized)return;this.meetingId=i;let a=n.initSession(e,t);this.session=a,this.isInitialized=!0,a.on("sessionConnected",()=>{this.readyResolve(),this.updateUI()}),a.on("sessionDisconnected",()=>{this.updateUI()}),a.on("sessionReconnected",()=>{this.updateUI()}),a.on("streamPropertyChanged",e=>{this.evaluateMediaHealth(),this.updateUI()}),this.emitter.on("publisherCreateError",e=>{r.onPublisherCreateError?.({type:e.type},e.error),this.meetingId&&ec(e.error,{meetingId:this.meetingId,service:this})}),a.on("signal",e=>{let t=function(e){let t=function(e){if("string"!=typeof e)return e;try{return JSON.parse(e)}catch(e){return null}}(e);return eu(t)&&!0===t.NeedsUpdate?{NeedsUpdate:!0}:null}(e.data);t&&(r.onSignal?.(t),this.updateUI())}),a.on("streamCreated",e=>{if(this.streams.find(t=>t.streamId===e.stream.streamId))return;let t=new ep(e.stream,{service:this});this.streams=[...this.streams,t],r.onStreamJoined?.(t),this.updateUI()}),a.on("streamDestroyed",e=>{let t=Array.from(this.streams).findIndex(t=>t.streamId===e.stream.streamId);if(t>-1){let e=this.streams[t];e.unsubscribe(),this.emitter.emit("streamDestroyed",{type:e?.streamType,userId:e?.userId}),this.streams=[...this.streams.slice(0,t),...this.streams.slice(t+1)]}this.evaluateMediaHealth(),this.updateUI()}),this.emitter.on("mediaHealthChanged",e=>{r?.onMediaHealthChanged?.(e)}),this.emitter.on("audioBlocked",e=>{r?.onAudioBlocked?.(e)}),this.emitter.on("audioUnblocked",e=>{r?.onAudioUnblocked?.(e)}),this.emitter.on("streamDestroyed",e=>{r?.onStreamDestroyed?.({type:e.type,userId:e.userId})}),this.emitter.on("mediaStopped",e=>{r?.onMediaStopped?.(e)}),this.emitter.on("accessDenied",e=>{r?.onAccessDenied?.(e)})};static teardownPublisher(e){e&&[()=>e.publishVideo?.(!1),()=>e.publishAudio?.(!1),()=>
1e.destroy?.()].forEach(e=>{try{e()}catch(e){}})}performDisconnect=async()=>{em.teardownPublisher(this.mainPublisher),em.teardownPublisher(this.screenPublisher);let{session:e}=this;return e?new Promise(t=>{let r,i,n=!1,a=a=>{if(!n){n=!0;try{e.off("sessionDisconnected",i)}catch(e){console.warn("Failed to remove the OpenTok disconnect listener",e)}clearTimeout(r),t(a)}};i=()=>a({confirmed:!0,timedOut:!1}),e.once("sessionDisconnected",i),r=setTimeout(()=>a({confirmed:!1,timedOut:!0}),1e3);try{e.disconnect(),this.isConnected||i()}catch(e){a({confirmed:!1,timedOut:!1,errorName:e instanceof Error?e.name:"UnknownError"})}}):{confirmed:!0,timedOut:!1}};disconnect=async()=>{this.disconnectPromise||(this.disconnectPromise=this.performDisconnect());let e=this.disconnectPromise;try{return await e}finally{this.disconnectPromise===e&&(this.disconnectPromise=void 0)}};requireSession(){if(!this.session)throw Error("OpenTokService has no session; initialize() has not run");return this.session}async attachPublisher(e,t=0){return new Promise((r,i)=>{this.requireSession().publish(e,n=>{if(n){let a=e===this.mainPublisher;if(this.meetingId&&ec(n,{meetingId:this.meetingId,service:this}),t<this.MAX_PUBLISH_RETRIES&&a){console.warn(`Error attaching publisher, retrying ${t+1}`,n);let s=e.element;if(e.destroy(),!s)return void i(n);this.createPublisher(s,{type:a?"camera":"screen",autoAttach:!1}).then(()=>{let e=a?this.mainPublisher:this.screenPublisher;if(!e)return void i(n);this.attachPublisher(e,t+1).then(()=>r())}).catch(e=>{this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),i(e)})}else a&&this.emitter.emit("publisherCreateError",{error:n,type:"camera"}),i(n)}else r()})})}connect=async e=>{this.connectionToken=e,await new Promise((t,r)=>{this.requireSession().connect(e,e=>{if(e)return void r(e);t()})})};startCamera=async()=>{this.mainPublisher&&await this.publishVideoSerialized(!0)};toggleCamera=async()=>{this.mainPublisher&&await this.publishVideoSerialized(!this.requestedCameraEnabled)};stopCamera=async()=>{this.mainPublisher&&await this.publishVideoSerialized(!1)};publishVideoSerialized=e=>{if(!this.mainPublisher)return Promise.resolve();if(this._publishVideoTarget=e,this._publishVideoDesired=e,this._publishVideoInFlight)return this._publishVideoInFlight;let t=async()=>{for(;null!==this._publishVideoDesired;){let e=this._publishVideoDesired;this._publishVideoDesired=null;let t=this.mainPublisher;if(!t)return;let r=ei((...e)=>t.publishVideo(...e));await r(e),this.updateUI()}};return this._publishVideoInFlight=t().finally(()=>{this._publishVideoInFlight=null,this._publishVideoTarget=null}),this._publishVideoInFlight};startAudio=()=>{this.mainPublisher&&(this.mainPublisher.publishAudio(!0),this.updateUI())};stopAudio=()=>{this.mainPublisher&&(this.mainPublisher.publishAudio(!1),this.updateUI())};startScreenShare=async(e,t=0,r=2e3)=>{if(this.isAttemptingScreenShare||(this.isAttemptingScreenShare=!0,this.updateUI()),t<=this.MAX_PUBLISH_RETRIES&&!this.screenPublisher)return(this._screensharePublisherTimeouts??[]).forEach(e=>{window.clearTimeout(e)}),new Promise((i,n)=>{this._screensharePublisherTimeouts.push(window.setTimeout(()=>{this.startScreenShare(e,t+1,2*r).then(i).catch(e=>{this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),this.isAttemptingScreenShare=!1,this.updateUI(),n(e)})},r))});let{screenPublisher:i}=this;if(!i){this.isAttemptingScreenShare=!1,this.updateUI();return}try{await ei((...e)=>i.publishVideo(...e))(!0)}catch(e){this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),this.isAttemptingScreenShare=!1,this.updateUI()}return new Promise((e,t)=>{(this._screensharePublisherTimeouts??[]).forEach(e=>{window.clearTimeout(e)});let r=()=>{if(this.streams.some(e=>"screen"===e.streamType)){this.isAttemptingScreenShare=!1,this.screenPublisher?.destroy(),this.updateUI(),t(Error("Screen share already started"));return}e(),this.updateUI(),setTimeout(()=>{this.isAttemptingScreenShare=!1,this.updateUI()},1e3)};this.emitter.once("screenShareStarted",r)})};stopScreenShare=async()=>
1{if((this._screensharePublisherTimeouts??[]).forEach(e=>{window.clearTimeout(e)}),this.screenPublisher){this.isAttemptingScreenShare=!1;try{this.screenPublisher.destroy()}catch(e){this.meetingId&&ec(e,{meetingId:this.meetingId,service:this}),console.error("Error destroying screen publisher",e)}this.updateUI(),this.screenPublisher=void 0,this._screenPublisherStream=void 0}};canShareScreen=async()=>{let e=this.OpenTok??await this.loadOpenTok();return new Promise(t=>{e.checkScreenSharingCapability(({supported:e})=>{t(e)})})};static aggregateMediaHealth=(e,t)=>{if(!e.length)return{state:"healthy"};let r=e.map(e=>({streamId:e,detail:t.get(e)}));if(r.every(({detail:e})=>e?.state==="noMedia"))return{state:"noMedia",detail:r[0].detail,streamId:r[0].streamId};let i=r.find(({detail:e})=>e?.state==="degraded"&&(void 0===e.degradationSource||"local"===e.degradationSource||"bothOrUnclear"===e.degradationSource));return i?{state:"degraded",detail:i.detail,streamId:i.streamId}:{state:"healthy"}};reportStreamMediaHealth=(e,t)=>{"healthy"===t.state?this.streamMediaHealth.delete(e.streamId):this.streamMediaHealth.set(e.streamId,t),this.evaluateMediaHealth()};evaluateMediaHealth=()=>{let e=this.streams.filter(e=>e.isConnected&&e.isExpectingMedia).map(e=>e.streamId);this.streamMediaHealth.forEach((t,r)=>{e.includes(r)||this.streamMediaHealth.delete(r)});let{state:t,detail:r,streamId:i}=em.aggregateMediaHealth(e,this.streamMediaHealth);t!==this.mediaHealth&&(this.mediaHealth=t,this.emitter.emit("mediaHealthChanged",{state:t,detail:r}),this.updateUI(),"healthy"!==t&&t!==this.lastLoggedMediaHealth?(this.lastLoggedMediaHealth=t,this.logMediaHealth(t,r,i)):"healthy"===t&&(this.lastLoggedMediaHealth="healthy"))};logMediaHealth=async(e,t,r)=>{if(!this.meetingId)return;let i=this.streams.find(e=>e.streamId===r);ec(Error(`Video call media health: ${e} (${t?.reason??"unknown"})`),{meetingId:this.meetingId,service:this,context:"mediaHealth",iceTransport:i?await i.getIceTransport():null,stalledForMs:t?.stalledForMs})};getSnapshot=()=>this._snapshot;subscribe=e=>(this.onStoreChange=e,()=>{this.onStoreChange=()=>{}});updateUI=()=>{this._snapshot={},this.onStoreChange()};refresh=async()=>{let{connectionToken:e}=this;if(!e)throw Error("Cannot refresh an OpenTok session before connecting");this.ready=new Promise((e,t)=>{this.readyResolve=e,this.readyReject=t});let t=Array.from(this.streams).filter(e=>e.isConnected);this.mainPublisher&&this.session&&this.session.unpublish(this.mainPublisher),t.forEach(e=>{e.loading=!0,e.unsubscribe()}),await this.disconnect(),await this.connect(e);let r=this.mainPublisherStream?.element;this.mainPublisherStream&&r&&(this.mainPublisherStream.loading=!0,await this.createPublisher(r,{type:"camera",autoAttach:!0})),t.forEach(e=>{let t=e.element;t&&e.subscribe({elementId:t})})};refreshDevices=async()=>this.getDevices();getOpenTokDevices=async()=>{let e=this.OpenTok??await this.loadOpenTok();return new Promise((t,r)=>{e.getDevices((e,i)=>{if(e)return void r(e);t(i??[])})})};maybeFallbackCamera=async e=>{let t=(await this.getOpenTokDevices()).find(t=>"videoInput"===t.kind&&t.deviceId!==e&&(t.label.includes("0000:0001")||t.label.includes("Built-in")));t&&await this.setVideoSourceDevice(t.deviceId)};getDevices=async()=>{let e=this.OpenTok??await this.loadOpenTok(),t=await this.getOpenTokDevices(),r=t.filter(e=>"audioInput"===e.kind),i=t.filter(e=>"videoInput"===e.kind),n=await e.getAudioOutputDevices(),a=(await e.getActiveAudioOutputDevice()).deviceId,s=(await this.mainPublisher?.getVideoSource())?.track?.getCapabilities()?.deviceId??"default",o=(await this.mainPublisher?.getAudioSource())?.getCapabilities()?.deviceId??"default",l={audioInput:em.resolveDeviceList(r.map(e=>({...e,active:e.deviceId===o}))),videoInput:em.resolveDeviceList(i.map(e=>({...e,active:e.deviceId===s}))),audioOutput:em.resolveDeviceList(n.flatMap(e=>e.deviceId?[{deviceId:e.deviceId,label:e.label??"",active:e.deviceId===a}]:[]))};return this.devices=l,this.updateUI(),l};static resolveDeviceList=e=>{let t=e.find(e=>e.active),r=t?.label.match(/\(([^)]+)\)/)?.[1],i=t?.deviceId==="default",n=t?.label?.replace("Default - ","");return e.filter(e=>!e.label.startsWith("Default -")).map(e=>{let{active:t}=e;return!t&&r&&(t=e.label.match(/\(([^)]+)\)/)?.[1]===r),!t&&i&&n&&(t=e.label===n),{...e,active:t}})};setAudioSourceDevice=async e=>{let t=this.mainPublisher;if(t&&"function"==typeof t.setAudioSource){if("function"==typeof t.getAudioSource&&!t.getAudioSource())return;await t.setAudioSource(e),await this.getDevices(),this.updateUI()}};setVideoSourceDevice=async e=>{let t=this.mainPublisher;if(!t||"function"!=typeof t.setVideoSource)return;let r="function"==typeof t.getVideoSource?t.getVideoSource():null,i=r?.track??r,n=i?.getCapabilities,a="function"==typeof n?n.call(i):void 0;a?.deviceId&&(await t.setVideoSource(e),await this.getDevices(),this.updateUI())};setAudioOutputDevice=async e=>{let t=this.OpenTok??await this.loadOpenTok();await t.setAudioOutputDevice(e),await this.getDevices(),this.updateUI()};unblockAudio=async()=>(this.OpenTok??await this.loadOpenTok()).unblockAudio();cleanup=()=>{this.session?.off(),this.emitter.off("accessDenied"),this.emitter.off("audioBlocked"),this.emitter.off("audioUnblocked"),this.emitter.off("mediaStopped"),this.emitter.off("streamDestroyed"),this.emitter.off("mediaHealthChanged"),this.streams.forEac
1h(e=>e.unsubscribe()),this.mainPublisher?.destroy(),this.screenPublisher?.destroy()}}var ex=r(15039),ef=r.n(ex),ew=r(12752);let eg=(0,i.createContext)(null),eb=new Map,ev=({id:e,styles:t,children:r,className:n})=>{let{status:a,isInPip:s}=(0,ew.e1)(),{x:o,y:l,meta:d,ratio:p,rowSpan:u,colSpan:h,overflow:m,type:x,width:f,height:w,top:g,left:b,transform:v,...S}=t,y=`${e}-${s?"pip":"normal"}`,j=`${e}-normal`,k=eb.get(y)??eb.get(j),E=(0,i.useMemo)(()=>({...S,position:"absolute"}),[S]),N=(0,i.useMemo)(()=>{let t=Number.isNaN(f)?void 0:f,r=Number.isNaN(w)?void 0:w,i=Number.isNaN(g)?void 0:g,n=Number.isNaN(b)?void 0:b;e&&eb.set(y,{width:t,height:r,x:o,y:l,top:i,left:n});let a={top:i,left:n,width:t,height:r,x:o,y:l};return{resize:{...a,transition:{duration:.2,ease:"easeOut"}},idle:{...a,transition:{duration:.5,ease:"easeInOut"}},scroll:{...a,transition:{duration:.25,ease:"easeOut"}},instant:{...a,transition:{duration:1e-4,ease:"easeOut"}}}},[f,w,g,b,e,o,l,y]),I={height:window.innerHeight/2},C=(0,i.useMemo)(()=>({videoCardSize:{width:Number(f),height:Number(w)}}),[f,w]);return(0,T.jsx)(eg.Provider,{value:C,children:(0,T.jsx)(c.P.div,{"data-stream":e,initial:{width:k?.width??I.height,height:k?.height??I.height,top:k?.top??0,left:k?.left??0,x:k?.x??o,y:k?.y??l,z:1},style:E,animate:a,variants:N,className:ef()("w-full h-full group @container/vcc absolute z-20",n),children:r})})},eS=({stream:e,className:t,subscriptionOptions:r={}})=>{let n=(0,i.useContext)(eg)?.videoCardSize,a=(0,i.useRef)(n),s=(0,i.useRef)(null),o=(0,i.useRef)(null),l=(0,i.useRef)(0),c=(0,i.useRef)(r);(0,i.useEffect)(()=>{a.current=n},[n]),(0,i.useEffect)(()=>{c.current=r},[r]);let d=(0,i.useCallback)(()=>{null!==s.current&&(window.clearTimeout(s.current),s.current=null)},[]),p=(0,i.useCallback)(t=>{l.current+=1;let r=l.current;if(d(),o.current=t,!t||t===e.element)return;let i=()=>l.current===r&&o.current===t,n=()=>{let{resolution:r}=c.current;return e.subscribe({elementId:t,...r?{resolution:r}:{}})},p=()=>{if(!i())return;e.attachElement(t);let r=a.current;r&&e.setResolution(r)};n().then(p).catch(()=>{i()&&(s.current=window.setTimeout(()=>{s.current=null,i()&&n().then(p).catch(()=>{i()})},1e3))})},[d,e]);return(0,i.useEffect)(()=>()=>{l.current+=1,o.current=null,d()},[d]),(0,i.useEffect)(()=>{e.element&&n&&e.setResolution(n)},[n,e,e.element]),(0,T.jsx)("div",{id:e.streamId,ref:p,className:t},e?.streamId)},ey=({call:e,className:t,audioEnabled:r,audioInputDeviceId:n,audioOutputDeviceId:a,videoEnabled:s,videoInputDeviceId:o,echoCancellation:l,noiseSuppression:c,autoGainControl:d,onError:p=e=>{console.error(Error(`VideoCallPublisher error: ${e.message}`,{cause:e}))}})=>{let u=(0,i.useRef)(null),[h,m]=function(e,t,r="local"){let n=(0,i.useCallback)(()=>"local"===r?window.localStorage:window.sessionStorage,[r]),[a,s]=(0,i.useState)(()=>{let i=n();if(!i)return t;try{let r=i.getItem(e);return r?JSON.parse(r):t}catch(i){return console.warn(`Error reading ${r} key "${e}":`,i),t}}),o=(0,i.useCallback)(t=>{try{let r=t instanceof Function?t(a):t;s(r);let i=n();i&&i.setItem(e,JSON.stringify(r))}catch(t){console.warn(`Error setting ${r} key "${e}":`,t)}},[e,a,n,r]);return[a,o]}(I,{},"session"),x=(0,i.useCallback)(t=>{if(t&&(t!==u.current&&e.mainPublisherStream&&e.mainPublisherStream.subscribe({elementId:t}),t&&(u.current=t),!e.mainPublisherStream)){let i=o??h?.videoInputDeviceId,u=i,x=n??h?.audioInputDeviceId,f=x,w=a??h?.audioOutputDeviceId,g=w;e.ready.then(()=>(e.devices&&(u=e.devices.videoInput.find(e=>e.deviceId===i)?.deviceId,f=e.devices.audioInput.find(e=>e.deviceId===x)?.deviceId,g=e.devices.audioOutput.find(e=>e.deviceId===w)?.deviceId),e.createPublisher(t,{type:"camera",autoAttach:!0,audioEnabled:r,audioInputDeviceId:f||void 0,videoEnabled:s,videoInputDeviceId:u||void 0,audioOutputDeviceId:g||void 0,echoCancellation:l,noiseSuppression:c,autoGainControl:d}))).then(()=>{m({audioInputDeviceId:f,audioOutputDeviceId:g,videoInputDeviceId:u})}).catch(e=>{m({audioInputDeviceId:void 0,audioOutputDeviceId:void 0,videoInputDeviceId:void 0}),p?.(e)})}},[e.mainPublisherStream]);(0,i.useEffect)(()=>{u.current&&e.mainPublisherStream&&e.mainPublisherStream.element!==u.current&&e.mainPublisherStream.attachElement(u.current)},[e.mainPublisherStream]);let f=e.mainPublisherStream;return(0,T.jsx)("div",{ref:x,className:t,id:"publisher-camera"},f?.streamId)},ej=({call:e,className:t,audioEnabled:r,audioInputDeviceId:n,audioOutputDeviceId:a,videoEnabled:s,videoInputDeviceId:o,onError:l=e=>{console.error(Error(`VideoCallPublisher error: ${e.message}`,{cause:e}))}})=>{let c=(0,i.useRef)(null),d=(0,i.useCallback)(t=>{t&&(t!==c.current&&e.screenPublisherStream&&e.screenPublisherStream.subscribe({elementId:t}),t&&(c.current=t),!e.isAttemptingScreenShare||e.screenPublisherStream||e.screenPublisherDimensions?.width||e.screenPublisherDimensions?.height||e.screenPublisher||e.ready.then(()=>e.createPublisher(t,{type:"screen",autoAttach:!0,audioEnabled:r,audioInputDeviceId:n,videoEnabled:s,videoInputDeviceId:o,audioOutputDeviceId:a})).catch(l))},[e.mainPublisherStream]);(0,i.useEffect)(()=>{c.current&&e.screenPublisherStream&&e.screenPublisherStream.element!==c.current&&e.screenPublisherStream.attachElement(c.current)},[e.screenPublisherStream]);let p=e.screenPublisherStream;return(0,T.jsx)("div",{ref:d,className:t,id:"publisher-screen"},p?.streamId)};var ek=r(56553),eE=r(73414),eN=r(60656),eI=r(75784);function eC({left:e,top:t,isMobile:r,onComplete:n,range:a=5}){let s=(0,i.useMemo)(()=>Array.from({length:8},()=>Math.random()*a-a/2),[a]),o=(0,i.useMemo)(()=>{let e=20*Math.random()+80;return r?e:-1*e},[r]),l=(0,i.useMemo)(()=>1.5+.5*Math.random(),[]),d=(0,i.useMemo)(()=>.2*Math.random(),[]);return(0,T.jsx)(c.P.div,{style:{position:"absolute",top:t,left:e},initial:{opacity:1,y:0,x:0}
1,animate:{opacity:[0,.4,.8,1,1,.8,.4,0],y:[0,.15*o,.3*o,.5*o,.7*o,.85*o,.95*o,o],x:s},transition:{duration:l,delay:d,times:[0,.1,.2,.4,.6,.8,.9,1],ease:"linear"},onAnimationComplete:n,className:"z-50",children:(0,T.jsx)("div",{className:"bg-white rounded-full shadow-sm pointer-events-none select-none",children:(0,T.jsx)("img",{alt:"Add minute",src:r?"/plus-one-icon-white.svg":"/plus-one-icon.svg",className:"w-[17px] h-[17px] md:w-[22px] md:h-[22px]"})})})}function eD({meetingId:e,buttonCallback:t,isPip:r=!1}){let[n,a]=(0,i.useState)([]),{width:s}=(0,k.A)(),o=s<800,l=async()=>{let i=27,n=19;(r||o)&&(i=10,n=10);let s={id:`add-minute-icon-${Date.now()}`,left:i,top:n};try{await (0,$.u1)(e,1),a(e=>[...e,s]),await t?.()}catch(e){console.error("Unable to extend meeting",e)}};return(0,T.jsxs)("div",{className:"relative",children:[(0,T.jsx)(c.P.button,{className:r?"w-[36px] h-[36px] rounded-[12px] bg-[#3D3D3D] hover:bg-[#4D4D4D] relative overflow-hidden flex items-center justify-center":"w-[36px] h-[36px] md:w-[60px] md:h-[60px] rounded-[12px] md:rounded-[20px] bg-[#3D3D3D] md:bg-[#EAEAEA] md:hover:bg-[#dddddd] md:ml-[8px] relative overflow-hidden flex items-center justify-center",onClick:l,type:"button",children:(0,T.jsx)("img",{alt:"Add minute",src:r||o?"/plus-one-icon-white.svg":"/plus-one-icon.svg",className:r?"w-[17px] h-[17px] pointer-events-none select-none":"w-[17px] h-[17px] md:w-[22px] md:h-[22px] pointer-events-none select-none"})}),(0,T.jsx)(eI.N,{children:n.map(e=>(0,T.jsx)(eC,{left:e.left,top:e.top,isMobile:o||r,onComplete:()=>{var t;return t=e.id,void a(e=>e.filter(e=>e.id!==t))}},e.id))})]})}var eA=r(96981);function eT({meetingId:e,extendAmount:t,buttonCallback:r}){let[n,a]=(0,i.useState)(!1),s=async()=>{try{a(!0),await (0,$.u1)(e,t);try{(0,eA.A)({event:"expert-extend-call-for-free",timestamp:b()().format("YYYY-MM-DDTHH:mm:ss.SSSZ"),meetingId:e,amountExtended:`${t} minutes`})}catch(e){}await r?.()}catch(e){console.log("error",e)}finally{a(!1)}};return(0,T.jsx)("button",{type:"button",onClick:()=>s(),className:"w-full flex-1 h-[40px] px-[10px] border border-charcoal rounded-[5px] bg-transparent hover:bg-[rgba(255,255,255,0.2)] flex items-center justify-center cursor-pointer",children:n?(0,T.jsx)(w.A,{width:20,height:20,color:"#1E1D24"}):(0,T.jsxs)("p",{className:"whitespace-nowrap cursor-pointer",children:["+",t," min"]})},`add-${t}-btn`)}let eP=(e,t)=>e?"bg-[#F25757]":t?"bg-[#f8b54a]":"bg-dark-purple",eM=(e,t)=>e?"text-[#F25757]":t?"text-[#f8b54a]":"text-[#BCBCBC] md:text-[#767676]",eR=({minutes:e,seconds:t})=>(0,T.jsx)("div",{className:"max-w-[160px] md:max-w-none md:w-[200px] w-full h-[36px] md:h-[60px] rounded-[12px] md:rounded-[20px] bg-[#3D3D3D] md:bg-[#EAEAEA] px-[12px] md:px-[18px] flex items-center justify-center",children:(0,T.jsxs)("p",{className:"text-[#BCBCBC] md:text-[#767676] shrink-0 font-normal text-[14px]",children:["Call starts in ",(0,v.e8)(e),":",(0,v.e8)(t)]})}),eV=({hideProgressBar:e=!1,duration:t,startAt:r,onCallStart:n,onCallEnd:a,altTimerView:s,onTick:o,callStarted:l,isInPip:c})=>{let d=60*t,p=(0,i.useMemo)(()=>b()(r).add(d,"second").toDate(),[r,d]),u=b()().isBefore(r),h=(0,i.useMemo)(()=>c?(({startAt:e,totalMeetingSeconds:t})=>({hours:r,minutes:i,seconds:n})=>{let a=(b()().diff(b()(e),"second")/t*100).toFixed(3),s=0===r&&1===i,o=0===r&&0===i,l=a;return parseInt(a,10)>100?l="100":0>parseInt(a,10)&&(l="0"),(0,T.jsxs)("div",{className:"max-w-[160px] md:max-w-none md:w-[200px] w-full h-[36px] rounded-[12px] bg-[#3D3D3D] px-[14px] flex items-center justify-center gap-2",children:[(0,T.jsx)("div",{className:"h-[5px] rounded-[14px] md:rounded-[20px] overflow-hidden relative bg-[#BCBCBC] w-full",children:(0,T.jsx)("div",{className:`transition-all left-0 h-[5px] absolute top-0 ${eP(o,s)}`,style:{width:`${l}%`}})}),(0,T.jsxs)("p",{className:`${eM(o,s)} shrink-0 font-bold md:font-semibold text-[14px] text-right`,style:{width:r>0?"50px":"39px"},children:[r>0?`${r}:`:null,(0,v.e8)(i),":",(0,v.e8)(n)]})]})})({startAt:r,totalMeetingSeconds:d,hideProgressBar:e}):s?(({startAt:e})=>({hours:t,minutes:r,seconds:i})=>{let n=b()().subtract(1,"second").diff(b()(e),"minute");return(0,T.jsx)("div",{className:"max-w-none w-auto h-[36px] md:h-[60px] rounded-[12px] md:rounded-[20px] md:bg-[#EAEAEA] bg-[#3D3D3D] px-[12px] md:px-[18px] flex items-center justify-center",children:(0,T.jsxs)("div",{className:"flex items-center justify-center",children:[(0,T.jsxs)("p",{className:"font-bold md:font-semibold text-[16px] text-[#BCBCBC] md:text-[#767676]",children:[n," min"]}),(0,T.jsx)("div",{className:"w-[1px] h-[20px] bg-[#979797] rounded-[4px] mx-[10px]"}),(0,T.jsxs)("p",{className:`${eM(0===t&&0===r,0===t&&1===r)} shrink-0 font-bold md:font-semibold text-[16px]`,style:{width:t>0?"50px":"39px"},children:[t>0?`${t}:`:null,(0,v.e8)(r),":",(0,v.e8)(i)]})]})})})({startAt:r,totalMeetingSeconds:d,hideProgressBar:e}):(({startAt:e,totalMeetingSeconds:t,hideProgressBar:r})=>({hours:i,minutes:n,seconds:a})=>{let s=(b()().diff(b()(e),"second")/t*100).toFixed(3),o=0===i&&1===n,l=0===i&&0===n,c=s;return parseInt(s,10)>100?c="100":0>parseInt(s,10)&&(c="0"),(0,T.jsxs)("div",{className:`max-w-[160px] md:max-w-none md:w-[200px] w-full h-[36px] md:h-[60px] rounded-[12px] md:rounded-[20px] ${l?"bg-[#3D3D3D] md:bg-[#ffe1e1]":o?"bg-[#3D3D3D] md:bg-[#ffebc6]":"bg-[#3D3D3D] md:bg-[#EAEAEA]"} px-[17px] md:px-[22px] flex items-center justify-center`,children:[!r&&(0,T.jsx)("div",{className:"h-[5px] rounded-[14px] md:rounded-[20px] overflow-hidden relative bg-[#BCBCBC] w-full mr-[14px]",children:(0,T.jsx)("div",{className:`transition-all left-0 h-[5px] absolute top-0 ${eP(l,o)}`,style:{width:`${c}%`}})}),(0,T.jsxs)("p",{className:`${eM(l,o)} shrink-0 font-bold md:font-semibold text-[16px] relative top-[-1px]`,style:{width:i>0?"50px":"39px"},children:[i>0?`${i}:`:null,(0,v.e8)(n),":",(0,v.e8)(a)]})]})})({startAt:r,totalMeetingSeconds:d,hideProgressBar:e}),[s,c,r,d,e]);return u&&!l?c?null:(0,T.jsx)(v.Ay,{date:r,renderer:eR,onComplete:n,autoStart:!0},`pre-${r}`):(0,T.jsx)(v.Ay,{date:p,renderer:h,onTick:o,onComplete:a,autoStart:!0},`main-${r}-${t}`)},e$=e=>new Set([e?.Expert?.Id,e?.User?.Id,...(e?.Participants??[]).map(e=>e?.Id)].filter(e=>"number"==typeof e));var eF=r(21338);let eL=(0,i.forwardRef)(({children:e,overlay:t=null,style:r={},isSpeaking:i=!1,isActiveSpeaker:n=!1},a)=>{let{isInPip:s}=(0,ew.e1)();return(0,T.jsxs)("div",{className:"w-full h-full flex-1 flex relative",style:r,children:[(0,T.jsx)("div",{className:ef()("md:shadow-vi
1deo-light-card-border z-10 rounded-[8px] md:rounded-[15px] md:@[450px]/vcc:rounded-[18px] pointer-events-none absolute top-[1px] left-[1px] right-[1px] bottom-[1px]",{"!shadow-video-dark-card-border":s})}),(0,T.jsx)("div",{className:ef()("md:shadow-video-light-card-border z-10 rounded-[8px] md:rounded-[15px] md:@[450px]/vcc:rounded-[18px] pointer-events-none absolute top-[1px] left-[1px] right-[1px] bottom-[1px]",{"!shadow-video-dark-card-border":s&&!n,"!shadow-video-speaking-border":i,"!shadow-video-active-speaker-border":n})}),(0,T.jsxs)(c.P.div,{ref:a,transition:{duration:.2,delay:.1},className:"overflow-hidden rounded-[10px] md:rounded-[17px] md:@[450px]/vcc:rounded-[20px] w-full h-full relative flex-1 flex bg-charcoal-light @container/vc",children:[(0,T.jsx)("div",{className:"w-full h-full top-0 left-0 right-0 bottom-0 absolute md:p-[1px]",children:(0,T.jsx)("div",{className:"w-full h-full flex-1 flex relative",children:t})}),(0,T.jsx)("div",{className:"w-full h-full flex-1 flex absolute",children:e})]})]})}),e_=(e,t)=>Number.isFinite(e)&&Number.isFinite(t)&&!(t<=0)?Math.min(t,Math.max(-t,e)):0,eO=(e,t,r)=>!Number.isFinite(r)||r<=1?{x:0,y:0}:{x:Math.max(0,(e*r-e)/2),y:Math.max(0,(t*r-t)/2)},ez=({stream:e,hasScreenShare:t,maxHeight:r,style:n,showZoomControls:a=!0,className:s})=>{r||="100%";let{width:o,height:l}=(0,ew.e1)(),{width:d,height:p}=e?.videoDimensions??{},u=d??NaN,h=p??NaN,m=u/h,x=n?.width&&n?.height,f=n?.height?parseInt(`${n.height}`,10):l??NaN,w=n?.width?parseInt(`${n.width}`,10):o??NaN,g=Number.isFinite(f)&&f>0?f:l??NaN,b=Number.isFinite(w)&&w>0?w:o??NaN,v=b/m,S=g*m>=b?"100%":"max-content",y=v>=g?"100%":"max-content",j=Math.max(u/b,h/g),k=Math.min(1,j),[E,N]=(0,i.useState)(1),[I,C]=(0,i.useState)(null),D=(0,eF.d)(0),A=(0,eF.d)(0),[P,M]=(0,i.useState)(0),[R,V]=(0,i.useState)(0),$=(0,i.useMemo)(()=>eO(b,g,E),[E,b,g]),{overflow:F,...L}=n??{},_=Object.fromEntries(Object.entries(L).map(([e,t])=>[e,"number"==typeof t?Math.round(t):t])),O=(0,i.useCallback)(e=>{let t=parseFloat(e.toFixed(2));N(e=>{if(t===k||t<=1)return M(0),V(0),t;let{x:r,y:i}=(({currentX:e,currentY:t,previousScale:r,nextScale:i,styleWidth:n,styleHeight:a})=>{if(!Number.isFinite(i)||i<=1)return{x:0,y:0};if(!Number.isFinite(r)||r<=0){let r=eO(n,a,i);return{x:e_(e,r.x),y:e_(t,r.y)}}let s=i/r;if(!Number.isFinite(s))return{x:0,y:0};let o=eO(n,a,i);return{x:e_(e*s,o.x),y:e_(t*s,o.y)}})({currentX:D.get(),currentY:A.get(),previousScale:e,nextScale:t,styleWidth:b,styleHeight:g});return M(r),V(i),t})},[k,g,b,D,A,N]);return(0,T.jsx)(ev,{id:e?.streamId,styles:x?_:{width:"100%",height:t?`${l}px`:"auto",margin:"auto",top:"0",left:"0"},className:ef()("md:p-[5px]",s),children:(0,T.jsx)("div",{onDoubleClick:e=>{j<=1||(1===E?O(j):O(1))},onTouchEnd:e=>{let t=Date.now();I&&t-I<300?(j>1&&O(1===E?j:1),C(null)):C(t)},className:"flex items-center justify-center w-full h-full",children:(0,T.jsx)("div",{className:"transition-transform inline-block items-center justify-center w-full duration-300 ease-in-out relative group",style:{width:S,height:y},children:(0,T.jsx)(eL,{style:{aspectRatio:`${d??1} / ${p??1}`},overlay:a&&(0,T.jsxs)("div",{className:"absolute bottom-4 left-4 z-10 bg-[#bbbbbb]/30 backdrop-blur-sm px-2 py-1 rounded-full items-center gap-2 transition-opacity opacity-0 group-hover:opacity-100 hidden fine-pointer:flex",onClick:e=>e.stopPropagation(),onDoubleClick:e=>e.stopPropagation(),children:[(0,T.jsx)("button",{type:"button",className:ef()("text-white w-6 h-6 flex items-center justify-center cursor-pointer select-none",{"opacity-50":j<1?E===k:1===E}),onClick:()=>{j<1?O(Math.max(k,E-.1)):O(Math.max(1,E-.5))},children:"-"}),(0,T.jsx)("button",{type:"button",className:ef()("text-white w-6 h-6 flex items-center justify-center cursor-pointer select-none",{"opacity-50":j<1?1===E:E===j}),onClick:()=>{j<1?O(Math.min(1,E+.1)):O(Math.min(j,E+.5))},children:"+"})]}),children:(0,T.jsx)(c.P.div,{className:`overflow-hidden w-full h-full touch-none shadow-calls-cards ${E>1?"cursor-grab rounded-[8px]":"rounded-[8px] md:rounded-[15px] md:@[450px]/vcc:rounded-[18px]"}`,animate:{scale:E,x:P,y:R},style:{x:D,y:A,transformOrigin:"center center",aspectRatio:`${d??1} / ${p??1}`,width:S,height:y},transition:{duration:.3},whileInView:{cursor:1===E?"default":"grab"},whileTap:{cursor:1===E?"default":"grabbing"},onPan:(e,t)=>{if(E<=1)return;let r=D.get()+t.delta.x,i=A.get()+t.delta.y;r>-$.x&&r<$.x&&(D.jump(r),M(r)),i>-$.y&&i<$.y&&(A.jump(i),V(i))},onMouseDown:e=>{e.stopPropagation(),e.preventDefault()},children:e?.child??null})})})})})};var eB=r(98477);let eU=({pipWindow:e,children:t,padding:r=10,el:n,setWidth:a,setHeight:s,topBar:o,bottomBar:l})=>{let{setStatus:c}=(0,ew.Xp)();return(0,i.useEffect)(()=>
1{if(!e)return()=>{};let t=()=>{a(e.innerWidth-2*r),s(e.innerHeight-2*r-50-70),c("resize"),e.document.title=""};return e.addEventListener("resize",t),e.document.title="",()=>{e.removeEventListener("resize",t)}},[e,r,c,a,s]),(0,i.useEffect)(()=>{if(!e)return()=>{};let t=new MutationObserver(t=>{t.forEach(t=>{"attributes"===t.type&&"title"===t.attributeName&&(e.document.title="")})});return t.observe(e.document.head,{childList:!0,subtree:!0}),()=>{t.disconnect()}},[e]),(0,eB.createPortal)((0,T.jsxs)("div",{className:"flex flex-col h-full",children:[o&&(0,T.jsx)("div",{style:{height:"50px"},className:"flex-none",children:o}),(0,T.jsx)("div",{className:"flex-1 overflow-hidden",children:t}),l&&(0,T.jsx)("div",{style:{height:"70px"},className:"flex-none",children:l})]}),n)},eH=({pipWindow:e,children:t,className:r="",padding:n=10,topBar:a,bottomBar:s})=>{let o=(0,i.useMemo)(()=>document.createElement("div"),[]),[l,c]=(0,i.useState)(e.innerWidth-2*n),[d,p]=(0,i.useState)(e.innerHeight-2*n-50-70);return(0,i.useEffect)(()=>{o.className=r},[o,r]),(0,i.useEffect)(()=>e?.document?.body?(e?.document?.body.appendChild(o),()=>{e?.document?.body.removeChild(o)}):()=>{},[o,e]),(0,T.jsx)(ew.LR,{width:l,height:d,el:o,children:(0,T.jsx)(eU,{pipWindow:e,padding:n,setWidth:c,setHeight:p,el:o,topBar:a,bottomBar:s,children:t})})},eW=e=>Object.fromEntries(Object.entries(e).filter(([e,t])=>null!=t&&("number"!=typeof t||!Number.isNaN(t)&&t!==1/0&&t!==-1/0)));
1function eq({wrapperWidth:e,wrapperHeight:t,columns:r,rows:i,colWidths:n,rowHeights:a,xOffset:s=0,yOffset:o=0,overflow:l,overflowPage:c=0,overflowItemPerPage:d=2}){let p=Array.from({length:i},()=>Array(r).fill(!1)),u=n&&n.length===r?[...n]:Array.from({length:r},()=>e/r),h=a&&a.length===i?[...a]:Array.from({length:i},()=>t/i),m=l?Array.from({length:l.layout.length},(e,t)=>Array.from({length:l.layout[t].length},()=>!1)):[],x=(e,t)=>{let r=t[t.length-1],i=0;for(let n=0;n<e;n++)i+=n<t.length?t[n]:r;return i},f=c&&l?.direction==="horizontal"?x(d*c,u):0,w=c&&l?.direction==="vertical"?x(d*c,h):0;function g(){if(!l)return;let e=l.layout[0];"horizontal"===l.direction?m.forEach(t=>{t.push(...Array(e.length).fill(!1))}):m.push(Array.from({length:e.length},()=>!1))}function b(e){let t=0;for(let r=0;r<e;r++)t+=u[r];return t}function v(e){let t=0;for(let r=0;r<e;r++)t+=h[r];return t}function S(e,t){let r=0;for(let i=e;i<e+t;i++)r+=u[i];return r}return{colWidths:u,rowHeights:h,placeItem:function(e,t){e||={};for(let n=0;n<i;n++)for(let a=0;a<r;a++)if(function(e,t,n,a){if(e+n>i||t+a>r)return!1;for(let r=e;r<e+n;r++)for(let e=t;e<t+a;e++)if(p[r][e])return!1;return!0}(n,a,e.rowSpan||1,e.colSpan||1)){!function(e,t,r,i){for(let n=e;n<e+r;n++)for(let e=t;e<t+i;e++)p[n][e]=!0}(n,a,e.rowSpan||1,e.colSpan||1);let r=e.pinned?0:f,i=e.pinned?0:w,l=b(a)-r,c=v(n)-i,d=S(a,e.colSpan||1),u=function(e,t){let r=0;for(let i=e;i<e+t;i++)r+=h[i];return r}(n,e.rowSpan||1);return eW({position:"absolute",top:o,left:s,width:Math.floor(d),height:Math.floor(u),x:l,y:c,ratio:d/u,col:a,row:n,colSpan:e.colSpan||1,rowSpan:e.rowSpan||1,type:e.type,meta:{...t,overflow:!1,pinned:!!e.pinned}})}let n=function({type:e="camera"},t){if(!l)return null;let{direction:n,layout:a}=l,c=a[0];if("vertical"===n)for(;;){for(let r=0;r<m.length;r++)for(let n=0;n<c.length;n++)if(1===c[n]&&!m[r][n]){m[r][n]=!0;let a=v(i)+r*h[i-1]-w,l=b(n);return eW({position:"absolute",top:o,left:s,width:Math.floor(u[n]),height:Math.floor(h[i-1]),x:l,y:a,ratio:u[n]/h[i-1],col:n,row:i+r,colSpan:1,rowSpan:1,type:e,meta:{...t,overflow:!0,pinned:!1}})}g()}if("horizontal"===n){let i=u[r-1];for(;;){for(let n=0;n<m[0].length;n++)for(let l=0;l<a.length;l++)if(1===c[n%c.length]&&!m[l][n]){m[l][n]=!0;let a=b(r)+n*i-f,d=v(l);return eW({position:"absolute",top:o,left:s,width:Math.floor(i),height:Math.floor(h[l]),x:a,y:d,ratio:i/h[l],col:r+n,row:l,colSpan:1,rowSpan:1,type:e,meta:{...t,overflow:!0,pinned:!1},overflowPage:Math.floor(n/c.length)})}g()}}return null}(e,t);return n||eW({position:"absolute",top:o,left:s,width:u[0],height:h[0],x:0,y:0,ratio:u[0]/h[0],col:0,row:0,colSpan:1,rowSpan:1,type:e.type,meta:{...t,overflow:!1,pinned:!1}})},overflowPages:()=>m.length>0&&!m[0].every(e=>!e)?l?.direction==="vertical"?Math.ceil(m.length/d):Math.ceil(m.flat().filter(Boolean).length/d):0,getOverflowButtonPlacement:function(){if(!l||!m.length)return null;let{direction:e}=l;if("vertical"===e){let t=[...Array.isArray(l.layout)?l.layout[0]:l.layout].map((e,t)=>[t,e]).filter(([,e])=>!!e).map(([e])=>e);return t.length?{x:b(Math.min(...t))+s,width:S(Math.min(...t),Math.max(...t)-Math.min(...t)+1),direction:e}:null}if("horizontal"===e){let t=x(c*d,u),i=Array.from({length:l.layout.length},(e,t)=>t),n=v(Math.min(...i)),a=v(Math.max(...i))+h[Math.max(...i)];return{y:n+o,x:t+b(r),height:a-n,direction:e}}return null}}}let eY=[{name:"landscape",modifier:"superWide",value:2.65},{name:"landscape",modifier:"wide",value:1.95},{name:"landscape",modifier:"normal",value:1.3},{name:"landscape",modifier:"narrow",value:1},{name:"portrait",modifier:"wide",value:.8},{name:"portrait",modifier:"normal",value:.5},{name:"portrait",modifier:"narrow",value:.36},{name:"portrait",modifier:"superNarrow",value:0}].sort((e,t)=>t.value-e.value),eJ={portrait:{normal:{2:{columns:1,rows:2,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:2,rows:3,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:2,rows:4,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4,overflow:{direction:"vertical",layout:[[1,1]]}}},wide:{3:{columns:2,rows:3,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:3,rows:3,expert:{colSpan:3,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:4,rows:3,expert:{colSpan:4,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:3,rows:3,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6},7:{columns:3,rows:3,expert:{colSpan:3,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:7,overflow:{direction:"vertical",layout:[[1,1,1]]}}},narrow:{3:{columns:1,rows:3,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3}
1,4:{columns:1,rows:4,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:2,rows:4,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:1,rows:4,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6,overflow:{direction:"vertical",layout:[[1]]}}},superNarrow:{3:{columns:1,rows:3,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:1,rows:4,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:1,rows:5,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:1,rows:6,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6,overflow:{direction:"vertical",layout:[[1]]}}}},landscape:{normal:{2:{columns:2,rows:1,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:3,rows:2,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:2,rows:2,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:2,rows:4,expert:{colSpan:1,rowSpan:4},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:4,rows:4,expert:{colSpan:3,rowSpan:4,pinned:!0},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6,overflow:{direction:"vertical",layout:[[0,0,0,1]]}},7:{columns:2,rows:4,expert:{colSpan:1,rowSpan:4,pinned:!0},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:7,overflow:{direction:"vertical",layout:[[0,1]]}}},narrow:{3:{columns:2,rows:3,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:2,rows:2,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:4,rows:3,expert:{colSpan:4,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:3,rows:3,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6},7:{columns:3,rows:4,expert:{colSpan:2,rowSpan:2,pinned:!0},owner:{colSpan:2,rowSpan:2,pinned:!0},participants:{colSpan:1,rowSpan:1},maxVideos:7,overflow:{direction:"vertical",layout:[[0,0,1]]}}},wide:{3:{columns:4,rows:2,expert:{colSpan:3,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:4,rows:3,expert:{colSpan:3,rowSpan:3},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:4,rows:2,expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:4,rows:3,expert:{colSpan:2,rowSpan:3,pinned:!0},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:7,overflow:{direction:"vertical",layout:[[0,0,1,1]]}}},superWide:{3:{columns:3,rows:1,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:4,rows:1,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:4,rows:2,expert:{colSpan:2,rowSpan:2,pinned:!0},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5},6:{columns:5,rows:2,expert:{colSpan:2,rowSpan:2,pinned:!0},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:6,overflow:{direction:"vertical",layout:[[0,0,1,1,1]]}}}}},eK={landscape:{normal:{2:{columns:3,rows:2,screenShare:{colSpan:2,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:4,rows:3,screenShare:{colSpan:3,rowSpan:3},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:3,rows:4,screenShare:{colSpan:2,rowSpan:4},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:2,rows:4,screenShare:{colSpan:1,rowSpan:4,pinned:!0},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[0,1]]}}},wide:{3:{columns:5,rows:3,screenShare:{colSpan:3,rowSpan:3},expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:4,rows:4,screenShare:{colSpan:3,rowSpan:4},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:3,rows:4,screenShare:{colSpan:1,rowSpan:4,pinned:!0},expert:{colSpan:2,rowSpan:2},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[0,1,1]]}}},superWide:{2:{columns:3,rows:1,screenShare:{colSpan:1,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:3},3:{columns:5,rows:2,screenShare:{colSpan:3,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:5,rows:2,screenShare:{colSpan:3,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:5,rows:2,screenShare:{colSpan:2,rowSpan:2,pinned:!0},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[0,0,1,1,1]]}}}},portrait:{normal:{2:{columns:2,rows:2,screenShare:{colSpan:2,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:2,rows:4,screenShare:{colSpan:2,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:2,rows:5,screenShare:{colSpan:2,rowSpan:3},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:2,rows:3,screenShare:{colSpan:2,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[1,1]]}}},narrow:{2:{columns:2,rows:2,screenShare:{colSpan:2,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:2,rows:4,screenShare:{colSpan:2,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:2,rows:4,screenShare:{colSpan:2,rowSpan:2},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:2,rows:3,screenShare:{colSpan:2,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[1,1]]}}},wide:{2:{columns:2,rows:2,screenShare:{colSpan:2,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},maxVideos:2},3:{columns:3,rows:5,screenShare:{colSpan:3,rowSpan:4},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:3},4:{columns:3,rows:4,screenShare:{colSpan:2,rowSpan:4},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:4},5:{columns:3,rows:2,screenShare:{colSpan:3,rowSpan:1},expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},maxVideos:5,overflow:{direction:"vertical",layout:[[1,1,1]]}}}}},eG=100,eZ=.95,eX=1.05,eQ=.2,e0=.9,e1=1.5,e2=1,e3=275,e5=300,e4=150,e6=230,e8=100,e7=100,e9=({expertStream:e,ownerStream
1:t,participantStreams:r,hasScreenShare:i,width:n,height:a,xOffset:s,yOffset:o,isMobile:l,gap:c=12,maxRatio:d=e1,minRatio:p=e2,attempt:u=0,colWidths:h,rowHeights:m,originalHeight:x,originalWidth:f,screenShareStream:w,overflowPage:g,videoMinWidth:b=e8,videoMinHeight:v=e7,maxAttempts:S=eG,decreaseRatio:y=eZ,increaseRatio:j=eX,mobileMaxRemovalAmountRatio:k=eQ,desktopMaxRemovalAmountRatio:E=e0,highlyRestrictedHeightValue:N=e3,highlyRestrictedWidthValue:I=e5,heightLimit:C=e4,widthLimit:D=e6})=>{if(void 0===n||void 0===a)return{streams:[],colWidths:[],rowHeights:[],layout:{orientation:"landscape",aspectRatio:"normal",isHighlyRestrictedHeight:!1,isHighlyRestrictedWidth:!1,dimensions:{width:0,height:0,originalWidth:0,originalHeight:0}}};let A=l?k:E,{streams:T,colWidths:P,rowHeights:M,error:R,overflowPages:V,getOverflowButtonPlacement:$,layout:F}=(({expertStream:e,ownerStream:t,participantStreams:r,hasScreenShare:i,width:n,height:a,xOffset:s,yOffset:o,gap:l=6,colWidths:c,rowHeights:d,originalHeight:p,originalWidth:u,screenShareStream:h,overflowPage:m,heightLimit:x=e4,widthLimit:f=e6,highlyRestrictedHeightValue:w=e3,highlyRestrictedWidthValue:g=e5})=>{let b=2+r.length;if(void 0===n||void 0===a)return{streams:[],colWidths:[],rowHeights:[]};if(a<=x||n<=f)return{layout:{orientation:"landscape",aspectRatio:{name:"landscape",modifier:"superWide",value:n/a},isHighlyRestrictedHeight:!1,isHighlyRestrictedWidth:!1,dimensions:{width:n,height:a,originalWidth:u,originalHeight:p}},streams:[],rowHeights:[],colWidths:[],error:"Browser window size is too small, please resize the window to see other participants in call."};if(w&&a<=w){let c=b+ +!!i,d=a*e2,x=Math.min(Math.max(1,Math.floor(n/d)),c),f=[Array.from({length:Math.max(x,1)},()=>1)],w=Array.from({length:x},()=>d),g=1;if(i){let e=(h?.videoDimensions?.width||1)/(h?.videoDimensions?.height||1);w[0]=a*e}let v=w.reduce((e,t)=>e+t,0),S=c>x;if(!i&&S){let e=n/(x+.3);w=Array.from({length:x},()=>e)}else v<=n?s=(n-v)/2:x>1&&(x=Math.max(1,x-1),w.pop());if(1===x&&i){g=2,x=2,s=0;let e=w[0]-d;w=[e,e<0?d-Math.abs(e):d]}let y=eq({wrapperWidth:n,wrapperHeight:a,columns:x,rows:1,gap:l,xOffset:s,yOffset:o,overflow:{direction:"horizontal",layout:f},overflowPage:m,overflowItemPerPage:x,colWidths:w});return{streams:[i&&h?{...h,position:y.placeItem({colSpan:g,rowSpan:1,type:"screen"},{type:"screen"})}:null,{...e,position:y.placeItem({colSpan:1,rowSpan:1},{type:"expert"})},t?{...t,position:y.placeItem({colSpan:1,rowSpan:1},{type:"owner"})}:null,...r.map((e,t)=>({...e,position:y.placeItem({colSpan:1,rowSpan:1},{type:"participant",index:t})}))].filter(e=>null!==e),colWidths:y.colWidths,rowHeights:y.rowHeights,overflowPages:y.overflowPages,getOverflowButtonPlacement:y.getOverflowButtonPlacement,layout:{aspectRatio:{name:"landscape",modifier:"superWide",value:n/a},isHighlyRestrictedHeight:!0,isHighlyRestrictedWidth:!1,dimensions:{width:n,height:a,originalWidth:u,originalHeight:p},row:1,col:x,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},overflow:{direction:"horizontal",layout:f}}}}if(g&&n<=g){let c=Math.max(1,Math.min(Math.floor(a/(n/e1)),b+ +!!i)),d=[[1]],x=eq({wrapperWidth:n,wrapperHeight:a,columns:1,rows:c,gap:l,xOffset:s,yOffset:o,overflow:{direction:"vertical",layout:d},overflowPage:m,overflowItemPerPage:c});return{streams:[i&&h?{...h,position:x.placeItem({colSpan:1,rowSpan:1,type:"screen"},{type:"screen"})}:null,{...e,position:x.placeItem({colSpan:1,rowSpan:1},{type:"expert"})},t?{...t,position:x.placeItem({colSpan:1,rowSpan:1},{type:"owner"})}:null,...r.map((e,t)=>({...e,position:x.placeItem({colSpan:1,rowSpan:1},{type:"participant",index:t})}))].filter(e=>null!==e),colWidths:x.colWidths,rowHeights:x.rowHeights,overflowPages:x.overflowPages,getOverflowButtonPlacement:x.getOverflowButtonPlacement,layout:{aspectRatio:{name:"portrait",modifier:"superNarrow",value:n/a},isHighlyRestrictedHeight:!1,isHighlyRestrictedWidth:!0,dimensions:{width:n,height:a,originalWidth:u,originalHeight:p},row:c,col:1,expert:{colSpan:1,rowSpan:1},owner:{colSpan:1,rowSpan:1},participants:{colSpan:1,rowSpan:1},overflow:{direction:"vertical",layout:d}}}}let v=(({aspectRatio:e,streamCount:t,hasScreenShare:r})=>{let i=eY.filter(t=>e>=t.value),n=i.every(e=>"portrait"===e.name)?"portrait":"landscape",a=r?eK:eJ;for(let e of i){let r=t,i=Object.keys(a?.[e.name]?.[e.modifier]??{}).map(Number);i.includes(t)||Math.max(...i,t)!==t||(r=i.reduce((e,r)=>
1Math.abs(Number(r)-t)<Math.abs(Number(e)-t)?r:e,0));let n=a[e.name][e.modifier]?.[r];if(n)return{...n,aspectRatio:e}}let s=eY.find(e=>e.name===n&&"normal"===e.modifier);if(!s)throw Error(`Missing normal ${n} aspect ratio fallback`);let o=Object.keys(a[n].normal).map(Number).reduce((e,r)=>Math.abs(r-t)<Math.abs(e-t)?r:e,0);return{aspectRatio:s,...a[n].normal[o]}})({aspectRatio:(u??n)/(p??a),streamCount:b,hasScreenShare:i}),{placeItem:S,colWidths:y,rowHeights:j,overflowPages:k,getOverflowButtonPlacement:E}=eq({wrapperWidth:n,wrapperHeight:a,columns:v.columns,rows:v.rows,gap:l,xOffset:s,yOffset:o,colWidths:c,rowHeights:d,overflow:v.overflow,overflowPage:m});return{streams:[h&&v.screenShare?{...h,position:S({...v.screenShare,type:"screen"},{type:"screen"})}:null,{...e,position:S({...v.expert,type:"camera"},{type:"expert"})},t?{...t,position:S(v.owner??{},{type:"owner"})}:null,...r.length?r.slice(0,!v.overflow?v.maxVideos-2:void 0).map((e,t)=>({...e,position:S((Array.isArray(v.participants)?v.participants[t]:v.participants)??{},{type:"participant",index:t})})):[]].filter(e=>null!==e),colWidths:y,rowHeights:j,overflowPages:k,getOverflowButtonPlacement:E,layout:v}})({expertStream:e,ownerStream:t,participantStreams:r,hasScreenShare:i,width:n,height:a,xOffset:s,yOffset:o,gap:c,colWidths:h,rowHeights:m,originalHeight:x,originalWidth:f,screenShareStream:w,overflowPage:g,heightLimit:C,widthLimit:D,highlyRestrictedHeightValue:N,highlyRestrictedWidthValue:I}),L=V&&V()>=1,_=g??0,O=$&&$(),z=T;if(L&&O?.direction==="vertical"){let e="rows"in F&&"number"==typeof F.rows&&F.rows||"row"in F&&"number"==typeof F.row&&F.row||1,t=e/(e+.3);z=T.map(e=>e.position.meta?.pinned?e:{...e,position:{...e.position,y:e.position.y*t,height:Math.floor(Number(e.position.height)*t)}})}let B=(()=>{if(!L||_<=0||_<V()||!O)return{x:0,y:0};let e=z.filter(e=>!e.position.meta?.pinned);return e.length?"vertical"===O.direction?{x:0,y:(x??a)-2*(Number(e[0].position.top)||0)-Math.max(...e.map(e=>e.position.y+Number(e.position.height)))}:{x:(f??n)-2*(Number(e[0].position.left)||0)-Math.max(...e.map(e=>e.position.x+Number(e.position.width))),y:0}:{x:0,y:0}})(),U=B.x||B.y?z.map(e=>e.position.meta?.pinned?e:{...e,position:{...e.position,x:e.position.x+B.x,y:e.position.y+B.y}}):z,H=U.find(e=>e?.position?.meta?.type==="screen")?.position,W=U.find(e=>e?.position?.meta?.type==="expert")?.position,q=H??W,Y=q?Array.from({length:q.colSpan},(e,t)=>q.col+t):[],J=q?Array.from({length:q.rowSpan},(e,t)=>q.row+t):[],K=P.map((e,t)=>t).filter(e=>{if(Y.includes(e)&&i)return!1;let t=U.filter(t=>t.position.col===e);return t.length&&t.every(e=>e.position.ratio>d&&e.position?.meta?.type!=="screen")}),G=P.map((e,t)=>t).filter(e=>{if(Y.includes(e)&&i)return!1;let t=U.filter(t=>t.position.col===e);return t.length&&t.every(e=>e.position.ratio<p&&e.position?.meta?.type!=="screen")}),Z=M.map((e,t)=>t).filter(e=>{if(J.includes(e)&&i)return!1;let t=U.filter(t=>t.position.row===e);return t.length&&t.every(e=>e.position.ratio<p&&e.position?.meta?.type!=="screen")}),X=M.map((e,t)=>t).filter(e=>{if(J.includes(e)&&i)return!1;let t=U.filter(t=>t.position.row===e);return t.length&&t.every(e=>e.position.ratio>d&&e.position?.meta?.type!=="screen")});if((K.length||Z.length||G.length||X.length)&&u<S){let h=M.map((e,t)=>{if(Z.includes(t)){let t=e*y;return t<v?v:t}return X.includes(t)&&Z.length?e*j:e}),m=P.map((e,t)=>{if(K.includes(t)){let t=e*y;return t<b?b:t}return G.includes(t)&&void 0!==f&&n<f?e*j:e}),T=m.reduce((e,t)=>e-t,n),R=h.reduce((e,t)=>e-t,a),V=Math.abs(n-T-(f??n)),$=Math.abs(a-R-(x??a)),F=(f??n)*A,L=(x??a)*A,_=a-R>(x??a);if((n-T>(f??n)||V>F)&&(m=P,T=0),(_||$>L)&&(h=M,R=0),Y&&T&&!K.some(e=>Y.includes(e))){let e=q?.colSpan??1,t=T/e;for(let r=0;r<e;r++)m[Y[r]]+=t;T=0}if(Y&&i&&w?.videoDimensions?.width&&w.videoDimensions.height){let e=w.videoDimensions.width/w.videoDimensions.height,t=Y.reduce((e,t)=>e+m[t],0),r=J.reduce((e,t)=>e+h[t],0);if(Math.abs(t/r-e)>.001&&!l){let i=Math.min(r*e,f??n)-t,a=i/Y.length;i+n<=(f??n)&&(Y.forEach(e=>{m[e]+=a}),T+=Math.abs(i))}}return e9({expertStream:e,ownerStream:t,participantStreams:r,hasScreenShare:i,width:n-T,height:a-R,xOffset:s+T/2,yOffset:o+R/2,isMobile:l,gap:c,maxRatio:d,minRatio:p,attempt:u+1,colWidths:m,rowHeights:h,originalHeight:x??a,originalWidth:f??n,screenShareStream:w,overflowPage:g,videoMinWidth:b,videoMinHeight:v,maxAttempts:S,decreaseRatio:y,increaseRatio:j,mobileMaxRemovalAmountRatio:k,desktopMaxRemovalAmountRatio:E,highlyRestrictedHeightValue:N,highlyRestrictedWidthValue:I,heightLimit:C,widthLimit:D})}return{streams:U,colWidths:P,rowHeights:M,error:R,overflowPages:V,getOverflowButtonPlacement:$,layout:{orientation:F?.aspectRatio?.name??"landscape",aspectRatio:F?.aspectRatio?.modifier??"normal",isHighlyRestrictedHeight:a<=N,isHighlyRestrictedWidth:n<=I,dimensions:{width:n,height:a,originalWidth:f??n,originalHeight:x??a}}}},te=function(e,t={}){let{throttleMs:r=500,threshold:n=.1,idleTimeout:a=5e3,speakingThreshold:s=.08,speakingRemovalDelay:o=1500}=t,[l,c]=(0,i.useState)(null),[d,p]=(0,i.useState)(new Set),u=(0,i.useRef)(new Map),h=(0,i.useRef)(Date.now()),m=(0,i.useRef)(new Map);return(0,i.useEffect)(()=>{let t=u.current,r=e.map(e=>("function"==typeof e.on&&e.on("audioLevelChanged",({audioLevel:r})=>{t.set(e.streamId,r)}
1),()=>{"function"==typeof e.off&&e.off("audioLevelChanged"),t.delete(e.streamId)}));return()=>{r.forEach(e=>e())}},[e]),(0,i.useEffect)(()=>{let e=window.setInterval(()=>{let e=u.current,t=m.current,r=null,i=0,d=Date.now();e.forEach((e,n)=>{e>i&&(i=e,r=n),e>s&&t.set(n,d)});let x=l?e.get(l)??0:0;r&&i>n&&i>x+.05?(c(r),h.current=d):r&&r===l&&i>n?h.current=d:d-h.current>a&&c(null);let f=new Set;t.forEach((e,r)=>{d-e<=o?f.add(r):t.delete(r)}),p(f)},r);return()=>window.clearInterval(e)},[l,r,n,a,s,o]),{activeSpeaker:l,speakingStreams:d}};var tt=r(29476);let tr=({isSpeaking:e,amount:t=3})=>(0,T.jsx)("div",{className:"absolute z-10 right-4 bottom-[2px]",children:(0,T.jsx)("div",{className:"relative p-2 rounded-full w-5 h-5",children:(0,T.jsx)("div",{className:"flex justify-center space-x-[1px] absolute top-1/2 left-0 w-5 h-[1px]",children:Array.from({length:t},(t,r)=>(0,T.jsx)(c.P.span,{className:"block w-[5px] h-[5px] bg-white rounded-full",animate:e?{y:[-2.5,-3.5,-4.5,-3.5,-2.5],height:[5,7,9,7,5]}:{y:-2.5,height:5},transition:e?{repeat:1/0,repeatType:"loop",duration:.7,ease:"easeInOut",delay:.15*r}:{duration:.3}},r))})})}),ti=()=>null,tn=()=>null,ta=({hasScreenShare:e,cameraEnabled:t,audioEnabled:r,videoLoading:n,videoHeight:a,videoWidth:s,name:o,subtext:d,children:p,noCameraText:u,avatarUrl:h="/participant-video-off.svg",id:m,className:x="",styles:f,stream:g,allowBlur:b=!0,isInPip:v,isSpeaking:S=!1,isActiveSpeaker:y=!1,showSpeakingIndicator:j=!0})=>{let k=(0,i.useRef)(200),E=(0,i.useRef)(null),[N,I]=(0,i.useState)(null),C=(0,i.useRef)(null),[D,A]=(0,i.useState)(!1),P=(0,tt.B)(p,ti),M=(0,tt.B)(p,tn);f?.height&&parseFloat(`${f.height}`),f?.width&&parseFloat(`${f.width}`);let R=(a??0)>(s??0),V=s&&a?`${s} / ${a}`:void 0,$=(0,i.useCallback)(e=>{let t=document.createElement("canvas");t.width=e.videoWidth,t.height=e.videoHeight;let r=t.getContext("2d");r&&(r.drawImage(e,0,0,t.width,t.height),I(t.toDataURL("image/jpeg",.5)))},[]),F=(0,i.useCallback)(()=>{C.current&&g&&g.hasVideo&&void 0!==g.subscribeToVideo&&!g.subscribedToVideo&&"function"==typeof g.subscribeToVideo?(null!==E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{g?.hasVideo&&g?.shouldReconnectVideo&&g?.subscribeToVideo&&(g?.subscribeToVideo(!0),F()),k.current=Math.min(2*k.current,1e4)},k.current)):k.current=200},[g,m]);return(0,i.useEffect)(()=>{F()},[]),(0,i.useEffect)(()=>{let e=C.current?.querySelector("video"),t=0,r=()=>{e&&e.play().catch(e=>{t<3?(t++,r()):console.error(e)})};e&&r()},[v]),(0,i.useEffect)(()=>{let e=new MutationObserver(e=>{e.forEach(e=>{"childList"===e.type&&e.addedNodes.forEach(e=>{"VIDEO"===e.nodeName&&b&&R&&(e.readyState>=2?$(e):e.addEventListener("loadeddata",()=>$(e),{once:!0}))})})});return D&&C.current&&e.observe(C.current,{childList:!0,subtree:!0}),()=>{e.disconnect()}},[b,D,R,$]),u||=o,b||=window.navigator.hardwareConcurrency>6,(0,T.jsx)(ev,{id:m??"",styles:f??{},className:ef()("p-[4px] md:p-[8px]",{"!p-[4px]":v}),children:(0,T.jsx)(eL,{ref:e=>{C.current=e,A(!!e)},isActiveSpeaker:y,overlay:(0,T.jsxs)(T.Fragment,{children:[!t&&e?null:(0,T.jsxs)("div",{className:"flex absolute shadow-[rgba(0,0,0,0.5)] right-[12px] md:right-[16px] top-[10px] md:top-[12px] z-1",children:[(0,T.jsx)("p",{className:"text-shadow-sm font-light text-[10px] text-white mr-[4px] hidden @[450px]/vc:flex",children:"Powered by"}),(0,T.jsx)(l.A,{svgClassName:"svg-shadow-sm",invert:!0,width:35,height:13,classes:"!w-[35px] !h-[10px] opacity-80 !py-0 !pr-0 !mb-0 !ml-0 !pointer-events-none !cursor-default",onClick:e=>{e.preventDefault()}})]}),!t&&(0,T.jsxs)("div",{className:"absolute z-10 rounded-[8px] md:rounded-[15px] left-0 right-0 bottom-0 top-0 bg-[#2d2d2d] py-[25px] @[150px]/vc:py-[45px] flex items-center justify-center",children:[(0,T.jsxs)("div",{className:"h-full items-center justify-center flex flex-col aspect-square flex-0 @container/image gap-2",children:[(0,T.jsx)("div",{className:"hidden @[50px]/image:flex flex-0 h-full max-h-[200px] items-center justify-center aspect-square",children:(0,T.jsx)("img",{alt:`${o} avatar`,src:h,className:"rounded-full h-full"})}),(0,T.jsx)("div",{className:"-mx-8 !@[50px]/image:-mx-10",children:(0,T.jsx)("p",{className:"text-[#E0E0E0] text-[12px] @[250px]/vc:text-[18px] font-normal px-2 text-wrap-balance flex-0 w-full text-center",children:u})})]}),!r&&u===o&&(0,T.jsx)("div",{className:"absolute z-10 left-2 bottom-2",children:(0,T.jsxs)("div",{className:"relative bg-charcoal rounded-full p-1",children:[(0,T.jsx)("img",{alt:"microphone off",className:"w-[12px] h-[12px] relative",src:"/microphone-icon-red.svg"}),(0,T.jsx)("span",{className:"bg-[#F25757] w-px h-[15px] rounded-[4px] ring-charcoal -rotate-45 ring-1 absolute z-10 left-[10px] top-[3px] red-strikethrough cursor-pointer"})]})})]}
1),r&&j&&S&&(0,T.jsx)(tr,{isSpeaking:S}),n&&(0,T.jsx)("div",{className:"absolute z-10 flex items-center justify-center w-full h-full left-0 right-0 bottom-0 top-0 bg-black/60 rounded-[8px] md:rounded-[15px] md:@[450px]/vcc:rounded-[18px]",children:(0,T.jsx)(w.A,{width:32,height:32,color:"#ffffff"})}),(0,T.jsx)("div",{className:ef()("text-[12px] @[350px]/vc:text-[14px] absolute right-0 left-0 bottom-0 text-white font-light z-1",{hidden:!t,"fine-pointer:hidden fine-pointer:@[125px]/vc:block fine-pointer:group-hover:block  ":t}),children:(0,T.jsxs)("span",{className:ef()("relative pr-[8px] pt-[2px] pb-[4px] -my-px bg-[rgba(0,0,0,0.8)] inline-flex items-center whitespace-nowrap overflow-hidden text-ellipsis",{"pl-[28px]":!r,"pl-[10px]":r}),style:r?{}:{minWidth:0,maxWidth:"100%"},children:[!r&&(0,T.jsxs)("span",{className:"absolute left-[8px] flex items-center",children:[(0,T.jsx)("img",{alt:"microphone off",className:"w-[12px] h-[12px] relative",src:"/microphone-icon-red.svg"}),(0,T.jsx)("span",{className:"bg-[#F25757] w-px h-[16px] rounded-[4px] ring-[rgba(0,0,0,0.8)] -rotate-45 ring-1 absolute z-10 left-[6px] top-[-1px] red-strikethrough pointer-events-none"})]}),(0,T.jsx)("span",{className:"block overflow-hidden text-ellipsis whitespace-nowrap min-w-0",children:o})]})}),M?.props?.children]}),children:R?(0,T.jsxs)(T.Fragment,{children:[N&&(0,T.jsx)(c.P.div,{initial:{opacity:0}
1,animate:{opacity:1},exit:{opacity:0},transition:{duration:.2},className:"absolute inset-0 w-full h-full z-0 top-0 left-0 right-0 bottom-0 blur-xl scale-105 origin-center opacity-70",style:{backgroundImage:`url(${N})`,backgroundSize:"cover",backgroundPosition:"center",aspectRatio:V},"data-testid":"video-bg-blur"}),(0,T.jsx)("div",{className:"w-auto h-full m-auto",style:{aspectRatio:V},children:P?.props?.children})]}):P?.props?.children})})};ta.Source=ti,ta.Overlay=tn;var ts=r(31150);let to=({stream:e})=>((0,i.useEffect)(()=>{e.subscribeToVideo?.(!1,!0)},[]),e.child),tl=({onClick:e,direction:t,x:r,y:i,width:n,height:a,wrapperPadding:s,alt:o,type:l,showButton:d=!0,showGradient:p=!0,gradientType:u="linear",isInPip:h=!1})=>{let m,x,{setStatus:f}=(0,ew.Xp)(),w="next"===l?"rotate-90":"-rotate-90";"horizontal"===t&&(w="next"===l?"rotate-0":"rotate-180");let g="bottom";return"horizontal"===t?g="prev"===l?"left":"right":"prev"===l&&(g="top"),(0,T.jsxs)(c.P.div,{className:ef()("flex absolute justify-center  z-50",{"items-center":"horizontal"===t,"justify-center":"vertical"===t}),style:{..."vertical"===t?{left:`${r}px`,width:`${n}px`,..."next"===l?{bottom:`-${s??0}px`}:{top:`-${s??0}px`}}:{..."next"===l?{right:`-${s??0}px`}:{left:`-${s??0}px`},top:`${i}px`,height:`${a}px`,y:0}},initial:{opacity:+!!h,..."vertical"===t?{y:"next"===l?"100%":"-100%"}:{x:"next"===l?"100%":"-100%"}},animate:{opacity:1,..."vertical"===t?{y:0}:{x:0}},exit:{opacity:+!!h,..."vertical"===t?{y:"next"===l?"100%":"-100%"}:{x:"next"===l?"100%":"-100%"}},transition:{duration:.1,ease:"linear"},children:[(0,T.jsx)(c.P.div,{className:ef()("absolute z-0 from-[#1b1b1b]",{"right-0":"horizontal"===t&&"next"===l,"left-0":"horizontal"===t&&"prev"===l,"top-0":"vertical"===t&&"prev"===l,"-bottom-1":"vertical"===t&&"next"===l,"w-[25px]":"horizontal"===t,"h-[25px]":"vertical"===t,"-top-24 -bottom-24":"horizontal"===t&&"radial"===u,"-left-24 -right-24":"vertical"===t&&"radial"===u,"top-0 -bottom-0":"horizontal"===t&&"linear"===u,"left-0 -right-0":"vertical"===t&&"linear"===u,"md:from-[#F7F8FB]":!h}),style:{background:"radial"===u?(m=g,`
2    radial-gradient(ellipse at ${m}, var(--tw-gradient-from) 0%, var(--tw-gradient-from) 45%, transparent 75%)
3`):(x=g,`
4    linear-gradient(to ${x}, transparent 0%, var(--tw-gradient-from) 75%)
5`)},animate:{opacity:+!!p,transition:{duration:.1,ease:"linear",delay:.1}}}),d?(0,T.jsx)("span",{className:ef()("flex items-center justify-center",{"transition-all duration-200 can-hover:opacity-0 group-hover/videoLayout:can-hover:opacity-100 group-hover/videoLayout:can-hover:translate-x-0 group-hover/videoLayout:can-hover:translate-y-0":!h,"focus-within:can-hover:opacity-100 focus-within:can-hover:translate-x-0 focus-within:can-hover:translate-y-0":!h,"can-hover:translate-y-full":!h&&"vertical"===t&&"next"===l,"can-hover:-translate-y-full":!h&&"vertical"===t&&"prev"===l,"can-hover:translate-x-full":!h&&"horizontal"===t&&"next"===l,"can-hover:-translate-x-full":!h&&"horizontal"===t&&"prev"===l}),children:(0,T.jsx)(c.P.button,{type:"button",initial:{opacity:+!!h,..."vertical"===t?{y:"next"===l?"100%":"-100%"}:{x:"next"===l?"100%":"-100%"}},animate:{opacity:1,..."vertical"===t?{y:0}:{x:0}},exit:{opacity:+!!h,..."vertical"===t?{y:"next"===l?"100%":"-100%"}:{x:"next"===l?"100%":"-100%"}},className:ef()("bg-white text-charcoal z-10 w-7 h-7 lg:w-9 lg:h-9 rounded-full flex items-center justify-center hover:scale-105 active:scale-100 border-[#efefef] border-[1px] border-solid shadow-calls-cards",{"shadow-calls-cards":p,"hover:bg-[#F1f1f2] active:bg-[#F1f1f2]":p,"hover:bg-white active:bg-white":!p,"mt-2":"vertical"===t&&"prev"===l,"mb-2":"vertical"===t&&"next"===l}),onClick:()=>{f("scroll"),e()},children:(0,T.jsx)("img",{alt:o,src:"/send-message-arrow.svg",className:ef()("w-[16px] h-[12px]",w)})})}):(0,T.jsx)("div",{className:"w-2 h-2 lg:w-4 lg:h-4 rounded-full shadow-calls-cards flex items-center justify-center"})]},o)};function tc({className:e,expertStream:t,ownerStream:r,participantStreams:n,screenShareStream:a,padding:s=0,hasScreenShare:o,currentUserId:l,getUserNotConnectedText:c=()=>
5"Not connected",audioBlocked:d,onAllowAudio:p,canDisabledVideo:u,isInPip:h}){let[m,x]=(0,i.useState)(0),[f,g]=(0,i.useState)(!1),{width:b}=(0,k.A)(),{allStreams:v,error:y,streamsWithoutVideoSpot:j,overflowPages:E,getOverflowButtonPlacement:N,layout:I}=(({expertStream:e,ownerStream:t,participantStreams:r,screenShareStream:n,hasScreenShare:a,gap:s=12,width:o,height:l,overflowPage:c=0,heightLimit:d=e4,widthLimit:p=e6,highlyRestrictedHeightValue:u=e3,highlyRestrictedWidthValue:h=e5})=>{let{status:m}=(0,ew.Xp)(),x=(0,i.useMemo)(()=>r.length<=7?r:[...r].sort((e,t)=>Number(!!t.hasVideo)-Number(!!e.hasVideo)),[r]),{width:f,height:w}=(0,ew.e1)(),g=o??f,b=l??w,v=(b??0)>(g??0),[,S]=(0,i.useState)(0),{streams:y,error:j,overflowPages:k,getOverflowButtonPlacement:E,layout:N}=(0,i.useMemo)(()=>e9({expertStream:e,ownerStream:t,participantStreams:x,hasScreenShare:a??!1,width:g,height:b,xOffset:0,yOffset:0,isMobile:v,gap:s,screenShareStream:n,overflowPage:c,heightLimit:d,widthLimit:p,highlyRestrictedHeightValue:u,highlyRestrictedWidthValue:h}),[e,t,x,a,v,g,b,s,n,c,d,p,u,h]);return(0,i.useEffect)(()=>{let e=()=>{document.hidden||S(e=>e+1)};return document.addEventListener("visibilitychange",e),()=>{document.removeEventListener("visibilitychange",e)}},[]),{status:m,allStreams:y,error:j,streamsWithoutVideoSpot:x.filter(e=>y.every(t=>t.streamId!==e.streamId)),overflowPages:k,getOverflowButtonPlacement:E,layout:N}})({expertStream:t,ownerStream:r,participantStreams:n,hasScreenShare:o,screenShareStream:a,overflowPage:m,gap:h?5:12,heightLimit:h?100:void 0,widthLimit:h?100:void 0,highlyRestrictedHeightValue:h?250:void 0,highlyRestrictedWidthValue:h?250:void 0}),{activeSpeaker:C,speakingStreams:D}=te(v),A=(0,i.useCallback)(e=>{e.shiftKey&&(e.ctrlKey||e.metaKey)&&"d"===e.key.toLowerCase()&&(e.preventDefault(),g(e=>!e))},[]),P=(0,i.useCallback)(e=>{3===e.touches.length&&g(e=>!e)},[]);(0,i.useEffect)(()=>{},[A,P]);let M=E?.()??0,R=N?.()??{direction:"horizontal",x:0,y:0,width:0,height:0};(0,i.useEffect)(()=>{"number"==typeof M&&(m>M?x(Math.max(M,0)):m<0&&x(0))},[m,M]);let V="number"==typeof M&&M>=1,$=V&&m<M,F=V&&m>0;return(0,T.jsx)("div",{className:ef()(e,"w-full h-full group/videoLayout"),style:{padding:s?`${s}px`:void 0},children:(0,T.jsxs)("div",{className:"relative w-full h-full",children:[(0,T.jsx)(eI.N,{children:V&&[(0,T.jsx)(tl,{onClick:()=>{x(e=>Math.min(M,e+1))},direction:R.direction,x:R.x,y:R.y,width:R.width,height:R.height,wrapperPadding:s,alt:"Next Page",type:"next",showButton:$,showGradient:m!==M,isInPip:h},`next-${R.direction}`),(0,T.jsx)(tl,{onClick:()=>{x(e=>Math.max(0,e-1))},direction:R.direction,x:R.x,y:R.y,width:R.width,height:R.height,wrapperPadding:s,alt:"Previous Page",type:"prev",showButton:F,showGradient:0!==m,isInPip:h},`prev-${R.direction}`)]}),d&&(0,T.jsx)("div",{className:ef()("absolute inset-0 flex items-center justify-center z-50 bg-charcoal/60",{"md:bg-[#F7F8FB]/60":!h}),children:(0,T.jsxs)("div",{className:ef()("flex justify-center text-center flex-col items-center",{"text-white gap-6 max-w-[60vw]":h,"text-white md:bg-[#F7F8FB]/70 md:shadow-gift-card md:text-charcoal md:p-8 md:rounded-xl gap-6 md:gap-6 max-w-[400px] text-wrap-balance":!h}),children:[(0,T.jsx)("p",{className:"font-medium md:font-bold text-shadow-lg md:text-shadow-0 text-[18px] md:text-[24px] leading-snug",children:"Browser security policies have blocked audio."}),(0,T.jsx)("button",{type:"button",className:ef()("w-full max-w-[70vw] mt-[10px] flex items-center justify-center py-4 px-6 cursor-pointer text-white rounded-md font-semibold text-[16px] bg-btn hover:bg-btn-hover"),onClick:()=>{p?.()},children:"Allow audio"})]})}),y&&(0,T.jsx)("div",{className:"w-full h-full flex items-center justify-center",children:(0,T.jsx)("div",{className:"h-full flex justify-center text-center flex-col items-center",children:(0,T.jsx)("p",{className:"text-white font-normal text-shadow-lg text-[14px] p-[24px]",children:y})})}),a&&(0,T.jsx)("div",{className:"hidden",children:a.child}),v.map(e=>{let t="screen"===e.position.type,r=!!e?.subscribedToVideo&&e?.hasVideo;return t?(0,T.jsx)(ez,{style:e.position,hasScreenShare:!0,stream:e},e.streamId):(0,T.jsx)(ts.T,{namespace:"VideoCard",fallback:()=>null,children:(0,T.jsxs)(ta,{styles:e.position,id:e.streamId,hasScreenShare:"screen"===e.position.type,cameraEnabled:!!t||r,audioEnabled:e?.hasAudio,videoLoading:e.loading,videoHeight:e?.videoDimensions?.height,videoWidth:e?.videoDimensions?.width,name:`${(0,S.Nc)(e.user?.FirstName,e.user?.LastName)}${"screen"===e.position.type?"'s screen":""}`,subtext:"screen"!==e.position.type&&e.user&&"Title"in e.user&&"string"==typeof e.user.Title?e.user.Title:void 0,stream:e,n
5oCameraText:e.child||"screen"===e.position.type?void 0:c({firstName:e.user?.FirstName,lastName:e.user?.LastName,userId:e.userId}),isInPip:h,isSpeaking:!d&&D.has(e.streamId),isActiveSpeaker:!d&&C===e.streamId,className:ef()({"z-20":e.position.meta?.pinned}),children:[(0,T.jsx)(ta.Source,{children:e?.child}),"screen"!==e.position.type&&!("hideOverlay"in e&&e.hideOverlay)&&(0,T.jsxs)(ta.Overlay,{children:[e.loading&&(0,T.jsx)("div",{className:"absolute left-0 right-0 top-0 bottom-0 z-10 flex items-center justify-center w-full h-full bg-[#202020] rounded-[8px] md:rounded-[14px]",children:(0,T.jsx)(w.A,{width:32,height:32,color:"#ffffff"})}),(0,T.jsx)("div",{className:`absolute z-20 ${o?"left-[10px] top-[10px] md:bottom-[10px] md:right-[12px] md:top-auto md:left-auto":"right-[12px] bottom-[10px]"}`,children:u&&(0,T.jsxs)("button",{className:`toggleParticipantVideoButton transition-opacity group-hover:fine-pointer:opacity-100 w-[41px] h-[41px] rounded-[14px] bg-[#bbbbbb]/30 backdrop-blur-sm hover:bg-[#bbbbbb]/40 flex items-center justify-center relative videoCall-media-toggle-btn ${l!==e.userId&&e.hasVideo?"flex":"hidden"} ${e.subscribedToVideo?"fine-pointer:opacity-0":"fine-pointer:opacity-100"}`,onClick:()=>e.subscribeToVideo(!e.subscribedToVideo),type:"button",children:[!e?.subscribedToVideo&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[26px] rounded-[4px] -rotate-45 absolute z-10 left-[18px] top-[8px] red-strikethrough participantVideoToggle cursor-pointer"}),(0,T.jsx)("img",{alt:e?.subscribedToVideo?"Camera Off":"Camera On",src:"/camera-on-icon-white.svg",className:"w-[18px] h-[14px]"})]})})]})]},`${e.streamId}-${"screen"===e.position.type?"screen":e.userId}`)},`${e.streamId}-videoCard`)}),j.map(e=>(0,T.jsx)(ts.T,{namespace:"AudioOnlyStream",children:(0,T.jsx)("div",{className:"absolute -left-[1000px] -top-[1000px] w-px h-px bg-transparent",children:(0,T.jsx)(to,{stream:e})})},`${e.streamId}-audio-only`)),!1]})})}r(26885);var td=r(91441),tp=r(33814),tu=r(10942);function th({stream:e,onClick:t}){if(!e||!e.user)return null;let r=(0,S.Nc)(e.user.FirstName,e.user.LastName),i="Url"in e.user&&!!e.user.Url,n=e.isConnected?"Connected":"Not here",a=i?`Expert \xb7 ${n}`:n;return(0,T.jsxs)(tu.YP,{className:"-mx-6 cursor-pointer",onClick:t,children:[(0,T.jsx)(tu.z3,{participants:[e.user],allowCurrentUser:!0,size:{single:32,multi:32},linked:!1}),(0,T.jsx)(tu.ez,{children:r}),a&&(0,T.jsx)(tu.W_,{children:a}),(0,T.jsx)(tu.$Q,{children:e.isConnected&&(0,T.jsxs)("div",{className:"flex gap-3 cursor-auto",children:[(0,T.jsxs)("div",{className:"relative",children:[(0,T.jsx)("img",{src:"/camera-on-icon.svg",alt:"Camera",className:"w-[18px] h-[18px]"}),(!e.hasVideo||!e.subscribedToVideo)&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[1.5px] h-[22px] rounded-[4px] ring-[#fff] -rotate-45 ring-1 absolute z-10 left-[8px] -top-[2px]"})]}),(0,T.jsxs)("div",{className:"relative",children:[(0,T.jsx)("img",{src:"/microphone-on-icon.svg",alt:"Mic",className:"w-[18px] h-[18px]"}),!e.hasAudio&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[1.5px] h-[22px] rounded-[4px] ring-[#fff] -rotate-45 ring-1 absolute z-10 left-[8px] -top-[2px]"})]})]})})]})}var tm=r(67768),tx=r(74359),tf=r(20848),tw=r.n(tf),tg=r(92545),tb=r.n(tg),tv=r(7579),tS=r(96428),ty=r(76556),tj=r(89918),tk=r(8954);b().extend(tw()),b().extend(tb());let tE=({title:e,value:t})=>(0,T.jsxs)("div",{className:"flex flex-col items-center justify-center gap-[4px] bg-[#f1f2f7] rounded-[8px] px-[20px] py-[24px]",children:[(0,T.jsx)("p",{className:"text-[32px] text-center font-semibold text-charcoal leading-tight",children:t}),(0,T.jsx)("p",{className:"text-[16px] text-center font-medium text-charcoal leading-[1.2] px-2",children:(e=>{let t=e.split(" ");if(t.length<=2)return(0,T.jsxs)(T.Fragment,{children:[t[0],t.length>1&&(0,T.jsx)("br",{}),t[1]]});let r=Math.ceil(t.length/2),i=t.slice(0,r).join(" "),n=t.slice(r).join(" ");return(0,T.jsxs)(T.Fragment,{children:[i,(0,T.jsx)("br",{}),n]})})(e)})]}),tN=({subscription:e})=>{let t=e.StartAt?b()().diff(b()(e.StartAt),"month"):0,r=0===e.Price?"Free":`$${e.Price}`;return(0,T.jsxs)("div",{className:"w-full border border-[#c9c9c9] rounded-[6px] overflow-hidden",children:[(0,T.jsxs)("div",{className:"px-[20px] pt-[25px] pb-[25px]",children:[(0,T.jsx)("p",{className:"text-[23px] text-charcoal leading-[32px]",children:e.Tier?.Title||"Subscription"}),e.Tier?.Perks&&e.Tier.Perks.length>0&&(0,T.jsxs)("div",{className:"mt-[14px]",children:[(0,T.jsx)("p",{className:"text-[17px] font-medium text-charcoal",children:"What's included:"}),(0,T.jsx)("div",{className:"pt-[6px] space-y-[2px]",children:e.Tier.Perks.map(e=>(0,T.jsxs)("div",{className:"flex items-start gap-[10px]",children:[(0,T.jsxs)("svg",{className:"w-[13px] h-[13px] mt-[4px] flex-shrink-0",viewBox:"0 0 13 13",fill:"
5currentColor",xmlns:"http://www.w3.org/2000/svg",children:[(0,T.jsx)("circle",{cx:"6.5",cy:"6.5",r:"6.5",fill:"#6B6A6F"}),(0,T.jsx)("path",{d:"M9.5 4.5L5.5 8.5L3.5 6.5",stroke:"white",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]}),(0,T.jsx)("span",{className:"text-[17px] text-[#6B6A6F] leading-[28px]",children:e})]},e))})]}),(0,T.jsx)("p",{className:"text-[21px] text-charcoal font-medium mt-[16px]",children:0===e.Price?"Free":`${r} / Month`})]}),(0,T.jsxs)("div",{className:"border-t border-[#c9c9c9] px-[20px] py-[20px] flex items-center justify-between",children:[(0,T.jsx)("span",{className:"text-[20px] text-charcoal",children:t<=0?"New sub":`${t} month${1===t?"":"s"}`}),e.Tier&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("span",{className:"text-[26px] font-bold text-charcoal",children:"•"}),(0,T.jsx)("span",{className:"text-[20px] text-charcoal",children:(()=>{let r=e.Price*Math.max(t,1);return r>1e6?`$${(r/1e6).toFixed(2).replace(/\.?0+$/,"")}M Spent`:r>1e3?`$${(r/1e3).toFixed(2).replace(/\.?0+$/,"")}K Spent`:`$${r} Spent`})()})]})]}),e.RenewsAt&&(0,T.jsx)("div",{className:"border-t border-[#c9c9c9] px-[20px] py-[20px] text-center",children:(0,T.jsx)("span",{className:"text-[18px] font-medium text-charcoal",children:(()=>{let t=b()(e.RenewsAt);return t.isToday()?"Renews today":t.isTomorrow()?"Renews tomorrow":`Renews on ${t.format("M/D")}`})()})}),e.ExpiresAt&&!e.RenewsAt&&(0,T.jsx)("div",{className:"border-t border-[#c9c9c9] px-[20px] py-[20px] text-center",children:(0,T.jsx)("span",{className:"text-[18px] font-medium text-[#DB0202]",children:(()=>{let t=b()(e.ExpiresAt);return t.isToday()?"Expiring today":t.isTomorrow()?"Expiring tomorrow":`Expiring on ${t.format("M/D")}`})()})})]})},tI=({sharedThreadId:e,expertLinkUrl:t,isSelf:r,className:n})=>{let a=(0,i.useMemo)(()=>{let i=0;return t&&(i+=2),r&&(i-=1),e&&(i+=1),i},[t,r,e]);return(0,T.jsxs)("div",{className:ef()(a<=2?"flex justify-center gap-3 py-4":"grid grid-cols-3 gap-3 w-full",n),children:[t&&(0,T.jsxs)("a",{type:"button",className:ef()("px-4 py-2 rounded-[12px] flex items-center justify-center transition-colors duration-200 border-solid border-2 border-charcoal text-charcoal disabled:opacity-50 disabled:cursor-not-allowed gap-2",a<=2?"min-w-[160px]":"grid-col-span-1"),href:(0,tS.O)(t,{query:{source:"intro"}}),target:"_blank",rel:"noreferrer",children:[(0,T.jsx)("img",{src:"/profile-icon.svg",alt:"Profile",className:"w-[15px] h-[19px]"}),a<=2?"View profile":""]}),t&&!r&&(0,T.jsxs)("a",{type:"button",className:ef()("px-4 py-2 rounded-[12px] flex items-center justify-center transition-colors duration-200 border-solid border-2 border-charcoal text-charcoal disabled:opacity-50 disabled:cursor-not-allowed gap-2",a<=2?"min-w-[160px]":"grid-col-span-1"),href:(0,tS.O)(t,{query:{source:"intro",bookView:"book"}}),target:"_blank",rel:"noreferrer",children:[(0,T.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"19",height:"20",fill:"none",viewBox:"0 0 15 16",children:[(0,T.jsx)("path",{stroke:"#1E1D24",strokeWidth:"1.2",d:"M14.4 5.256v6.823a2.32 2.32 0 0 1-2.32 2.32H2.92A2.32 2.32 0 0 1 .6 12.08V5.256h13.8Z"}),(0,T.jsx)("ellipse",{cx:"7.465",cy:"8.46",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("ellipse",{cx:"7.465",cy:"11.503",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("ellipse",{cx:"4.166",cy:"8.46",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("ellipse",{cx:"4.166",cy:"11.503",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("ellipse",{cx:"10.766",cy:"8.46",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("ellipse",{cx:"10.766",cy:"11.503",fill:"#1E1D24",rx:".75",ry:".761"}),(0,T.jsx)("rect",{width:"1.8",height:"3.042",x:"9.3",y:".699",fill:"#1E1D24",rx:".9"}),(0,T.jsx)("rect",{width:"1.8",height:"3.042",x:"3.9",y:".699",fill:"#1E1D24",rx:".9"}),(0,T.jsx)("path",{fill:"#1E1D24",d:"M8.85 2.962c0 .729.591 1.32 
51.32 1.32h.06a1.32 1.32 0 0 0 1.32-1.32V1.918h.53A2.92 2.92 0 0 1 15 4.838v.73H0v-.73a2.92 2.92 0 0 1 2.92-2.92h.53v1.044c0 .729.591 1.32 1.32 1.32h.06a1.32 1.32 0 0 0 1.32-1.32V1.918h2.7v1.044Z"})]}),a<=2?"Book a time":""]}),e&&(0,T.jsxs)("a",{href:`/chat/${e}`,target:"_blank",rel:"noopener noreferrer",className:ef()("px-4 py-2 rounded-[12px] flex items-center justify-center transition-colors duration-200 border-solid border-2 border-charcoal text-charcoal disabled:opacity-50 disabled:cursor-not-allowed gap-2",a<=2?"min-w-[160px]":"grid-col-span-1"),children:[(0,T.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"18",height:"18",viewBox:"0 0 31 34",className:"rotate-45 -mb-[1px]",children:[(0,T.jsx)("title",{children:"Chat Icon"}),(0,T.jsx)("path",{fill:"#2e2e2e",fillRule:"nonzero",stroke:"#1E1D24",strokeWidth:.5,d:"M15.529.468c8.154-.02 14.76 6.455 14.742 14.471-.016 6.545-4 12.125-10.008 13.94-.16.048-.532.171-.588.188a4 4 0 0 1-.37.096l-.119.022-.007.011-.05.071-.057.083c-.1.148-.215.33-.365.576l-.428.712c-.156.26-.283.466-.408.66-.858 1.338-1.411 1.94-2.398 1.95-.983.011-1.552-.587-2.394-1.872a25 25 0 0 1-.455-.727c-.088-.145-.381-.634-.433-.718a17 17 0 0 0-.422-.669l-.04-.057h-.012a5 5 0 0 1-.341-.069l-.161-.04c-.125-.034-.577-.173-.68-.203C4.564 27.143.715 21.61.73 14.998.75 6.986 7.38.488 15.53.468m.006 2.54C8.772 3.026 3.286 8.403 3.27 15.005c-.013 5.515 3.127 10.028 7.98 11.45.14.041.554.169.627.189.081.021.156.038.26.055q.121.02.31.045c.683.086.97.404 1.497 1.2.122.183.251.39.422.673l.43.715c.158.26.287.467.408.652q.113.171.212.311l.035.05.062-.088q.052-.075.106-.157l.114-.173c.11-.171.225-.36.37-.6l.432-.719a17 17 0 0 1 .432-.68c.506-.75.832-1.097 1.496-1.196.14-.02.24-.038.315-.054a2 2 0 0 0 .157-.04c.014-.005.39-.13.593-.19 4.919-1.486 8.188-6.067 8.202-11.514.015-6.597-5.438-11.94-12.195-11.924"})]}),a<=2?"Message":""]})]})};function tC({participantId:e}){let{currentUser:t}=(0,p.A)(),r=(0,tp.Vz)(),i=(0,tm.jE)(),{width:n}=(0,k.A)(),a=t.Id===Number(e),s=e?.toString()??"",o=i.getQueryData(tv.lH.users.detail(s)),{data:l}=(0,tx.I)({queryKey:tv.lH.users.detail(s),queryFn:async()=>{if(a)return{...t,RelationshipDetails:null};let r=null,i=null,n=await (0,$.FH)({url:`/users/${e}`,method:"GET"});if(n.ok&&(i=await n.json()),t.Expert&&!a){let t=await (0,$.FH)({url:`/users/${e}/relationship`,method:"GET"});t.ok&&(r=await t.json())}return{...i??o??{},RelationshipDetails:r}},enabled:!!e}),{data:c,isLoading:d}=(0,tx.I)({queryKey:["expert",e],queryFn:async()=>{let t=await (0,$.FH)({url:`/experts/${e}`});return t.ok?await t.json():null},enabled:!!e&&!a}),{data:u,isLoading:h}=(0,ty.KS)([t.Id,Number(e)],{enabled:!!t.Id&&!!e&&!a,allPossibleThreads:!0});if(!l)return(0,T.jsx)("div",{className:"flex w-full flex-col items-center gap-[10px] pt-[64px] px-[20px]",children:(0,T.jsx)(w.A,{color:"#ddd",width:40,height:40})});let m=l.RelationshipDetails?.CurrentSubscription,x=l.RelationshipDetails,f=x?.TotalSpend===0&&!x?.TotalBookings&&!x?.CurrentSubscription,g=(0,S.Nc)(l.FirstName,l.LastName);return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("div",{className:"sticky flex bg-white top-0 z-10 items-center py-[18px] px-[24px] min-h-[80px] gap-3",children:(0,T.jsx)("button",{type:"button",className:`w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 -ml-[10px] ${n<768?"":"hover:bg-gray-100"}`,onClick:()=>r.pop(),"aria-label":"Go back",children:(0,T.jsx)(tk._,{icon:"left"})})}),(0,T.jsxs)("div",{className:"flex w-full flex-col items-center gap-[16px] px-[20px]",children:[(0,T.jsx)("div",{className:"relative flex-shrink-0",children:(0,T.jsx)(tj.A,{allowCurrentUser:!0,participants:[{Id:l.Id,FirstName:l.FirstName,LastName:l.LastName,Avatar:l.Avatar}],linked:!1,size:{single:100,multi:60},backgroundColor:"#ffffff",className:"!mr-0"})}),(0,T.jsxs)("div",{className:"flex flex-col items-center pb-[24px]",children:[(0,T.jsxs)("h2",{className:"font-medium text-[#060606] text-[26px] leading-tight text-center max-w-[234px] break-words text-wrap-pretty",children:[g,a&&" (You)",c?.TopExpert&&(0,T.jsx)("img",{src:"/checkmark-gold.svg",alt:"Top Expert Badge",className:"w-4 h-4 inline-block ml-[4px] mb-1"}),c?.Verified&&!c?.TopExpert&&(0,T.jsx)("img",{src:"/checkmark-blue.svg",alt:"Verified Expert Badge",className:"w-4 h-4 inline-block ml-[4px] mb-1"})]}),c?.Title?(0,T.jsx)("p",{className:"text-[16px] font-normal text-[#807F7F] text-center max-w-[234px] leading-tight break-words text-wrap-pretty",children:c.Title}):(0,T.jsxs)("p",{className:"text-[16px] font-normal text-[#807F7F] text-center max-w-[234px] leading-tight break-words text-wrap-pretty",children:["Joined in ",b()(l.CreatedAt).format("YYYY")]})]}),!h&&!d&&(0,T.jsx)(tI,{sharedThreadId:u?.Id,expertLinkUrl:c?.Url,isSelf:a,className:"pb-[16
5px]"}),l.RelationshipDetails&&!f&&(0,T.jsxs)("div",{className:"flex flex-col w-full pb-[64px]",children:[(0,T.jsx)("p",{className:"text-[17px] font-semibold text-charcoal leading-tight pb-[16px]",children:"Dashboard"}),(0,T.jsxs)("div",{className:"grid grid-cols-2 gap-[8px]",children:[(0,T.jsx)(tE,{title:"Total Revenue",value:(0,S.tH)(l.RelationshipDetails?.TotalSpend||0)||"$0"}),(0,T.jsx)(tE,{title:"Total Bookings",value:(l.RelationshipDetails?.TotalBookings??0).toString()}),(0,T.jsx)(tE,{title:"Call Credits Remaining",value:`${(l.RelationshipDetails?.AvailableMeetingCreditsDuration??0).toLocaleString()}m`}),(0,T.jsx)(tE,{title:"Time until Renewal",value:(()=>{let e=l.RelationshipDetails?.CurrentSubscription?.RenewsAt;if(!e)return"—";let t=b()(e).diff(b()(),"day");return t>0?`${t}d`:"—"})()}),(0,T.jsx)(tE,{title:"Subscription Revenue",value:l.RelationshipDetails?.CurrentSubscription?.Price!==0&&l.RelationshipDetails?.CurrentSubscription?.Price?(0,S.tH)(l.RelationshipDetails?.CurrentSubscription?.Price):"$0"}),(0,T.jsx)(tE,{title:"Total months Subscribed",value:(()=>{let e=l.RelationshipDetails?.CurrentSubscription?.StartAt;return e?b()().diff(b()(e),"month").toString():"0"})()})]}),m&&(0,T.jsxs)("div",{className:"pt-[30px]",children:[(0,T.jsx)("p",{className:"text-[17px] font-semibold text-charcoal leading-tight pb-[16px]",children:"Subscription"}),(0,T.jsx)(tN,{subscription:m})]})]})]})]})}var tD=r(79221);let tA=({children:e,onClose:t})=>{let{width:r}=(0,k.A)(),i=r<768;return(0,T.jsxs)("div",{className:"sticky flex bg-white top-0 z-10 items-center py-[18px] px-[24px] min-h-[80px] gap-3",children:[(0,T.jsx)("button",{type:"button",className:`w-8 h-8 flex items-center justify-center rounded-full transition-colors duration-200 -ml-[10px] ${i?"":"hover:bg-gray-100"}`,onClick:t,"aria-label":"Close drawer",children:(0,T.jsx)(tk._,{icon:i?"down":"right"})}),(0,T.jsx)("div",{className:"flex flex-col gap-0",children:e})]})},tT=(0,tp.gY)(),tP=({expertStream:e,ownerStream:t,participantStreams:r,meeting:n,onClose:a})=>{let s=(0,tp.Vz)();(0,td.uS)();let o=(0,i.useRef)(null),[l,c]=(0,i.useState)(!1),d=[e,t,...r??[]].filter(e=>e&&e.user),p=new Map;for(let e of d){let t=Number(e.userId??e.user?.Id);Number.isFinite(t)&&p.set(t,e)}let u=[n.Expert,n.User,...n.Participants??[]].filter(Boolean),h=d.map(e=>e.user).filter(e=>!!e),m=[],x=new Set;for(let e of u)x.has(e.Id)||(x.add(e.Id),m.push(e));for(let e of h)x.has(e.Id)||(x.add(e.Id),m.push(e));let f=m.map(e=>{let t=p.get(e.Id);return{hasAudio:!1,hasVideo:!1,subscribedToVideo:!1,isConnected:!1,userId:e.Id,user:e,streamId:`participant-${e.Id}`,...t??{}}}),w=(n.Participants??[]).length<5&&n.InviteLink;return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(tA,{onClose:a,children:(0,T.jsx)("h1",{className:"text-[19px] font-medium text-[#1E1D24] leading-tight",children:"Participants"})}),w&&(0,T.jsx)("div",{className:"px-[24px] pt-[24px] pb-[8px]",children:(0,T.jsxs)("div",{className:"flex flex-col gap-[9px] w-full",children:[(0,T.jsx)("p",{className:"text-[15px] text-[#606060] leading-[19px]",children:"Invite link"}),(0,T.jsxs)("div",{className:"relative w-full h-[56px]",children:[(0,T.jsx)("input",{ref:o,type:"text",readOnly:!0,value:n.InviteLink||"",className:"w-full h-full bg-[#F4F5F7] pl-[17px] pr-[120px] py-[12px] text-[17px] text-[#1E1D24] rounded-xl text-ellipsis whitespace-nowrap focus:outline-none focus:ring-0 focus:border-none",onFocus:e=>e.target.select()}),(0,T.jsx)("button",{type:"button",onClick:async()=>{if(!l&&n.InviteLink)try{await navigator.clipboard.writeText(n.InviteLink),c(!0),o.current?.select(),setTimeout(()=>c(!1),2e3)}catch{}},className:"absolute flex items-center justify-center right-[8px] top-[8px] bottom-[8px] bg-black text-white px-[16px] py-[12px] rounded-[8px] text-[14px] hover:bg-[#333] transition-colors",children:l?"Copied!":"Copy link"})]})]})}),(0,T.jsx)("ul",{className:"text-[#1d1d1d] flex flex-col gap-2 px-[24px] z-0 pt-[16px]",children:f.map(e=>e&&e.user?(0,T.jsx)("li",{children:(0,T.jsx)(th,{stream:e,onClick:()=>{s.push("member-details",{participantId:e.userId})}})},`${e.streamId}-participant`):null)})]})},tM=({meeting:e,onClose:t})=>(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(tA,{onClose:t}
5),(0,T.jsx)(tD.A,{setSessionDetailsOpen:t,sessionDetails:e.PreMeetingAnswers??[],canEdit:!1,hosting:!0,hideHeader:!1,stickyHeader:!1})]}),tR=({expertStream:e,ownerStream:t,participantStreams:r,meeting:n,onClose:a,view:s})=>{let o=(0,tp.Vz)();return(0,i.useEffect)(()=>{o&&s&&o.replace(s,void 0)},[o,s]),(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(tT,{path:"participants",isDefault:!0,children:(0,T.jsx)(tP,{expertStream:e,ownerStream:t,participantStreams:r,meeting:n,onClose:a})}),(0,T.jsx)(tT,{path:"member-details",children:e=>e?(0,T.jsx)(tC,{participantId:e.participantId}):null}),(0,T.jsx)(tT,{path:"sessionDetails",children:(0,T.jsx)(tM,{meeting:n,onClose:a})})]})},tV=e=>(0,T.jsx)(tp.mq,{children:(0,T.jsx)(tR,{...e})}),t$=({id:e,defaultSelected:t,onButtonClick:r,mediaOff:n,wrapperClasses:a,videoSrcOptions:s,audioInSrcOptions:o,audioOutSrcOptions:l,selectedVideoSrcOption:c,selectedAudioInSrcOption:d,selectedAudioOutSrcOption:p,videoSrcOptionClick:u,audioInputOptionClick:h,audioOutputOptionClick:m,classes:x,optionClasses:f,optionsWrapperClasses:w,optionsMaxHeight:g,onClose:b,onOpen:v,getAllMediaDevices:S})=>{let[y,j]=(0,i.useState)(n),[E,N]=(0,i.useState)(null),{openDropdownId:I,setOpenDropdownId:C}=(0,L.o$)(),{width:D}=(0,k.A)(),A=D<800,P=(0,i.useRef)(n),M=(0,i.useRef)(null),R=I===e,V=(0,i.useRef)(null),$=(0,i.useRef)(null);(0,i.useEffect)(()=>{R?v?.():b?.()},[R]),(0,i.useEffect)(()=>{j(n),P.current=n},[n]),(0,i.useEffect)(()=>()=>{M.current&&clearTimeout(M.current)},[]);let F=[];F=s?[...s]:[...o??[],...l??[]];let _=t=>{let r=document.getElementById(e),i=t.target;V.current&&!V.current.contains(i)&&r&&!r.contains(i)&&C(null)},O=()=>{E&&("videoInput"===E.kind?u?.(E):"audioInput"===E.kind?h?.(E):m?.(E),C(null))};(0,i.useEffect)(()=>(R&&document.addEventListener("click",_),()=>{document.removeEventListener("click",_)}),[R]),(0,i.useEffect)(()=>{N(t??null)},[t]),(0,i.useEffect)(()=>{if(R){setTimeout(()=>{$?.current?.scrollIntoView({behavior:"auto",block:"center",inline:"center"})},10);let e=setInterval(()=>{try{S?.()}catch(e){console.error("Error getting media devices: ",e)}},1e3);return()=>clearInterval(e)}},[R]);let z=(e,t)=>{N(e),"video"===t?u?.(e):"audioInput"===t?h?.(e):m?.(e),C(null)};return(0,T.jsxs)("div",{className:`flex items-center justify-center md:justify-start md:hover:bg-[#dddddd] ${R?"bg-[#dddddd]":"bg-[#3D3D3D] md:bg-[#EAEAEA]"} h-[45px] w-[45px] md:h-[60px] md:w-auto videoCall-media-toggle-btn relative shrink-0 rounded-[14px] md:rounded-[20px] cursor-pointer`,children:[(0,T.jsxs)("button",{className:"rounded-tl-[20px] rounded-bl-[20px] md:pl-[14px] md:pr-[12px] flex-1 shrink-0 h-full flex items-center justify-center",onClick:()=>{j(!y),r?.(),M.current&&clearTimeout(M.current),M.current=window.setTimeout(()=>{P.current===n&&j(n)},1e3)},type:"button",children:[y&&(0,T.jsx)("span",{className:"bg-[#F25757] w-[2px] h-[25px] md:h-[30px] rounded-[4px] ring-[#3D3D3D] md:ring-[#EAEAEA] -rotate-45 ring-2 absolute z-10 md:left-[25px] md:top-[15px] left-[21px] top-[10px] red-strikethrough cursor-pointer"}),s?(0,T.jsx)("img",{alt:"camera on icon",className:"w-[20px] h-[20px] md:w-[24px] md:h-[22px] relative left-[1px] md:left-[2px] opacity-80 md:opacity-100",src:A?"/camera-on-icon-white.svg":"/camera-on-icon.svg"}):(0,T.jsx)("img",{alt:"microphone on icon",className:"w-[18px] h-[20px] md:w-[20px] md:h-[22px] relative md:left-[2px] opacity-80 md:opacity-100",src:A?"/microphone-on-icon-white.svg":"/microphone-on-icon.svg"})]}),(0,T.jsxs)("div",{className:`dropdown-container dark h-full rounded-tr-[20px] rounded-br-[20px] hidden md:flex ${a||""}`,ref:V,id:e,onKeyDown:t=>{if(" "===t.key)t.preventDefault(),R?E&&O():C(e);else if(R)switch(t.key){case"ArrowUp":t.preventDefault(),(()=>{let e=F.findIndex(e=>e.value===E?.value),t=e>0?e-1:F.length-1;N(F[t])})();break;case"ArrowDown":t.preventDefault(),(()=>{let e=F.findIndex(e=>e.value===E?.value),t=e<F.length-1?e+1:0;N(F[t])})();break;case"Enter":t.preventDefault(),O();break;case"Escape":t.preventDefault(),C(null)}else("ArrowUp"===t.key||"ArrowDown"===t.key)&&(t.preventDefault(),C(e))},"aria-haspopup":"listbox","aria-expanded":R,children:[(0,T.jsx)("div",{className:`media-src-button-arrow-container select-none hidden md:flex items-center justify-center rounded-tr-[20px] rounded-br-[20px] h-full py-0 pl-0 pr-[8px] ${x||""}`,onClick:t=>{t.stopPropagation(),S?.(),C(R?null:e)},children:(0,T.jsx)("div",{className:`media-src-button-arrow-wrapper w-[16px] h-[16px] rounded-[4px] p-[5px] flex items-center justify-center ${R?"is-open bg-[#AFA
5EAE]":""}`,children:(0,T.jsx)("img",{className:`relative transition ease-in-out duration-150 ${R?"-rotate-90":"rotate-90"}`,alt:"Arrow",width:6,height:8,src:"/dropdown-arrow-gray.svg"})})}),R&&(0,T.jsx)("div",{className:`dropdown-options pl-[10px] ${1===F.length?"pt-[14px] pb-[10px]":"pt-[18px] pb-[16px]"} pr-[10px] mb-[8px] min-w-full overflow-y-auto w-auto max-w-[300px] right-auto !left-[-50px] z-[101] ${w||""}`,style:{maxHeight:`${g}px`||"auto"},role:"listbox",children:function(){if(s)return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:"text-left pb-[12px] font-medium text-[14px]",children:"Select your camera"}),(0,T.jsx)("div",{className:"mt-[6px]",children:0===F.length?(0,T.jsx)("div",{className:"text-[14px] text-gray-400 italic py-[10px] text-center",children:"No cameras available"}):F.map(e=>(0,T.jsxs)("div",{ref:c?.value===e.value?$:null,role:"option","aria-selected":c===e,className:`dropdown-option select-none rounded-[6px] relative cursor-pointer my-[4px] font-medium !pr-[8px] !pl-[34px] !py-[10px] ${f||""} ${c?.value===e.value?"selected":""}`,onClick:()=>z(e,"video"),tabIndex:0,children:[c?.value===e.value?(0,T.jsx)("img",{alt:"selected",className:"w-[14px] h-[14px] absolute top-[15px] left-[10px]",src:"/white-outline-checkmark.svg"}):(0,T.jsx)("img",{alt:"camera",className:"w-[18px] h-[14px] absolute top-[15px] left-[8px]",src:"/camera-on-icon-white.svg"}),(0,T.jsx)("div",{className:"whitespace-nowrap text-ellipsis overflow-hidden",children:e.label})]},e.value))})]});let e=o??[],t=l??[];return(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:"text-left pb-[12px] font-medium text-[14px]",children:"Select a microphone"}),(0,T.jsx)("div",{className:"mt-[6px]",children:0===e.length?(0,T.jsx)("div",{className:"text-[14px] text-gray-400 italic py-[10px] text-center",children:"No microphones available"}):e.map(e=>(0,T.jsxs)("div",{ref:d?.value===e.value?$:null,role:"option","aria-selected":d===e,className:`dropdown-option select-none rounded-[6px] relative cursor-pointer my-[4px] font-medium !pr-[8px] !pl-[34px] !py-[10px] ${f||""} ${d?.value===e.value?"selected":""}`,onClick:()=>z(e,"audioInput"),tabIndex:0,children:[d?.value===e.value?(0,T.jsx)("img",{alt:"selected",className:"w-[14px] h-[14px] absolute top-[14px] left-[10px]",src:"/white-outline-checkmark.svg"}):(0,T.jsx)("img",{alt:"microphone",className:"w-[15px] h-[16px] absolute top-[13px] left-[10px]",src:"/microphone-on-icon-white.svg"}),(0,T.jsx)("div",{className:"whitespace-nowrap text-ellipsis overflow-hidden",children:e.label})]},e.value))}),(0,T.jsx)("div",{className:"border-b border-dashed border-b-white h-[1px] w-full mt-[20px] mb-[25px] opacity-40"}),(0,T.jsx)("p",{className:"text-left pb-[12px] font-medium text-[14px]",children:"Select a speaker"}),(0,T.jsx)("div",{className:"mt-[6px]",children:0===t.length?(0,T.jsx)("div",{className:"text-[14px] text-gray-400 italic py-[10px] text-center",children:"No speakers available"}):t.map(e=>(0,T.jsxs)("div",{ref:p?.value===e.value?$:null,role:"option","aria-selected":p===e,className:`dropdown-option select-none rounded-[6px] relative cursor-pointer my-[4px] font-medium !pr-[8px] !pl-[34px] !py-[10px] ${f||""} ${p?.value===e.value?"selected":""}`,onClick:()=>z(e,"audioOutput"),tabIndex:0,children:[p?.value===e.value?(0,T.jsx)("img",{alt:"selected",className:"w-[14px] h-[14px] absolute top-[14px] left-[10px]",src:"/white-outline-checkmark.svg"}):(0,T.jsx)("img",{alt:"speaker",className:"w-[16px] h-[11px] absolute top-[16px] left-[10px]",src:"/select-audio-output-icon-white.svg"}),(0,T.jsx)("div",{className:"whitespace-nowrap text-ellipsis overflow-hidden",children:e.label})]},e.value))})]})}()})]})]})},tF=()=>null,tL=({onClick:e,icon:t="/call-participants.svg",mobileIcon:r="/call-participants-mobile.svg",activeIcon:n="/call-participants-filled.svg",alt:a="Call participants",children:s,tooltipId:o="participants",active:l})=>{let{width:d}=(0,k.A)(),p=(0,i.useRef)(null),u=(0,tt.B)(s,tF),{openDropdownId:h,setOpenDropdownId:m}=(0,L.o$)(),x=l??h===o;(0,i.useEffect)(()=>{if(x&&u){let e=()=>{m(null)};return document.addEventListener("click",e),()=>{document.removeEventListener("click",e)}}return()=>{}},[x,u,m]);let f=()=>
5{m(x?null:o),!x&&p.current&&p.current.focus()},w=t=>{("Enter"===t.key||" "===t.key)&&(t.preventDefault(),u&&f(),e?.())};return(0,T.jsxs)("div",{className:`flex items-center justify-center md:justify-start ${x?"bg-[#dddddd] md:bg-[#737373] md:fill-[#767676]":"bg-[#3D3D3D] md:bg-[#EAEAEA] md:hover:bg-[#dddddd]"} h-[45px] w-[45px] md:h-[60px] md:w-[60px] relative shrink-0 rounded-[14px] md:rounded-[20px] cursor-pointer`,children:[(0,T.jsx)("button",{className:"rounded-[20px] md:pl-[14px] md:pr-[12px] flex-1 shrink-0 h-full flex items-center justify-center",onClick:t=>{t.stopPropagation(),u&&f(),e?.()},type:"button",onKeyDown:w,children:(0,T.jsx)("img",{alt:a,src:x?n:d<800?r:t,className:"h-[21px] md:h-[23px]"})}),(0,T.jsx)(eI.N,{children:x&&u&&(0,T.jsx)(c.P.div,{ref:e=>{e&&e.focus()},initial:{opacity:0,y:10},animate:{opacity:1,y:0},exit:{opacity:0,y:5},className:"bg-[#1e1e1e] absolute bottom-full mb-2 top-auto left-0 max-w-[300px] min-w-[300px] max-h-[300px] rounded-[8px] flex flex-col",onKeyDown:w,onClick:e=>{e.stopPropagation()},tabIndex:0,"aria-haspopup":"listbox","aria-expanded":x,children:u.props.children})})]})};tL.Tooltip=tF;let t_=({hasScreenShare:e,isMobile:t,call:r,screenShareStream:i,isScreenShareSupported:n,videoInput:a,audioInput:s,audioOutput:o,handleToggleVideo:l,handleVideoSrcOptionChange:c,handleToggleMute:d,handleAudioSrcOptionChange:p,handleAudioOutputOptionChange:u,setPollDevices:h,handleToggleScreenShare:m,setOpenDrawer:x,openDrawer:f,meeting:w,altTimerView:g,callStarted:b,onCallStart:v,onCallEnd:y,onMeetingExtended:j,onTimerTick:k,hosting:E,expertCanExtend:N,meetingId:I,setPromptToEndCall:C,promptToEndCall:D,handleCloseCall:A,mpTrackEvent:P,handleEndCall:M,className:R,isInPip:V})=>(0,T.jsxs)("div",{className:ef()("w-full flex-0 justify-center font-semibold text-white text-[18px] flex items-center py-[8px] md:py-[30px] gap-[16px]",R),children:[e&&t&&(0,T.jsxs)("button",{className:`w-auto max-w-[120px] h-[45px] rounded-[14px] px-[10px] relative ${r.screenShareEnabled?"bg-dark-purple hover:bg-dark-purple":"bg-[#3D3D3D]"} flex items-center justify-center`,disabled:e&&!r.screenShareEnabled,onClick:m,type:"button",children:[(0,T.jsx)("img",{alt:r.screenShareEnabled?"Stop sharing screen":"Share screen",src:r.screenShareEnabled?"/screenshare-active-icon.svg":"/share-screen-icon-mobile.svg",className:"w-[30px] h-[26px]"}),r.screenShareEnabled?null:(0,T.jsx)("p",{className:"text-[#BCBCBC] text-[14px] text-ellipsis overflow-hidden whitespace-nowrap font-normal w-full ml-[8px]",children:(0,S.Nc)(i.user?.FirstName,i.user?.LastName)})]}),(0,T.jsxs)("div",{className:"flex gap-[8px] z-50",children:[(0,T.jsx)(t$,{id:"videoInputDropdown",selectedVideoSrcOption:a.find(e=>e.active),wrapperClasses:"position-top",videoSrcOptions:a,mediaOff:!(!r.mainPublisherStream||r.cameraEnabled),onButtonClick:l,videoSrcOptionClick:c,onOpen:()=>{h(!0)},onClose:()=>{h(!1)}}),(0,T.jsx)(t$,{id:"audioInputDropdown",selectedAudioInSrcOption:s.find(e=>e.active),selectedAudioOutSrcOption:o.find(e=>e.active),wrapperClasses:"position-top",audioInSrcOptions:s,audioOutSrcOptions:o,mediaOff:!(!r.mainPublisherStream||r.audioEnabled),onButtonClick:d,audioInputOptionClick:p,audioOutputOptionClick:u,onOpen:()=>{h(!0)},onClose:()=>{h(!1)}}),(0,T.jsx)(tL,{active:"participants"===f,onClick:()=>{x("participants"===f?null:"participants")}}),n&&!t&&(0,T.jsx)("button",{className:`w-[45px] h-[45px] md:w-[60px] md:h-[60px] rounded-[14px] md:rounded-[20px] relative shrink-0 ${r.screenShareEnabled?"bg-dark-purple hover:bg-dark-purple":"bg-[#EAEAEA]"} flex items-center justify-center ${e&&!r.screenShareEnabled?"opacity-50 cursor-not-allowed":"hover:bg-[#dddddd]"}`,disabled:e&&!r.screenShareEnabled,onClick:m,type:"button",children:(0,T.jsx)("img",{alt:r.screenShareEnabled?"Stop sharing screen":"Share screen",src:r.screenShareEnabled?"/screenshare-active-icon.svg":"/share-screen-icon.svg",className:"w-[30px] h-[26px]"})})]}),(0,T.jsx)("div",{className:"w-[2px] h-[45px] md:h-[60px] bg-[#E7E7E7] rounded-md hidden md:block"}),w&&!t&&(0,T.jsxs)("div",{className:"flex items-center justify-center",children:[(0,T.jsx)(eV,{startAt:w.StartAt,altTimerView:g,duration:w.Duration,onCallStart:v,onCallEnd:y,onTick:k,callStarted:b}),E&&N&&!t&&(0,T.jsx)(eD,{meetingId:I,buttonCallback:j})]}),!t&&(0,T.jsx)("div",{className:"w-[2px] h-[45px] md:h-[60px] bg-[#3D3D3D] md:bg-[#E7E7E7] rounded-md"}),(0,T.jsxs)("div",{className:"relative shrink-0",children:[(0,T.jsxs)("button",{className:`h-[45px] md:h-[60px] rounded-[14px] md:rounded-[20px] flex items-center justify-center text-white ${D?"bg-[#3D3D3D] md:bg-[#1E1E1E] w-[75px]":"hover:bg-[#e95050] bg-[#F25757] w-[75px]"}`,onClick:()=>C(!D),type:"button",children:[(0,T.jsx)("span",{className:`text-[15px] font-normal cursor-pointer select-none ${D?"block":"hidden"}`,children:"Cancel"}),(0,T.jsx)("img",{alt:"End call",src:"/white-phone.svg",className:`w-[19px] h-[19px] md:w-[26px] md:h-[26px] rotate-[136deg] mt-[3px] opacity-75 ${D?"hidden":"block"}`})]}),D&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("button",{type:"button","aria-label":"Close end call menu",className:"fixed w-full h-full bg-transparent left-0 top-0 z-[99]",onClick:e=>{e.stopPropagation(),C(!1)}}),(0,T.jsxs)("div",{className:"absolute bottom-[50px] md:bottom-[65px] right-0 md:right-auto md:left-0 bg-[#3D3D3D] md:bg-[#1E1E1E] rounded-[12px] py-[15px] px-[10px] z-[100] flex flex-col justify-start items-start",children:[(0,T.jsx)("button",{type:"button",className:"text-left px-[15px] py-[10px] font-normal rounded-[6px] bg-transparent hover:bg-[#3F3F3F] text-[15px] text-white whitespace-nowrap w-full",onClick:e=>{e.stopPropagation(),A()},children:"I'll be right back"}),(0,T.jsx)("button",{type:"button",className:"text-left px-[15px] py-[10px] font-normal rounded-[6px] bg-transparent hover:bg-[#3F3F3F] text-[15px] text-[#F25757] whitespace-nowrap w-full",onClick:e=>{e.stopPropagation(),P("Left Call",{"Call Id":w.Id}),M()},children:"End call"})]})]})]})]});var tO=r(378);function tz({visible:e,className:t,children:r}){let n=(0,i.useRef)(null);return(0,T.jsx)(tO.A,{nodeRef:n,in:e,timeout:200,classNames:"alert",unmountOnExit:!0,children:(0,T.jsx)("div",{ref:n,className:t,children:r})})}var tB=r(69891);function tU({compact:e=!1,onDismiss:t}){return(0,T.jsxs)("div",{className:"relative",children:[(0,T.jsx)("p",{className:`w-full px-7 font-semibold text-center text-charcoal ${e?"text-[20px] leading-7":"text-[24px] leading-8"}`,children:"Say goodbye"}),(0,T.jsx)("button",{type:"button",onClick:t,"aria-label":"Dismiss call ending prompt",className:"absolute right-[-12px] top-1/2 flex h-10 w-10 -translate-y-1/2 items-center justify-center rounded-full text-charcoal transition-colors can-hover:hover:bg-black/10",children:(0,T.jsx)(tB.I,{name:"close",size:16})})]})}let{publicRuntimeConfig:tH}=O()(),tW="video-call-media-health";function tq({meeting:e,requestStatus:t,sendingRequest:r,hosting:i,onRespondToExtensionRequest:n}){let{ExtensionRequest:a}=e;return a?"requested"===t?i?(0,T.jsxs)("div",{className:"w-full",children:[(0,T.jsxs)("p",{className:"text-[#6D6C6C] text-center font-semibold text-[16px] mt-0 mb-[26px]",children:["extend call by ",a.Duration," min"]}),(0,T.jsx)("button",{type:"button",onClick:()=>n("approve"),disabled:r,className:`font-sofia h-[75px] w-full text-white whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold cursor-pointer ${r?"bg-btn-inactive hover:bg-btn-inactive flex items-center justify-center":"bg-btn hover:bg-btn-hover"}
5`,children:r?(0,T.jsx)(w.A,{width:34,height:34,color:"#ffffff"}):(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("p",{className:"cursor-pointer text-[22px] leading-none mt-[2px]",children:"Tap to Accept"}),(0,T.jsxs)("p",{className:"cursor-pointer font-normal text-[16px] mt-[4px]",children:["Earn ",(0,S.$g)(a.Price,{decimalPoints:2,trim:"decimal"})]})]})}),(0,T.jsx)("div",{className:"text-center mt-[16px]",children:(0,T.jsx)("button",{type:"button",onClick:()=>n("decline"),className:"font-sofia whitespace-nowrap text-[16px] font-medium text-[#F44336] cursor-pointer",children:"Decline request"})})]}):(0,T.jsx)("div",{className:"font-sofia text-white text-center h-[75px] mt-[26px] w-full whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold bg-btn opacity-70 text-[22px] leading-[51px] select-none",children:"15 min requested"}):"approved"===t?(0,T.jsxs)("div",{className:"w-full block",children:[i&&(0,T.jsxs)("p",{className:"text-[#6D6C6C] text-center font-semibold text-[16px] mt-0 mb-[26px]",children:["You earned an additional ",(0,S.$g)(a.Price,{decimalPoints:2,trim:"decimal"})]}),(0,T.jsx)("div",{className:`font-sofia text-white w-full h-[75px] whitespace-nowrap flex-grow px-8 py-3 ${!i?"mt-[26px]":""} rounded-[4px] font-semibold bg-[#1ABE4A] text-center text-[22px] leading-[51px] select-none`,children:"Approved!"})]}):"declined"===t?(0,T.jsx)("div",{className:"font-sofia text-charcoal px-8 py-3 font-medium text-center mt-0",children:i?"Please let the caller know why you're unavailable. Thank you":"Please select another time slot after the call. Thank you"}):void 0:null}function tY({requestExtensionVisible:e,setRequestExtensionVisible:t,requestStatus:r,setRequestStatus:n,hasSentRequest:a}){let s=(0,i.useMemo)(()=>("approved"===r||"declined"===r)&&a?b()().add(5,"second").toDate():b()().add(30,"second").toDate(),[e,r,a]);if(!e)return null;let o="requested"===r&&a?"Request ends in":"Offer ends in";return(0,T.jsx)(v.Ay,{date:s,renderer:function({hours:e,minutes:t,seconds:i}){return(0,T.jsxs)("p",{className:`text-center text-[16px] ${"declined"!==r?"mt-[16px]":"mt-[6px]"} text-[#6D6C6C] font-medium ${("approved"===r||"declined"===r)&&a?"hidden":""}`,children:[o," ",(0,T.jsxs)("span",{className:"text-error",children:[(0,v.e8)(t,1),":",(0,v.e8)(i)]})]})},onComplete:()=>{t(!1),n(null)}})}function tJ({showEndCallModal:e,callEnd:t}){return e?(0,T.jsx)(v.Ay,{date:t,renderer:function({minutes:e,seconds:t}){return(0,T.jsxs)("p",{className:"text-center text-[16px] mt-[16px] text-[#6D6C6C] font-medium",children:["Call automatically ends in"," ",(0,T.jsxs)("span",{className:"text-red",children:[(0,v.e8)(e,1),":",(0,v.e8)(t)]})]})}}):null}let tK=({meeting:e,defaultVideoOff:t,defaultAudioMuted:r,refetchMeetingDetails:a,defaultCameraSourceId:s,defaultAudioSourceId:c,defaultAudioOutputId:d,meetingId:h})=>{let{addToast:m,removeToast:x}=(0,eN.d)(),f=(0,n.useRouter)(),{setStatus:g}=(0,ew.Xp)(),v=(0,i.useRef)(null),[y,j]=(0,i.useState)(!1),[E,N]=(0,i.useState)([]),{currentUser:I}=(0,p.A)(),{width:C}=(0,k.A)(),D=et("/sounds/extension-request-open.wav"),P=et("/sounds/screenshare-start.wav"),M=et("/sounds/hangup-call.wav"),V=et("/sounds/participant-join-call.wav"),F=et("/sounds/booking.wav"),L=C<800,_=e?.Expert?.Id===I?.Id,[O,Q]=(0,i.useState)(!1),[er,ei]=(0,i.useState)(!1),{call:en,hasScreenShare:ea,startScreenShare:es,screenShareStream:eo,stopScreenShare:el,ownerStream:ec,expertStream:ed,participantStreams:ep}=(({provider:e,streamClassName:t,pollDevices:r=!1,pollDevicesInterval:n=1e3,defaultAudioEnabled:a=!0,defaultVideoEnabled:s=!0,defaultAudioOutputDeviceId:o,defaultAudioSourceDeviceId:l,defaultVideoSourceDeviceId:c,echoCancellation:d,noiseSuppression:p,autoGainControl:u,expert:h,owner:m,participants:x,currentUserId:f})=>{let w=(0,i.useMemo)(()=>{if("opentok"===e)return new em;throw Error("Invalid provider")},[e]);"intro.co".includes("qa")&&(window.introCall=w);let g=(0,i.useMemo)(()=>[(...e)=>w.subscribe(...e),()=>w.getSnapshot()],[w]);(0,i.useEffect)(()=>{if(!r)return w.refreshDevices(),()=>{};let e=window.setInterval(()=>{w.refreshDevices()},n);return()=>{window.clearInterval(e)}},[r,n]);let b={hasAudio:!1,hasVideo:!1,isConnected:!1,loading:!1,subscribedToVideo:!1,subscribeToVideo:()=>{},getAudioTrack:()=>null,on:()=>{},off:()=>{}},v=(w.streams.map(e=>({streamId:e.streamId,hasAudio:e.hasAudio,hasVideo:e.hasVideo,shouldReconnect
5Video:e.shouldReconnectVideo,isConnected:e.isConnected,audioTrack:e.getAudioTrack(),name:e.name,userId:e.userId,videoType:e.streamType,videoDimensions:e.videoDimensions,subscribeToVideo:e.subscribeToVideo,subscribedToVideo:e.subscribedToVideo,getAudioTrack:e.getAudioTrack,on:e.on,off:e.off,loading:e.loading,child:(0,i.createElement)(eS,{stream:e,key:e.streamId,className:t,subscriptionOptions:e.userId!==h?.Id&&"screen"!==e.streamType?{resolution:"640x480"}:{resolution:"1920x1080"}}),creationTime:e.creationTime}))??[]).sort((e,t)=>e.creationTime-t.creationTime),S={streamId:"camera",hasAudio:w.mainPublisherStream?.hasAudio,hasVideo:w.mainPublisherStream?.hasVideo,isConnected:!0,name:w.mainPublisherStream?.name,userId:w.mainPublisherStream?.userId,videoType:w.mainPublisherStream?.streamType,videoDimensions:w.mainPublisherStream?.videoDimensions,getAudioTrack:w.mainPublisherStream?.getAudioTrack,child:(0,i.createElement)(ey,{key:"camera",className:t,call:w,audioEnabled:a,videoEnabled:s,audioInputDeviceId:l,videoInputDeviceId:c,audioOutputDeviceId:o,echoCancellation:d,noiseSuppression:p,autoGainControl:u}),on:w.mainPublisherStream?.on,off:w.mainPublisherStream?.off},y=w.isAttemptingScreenShare||w.screenShareEnabled?{streamId:"screen",key:"screen",hasAudio:w.screenPublisherStream?.hasAudio,hasVideo:w.screenPublisherStream?.hasVideo,isConnected:w.screenPublisherStream?.isConnected,name:w.screenPublisherStream?.name,userId:w.screenPublisherStream?.userId,videoType:w.screenPublisherStream?.streamType,videoDimensions:w.screenPublisherStream?.videoDimensions,child:(0,i.createElement)(ej,{key:"screen",className:t,call:w,audioEnabled:!1,videoEnabled:!0,onError:async e=>{console.log("screen share error",e)}}),on:w.screenPublisherStream?.on,off:w.screenPublisherStream?.off,setResolution:w.screenPublisherStream?.setResolution}:null,j=v.some(e=>"screen"===e.videoType)||w.screenShareEnabled,k=[h,m,...x].filter(e=>void 0!==e),E=v.map(e=>{let t=k.find(t=>t.Id===e.userId);return{...e,user:t}}),N=k.find(e=>e.Id===f),I=h?.Id===f,C=m?.Id===f,D={...b,...w.mainPublisherStream,isConnected:!0,user:N,child:S.child??null,type:"publisher",hasVideo:w.cameraEnabled,hasAudio:w.audioEnabled,hideOverlay:!0,videoType:"camera",videoDimensions:w.mainPublisherVideoDimensions,loading:!w.mainPublisherStream?.streamId,streamId:"my-stream",userId:w.mainPublisherStream?.userId},A=I?D:{...b,streamId:"expert",...E.find(e=>e.userId===h?.Id&&"camera"===e.videoType),user:h,userId:h?.Id},T=I?{...b,streamId:"owner",...E.find(e=>e.userId===m?.Id&&"camera"===e.videoType),user:m,userId:m?.Id}:D,P=E.filter(e=>e.streamId&&(e.streamId!==A.streamId||e.streamId!==T.streamId)&&"camera"===e.videoType),M=E.find(e=>"screen"===e.videoType),R=M?{...M,user:M.user??k.find(e=>e.Id===M.userId),videoDimensions:M.videoDimensions}:{videoDimensions:{width:0,height:0},streamType:"screen",getAudioTrack:()=>null,subscribedToVideo:!0,subscribe:()=>Promise.resolve(),unsubscribe:()=>{},attachElement:()=>{},subscribeToVideo:()=>{},on:()=>{},off:()=>{},...y,user:N,type:"publisher",hasAudio:!1,hideOverlay:!0,videoType:"screen",hasVideo:w.screenShareEnabled,loading:!y?.streamId,creationTime:Date.now(),isConnected:!0,name:"",userId:N?.Id??0,streamId:"screen-fallback"};return(0,i.useSyncExternalStore)(...g),{call:w,screenShareStream:R,mainPublisher:S,screenPublisher:y,hasScreenShare:j,startScreenShare:w.startScreenShare,stopScreenShare:w.stopScreenShare,cleanup:()=>w.cleanup(),ownerStream:T,expertStream:A,participantStreams:[!C&&!I?D:null,...P].filter(e=>!!e&&e.streamId!==T.streamId&&e.streamId!==A.streamId)}})({provider:"opentok",meetingId:e.Id,streamClassName:"video-call-stream bg-[#2d2d2d] w-full h-full overflow-hidden scale-[1.005] shadow-video-inset",pollDevices:O,defaultAudioEnabled:!r,defaultVideoEnabled:!t,defaultVideoSourceDeviceId:s,defaultAudioSourceDeviceId:c,defaultAudioOutputDeviceId:d,expert:e.Expert,owner:e.User,participants:e.Participants??[],currentUserId:I.Id}),{scheduleParticipantRefetchFallback:eu}=function({meeting:e,refetchMeetingDetails:t}){let r=(0,i.useRef)(new Set),n=(0,i.useRef)(new Map),a=(0,i.useRef)(null),s=(0,i.useRef)(!1),o=(0,i.useRef)(new Set),l=()=>{a.current||s.current||(a.current=setTimeout(async()=>
5{if(a.current=null,s.current)return;let e=Array.from(r.current);if(0===e.length)return;s.current=!0,e.forEach(e=>{let t=n.current.get(e)??0;n.current.set(e,t+1)}),r.current.clear();let i=null;try{i=await t()}catch(e){console.warn("Participant refetch fallback failed",e)}finally{let t=i?e$(i):o.current;i&&(o.current=t),e.forEach(e=>{if(t.has(e))return void n.current.delete(e);(n.current.get(e)??0)<2&&r.current.add(e)}),s.current=!1,r.current.size>0&&l()}},1e3))};return(0,i.useEffect)(()=>()=>{a.current&&clearTimeout(a.current)},[]),(0,i.useEffect)(()=>{let t=e$(e);o.current=t,t.forEach(e=>{r.current.delete(e),n.current.delete(e)})},[e]),{scheduleParticipantRefetchFallback:e=>{!(!e||o.current.has(e))&&((n.current.get(e)??0)>=2||(r.current.add(e),l()))}}}({meeting:e,refetchMeetingDetails:a}),[eh]=(0,i.useState)(!1),[ex,ef]=(0,i.useState)(!1),[eg,ev]=(0,i.useState)(!1),[ek,eI]=(0,i.useState)(!1),[eC,eA]=(0,i.useState)(!1),[eP,eM]=(0,i.useState)(!1),[eR,eF]=(0,i.useState)(!1),[eL,e_]=(0,i.useState)(!1),[eO,eB]=(0,i.useState)(null),[eU,eW]=(0,i.useState)(null),[eq,eY]=(0,i.useState)(null),[eJ,eK]=(0,i.useState)(!1),[eG,eZ]=(0,i.useState)(!1),[eX,eQ]=(0,i.useState)(!1),[e0,e1]=(0,i.useState)(null),[e2,e3]=(0,i.useState)(!1),[e5,e4]=(0,i.useState)(!1),[e6,e8]=(0,i.useState)(!1),[e7,e9]=(0,i.useState)(!1),te=e?.Expert?.Id===I?.Id,tt=(0,i.useRef)(null);(0,i.useRef)(null);let tr=(0,i.useRef)(!1),ti=(0,i.useMemo)(()=>b()(e.StartAt).add(e.Duration,"minute").toDate(),[e.StartAt,e.Duration]),tn=(0,S.Pv)(ti,e.ExpertExtendableUntil,e.Duration),ta=b().utc(e.StartAt).local().toDate(),ts=b()().isBefore(ta),{mpTrackEvent:to}=(0,B.A)(),tl="participant";_?tl="expert":e.User.Id===I.Id&&(tl="client");let tp=(({meetingId:e,callId:t,tokboxSessionId:r,participantId:n,participantRole:a,trackEvent:s})=>{let o=(0,i.useRef)(s),l=(0,i.useRef)({meetingId:e,callId:t,tokboxSessionId:r,participantId:n,participantRole:a}),c=JSON.stringify([e,r,n]),d=(0,i.useRef)();return d.current||(d.current=q(c)),(0,i.useEffect)(()=>{Y(d).identity!==c&&(d.current=q(c)),o.current=s,l.current={meetingId:e,callId:t,tokboxSessionId:r,participantId:n,participantRole:a}},[t,c,e,n,a,r,s]),(0,i.useMemo)(()=>{let e=e=>{let{meetingId:t,callId:r,tokboxSessionId:i,participantId:n,participantRole:a}=l.current,{callLegId:s,attemptStartedAt:o}=Y(d);return{"Call Id":t,Platform:"web","Session Id":i,"Participant Id":n,"Participant Role":a,"Call Leg Id":s,...e?{"Connection Id":e}:{},platform:"web",meeting_id:t,call_id:r||t.toString(),tokbox_session_id:i,participant_id:n,participant_role:a,call_leg_id:s,...e?{connection_id:e}:{},elapsed_ms:Math.max(0,Date.now()-o),timestamp:new Date().toISOString()}},t=(e,t,r,i="info")=>{try{H.Z({category:"web-call",message:e,level:i,data:t})}catch(e){}try{o.current(e,t,r)}catch(e){}};return{get callLegId(){return Y(d).callLegId},trackJoined:()=>{let r=Y(d);r.joinedTracked||(r.joinedTracked=!0,t("Joined Call",e()))},trackConnected:r=>{let i=Y(d);i.connectedTracked||(i.connectedTracked=!0,t("Call Connected",e(r)))},trackRefreshed:({reason:r,connectionId:i,onAccepted:n})=>{t("Refreshed Call",{...e(i),refresh_reason:r},{navigationSafe:!0,onAccepted:n})},trackConnectionFailure:({stage:r,error:i,connectionId:n,diagnosticContext:a={},navigationSafe:s=!1,captureDiagnostic:o=!0,diagnosticUnavailableReason:c})=>{let p,u=Y(d),{meetingId:h,participantRole:m}=l.current,{callLegId:x}=u,f=J(i);if(u.failedStages.has(r))return;u.failedStages.add(r);let w=`Web call connection failed at ${r}`,g=G(i),b=Object.fromEntries(Object.entries(a).filter(([,e])=>"boolean"==typeof e||"number"==typeof e&&Number.isFinite(e))),v={...e(n),"Failure Stage":r,"Error Name":K(f.name),"Error Message":w,...void 0!==g?{"Error Code":g}:{},stage:r,error_name:K(f.name),error_message:w,...void 0!==g?{error_code:g}:{}},S=o?"unavailable":"suppressed",y=c;if(o)try{let e=Error(w);S=(p=W.Cp(e,{tags:{platform:"web",meeting_id:h.toString(),participant_role:m,web_call_stage:r,call_leg_id:x},extra:{...v,...b}}))?"sentry":"unavailable",p||(y="sentry_event_id_unavailable")}catch(e){y="sentry_capture_failed"}t("Call Connect Failed",{...v,diagnostic_capture:S,...y?{diagnostic_capture_reason:y}:{},...p?{sentry_event_id:p}:{}},s?{navigationSafe:!0}:void 0,"error")},trackScheduledEndDetected:({trigger:r,overdueMs:i})=>{t("Call Scheduled End Detected",{...e(),"End Trigger":r,end_trigger:r,overdue_ms:Math.max(0,Math.round(i))},{navigationSafe:!0})},trackEndUnverified:({attempts:r,unverifiedForMs:i})=>{t("Call Ended Unverified",{...e(),"Verification Attempts":r,verification_attempts:r,unverified_for_ms:Math.max(0,Math.round(i))},{navigationSafe:!0},"error")},trackDisconnectFailed:({error:r,reason:i,failure:n})=>{let a=void 0===r?void 0:K(J(r).name),s=G(r);t("Call Disconnect Failed",{...e(),"Disconnect Reason":i,"Failure Mode":n,disconnect_reason:i,failure_mode:n,error_message:"Web call disconnect failed",...void 0!==a?{"Error Name":a,error_name:a}:{},...void 0!==s?{error_code:s}:{}},{navigationSafe:!0},"error")}}},[])})({meetingId:e.Id,callId:e.CallId,tokboxSessionId:e.TokBoxId,participantId:I.Id,participantRole:tl,trackEvent:to}),tu=()=>{try{window.documentPictureInPicture.window&&(window.documentPictureInPicture.window.close(),e3(!1))}catch(e){console.warn("Failed to close the picture-in-picture window",e)}},th=(e,t)=>{e&&!e.confirmed&&tp.trackDisconnectFailed({reason:t,failure:e.timedOut?"unconfirmed":"threw",...void 0!==e.errorName?{error:{name:e.errorName}}:{}})},tm=async(t=!0,r="manual_leave")=>{try{th(await en.disconnect(),r),tu()}catch(e){tp.trackDisconnectFailed({error:e,reason:r,failure:"exception"})}finally{if(eb.clear(),t){let t=()=>{let t=e?.User?.Id===I?.Id&&!ts;o.A.remove("hideWaitingRoom");let r=new URL(t?`/meetings/${e.Id}/review?fromCall=1`:"/meetings",window.location.origin);window.location.replace(r)},r=setTimeout(t,2e3);M.addEventListener("ended",()=>{clearTimeout(r),t()}),await M.play()}}},tx=(t=!1,r="manual_leave")=>{tr.current||(tr.current=!0,t?setTimeout(()=>{e8(!0),tm(!0,r),to("Left Call",{"Call Id":e.Id})},300):(e8(!0),tm(!0,r),to("Left Call",{"Call Id":e.Id})))},tf=()=>{eZ(!0)},{dismissEndCallPrompt:tw,handleAutoEndCall:tg,handleCallEndPromptTick:tb,showEndCallModal:tv}=function({callEnd:e,onEndCall:t,onMeetingExtended:r,onPrompt:n,refetchMeetingDetails:a,onScheduledEndDetected:s,onVerificationUnavailable:o}){let l=function({callEnd:e,onPrompt:t}){let[r,n]=(0,i.useState)(!1),a=(0,i.useRef)(null),s=(0,i.useRef)(t),o=e.getTime();return(0,i.useEffect)(()=>{s.current=t}),{dismissEndCallPrompt:(0,i.useCallback)(()=>{n(!1)},[]),handleCallEndPromptTick:(0,i.useCallback)(({hours:e,minutes:t,seconds:r})=>{0===e&&0===t&&20===r&&a.current!==o&&(a.current=o,n(!0),s.current())}
5,[o]),showEndCallModal:r}}({callEnd:e,onPrompt:n}),c=function({refetchMeetingDetails:e,onEndCall:t,onMeetingExtended:r,onVerificationUnavailable:n}){let a=(0,i.useRef)(e),s=(0,i.useRef)(t),o=(0,i.useRef)(r),l=(0,i.useRef)(n),c=(0,i.useRef)(null),d=(0,i.useRef)(!1),p=(0,i.useRef)(null),u=(0,i.useRef)(null),h=(0,i.useRef)(0),m=(0,i.useRef)(!1),x=(0,i.useRef)(!0),f=(0,i.useRef)(null);(0,i.useEffect)(()=>{a.current=e,s.current=t,o.current=r,l.current=n},[e,t,r,n]);let w=(0,i.useCallback)(()=>{p.current&&(clearTimeout(p.current),p.current=null),u.current&&(clearTimeout(u.current),u.current=null)},[]),g=(0,i.useCallback)(({attempts:e,unverifiedForMs:t})=>{!m.current&&x.current&&(m.current=!0,w(),h.current=0,c.current=null,l.current?.({attempts:e,unverifiedForMs:t}),s.current())},[w]),b=(0,i.useCallback)(async()=>{if(d.current||m.current)return;null===c.current&&(c.current=Date.now(),u.current=setTimeout(()=>{u.current=null,g({attempts:h.current+ +!!d.current,unverifiedForMs:12e4})},12e4)),d.current=!0;let e=null;try{e=await a.current()}catch(t){e=null}finally{d.current=!1}if(x.current&&!m.current){if(!e){let e=h.current+1,t=Date.now()-(c.current??Date.now());if(t>=12e4)return void g({attempts:e,unverifiedForMs:t});let r=h.current<3?1e3*2**h.current:15e3;return h.current=e,void(p.current=setTimeout(()=>{p.current=null,f.current?.().catch(()=>{})},r))}if(w(),h.current=0,c.current=null,((e,t=Date.now())=>{let r=new Date(e.StartAt).getTime()+60*e.Duration*1e3;return Number.isFinite(r)&&r>t})(e))return void o.current();m.current=!0,s.current()}},[w,g]);(0,i.useEffect)(()=>{f.current=b},[b]);let v=(0,i.useCallback)(async()=>{d.current||p.current||m.current||(h.current=0,await f.current?.())},[]);return(0,i.useEffect)(()=>()=>{x.current=!1,w()},[w]),v}({refetchMeetingDetails:a,onEndCall:()=>{l.dismissEndCallPrompt(),t()},onMeetingExtended:()=>{l.dismissEndCallPrompt(),r()},onVerificationUnavailable:o});return!function({callEnd:e,onScheduledEnd:t,enabled:r=!0}){let n=(0,i.useRef)(t),a=(0,i.useRef)(null),s=e.getTime();(0,i.useEffect)(()=>{n.current=t},[t]),(0,i.useEffect)(()=>{if(!r||!Number.isFinite(s))return;null!==a.current&&a.current!==s&&(a.current=null);let e=e=>{if(a.current===s)return;let t=Date.now()-s;t<0||(a.current=s,n.current({trigger:e,overdueMs:t}))};e("mounted");let t=window.setInterval(()=>e("polled"),15e3),i=()=>{("undefined"==typeof document||"hidden"!==document.visibilityState)&&e("page_resumed")};return window.addEventListener("focus",i),window.addEventListener("pageshow",i),document.addEventListener("visibilitychange",i),()=>{window.clearInterval(t),window.removeEventListener("focus",i),window.removeEventListener("pageshow",i),document.removeEventListener("visibilitychange",i)}},[s,r])}({callEnd:e,onScheduledEnd:e=>{s?.(e),c().catch(()=>{})}}),{...l,handleAutoEndCall:c}}({callEnd:ti,onEndCall:()=>tx(!0,"scheduled_end"),onMeetingExtended:tf,onPrompt:()=>D.play(),refetchMeetingDetails:a,onScheduledEndDetected:e=>tp.trackScheduledEndDetected(e),onVerificationUnavailable:e=>tp.trackEndUnverified(e)}),tS=(e=!1)=>{tw(),tx(e)},[ty,tj]=(0,i.useState)(!1),[tk,tE]=(0,i.useState)(!1),tN=()=>/android|iphone|ipad|ipod/i.test(navigator.userAgent),tI=async()=>{let e=document.documentElement,{fullscreenEnabled:t}=document;if(t)try{document.fullscreenElement?(document.exitFullscreen&&await document.exitFullscreen(),tj(!1)):(e.requestFullscreen&&await e.requestFullscreen(),tj(!0))}catch(e){console.warn("Error toggling fullscreen:",e)}};(0,i.useEffect)(()=>{if(!tN())return;let{fullscreenEnabled:e}=document;tE(!!e&&tN());let t=()=>{tj(!!document.fullscreenElement)};return document.addEventListener("fullscreenchange",t),document.addEventListener("webkitfullscreenchange",t),document.addEventListener("mozfullscreenchange",t),document.addEventListener("MSFullscreenChange",t),/android/i.test(navigator.userAgent)&&tI(),()=>{document.removeEventListener("fullscreenchange",t),document.fullscreenElement&&tI()}},[]),(0,i.useEffect)(()=>{f.beforePopState(()=>(ev(!0),window.history.pushState({...window.history.state,as:f.asPath,url:f.asPath},"",f.asPath),!1))},[]);let tC=(0,i.useRef)(ti);(0,i.useEffect)(()=>{let e=ti.getTime()>tC.current.getTime();tC.current=ti,tv&&e&&(tw(),eZ(!0))},[ti,tw,tv]);let tD=async({keepOpen:e=!1}={})=>
5{if("documentPictureInPicture"in window){let t;if(window.documentPictureInPicture.window&&!e)return void window.documentPictureInPicture.window.close();try{t=await window.documentPictureInPicture?.requestWindow({width:300,height:window.innerHeight})}catch(e){}t&&([...document.styleSheets].forEach(e=>{try{let r=[...e.cssRules].map(e=>e.cssText).join(""),i=document.createElement("style");i.textContent=r,t.document.head.appendChild(i)}catch(i){let r=document.createElement("link");r.rel="stylesheet",r.type=e.type,r.media=Array.from(e.media).join(", "),r.href=e.href??"",t.document.head.appendChild(r)}}),t.document.body.classList.add("intro-call-pip-window","flex","flex-col"),e3(!0),eW(t),t.addEventListener("pagehide",e=>{e3(!1),eW(null)}))}},tA=async()=>{en.screenShareEnabled?(el(),"documentPictureInPicture"in window&&window.documentPictureInPicture.window&&(window.documentPictureInPicture.window.close(),eW(null),e3(!1))):es("screen").then(()=>{P.play(),tD({keepOpen:!0})})},tT=(e,t)=>{t?o.A.set("hideWaitingRoom","true"):o.A.remove("hideWaitingRoom");let r=!1,i=()=>{r||(r=!0,window.location.reload())},n=window.setTimeout(i,750);tp.trackRefreshed({reason:e,connectionId:en.connectionId,onAccepted:()=>{window.clearTimeout(n),i()}})},tP=async()=>{let t="opentok_initialization";try{await en.initialize({apiKey:tH.tokboxApiKey,sessionId:e.TokBoxId,options:{onSignal(e){e.NeedsUpdate&&a()},onStreamJoined(e){switch(e.streamType){case"camera":V.play(),eu(e.userId);break;case"screen":P.play()}},onStreamDestroyed({type:e,userId:t}){"screen"===e&&I.Id===t&&el(),"camera"===e&&t&&N(e=>e.includes(t)?e:[...e,t])},onMediaStopped({type:e}){"screen"===e&&tA()},onAccessDenied({type:e}){if("screen"===e){el();let e=(()=>{let{userAgent:e}=navigator;return e.includes("Chrome")&&!e.includes("Edg")?"Chrome":e.includes("Safari")&&!e.includes("Chrome")?"Safari":e.includes("Firefox")?"Firefox":e.includes("Edg")?"Edge":"your browser"})(),t=(0,T.jsxs)("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,T.jsx)("path",{d:"M10 18C14.4183 18 18 14.4183 18 10C18 5.58172 14.4183 2 10 2C5.58172 2 2 5.58172 2 10C2 14.4183 5.58172 18 10 18Z",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,T.jsx)("path",{d:"M10 6V10",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"}),(0,T.jsx)("path",{d:"M10 14H10.01",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]});m(`Screen sharing was disabled. Try again or enable screen sharing for ${e} in System Settings`,t,"screen-sharing-permission-denied")}else tp.trackConnectionFailure({stage:"media_permission",error:Error("Browser media permission denied"),connectionId:en.connectionId,navigationSafe:!0,captureDiagnostic:!1,diagnosticUnavailableReason:"browser_media_permission_denied"}),tT("connection_failure",!1)},onMediaHealthChanged:({state:e})=>"noMedia"===e?void m("Audio and video stopped coming through. Try another network or browser.",void 0,tW,0):"degraded"===e?void m("Weak connection — video may freeze or drop out.",void 0,tW,8e3):void x(tW),onAudioBlocked(){e4(!0)},onAudioUnblocked(){e4(!1)},onPublisherCreateError({type:e},t){if("camera"===e){let e=en.devices?.videoInput?.find(e=>e.active),r=en.devices?.audioInput?.find(e=>e.active),i=en.devices?.audioOutput?.find(e=>e.active);tp.trackConnectionFailure({stage:"publisher_readiness",error:t,connectionId:en.connectionId,diagnosticContext:{active_video_device:!!e,active_audio_device:!!r,active_audio_output:!!i,available_video_device_count:en.devices?.videoInput?.length??0,available_audio_device_count:en.devices?.audioInput?.length??0,available_audio_output_count:en.devices?.audioOutput?.length??0}}),en.disconnect(),e1(t)}}}}),t="tokbox_connection",en.isConnected&&await en.disconnect(),await en.connect(e.TokBoxToken),tp.trackConnected(en.connectionId)}catch(e){tp.trackConnectionFailure({stage:t,error:e,connectionId:en.connectionId}),e1(e instanceof Error?e:Error(String(e)));return}try{let e=await en.canShareScreen();ei(e)}catch(t){(0,U.C)(Error("Web call screen sharing capability check failed"),{context:"screenShareCapability",platform:"web",meetingId:e.Id,tokboxSessionId:e.TokBoxId,callLegId:tp.callLegId,connectionId:en.connectionId,errorType:t instanceof Error?"Error":typeof t})}try{await V.play()}catch(e){}};(0,i.useEffect)(()=>
5{if(!e0||en.isConnected){try{navigator.mediaSession.setActionHandler("enterpictureinpicture",()=>{tD()})}catch(e){console.warn("The enterpictureinpicture action is not yet supported.")}return()=>{try{navigator.mediaSession.setActionHandler("enterpictureinpicture",null)}catch(e){console.warn("The enterpictureinpicture action is not yet supported.")}}}},[e0,en]),(0,i.useEffect)(()=>{e?.ExtensionRequest&&("REQUESTED"===e.ExtensionRequest.Status&&te&&!eP&&(eB("requested"),eM(!0),D.play(),eF(!0)),!te&&eP&&("DECLINED"===e.ExtensionRequest.Status?(eB("declined"),setTimeout(()=>{eM(!1)},5e3),setTimeout(()=>{eB(null),eF(!1)},6e3)):"APPROVED"===e.ExtensionRequest.Status&&(eB("approved"),setTimeout(()=>{eM(!1)},5e3))))},[e?.ExtensionRequest]),(0,i.useEffect)(()=>{g("instant")},[eU]);let tM=t=>{let{hours:r,minutes:i,seconds:n}=t,s=(e?.ExtensionOptions??[])?.length>0;0===r&&3===i&&0===n&&a(),!te&&0===r&&2===i&&0===n&&s&&(eR&&eF(!1),eM(!0),D.play()),tb(t)},tR=()=>{en.audioEnabled?en.stopAudio():en.startAudio()},t$=()=>{en.toggleCamera().catch(t=>{t instanceof Error&&t.message.includes("The previous call to this function has not yet completed.")||(0,U.C)(t,{meetingId:e.Id,context:"toggleCamera",userAgent:navigator.userAgent})})},tF=async()=>{let t=await a();if(!t)return;let r=b()(e.StartAt).add(e.Duration,"minute");b()(t.StartAt).add(t.Duration,"minute").isAfter(r)&&(tw(),tf())},tL=async()=>{if(!tr.current){tr.current=!0;try{th(await en.disconnect(),"manual_leave"),tu()}catch(e){tp.trackDisconnectFailed({error:e,reason:"manual_leave",failure:"exception"})}finally{M.play(),o.A.remove("hideWaitingRoom"),to("Left Call",{"Call Id":e.Id}),window.location.replace("/meetings")}}},tO=async()=>{eA(!0),await (0,$.wV)(h,!e.AllowExtensions),eA(!1),eI(!1)},tB=()=>tT("user_requested",!0),tK=()=>{eM(!1),setTimeout(()=>{eF(!1),eB(null)},2e3)},tG=async()=>{e_(!0);try{await (0,$.SM)(h),to("Call Extension Requested",{"Meeting Id":h,"Expert Id":e.Expert.Id,"Expert Name":`${e.Expert.FirstName} ${e.Expert.LastName}`}),eB("requested"),e_(!1),eF(!0)}catch(e){e_(!1)}},tZ=async t=>{e_(!0);let r=e.ExtensionRequest?.Id;if(void 0===r)throw Error("handleApproveDenyExtensionRequest called with no pending ExtensionRequest");"approve"===t?(await (0,$.UU)(r,"approve"),F.play(),eB("approved"),e_(!1)):(await (0,$.UU)(r,"decline"),eB("declined"),e_(!1),setTimeout(()=>{eM(!1)},5e3),setTimeout(()=>{eF(!1)},6e3))},tX=()=>{let t="Add time & save!";return"requested"===eO&&te&&eR&&(t=`${e.User.FirstName} would like to:`),"approved"===eO&&eR&&(t=`Video call extended${te?"!":""}`),"declined"===eO&&eR&&(t=te?"Call declined":"Unavailable :-("),t};(0,i.useEffect)(()=>{if(!e?.TokBoxId)return void tp.trackConnectionFailure({stage:"credentials_missing",error:Error("Web call session credentials unavailable"),diagnosticContext:{has_tokbox_session_id:!1,has_tokbox_token:!!e?.TokBoxToken}});if(b()().isAfter(b()(e?.StartAt).add(e?.Duration,"minute"))&&!e?.TokBoxToken)return void eK(!0);if(e&&b()().isBefore(b()(e.StartAt).subtract(5,"minute"))&&!(0,S.AZ)(f.query)){o.A.remove("hideWaitingRoom"),window.location.replace("/meetings");return}tp.trackJoined(),e.TokBoxId&&e.TokBoxToken?tP():tp.trackConnectionFailure({stage:"credentials_missing",error:Error("Web call session credentials unavailable"),diagnosticContext:{has_tokbox_session_id:!!e.TokBoxId,has_tokbox_token:!1}})},[]);let tQ=(en.devices?.audioInput??[]).map(e=>({...e,label:e.label,value:e.deviceId})),t0=(en.devices?.videoInput??[]).map(e=>({...e,label:e.label,value:e.deviceId})),t1=(en.devices?.audioOutput??[]).map(e=>({...e,label:e.label,value:e.deviceId}));if(eJ)return(0,T.jsxs)("div",{className:"h-screen flex flex-col lg:px-15 md:px-10 px-[22px] bg-[#F7F8FB]",children:[(0,T.jsx)("div",{className:"flex relative z-50 items-center justify-between pt-[20px]",children:(0,T.jsxs)("div",{className:"flex relative items-center shrink-0",children:[(0,T.jsx)("button",{type:"button",onClick:()=>window.location.replace("/meetings"),className:"mr-6 cursor-pointer relative",children:(0,T.jsx)("img",{alt:"back arrow",width:13,height:21,src:"/intro-back.svg"})}),(0,T.jsx)(l.A,{width:70,height:26,classes:"!pr-0 md:!pr-3 ml-6",href:"/meetings"})]})}),(0,T.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center w-full bg-[#F7F8FB] mt-[-72px]",children:(0,T.jsxs)("div",{className:"max-w-[230px] text-center font-medium",children:[(0,T.jsx)("p",{className:"text-[30px] text-charcoal mb-[8px]",children:"Call has ended"}),(0,T.jsxs)("p",{className:"text-[15px] text-[#8C8C8C]",children:["To rebook this expert,"," ",(0,T.jsx)(ee(),{href:`${e.Expert.Url}?source=intro&view=minimal`,className:"text-btn",children:"tap here"})," ","or go to the"," ",(0,T.jsx)(ee(),{href:"/marketplace",className:"text-btn",children:"marketplace"})]})]})})]});let t2=({firstName:t,lastName:r,userId:i})=>{let n="Get ready, your call is starting soon!";return(y||b()().isAfter(e.StartAt))&&(n=`Waiting for ${t} ${r}`),i&&E.includes(i)&&(n=`${t} ${r} left the room`),n};if(eh||!e?.TokBoxId||!e?.TokBoxToken)return(0,T.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center w-full bg-[#F7F8FB]",children:(0,T.jsx)(A.v,{title:"Unable to load this call",description:"You're amazing, but we have encountered an error loading this call.",buttonText:"Back to meetings",buttonOnClick:()=>{window.location.replace("/meetings")}})});if(e6)return(0,T.jsx)("div",{className:"min-h-full flex flex-col items-center justify-center w-full",children:(0,T.jsx)(w.A,{width:64,height:64})});let t3=[{label:"Refresh call",value:"refresh_call"},tk&&{label:ty?"Exit fullscreen":"Enter fullscreen",value:"toggle_fullscreen"},"documentPictureInPicture"in window&&_?{label:e2?"Exit Picture in Picture":"Picture in Picture",value:"picture_in_picture"}:null].filter(e=>!!e);if(!te&&(e?.ExtensionOptions??[])?.length>0&&e?.ExtensionRequest?.Status!=="REQUESTED"&&t3.push({label:"Extend call",value:"request_extension"}),te&&t3.push({label:`Turn ${e.AllowExtensions?"off":"on"} extensions`,value:"toggle_extensions"}),eX)return(0,T.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center w-full",children:(0,T.jsx)("p",{className:"text-error text-center px-8",children:"You have denied access to your camera and microphone. Please refresh the page and allow access to join the call."})});let t5=()=>{let t=b()(e.StartAt).add(e.Duration,"minute"),r=(e.ExpertExtendableUntil?b()(e.ExpertExtendableUntil):b()(new Date(864e13))).diff(t,"minute"),i=[];return r>=1&&i.push((0,T.jsx)(eT,{meetingId:h.toString(),extendAmount:1,buttonCallback:tF})),r>=3&&i.push((0,T.jsx)(eT,{meetingId:h.toString(),extendAmount:3,buttonCallback:tF})),r>=5&&i.push((0,T.jsx)(eT,{meetingId:h.toString(),extendAmount:5,buttonCallback:tF})),(0,T.jsx)("div",{className:"flex items-center justify-between",children:i.map((e,t)=>(0,T.jsx)("div",{className:`w-full flex-1 ${t>0?"ml-[8px]":""}`,children:e},`${e}`))})};return(0,T.jsx)(X.x,{reducedMotion:"user",children:(0,T.jsxs)("div",{ref:v,className:"video-chat-wrapper sticky top-0 h-[100dvh] w-[100dvw] max-h-[100dvh] max-w-[100dvw] flex flex-col lg:px-15 md:px-10 px-[8px] bg-[#1b1b1b] md:bg-[#F7F8FB]",children:[(0,T.jsxs)("div",{className:"flex flex-row h-full w-full flex-1 overflow-clip gap-2",style:{overflowClipMargin:0},children:[(0,T.jsxs)("div",{className:"flex flex-col flex-1 min-w-0",children:[(0,T.jsxs)("div",{className:"flex flex-0 relative z-50 items-center justify-center md:justify-between pt-[10px] mb-[8px] md:mb-[20px]",children:[(0,T.jsxs)("div",{className:"flex relative items-center shrink-0",children:[(0,T.jsxs)("button",{onClick:()=>{ev(!0)},className:"mr-6 cursor-pointer hidden md:block relative z-50",type:"button",children:[(0,T.jsx)("img",{alt:"back arrow",width:13,height:21,src:"/intro-back.svg"}),eg&&(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("button",{type:"button","aria-label":"Close end call menu",className:"fixed inset-0 bg-transparent",onClick:e=>{e.stopPropagation(),ev(!1)}}),(0,T.jsxs)("div",{className:"absolute top-[40px] left-[0px] bg-[#3D3D3D] md:bg-[#1E1E1E] rounded-[12px] py-[15px] px-[10px] flex flex-col justify-start items-start",children:[(0,T.jsx)("button",{type:"button",className:"text-left px-[15px] py-[10px] font-normal rounded-[6px] bg-transparent hover:bg-[#3F3F3F] text-[15px] text-white whitespace-nowrap w-full",onClick:e=>{e.stopPropagation(),tL()},children:"I'll be right back"}),(0,T.jsx)("button",{type:"button",className:"text-left px-[15px] py-[10px] font-normal rounded-[6px] bg-transparent hover:bg-[#3F3F3F] text-[15px] text-[#F25757] whitespace-nowrap w-full",onClick:t=>{t.stopPropagation(),to("Left Call",{"Call Id":e.Id}),tS()},children:"End call"})]})]})]}),(0,T.jsx)(l.A,{invert:L,width:L?66:70,height:L?22:26,classes:" !py-0 !pr-0 md:!pr-3 !mb-0 !ml-0",onClick:()=>ev(!0)})]}),ea&&!L&&(0,T.jsxs)("div",{className:`${te?"max-w-[170px]":"max-w-[200px]"} md:max-w-[600px] flex flex-1 ml-[8px] md:ml-[8px] md:mx-[18px]`,children:[(0,T.jsxs)("div",{className:`${en.screenShareEnabled?"justify-between":"justify-center"} w-full h-[36px] md:h-[60px] rounded-[12px] md:rounded-[20px] bg-[#3D3D3D] md:bg-[#EAEAEA] flex items-center p-[6px] mx-[0]`,children:[(0,T.jsxs)("div",{className:"flex items-center text-center md:text-left mx-[5px] md:ml-[30px] md:mr-[10px] w-full md:w-auto",children:[(0,T.jsx)("img",{alt:"Screen Share",src:"/share-screen-icon.svg",className:"w-[30px] h-[26px] mr-[14px] hidden md:block"}),(0,T.jsx)("p",{className:"text-[#767676] text-[14px] text-ellipsis overflow-hidden whitespace-nowrap font-normal w-full",children:en.screenShareEnabled?"You are presenting":`${eo.user?.FirstName??""} ${eo.user?.LastName??""} is presenting`.trim()})]}),en.screenShareEnabled&&(0,T.jsx)("button",{className:"font-medium text-[14px] text-white px-[24px] h-full bg-dark-purple cursor-pointer hover:bg-dark-purple roun
5ded-[14px] hidden md:block",onClick:tA,type:"button",children:"Stop sharing"})]}),"documentPictureInPicture"in window&&(0,T.jsx)("div",{className:"ml-[8px]",children:(0,T.jsx)("button",{className:"w-[36px] h-[36px] md:w-[60px] md:h-[60px] rounded-[12px] md:rounded-[20px] bg-[#3D3D3D] md:bg-[#EAEAEA] md:hover:bg-[#dddddd] relative overflow-hidden flex items-center justify-center",onClick:()=>{if(e2)return void eU?.close();tD()},type:"button",children:(0,T.jsx)("img",{alt:e2?"Close Picture-in-Picture":"Open Picture-in-Picture",src:e2?"/pip-close.svg":"/pip-icon.svg",className:"w-[24px] h-[20px]"})})})]}),e&&L&&(0,T.jsx)("div",{className:`flex items-center justify-center mx-[8px] ${eG?"max-w-none":"flex-1 grow max-w-[160px]"}`,children:(0,T.jsx)(eV,{startAt:e.StartAt,altTimerView:eG,duration:e.Duration,onCallStart:()=>{j(!0)},onCallEnd:()=>{tg().catch(()=>{})},callStarted:y,onTick:tM})}),te&&tn&&L&&(0,T.jsx)("div",{className:"mr-[8px]",children:(0,T.jsx)(eD,{meetingId:h,buttonCallback:tF})}),(0,T.jsxs)("div",{className:"flex items-center",children:[te&&(0,T.jsx)("div",{className:"mr-[8px]",children:(0,T.jsx)("button",{className:`w-[36px] h-[36px] md:w-[60px] md:h-[60px] rounded-[12px] md:rounded-[20px] ${"sessionDetails"===eq?"bg-[#dddddd] md:bg-[#737373]":"bg-[#3D3D3D] md:bg-[#EAEAEA] md:hover:bg-[#dddddd]"} md:ml-[8px] relative overflow-hidden flex items-center justify-center`,onClick:()=>{eY("sessionDetails"===eq?null:"sessionDetails")},type:"button",children:(0,T.jsx)("img",{alt:"Session details",src:L?"/calls-session-details-icon-mobile.svg":"sessionDetails"===eq?"/calls-session-details-icon-white.svg":"/calls-session-details-icon.svg",className:"w-[14px] h-[17px] md:w-[20px] md:h-[24px]"})})}),(0,T.jsx)(u.A,{id:"moreOptionsDropdown",options:t3,iconOnly:!0,hideArrow:!0,forgetSelection:!0,wrapperClasses:"dark !w-[36px] !h-[36px] md:!w-[60px] md:!h-[60px] !rounded-[12px] md:!rounded-[20px] bg-[#3D3D3D] md:bg-[#EAEAEA] md:hover:bg-[#dddddd] flex items-center justify-center more-options-dropdown shrink-0",classes:"h-full !justify-center !rounded-[14px] md:!rounded-[20px] !p-0",optionsWrapperClasses:"!pl-[10px] !w-auto right-0 !left-auto !z-[101] !min-w-[160px]",labelIcon:(0,T.jsx)("img",{alt:"Call settings",className:"w-[21px] h-[4px] md:w-[23px] md:h-[5px]",src:L?"/video-call-options-button-white.svg":"/video-call-options-button.svg"}),onChange:e=>(e=>{switch(e.value){case"refresh_call":default:tB();break;case"toggle_fullscreen":tI();break;case"toggle_extensions":tO();break;case"request_extension":eF(!1),eB(null),eB("requested"),eM(!0),D.play(),eI(!1);break;case"picture_in_picture":tD()}})(e)})]})]}),(0,T.jsx)("div",{className:"flex-1 h-full w-full overflow-clip",children:e0?(0,T.jsx)("div",{className:"flex-1 self-center justify-self-center p-[24px] mx-4 md:max-w-[550px] w-full md:mx-auto",children:(0,T.jsx)(A.v,{title:"Tap to rejoin this call",description:(0,T.jsxs)(T.Fragment,{children:["You’re amazing, but something didn’t load. Please make sure you have wifi or signal",(0,T.jsx)("span",{className:"block pl-2 pt-2",children:(e0.message??"").replace("OT.Publisher","*")})]}),buttonText:"Reload Call",buttonOnClick:()=>{tT("connection_failure",!1)}})}):(0,T.jsx)(T.Fragment,{children:eU?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(eH,{className:"flex-1 w-full h-full overflow-hidden",pipWindow:eU,padding:10,topBar:(0,T.jsxs)("div",{className:"flex items-center justify-center bg-charcoal h-full gap-2",children:[(0,T.jsx)(eV,{isInPip:!0,startAt:e.StartAt,altTimerView:eG,duration:e.Duration,onCallStart:()=>{j(!0)},onCallEnd:()=>{tg().catch(()=>{})},callStarted:y,onTick:tM}),te&&tn&&(0,T.jsx)(eD,{meetingId:h,buttonCallback:tF,isPip:!0})]}),bottomBar:(0,T.jsxs)("div",{className:"flex items-center justify-center bg-charcoal h-full gap-2",style:{paddingTop:"8px",paddingBottom:"8px"},children:[(0,T.jsxs)("button",{className:"bg-[#3D3D3D] flex items-center justify-center relative hover:bg-[#4D4D4D] transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-[#3D3D3D]",style:{height:"45px",width:"45px",borderRadius:"14px"},onClick:t$,type:"button",title:en.cameraEnabled?"Turn off camera":"Turn on camera","aria-label":en.cameraEnabled?"Turn off camera":"Turn on camera","aria-pressed":!en.cameraEnabled,children:[!en.cameraEnabled&&(0,T.jsx)("span",{className:"bg-[#F25757] rounded-[4px] ring-[#3D3D3D] -rotate-45 ring-2 absolute z-10",style:{width:"2px",height:"25px"}}),(0,T.jsx)("img",{alt:en.cameraEnabled?"Turn off camera":"Turn on camera",className:"w-[20px] h-[20px] opacity-80",src:"/camera-on-icon-white.svg"})]}),(0,T.jsxs)("button",{className:"bg-[#3D3D3D] flex items-center justify-center relative hover:bg-[#4D4D4D] transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-[#3D3D3D]",style:{height:"45px",width:"45px",borderRadius:"14px"},onClick:tR,type:"button",title:en.audioEnabled?"Mute":"Unmute","aria-label":en.audioEnabled?"Mute microphone":"Unmute microphone","aria-pressed":!en.audioEnabled,children:[!en.audioEnabled&&(0,T.jsx)("span",{className:"bg-[#F25757] rounded-[4px] ring-[#3D3D3D] -rotate-45 ring-2 absolute z-10",style:{width:"2px",height:"25px"}}),(0,T.jsx)("img",{alt:en.audioEnabled?"Mute":"Unmute",className:"w-[18px] h-[20px] opacity-80",src:"/microphone-on-icon-white.svg"})]}),(0,T.jsx)("button",{className:"bg-[#F25757] hover:bg-[#e95050] flex items-center justify-center transition-colors disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:bg-[#F25757]",style:{height:"45px",width:"75px",borderRadius:"14px"},onClick:tL,type:"button",title:"Leave call","aria-label":"Leave call",children:(0,T.jsx)("img",{alt:"Leave call",src:"/white-phone.svg",className:"w-[19px] h-[19px] rotate-[136deg] mt-[3px] opacity-75"})})]}),children:(0,T.jsxs)("div",{className:"bg-charcoal flex-1 w-full h-full overflow-hidden relative",children:[(0,T.jsx)(tc,{className:"bg-charcoal w-full h-full overflow-hidden",ownerStream
5:ec,participantStreams:ep??[],expertStream:ed,screenShareStream:e7?eo:void 0,padding:10,currentUserId:I.Id,getUserNotConnectedText:t2,audioBlocked:e5,onAllowAudio:()=>{try{en.unblockAudio().then(()=>{e4(!1)})}catch(e){}},canDisabledVideo:_,isInPip:!0,hasScreenShare:e7&&ea}),(0,T.jsx)(Z.A,{customStyles:{width:"100%",maxWidth:"280px",height:"auto"},className:"IntroPopupDialog RequestsExtensionsModal",visible:eP,onClose:tK,animation:"zoom",showMask:!0,closeMaskOnClick:!te||te&&"approved"===eO,closeOnEsc:!te||te&&"approved"===eO,children:(0,T.jsxs)("div",{className:"IntroModal IntroPopupDialog relative",ref:tt,children:[(0,T.jsxs)("div",{className:"relative",children:[!te&&!eR&&(0,T.jsx)("button",{type:"button",className:"absolute right-[-10px] top-[5px]",onClick:tK,children:(0,T.jsx)("img",{alt:"Close popup",src:"/intro-popup-close-icon.svg",className:"w-[22px] h-[22px]"})}),(0,T.jsx)("p",{className:"w-full font-semibold text-center text-[24px] text-charcoal leading-8 text-wrap-balance",children:tX()})]}),(0,T.jsxs)("div",{className:"",children:[(0,T.jsx)("div",{className:"flex items-center justify-center w-full",children:eR?(0,T.jsx)(tq,{sendingRequest:eL,hosting:te,requestStatus:eO,meeting:e,onRespondToExtensionRequest:tZ}):(e?.ExtensionOptions??[])?.length>0&&(e?.ExtensionOptions??[]).map(e=>(0,T.jsx)("div",{className:"w-full mt-[26px]",children:(0,T.jsx)("button",{type:"button",onClick:tG,className:`font-sofia h-[75px] min-w-[60px] w-full text-white whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold bg-btn hover:bg-btn-hover cursor-pointer ${eL?"flex items-center justify-center":""}`,children:eL?(0,T.jsx)(w.A,{width:34,height:34,color:"#ffffff"}):(0,T.jsxs)("div",{children:[(0,T.jsxs)("p",{className:"text-[22px] font-semibold cursor-pointer leading-none mt-[1px] mb-[2px]",children:[e.Duration," min"]}),(0,T.jsxs)("p",{className:"text-[20px] cursor-pointer font-normal",children:[(0,T.jsxs)("span",{className:"line-through cursor-pointer opacity-60 mr-[2px]",children:["$",e.Price]})," ","$",e.Price-e.Discount]})]})})},e.Id))}),te&&"requested"===eO?null:(0,T.jsx)(tY,{requestStatus:eO,setRequestStatus:eB,setRequestExtensionVisible:eM,hasSentRequest:eR,requestExtensionVisible:eP})]})]})}),(0,T.jsx)(tz,{visible:tv,className:"absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] w-full max-w-[280px] z-[100] px-2",children:(0,T.jsxs)("div",{className:"rounded-[16px] bg-white bg-opacity-80 px-[24px] py-[20px]",children:[(0,T.jsx)(tU,{compact:!0,onDismiss:tw}),(0,T.jsxs)("div",{className:"pt-[12px]",children:[(0,T.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,T.jsx)("button",{type:"button",onClick:()=>{to("Left Call",{"Call Id":e.Id}),tS(!0)},className:"font-sofia h-[50px] text-[18px] w-full text-white whitespace-nowrap flex-grow px-6 rounded-[4px] font-semibold cursor-pointer bg-red hover:bg-red-hover",children:"End Call"})}),(0,T.jsx)(tJ,{showEndCallModal:tv,callEnd:ti}),te&&tn&&(0,T.jsxs)("div",{className:"mt-[12px] pt-[8px] border-t border-[#979797]",children:[(0,T.jsx)("p",{className:"text-[16px] text-charcoal text-center font-medium mb-[8px]",children:"Extend call (free)"}),t5()]})]})]})}),tv&&(0,T.jsx)("div",{className:"fixed top-0 bg-[rgba(0,0,0,0.5)] right-0 left-0 bottom-0 z-[61]"}),(0,T.jsx)(eE.N,{className:"bg-black text-white"})]})}),(0,T.jsx)(ew.VT,{hasScreenShare:ea,className:"flex flex-1 items-center justify-center h-full w-full max-h-full max-w-full md:min-w-[300px] relative z-10",children:eo&&ea&&!e7?(0,T.jsx)(ez,{style:{},stream:eo,hasScreenShare:ea}):(0,T.jsxs)("div",{className:"text-center flex-1 self-center justify-self-center mx-4 md:max-w-[80vw] w-full md:mx-auto",children:[(0,T.jsx)("h3",{className:"text-[32px] font-medium text-wrap-pretty text-white md:text-charcoal",children:"Your Intro call is in another window"}),(0,T.jsx)("p",{className:"text-[16px] text-[#EFEFEF] md:text-[#6D6C6C] mt-[8px] text-wrap-pretty",children:"By using Picture in Picture, you can do other things while staying on you call."}),(0,T.jsxs)("div",{className:"mt-[20px] flex flex-col gap-3 items-center",children:[(0,T.jsx)("button",{type:"button",onClick:()=>{eU?.close(),e3(!1)},className:"bg-blue-500 md:bg-black inline-flex font-sofia h-[45px] text-white whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold cursor-pointer",children:"Bring the call back here"}),eo&&ea&&(0,T.jsx)("button",{type:"button",onClick:()=>e9(!e7),className:"bg-blue-500 md:bg-[#EAEAEA] md:text-charcoal inline-flex font-sofia h-[45px] text-white whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold cursor-pointer md:hover:bg-[#dddddd]",children:e7?"Show screenshare here":"Show screenshare in PIP"})]})]})})]}):(0,T.jsx)(ew.VT,{hasScreenShare:ea,className:"flex-0 items-center justify-center h-full w-full max-h-full max-w-full md:min-w-[300px] relative z-10",children:(0,T.jsx)(tc,{ownerStream
5:ec,participantStreams:ep??[],expertStream:ed,screenShareStream:eo,padding:0,currentUserId:I.Id,hasScreenShare:ea,getUserNotConnectedText:t2,audioBlocked:e5,onAllowAudio:()=>{try{en.unblockAudio().then(()=>{e4(!1)})}catch(e){}},canDisabledVideo:_,isInPip:!!eU})})})})]}),(0,T.jsx)(td.ei,{isOpen:!!eq,isMobile:L,className:"md:mt-[10px] md:!h-auto",children:eq&&(0,T.jsx)(tV,{expertStream:ed,ownerStream:ec,participantStreams:ep,meeting:e,onClose:()=>eY(null),view:eq})})]})," ",(0,T.jsx)(t_,{hasScreenShare:ea,isMobile:L,call:en,screenShareStream:eo,isScreenShareSupported:er,videoInput:t0,audioInput:tQ,audioOutput:t1,handleToggleVideo:t$,handleVideoSrcOptionChange:e=>{Q(!1),en.setVideoSourceDevice(e.value)},handleToggleMute:tR,handleAudioSrcOptionChange:e=>{Q(!1),en.setAudioSourceDevice(e.value)},handleAudioOutputOptionChange:e=>{Q(!1),en.setAudioOutputDevice(e.value)},setPollDevices:Q,handleToggleScreenShare:tA,setOpenDrawer:eY,openDrawer:eq,meeting:e,altTimerView:eG,callStarted:y,onCallStart:()=>j(!0),onCallEnd:()=>{tg().catch(()=>{})},onMeetingExtended:tF,onTimerTick:tM,hosting:te,expertCanExtend:tn,meetingId:h,setPromptToEndCall:ef,promptToEndCall:ex,handleCloseCall:tL,mpTrackEvent:to,handleEndCall:tS}),(0,T.jsx)(R.A,{visible:ek,onRequestClose:()=>eI(!1),header:"Call settings",dialogOptions:(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)("div",{className:"mb-[16px]",children:(0,T.jsx)(z.A,{type:"confirm",cta:"Refresh call",onClick:tB})}),!te&&e?.ExtensionRequest?.Status!=="REQUESTED"&&(0,T.jsx)("div",{className:"mb-[16px]",children:(0,T.jsx)(z.A,{type:"confirm",cta:"Extend call",onClick:()=>{eF(!1),eB(null),eB("requested"),eM(!0),D.play(),eI(!1)}})}),te&&(0,T.jsx)("div",{className:"mb-[16px]",children:(0,T.jsx)(z.A,{type:"confirm",cta:`Turn ${e.AllowExtensions?"off":"on"} extensions`,actionLoading:eC,onClick:tO})})]})}),(0,T.jsx)(Z.A,{customStyles:{width:"100%",maxWidth:"320px",height:"370px"},className:"IntroPopupDialog RequestsExtensionsModal",visible:eP,onClose:tK,animation:"zoom",showMask:!0,closeMaskOnClick:!te||te&&("approved"===eO||"declined"===eO),closeOnEsc:!te||te&&("approved"===eO||"declined"===eO),children:(0,T.jsxs)("div",{className:"IntroModal IntroPopupDialog relative",ref:tt,children:[(0,T.jsxs)("div",{className:"relative",children:[(!te&&!eR||te&&("approved"===eO||"declined"===eO))&&(0,T.jsx)("button",{type:"button",className:"absolute right-[-10px] top-[5px]",onClick:tK,children:(0,T.jsx)("img",{alt:"Close popup",src:"/intro-popup-close-icon.svg",className:"w-[22px] h-[22px]"})}),(0,T.jsx)("p",{className:"w-full font-semibold text-center text-[24px] text-charcoal leading-8 text-wrap-balance",children:tX()})]}),(0,T.jsxs)("div",{className:"",children:[(0,T.jsx)("div",{className:"flex items-center justify-center w-full",children:eR?(0,T.jsx)(tq,{sendingRequest:eL,hosting:te,requestStatus:eO,meeting:e,onRespondToExtensionRequest:tZ}):(e?.ExtensionOptions??[])?.length>0&&(e?.ExtensionOptions??[]).map(e=>(0,T.jsx)("div",{className:"w-full mt-[26px]",children:(0,T.jsx)("button",{type:"button",onClick:tG,className:`font-sofia h-[75px] min-w-[60px] w-full text-white whitespace-nowrap flex-grow px-8 py-3 rounded-[4px] font-semibold bg-btn hover:bg-btn-hover cursor-pointer ${eL?"flex items-center justify-center":""}`,children:eL?(0,T.jsx)(w.A,{width:34,height:34,color:"#ffffff"}):(0,T.jsxs)("div",{children:[(0,T.jsxs)("p",{className:"text-[22px] font-semibold cursor-pointer leading-none mt-[1px] mb-[2px]",children:[e.Duration," min"]}),(0,T.jsxs)("p",{className:"text-[20px] cursor-pointer font-normal",children:[(0,T.jsx)("span",{className:"line-through cursor-pointer opacity-60 mr-[2px]",children:(0,S.$g)(e.Price,{decimalPoints:2,trim:"decimal"})})," ",(0,S.$g)(e.Price-e.Discount,{decimalPoints:2,trim:"decimal"})]})]})})},e.Id))}),te&&"requested"===eO?null:(0,T.jsx)(tY,{requestStatus:eO,setRequestStatus:eB,setRequestExtensionVisible:eM,hasSentRequest:eR,requestExtensionVisible:eP})]})]})}),(0,T.jsx)(tz,{visible:tv,className:"absolute left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%] w-full max-w-[320px] z-[100]",children:(0,T.jsxs)("div",{className:"rounded-[16px] bg-white bg-opacity-80 px-[32px] py-[25px] ",children:[(0,T.jsx)(tU,{onDismiss:tw}),(0,T.jsxs)("div",{className:"pt-[15px]",children:[(0,T.jsx)("div",{className:"flex items-center justify-center w-full",children:(0,T.jsx)("button",{type:"button",onClick:()=>{to("Left Call",{"Call Id":e.Id}),tS(!0)},className:"font-sofia h-[57px] text-[22px] w-full text-white whitespace-nowrap flex-grow px-8 rounded-[4px] font-semibold cursor-pointer bg-red hover:bg-red-hover",children:"End Call"})}),(0,T.jsx)(tJ,{showEndCallModal:tv,callEnd:ti}),te&&tn&&(0,T.jsxs)("div",{className:"mt-[15px] pt-[10px] border-t border-[#979797]",children:[(0,T.jsx)("p",{className:"text-[18px] text-charcoal text-center font-medium mb-[10px]",children:"Extend call (free)"}),t5()]})]})]})}),tv&&(0,T.jsx)("div",{className:"fixed top-0 bg-[rgba(0,0,0,0.5)] right-0 left-0 bottom-0 z-[61]"}),(0,T.jsx)(eE.N,{className:"bg-white md:bg-black text-black md:text-white"})]})})},tG=e=>(0,T.jsx)(ek.t,{children:(0,T.jsx)(tK,{...e})});var tZ=r(88488);function tX({children:e}){return(0,T.jsxs)("div",{className:"h-screen flex flex-col overflow-hidden w-full lg:px-15 md:px-10 px-[22px] bg-[#F7F8FB]",children:[(0,T.jsx)("div",{className:"flex relative z-10 items-center justify-between pt-[20px]",children:(0,T.jsxs)("div",{className:"flex relative items-center shrink-0",children:[(0,T.jsx)("button",{type:"button",onClick:()=>{window.location.href="/meetings"},className:"mr-6 cursor-pointer relative",children:(0,T.jsx)("img",{alt:"back arrow",width:13,height:21,src:"/intro-back.svg"})}),(0,T.jsx)(l.A,{width:70,height:26,classes:"!pr-0 md:!pr-3 ml-6",href:"/meetings"})]})}),(0,T.jsx)("div",{className:"min-h-screen flex flex-col items-center justify-center w-full bg-[#F7F8FB] mt-[-72px]",children:e})]})}var tQ=!0;function t0({meeting:e,isMaxParticipantsError:t,hasErrorLoadingCall:r,shouldRefresh:a}){let l=(0,n.useRouter)(),{meetingId:c}=l.query,{currentUser:d,isLoggedIn:u}=(0,p.A)(),[h,m]=(0,i.useState)(!0),[x,f]=(0,i.useState)(null),[g,v]=(0,i.useState)(null),[y,j]=(0,i.useState)(null),[k,E]=(0,i.useState)(!1),[N,I]=(0,i.useState)(!1),P=(Array.isArray(c)?c[0]:c)??e?.Id,R=u&&!d?.Id,V=!R&&u&&!!d?.Id&&(!d.FirstName?.trim()||!d.LastName?.trim()),$=h||V||R,{data:_=null,isPending:O,isError:z,refetch:B}=(0,tZ.V8)({meetingId:P,initialData:e??void 0,enabled:u,liveRefresh:!$}),U=O&&!_,H=r||z&&!_,W=_?.Expert?.Id===d?.Id,q=_?.Expert?.Id===d?.Id,Y=b()().isAfter(b()(_?.StartAt).add(_?.Duration,"minute"))&&!_?.TokBoxToken,J=_?.Canceled,K=a&&u,G=(0,i.useCallback)(async()=>{let e=await B();return e.isSuccess?e.data??null:null},[B]);(0,i.useEffect)(()=>{_?.ZoomLink&&(window.location.href=_.ZoomLink)},[_?.ZoomLink]),(0,i.useEffect)(()=>
5{if(!u)return void(0,S.jL)(l);"true"===o.A.get("hideWaitingRoom")&&m(!1)},[u,l]);if((0,i.useEffect)(()=>{let e=C();e.audioInputDeviceId&&v(e.audioInputDeviceId),e.videoInputDeviceId&&j(e.videoInputDeviceId),e.audioOutputDeviceId&&f(e.audioOutputDeviceId)},[]),(0,i.useEffect)(()=>{K&&window.location.reload()},[K]),U||K)return(0,T.jsx)("div",{className:"min-h-full flex flex-col items-center justify-center w-full md:max-w-[360px] md:min-w-[340px]",children:(0,T.jsx)(w.A,{width:64,height:64})});if(!U&&(Y||J)){let e=q?(0,T.jsxs)(T.Fragment,{children:["To view your calls,"," ",(0,T.jsx)(ee(),{href:"/meetings",className:"text-btn",children:"tap here"}),"."]}):(0,T.jsxs)(T.Fragment,{children:["To rebook this expert,"," ",(0,T.jsx)(ee(),{href:`${_?.Expert.Url}?source=intro&view=minimal`,className:"text-btn",children:"tap here"})," ","or go to the"," ",(0,T.jsx)(ee(),{href:"/marketplace",className:"text-btn",children:"marketplace"})]});return(0,T.jsx)(tX,{children:(0,T.jsx)(A.v,{title:J?"Call was canceled":"Call has ended",description:e,buttonText:""})})}if(!U&&H)return(0,T.jsx)(tX,{children:(0,T.jsx)(A.v,{title:"Unable to load this call",description:"You're amazing, but we have encountered an error loading this call.",buttonText:"Back to meetings",buttonOnClick:()=>{window.location.href="/meetings"}})});if(t)return(0,T.jsx)(tX,{children:(0,T.jsx)(A.v,{title:"Too many participants",description:"You're amazing, but this call has reached its capacity. Please reach out to your host.",buttonText:"Back to meetings",buttonOnClick:()=>{window.location.href="/meetings"}})});let Z=W?`Intro - Call with ${_?.User?.FirstName} ${_?.User?.LastName}`:`Intro - Call with ${_?.Expert?.FirstName} ${_?.Expert?.LastName}`;return(0,T.jsxs)("div",{className:"w-full h-full flex flex-col",children:[(0,T.jsxs)(s(),{children:[(0,T.jsx)("title",{children:U?"Intro - Discover an expert & Book":Z}),(0,T.jsx)("link",{href:"/intro-icon-32.png",rel:"shortcut icon",type:"image/png"}),(0,T.jsx)("meta",{name:"viewport",content:"initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0, width=device-width"}),(0,T.jsx)("meta",{content:"#ffffff",name:"theme-color"}),(0,T.jsx)("meta",{content:"telephone=no",name:"format-detection"}),(0,T.jsx)("meta",{content:"30c9fcf51f2a10f6c360105ec5cc657f",name:"p:domain_verify"}),(0,T.jsx)("meta",{content:"Book the world's most in-demand experts & get advice over a video call",name:"description"}),(0,T.jsx)("meta",{content:"Book the world's most in-demand experts & get advice over a video call",property:"og:description"}),(0,T.jsx)("meta",{content:"Intro | Discover an expert & book",property:"og:title"}),(0,T.jsx)("meta",{content:"Intro | Discover an expert & book",property:"twitter:title"}),(0,T.jsx)("meta",{name:"apple-mobile-web-app-capable",content:"yes"}),(0,T.jsx)("meta",{content:"#1C1C1C",name:"theme-color"})]}),(0,T.jsx)(F,{isOpen:V,returnPath:l.asPath,onComplete:async()=>{await G()}}),(0,T.jsx)(L.tc,{children:$?(0,T.jsx)(M,{meeting:_,setDefaultMute:e=>{E(e)},setDefaultVideoOff:e=>{I(e)},onEnterMeeting:()=>{m(!1),o.A.set("hideWaitingRoom","true",{expires:b()(_.StartAt).add(_.Duration,"minute").toDate()})},setDefaultAudioSource:e=>{v(e),D({audioInputDeviceId:e})},setDefaultCameraSource:e=>{j(e),D({videoInputDeviceId:e})},setDefaultAudioOutput:e=>{f(e),D({audioOutputDeviceId:e})}}):(0,T.jsx)(ew.GV,{children:(0,T.jsx)(tG,{meetingId:_?.Id.toString(),meeting:_,refetchMeetingDetails:G,defaultVideoOff:N,defaultAudioMuted:k,defaultAudioSourceId:g,defaultCameraSourceId:y,defaultAudioOutputId:x})})})]})}t0.displayName="Calls"},8954:(e,t,r)=>{"use strict";r.d(t,{_:()=>l}),r(14232);var i=r(16476),n=r(15039),a=r.n(n),s=r(37876);let o={left:{line1:{x1:3.5,y1:5,x2:6.5,y2:8},line2:{x1:3.5,y1:5,x2:6.5,y2:2}},right:{line1:{x1:3.5,y1:2,x2:6.5,y2:5},line2:{x1:3.5,y1:8,x2:6.5,y2:5}},close:{line1:{x1:2,y1:2,x2:8,y2:8},line2:{x1:2,y1:8,x2:8,y2:2}},up:{line1:{x1:5,y1:3.5,x2:8,y2:6.5},line2:{x1:5,y1:3.5,x2:2,y2:6.5}},down:{line1:{x1:5,y1:6.5,x2:8,y2:3.5},line2:{x1:5,y1:6.5,x2:2,y2:3.5}}},l=({icon:e,onClick:t,className:r})=>{let{width:n}=(0,i.A)(),l=n<768,{line1:c,line2:d}=o[e]??o.left;return(0,s.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 10 10",width:l?26:20,height:l?42:20,fill:"none",style:l?{minWidth:"26px",minHeight:"42px"}:{minWidth:"20px",minHeight:"20px"}
5,className:a()(t?"cursor-pointer":"",l?"-ml-2":"",r),onClick:t,role:t?"button":void 0,tabIndex:t?0:void 0,"aria-label":t?({left:"Go back",right:"Go forward",close:"Close",up:"Collapse",down:"Expand"})[e]:void 0,"aria-hidden":t?void 0:"true",onKeyDown:t?e=>{t&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),t())}:void 0,children:[(0,s.jsx)("line",{...c,fill:"none",pathLength:"1",stroke:"currentColor",strokeWidth:l?"1.3":"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,s.jsx)("line",{...d,fill:"none",pathLength:"1",stroke:"currentColor",strokeWidth:l?"1.3":"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}},10942:(e,t,r)=>{"use strict";r.d(t,{$Q:()=>i.$Q,Q0:()=>i.Q0,W_:()=>i.W_,YP:()=>i.YP,ez:()=>i.ez,z3:()=>i.z3});var i=r(62629)},19316:(e,t,r)=>{"use strict";r.d(t,{K:()=>f,q:()=>x});var i=r(56557),n=r.n(i),a=r(5902),s=r.n(a),o=r(71576),l=r.n(o),c=r(64301),d=r.n(c),p=r(20355),u=r.n(p),h=r(22429),m=r.n(h);n().extend(l()),n().extend(d());let x=(e={},t,r)=>{e.shortMeridiem||=!1,e.stripZeros||=!1,r.extend(l()),r.extend(d()),r.extend(u()),r.extend(m()),r.locale("en",{...s(),meridiem:(t,r,i)=>(t=>e.shortMeridiem?t>=12?"p":"a":t>=12?"pm":"am")(t)[!i?"toUpperCase":"toLowerCase"]()});let i=r.prototype.format;r.prototype.format=function(t){let r=i.call(this,t);return e.stripZeros&&r?.includes(":00")&&t?.includes(":mm")&&(r=r.replace(":00","")),r}};function f(e=6){let t=[],r=n()().tz("America/Los_Angeles").add(7,"day");for(;3!==r.day();)r=r.add(1,"day");for(let i=0;i<e;i++){let e=r.add(i,"week").startOf("day");t.push(e.toDate())}return t}},23157:(e,t,r)=>{"use strict";r.d(t,{gY:()=>h,gd:()=>c,iB:()=>u});var i=r(14232),n=r(69505),a=r(31150),s=r(29476),o=r(89565),l=r(37876);let c=({children:e})=>{let t=(0,o.Vz)();return(0,i.useEffect)(()=>{e&&t.setTitle(e)},[t,e]),null},d=()=>(0,l.jsxs)("div",{className:"p-4 flex flex-col gap-2",children:[(0,l.jsx)("div",{className:"text-lg font-medium",children:"Error"}),(0,l.jsx)("div",{className:"text-sm text-gray-500",children:"An error occurred while loading this page."})]});function p({children:e,path:t,isDefault:r,title:p,Header:u,Fallback:h=d,hideHeader:m=!1,transitionDuration:x=.2}){let f=(0,o.Vz)();(0,i.useEffect)(()=>(f.attachView(t,r),()=>{f.detachView(t)}),[f,t,r]);let w=f.stack[f.currentIndex];if(w?.at(0)===t){let i="function"==typeof e?e(w[1]):e,o=(0,s.B)(i,c)?.props.children??f.title??p,d="forward"===f.direction,g="backward"===f.direction;return(0,l.jsxs)(a.T,{namespace:"SubRoute",fallback:h,children:[u&&!m&&(0,l.jsx)(u,{title:o},"header"),(0,l.jsx)(n.P.div,{initial:0!==x&&{x:g?"-3%":"3%",opacity:.7},animate:{x:0,opacity:1},exit:{opacity:.7,x:d?"-3%":"3%"},transition:{duration:x},style:{transformOrigin:"top left"},children:i},JSON.stringify({id:t,isDefault:r}))]})}return null}function u(e){return(0,l.jsx)(p,{...e})}function h(){return function(e){return(0,l.jsx)(p,{...e})}}},30580:(e,t,r)=>{"use strict";r.d(t,{v:()=>a}),r(14232);var i=r(64392),n=r(37876);let a=({title:e="Tap to rejoin this call",description:t="You’re amazing, but something didn’t load. Please make sure you have wifi or signal",buttonText:r="Tap to refresh",buttonOnClick:a=()=>{window.location.reload()}})=>(0,n.jsxs)("div",{className:"flex flex-col items-center",children:[(0,n.jsx)("h3",{className:"text-[30px] text-center text-wrap-balance mb-[14px]",children:e}),(0,n.jsx)("p",{className:"text-[#8c8c8c] text-[15px] text-center font-normal leading-snug mb-[28px] text-wrap-balance max-w-[450px]",children:t}),r&&(0,n.jsx)(i.A,{cta:r,onClick:a,classes:"!font-medium !py-2 w-[250px] h-[48px] select-none !bg-black",isActive:!0})]})},31150:(e,t,r)=>{"use strict";r.d(t,{T:()=>s});var i=r(14232),n=r(37876);let a=({error:e})=>(0,n.jsx)("div",{children:e.message});class s extends i.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(e){return e instanceof Error?{hasError:!0,error:e}:{hasError:!0}}componentDidCatch(e,t){let{namespace:r}=this.props;console.error(`${r}: ${e.message}`,t)}render(){let{hasError:e,error:t}=this.state,{fallback:r=a,children:i}=this.props;return e&&t?(0,n.jsx)(r,{error:t}):i}}},33814:(e,t,r)=>{"use strict";r.d(t,{Vz:()=>
5i.Vz,gY:()=>n.gY,gd:()=>n.gd,mq:()=>i.mq});var i=r(89565),n=r(23157)},37443:(e,t,r)=>{"use strict";r.d(t,{A:()=>i});let i=r(14232).useLayoutEffect},45030:(e,t,r)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/meetings/[meetingId]",function(){return r(6245)}])},55031:(e,t,r)=>{"use strict";r.d(t,{A:()=>s});var i=r(14232),n=r(2372),a=r(37876);let s=({id:e,defaultSelected:t,noSelectionLabel:r,options:s=[],wrapperClasses:o,classes:l,optionClasses:c,optionsOverride:d,optionsWrapperClasses:p,labelIcon:u,arrowOverride:h,optionsMaxHeight:m,iconOnly:x,hideArrow:f,forgetSelection:w,onChange:g,preventCloseOnOutside:b=!1})=>{let[v,S]=(0,i.useState)(null),{openDropdownId:y,setOpenDropdownId:j}=(0,n.o$)(),k=y===e,E=(0,i.useRef)(null),N=(0,i.useRef)(null),I=(0,i.useCallback)(t=>{let r=document.getElementById(e),i=t.target instanceof Node?t.target:null;E.current&&!E.current.contains(i)&&r&&!r.contains(i)&&j(null)},[e,j]),C=()=>{v&&(g?.(v),j(null))};return(0,i.useEffect)(()=>(k&&!b&&document.addEventListener("click",I),()=>{document.removeEventListener("click",I)}),[k,b,I]),(0,i.useEffect)(()=>{S(t??null)},[t]),(0,i.useEffect)(()=>{k&&setTimeout(()=>{N?.current?.scrollIntoView({behavior:"auto",block:"center",inline:"center"})},10)},[k]),(0,a.jsxs)("div",{className:`dropdown-container w-full ${o||""}`,ref:E,id:e,onKeyDown:t=>{if(" "===t.key)t.preventDefault(),k?v&&C():j(e);else if(k)switch(t.key){case"ArrowUp":t.preventDefault(),(()=>{let e=s.findIndex(e=>e.value===v?.value),t=e>0?e-1:s.length-1;S(s[t])})();break;case"ArrowDown":t.preventDefault(),(()=>{let e=s.findIndex(e=>e.value===v?.value),t=e<s.length-1?e+1:0;S(s[t])})();break;case"Enter":t.preventDefault(),C();break;case"Escape":t.preventDefault(),j(null)}else("ArrowUp"===t.key||"ArrowDown"===t.key)&&(t.preventDefault(),j(e),S(s[0]))},"aria-haspopup":"listbox","aria-expanded":k,children:[(0,a.jsxs)("div",{className:`dropdown-header select-none flex items-center justify-between md:hover:bg-[#e3e3e3] ${k?"is-open bg-[#e3e3e3]":""} ${l||""}`,onClick:t=>{t.stopPropagation(),j(k?null:e)},tabIndex:0,role:"button",children:[(0,a.jsxs)("div",{className:"overflow-hidden cursor-pointer flex items-center justify-center",children:[(0,a.jsx)("div",{className:"flex shrink-0",children:u&&u}),!x&&(0,a.jsx)("p",{className:"overflow-hidden overflow-ellipsis whitespace-nowrap cursor-pointer mr-[10px]",children:v?v.label:r||"Select an option"})]}),!f&&(0,a.jsx)("img",{className:`relative top-[1px] transition ease-in-out duration-150 ${k?"-rotate-90":"rotate-90"}`,alt:"Arrow",width:6,height:8,src:h?`/${h}`:"/dropdown-arrow-gray.svg"})]}),k&&(0,a.jsx)("div",{className:`dropdown-options pl-[40px] pt-[12px] pb-[14px] pr-[10px] min-w-full w-full overflow-y-auto ${p||""}`,style:{maxHeight:`${m}px`||"auto"},role:"listbox",children:d||s.map(e=>(0,a.jsx)("div",{ref:v?.value===e.value?N:null,role:"option","aria-selected":v?.value===e.value,className:`dropdown-option select-none cursor-pointer pl-[10px] pr-[8px] pb-[10px] pt-[11px] ${c||""} ${v?.value===e.value?"selected":""}`,onClick:()=>(e=>{w||S(e),g?.(e),j(null)})(e),tabIndex:0,children:(0,a.jsx)("div",{className:"whitespace-nowrap text-ellipsis overflow-hidden",children:e.label})},e.value))})]})}},60656:(e,t,r)=>{"use strict";r.d(t,{d:()=>a});var i=r(14232),n=r(56553);let a=()=>{let e=(0,i.useContext)(n.$);if(!e)throw Error("useToast must be used within a ToastProvider");return e}},62629:(e,t,r)=>{"use strict";r.d(t,{$Q:()=>m,Q0:()=>h,W_:()=>u,YP:()=>x,ez:()=>d,v1:()=>p,z3:()=>c}),r(14232);var i=r(15039),n=r.n(i),a=r(29476),s=r(89918),o=r(37876);let l={sm:{avatar:{single:40,multi:40}},md:{avatar:{single:60,multi:46}},lg:{avatar:{single:80}}},c=()=>null,d=()=>null,p=()=>null,u=()=>null,h=()=>null,m=()=>null,x=({children:e,className:t,size:r="md",onClick:i})=>{let x=(0,a.B)(e,c)?.props,f=(0,a.B)(e,d)?.props,w=(0,a.B)(e,u)?.props,g=(0,a.B)(e,h)?.props,b=(0,a.B)(e,m)?.props,v=(0,a.B)(e,p)?.props,S=l[r]??l.md;return(0,o.jsxs)("div",{className:n()("@container flex justify-between items-center","py-[8px] md:py-[12px] px-[24px] md:hover:bg-[#f9f9fb]","bg-white md:hover:bg-[#f9f9fb]",t),onClick:i,onKeyDown:i?e=>
5{i&&("Enter"===e.key||" "===e.key)&&(e.preventDefault(),i())}:void 0,role:i?"button":void 0,tabIndex:i?0:void 0,children:[(0,o.jsxs)("div",{className:n()("flex items-center gap-[16px] flex-1 min-w-0"),children:[(0,o.jsx)("div",{className:"hidden @[300px]:block",children:(0,o.jsx)(s.A,{...x,participants:x?.participants??[],size:S.avatar,className:n()("flex-shrink-0",x?.className)})}),(0,o.jsxs)("div",{className:"flex flex-col flex-1 overflow-hidden min-w-0",children:[(0,o.jsxs)("div",{className:"flex justify-between items-center",children:[f?.children&&(0,o.jsx)("h3",{className:n()("text-[16px] text-[#1E1D24] truncate flex-1",f?.className),children:f.children}),v?.children&&(0,o.jsx)("div",{className:n()("flex-shrink-0",v.className??""),children:v.children})]}),w?.children&&(0,o.jsx)("p",{className:n()("text-[12px] text-[#888888] font-medium",w.className),children:w.children}),g?.children&&(0,o.jsx)("p",{className:n()("text-[12px] text-[#888888] font-medium",g.className),children:g.children})]})]}),b?.children&&(0,o.jsx)("div",{className:n()("flex-shrink-0",b.className??""),children:b.children})]})}},89565:(e,t,r)=>{"use strict";r.d(t,{Vz:()=>l,mq:()=>c});var i=r(14232),n=r(37876);class a{onChange=()=>{};stack=[];views=new Map;viewTitles=new WeakMap;currentIndex=0;direction=null;_defaultViewId=null;scrollContainer=null;scrollPositions=new WeakMap;enableScrollRestoration=!0;pendingScrollRestore=null;cachedSnapshot=null;constructor({enableScrollRestoration:e=!0}={}){this.enableScrollRestoration=e}get title(){let e=this.stack[this.currentIndex];return e?this.viewTitles.get(e)??null:null}setTitle=e=>{let t=this.stack[this.currentIndex];t&&this.viewTitles.get(t)!==e&&(this.viewTitles.set(t,e),this.onChange())};push=(e,t)=>{if(this.scrollContainer&&this.enableScrollRestoration){let e=this.stack[this.currentIndex];e&&this.scrollPositions.set(e,this.scrollContainer.scrollTop)}this.direction="forward",this.stack.push([e,t]),this.currentIndex=this.stack.length-1,this.scrollContainer&&(this.scrollContainer.scrollTop=0),this.onChange()};pop=()=>{this.direction="backward";let e=this.stack[this.currentIndex];if(this.stack.pop(),this.currentIndex=Math.max(0,this.stack.length-1),this.scrollPositions.delete(e),this.scrollContainer&&this.enableScrollRestoration){let e=this.stack[this.currentIndex],t=this.scrollPositions.get(e);void 0!==t&&setTimeout(()=>{this.scrollContainer&&(this.scrollContainer.scrollTop=t)},0)}this.onChange()};clearStack(){this.stack=[],this.currentIndex=0,this.onChange()}replaceStack=(e,t)=>{this.stack=[[e,t]],this.currentIndex=0,this.direction="forward",this.onChange()};get defaultViewId(){return this._defaultViewId}set defaultViewId(e){this._defaultViewId=e}replace=(e,t)=>{this.stack[this.currentIndex]=[e,t],this.direction="forward",this.onChange()};updateCurrentState=e=>{let t=this.stack[this.currentIndex];if(t){let r=e(t[1]||{});t[1]=r,this.onChange()}};attachView=(e,t)=>{t&&!this._defaultViewId&&(this._defaultViewId=e,this.stack.at(0)?.at(0)!==e&&(this.stack.unshift([e,void 0]),this.onChange())),this.views.set(e,!0)};detachView=e=>{this.views.delete(e)};currentView=()=>this.stack.at(this.currentIndex);subscribe=e=>(this.onChange=e,()=>{this.onChange=()=>{}});getSnapshot=()=>{let e=this.currentView(),t=this.title;return this.cachedSnapshot&&this.cachedSnapshot.view===e&&this.cachedSnapshot.title===t||(this.cachedSnapshot={view:e,title:t}),this.cachedSnapshot};get canGoBack(){return this.stack.length>1}setScrollContainer=e=>{if(this.scrollContainer=e,null!==this.pendingScrollRestore&&(clearTimeout(this.pendingScrollRestore),this.pendingScrollRestore=null),e&&this.enableScrollRestoration){let e=this.stack[this.currentIndex];if(e){let t=this.scrollPositions.get(e);void 0!==t&&(this.pendingScrollRestore=window.setTimeout(()=>{this.pendingScrollRestore=null,this.scrollContainer&&(this.scrollContainer.scrollTop=t)},250))}}}}let s=(0,i.createContext)(null);function o(){let e=(0,i.useContext)(s);return e?.router}function l(){let e=o();if(!e)throw Error("useSubRouter must be used within a SubRouter");return e}function c({children:e,disableScrollRestoration:t=!1,isolated:r=!1}){let l=o(),c=(0,i.useRef)(void 0),d=(0,i.useMemo)(()=>!r&&l?l:new a({enableScrollRestoration:!t}),[t,r]),p=d.currentView(),u=d.title;
5return p!==c.current&&(c.current=p),(0,i.useSyncExternalStore)(d.subscribe,d.getSnapshot,d.getSnapshot),(0,n.jsx)(s.Provider,{value:(0,i.useMemo)(()=>({router:d}),[p,u]),children:e})}}},e=>{e.O(0,[3196,8095,5600,4886,3370,2342,6128,636,6593,8792],()=>e(e.s=45030)),_N_E=e.O()}]);

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.