|
|
|
(self.webpackChunktelegram_t=self.webpackChunktelegram_t||[]).push([[954],{544:(e,t,a)=>{"use strict";a.r(t),a.d(t,{ActiveCallHeader:()=>J,GroupCall:()=>X,PhoneCall:()=>ae,RatePhoneCallModal:()=>oe});var n=a(3794),o=a(4050),i=a(3555),s=a(3716),l=a(1226),r=a(1192),c=a(2431),d=a(8958),u=a(8422),p=a(7225);(0,i.iw)("leaveGroupCall",(async(e,t,a)=>{const{isFromLibrary:o,shouldDiscard:s,shouldRemove:r,rejoin:p}=a||{},m=(0,c.mU)(e);m&&((0,i.R3)((0,d.Ic)(e,{connectionState:"disconnected"},m.participantsCount-1)),await(0,l.t9)("leaveGroupCall",{call:m}),s&&await(0,l.t9)("discardGroupCall",{call:m}),e=(0,i.Rd)(),r&&(e=(0,d.dc)(e,m.id)),(0,u.Mt)(),(0,i.R3)({...e,groupCalls:{...e.groupCalls,activeGroupCallId:void 0},isCallPanelVisible:void 0}),o||(0,n.leaveGroupCall)(),p&&t.joinGroupCall(p))})),(0,i.iw)("toggleGroupCallVideo",(async e=>{const t=(0,c.mU)(e),a=(0,r.dy)(e,e.currentUserId);a&&t&&(await(0,n.toggleStream)("video"),await(0,l.t9)("editGroupCallParticipant",{call:t,videoStopped:!(0,n.isStreamEnabled)("video"),participant:a}))})),(0,i.iw)("requestToSpeak",((e,t,a)=>{const{value:n}=a||{value:!0},o=(0,c.mU)(e),i=(0,r.dy)(e,e.currentUserId);i&&o&&(0,l.t9)("editGroupCallParticipant",{call:o,raiseHand:n,participant:i})})),(0,i.iw)("setGroupCallParticipantVolume",((e,t,a)=>{const{participantId:o,volume:i}=a,d=(0,c.mU)(e),u=(0,r.dy)(e,o);u&&d&&((0,n.setVolume)(o,Math.floor(i/s.Ro)/100),(0,l.t9)("editGroupCallParticipant",{call:d,volume:Number(i),participant:u}))})),(0,i.iw)("toggleGroupCallMute",(async(e,t,a)=>{const{participantId:o,value:i}=a||{},s=(0,c.mU)(e),d=(0,r.dy)(e,o||e.currentUserId);if(!d||!s)return;const u=void 0===i?(0,n.isStreamEnabled)("audio",d.id):i;o?(0,n.setVolume)(o,u?0:1):await(0,n.toggleStream)("audio"),await(0,l.t9)("editGroupCallParticipant",{call:s,muted:u,participant:d})})),(0,i.iw)("toggleGroupCallPresentation",(async(e,t,a)=>{const o=(0,c.mU)(e),i=(0,r.dy)(e,e.currentUserId);if(i&&o){if(void 0!==(null==a?void 0:a.value)?null==a?void 0:a.value:!(0,n.isStreamEnabled)("presentation")){const e=await(0,n.startSharingScreen)();if(!e)return;await(0,l.t9)("joinGroupCallPresentation",{call:o,params:e})}else await(0,n.toggleStream)("presentation",!1),await(0,l.t9)("leaveGroupCallPresentation",{call:o});await(0,l.t9)("editGroupCallParticipant",{call:o,presentationPaused:!(0,n.isStreamEnabled)("presentation"),participant:i})}})),(0,i.iw)("connectToActiveGroupCall",(async(e,t)=>{const a=(0,c.mU)(e);if(!a)return;if("discarded"===a.connectionState)return void t.showNotification({message:"This voice chat is not active"});const o=(0,u.FF)(),s=(0,u.NH)();if(!o||!s)return;const{currentUserId:d}=e;if(!d)return;const m=await(0,n.joinGroupCall)(d,s,o,t.apiUpdate);if(await(0,l.t9)("joinGroupCall",{call:a,params:m,inviteHash:a.inviteHash})&&(t.loadMoreGroupCallParticipants(),a.chatId)){const e=(0,r.Z1)((0,i.Rd)(),a.chatId);if(!e)return;await(0,p.ft)(e)}})),(0,i.iw)("connectToActivePhoneCall",(async e=>{const{phoneCall:t}=e;if(!t)return;const a=(0,c.fu)(e);if(!a)return;const n=await(0,l.t9)("getDhConfig");if(!n)return;await(0,l.t9)("createPhoneCallState",[!0]);const o=await(0,l.t9)("requestPhoneCall",[n]);await(0,l.t9)("requestCall",{user:a,gAHash:o,isVideo:t.isVideo})})),(0,i.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]);(0,l.t9)("acceptCall",{call:t,gB:n})})),(0,i.iw)("sendSignalingData",((e,t,a)=>{const{phoneCall:n}=e;if(!n)return;const o=JSON.stringify(a);(async()=>{const e=await(0,l.t9)("encodePhoneCallData",[o]);e&&(0,l.t9)("sendSignalingData",{data:e,call:n})})()})),(0,i.iw)("closeCallRatingModal",(e=>({...e,ratingPhoneCall:void 0}))),(0,i.iw)("setCallRating",((e,t,a)=>{const{ratingPhoneCall:n}=e;if(!n)return;const{rating:o,comment:i}=a;return(0,l.t9)("setCallRating",{call:n,rating:o,comment:i}),{...e,ratingPhoneCall:void 0}})),(0,i.iw)("hangUp",(e=>{const{phoneCall:t}=e;if(t)return"discarded"===t.state?((0,l.t9)("destroyPhoneCallState"),(0,n.stopPhoneCall)(),{...e,phone
|