TelegramPWA/dist/9954.b96be4db8b9a2c673973.js
Alexander Zinchuk 2226feb98e [Build]
2023-04-27 01:48:35 +04:00

2 lines
56 KiB
JavaScript

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[9954],{78130:(e,t,a)=>{a.r(t),a.d(t,{ActiveCallHeader:()=>Ue,GroupCall:()=>De,PhoneCall:()=>xe,RatePhoneCallModal:()=>Be});var n=a(863),i=a(88422);function o(e){return e<<0}function s(e){return e>>>0}function r(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(!e)return 0;const{length:a}=e;let n=0;for(let t=0;t<a;t++)n+=e[t]*e[t];const i=Math.sqrt(n/a)/255;return Math.min(1,i*t)}function c(e){return{id:e.id,name:e.name,"rtcp-fbs":e.feedbackTypes,clockrate:e.clockrate,parameters:e.parameters,channels:e.channels}}const l=.1,d="getDisplayMedia"in(navigator?.mediaDevices||{}),u=navigator?.mediaDevices?.getSupportedConstraints().echoCancellation,p=navigator?.mediaDevices?.getSupportedConstraints().noiseSuppression,m=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||!e.sdp)throw Error("Failed parsing SDP: session description is null");const a=e.sdp.split("\r\nm=").map(((e,t)=>0===t?e:`m=${e}`)).reduce(((e,t)=>{const a=t.match(/^m=(.+?)\s/)?.[1]||"header";return e[e.hasOwnProperty(a)&&"video"===a?"screencast":a]=t.split("\r\n").filter(Boolean),e}),{}),n=(e,t)=>t?a[t]?.find((t=>t.startsWith(e)))?.substr(e.length):Object.values(a).map((t=>t.find((t=>t.startsWith(e)))?.substr(e.length))).filter(Boolean)[0],i=e=>a[e].filter((e=>e.startsWith("a=extmap"))).map((e=>{const[,t,a]=e.match(/extmap:(\d+)(?:\/.+)?\s(.+)/);return{id:Number(t),uri:a}})),s=e=>{const t=a[e].filter((e=>e.startsWith("a=rtpmap"))).map((e=>{const[,t,a]=e.match(/:(\d+)\s(.+)/)||[],[n,i,o]=a.split("/");return{id:Number(t),name:n,clockrate:Number(i),...o&&{channels:Number(o)}}})),n=a[e].filter((e=>e.startsWith("a=rtcp-fb"))).map((e=>{const[,t,a]=e.match(/:(\d+)\s(.+)/)||[],[n,i]=a.split(" ");return{id:Number(t),type:n,subtype:i||""}})),i=a[e].filter((e=>e.startsWith("a=fmtp"))).map((e=>{const[,t,a]=e.match(/:(\d+)\s(.+)/)||[],n=a.split(";").reduce(((e,t)=>{const[a,n]=t.split("=");return e[a]=n,e}),{});if(!Object.values(n).some((e=>!e)))return{id:Number(t),data:n}})).filter(Boolean);return t.map((e=>{const t=i.filter((t=>t.id===e.id)).map((e=>e.data)).reduce(((e,t)=>Object.assign(e,t)),{}),a=n.filter((t=>t.id===e.id)).map((e=>({type:e.type,subtype:e.subtype})));return{...e,...Object.keys(t).length>0&&{parameters:t},...a.length>0&&{feedbackTypes:a}}}))},r=n("a=ssrc:","audio"),c=r&&Number(r.split(" ")[0]),l=n("a=ssrc-group:","video")?.split(" ")||void 0,d=n("a=ssrc-group:","screencast")?.split(" ")||void 0;if(!l)throw Error("Failed parsing SDP: no video ssrc");const[u,p]=n("a=fingerprint:")?.split(" ")||[],m=n("a=setup:");if(!u||!p)throw Error("Failed parsing SDP: no fingerprint");console.log(a);const g=n("a=ice-ufrag:"),v=n("a=ice-pwd:");if(!g||!v)throw Error("Failed parsing SDP: no ICE ufrag or pwd");return{fingerprints:[{fingerprint:p,hash:u,setup:t?m:"active"}],pwd:v,ufrag:g,...c&&{ssrc:o(c)},...l&&{"ssrc-groups":[{semantics:l[0],sources:l.slice(1,l.length).map(Number).map(o)},t&&d&&{semantics:d[0],sources:d.slice(1,d.length).map(Number).map(o)}].filter(Boolean)},...t&&{audioExtmap:i("audio"),videoExtmap:i("video"),screencastExtmap:i("screencast"),audioPayloadTypes:s("audio"),videoPayloadTypes:s("video"),screencastPayloadTypes:s("screencast")}}},g=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],a=arguments.length>2&&void 0!==arguments[2]&&arguments[2],n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=[],o=e=>{i.push(e)},{sessionId:r,ssrcs:c,audioExtensions:l,videoExtensions:d,audioPayloadTypes:u,videoPayloadTypes:p,transport:{ufrag:m,pwd:g,fingerprints:v,candidates:f}}=e;o("v=0"),o(`o=- ${r} 2 IN IP4 0.0.0.0`),o("s=-"),o("t=0 0"),o("a=ice-options:trickle"),o("a=msid-semantic:WMS *"),o(`a=group:BUNDLE ${c.map((e=>e.mid)).join(" ")}${a?"":" "+(n?"3":"2")}`),n||o("a=ice-lite");const h=e=>{if(e.sdpString)o(`a=${e.sdpString}`);else{let t="";t+="a=candidate:",t+=`${e.foundation} ${e.component} ${e.protocol} ${e.priority} ${e.ip} ${e.port} typ ${e.type}`,"rel-addr"in e&&(t+=` raddr ${e["rel-addr"]} rport ${e["rel-port"]}`),t+=` generation ${e.generation}`,o(t)}},C=()=>{o(`a=ice-ufrag:${m}`),o(`a=ice-pwd:${g}`),v.forEach((e=>{o(`a=fingerprint:${e.hash} ${e.fingerprint}`),o(`a=setup:${n?e.setup:"passive"}`)})),f.forEach(h)},P=e=>{const{channels:t,id:a,name:n,clockrate:i,parameters:s}=e;if(o(`a=rtpmap:${a} ${n}/${i}${t?`/${t}`:""}`),s){const e=Object.keys(s).map((e=>`${e}=${s[e]};`)).join(" ");o(`a=fmtp:${a} ${e}`)}e["rtcp-fbs"]?.forEach((e=>{o(`a=rtcp-fb:${a} ${e.type}${e.subtype?` ${e.subtype}`:""}`)}))},b=e=>{const a=e.isVideo?p:u,i=e.isVideo?"video":"audio";if(o(`m=${i} ${e.isMain?1:0} RTP/SAVPF ${a.map((e=>e.id)).join(" ")}`),o("c=IN IP4 0.0.0.0"),o("b=AS:1300"),o(`a=mid:${e.mid}`),o("a=rtcp-mux"),a.forEach(P),o("a=rtcp:1 IN IP4 0.0.0.0"),e.isVideo&&o("a=rtcp-rsize"),(e.isVideo?d:l).forEach((e=>{let{id:t,uri:a}=e;o(`a=extmap:${t} ${a}`)})),e.isRemoved)o("a=inactive");else{if(C(),n)o("a=sendrecv"),o("a=bundle-only");else{if(t)return void o("a=recvonly");e.isMain?o("a=sendrecv"):(o("a=sendonly"),o("a=bundle-only"))}e.sourceGroups.forEach((t=>{o(`a=ssrc-group:${t.semantics} ${t.sources.map(s).join(" ")}`),t.sources.forEach((t=>{const a=s(t);o(`a=ssrc:${a} cname:${e.endpoint}`),o(`a=ssrc:${a} msid:${e.endpoint} ${e.endpoint}`),o(`a=ssrc:${a} mslabel:${e.endpoint}`),o(`a=ssrc:${a} label:${e.endpoint}`)}))}))}};return n?c.filter(b):c.filter((e=>"0"===e.mid||"1"===e.mid)).map(b),a||(o("m=application 1 UDP/DTLS/SCTP webrtc-datachannel"),o("c=IN IP4 0.0.0.0"),C(),o("a=ice-options:trickle"),o("a=mid:"+(n?"3":a?"1":"2")),o("a=sctp-port:5000"),o("a=max-message-size:262144")),n||c.filter((e=>"0"!==e.mid&&"1"!==e.mid)).map(b),`${i.join("\n")}\n`},v=e=>{const t=e.createOscillator(),a=t.connect(e.createMediaStreamDestination());return t.start(),new MediaStream([Object.assign(a.stream.getAudioTracks()[0],{enabled:!1})])},f=function(){let{width:e=640,height:t=480}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const a=Object.assign(document.createElement("canvas"),{width:e,height:t}),n=a.getContext("2d");if(!n)throw Error("Cannot create canvas ctx");n.fillRect(0,0,e,t);const i=a.captureStream();return new MediaStream([Object.assign(i.getVideoTracks()[0],{enabled:!1})])};let h,C;function P(e){h&&(h.screenshareDataChannel?.close(),h.screenshareConnection?.close(),e||h.onUpdate?.({"@type":"updateGroupCallLeavePresentation"}))}function b(e){return h?.streams?.[e]}function Z(e,t){const a=h?.participantFunctions?.[e];a&&a.setVolume?.(t)}function y(e,t){const a=t||h?.myId,n=a&&b(a)?.[e];return!!n&&n.getTracks()[0]?.enabled}function w(e){h?.onUpdate?.({"@type":"updateGroupCallStreams",userId:e,hasAudioStream:y("audio",e),hasVideoStream:y("video",e),hasPresentationStream:y("presentation",e),amplitude:h.speaking?.[e]})}function k(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user";return"presentation"===e?navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}):navigator.mediaDevices.getUserMedia({audio:"audio"===e&&{...u&&{echoCancellation:!0},...p&&{noiseSuppression:!0}},video:"video"===e&&{facingMode:t}})}async function E(){if(!(h?.myId&&h.connection&&h.streams&&h.facingMode))return;const e=b(h.myId)?.video;if(!e)return;const t=e.getTracks()[0];if(!t)return;const a=h.connection.getSenders().find((e=>t.id===e.track?.id));if(a){h.facingMode="environment"===h.facingMode?"user":"environment";try{const e=await k("video",h.facingMode);await a.replaceTrack(e.getTracks()[0]),h.streams[h.myId].video=e}catch(e){}}}async function S(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(!(h&&h.myId&&h.connection&&h.streams))return;const a=b(h.myId)?.[e];if(!a)return;const n=a.getTracks()[0];if(!n)return;const i=[...h.connection.getSenders(),...h.screenshareConnection?.getSenders()||[]].find((e=>n.id===e.track?.id));if(i){t=void 0===t?!n.enabled:t;try{if(t&&!n.enabled){const t=await k(e);if(await i.replaceTrack(t.getTracks()[0]),h.streams[h.myId][e]=t,"video"===e)h.facingMode="user";else if("audio"===e){const{audioContext:e}=h;if(!e)return;const a=e.createMediaStreamSource(t),n=e.createAnalyser();n.minDecibels=-100,n.maxDecibels=-30,n.smoothingTimeConstant=.05,n.fftSize=1024,a.connect(n),h={...h,participantFunctions:{...h.participantFunctions,[h.myId]:{...h.participantFunctions?.[h.myId],getCurrentAmplitude:()=>{const e=new Uint8Array(n.frequencyBinCount);return n.getByteFrequencyData(e),r(e,1.5)}}}}}}else if(!t&&n.enabled){n.stop();const t="audio"===e?h.silence:h.black;if(!t)return;await i.replaceTrack(t.getTracks()[0]),h.streams[h.myId][e]=t,"video"===e&&(h.facingMode=void 0)}w(h.myId),"presentation"!==e||t||P(!0)}catch(e){}}}function I(e){h?.onUpdate?.({"@type":"updateGroupCallConnectionState",connectionState:e})}function N(){h&&(h.myId&&h.streams?.[h.myId]&&Object.values(h.streams[h.myId]||{}).forEach((e=>{e?.getTracks().forEach((e=>{e.stop()}))})),P(!0),h.dataChannel?.close(),h.connection?.close(),I("disconnected"),h.analyserInterval&&clearInterval(h.analyserInterval),h=void 0)}function T(){h&&h.participantFunctions&&Object.keys(h.participantFunctions).forEach((e=>{const{getCurrentAmplitude:t}=h.participantFunctions[Number(e)];if(t){const a=t(),n=h.speaking[e]||0;h.speaking[e]=a,(a>l&&n<=l||a<=l&&n>l)&&w(e)}}))}async function M(e){if(!h)return;const{participants:t,conference:a,connection:n,myId:i}=h;if(!(t&&a&&n&&a.ssrcs&&a.transport&&i))return;if(e.find((e=>e.isSelf&&e.source!==h?.conference?.ssrcs?.find((e=>e.isMain&&!e.isVideo))?.sourceGroups[0].sources[0])))return void N();const o=[];if(e.forEach((e=>{if(console.log("handleUpdateGroupCallParticipants",e),e.isSelf)return void(e.isMuted&&!e.canSelfUnmute&&(S("audio",!1),S("video",!1),S("presentation",!1)));const{isLeft:t}=e,n=e.isMuted||e.isMutedByMe,i=!e.isVideoJoined||!e.video||t,s=!e.presentation||t;let r=!1,c=!1,l=!1;a.ssrcs.filter((t=>t.userId===e.id)).forEach((t=>{t.isVideo||(t.sourceGroups[0].sources[0]===e.source&&(c=!0),t.isRemoved=n),t.isVideo&&(t.isPresentation||(e.video&&t.endpoint===e.video.endpoint&&(r=!0),t.isRemoved=i),t.isPresentation&&(e.presentation&&t.endpoint===e.presentation.endpoint&&(l=!0),t.isRemoved=s))})),n||c||(h.lastMid=h.lastMid+1,a.ssrcs.push({userId:e.id,isMain:!1,endpoint:`audio${e.source}`,isVideo:!1,sourceGroups:[{semantics:"FID",sources:[e.source]}],mid:h.lastMid.toString()})),i||r||!e.video||(h.lastMid=h.lastMid+1,o.push(e.video.endpoint),a.ssrcs.push({userId:e.id,isMain:!1,endpoint:e.video.endpoint,isVideo:!0,sourceGroups:e.video.sourceGroups,mid:h.lastMid.toString()})),s||l||!e.presentation||(h.lastMid=h.lastMid+1,a.ssrcs.push({isPresentation:!0,userId:e.id,isMain:!1,endpoint:e.presentation.endpoint,isVideo:!0,sourceGroups:e.presentation.sourceGroups,mid:h.lastMid.toString()}))})),h.updatingParticipantsQueue)return void h.updatingParticipantsQueue.push(a);h.updatingParticipantsQueue=[];const s=g(a);console.log("build sdp!",s),await n.setRemoteDescription({type:"offer",sdp:s});try{const e=await n.createAnswer();if(await n.setLocalDescription(e),w(i),h.updatingParticipantsQueue.length>0)for(const e of h.updatingParticipantsQueue){await n.setRemoteDescription({type:"offer",sdp:g(e)});const t=await n.createAnswer();await n.setLocalDescription(t),w(i)}h.updatingParticipantsQueue=void 0}catch(e){console.error(e)}}function V(e){if(!(h&&h.audioElement&&h.audioContext&&h.mediaStream))return;const t=h.conference?.ssrcs?.find((t=>t.endpoint===e.track.id));if(!t||!t.userId)return;const{userId:a,isPresentation:n}=t,i=h.participants?.find((e=>e.id===a)),o="video"===e.track.kind?n?"presentation":"video":"audio";e.track.onended=()=>{delete h?.streams?.[a][o],w(a)};const s=e.streams[0];if("audio"===e.track.kind){const{mediaStream:e}=h,t=new window.AudioContext,n=t.createMediaStreamSource(s),o=t.createGain();o.gain.value=(i?.volume||1e4)/1e4;const c=t.createGain();o.gain.value=1;const l=t.createAnalyser();l.minDecibels=-100,l.maxDecibels=-30,l.smoothingTimeConstant=.05,l.fftSize=1024,n.connect(l).connect(c).connect(o).connect(t.destination),e.addTrack(n.mediaStream.getAudioTracks()[0]);const d=new Audio;d.srcObject=s,d.muted=!0,d.remove(),h={...h,participantFunctions:{...h.participantFunctions,[a]:{...h.participantFunctions?.[a],setVolume:e=>{o.gain.value=e>1?2*e:e},toggleMute:e=>{c.gain.value=e?0:1},getCurrentAmplitude:()=>{const e=new Uint8Array(l.frequencyBinCount);return l.getByteFrequencyData(e),r(e,1.5)}}}}}h={...h,streams:{...h.streams,[a]:{...h.streams?.[a],[o]:s}}},w(a)}function G(e,t){let a=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const n=new RTCPeerConnection,i=a?void 0:function(e){const t=e.createDataChannel("data",{id:0});return t.onopen=()=>{},t.onmessage=e=>{JSON.parse(e.data).colibriClass},t.onerror=e=>{console.log("%conerror","background: green; font-size: 5em"),console.error(e)},t}(n);return e.forEach((e=>e.getTracks().forEach((t=>{n.addTrack(t,e)})))),a||(n.oniceconnectionstatechange=()=>{const e=n.iceConnectionState;console.log("ice",e),"connected"===e||"completed"===e?I("connected"):"checking"===e||"new"===e?I("connecting"):"disconnected"===n.iceConnectionState&&I("reconnecting")}),n.ontrack=V,n.onnegotiationneeded=async()=>{if(!h)return;const{myId:i}=h;if(!i)return;const o=await n.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!a});if(console.log("created offer!",o),await n.setLocalDescription(o),!o.sdp)return;const s=m(o);console.log("parsed sdp",s);const r=a?void 0:{userId:"",sourceGroups:[{semantics:"FID",sources:[s.ssrc||0]}],isRemoved:a,isMain:!0,isVideo:!1,isPresentation:a,endpoint:a?"1":"0",mid:a?"1":"0"},c=s["ssrc-groups"]&&{isPresentation:a,userId:"",sourceGroups:s["ssrc-groups"],isMain:!0,isVideo:!0,endpoint:a?"0":"1",mid:a?"0":"1"},l=a?h.screenshareConference:h.conference,d=[];a?(c&&d.push(c),r&&d.push(r)):(r&&d.push(r),c&&d.push(c));const u=e.find((e=>"audio"===e.getTracks()[0].kind)),p=e.find((e=>"video"===e.getTracks()[0].kind));h={...h,...a?{screenshareConference:{...l,ssrcs:d}}:{conference:{...l,ssrcs:d}},streams:{...h.streams,[i]:{...h.streams?.[i],...u&&{audio:u},...!a&&p?{video:p}:{presentation:p}}}},w(i),t(s)},{connection:n,dataChannel:i}}function D(){C?.onUpdate({...C.mediaState,"@type":"updatePhoneCallMediaState"})}function U(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user";return"presentation"===e?navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0}):navigator.mediaDevices.getUserMedia({audio:"audio"===e&&{...u&&{echoCancellation:!0},...p&&{noiseSuppression:!0}},video:"video"===e&&{facingMode:t}})}async function A(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(!C)return;const a="audio"===e?C.streams.ownAudio:"video"===e?C.streams.ownVideo:C.streams.ownPresentation;if(!a)return;const n=a.getTracks()[0];if(!n)return;const i=C.connection.getSenders().find((e=>n.id===e.track?.id));if(i){t=void 0===t?!n.enabled:t;try{if(t&&!n.enabled){const t=await U(e);t.getTracks()[0].onended=()=>{A(e,!1)},await i.replaceTrack(t.getTracks()[0]),"audio"===e?C.streams.ownAudio=t:"video"===e?(C.streams.ownVideo=t,C.facingMode="user"):C.streams.ownPresentation=t,"video"!==e&&"presentation"!==e||A("video"===e?"presentation":"video",!1)}else if(!t&&n.enabled){n.stop();const t="audio"===e?C.silence:"video"===e?C.blackVideo:C.blackPresentation;if(!t)return;await i.replaceTrack(t.getTracks()[0]),"audio"===e?C.streams.ownAudio=t:"video"===e?C.streams.ownVideo=t:C.streams.ownPresentation=t}D(),O()}catch(e){}}}function $(){C&&(C.streams.ownVideo?.getTracks().forEach((e=>e.stop())),C.streams.ownPresentation?.getTracks().forEach((e=>e.stop())),C.streams.ownAudio?.getTracks().forEach((e=>e.stop())),C.dataChannel.close(),C.connection.close(),C=void 0)}function O(){if(!C)return;const{emitSignalingData:e,streams:t}=C;e({"@type":"MediaState",videoRotation:0,isMuted:!t.ownAudio?.getTracks()[0].enabled,isBatteryLow:!0,videoState:t.ownVideo?.getTracks()[0].enabled?"active":"inactive",screencastState:t.ownPresentation?.getTracks()[0].enabled?"active":"inactive"})}function j(e){if(!C||C.isOutgoing)return e;const{payloadTypes:t}=e,a=t.findIndex((e=>"VP8"===e.name)),n=t[a],i=t.findIndex((e=>Number(e.parameters?.apt)===n.id));return e.payloadTypes=[t[a],t[i]],e}function R(e){if(!C)return;const{emitSignalingData:t}=C;e.ssrc&&e["ssrc-groups"]&&e["ssrc-groups"][0]&&e["ssrc-groups"][1]&&t({"@type":"InitialSetup",fingerprints:e.fingerprints,ufrag:e.ufrag,pwd:e.pwd,audio:{ssrc:s(e.ssrc).toString(),ssrcGroups:[],payloadTypes:e.audioPayloadTypes,rtpExtensions:e.audioExtmap},video:j({ssrc:s(e["ssrc-groups"][0].sources[0]).toString(),ssrcGroups:[{semantics:e["ssrc-groups"][0].semantics,ssrcs:e["ssrc-groups"][0].sources.map(s)}],payloadTypes:e.videoPayloadTypes,rtpExtensions:e.videoExtmap}),screencast:j({ssrc:s(e["ssrc-groups"][1].sources[0]).toString(),ssrcGroups:[{semantics:e["ssrc-groups"][1].semantics,ssrcs:e["ssrc-groups"][1].sources.map(s)}],payloadTypes:e.screencastPayloadTypes,rtpExtensions:e.screencastExtmap})})}async function _(e){if(C&&C.connection)switch(console.log(e),e["@type"]){case"MediaState":C.mediaState=e,D(),O();break;case"Candidates":{const{candidates:t,gotInitialSetup:a}=C;if(!t)return;e.candidates.forEach((e=>{C.candidates.push(e.sdpString)})),a&&await Promise.all(C.candidates.map((e=>C.connection.addIceCandidate({candidate:e,sdpMLineIndex:0}))));break}case"InitialSetup":{const{connection:t,isOutgoing:a}=C;if(!t)return;const n={transport:{candidates:[],ufrag:e.ufrag,pwd:e.pwd,fingerprints:e.fingerprints,"rtcp-mux":!1,xmlns:""},sessionId:Date.now(),ssrcs:[e.audio&&{isVideo:!1,isMain:!1,userId:"123",endpoint:"0",mid:"0",sourceGroups:[{semantics:"FID",sources:[e.audio.ssrc]}]},e.video&&{isVideo:!0,isPresentation:!1,isMain:!1,userId:"123",endpoint:"1",mid:"1",sourceGroups:e.video.ssrcGroups.map((e=>({semantics:e.semantics,sources:e.ssrcs})))},e.screencast&&{isVideo:!0,isPresentation:!0,isMain:!1,userId:"123",endpoint:"2",mid:"2",sourceGroups:e.screencast.ssrcGroups.map((e=>({semantics:e.semantics,sources:e.ssrcs})))}],audioPayloadTypes:e.audio.payloadTypes?.map(c)||[],audioExtensions:e.audio.rtpExtensions,videoPayloadTypes:j(e.video).payloadTypes?.map(c)||[],videoExtensions:e.video.rtpExtensions};if(await t.setRemoteDescription({sdp:g(n,a,void 0,!0),type:a?"answer":"offer"}),C.conference=n,!a){const e=await t.createAnswer();if(!e)return;await t.setLocalDescription(e),R(m(e,!0))}C.gotInitialSetup=!0,await Promise.all(C.candidates.map((e=>t.addIceCandidate({candidate:e,sdpMLineIndex:0}))));break}}}var x=a(60748),F=a(33555),B=a(83716),L=a(71226),q=a(11192),H=a(42431),J=a(78958),z=a(27225),X=a(25260),Y=a(60782),K=a(44271),Q=a(65054);(0,F.iw)("leaveGroupCall",(async(e,t,a)=>{const{isFromLibrary:n,shouldDiscard:o,shouldRemove:s,rejoin:r,tabId:c=(0,Q._w)()}=a||{},l=(0,H.mU)(e);l&&(e=(0,J.Ic)(e,{connectionState:"disconnected"},l.participantsCount-1),(0,F.R3)(e),await(0,L.t9)("leaveGroupCall",{call:l}),o&&await(0,L.t9)("discardGroupCall",{call:l}),e=(0,F.Rd)(),s&&(e=(0,J.dc)(e,l.id)),(0,i.Mt)(),e={...e,groupCalls:{...e.groupCalls,activeGroupCallId:void 0}},(0,F.R3)(e),t.toggleGroupCallPanel({force:void 0,tabId:c}),n||N(),t.afterHangUp(),r&&t.requestMasterAndJoinGroupCall({...r,tabId:c}))})),(0,F.iw)("toggleGroupCallVideo",(async e=>{const t=(0,H.mU)(e),a=(0,q.dy)(e,e.currentUserId);a&&t&&(await S("video"),await(0,L.t9)("editGroupCallParticipant",{call:t,videoStopped:!y("video"),participant:a}))})),(0,F.iw)("requestToSpeak",((e,t,a)=>{const{value:n}=a||{value:!0},i=(0,H.mU)(e),o=(0,q.dy)(e,e.currentUserId);o&&i&&(0,L.t9)("editGroupCallParticipant",{call:i,raiseHand:n,participant:o})})),(0,F.iw)("setGroupCallParticipantVolume",((e,t,a)=>{const{participantId:n,volume:i}=a,o=(0,H.mU)(e),s=(0,q.dy)(e,n);s&&o&&(Z(n,Math.floor(i/B.Ro)/100),(0,L.t9)("editGroupCallParticipant",{call:o,volume:Number(i),participant:s}))})),(0,F.iw)("toggleGroupCallMute",(async(e,t,a)=>{const{participantId:n,value:i}=a||{},o=(0,H.mU)(e),s=(0,q.dy)(e,n||e.currentUserId);if(!s||!o)return;const r=void 0===i?y("audio",s.id):i;n?Z(n,r?0:1):await S("audio"),await(0,L.t9)("editGroupCallParticipant",{call:o,muted:r,participant:s})})),(0,F.iw)("toggleGroupCallPresentation",(async(e,t,a)=>{const n=(0,H.mU)(e),i=(0,q.dy)(e,e.currentUserId);if(i&&n){if(void 0!==a?.value?a?.value:!y("presentation")){const e=await async function(){if(h)try{const e=await k("presentation");if(!e)return;return e.getTracks()[0].onended=()=>{h&&h.myId&&(delete h.streams?.[h.myId].presentation,w(h.myId),P())},await new Promise((t=>{const{connection:a,dataChannel:n}=G([e],t,!0);h={...h,screenshareConnection:a,screenshareDataChannel:n}}))}catch(e){return}}();if(!e)return;await(0,L.t9)("joinGroupCallPresentation",{call:n,params:e})}else await S("presentation",!1),await(0,L.t9)("leaveGroupCallPresentation",{call:n});await(0,L.t9)("editGroupCallParticipant",{call:n,presentationPaused:!y("presentation"),participant:i})}})),(0,F.iw)("connectToActiveGroupCall",(async(e,t,a)=>{const{tabId:n=(0,Q._w)()}=a||{},o=(0,H.mU)(e);if(!o)return;if("discarded"===o.connectionState)return void t.showNotification({message:"This voice chat is not active",tabId:n});const s=(0,i.FF)(),r=(0,i.NH)();if(!s||!r)return;const{currentUserId:c}=e;if(!c)return;const l=await function(e,t,a,n){if(h)throw Error("Already in call");I("connecting");const i=new MediaStream;return a.srcObject=i,a.play().catch((e=>console.warn(e))),h={onUpdate:n,participants:[],myId:e,speaking:{},silence:v(t),black:f({width:640,height:480}),analyserInterval:setInterval(T,1e3),audioElement:a,audioContext:t,mediaStream:i,lastMid:3},new Promise((e=>{h={...h,...G([h.silence,h.black],e)}}))}(c,r,s,t.apiUpdate),d=await(0,L.t9)("joinGroupCall",{call:o,params:l,inviteHash:o.inviteHash});if(e=(0,F.Rd)(),d&&(t.loadMoreGroupCallParticipants(),o.chatId)){e=(0,F.Rd)();const a=(0,q.Z1)(e,o.chatId);if(!a)return;await(0,z.ft)(e,t,a,n)}})),(0,F.iw)("connectToActivePhoneCall",(async(e,t)=>{const{phoneCall:a}=e;if(!a)return;const n=(0,H.fu)(e);if(!n)return;const i=await(0,L.t9)("getDhConfig");if(!i)return;await(0,L.t9)("createPhoneCallState",[!0]);const o=await(0,L.t9)("requestPhoneCall",[i]),s=await(0,L.t9)("requestCall",{user:n,gAHash:o,isVideo:a.isVideo});s?(e=(0,F.Rd)(),e=(0,X.Sh)(e,(0,Y.ee)(s.users,"id")),(0,F.R3)(e)):"hangUp"in t&&t.hangUp({tabId:(0,Q._w)()})})),(0,F.iw)("acceptCall",(async e=>{const{phoneCall:t}=e;if(!t)return;const a=await(0,L.t9)("getDhConfig");if(!a)return;await(0,L.t9)("createPhoneCallState",[!1]);const n=await(0,L.t9)("acceptPhoneCall",[a]),i=await(0,L.t9)("acceptCall",{call:t,gB:n});i&&(e=(0,F.Rd)(),e=(0,X.Sh)(e,(0,Y.ee)(i.users,"id")),(0,F.R3)(e))})),(0,F.iw)("sendSignalingData",((e,t,a)=>{const{phoneCall:n}=e;if(!n)return;const i=JSON.stringify(a);(async()=>{const e=await(0,L.t9)("encodePhoneCallData",[i]);e&&(0,L.t9)("sendSignalingData",{data:e,call:n})})()})),(0,F.iw)("closeCallRatingModal",((e,t,a)=>{const{tabId:n=(0,Q._w)()}=a||{};return(0,K.i)(e,{ratingPhoneCall:void 0},n)})),(0,F.iw)("setCallRating",((e,t,a)=>{const{rating:n,comment:i,tabId:o=(0,Q._w)()}=a,{ratingPhoneCall:s}=(0,q.jU)(e,o);if(s)return(0,L.t9)("setCallRating",{call:s,rating:n,comment:i}),(0,K.i)(e,{ratingPhoneCall:void 0},o)})),(0,F.iw)("hangUp",((e,t,a)=>{const{tabId:n=(0,Q._w)()}=a||{},{phoneCall:i}=e;if(i){if("discarded"===i.state)return(0,L.t9)("destroyPhoneCallState"),$(),e={...e,phoneCall:void 0},(0,F.R3)(e),t.toggleGroupCallPanel({force:void 0,tabId:n}),void t.afterHangUp();if((0,L.t9)("destroyPhoneCallState"),$(),(0,L.t9)("discardCall",{call:i}),"requesting"===i.state)return e={...e,phoneCall:void 0},(0,F.R3)(e),t.toggleGroupCallPanel({force:void 0,tabId:n}),void t.afterHangUp();setTimeout((()=>{e=(0,F.Rd)(),e={...e,phoneCall:void 0},(0,F.R3)(e),t.toggleGroupCallPanel({force:void 0,tabId:n}),t.afterHangUp()}),500)}}));var W=a(59692);const ee=new Uint16Array([55357,56841,55357,56845,55357,56859,55357,56877,55357,56881,55357,56865,55357,56846,55357,56884,55357,56885,55357,56840,55357,56876,55357,56839,55357,56847,55357,56430,55357,56439,55357,56450,55357,56438,55357,56424,55357,56425,55357,56436,55357,56437,55357,56891,55357,56893,55357,56896,55357,56442,55357,56904,55357,56905,55357,56906,55357,56448,55357,56445,55357,56489,55357,56613,55357,56485,55357,56484,55357,56386,55357,56384,55357,56387,55357,56389,55357,56388,55357,56397,55357,56398,55357,56396,55357,56394,9996,9995,55357,56400,55357,56390,55357,56391,55357,56393,55357,56392,55357,56911,55357,56399,55357,56490,55357,57014,55356,57283,55357,56451,55357,56427,55357,56426,55357,56428,55357,56429,55357,56453,55356,57257,55357,56401,55357,56402,55357,56415,55357,56414,55357,56416,55357,56405,55357,56407,55357,56406,55357,56409,55357,56412,55357,56403,55356,57216,55357,56452,55357,56475,55357,56473,55357,56476,55357,56474,55357,56461,55357,56462,55357,56374,55357,56378,55357,56369,55357,56365,55357,56377,55357,56368,55357,56376,55357,56367,55357,56360,55357,56379,55357,56375,55357,56366,55357,56343,55357,56372,55357,56337,55357,56344,55357,56380,55357,56359,55357,56357,55357,56340,55357,56333,55357,56354,55357,56347,55357,56349,55357,56348,55357,56350,55357,56332,55357,56345,55357,56346,55357,56351,55357,56364,55357,56331,55357,56336,55357,56330,55357,56363,55356,57152,55356,57145,55356,57147,55356,57153,55356,57150,55356,57156,55356,57141,55356,57140,55356,57139,55356,57118,55356,57114,55356,57113,55356,57102,55356,57099,9889,9748,10052,9924,55356,57088,55356,57096,55356,57098,55356,57235,55356,57222,55356,57219,55357,56443,55356,57221,55356,57220,55356,57217,55356,57224,55357,56622,55356,57253,55357,56567,55357,56511,55357,56507,9742,55357,56545,55357,56570,55357,56571,55357,56585,55357,56596,9203,9200,8986,55357,56594,55357,56593,55357,56590,55357,56481,55357,56614,55357,56588,55357,56587,55357,57023,55357,57021,55357,56615,55357,56616,55357,57002,55357,57004,55357,56483,55357,56619,55357,56618,55357,56458,55357,56457,55357,56496,55357,56501,55357,56499,9993,55357,56555,55357,56550,55357,56517,55357,56513,9986,55357,56524,55357,56526,10002,9999,55357,56528,55357,56538,55357,56620,55357,56621,55356,57256,55356,57260,55356,57252,55356,57255,55356,57269,55356,57273,55356,57275,55356,57274,55356,57272,55357,56446,55356,57262,55356,56527,55356,57266,55356,57263,55356,57288,55356,57280,9917,9918,55356,57278,55356,57265,55356,57289,55356,57267,55356,57281,55356,57287,55356,57286,55356,57290,55356,57284,9749,55356,57212,55356,57210,55356,57207,55356,57204,55356,57173,55356,57172,55356,57183,55356,57175,55356,57201,55356,57178,55356,57180,55356,57185,55356,57203,55356,57182,55356,57193,55356,57190,55356,57218,55356,57200,55356,57194,55356,57195,55356,57197,55356,57199,55356,57166,55356,57167,55356,57162,55356,57163,55356,57170,55356,57159,55356,57161,55356,57171,55356,57169,55356,57164,55356,57168,55356,57165,55356,57158,55356,57157,55356,57149,55356,57313,55356,57317,55356,57318,9962,55356,57328,9978,55356,57325,55357,56827,55357,56829,55356,57248,55356,57249,9970,55356,57250,55357,56994,55357,56996,9875,55357,56960,9992,55357,56961,55357,56962,55357,56971,55357,56974,55357,56972,55357,56985,55357,56983,55357,56981,55357,56987,55357,57e3,55357,56980,55357,56978,55357,56977,55357,57010,55357,56992,55357,56988,55357,56998,9888,55357,56999,9981,55356,57264,55357,56831,55356,57258,55356,57261,55356,56815,55356,56821,55356,56816,55356,56823,55356,56809,55356,56810,55356,56808,55356,56819,55356,56826,55356,56824,55356,56811,55356,56823,55356,56810,55356,56824,55356,56814,55356,56825,55356,56823,55356,56826,55356,56812,55356,56807,49,8419,50,8419,51,8419,52,8419,53,8419,54,8419,55,8419,56,8419,57,8419,48,8419,55357,56607,10071,10067,9829,9830,55357,56495,55357,56599,55357,56625,55357,56628,55357,56629,55357,56630,55357,56631]),te=[0,2,4,6,8,10,12,14,16,18,20,22,24,26,28,30,32,34,36,38,40,42,44,46,48,50,52,54,56,58,60,62,64,66,68,70,72,74,76,78,80,82,84,86,87,88,90,92,94,96,98,100,102,104,106,108,110,112,114,116,118,120,122,124,126,128,130,132,134,136,138,140,142,144,146,148,150,152,154,156,158,160,162,164,166,168,170,172,174,176,178,180,182,184,186,188,190,192,194,196,198,200,202,204,206,208,210,212,214,216,218,220,222,224,226,228,230,232,234,236,238,240,242,244,246,248,250,252,254,256,258,259,260,261,262,264,266,268,270,272,274,276,278,280,282,284,286,288,290,292,294,295,297,299,301,303,305,306,307,308,310,312,314,316,318,320,322,324,326,328,330,332,334,336,338,340,342,344,346,348,350,351,353,355,357,359,360,362,364,365,366,368,370,372,374,376,378,380,382,384,386,388,390,392,394,396,398,400,402,404,406,407,408,410,412,414,416,418,420,422,424,426,427,429,431,433,435,437,439,441,443,445,447,449,451,453,455,457,459,461,463,465,467,469,471,473,475,477,479,481,483,485,487,489,491,493,495,497,499,501,503,505,507,508,510,511,513,515,517,519,521,522,524,526,528,529,531,532,534,536,538,540,542,544,546,548,550,552,554,556,558,560,562,564,566,567,569,570,572,574,576,578,582,586,590,594,598,602,606,610,614,618,620,622,624,626,628,630,632,634,636,638,640,641,642,643,644,646,648,650,652,654,656,658];(0,F.iw)("apiUpdate",((e,t,a)=>{const{activeGroupCallId:i}=e.groupCalls;switch(a["@type"]){case"updateGroupCallLeavePresentation":t.toggleGroupCallPresentation({value:!1});break;case"updateGroupCallStreams":if(!a.userId||!i)break;if(!(0,H.GU)(e,i,a.userId))break;return(0,J.B6)(e,i,a.userId,(0,Y.CE)(a,["@type","userId"]));case"updateGroupCallConnectionState":if(!i)break;if("disconnected"===a.connectionState){"leaveGroupCall"in t&&t.leaveGroupCall({isFromLibrary:!0,tabId:(0,Q._w)()});break}return(0,J.AH)(e,i,{connectionState:a.connectionState,isSpeakerDisabled:a.isSpeakerDisabled});case"updateGroupCallParticipants":{const{groupCallId:e,participants:t}=a;i===e&&M(t);break}case"updateGroupCallConnection":{if(a.data.stream){t.showNotification({message:"Big live streams are not yet supported",tabId:(0,Q._w)()}),"leaveGroupCall"in t&&t.leaveGroupCall({tabId:(0,Q._w)()});break}!async function(e,t){if(!h)return;const a=t?h.screenshareConference:h.conference,n=t?h.screenshareConnection:h.connection;if(!a||!n||!a.ssrcs)return;const i=Date.now(),o={...a,transport:e.transport,sessionId:i,audioExtensions:e.audio?.["rtp-hdrexts"],audioPayloadTypes:e.audio?.["payload-types"],videoExtensions:e.video?.["rtp-hdrexts"],videoPayloadTypes:e.video?.["payload-types"]};h={...h,...t?{screenshareConference:o}:{conference:o}},console.warn("update remote description",o,g(o,!0,t));try{await n.setRemoteDescription({type:"answer",sdp:g(o,!0,t)})}catch(e){console.error(e)}}(a.data,a.presentation);const n=(0,H.mU)(e);n?.participants&&Object.keys(n.participants).length>0&&M(Object.values(n.participants));break}case"updatePhoneCallMediaState":return{...e,phoneCall:{...e.phoneCall,...(0,Y.CE)(a,["@type"])}};case"updatePhoneCall":{if(!n.Bi)return;const{phoneCall:i,currentUserId:s}=e,r={...i,...a.call},c=i?.adminId===s;if(e={...e,phoneCall:r},i&&i.id&&r.id!==i.id)return void("discarded"!==r.state&&(0,L.t9)("discardCall",{call:r,isBusy:!0}));const{accessHash:l,state:d,connections:u,gB:p}=r;if(("active"===d||"accepted"===d)&&(o=r.protocol,!o?.libraryVersions.some((e=>"4.0.0"===e||"4.0.1"===e)))){const a=(0,H.fu)(e);return"hangUp"in t&&t.hangUp({tabId:(0,Q._w)()}),void t.showNotification({message:W.Iu("VoipPeerIncompatible",a?.firstName),tabId:(0,Q._w)()})}if("discarded"===d){if(!i)return;return(0,K.i)(e,{...r.needRating&&{ratingPhoneCall:r},isCallPanelVisible:void 0},(0,Q._w)())}return"accepted"===d&&l&&p?(async()=>{const{gA:t,keyFingerprint:a,emojis:n}=await(0,L.t9)("confirmPhoneCall",[p,ee,te]),i={...(e=(0,F.Rd)()).phoneCall,emojis:n};e={...e,phoneCall:i},(0,F.R3)(e);const o=await(0,L.t9)("confirmCall",{call:r,gA:t,keyFingerprint:a});o&&(e=(0,F.Rd)(),e=(0,X.Sh)(e,(0,Y.ee)(o.users,"id")),(0,F.R3)(e))})():"active"===d&&u&&"active"!==i?.state&&(c||((0,L.t9)("receivedCall",{call:r}),(async()=>{const{emojis:t}=await(0,L.t9)("confirmPhoneCall",[r.gAOrB,ee,te]),a={...(e=(0,F.Rd)()).phoneCall,emojis:t};e={...e,phoneCall:a},(0,F.R3)(e)})()),async function(e,t,a,n,i){const o=new RTCPeerConnection({iceServers:e.map((e=>({urls:[e.isTurn&&`turn:${e.ip}:${e.port}`,e.isStun&&`stun:${e.ip}:${e.port}`].filter(Boolean),username:e.username,credentialType:"password",credential:e.password}))),iceCandidatePoolSize:2}),s=v(new AudioContext),r=f({width:640,height:480}),c=f({width:640,height:480});o.addTrack(s.getTracks()[0],s),o.addTrack(r.getTracks()[0],r),o.addTrack(c.getTracks()[0],c),o.onicecandidate=e=>{e.candidate&&t({"@type":"Candidates",candidates:[{sdpString:e.candidate.candidate}]})},o.onconnectionstatechange=()=>{i({"@type":"updatePhoneCallConnectionState",connectionState:o.connectionState})},o.ontrack=e=>{if(!C)return;const t=e.streams[0];"audio"===e.track.kind?(C.audio.srcObject=t,C.audio.play().catch(),C.streams.audio=t):"1"===e.transceiver.mid?C.streams.video=t:C.streams.presentation=t,D()};const l=o.createDataChannel("data",{id:0,negotiated:!0});l.onmessage=e=>{_(JSON.parse(e.data))};const d=new Audio;C={audio:d,connection:o,emitSignalingData:t,isOutgoing:a,candidates:[],onUpdate:i,streams:{ownVideo:r,ownAudio:s,ownPresentation:c},mediaState:{isBatteryLow:!1,screencastState:"inactive",videoState:"inactive",videoRotation:0,isMuted:!0},blackVideo:r,blackPresentation:c,silence:s,dataChannel:l};try{n&&A("video",!0),A("audio",!0)}catch(e){}if(a){const e=await o.createOffer({offerToReceiveAudio:!0,offerToReceiveVideo:!0});await o.setLocalDescription(e),R(m(e,!0))}}(u,t.sendSignalingData,c,Boolean(r?.isVideo),t.apiUpdate)),e}case"updatePhoneCallConnectionState":{const{connectionState:n}=a;return e.phoneCall?"closed"===n||"disconnected"===n||"failed"===n?void("hangUp"in t&&t.hangUp({tabId:(0,Q._w)()})):{...e,phoneCall:{...e.phoneCall,isConnected:"connected"===n}}:e}case"updatePhoneCallSignalingData":{const{phoneCall:t}=e;if(!t)break;(0,L.t9)("decodePhoneCallData",[a.data])?.then(_);break}}var o}));var ae=a(57773),ne=a(46752),ie=a(60706),oe=a(59107),se=a(42797),re=a(34288),ce=a(231),le=a(53106),de=a(58964),ue=a(13103);const pe=()=>{navigator.vibrate?.(50)};var me=a(87204),ge=a(58912);const ve=(0,x.X$)((0,F.c$)((e=>{const t=(0,H.mU)(e),{connectionState:a}=t||{},n=t&&(0,H.GU)(e,t.id,e.currentUserId),{raiseHandRating:i,hasAudioStream:o,canSelfUnmute:s,isMuted:r}=n||{};return{connectionState:a||"discarded",hasRequestedToSpeak:Boolean(i),noAudioStream:!o,canSelfUnmute:s,isMuted:r}}))((e=>{let{noAudioStream:t,canSelfUnmute:a,isMuted:n,hasRequestedToSpeak:i,connectionState:o}=e;const{toggleGroupCallMute:s,requestToSpeak:r,playGroupCallSound:c}=(0,F.Sv)(),l=(0,oe.Z)(),d=(0,x.sO)("up"),[u,p]=(0,x.eJ)(!1),m="connected"!==o,g=!a&&n,v=(0,me.Z)(g);(0,x.d4)((()=>{v&&!g&&c({sound:"allowTalk"})}),[c,v,g]);const f=(0,x.Ye)((()=>{if(u){const e=Math.floor(100*Math.random());return e<32?[0,120]:e<64?[120,240]:e<97?[240,420]:[420,540]}return!v&&g?t?[99,135]:[136,172]:v&&!g?[0,36]:g?[0,0]:t?[69,99]:[36,69]}),[v,u,t,g]),h=u?"HandFilled":"VoiceMini",C=()=>{pe(),s()},P=l(i?"VoipMutedTapedForSpeak":g?"VoipMutedByAdmin":t?"VoipUnmute":"VoipTapToMute");return x.ZP.createElement("div",{className:"button-wrapper microphone-wrapper"},x.ZP.createElement("button",{className:(0,ne.Z)("MicrophoneButton",t&&"crossed",a&&"can-self-unmute",m&&"is-connecting",g&&"muted-by-admin"),onMouseDown:()=>{if(g){if(u)return;return pe(),r(),p(!0),void setTimeout((()=>{p(!1)}),3e3)}d.current="down",t&&setTimeout((()=>{"down"===d.current&&(d.current="hold",C())}),200)},onMouseUp:()=>{g||(C(),d.current="up")}},x.ZP.createElement(ge.Z,{tgsUrl:ae.l[h],size:48,playSegment:f})),x.ZP.createElement("div",{className:"button-text"},P))})));var fe=a(14605),he=a(80036),Ce=a(3927),Pe=a(52328),be=a(22275);const Ze=[0,17],ye=[17,34],we=(0,x.X$)((0,F.c$)((e=>({isAdmin:(0,H.Ht)(e)})))((e=>{let{participant:t,closeDropdown:a,isDropdownOpen:n,anchor:i,isAdmin:o}=e;const{toggleGroupCallMute:s,setGroupCallParticipantVolume:r,toggleGroupCallPanel:c,openChat:l,requestToSpeak:d}=(0,F.Sv)(),u=(0,oe.Z)(),[p,m,g]=(0,ie.Z)(),v=t?.id,{isMutedByMe:f,isMuted:h,isSelf:C,canSelfUnmute:P}=t||{},b=Boolean(t?.raiseHandRating),Z=!P&&h,[y,w]=(0,x.eJ)(f?0:(t?.volume||B.aCB)/B.Ro);(0,x.d4)((()=>{w(f?0:(t?.volume||B.aCB)/B.Ro)}),[v]);const k=function(e,t){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return(0,Ce.Z)((e=>{e()}),a,e,t)}(500),E=(0,x.I4)((e=>{e.stopPropagation(),m(),a()}),[m,a]),S=(0,x.I4)((e=>{e.stopPropagation(),d({value:!1}),a()}),[d,a]),I=(0,x.I4)((e=>{e.stopPropagation(),a(),o||w(f?B.aCB/B.Ro:0),s({participantId:v,value:o?!Z:!f})}),[a,s,v,o,Z,f]),N=(0,x.I4)((e=>{e.stopPropagation(),c(),l({id:v}),a()}),[c,a,l,v]),T=0===y?Ze:ye;return x.ZP.createElement("div",null,x.ZP.createElement(Pe.Z,{isOpen:n,positionX:"right",autoClose:!0,style:(0,he.Z)(i&&`right: 1rem; top: ${i.y}px`),onClose:a,className:"participant-menu"},!C&&!Z&&x.ZP.createElement("div",{className:"group"},x.ZP.createElement("div",{className:(0,ne.Z)("volume-control",y<50&&"low",y>=50&&y<100&&"medium",y>=100&&y<150&&"normal",y>=150&&"high")},x.ZP.createElement("input",{type:"range",min:"0",max:"200",value:y,onChange:e=>{const t=Number(e.target.value);w(t),k((()=>{0===t?s({participantId:v,value:!0}):r({participantId:v,volume:Math.floor(t*B.Ro)})}))}}),x.ZP.createElement("div",{className:"info"},x.ZP.createElement(ge.Z,{tgsUrl:ae.l.Speaker,playSegment:T,size:24}),x.ZP.createElement("span",null,y,"%")))),x.ZP.createElement("div",{className:"group"},b&&C&&x.ZP.createElement(de.Z,{icon:"stop-raising-hand",onClick:S},u("VoipGroupCancelRaiseHand")),!C&&x.ZP.createElement(de.Z,{icon:"user",onClick:N},u("VoipGroupOpenProfile")),!C&&x.ZP.createElement(de.Z,{icon:h&&o?"allow-speak":"microphone-alt",onClick:I},u(o?Z?"VoipGroupAllowToSpeak":"VoipMute":f?"VoipGroupUnmuteForMe":"VoipGroupMuteForMe")),!C&&o&&x.ZP.createElement(de.Z,{icon:"delete-user",destructive:!0,onClick:E},u("VoipGroupUserRemove")))),!C&&o&&x.ZP.createElement(be.Z,{isOpen:p,userId:v,onClose:g}))})));var ke=a(27407),Ee=a(70172);const Se=(0,x.X$)((e=>{let{participant:t,noColor:a}=e;const{isMuted:n,isMutedByMe:i}=t,o=(t.amplitude||0)>l,s=Boolean(t.raiseHandRating),r=(0,me.Z)(s),c=!Boolean(t?.canSelfUnmute)&&n,d=(0,me.Z)(n),u=(0,x.Ye)((()=>n&&!d?[43,64]:!n&&d?[22,42]:s&&!r?[65,84]:!c&&r?[0,21]:n?[22,23]:[43,44]),[n,c,s]),p=(0,x.Ye)((()=>a?[255,255,255]:s?[77,166,224]:c||i?[255,112,111]:o?[87,188,108]:[132,141,148]),[a,s,c,i,o]);return x.ZP.createElement(ge.Z,{tgsUrl:ae.l.VoiceOutlined,playSegment:u,size:28,color:p})})),Ie=(0,x.X$)((0,F.c$)(((e,t)=>{let{participant:a}=t;return{user:a.isUser?(0,q.dy)(e,a.id):void 0,chat:a.isUser?void 0:(0,q.Z1)(e,a.id)}}))((e=>{let{openParticipantMenu:t,participant:a,user:n,chat:i}=e;const o=(0,x.sO)(null),s=(0,oe.Z)(),{isSelf:r,isMutedByMe:c,isMuted:d}=a,u=(a.amplitude||0)>l,p=Boolean(a.raiseHandRating),[m,g]=(0,x.Ye)((()=>r?[s("ThisIsYou"),"blue"]:c?[s("VoipGroupMutedForMe"),"red"]:p?[s("WantsToSpeak"),"blue"]:!d&&u?[a.volume&&a.volume!==B.aCB?s("SpeakingWithVolume",(a.volume/B.Ro).toString()).replace("%%","%"):s("Speaking"),"green"]:a.about?[a.about,""]:[s("Listening"),"blue"]),[u,a.volume,s,r,c,p,d,a.about]);if(!n&&!i)return;const v=n?`${n.firstName||""} ${n.lastName||""}`:i?.title;return x.ZP.createElement("div",{className:(0,ne.Z)("GroupCallParticipant",a.canSelfUnmute&&"can-self-unmute"),onClick:()=>{r||t(o.current,a)},ref:o},x.ZP.createElement(Ee.Z,{user:n,chat:i,size:"medium"}),x.ZP.createElement("div",{className:"info"},x.ZP.createElement("span",{className:"name"},v),x.ZP.createElement("span",{className:(0,ne.Z)("about",g)},m)),x.ZP.createElement("div",{className:"microphone"},x.ZP.createElement(Se,{participant:a})))})));var Ne=a(21273);const Te=(0,x.X$)((0,F.c$)((e=>{const{participantsCount:t,participants:a}=(0,H.mU)(e)||{};return{participants:a,participantsCount:t||0}}))((e=>{let{participants:t,participantsCount:a,openParticipantMenu:n}=e;const{createGroupCallInviteLink:i,loadMoreGroupCallParticipants:o}=(0,F.Sv)(),s=(0,oe.Z)(),r=(0,x.Ye)((()=>Object.keys(t||{})),[t]),c=(0,x.I4)((()=>{o()}),[o]),[l,d]=(0,ke.Z)(c,r,r.length>=a);return x.ZP.createElement("div",{className:"participants"},x.ZP.createElement("div",{className:"invite-btn",onClick:function(){i()}},x.ZP.createElement("div",{className:"icon-wrapper"},x.ZP.createElement("i",{className:"icon icon-add-user"})),x.ZP.createElement("div",{className:"text"},s("VoipGroupInviteMember"))),x.ZP.createElement(Ne.Z,{items:l,onLoadMore:d},l?.map((e=>t[e]&&x.ZP.createElement(Ie,{key:e,openParticipantMenu:n,participant:t[e]})))))}))),Me=(0,x.X$)((0,F.c$)(((e,t)=>{let{participant:a}=t;return{currentUserId:e.currentUserId,user:a.isUser?(0,q.dy)(e,a.id):void 0,chat:a.isUser?void 0:(0,q.Z1)(e,a.id),isActive:(a.amplitude||0)>l}}))((e=>{let{type:t,onClick:a,user:n,chat:i,isActive:o,isFullscreen:s}=e;const r=(0,oe.Z)(),c=(0,x.I4)((()=>{a&&a(n?.id||i.id,t)}),[i,a,t,n?.id]);if(!n&&!i)return;const l=b(n?.id||i.id);return x.ZP.createElement("div",{className:(0,ne.Z)("GroupCallParticipantVideo",o&&"active"),onClick:c},s&&x.ZP.createElement("button",{className:"back-button"},x.ZP.createElement("i",{className:"icon icon-arrow-left"}),r("Back")),x.ZP.createElement(Ee.Z,{user:n,chat:i,className:"thumbnail-avatar"}),!B.gdz&&x.ZP.createElement("div",{className:"thumbnail-wrapper"},x.ZP.createElement("video",{className:"thumbnail",muted:!0,autoPlay:!0,playsInline:!0,srcObject:l?.[t]})),x.ZP.createElement("video",{className:"video",muted:!0,autoPlay:!0,playsInline:!0,srcObject:l?.[t]}),x.ZP.createElement("div",{className:"info"},x.ZP.createElement("i",{className:"icon icon-microphone-alt"}),x.ZP.createElement("span",{className:"name"},n?.firstName||i?.title),"presentation"===t&&x.ZP.createElement("i",{className:"icon last-icon icon-active-sessions"})))}))),Ve=(0,x.X$)((0,F.c$)((e=>{const{participants:t}=(0,H.mU)(e)||{};return{participants:t}}))((e=>{let{participants:t,onDoubleClick:a}=e;const[n,i]=(0,x.eJ)(void 0),o=(0,x.Ye)((()=>Object.values(t||{}).filter((e=>e.hasPresentationStream))),[t]),s=(0,x.Ye)((()=>Object.values(t||{}).filter((e=>e.hasVideoStream))),[t]),r=s.length+o.length,c=r<=2?1:r<=6?2:r<=9?3:4,l=3===r||2===c&&r%2!=0,d=(0,x.I4)(((e,t)=>{n&&e===n.id&&t===n.type?i(void 0):i({id:e,type:t})}),[n]);return x.ZP.createElement("div",{className:"streams",onDoubleClick:a},x.ZP.createElement("div",{className:(0,ne.Z)("videos",l&&"span-last-video"),style:`--column-count: ${n?1:c}`},n&&x.ZP.createElement(Me,{key:n.id,isFullscreen:!0,onClick:d,participant:t[n.id],type:n.type}),n?void 0:o.map((e=>x.ZP.createElement(Me,{key:e.id,onClick:d,participant:e,type:"presentation"}))),n?void 0:s.map((e=>x.ZP.createElement(Me,{key:e.id,onClick:d,participant:e,type:"video"})))))}))),Ge=[0,10],De=(0,x.X$)((0,F.c$)(((e,t)=>{let{groupCallId:a}=t;const{connectionState:n,title:i,isSpeakerDisabled:o,participants:s,participantsCount:r}=(0,H.$5)(e,a)||{};return{connectionState:n,title:i,isSpeakerEnabled:!o,participantsCount:r,meParticipant:(0,H.GU)(e,a,e.currentUserId),isCallPanelVisible:Boolean((0,q.jU)(e).isCallPanelVisible),isAdmin:(0,H.Ht)(e),participants:s}}))((e=>{let{groupCallId:t,isCallPanelVisible:a,connectionState:i,isSpeakerEnabled:o,title:s,meParticipant:r,isAdmin:c,participants:l}=e;const{toggleGroupCallVideo:u,toggleGroupCallPresentation:p,leaveGroupCall:m,toggleGroupCallPanel:g,connectToActiveGroupCall:v,playGroupCallSound:f}=(0,F.Sv)(),C=(0,oe.Z)(),P=(0,x.sO)(null),{isMobile:b,isLandscape:Z}=(0,se.ZP)(),[y,w]=(0,x.eJ)(!1),[k,S,I]=(0,ie.Z)(),[N,T,M]=(0,ie.Z)(!0),V=Object.values(l).some((e=>{let{video:t,presentation:a}=e;return t||a})),G=k&&(!b||Z)&&V,[D,U]=(0,x.eJ)(),[A,$,O]=(0,ie.Z)(),[j,R,_]=(0,ie.Z)(),[B,L]=(0,x.eJ)(!1),[q,H]=(0,x.eJ)(!1),J=r?.hasVideoStream,z=r?.hasPresentationStream,X="connected"!==i,Y=r?.canSelfUnmute,K=!Y&&r?.isMuted,Q=(0,x.I4)(((e,t)=>{const a=e.getBoundingClientRect(),n=P.current;U({anchor:{x:a.left,y:a.top-n.offsetTop+60},participant:t}),$()}),[$]);(0,x.d4)((()=>{"connected"===i?f({sound:"join"}):"reconnecting"===i&&f({sound:"connecting"})}),[i,f]);const W=(0,x.I4)((()=>{_(),L(!1)}),[_]),ee=(0,x.Ye)((()=>e=>{let{onTrigger:t,isOpen:a}=e;return x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",className:a?"active":void 0,onClick:t,ariaLabel:C("AccDescrMoreOptions")},x.ZP.createElement("i",{className:"icon icon-more"}))}),[C]),te=(0,x.I4)((()=>{P.current&&(k?document.exitFullscreen().then(I):P.current.requestFullscreen().then(S))}),[I,k,S]),pe=(0,x.I4)((()=>{N?M():T()}),[M,N,T]),me=(0,x.I4)((()=>{n.t0&&(k||M(),te())}),[M,te,k]),he=(0,x.I4)((()=>{k?I():S()}),[I,k,S]),Ce=(0,x.I4)((()=>{g(),k&&I()}),[I,k,g]);(0,x.d4)((()=>{if(!n.t0)return;const e=P.current;return e?(e.addEventListener("fullscreenchange",he),()=>{e.removeEventListener("fullscreenchange",he)}):void 0}),[he]),(0,x.d4)((()=>{v()}),[v,t]);const Pe=(0,x.I4)((()=>{L(!0),H(!0),R(),k&&te()}),[te,k,R]),be=(0,x.I4)((()=>{if(c&&!j)return R(),void(k&&te());f({sound:"leave"}),w(!0),_()}),[_,te,c,j,k,R,f]),Ze=(0,x.I4)((()=>{y&&m({shouldDiscard:q})}),[y,m,q]),ye=(0,x.I4)((()=>{p()}),[p]);return x.ZP.createElement(ue.Z,{isOpen:!a&&!y,onClose:g,className:(0,ne.Z)("GroupCall",b&&!Z&&"single-column",G&&"landscape",!N&&"no-sidebar"),dialogRef:P,onCloseAnimationEnd:Ze},x.ZP.createElement("div",{className:"header"},x.ZP.createElement("h3",null,s||C("VoipGroupVoiceChat")),n.t0&&x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",onClick:te,ariaLabel:C(k?"AccExitFullscreen":"AccSwitchToFullscreen")},x.ZP.createElement("i",{className:(0,ne.Z)("icon",k?"icon-smallscreen":"icon-fullscreen")})),G&&x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",onClick:pe},x.ZP.createElement("i",{className:"icon icon-sidebar"})),(d&&!K||c)&&x.ZP.createElement(le.Z,{positionX:"right",trigger:ee},d&&!K&&x.ZP.createElement(de.Z,{icon:"share-screen-outlined",onClick:ye},C(z?"VoipChatStopScreenCapture":"VoipChatStartScreenCapture")),c&&x.ZP.createElement(de.Z,{icon:"phone-discard-outline",onClick:Pe,destructive:!0},C("VoipGroupLeaveAlertEndChat"))),x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",onClick:Ce},x.ZP.createElement("i",{className:"icon icon-close"}))),x.ZP.createElement("div",{className:"scrollable custom-scroll"},x.ZP.createElement(Ve,{onDoubleClick:me}),(!G||N)&&x.ZP.createElement(Te,{openParticipantMenu:Q})),x.ZP.createElement(we,{participant:D?.participant,anchor:D?.anchor,isDropdownOpen:A,closeDropdown:O}),x.ZP.createElement("div",{className:"buttons"},X&&x.ZP.createElement(re.Z,null),x.ZP.createElement("div",{className:"button-wrapper"},x.ZP.createElement("div",{className:"video-buttons"},J&&(n.wZ||n.cj)&&x.ZP.createElement("button",{className:"smaller-button",onClick:E},x.ZP.createElement(ge.Z,{tgsUrl:ae.l.CameraFlip,playSegment:Ge,size:24})),x.ZP.createElement("button",{className:(0,ne.Z)("small-button",K?"speaker":"camera",(J||K&&o)&&"active"),onClick:()=>{K?h&&(h.isSpeakerDisabled=!h.isSpeakerDisabled,h?.onUpdate?.({"@type":"updateGroupCallConnectionState",connectionState:"connected",isSpeakerDisabled:h.isSpeakerDisabled}),h.participantFunctions&&Object.values(h.participantFunctions).forEach((e=>{e.toggleMute?.(!!h?.isSpeakerDisabled)}))):u()}},x.ZP.createElement("i",{className:(0,ne.Z)("icon",K?"icon-speaker":J?"icon-video-stop":"icon-video")}))),x.ZP.createElement("div",{className:"button-text"},C(K?"VoipSpeaker":"VoipCamera"))),x.ZP.createElement(ve,null),x.ZP.createElement("div",{className:"button-wrapper"},x.ZP.createElement("button",{className:"small-button leave",onClick:be},x.ZP.createElement("i",{className:"icon icon-phone-discard"})),x.ZP.createElement("div",{className:"button-text"},C("VoipGroupLeave")))),x.ZP.createElement(ue.Z,{isOpen:j,onClose:W,className:"error",title:C(B?"VoipGroupEndAlertTitle":"VoipGroupLeaveAlertTitle")},x.ZP.createElement("p",null,C(B?"VoipGroupEndAlertText":"VoipGroupLeaveAlertText")),!B&&x.ZP.createElement(fe.Z,{label:C("VoipGroupEndChat"),checked:q,onCheck:H}),x.ZP.createElement("div",{className:"dialog-buttons"},x.ZP.createElement(ce.Z,{isText:!0,className:"confirm-dialog-button",onClick:be},C(B?"VoipGroupEnd":"VoipGroupLeave")),x.ZP.createElement(ce.Z,{isText:!0,className:"confirm-dialog-button",onClick:W},C("Cancel")))))}))),Ue=(0,x.X$)((0,F.c$)((e=>{const t=(0,q.jU)(e);return{groupCall:t.isMasterTab?(0,H.mU)(e):void 0,isCallPanelVisible:t.isCallPanelVisible,phoneCallUser:t.isMasterTab?(0,H.fu)(e):void 0}}))((e=>{let{groupCall:t,phoneCallUser:a,isCallPanelVisible:n}=e;const{toggleGroupCallPanel:i}=(0,F.Sv)(),o=(0,oe.Z)();if((0,x.d4)((()=>(document.body.classList.toggle("has-call-header",Boolean(n)),()=>{document.body.classList.toggle("has-call-header",!1)})),[n]),t||a)return x.ZP.createElement("div",{className:(0,ne.Z)("ActiveCallHeader",n&&"open"),onClick:function(){i()}},x.ZP.createElement("span",{className:"title"},a?.firstName||t?.title||o("VoipGroupVoiceChat")))})));var Ae=a(32340),$e=a(790),Oe=a(62357),je=a(65326);const Re=(0,x.X$)((e=>{let{onClick:t,label:a,customIcon:n,icon:i,iconClassName:o,className:s,isDisabled:r,isActive:c}=e;return x.ZP.createElement("div",{className:"eWbOLx__FZXR1sqKEJek"},x.ZP.createElement(ce.Z,{round:!0,className:(0,ne.Z)(s,"XKOJvKiD4DsRfJLLhnw2",c&&"qvAVe7qcyaEvRQQ1StFI"),onClick:t,disabled:r},n||x.ZP.createElement("i",{className:(0,ne.Z)(o,"icon",`icon-${i}`)})),x.ZP.createElement("div",{className:"wnAniFJmQ7ocVtjRHNey"},a))})),_e={root:"AddQYAOZJv2f7U7qIfC3",blurred:"anFtHj7Wvsv4M_2I2EFF","single-column":"Oi7aFYBAbl4bYichdt52",singleColumn:"Oi7aFYBAbl4bYichdt52",header:"_iK8HccGNSmmo2wL7tMs","close-button":"U66J7V5JKTCiktgwYpcC",closeButton:"U66J7V5JKTCiktgwYpcC","emojis-backdrop":"IekzemHkkO4bfrWHmxlv",emojisBackdrop:"IekzemHkkO4bfrWHmxlv",open:"hiNHKiq2owo1FvdT9a5g",emojis:"BjOb1fDymE5GCiJ4g6YN","emoji-tooltip":"Ci9ie86NFinrXvowDx23",emojiTooltip:"Ci9ie86NFinrXvowDx23","user-info":"eiM2IbZjKKAwrfNtXtAy",userInfo:"eiM2IbZjKKAwrfNtXtAy",buttons:"AtK8DjRToL8Uk7ZAY25p",leave:"uI2mkCTKDcqYPu64xKOk",accept:"PC2FeM0OEDDW0TVFGMkk","accept-icon":"hBxp1Loj3vj4DtnculDA",acceptIcon:"hBxp1Loj3vj4DtnculDA","main-video":"lXMZESnc4CBKQbvV7qkL",mainVideo:"lXMZESnc4CBKQbvV7qkL","second-video":"cnQvI_xwAbO0EEwRcLsg",secondVideo:"cnQvI_xwAbO0EEwRcLsg",visible:"XaD79h6hSiEi0ypkn5OK",fullscreen:"NlF9_Kb2le_3B712PZnO"},xe=(0,x.X$)((0,F.c$)((e=>{const{phoneCall:t,currentUserId:a}=e,{isCallPanelVisible:n,isMasterTab:i}=(0,q.jU)(e),o=(0,H.fu)(e);return{isCallPanelVisible:Boolean(n),user:o,isOutgoing:t?.adminId===a,phoneCall:i?t:void 0}}))((e=>{let{user:t,isOutgoing:a,phoneCall:i,isCallPanelVisible:o}=e;const s=(0,oe.Z)(),{hangUp:r,requestMasterAndAcceptCall:c,playGroupCallSound:l,toggleGroupCallPanel:u,connectToActivePhoneCall:p}=(0,F.Sv)(),m=(0,x.sO)(null),[g,v,f]=(0,ie.Z)(),{isMobile:h}=(0,se.ZP)(),P=(0,x.I4)((()=>{g?f():v()}),[f,g,v]),b=(0,x.I4)((()=>{m.current&&(g?document.exitFullscreen().then(f):m.current.requestFullscreen().then(v))}),[f,g,v]);(0,x.d4)((()=>{if(!n.t0)return;const e=m.current;return e?(e.addEventListener("fullscreenchange",P),()=>{e.removeEventListener("fullscreenchange",P)}):void 0}),[P]);const Z=(0,x.I4)((()=>{u(),g&&f()}),[f,g,u]),y="discarded"===i?.state,w="busy"===i?.reason,k="requested"===i?.state&&!a,E=("requested"===i?.state||"waiting"===i?.state)&&a,S="active"===i?.state,I=i?.isConnected,[N,T,M]=(0,ie.Z)(),V=(0,x.I4)((()=>{T(),r()}),[r,T]);(0,x.d4)((()=>{N?l({sound:"end"}):k?l({sound:"incoming"}):w?l({sound:"busy"}):y?l({sound:"end"}):E?l({sound:"ringing"}):I&&l({sound:"connect"})}),[w,y,k,E,I,l,N]),(0,x.d4)((()=>{i?.id?M():p()}),[p,i?.id,M]);const G=(0,je.Z)();(0,Oe.Z)((()=>{G()}),I?1e3:void 0);const $=(0,x.Ye)((()=>{const e=i?.state;return N?s("lng_call_status_hanging"):w?"busy":"requesting"===e?s("lng_call_status_requesting"):"requested"===e?s(a?"lng_call_status_ringing":"lng_call_status_incoming"):"waiting"===e?s("lng_call_status_waiting"):"active"===e&&I?void 0:s("lng_call_status_exchanging")}),[w,I,N,a,s,i?.state]),O="active"===i?.videoState,j="active"===i?.screencastState,R=C?.streams,_=R?.ownAudio?.getTracks()[0].enabled,B=R?.ownPresentation?.getTracks()[0].enabled,L=R?.ownVideo?.getTracks()[0].enabled,[q,H,J]=(0,ie.Z)(),[z,X,Y]=(0,ie.Z)(),K=(0,x.I4)((()=>{B&&H(),L&&X(),setTimeout((async()=>{await A("presentation"),J(),Y()}),250)}),[B,L,H,X,J,Y]),Q=(0,x.I4)((()=>{L&&X(),B&&H(),setTimeout((async()=>{await A("video"),J(),Y()}),250)}),[B,L,H,X,J,Y]),W=(0,x.I4)((()=>{A("audio")}),[]),[ee,te,re]=(0,ie.Z)(),[le,de,pe]=(0,ie.Z)(),me=(0,x.I4)((()=>{de(),async function(){if(!C||!C.facingMode)return;const e=C.streams.ownVideo;if(!e)return;const t=e.getTracks()[0];if(!t)return;const a=C.connection.getSenders().find((e=>t.id===e.track?.id));if(a){C.facingMode="environment"===C.facingMode?"user":"environment";try{const e=await U("video",C.facingMode);await a.replaceTrack(e.getTracks()[0]),C.streams.ownVideo=e,D()}catch(e){}}}(),setTimeout(pe,250)}),[de,pe]),ve=i?.startDate&&Number(new Date)/1e3-i.startDate;return(0,x.d4)((()=>{"discarded"===i?.state&&setTimeout(r,250)}),[r,i?.reason,i?.state]),x.ZP.createElement(ue.Z,{isOpen:i&&"discarded"!==i?.state&&!o,onClose:Z,className:(0,ne.Z)(_e.root,h&&_e.singleColumn),dialogRef:m},x.ZP.createElement(Ee.Z,{user:t,size:"jumbo",className:O||j?_e.blurred:""}),"active"===i?.screencastState&&R?.presentation&&x.ZP.createElement("video",{className:_e.mainVideo,muted:!0,autoPlay:!0,playsInline:!0,srcObject:R.presentation}),"active"===i?.videoState&&R?.video&&x.ZP.createElement("video",{className:_e.mainVideo,muted:!0,autoPlay:!0,playsInline:!0,srcObject:R.video}),x.ZP.createElement("video",{className:(0,ne.Z)(_e.secondVideo,!q&&B&&_e.visible,g&&_e.fullscreen),muted:!0,autoPlay:!0,playsInline:!0,srcObject:R?.ownPresentation}),x.ZP.createElement("video",{className:(0,ne.Z)(_e.secondVideo,!z&&L&&_e.visible,g&&_e.fullscreen),muted:!0,autoPlay:!0,playsInline:!0,srcObject:R?.ownVideo}),x.ZP.createElement("div",{className:_e.header},n.t0&&x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",onClick:b,ariaLabel:s(g?"AccExitFullscreen":"AccSwitchToFullscreen")},x.ZP.createElement("i",{className:(0,ne.Z)("icon",g?"icon-smallscreen":"icon-fullscreen")})),x.ZP.createElement(ce.Z,{round:!0,size:"smaller",color:"translucent",onClick:Z,className:_e.closeButton},x.ZP.createElement("i",{className:"icon icon-close"}))),x.ZP.createElement("div",{className:(0,ne.Z)(_e.emojisBackdrop,ee&&_e.open),onClick:ee?re:te},x.ZP.createElement("div",{className:(0,ne.Z)(_e.emojis,ee&&_e.open)},i?.isConnected&&i?.emojis&&(0,Ae.Z)(i.emojis,["emoji"])),x.ZP.createElement("div",{className:(0,ne.Z)(_e.emojiTooltip,ee&&_e.open)},s("CallEmojiKeyTooltip",t?.firstName).replace("%%","%"))),x.ZP.createElement("div",{className:_e.userInfo},x.ZP.createElement("h1",null,t?.firstName),x.ZP.createElement("span",{className:_e.status},$||(0,$e.k9)(ve||0))),x.ZP.createElement("div",{className:_e.buttons},x.ZP.createElement(Re,{onClick:W,icon:"microphone",isDisabled:!S,isActive:_,label:s(_?"lng_call_mute_audio":"lng_call_unmute_audio")}),x.ZP.createElement(Re,{onClick:Q,icon:"video",isDisabled:!S,isActive:L,label:s(L?"lng_call_stop_video":"lng_call_start_video")}),L&&(n.wZ||n.cj)&&x.ZP.createElement(Re,{onClick:me,customIcon:x.ZP.createElement(ge.Z,{tgsUrl:ae.l.CameraFlip,playSegment:le?[0,10]:[0,1],size:32}),isDisabled:!S,label:s("VoipFlip")}),d&&x.ZP.createElement(Re,{onClick:K,icon:"share-screen",isDisabled:!S,isActive:B,label:s("lng_call_screencast")}),k&&x.ZP.createElement(Re,{onClick:c,icon:"phone-discard",isDisabled:y,label:s("lng_call_accept"),className:_e.accept,iconClassName:_e.acceptIcon}),x.ZP.createElement(Re,{onClick:V,icon:"phone-discard",isDisabled:y,label:s(k?"lng_call_decline":"lng_call_end_call"),className:_e.leave})))})));var Fe=a(97687);const Be=(0,x.X$)((e=>{let{isOpen:t}=e;const{closeCallRatingModal:a,setCallRating:n}=(0,F.Sv)(),i=(0,x.sO)(null),o=(0,oe.Z)(),[s,r]=(0,x.eJ)(),c=(0,x.I4)((()=>{s?n({rating:s+1,comment:i.current?.value||""}):a()}),[a,s,n]),l=(0,x.I4)((()=>{a()}),[a]);return x.ZP.createElement(ue.Z,{title:o("lng_call_rate_label"),className:"narrow",onClose:a,isOpen:t},x.ZP.createElement("div",{className:"wLqZtZzJMOmPkr1Z7kT5"},new Array(5).fill(void 0).map(((e,t)=>{const a=void 0!==s&&s>=t;return x.ZP.createElement("i",{className:(0,ne.Z)("icon",a?"icon-favorite-filled":"icon-favorite",a&&"o_nOyYqj5URif5S86StK","OLQPS_OeztNYIaL15tdz"),onClick:(n=t,()=>r(s===n?void 0:n))});var n}))),x.ZP.createElement(Fe.Z,{ref:i,placeholder:o("lng_call_rate_comment"),className:(0,ne.Z)("ZToDNX6q1Yhf4aDPyuJF",4!==s&&void 0!==s&&"HdCq8jVctaJoit7bdgZd")}),x.ZP.createElement("div",{className:"dialog-buttons mt-2"},x.ZP.createElement(ce.Z,{className:"confirm-dialog-button",isText:!0,onClick:c},o("Send")),x.ZP.createElement(ce.Z,{className:"confirm-dialog-button",isText:!0,onClick:l},o("Cancel"))))}));(n.s$||n.cj)&&document.addEventListener("click",i.o5,{once:!0})}}]);
//# sourceMappingURL=9954.b96be4db8b9a2c673973.js.map