TelegramPWA/dist/2394.4ad3723acc675eb5913e.js
Alexander Zinchuk 6fd1d0c598 [Build]
2025-09-19 14:39:00 +02:00

2 lines
66 KiB
JavaScript

"use strict";(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[2394],{285:(e,t,n)=>{n.d(t,{A:()=>u});var a=n(84051),i=n(13439),o=n(90709),s=n(91048),r=n(4961),c=n(59030),l=n(94189),d=n(20021);const u=(0,a.ph)((0,i.EK)((e,t)=>{let{userId:n}=t;const a=(0,s.meB)(e),i=n&&(0,s.mBe)(e,n);return{chat:a,contactName:i?(0,o.u0)(i):void 0}})(e=>{let{isOpen:t,chat:n,userId:o,contactName:s,onClose:u}=e;const{deleteChatMember:p}=(0,i.ko)(),m=(0,c.A)(),h=(0,a.hb)(()=>{p({chatId:n.id,userId:o}),u()},[n,p,u,o]);if(n&&o)return(0,d.Y)(l.A,{isOpen:t,onClose:u,title:m("GroupRemoved.Remove"),textParts:(0,r.A)(m("PeerInfo.Confirm.RemovePeer",s)),confirmLabel:m("lng_box_remove"),confirmHandler:h,confirmIsDestructive:!0})}))},71331:(e,t,n)=>{n.d(t,{Ip:()=>r,O7:()=>p,iT:()=>d,mD:()=>s,n5:()=>c,qI:()=>l,uu:()=>u});var a=n(90709),i=n(21133),o=n(19926);function s(e,t){const n=(0,i.AW)(e,t);if(n&&n.groupCallId)return r(e,n.groupCallId)}function r(e,t){return e.groupCalls.byId[t]}function c(e,t,n){return r(e,t)?.participants[n]}function l(e){const t=d(e)?.chatId;if(!t)return!1;const n=(0,i.hd)(e,t);return!!n&&((0,a.yn)(n)&&n.isCreator||Boolean(n.adminRights?.manageCall))}function d(e){const{groupCalls:{activeGroupCallId:t}}=e;if(t)return r(e,t)}function u(e){const{phoneCall:t,currentUserId:n}=e;if(!t||!t.participantId||!t.adminId)return;const a=t.adminId===n?t.participantId:t.adminId;return(0,o.mB)(e,a)}function p(e){const t=d(e);if(!t||!t.chatId)return!1;const n=(0,i.hd)(e,t.chatId);if(!n)return!1;if(Boolean((0,a.Kl)(n)))return!0;const o=(0,i.AW)(e,n.id)?.inviteLink;return Boolean(o)}},83320:(e,t,n)=>{n.r(t),n.d(t,{ActiveCallHeader:()=>tt,GroupCall:()=>et,PhoneCall:()=>st,RatePhoneCallModal:()=>ct});var a=n(12859),i=n(96454),o=n(31481);function s(e){return 0|e}function r(e){return e>>>0}function c(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3;if(!e)return 0;const{length:n}=e;let a=0;for(let t=0;t<n;t++)a+=e[t]*e[t];const i=Math.sqrt(a/n)/255;return Math.min(1,i*t)}function l(e){return{id:e.id,name:e.name,"rtcp-fbs":e.feedbackTypes,clockrate:e.clockrate,parameters:e.parameters,channels:e.channels}}const d=.1,u="getDisplayMedia"in(navigator?.mediaDevices||{}),p=navigator?.mediaDevices?.getSupportedConstraints().echoCancellation,m=navigator?.mediaDevices?.getSupportedConstraints().noiseSuppression,h=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 n=e.sdp.split("\r\nm=").map((e,t)=>0===t?e:`m=${e}`).reduce((e,t)=>{const n=t.match(/^m=(.+?)\s/)?.[1]||"header";return e[e.hasOwnProperty(n)&&"video"===n?"screencast":n]=t.split("\r\n").filter(Boolean),e},{}),a=(e,t)=>t?n[t]?.find(t=>t.startsWith(e))?.substr(e.length):Object.values(n).map(t=>t.find(t=>t.startsWith(e))?.substr(e.length)).filter(Boolean)[0],i=e=>n[e].filter(e=>e.startsWith("a=extmap")).map(e=>{const[,t,n]=e.match(/extmap:(\d+)(?:\/.+)?\s(.+)/);return{id:Number(t),uri:n}}),o=e=>{const t=n[e].filter(e=>e.startsWith("a=rtpmap")).map(e=>{const[,t,n]=e.match(/:(\d+)\s(.+)/)||[],[a,i,o]=n.split("/");return{id:Number(t),name:a,clockrate:Number(i),...o&&{channels:Number(o)}}}),a=n[e].filter(e=>e.startsWith("a=rtcp-fb")).map(e=>{const[,t,n]=e.match(/:(\d+)\s(.+)/)||[],[a,i]=n.split(" ");return{id:Number(t),type:a,subtype:i||""}}),i=n[e].filter(e=>e.startsWith("a=fmtp")).map(e=>{const[,t,n]=e.match(/:(\d+)\s(.+)/)||[],a=n?.split(";").reduce((e,t)=>{const[n,a]=t.split("=");return e[n]=a,e},{});if(a&&!Object.values(a).some(e=>!e))return{id:Number(t),data:a}}).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),{}),n=a.filter(t=>t.id===e.id).map(e=>({type:e.type,subtype:e.subtype}));return{...e,...Object.keys(t).length>0&&{parameters:t},...n.length>0&&{feedbackTypes:n}}})},r=a("a=ssrc:","audio"),c=r&&Number(r.split(" ")[0]),l=a("a=ssrc-group:","video")?.split(" ")||void 0,d=a("a=ssrc-group:","screencast")?.split(" ")||void 0;if(!l)throw Error("Failed parsing SDP: no video ssrc");const[u,p]=a("a=fingerprint:")?.split(" ")||[],m=a("a=setup:");if(!u||!p)throw Error("Failed parsing SDP: no fingerprint");console.log(n);const h=a("a=ice-ufrag:"),g=a("a=ice-pwd:");if(!h||!g)throw Error("Failed parsing SDP: no ICE ufrag or pwd");return{fingerprints:[{fingerprint:p,hash:u,setup:t?m:"active"}],pwd:g,ufrag:h,...c&&{ssrc:s(c)},...l&&{"ssrc-groups":[{semantics:l[0],sources:l.slice(1,l.length).map(Number).map(s)},t&&d&&{semantics:d[0],sources:d.slice(1,d.length).map(Number).map(s)}].filter(Boolean)},...t&&{audioExtmap:i("audio"),videoExtmap:i("video"),screencastExtmap:i("screencast"),audioPayloadTypes:o("audio"),videoPayloadTypes:o("video"),screencastPayloadTypes:o("screencast")}}},g=function(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],a=arguments.length>3&&void 0!==arguments[3]&&arguments[3];const i=[],o=e=>{i.push(e)},{sessionId:s,ssrcs:c,audioExtensions:l,videoExtensions:d,audioPayloadTypes:u,videoPayloadTypes:p,transport:{ufrag:m,pwd:h,fingerprints:g,candidates:f}}=e;o("v=0"),o(`o=- ${s} 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(" ")}${n?"":" "+(a?"3":"2")}`),a||o("a=ice-lite");const v=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:${h}`),g.forEach(e=>{o(`a=fingerprint:${e.hash} ${e.fingerprint}`),o(`a=setup:${a?e.setup:"passive"}`)}),f.forEach(v)},b=e=>{const{channels:t,id:n,name:a,clockrate:i,parameters:s}=e;if(o(`a=rtpmap:${n} ${a}/${i}${t?`/${t}`:""}`),s){const e=Object.keys(s).map(e=>`${e}=${s[e]};`).join(" ");o(`a=fmtp:${n} ${e}`)}e["rtcp-fbs"]?.forEach(e=>{o(`a=rtcp-fb:${n} ${e.type}${e.subtype?` ${e.subtype}`:""}`)})},y=e=>{const n=e.isVideo?p:u,i=e.isVideo?"video":"audio";if(o(`m=${i} ${e.isMain?1:0} RTP/SAVPF ${n.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"),n.forEach(b),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:n}=e;o(`a=extmap:${t} ${n}`)}),e.isRemoved)o("a=inactive");else{if(C(),a)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=>{t.semantics&&o(`a=ssrc-group:${t.semantics} ${t.sources.map(r).join(" ")}`),t.sources.forEach(t=>{const n=r(t);o(`a=ssrc:${n} cname:${e.endpoint}`),o(`a=ssrc:${n} msid:${e.endpoint} ${e.endpoint}`),o(`a=ssrc:${n} mslabel:${e.endpoint}`),o(`a=ssrc:${n} label:${e.endpoint}`)})})}};return a?c.filter(y):c.filter(e=>"0"===e.mid||"1"===e.mid).map(y),n||(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:"+(a?"3":n?"1":"2")),o("a=sctp-port:5000"),o("a=max-message-size:262144")),a||c.filter(e=>"0"!==e.mid&&"1"!==e.mid).map(y),`${i.join("\n")}\n`},f=e=>{const t=e.createOscillator(),n=t.connect(e.createMediaStreamDestination());return t.start(),new MediaStream([Object.assign(n.stream.getAudioTracks()[0],{enabled:!1})])},v=function(){let{width:e=640,height:t=480}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const n=Object.assign(document.createElement("canvas"),{width:e,height:t}),a=n.getContext("2d");if(!a)throw Error("Cannot create canvas ctx");a.fillRect(0,0,e,t);const i=n.captureStream();return new MediaStream([Object.assign(i.getVideoTracks()[0],{enabled:!1})])};var C=n(9705),b=n(41733);let y,A;function w(e){y&&(y.screenshareDataChannel?.close(),y.screenshareConnection?.close(),e||y.onUpdate?.({"@type":"updateGroupCallLeavePresentation"}))}function S(e){return y?.streams?.[e]}function k(e,t){const n=y?.participantFunctions?.[e];n&&n.setVolume?.(t)}function I(e,t){const n=t||y?.myId,a=n&&S(n)?.[e];return!!a&&a.getTracks()[0]?.enabled}function P(e){y?.onUpdate?.({"@type":"updateGroupCallStreams",userId:e,hasAudioStream:I("audio",e),hasVideoStream:I("video",e),hasPresentationStream:I("presentation",e),amplitude:y.speaking?.[e]})}async function T(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"user";if("audio"===e&&y?.audioStream)return y.audioStream;if("presentation"===e)return navigator.mediaDevices.getDisplayMedia({audio:!1,video:!0});const n=await navigator.mediaDevices.getUserMedia({audio:"audio"===e&&{...p&&{echoCancellation:!0},...m&&{noiseSuppression:!0}},video:"video"===e&&{facingMode:t}});if(y&&"audio"===e&&(y.audioStream=n),"video"===e){const e=document.createElement("video");e.srcObject=n;const t=new C.A;e.oncanplay=()=>t.resolve(),await t.promise}return n}async function N(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(!(y&&y.myId&&y.connection&&y.streams))return;const n=S(y.myId)?.[e];if(!n)return;const a=n.getTracks()[0];if(!a)return;const i=[...y.connection.getSenders(),...y.screenshareConnection?.getSenders()||[]].find(e=>a.id===e.track?.id);if(i){t=void 0===t?!a.enabled:t;try{if(t&&!a.enabled){const t=await T(e);if(await i.replaceTrack(t.getTracks()[0]),y.streams[y.myId][e]=t,"video"===e)y.facingMode="user";else if("audio"===e){const{audioContext:e}=y;if(!e)return;const n=y.audioSource||e.createMediaStreamSource(t),a=y.audioAnalyser||e.createAnalyser();a.minDecibels=-100,a.maxDecibels=-30,a.smoothingTimeConstant=.05,a.fftSize=1024,n.connect(a),y={...y,audioSource:n,audioAnalyser:a,participantFunctions:{...y.participantFunctions,[y.myId]:{...y.participantFunctions?.[y.myId],getCurrentAmplitude:()=>{const e=new Uint8Array(a.frequencyBinCount);return a.getByteFrequencyData(e),c(e,1.5)}}}}}}else if(!t&&a.enabled){const t="audio"===e?y.silence:y.black;if(!t)return;await i.replaceTrack(t.getTracks()[0]),y.streams[y.myId][e]=t,"video"===e&&(y.facingMode=void 0),"audio"!==e?a.stop():(y.audioSource?.disconnect(),y.audioAnalyser?.disconnect())}P(y.myId),"presentation"!==e||t||w(!0)}catch(e){}}}function M(e){y?.onUpdate?.({"@type":"updateGroupCallConnectionState",connectionState:e})}function x(){y&&(y.myId&&y.streams?.[y.myId]&&Object.values(y.streams[y.myId]||{}).forEach(e=>{e?.getTracks().forEach(e=>{e.stop()})}),y.audioStream?.getTracks().forEach(e=>{e.stop()}),w(!0),y.dataChannel?.close(),y.connection?.close(),M("disconnected"),y.analyserInterval&&clearInterval(y.analyserInterval),y=void 0)}function V(){y&&y.participantFunctions&&Object.keys(y.participantFunctions).forEach(e=>{const{getCurrentAmplitude:t}=y.participantFunctions[Number(e)];if(t){const n=t(),a=y.speaking[e]||0;y.speaking[e]=n,(n>d&&a<=d||n<=d&&a>d)&&P(e)}})}async function E(e){if(!y)return;const{participants:t,conference:n,connection:a,myId:i}=y;if(!(t&&n&&a&&n.ssrcs&&n.transport&&i))return;if(e.find(e=>e.isSelf&&e.source!==y?.conference?.ssrcs?.find(e=>e.isMain&&!e.isVideo)?.sourceGroups[0].sources[0]))return void x();const o=[];if(e.forEach(e=>{if(e.isSelf)return void(e.isMuted&&!e.canSelfUnmute&&(N("audio",!1),N("video",!1),N("presentation",!1)));const{isLeft:t}=e,a=e.isMuted||e.isMutedByMe,i=!e.isVideoJoined||!e.video||t,s=!e.presentation||t;let r=!1,c=!1,l=!1;n.ssrcs.filter(t=>t.userId===e.id).forEach(t=>{t.isVideo||(t.sourceGroups[0].sources[0]===e.source&&(c=!0),t.isRemoved=a),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))}),a||c||(y.lastMid=y.lastMid+1,n.ssrcs.push({userId:e.id,isMain:!1,endpoint:`audio${e.source}`,isVideo:!1,sourceGroups:[{sources:[e.source]}],mid:y.lastMid.toString()})),i||r||!e.video||(y.lastMid=y.lastMid+1,o.push(e.video.endpoint),n.ssrcs.push({userId:e.id,isMain:!1,endpoint:e.video.endpoint,isVideo:!0,sourceGroups:e.video.sourceGroups,mid:y.lastMid.toString()})),s||l||!e.presentation||(y.lastMid=y.lastMid+1,n.ssrcs.push({isPresentation:!0,userId:e.id,isMain:!1,endpoint:e.presentation.endpoint,isVideo:!0,sourceGroups:e.presentation.sourceGroups,mid:y.lastMid.toString()}))}),y.updatingParticipantsQueue)return void y.updatingParticipantsQueue.push(n);y.updatingParticipantsQueue=[];const s=g(n);await a.setRemoteDescription({type:"offer",sdp:s});try{const e=await a.createAnswer();if(await a.setLocalDescription(e),P(i),y.updatingParticipantsQueue.length>0)for(const e of y.updatingParticipantsQueue){await a.setRemoteDescription({type:"offer",sdp:g(e)});const t=await a.createAnswer();await a.setLocalDescription(t),P(i)}y.updatingParticipantsQueue=void 0}catch(e){console.error(e)}}function Y(e){if(!(y&&y.audioElement&&y.audioContext&&y.mediaStream))return;const t=y.conference?.ssrcs?.find(t=>t.endpoint===e.track.id);if(!t||!t.userId)return;const{userId:n,isPresentation:a}=t,i=y.participants?.find(e=>e.id===n),o="video"===e.track.kind?a?"presentation":"video":"audio";e.track.onended=()=>{delete y?.streams?.[n][o],P(n)};const s=e.streams[0];if("audio"===e.track.kind){const{mediaStream:e}=y,t=new window.AudioContext,a=t.createMediaStreamSource(s),o=t.createGain();o.gain.value=(i?.volume||1e4)/1e4;const r=t.createGain();o.gain.value=1;const l=t.createAnalyser();l.minDecibels=-100,l.maxDecibels=-30,l.smoothingTimeConstant=.05,l.fftSize=1024,a.connect(l).connect(r).connect(o).connect(t.destination),e.addTrack(a.mediaStream.getAudioTracks()[0]);const d=new Audio;d.srcObject=s,d.muted=!0,d.remove(),y={...y,participantFunctions:{...y.participantFunctions,[n]:{...y.participantFunctions?.[n],setVolume:e=>{o.gain.value=e>1?2*e:e},toggleMute:e=>{r.gain.value=e?0:1},getCurrentAmplitude:()=>{const e=new Uint8Array(l.frequencyBinCount);return l.getByteFrequencyData(e),c(e,1.5)}}}}}y={...y,streams:{...y.streams,[n]:{...y.streams?.[n],[o]:s}}},P(n)}function D(e,t){let n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];const a=new RTCPeerConnection,i=n?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}(a);return e.forEach(e=>e.getTracks().forEach(t=>{a.addTrack(t,e)})),n||(a.oniceconnectionstatechange=()=>{const e=a.iceConnectionState;console.log("iceconnectionstatechange",e),"connected"===e||"completed"===e?M("connected"):"checking"===e||"new"===e?M("connecting"):"disconnected"===a.iceConnectionState&&M("reconnecting")}),a.onconnectionstatechange=()=>{console.log("connectionstatechange",a.connectionState)},a.ontrack=Y,a.onnegotiationneeded=async()=>{if(!y)return;console.log("onnegotiationneeded");const{myId:i}=y;if(!i)return;const o=await a.createOffer({offerToReceiveVideo:!0,offerToReceiveAudio:!n});if(console.log("offer created"),await a.setLocalDescription(o),console.log("local desc set"),!o.sdp)return;const s=h(o),r=n?void 0:{userId:"",sourceGroups:[{sources:[s.ssrc||0]}],isRemoved:n,isMain:!0,isVideo:!1,isPresentation:n,endpoint:n?"1":"0",mid:n?"1":"0"},c=s["ssrc-groups"]&&{isPresentation:n,userId:"",sourceGroups:s["ssrc-groups"],isMain:!0,isVideo:!0,endpoint:n?"0":"1",mid:n?"0":"1"},l=n?y.screenshareConference:y.conference,d=[];n?(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);y={...y,...n?{screenshareConference:{...l,ssrcs:d}}:{conference:{...l,ssrcs:d}},streams:{...y.streams,[i]:{...y.streams?.[i],...u&&{audio:u},...!n&&p?{video:p}:{presentation:p}}}},P(i),t(s)},{connection:a,dataChannel:i}}function F(){A?.onUpdate({...A.mediaState,"@type":"updatePhoneCallMediaState"})}function B(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&&{...p&&{echoCancellation:!0},...m&&{noiseSuppression:!0}},video:"video"===e&&{facingMode:t}})}async function G(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;if(!A)return;const n="audio"===e?A.streams.ownAudio:"video"===e?A.streams.ownVideo:A.streams.ownPresentation;if(!n)return;const a=n.getTracks()[0];if(!a)return;const i=A.connection.getSenders().find(e=>a.id===e.track?.id);if(i){t=void 0===t?!a.enabled:t;try{if(t&&!a.enabled){const t=await B(e);t.getTracks()[0].onended=()=>{G(e,!1)},await i.replaceTrack(t.getTracks()[0]),"audio"===e?A.streams.ownAudio=t:"video"===e?(A.streams.ownVideo=t,A.facingMode="user"):A.streams.ownPresentation=t,"video"!==e&&"presentation"!==e||G("video"===e?"presentation":"video",!1)}else if(!t&&a.enabled){a.stop();const t="audio"===e?A.silence:"video"===e?A.blackVideo:A.blackPresentation;if(!t)return;await i.replaceTrack(t.getTracks()[0]),"audio"===e?A.streams.ownAudio=t:"video"===e?A.streams.ownVideo=t:A.streams.ownPresentation=t}F(),L()}catch(e){console.error(e)}}}function R(){A&&(A.streams.ownVideo?.getTracks().forEach(e=>e.stop()),A.streams.ownPresentation?.getTracks().forEach(e=>e.stop()),A.streams.ownAudio?.getTracks().forEach(e=>e.stop()),A.dataChannel.close(),A.connection.close(),A=void 0)}function L(){if(!A)return;const{emitSignalingData:e,streams:t}=A;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 O(e){if(!A||A.isOutgoing)return e;const{payloadTypes:t}=e,n=t.findIndex(e=>"VP8"===e.name),a=t[n],i=t.findIndex(e=>Number(e.parameters?.apt)===a.id);return e.payloadTypes=[t[n],t[i]],e}function U(e){if(!A)return;const{emitSignalingData:t}=A;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:r(e.ssrc).toString(),ssrcGroups:[],payloadTypes:e.audioPayloadTypes,rtpExtensions:e.audioExtmap},video:O({ssrc:r(e["ssrc-groups"][0].sources[0]).toString(),ssrcGroups:[{semantics:e["ssrc-groups"][0].semantics,ssrcs:e["ssrc-groups"][0].sources.map(r)}],payloadTypes:e.videoPayloadTypes,rtpExtensions:e.videoExtmap}),screencast:O({ssrc:r(e["ssrc-groups"][1].sources[0]).toString(),ssrcGroups:[{semantics:e["ssrc-groups"][1].semantics,ssrcs:e["ssrc-groups"][1].sources.map(r)}],payloadTypes:e.screencastPayloadTypes,rtpExtensions:e.screencastExtmap})})}async function _(e){if(A&&A.connection)switch(e["@type"]){case"MediaState":A.mediaState=e,F(),L();break;case"Candidates":{const{pendingCandidates:t,gotInitialSetup:n}=A;e.candidates.forEach(e=>{t.push(e.sdpString)}),n&&await $();break}case"InitialSetup":{const{connection:t,isOutgoing:n}=A;if(!t)return;const a={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:[{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(l)||[],audioExtensions:e.audio.rtpExtensions,videoPayloadTypes:O(e.video).payloadTypes?.map(l)||[],videoExtensions:e.video.rtpExtensions};if(await t.setRemoteDescription({sdp:g(a,n,void 0,!0),type:n?"answer":"offer"}),A.conference=a,!n){const e=await t.createAnswer();await t.setLocalDescription(e),U(h(t.localDescription,!0))}A.gotInitialSetup=!0,await $();break}}}async function $(){if(!A)return;const{pendingCandidates:e,connection:t}=A;e.length&&(await Promise.all(e.map(e=>async function(e,t){try{await e.addIceCandidate({candidate:t,sdpMLineIndex:0})}catch(e){console.error(e)}}(t,e))),A.pendingCandidates=[])}async function J(e,t){const n=await e.createOffer(t);await e.setLocalDescription(n),U(h(e.localDescription,!0))}var j=n(14487),z=n(4875),K=n(13439),H=n(80840),q=n(32989),W=n(91048),Z=n(71331),Q=n(42347);(0,K.aJ)("leaveGroupCall",async(e,t,n)=>{const{isFromLibrary:i,shouldDiscard:o,shouldRemove:s,rejoin:r,isPageUnload:c,tabId:l=(0,j.g0)()}=n||{},d=(0,Z.iT)(e);d&&(e=(0,H.R6)(e,{connectionState:"disconnected"},d.participantsCount-1),e={...e,groupCalls:{...e.groupCalls,activeGroupCallId:void 0}},(0,K.UF)(e),await(0,z.px)("leaveGroupCall",{call:d,isPageUnload:c}),await(0,z.px)("abortRequestGroup","call"),o&&await(0,z.px)("discardGroupCall",{call:d}),e=(0,K.mS)(),s&&(e=(0,H.um)(e,d.id)),(0,a.ow)(),(0,K.UF)(e),t.toggleGroupCallPanel({force:void 0,tabId:l}),i||x(),t.afterHangUp(),r&&t.requestMasterAndJoinGroupCall({...r,tabId:l}))}),(0,K.aJ)("toggleGroupCallVideo",async e=>{const t=(0,Z.iT)(e),n=(0,W.mBe)(e,e.currentUserId);n&&t&&(await N("video"),await(0,z.px)("editGroupCallParticipant",{call:t,videoStopped:!I("video"),participant:n}))}),(0,K.aJ)("requestToSpeak",(e,t,n)=>{const{value:a}=n||{value:!0},i=(0,Z.iT)(e),o=(0,W.mBe)(e,e.currentUserId);o&&i&&(0,z.px)("editGroupCallParticipant",{call:i,raiseHand:a,participant:o})}),(0,K.aJ)("setGroupCallParticipantVolume",(e,t,n)=>{const{participantId:a,volume:i}=n,s=(0,Z.iT)(e),r=(0,W.mBe)(e,a);r&&s&&(k(a,Math.floor(i/o.CH0)/100),(0,z.px)("editGroupCallParticipant",{call:s,volume:Number(i),participant:r}))}),(0,K.aJ)("toggleGroupCallMute",async(e,t,n)=>{const{participantId:a,value:i}=n||{},o=(0,Z.iT)(e),s=(0,W.mBe)(e,a||e.currentUserId);if(!s||!o)return;const r=void 0===i?I("audio",s.id):i;a?k(a,r?0:1):await N("audio"),await(0,z.px)("editGroupCallParticipant",{call:o,muted:r,participant:s})}),(0,K.aJ)("toggleGroupCallPresentation",async(e,t,n)=>{const a=(0,Z.iT)(e),i=(0,W.mBe)(e,e.currentUserId);if(i&&a){if(void 0!==n?.value?n?.value:!I("presentation")){const e=await async function(){if(y)try{const e=await T("presentation");if(!e)return;return e.getTracks()[0].onended=()=>{y&&y.myId&&(delete y.streams?.[y.myId].presentation,P(y.myId),w())},await new Promise(t=>{const{connection:n,dataChannel:a}=D([e],t,!0);y={...y,screenshareConnection:n,screenshareDataChannel:a}})}catch(e){return}}();if(!e)return;await(0,z.px)("joinGroupCallPresentation",{call:a,params:e})}else await N("presentation",!1),await(0,z.px)("leaveGroupCallPresentation",{call:a});await(0,z.px)("editGroupCallParticipant",{call:a,presentationPaused:!I("presentation"),participant:i})}}),(0,K.aJ)("connectToActiveGroupCall",async(e,t,n)=>{const{tabId:i=(0,j.g0)()}=n||{},o=(0,Z.iT)(e);if(!o)return;if("discarded"===o.connectionState)return void t.showNotification({message:"This voice chat is not active",tabId:i});const s=(0,a.sN)(),r=(0,a.Hc)();if(!s||!r)return;const{currentUserId:c}=e;if(!c)return;const l=await function(e,t,n,a){if(y)throw Error("Already in call");M("connecting");const i=new MediaStream;return n.srcObject=i,(0,b.A)(n),y={onUpdate:a,participants:[],myId:e,speaking:{},silence:f(t),black:v({width:640,height:480}),analyserInterval:setInterval(V,1e3),audioElement:n,audioContext:t,mediaStream:i,lastMid:3},T("audio"),new Promise(e=>{y={...y,...D([y.silence,y.black],e)}})}(c,r,s,t.apiUpdate),d=await(0,z.px)("joinGroupCall",{call:o,params:l,inviteHash:o.inviteHash});if(e=(0,K.mS)(),!d)return t.showNotification({message:"Failed to join voice chat",tabId:i}),void t.leaveGroupCall({tabId:i});if(t.loadMoreGroupCallParticipants(),o.chatId){e=(0,K.mS)();const n=(0,W.hds)(e,o.chatId);if(!n)return;await(0,Q.ad)(e,t,n)}}),(0,K.aJ)("connectToActivePhoneCall",async(e,t)=>{const{phoneCall:n}=e;if(!n)return;const a=(0,Z.uu)(e);if(!a)return;const i=await(0,z.px)("getDhConfig");if(!i)return;await(0,z.px)("createPhoneCallState",[!0]);const o=await(0,z.px)("requestPhoneCall",[i]);await(0,z.px)("requestCall",{user:a,gAHash:o,isVideo:n.isVideo})||"hangUp"in t&&t.hangUp({tabId:(0,j.g0)()})}),(0,K.aJ)("acceptCall",async e=>{const{phoneCall:t}=e;if(!t)return;const n=await(0,z.px)("getDhConfig");if(!n)return;await(0,z.px)("createPhoneCallState",[!1]);const a=await(0,z.px)("acceptPhoneCall",[n]);await(0,z.px)("acceptCall",{call:t,gB:a})}),(0,K.aJ)("sendSignalingData",(e,t,n)=>{const{phoneCall:a}=e;if(!a)return;const i=JSON.stringify(n);(async()=>{const e=await(0,z.px)("encodePhoneCallData",[i]);e&&(0,z.px)("sendSignalingData",{data:e,call:a})})()}),(0,K.aJ)("closeCallRatingModal",(e,t,n)=>{const{tabId:a=(0,j.g0)()}=n||{};return(0,q.w)(e,{ratingPhoneCall:void 0},a)}),(0,K.aJ)("setCallRating",(e,t,n)=>{const{rating:a,comment:i,tabId:o=(0,j.g0)()}=n,{ratingPhoneCall:s}=(0,W.nTw)(e,o);if(s)return(0,z.px)("setCallRating",{call:s,rating:a,comment:i}),(0,q.w)(e,{ratingPhoneCall:void 0},o)}),(0,K.aJ)("hangUp",(e,t,n)=>{const{isPageUnload:a,tabId:i=(0,j.g0)()}=n||{},{phoneCall:o}=e;if(o){if("discarded"===o.state)return(0,z.px)("destroyPhoneCallState"),R(),e={...e,phoneCall:void 0},(0,K.UF)(e),t.toggleGroupCallPanel({force:void 0,tabId:i}),void t.afterHangUp();if((0,z.px)("destroyPhoneCallState"),R(),(0,z.px)("discardCall",{call:o,isPageUnload:a}),"requesting"===o.state)return e={...e,phoneCall:void 0},(0,K.UF)(e),t.toggleGroupCallPanel({force:void 0,tabId:i}),void t.afterHangUp();setTimeout(()=>{e=(0,K.mS)(),e={...e,phoneCall:void 0},(0,K.UF)(e),t.toggleGroupCallPanel({force:void 0,tabId:i}),t.afterHangUp()},500)}});var X=n(87894),ee=n(6e4);const te=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]),ne=[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,K.aJ)("apiUpdate",(e,t,n)=>{const{activeGroupCallId:a}=e.groupCalls;switch(n["@type"]){case"updateGroupCallLeavePresentation":t.toggleGroupCallPresentation({value:!1});break;case"updateGroupCallStreams":if(!n.userId||!a)break;if(!(0,Z.n5)(e,a,n.userId))break;return(0,H.c5)(e,a,n.userId,(0,X.cJ)(n,["@type","userId"]));case"updateGroupCallConnectionState":if(!a)break;if("disconnected"===n.connectionState){"leaveGroupCall"in t&&t.leaveGroupCall({isFromLibrary:!0,tabId:(0,j.g0)()});break}return(0,H.h9)(e,a,{connectionState:n.connectionState,isSpeakerDisabled:n.isSpeakerDisabled});case"updateGroupCallParticipants":{const{groupCallId:e,participants:t}=n;a===e&&E(t);break}case"updateGroupCallConnection":{if(n.data.stream){t.showNotification({message:"Big live streams are not yet supported",tabId:(0,j.g0)()}),"leaveGroupCall"in t&&t.leaveGroupCall({tabId:(0,j.g0)()});break}!async function(e,t){if(!y)return;const n=t?y.screenshareConference:y.conference,a=t?y.screenshareConnection:y.connection;if(!n||!a||!n.ssrcs)return;const i=Date.now(),o={...n,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"]};y={...y,...t?{screenshareConference:o}:{conference:o}};try{await a.setRemoteDescription({type:"answer",sdp:g(o,!0,t)})}catch(e){console.error(e)}}(n.data,n.presentation);const a=(0,Z.iT)(e);a?.participants&&Object.keys(a.participants).length>0&&E(Object.values(a.participants));break}case"updatePhoneCallMediaState":return{...e,phoneCall:{...e.phoneCall,...(0,X.cJ)(n,["@type"])}};case"updatePhoneCall":{if(!i.OL)return;const{phoneCall:a,currentUserId:s}=e,r={...a,...n.call},c=a?.adminId===s;if(e={...e,phoneCall:r},(0,K.UF)(e),e=(0,K.mS)(),a&&a.id&&r.id!==a.id)return void("discarded"!==r.state&&(0,z.px)("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 n=(0,Z.uu)(e);return"hangUp"in t&&t.hangUp({tabId:(0,j.g0)()}),void t.showNotification({message:ee.yE("VoipPeerIncompatible",n?.firstName),tabId:(0,j.g0)()})}if("discarded"===d){if(!a)return;return(0,q.w)(e,{...r.needRating&&{ratingPhoneCall:r},isCallPanelVisible:void 0},(0,j.g0)())}return"accepted"===d&&l&&p?(async()=>{const{gA:t,keyFingerprint:n,emojis:a}=await(0,z.px)("confirmPhoneCall",[p,te,ne]),i={...(e=(0,K.mS)()).phoneCall,emojis:a};e={...e,phoneCall:i},(0,K.UF)(e),(0,z.px)("confirmCall",{call:r,gA:t,keyFingerprint:n})})():"active"===d&&u&&"active"!==a?.state&&(c||((0,z.px)("receivedCall",{call:r}),(async()=>{const{emojis:t}=await(0,z.px)("confirmPhoneCall",[r.gAOrB,te,ne]),n={...(e=(0,K.mS)()).phoneCall,emojis:t};e={...e,phoneCall:n},(0,K.UF)(e)})()),async function(e,t,n,a,i,o){const s=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})),iceTransportPolicy:i?"all":"relay",bundlePolicy:"max-bundle",iceCandidatePoolSize:10});s.onicecandidate=e=>{e.candidate&&t({"@type":"Candidates",candidates:[{sdpString:e.candidate.candidate}]})},s.onconnectionstatechange=()=>{o({"@type":"updatePhoneCallConnectionState",connectionState:s.connectionState})},s.ontrack=e=>{if(!A)return;const t=e.streams[0];"audio"===e.track.kind?(A.audio.srcObject=t,A.audio.play().catch(),A.streams.audio=t):"1"===e.transceiver.mid?A.streams.video=t:A.streams.presentation=t,F()},s.oniceconnectionstatechange=async e=>{switch(s.iceConnectionState){case"disconnected":case"failed":n&&await J(s,{offerToReceiveAudio:!0,offerToReceiveVideo:!0,iceRestart:!0})}};const r=f(new AudioContext),c=v({width:640,height:480}),l=v({width:640,height:480});s.addTrack(r.getTracks()[0],r),s.addTrack(c.getTracks()[0],c),s.addTrack(l.getTracks()[0],l);const d=s.createDataChannel("data",{id:0,negotiated:!0});d.onmessage=e=>{_(JSON.parse(e.data))};const u=new Audio;A={audio:u,connection:s,emitSignalingData:t,isOutgoing:n,pendingCandidates:[],onUpdate:o,streams:{ownVideo:c,ownAudio:r,ownPresentation:l},mediaState:{isBatteryLow:!1,screencastState:"inactive",videoState:"inactive",videoRotation:0,isMuted:!0},blackVideo:c,blackPresentation:l,silence:r,dataChannel:d};try{G("audio",!0)}catch(e){console.error(e)}n&&await J(s,{offerToReceiveAudio:!0,offerToReceiveVideo:!0})}(u,t.sendSignalingData,c,Boolean(r?.isVideo),Boolean(r.isP2pAllowed),t.apiUpdate)),e}case"updatePhoneCallConnectionState":{const{connectionState:a}=n;return e.phoneCall?"closed"===a||"disconnected"===a||"failed"===a?void("hangUp"in t&&t.hangUp({tabId:(0,j.g0)()})):{...e,phoneCall:{...e.phoneCall,isConnected:"connected"===a}}:e}case"updatePhoneCallSignalingData":{const{phoneCall:t}=e;if(!t)break;(0,z.px)("decodePhoneCallData",[n.data])?.then(_);break}}var o});var ae=n(84051),ie=n(87357),oe=n(43874),se=n(37661),re=n(5912),ce=n(17712),le=n(59030),de=n(90423),ue=n(73767),pe=n(93545),me=n(18276),he=n(64493),ge=n(19806),fe=n(12933),ve=n(22337),Ce=n(96374),be=n(46222),ye=n(4961);function Ae(e){return Math.floor((e.volume||o.iRY)/o.CH0).toString()}var we=n(10722),Se=n(21849),ke=n(34431),Ie=n(22720),Pe=n(58443),Te=n(672),Ne=n(4438),Me=n(285),xe=n(71429),Ve=n(24433),Ee=n(20021);const Ye=[0,17],De=[17,34],Fe=(0,ae.ph)((0,K.EK)(e=>({isAdmin:(0,Z.qI)(e)}))(e=>{let{participant:t,onCloseAnimationEnd:n,onClose:a,isDropdownOpen:i,isAdmin:s,menuRef:r,...c}=e;const{toggleGroupCallMute:l,setGroupCallParticipantVolume:d,toggleGroupCallPanel:u,openChat:p,requestToSpeak:m}=(0,K.ko)(),h=(0,le.A)(),[g,f,v]=(0,se.A)(),C=t?.id,{isMutedByMe:b,isMuted:y,isSelf:A,canSelfUnmute:w}=t||{},S=Boolean(t?.raiseHandRating),k=!w&&y,[I,P]=(0,ae.J0)(b?0:(t?.volume||o.iRY)/o.CH0),[T,N]=(0,ae.J0)(!1),M=0===I,x=M?Ye:De;(0,ae.vJ)(()=>{i||N(!1)},[i]);const V=(0,ce.A)(e=>{P(e),N(0===e!==M)});(0,ae.vJ)(()=>{P(b?0:(t?.volume||o.iRY)/o.CH0)},[C]);const E=function(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:[];return(0,Te.A)(e=>{e()},n,e,t)}(500),Y=(0,ce.A)(e=>{e.stopPropagation(),f(),a()}),D=(0,ce.A)(e=>{e.stopPropagation(),m({value:!1}),a()}),F=(0,ce.A)(e=>{e.stopPropagation(),a(),s?k&&V((t?.volume??o.iRY)/o.CH0):V(b?o.iRY/o.CH0:0),l({participantId:C,value:s?!k:!b})}),B=(0,ce.A)(e=>{e.stopPropagation(),u(),p({id:C}),a()});return(0,Ee.FD)("div",{children:[(0,Ee.FD)(xe.A,{isOpen:i,ref:r,withPortal:!0,onClose:a,onCloseAnimationEnd:n,className:"participant-menu with-menu-transitions",...c,children:[!A&&!k&&(0,Ee.Y)("div",{className:"group",children:(0,Ee.FD)("div",{className:(0,ie.A)("volume-control",I<50&&"low",I>=50&&I<100&&"medium",I>=100&&I<150&&"normal",I>=150&&"high"),children:[(0,Ee.Y)("input",{type:"range",min:"0",max:"200",value:I,onChange:e=>{const t=Number(e.target.value);V(t),E(()=>{0===t?l({participantId:C,value:!0}):d({participantId:C,volume:Math.floor(t*o.CH0)})})}}),(0,Ee.FD)("div",{className:"info",children:[(0,Ee.Y)(Ne.A,{tgsUrl:Pe.w.Speaker,play:!!T&&x.toString(),playSegment:x,size:24}),(0,Ee.FD)("span",{children:[I,"%"]})]})]})}),(0,Ee.FD)("div",{className:"group",children:[S&&A&&(0,Ee.Y)(Ve.A,{icon:"stop-raising-hand",onClick:D,children:h("VoipGroupCancelRaiseHand")}),!A&&(0,Ee.Y)(Ve.A,{icon:"user",onClick:B,children:h("VoipGroupOpenProfile")}),!A&&(0,Ee.Y)(Ve.A,{icon:y&&s&&k?"allow-speak":"microphone-alt",onClick:F,children:h(s?k?"VoipGroupAllowToSpeak":"VoipMute":b?"VoipGroupUnmuteForMe":"VoipGroupMuteForMe")}),!A&&s&&(0,Ee.Y)(Ve.A,{icon:"delete-user",destructive:!0,onClick:Y,children:h("VoipGroupUserRemove")})]})]}),!A&&s&&(0,Ee.Y)(Me.A,{isOpen:g,userId:C,onClose:v})]})})),Be=(0,ae.ph)(e=>{let{participant:t,noColor:n,className:a}=e;const{isMuted:i,isMutedByMe:o}=t,s=(t.amplitude||0)>d,r=Boolean(t.raiseHandRating),c=(0,ue.A)(r),l=!Boolean(t?.canSelfUnmute)&&i,u=(0,ue.A)(i),p=(0,ae.Kr)(()=>i&&!u?[43,64]:!i&&u?[22,42]:r&&!c?[65,84]:!l&&c?[0,21]:i?[22,23]:[43,44],[i,l,r]),m=(0,ae.Kr)(()=>n?"#ffffff":r?"#4da6e0":l||o?"#ff706f":s?"#57bc6c":"#aaaaaa",[n,r,l,o,s]);return(0,Ee.Y)(Ne.A,{tgsUrl:Pe.w.VoiceOutlined,play:p.toString(),playSegment:p,size:28,color:m,className:a,forceAlways:!0,nonInteractive:!0})}),Ge={root:"Wk7JwPx3",subtitle:"ShcCNemD",subtitleText:"UZLgp2cx",icon:"vRc6jhKf",subtitleBlue:"yA7bxEWw",subtitleRed:"DnuZwImI",subtitleGreen:"BkgYQGFq",avatar:"ouHUJ9ff"},Re=(0,ae.ph)((0,K.EK)((e,t)=>{let{participant:n}=t;return{peer:(0,W.mBe)(e,n.id)||(0,W.hds)(e,n.id)}})(e=>{let{participant:t,peer:n}=e;const a=(0,ae.li)(),i=(0,ae.li)(),s=(0,le.A)(),{isSelf:r,isMutedByMe:c,isMuted:l,hasVideoStream:u,hasPresentationStream:p}=t,m=(t.amplitude||0)>d,h=Boolean(t.raiseHandRating),{isContextMenuOpen:g,contextMenuAnchor:f,handleContextMenu:v,handleBeforeContextMenu:C,handleContextMenuClose:b,handleContextMenuHide:y}=(0,we.A)(a,r),A=(0,ae.hb)(()=>a.current,[]),w=(0,ae.hb)(()=>a.current.closest(".custom-scroll, .no-scrollbar"),[]),S=(0,ae.hb)(()=>i.current,[]),k=(0,ae.hb)(()=>({withPortal:!0}),[]),I=Boolean(!l&&m&&t.volume&&t.volume!==o.iRY),[P,T]=(0,ae.Kr)(()=>c?[s("VoipGroupMutedForMe"),Ge.subtitleRed]:h?[s("WantsToSpeak"),Ge.subtitleBlue]:I?[s("SpeakingWithVolume",Ae(t)).replace("%%","%"),Ge.subtitleGreen]:!l&&m?[s("Speaking"),Ge.subtitleGreen]:r?[s("ThisIsYou"),Ge.subtitleBlue]:t.about?[t.about,""]:[s("Listening"),Ge.subtitleBlue],[c,h,I,l,m,r,t,s]);if(n)return(0,Ee.FD)(Ie.A,{leftElement:(0,Ee.Y)(Se.A,{peer:n,className:Ge.avatar}),rightElement:(0,Ee.Y)(Be,{participant:t,className:Ge.icon}),className:Ge.root,onClick:v,onMouseDown:C,onContextMenu:v,multiline:!0,ripple:!0,ref:a,children:[(0,Ee.Y)(ke.A,{peer:n,withEmojiStatus:!0,className:Ge.title}),(0,Ee.FD)("span",{className:(0,ie.A)(Ge.subtitle,"subtitle",T),children:[p&&(0,Ee.Y)(me.A,{name:"share-screen"}),u&&(0,Ee.Y)(me.A,{name:"video"}),I&&(0,Ee.Y)(me.A,{name:"speaker"}),(0,Ee.Y)("span",{className:Ge.subtitleText,children:(0,ye.A)(P)})]}),(0,Ee.Y)(Fe,{participant:t,isDropdownOpen:g,anchor:f,getTriggerElement:A,getRootElement:w,getMenuElement:S,getLayout:k,onClose:b,onCloseAnimationEnd:y,menuRef:i})]})}));function Le(e,t){return(0,X.zV)(!e.isMuted,!t.isMuted)||(0,X.zV)(e.presentation,t.presentation)||(0,X.zV)(e.video,t.video)||(0,X.zV)(e.raiseHandRating,t.raiseHandRating)}const Oe=(0,ae.ph)((0,K.EK)(e=>{const{participantsCount:t,participants:n}=(0,Z.iT)(e)||{};return{participants:n,participantsCount:t||0}})(e=>{let{panelOffset:t,participants:n,participantsCount:a,isLandscape:i}=e;const{loadMoreGroupCallParticipants:o}=(0,K.ko)(),s=(0,ae.Kr)(()=>Object.values(n||{}).sort(Le).map(e=>e.id),[n]),r=(0,ce.A)(()=>{o()}),[c,l]=(0,Ce.A)(r,s,s.length>=a);return(0,Ee.Y)(be.A,{items:c,onLoadMore:l,style:`transform: translateY(${t}px);`,className:(0,ie.A)("npTa6CmI",!i&&"v7oB2HTv"),children:n&&c?.map(e=>n[e]&&(0,Ee.Y)(Re,{teactOrderKey:s.indexOf(e),participant:n[e]},e))})}));var Ue=n(32587),_e=n(66644),$e=n(19822),Je=n(37836),je=n(32625),ze=n(55158);const Ke="eUXuK9Oz",He="O2bTiH2E",qe=(0,ae.ph)((0,K.EK)((e,t)=>{let{participant:n}=t;return{user:n.isUser?(0,W.mBe)(e,n.id):void 0,chat:n.isUser?void 0:(0,W.hds)(e,n.id)}})(e=>{let{layout:t,pinnedVideo:n,setPinned:a,canPin:s,className:r,participant:c,user:l,chat:u}=e;const p=(0,le.A)(),m=(0,ae.li)(),h=(0,ae.li)(),g=(0,ae.li)(),{x:f,y:v,width:C,height:b,noAnimate:y,isRemoved:A,type:w}=t,{isSelf:k,isMutedByMe:I,isMuted:P}=c,T=n?.id===c.id&&n?.type===w,N=(c.amplitude||0)>d,M=Boolean(c.raiseHandRating),x="video"===w&&c.isSelf,V=(0,ae.Kr)(()=>k?p("ThisIsYou"):I?p("VoipGroupMutedForMe"):M?p("WantsToSpeak"):P||!N?p("Listening"):c.volume&&c.volume!==o.iRY?p("SpeakingWithVolume",Ae(c)).replace("%%","%"):p("Speaking"),[k,I,M,P,N,c,p]),E=(0,ae.li)();A||(E.current=t);const{x:Y,y:D,width:F,height:B}=E.current||{},[G,R,L,O]=A?[Y,D,F,B]:[f,v,C,b],[U,_]=(0,ae.J0)(!y),$=S(l?.id||u.id),J="video"===w?$?.video:$?.presentation,j=(0,ae.li)(J);J?.active&&J?.getVideoTracks()[0].enabled&&(j.current=J);const z=j.current,K=(0,ce.A)(()=>{const e=h.current;e&&(e.srcObject=null)});(0,ae.vJ)(()=>(z?.addEventListener("inactive",K),()=>{z?.removeEventListener("inactive",K)}),[K,z]),(0,ae.vJ)(()=>{_(!1)},[]);const[H,q]=(0,ae.J0)(!0),W=(0,ce.A)(()=>{q(!1)});(0,je.A)(()=>{if(!z?.active)return;const e=h.current,t=g.current;(0,_e.RK)(()=>{t.width=e.videoWidth,t.height=e.videoHeight,t.getContext("2d").drawImage(e,0,0,t.width,t.height)})},1e3),(0,ae.vJ)(()=>{const e=h.current,t=m.current;if(!e||!t||!z)return;const n=t.getContext("2d",{alpha:!1});if(!n)return;let a=!0;return(0,_e.RK)(()=>{a&&(t.width=16,t.height=16,n.filter="blur(2px)",(0,$e.i0)(()=>!!a&&!!z.active&&(n.drawImage(e,0,0,e.videoWidth,e.videoHeight,0,0,t.width,t.height),i.QH||(0,Ue.A)(n,0,0,t.width,t.height,2,2),!0),Je.IJ))}),()=>{a=!1}},[z]);const Z=(0,ae.li)(),Q=(0,ae.li)(),{isContextMenuOpen:X,contextMenuAnchor:ee,handleContextMenu:te,handleContextMenuClose:ne,handleContextMenuHide:oe}=(0,we.A)(Z,k),se=(0,ae.hb)(()=>Z.current,[]),re=(0,ae.hb)(()=>Z.current.closest(".custom-scroll, .no-scrollbar"),[]),de=(0,ae.hb)(()=>Q.current,[]),ue=(0,ae.hb)(()=>({withPortal:!0}),[]),pe=(0,ae.hb)(()=>{a(T?void 0:{id:l?.id||u.id,type:w})},[u,T,a,w,l?.id]);return(0,Ee.FD)("div",{className:(0,ie.A)("DKuzmnN7",(U||A)&&"T_wodAHA",y&&"yPCkJzpi",r,T&&"B4WZhF9P"),style:`--x: ${G}px; --y: ${R}px; --width: ${L}px; --height: ${O}px;`,ref:Z,onContextMenu:te,onDoubleClick:s?pe:void 0,children:[(0,Ee.FD)("div",{className:(0,ie.A)("eBq1NoLo",N&&"h4NcT6OS"),children:[H&&(0,Ee.Y)(ze.A,{className:(0,ie.A)(Ke,"XedVWQii")}),z&&(0,Ee.Y)("video",{className:(0,ie.A)(Ke,x&&He),muted:!0,autoPlay:!0,playsInline:!0,srcObject:z,ref:h,onCanPlay:W}),(0,Ee.Y)("canvas",{className:(0,ie.A)("eTpvBU_b eUXuK9Oz",x&&He),ref:g}),(0,Ee.Y)("div",{className:"R5ULTrF9",children:(0,Ee.Y)("canvas",{className:(0,ie.A)("cjUWuViy",x&&He),ref:m})}),s&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",ripple:!0,color:"translucent",className:"lPdblo0y",ariaLabel:p(T?"lng_group_call_context_unpin_camera":"lng_group_call_context_pin_camera"),onClick:pe,children:(0,Ee.Y)(me.A,{name:T?"unpin":"pin"})}),(0,Ee.FD)("div",{className:"T1deCDSn",children:[(0,Ee.FD)("div",{className:"LzFFayK3",children:[(0,Ee.Y)(ke.A,{peer:l||u,className:"RBwMAuKp"}),(0,Ee.Y)("div",{className:"z1ZZTsjC",children:V})]}),(0,Ee.Y)(Be,{participant:c,className:"j1aDzn1H",noColor:!0})]})]}),(0,Ee.Y)(Fe,{participant:c,isDropdownOpen:X,anchor:ee,getTriggerElement:se,getRootElement:re,getMenuElement:de,getLayout:ue,onClose:ne,onCloseAnimationEnd:oe,menuRef:Q})]})})),We=()=>{navigator.vibrate?.(50)};var Ze=n(57474);const Qe=(0,ae.ph)((0,K.EK)(e=>{const t=(0,Z.iT)(e),{connectionState:n}=t||{},a=t&&(0,Z.n5)(e,t.id,e.currentUserId),{raiseHandRating:i,hasAudioStream:o,canSelfUnmute:s,isMuted:r}=a||{};return{connectionState:n||"discarded",hasRequestedToSpeak:Boolean(i),noAudioStream:!o,canSelfUnmute:s,isMuted:r}})(e=>{let{className:t,noAudioStream:n,canSelfUnmute:a,isMuted:i,connectionState:o}=e;const{toggleGroupCallMute:s,requestToSpeak:r,playGroupCallSound:c}=(0,K.ko)(),l=(0,le.A)(),d=(0,ae.li)("up"),[u,p]=(0,ae.J0)(!1),m="connected"!==o,h=!a&&i,g=(0,ue.A)(h);(0,ae.vJ)(()=>{g&&!h&&c({sound:"allowTalk"})},[c,g,h]);const f=(0,ae.Kr)(()=>{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!g&&h?n?[99,135]:[136,172]:g&&!h?[0,36]:h?[0,0]:n?[69,99]:[36,69]},[g,u,n,h]),v=u?"HandFilled":"VoiceMini",C=(0,ae.hb)(()=>{We(),s()},[s]),b=(0,ae.hb)(()=>{if(h){if(u)return;return We(),r(),p(!0),void setTimeout(()=>{p(!1)},3e3)}d.current="down",n&&setTimeout(()=>{"down"===d.current&&(d.current="hold",C())},200)},[u,n,r,h,C]),y=(0,ae.hb)(()=>{h||(C(),d.current="up")},[h,C]);return(0,Ee.FD)(he.A,{round:!0,size:"default",className:(0,ie.A)("lKdhQ5pw",!m&&n&&"bjKqp3SI",!m&&h&&"Ynow5UuE",t),onMouseDown:b,onMouseUp:y,ariaLabel:l(i?"VoipUnmute":"VoipMute"),disabled:m,children:[(0,Ee.Y)(Ne.A,{tgsUrl:Pe.w[v],size:36,play:f.toString(),playSegment:f,className:"Ea1XnQaX",forceAlways:!0}),(0,Ee.Y)(Ze.A,{className:(0,ie.A)("tyQNJC6B",m&&"LowChABq"),color:"white"})]})})),Xe={root:"OsO5GKfn",panelWrapper:"cUVoePr_",panel:"Thuz79M3",panelScrollTrigger:"zoK6Y6IS",panelHeader:"DMBtCL9Z",scrolled:"GdEH1Agb",fullscreen:"JJx0QI2w",landscape:"wamCuzMB",headerButton:"gmyieSid",firstButton:"hVnn6KBp",lastButton:"iy78A5rG",panelHeaderText:"TwEEA77i",title:"pNZ9skLf",bigger:"NumT3v5i",subtitle:"gmfUKabx",participants:"iTeC_RxH",participantVideos:"PZmKIdTl",addParticipantButton:"clmu2oBt",videos:"ATwoMlAV",mainVideoContainer:"hqFon3dV",videosHeader:"KPHc659W",appFullscreen:"cl2sfoBF",videosHeaderLastButton:"_t50HVNJ",videosContent:"oEEQZilE",actions:"uGzi9s97",actionButton:"foXbVcnN",destructive:"YIR9Z9CZ",canRequestToSpeak:"ZoiZQu_O",muted:"wpvv1V6m",portrait:"R6HQcMwx",noVideoParticipants:"aepCFyJQ",noSidebar:"XjgP21E6"},et=(0,ae.ph)((0,K.EK)((e,t)=>{let{groupCallId:n}=t;const{connectionState:a,title:i,participants:o,participantsCount:s,chatId:r}=(0,Z.Ip)(e,n)||{},c=r?(0,W.hds)(e,r):void 0;return{connectionState:a,title:i||c?.title,participantsCount:s,meParticipant:(0,Z.n5)(e,n,e.currentUserId),isCallPanelVisible:Boolean((0,W.nTw)(e).isCallPanelVisible),isAdmin:(0,Z.qI)(e),participants:o,canInvite:(0,Z.O7)(e)}})(e=>{let{groupCallId:t,isCallPanelVisible:n,connectionState:a,participantsCount:i,title:o,meParticipant:s,isAdmin:r,participants:c,canInvite:l}=e;const{toggleGroupCallVideo:d,toggleGroupCallPresentation:p,leaveGroupCall:m,toggleGroupCallPanel:h,connectToActiveGroupCall:g,playGroupCallSound:f,createGroupCallInviteLink:v}=(0,K.ko)(),C=(0,le.A)(),b=(0,ae.li)(),y=(0,ae.li)(),A=(0,ae.li)(),w=(0,ae.li)(),S=(0,ae.li)(),[k,I]=(0,ae.J0)(!1),P=!n&&!k,{observe:T}=(0,re.BL)({rootRef:S,throttleMs:200,isDisabled:!P}),N=!(0,re.Vz)(w,P?T:void 0),{isMobile:M,isLandscape:x}=(0,oe.Ay)(),[V,E,Y]=(0,se.A)(),[D,F,B]=(0,se.A)(!0),G=Boolean(V&&x),R=(0,de.zk)(),L=(0,ae.Kr)(()=>Object.values(c).find(e=>{let{presentation:t}=e;return t}),[c]),O=(0,ae.Kr)(()=>Object.values(c).filter(e=>{let{video:t,presentation:n}=e;return t||n}).flatMap(e=>{let{id:t,video:n,presentation:a}=e;return(0,X.oE)([n?{id:t,type:"video"}:void 0,a?{id:t,type:"screen"}:void 0])}),[c]),U=O.length>0,_=o||C("VoipGroupVoiceChat"),$=C("Participants",i,"i"),[J,j,z]=(0,se.A)(),[H,q]=(0,ae.J0)(!1),[W,Z]=(0,ae.J0)(!1),Q=s?.hasVideoStream,ee=s?.hasPresentationStream,te=s?.hasAudioStream,ne="connected"!==a,Ce=s?.canSelfUnmute,be=!Ce&&!te;(0,ae.vJ)(()=>{"connected"===a?f({sound:"join"}):"reconnecting"===a&&f({sound:"connecting"})},[a]);const ye=(0,ce.A)(()=>{z(),q(!1)}),Ae=(0,ce.A)(()=>{b.current&&!M&&(V?Y():E())}),we=(0,ce.A)(()=>{D?B():F()}),Se=(0,ce.A)(()=>{h()}),ke=(0,ce.A)(()=>{v()}),Ie=(0,ce.A)(()=>{d()});(0,ae.vJ)(()=>{g()},[g,t]);const Pe=(0,ce.A)(()=>{!r||J?(f({sound:"leave"}),I(!0),z()):j()}),Te=(0,ce.A)(()=>{k&&m({shouldDiscard:W})}),Ne=(0,ce.A)(()=>{p()}),Me=O.length>1&&!M,xe=G&&U,[Ve,Ye]=(0,ae.J0)(void 0),{videoLayout:De,panelOffset:Fe}=function(e){let{primaryContainerRef:t,secondaryContainerRef:n,videoParticipants:a,isLandscapeLayout:i,pinnedVideo:o}=e;const[s,r]=(0,ae.J0)([]),[c,l]=(0,ae.J0)(0),d=a.length,u=(0,ue.A)(d),p=(0,ue.A)(a),m=(0,ae.Kr)(()=>p?.filter(e=>{let{id:t,type:n}=e;return!a.some(e=>e.id===t&&e.type===n)}),[p,a]),h=(0,ce.A)(()=>{const e=t.current,s=n.current;if(!s)return;const c=void 0!==u&&u>d?u-d:0,{x:p,y:h,width:g}=s.getBoundingClientRect(),f=[];if(void 0!==o||!e||!i){const t=!0;let n,s=!1,u=0,v=a;if(o&&e&&i&&(u=v.findIndex(e=>{let{id:t,type:n}=e;return t===o.id&&n===o.type}),-1!==u)){const{x:t,y:a,width:i,height:r}=e.getBoundingClientRect(),{id:c,type:l}=o;n={x:t,y:a,width:i,height:r,participantId:c,type:l,orderKey:u},s=!0,v=v.filter(e=>{let{id:t,type:n}=e;return t!==c||n!==o.type})}const C=s?d-1:d,b=C%2==1,y=2,A=Math.ceil(C/y),w=(g-10*(y-1))/y,S=Math.max(0,b?240+(A-1)*w+8*(A-1):A*w+8*(A-1));for(let e=0;e<C;e++){const n=b&&0===e,a=n?g:w,i=n?240:w,o=b&&0!==e?e+1:e,s=(t?0:p)+o%y*(a+10),r=(t?0:h)+(b&&0!==e?248+(Math.floor(o/y)-1)*(i+8):Math.floor(o/y)*(i+8));f.push({x:s,y:r,width:a,height:i,shouldRemount:!t,isRemounted:t,noAnimate:!0,participantId:v[e].id,type:v[e].type,orderKey:e>=u?e+1:e})}if(n&&f.splice(u,0,n),m)for(let e=0;e<c;e++)f.push({x:0,y:0,width:0,height:0,isRemounted:t,isRemoved:!0,participantId:m[e].id,type:m[e].type,orderKey:e+d});return l(S),void r(f)}const{x:v,y:C,width:b,height:y}=e.getBoundingClientRect(),A=function(e){return e>=25?5:e>=13?4:e>=7?3:e>=3?2:1}(d),w=Math.ceil(d/A),S=w*A>d,k=(b-10*(A-1))/A,I=(y-8*(w-1))/w,P=k*(d%A);for(let e=0;e<d;e++){const t=Math.floor(e/A),n=v+e%A*(k+10)+(S&&t===w-1?(b-P)/2:0),i=C+Math.floor(e/A)*(I+8);f.push({x:n,y:i,width:k,height:I,participantId:a[e].id,type:a[e].type,orderKey:e})}if(m)for(let e=0;e<c;e++)f.push({x:0,y:0,width:0,height:0,isRemoved:!0,participantId:m[e].id,type:m[e].type,orderKey:e+d});l(0),r(f)});return(0,ae.vJ)(h,[h,a,i,o]),(0,pe.A)(t,h,!t.current),(0,pe.A)(n,h,!n.current),{videoLayout:s,panelOffset:c}}({primaryContainerRef:y,secondaryContainerRef:A,videoParticipants:O,isLandscapeLayout:G,pinnedVideo:Ve}),Be=(0,ce.A)(e=>{Ye(e),e&&!V&&E()}),Ge=(0,ce.A)(()=>{L&&Ye({id:L.id,type:"screen"})});return(0,ae.vJ)(Ge,[Ge,Boolean(L)]),(0,ae.vJ)(()=>{Ve&&(O.some(e=>e.type===Ve.type&&e.id===Ve.id)||Ye(void 0))},[Ve,De,O]),(0,Ee.FD)(ve.A,{isOpen:P,onClose:h,className:(0,ie.A)(Xe.root,(V||M)&&Xe.fullscreen,R&&Xe.appFullscreen,G&&Xe.landscape,!U&&Xe.noVideoParticipants,!G&&Xe.portrait,!D&&xe&&Xe.noSidebar),dialogRef:b,onCloseAnimationEnd:Te,children:[xe&&(0,Ee.FD)("div",{className:Xe.videos,children:[(0,Ee.FD)("div",{className:Xe.videosHeader,children:[!M&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",onClick:Ae,className:(0,ie.A)(Xe.headerButton,Xe.firstButton),ariaLabel:C(V?"AccExitFullscreen":"AccSwitchToFullscreen"),children:(0,Ee.Y)(me.A,{name:V?"smallscreen":"fullscreen"})}),(0,Ee.Y)("h3",{className:(0,ie.A)(Xe.title,Xe.bigger),children:o||C("VoipGroupVoiceChat")}),xe&&!D&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",className:(0,ie.A)(Xe.headerButton,Xe.videosHeaderLastButton),onClick:we,ariaLabel:C("AccDescrExpandPanel"),children:(0,Ee.Y)(me.A,{name:"sidebar"})})]}),(0,Ee.Y)("div",{className:Xe.videosContent,ref:y})]}),(0,Ee.FD)("div",{className:Xe.panelWrapper,ref:S,children:[(0,Ee.FD)("div",{className:(0,ie.A)(Xe.panel,"custom-scroll"),children:[(0,Ee.Y)("div",{className:Xe.panelScrollTrigger,ref:w}),(0,Ee.FD)("div",{className:(0,ie.A)(Xe.panelHeader,N&&Xe.scrolled),children:[!xe&&!M&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",ripple:!M,className:(0,ie.A)(Xe.firstButton,Xe.headerButton),onClick:Ae,ariaLabel:C("AccSwitchToFullscreen"),children:(0,Ee.Y)(me.A,{name:"fullscreen"})}),M&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",onClick:Se,className:(0,ie.A)(Xe.headerButton,Xe.firstButton),ariaLabel:C("Close"),children:(0,Ee.Y)(me.A,{name:"close"})}),xe&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",ripple:!M,className:(0,ie.A)(Xe.firstButton,Xe.headerButton),color:"translucent",onClick:we,ariaLabel:C("AccDescrCollapsePanel"),children:(0,Ee.Y)(me.A,{name:"sidebar"})}),(0,Ee.FD)("div",{className:Xe.panelHeaderText,children:[(0,Ee.Y)("h3",{className:(0,ie.A)(Xe.title,xe&&Xe.bigger),children:xe?$:_}),!xe&&(0,Ee.Y)("span",{className:Xe.subtitle,children:$})]}),!xe&&l&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",ripple:!M,className:(0,ie.A)(Xe.lastButton,Xe.headerButton),color:"translucent",onClick:ke,ariaLabel:C("VoipGroupInviteMember"),children:(0,Ee.Y)(me.A,{name:"add-user"})})]}),(0,Ee.FD)("div",{className:Xe.participants,children:[(0,Ee.Y)("div",{className:Xe.participantVideos,ref:A,style:`height: ${Fe}px;`,children:De.map(e=>{const t=c[e.participantId];return e.isRemounted&&t?(0,Ee.Y)(qe,{teactOrderKey:e.orderKey,layout:e,canPin:Me,setPinned:Be,pinnedVideo:Ve,participant:t},`${e.participantId}_${e.type}`):(0,Ee.Y)("div",{teactOrderKey:e.orderKey},`${e.participantId}_${e.type}`)})}),(0,Ee.Y)(Oe,{panelOffset:Fe,isLandscape:xe})]})]}),(0,Ee.Y)(fe.A,{isShown:xe&&l,onClick:ke,className:Xe.addParticipantButton,ariaLabel:C("VoipGroupInviteMember"),children:(0,Ee.Y)(me.A,{name:"add-user-filled"})},"add-participant")]}),(0,Ee.Y)("div",{className:Xe.mainVideoContainer,children:De.map(e=>{const t=c[e.participantId];return e.isRemounted||!t?(0,Ee.Y)("div",{teactOrderKey:e.orderKey},`${e.participantId}_${e.type}`):(0,Ee.Y)(qe,{teactOrderKey:e.orderKey,layout:e,canPin:Me,setPinned:Be,pinnedVideo:Ve,participant:t,className:Xe.video},`${e.participantId}_${e.type}`)})}),(0,Ee.FD)("div",{className:Xe.actions,children:[(0,Ee.Y)(he.A,{round:!0,size:"default",ripple:!0,className:(0,ie.A)(Xe.actionButton,!te&&Xe.muted,be&&Xe.canRequestToSpeak),onClick:Ie,ariaLabel:C(Q?"VoipStopVideo":"VoipStartVideo"),disabled:ne,children:(0,Ee.Y)(me.A,{name:Q?"video":"video-stop"})}),(0,Ee.Y)(he.A,{round:!0,size:"default",ripple:!0,className:(0,ie.A)(Xe.actionButton,!te&&Xe.muted,be&&Xe.canRequestToSpeak),onClick:Ne,ariaLabel:C(ee?"lng_group_call_screen_share_stop":"lng_group_call_tooltip_screen"),disabled:ne||!u,children:(0,Ee.Y)(me.A,{name:ee?"share-screen":"share-screen-stop"})}),(0,Ee.Y)(Qe,{className:Xe.actionButton}),(0,Ee.Y)(he.A,{round:!0,size:"default",ripple:!0,className:(0,ie.A)(Xe.actionButton,!te&&Xe.muted,be&&Xe.canRequestToSpeak),ariaLabel:C("lng_group_call_settings"),disabled:!0,children:(0,Ee.Y)(me.A,{name:"settings-filled"})}),(0,Ee.Y)(he.A,{round:!0,size:"default",ripple:!0,className:(0,ie.A)(Xe.actionButton,Xe.destructive),onClick:Pe,ariaLabel:C("lng_group_call_leave"),children:(0,Ee.Y)(me.A,{name:"close"})})]}),(0,Ee.FD)(ve.A,{isOpen:J,onClose:ye,className:"error",title:C(H?"VoipGroupEndAlertTitle":"VoipGroupLeaveAlertTitle"),children:[(0,Ee.Y)("p",{children:C(H?"VoipGroupEndAlertText":"VoipGroupLeaveAlertText")}),!H&&(0,Ee.Y)(ge.A,{className:"dialog-checkbox",label:C("VoipGroupEndChat"),checked:W,onCheck:Z}),(0,Ee.FD)("div",{className:"dialog-buttons",children:[(0,Ee.Y)(he.A,{isText:!0,className:"confirm-dialog-button",onClick:Pe,children:C(H?"VoipGroupEnd":"VoipGroupLeave")}),(0,Ee.Y)(he.A,{isText:!0,className:"confirm-dialog-button",onClick:ye,children:C("Cancel")})]})]})]})})),tt=(0,ae.ph)((0,K.EK)(e=>{const t=(0,W.nTw)(e);return{groupCall:t.isMasterTab?(0,Z.iT)(e):void 0,isCallPanelVisible:t.isCallPanelVisible,phoneCallUser:t.isMasterTab?(0,Z.uu)(e):void 0}})(e=>{let{groupCall:t,phoneCallUser:n,isCallPanelVisible:a}=e;const{toggleGroupCallPanel:i}=(0,K.ko)(),o=(0,le.A)();if((0,ae.vJ)(()=>(document.body.classList.toggle("has-call-header",Boolean(a)),window.tauri?.markTitleBarOverlay(!a),()=>{document.body.classList.toggle("has-call-header",!1),window.tauri?.markTitleBarOverlay(!0)}),[a]),t||n)return(0,Ee.Y)("div",{className:(0,ie.A)("ActiveCallHeader",a&&"open"),onClick:function(){i()},children:(0,Ee.Y)("span",{className:"title",children:n?.firstName||t?.title||o("VoipGroupVoiceChat")})})}));var nt=n(17663),at=n(30857);const it=(0,ae.ph)(e=>{let{onClick:t,label:n,customIcon:a,icon:i,iconClassName:o,className:s,isDisabled:r,isActive:c}=e;return(0,Ee.FD)("div",{className:"lBO3RZUM",children:[(0,Ee.Y)(he.A,{round:!0,className:(0,ie.A)(s,"ch2sqAKW",c&&"OQxlsRp7"),onClick:t,disabled:r,children:a||(0,Ee.Y)(me.A,{name:i,className:o})}),(0,Ee.Y)("div",{className:"aHguvLcL",children:n})]})}),ot={root:"GNYRVAUg",blurred:"RBmbMiou","single-column":"O7cZE08z",singleColumn:"O7cZE08z",header:"GI6dY5aJ","close-button":"ULiJZuaP",closeButton:"ULiJZuaP","emojis-backdrop":"RFBKZpjx",emojisBackdrop:"RFBKZpjx",open:"zi1NlOXX",emojis:"DFco1VIN","emoji-tooltip":"MRIShZ3V",emojiTooltip:"MRIShZ3V","user-info":"eaUe2A0c",userInfo:"eaUe2A0c",buttons:"qIeflO02",leave:"hclywYYk",accept:"ln_ZBUHy","accept-icon":"cVRd3twS",acceptIcon:"cVRd3twS","main-video":"bGlBFSJq",mainVideo:"bGlBFSJq","second-video":"TOFu1n5x",secondVideo:"TOFu1n5x",visible:"LOnSFN9w",fullscreen:"Omg5T1o6"},st=(0,ae.ph)((0,K.EK)(e=>{const{phoneCall:t,currentUserId:n}=e,{isCallPanelVisible:a,isMasterTab:i}=(0,W.nTw)(e),o=(0,Z.uu)(e);return{isCallPanelVisible:Boolean(a),user:o,isOutgoing:t?.adminId===n,phoneCall:i?t:void 0}})(e=>{let{user:t,isOutgoing:n,phoneCall:a,isCallPanelVisible:o}=e;const s=(0,le.A)(),{hangUp:r,requestMasterAndAcceptCall:c,playGroupCallSound:l,toggleGroupCallPanel:d,connectToActivePhoneCall:p}=(0,K.ko)(),m=(0,ae.li)(),[h,g,f]=(0,se.A)(),{isMobile:v}=(0,oe.Ay)(),C=(0,ae.hb)(()=>{h?f():g()},[f,h,g]),b=(0,ae.hb)(()=>{m.current&&(h?document.exitFullscreen().then(f):m.current.requestFullscreen().then(g))},[f,h,g]);(0,ae.vJ)(()=>{if(!i.SC)return;const e=m.current;return e?(e.addEventListener("fullscreenchange",C),()=>{e.removeEventListener("fullscreenchange",C)}):void 0},[C]);const y=(0,ae.hb)(()=>{d(),h&&f()},[f,h,d]),w="discarded"===a?.state,S="busy"===a?.reason,k="requested"===a?.state&&!n,I=("requested"===a?.state||"waiting"===a?.state)&&n,P="active"===a?.state,T=a?.isConnected,[N,M,x]=(0,se.A)(),V=(0,ae.hb)(()=>{M(),r()},[r,M]);(0,ae.vJ)(()=>{N?l({sound:"end"}):k?l({sound:"incoming"}):S?l({sound:"busy"}):w?l({sound:"end"}):I?l({sound:"ringing"}):T&&l({sound:"connect"})},[S,w,k,I,T,l,N]),(0,ae.vJ)(()=>{a?.id?x():p()},[p,a?.id,x]);const E=(0,at.A)();(0,je.A)(E,T?1e3:void 0);const Y=(0,ae.Kr)(()=>{const e=a?.state;return N?s("lng_call_status_hanging"):S?"busy":"requesting"===e?s("lng_call_status_requesting"):"requested"===e?s(n?"lng_call_status_ringing":"lng_call_status_incoming"):"waiting"===e?s("lng_call_status_waiting"):"active"===e&&T?void 0:s("lng_call_status_exchanging")},[S,T,N,n,s,a?.state]),D="active"===a?.videoState,R="active"===a?.screencastState,L=A?.streams,O=L?.ownAudio?.getTracks()[0].enabled,U=L?.ownPresentation?.getTracks()[0].enabled,_=L?.ownVideo?.getTracks()[0].enabled,[$,J,j]=(0,se.A)(),[z,H,q]=(0,se.A)(),W=(0,ae.hb)(()=>{U&&J(),_&&H(),setTimeout(async()=>{await G("presentation"),j(),q()},250)},[U,_,J,H,j,q]),Z=(0,ae.hb)(()=>{_&&H(),U&&J(),setTimeout(async()=>{await G("video"),j(),q()},250)},[U,_,J,H,j,q]),Q=(0,ae.hb)(()=>{G("audio")},[]),[X,ee,te]=(0,se.A)(),[ne,re,ce]=(0,se.A)(),de=(0,ae.hb)(()=>{re(),async function(){if(!A||!A.facingMode)return;const e=A.streams.ownVideo;if(!e)return;const t=e.getTracks()[0];if(!t)return;const n=A.connection.getSenders().find(e=>t.id===e.track?.id);if(n){A.facingMode="environment"===A.facingMode?"user":"environment";try{const e=await B("video",A.facingMode);await n.replaceTrack(e.getTracks()[0]),A.streams.ownVideo=e,F()}catch(e){}}}(),setTimeout(ce,250)},[re,ce]),ue=a?.startDate&&Number(new Date)/1e3-a.startDate;return(0,ae.vJ)(()=>{"discarded"===a?.state&&setTimeout(r,250)},[r,a?.reason,a?.state]),(0,Ee.FD)(ve.A,{isOpen:a&&"discarded"!==a?.state&&!o,onClose:y,className:(0,ie.A)(ot.root,v&&ot.singleColumn),dialogRef:m,children:[(0,Ee.Y)(Se.A,{peer:t,size:"jumbo",className:D||R?ot.blurred:""}),"active"===a?.screencastState&&L?.presentation&&(0,Ee.Y)("video",{className:ot.mainVideo,muted:!0,autoPlay:!0,playsInline:!0,srcObject:L.presentation}),"active"===a?.videoState&&L?.video&&(0,Ee.Y)("video",{className:ot.mainVideo,muted:!0,autoPlay:!0,playsInline:!0,srcObject:L.video}),(0,Ee.Y)("video",{className:(0,ie.A)(ot.secondVideo,!$&&U&&ot.visible,h&&ot.fullscreen),muted:!0,autoPlay:!0,playsInline:!0,srcObject:L?.ownPresentation}),(0,Ee.Y)("video",{className:(0,ie.A)(ot.secondVideo,!z&&_&&ot.visible,h&&ot.fullscreen),muted:!0,autoPlay:!0,playsInline:!0,srcObject:L?.ownVideo}),(0,Ee.FD)("div",{className:ot.header,children:[i.SC&&(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",onClick:b,ariaLabel:s(h?"AccExitFullscreen":"AccSwitchToFullscreen"),children:(0,Ee.Y)(me.A,{name:h?"smallscreen":"fullscreen"})}),(0,Ee.Y)(he.A,{round:!0,size:"smaller",color:"translucent",onClick:y,className:ot.closeButton,children:(0,Ee.Y)(me.A,{name:"close"})})]}),(0,Ee.FD)("div",{className:(0,ie.A)(ot.emojisBackdrop,X&&ot.open),onClick:X?te:ee,children:[(0,Ee.Y)("div",{className:(0,ie.A)(ot.emojis,X&&ot.open),children:a?.isConnected&&a?.emojis&&(0,ye.A)(a.emojis,["emoji"])}),(0,Ee.Y)("div",{className:(0,ie.A)(ot.emojiTooltip,X&&ot.open),children:s("CallEmojiKeyTooltip",t?.firstName).replace("%%","%")})]}),(0,Ee.FD)("div",{className:ot.userInfo,children:[(0,Ee.Y)("h1",{children:t?.firstName}),(0,Ee.Y)("span",{className:ot.status,children:Y||(0,nt.QO)(ue||0)})]}),(0,Ee.FD)("div",{className:ot.buttons,children:[(0,Ee.Y)(it,{onClick:Q,icon:"microphone",isDisabled:!P,isActive:O,label:s(O?"lng_call_mute_audio":"lng_call_unmute_audio")}),(0,Ee.Y)(it,{onClick:Z,icon:"video",isDisabled:!P,isActive:_,label:s(_?"lng_call_stop_video":"lng_call_start_video")}),_&&(i.Ni||i.pz)&&(0,Ee.Y)(it,{onClick:de,customIcon:(0,Ee.Y)(Ne.A,{tgsUrl:Pe.w.CameraFlip,playSegment:ne?[0,10]:[0,1],size:32}),isDisabled:!P,label:s("VoipFlip")}),u&&(0,Ee.Y)(it,{onClick:W,icon:"share-screen",isDisabled:!P,isActive:U,label:s("lng_call_screencast")}),k&&(0,Ee.Y)(it,{onClick:c,icon:"phone-discard",isDisabled:w,label:s("lng_call_accept"),className:ot.accept,iconClassName:ot.acceptIcon}),(0,Ee.Y)(it,{onClick:V,icon:"phone-discard",isDisabled:w,label:s(k?"lng_call_decline":"lng_call_end_call"),className:ot.leave})]})]})}));var rt=n(40664);const ct=(0,ae.ph)(e=>{let{isOpen:t}=e;const{closeCallRatingModal:n,setCallRating:a}=(0,K.ko)(),i=(0,ae.li)(),o=(0,le.A)(),[s,r]=(0,ae.J0)(),c=(0,ae.hb)(()=>{s?a({rating:s+1,comment:i.current?.value||""}):n()},[n,s,a]),l=(0,ae.hb)(()=>{n()},[n]);return(0,Ee.FD)(ve.A,{title:o("lng_call_rate_label"),className:"narrow",onClose:n,isOpen:t,children:[(0,Ee.Y)("div",{className:"P7EfDKJN",children:new Array(5).fill(void 0).map((e,t)=>{const n=void 0!==s&&s>=t;return(0,Ee.Y)(me.A,{name:n?"favorite-filled":"favorite",className:(0,ie.A)(n&&"_XX6q8YW","t8LJLFSN"),onClick:(a=t,()=>r(s===a?void 0:a))});var a})}),(0,Ee.Y)(rt.A,{ref:i,placeholder:o("lng_call_rate_comment"),className:(0,ie.A)("EvL0WaKD",4!==s&&void 0!==s&&"v5hn1XvT")}),(0,Ee.FD)("div",{className:"dialog-buttons mt-2",children:[(0,Ee.Y)(he.A,{className:"confirm-dialog-button",isText:!0,onClick:c,children:o("Send")}),(0,Ee.Y)(he.A,{className:"confirm-dialog-button",isText:!0,onClick:l,children:o("Cancel")})]})]})});(i.Yw||i.pz)&&document.addEventListener("click",a.cw,{once:!0})},90423:(e,t,n)=>{n.d(t,{Ay:()=>r,j9:()=>d,zk:()=>c});var a=n(84051),i=n(63495),o=n(96454);const s=l();function r(e,t,n){const[i,r]=(0,a.J0)(Boolean(s&&document[s]));return(0,a.Nf)(()=>{const a=e.current,i=()=>{const e=Boolean(s&&document[s]);r(e),e?n?.(!1):t?.(!1),a instanceof HTMLVideoElement&&(a.controls=e)},o=()=>{r(!0),n&&n(!0)},c=()=>{r(!1),t&&t(!1)};return document.addEventListener("fullscreenchange",i,!1),document.addEventListener("webkitfullscreenchange",i,!1),document.addEventListener("mozfullscreenchange",i,!1),a&&(a.addEventListener("webkitbeginfullscreen",o,!1),a.addEventListener("webkitendfullscreen",c,!1)),()=>{document.removeEventListener("fullscreenchange",i,!1),document.removeEventListener("webkitfullscreenchange",i,!1),document.removeEventListener("mozfullscreenchange",i,!1),a&&(a.removeEventListener("webkitbeginfullscreen",o,!1),a.removeEventListener("webkitendfullscreen",c,!1))}},[]),s||o.pz?[i,()=>{var t;e.current&&(s||o.pz)&&!i&&((t=e.current).requestFullscreen?t.requestFullscreen():t.webkitRequestFullscreen?t.webkitRequestFullscreen():t.webkitEnterFullscreen?t.webkitEnterFullscreen():t.mozRequestFullScreen&&t.mozRequestFullScreen(),r(!0))},()=>{e.current&&(document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.webkitExitFullscreen&&document.webkitExitFullscreen(),r(!1))}]:[!1]}const c=()=>{const[e,t]=(0,a.J0)(!1);return(0,a.vJ)(()=>{const e=()=>{t(d())};let n;return i.Vq&&(window.tauri?.getCurrentWindow().then(e=>{e.isFullscreen().then(t)}),(async()=>{const e=await(window.tauri?.getCurrentWindow());n=await e.onResized(()=>{e.isFullscreen().then(t)})})()),document.addEventListener("fullscreenchange",e,!1),document.addEventListener("webkitfullscreenchange",e,!1),document.addEventListener("mozfullscreenchange",e,!1),()=>{n?.(),document.removeEventListener("fullscreenchange",e,!1),document.removeEventListener("webkitfullscreenchange",e,!1),document.removeEventListener("mozfullscreenchange",e,!1)}},[]),e};function l(){return void 0!==document.fullscreenElement?"fullscreenElement":void 0!==document.mozFullScreenElement?"mozFullScreenElement":void 0!==document.webkitFullscreenElement?"webkitFullscreenElement":""}function d(){const e=l();return Boolean(e&&document[e])}}}]);
//# sourceMappingURL=2394.4ad3723acc675eb5913e.js.map