File manager - Edit - /home/web/vm-3fadc827.na4u.ru/www/bitrix/modules/im/install/js/im/call/view.min.js
Back
(function(){BX.namespace("BX.Call");if(BX.Call.View){return}var e={Grid:1,Centered:2,Mobile:3};var t={Preparing:1,Initializing:2,Calling:3,Connected:4,Error:5};var s={onShow:"onShow",onClose:"onClose",onDestroy:"onDestroy",onButtonClick:"onButtonClick",onBodyClick:"onBodyClick",onReplaceCamera:"onReplaceCamera",onReplaceMicrophone:"onReplaceMicrophone",onReplaceSpeaker:"onReplaceSpeaker",onSetCentralUser:"onSetCentralUser",onLayoutChange:"onLayoutChange",onChangeHdVideo:"onChangeHdVideo",onChangeMicAutoParams:"onChangeMicAutoParams",onChangeFaceImprove:"onChangeFaceImprove",onUserClick:"onUserClick",onUserRename:"onUserRename",onUserPinned:"onUserPinned"};var i=999;var n=1e3;var o=1001;var r=5;var a=250;var l=160;var c=90;var h=15;var u=249;var d=140;BX.Call.View=function(s){this.title=s.title;this.container=s.container;this.cameraId=s.cameraId;this.microphoneId=s.microphoneId;this.speakerId="";this.speakerMuted=false;this.showChatButtons=s.showChatButtons===true;this.showUsersButton=s.showUsersButton===true;this.showShareButton=s.showShareButton!==false;this.showRecordButton=s.showRecordButton!==false;this.showDocumentButton=s.showDocumentButton!==false;this.showButtonPanel=s.showButtonPanel!==false;this.broadcastingMode=BX.prop.getBoolean(s,"broadcastingMode",false);this.broadcastingPresenters=BX.prop.getArray(s,"broadcastingPresenters",[]);this.currentPage=1;this.pagesCount=1;this.usersPerPage=0;this.language=s.language||"";this.lastPosition=1;this.userData={};if(s.userData){this.updateUserData(s.userData)}this.userLimit=s.userLimit||1;this.userId=BX.message("USER_ID");this.isIntranetOrExtranet=BX.prop.getBoolean(s,"isIntranetOrExtranet",true);this.users={};this.screenUsers={};this.userRegistry=new R;var i=new V({id:this.userId,state:BX.prop.getString(s,"localUserState",BX.Call.UserState.Connected),localUser:true,order:n,name:this.userData[this.userId]?this.userData[this.userId].name:"",avatar:this.userData[this.userId]?this.userData[this.userId].avatar_hr:""});this.userRegistry.push(i);this.localUser=new p({parentContainer:this.container,userModel:i,allowBackgroundItem:BX.Call.Hardware.BackgroundDialog.isAvailable()&&this.isIntranetOrExtranet,onUserRename:this._onUserRename.bind(this),onUserRenameInputFocus:this._onUserRenameInputFocus.bind(this),onUserRenameInputBlur:this._onUserRenameInputBlur.bind(this)});this.centralUser=this.localUser;this.centralUserMobile=null;this.pinnedUser=null;this.presenterId=null;this.returnToGridAfterScreenStopped=false;this.mediaSelectionBlocked=s.mediaSelectionBlocked===true;this.visible=false;this.elements={root:null,wrap:null,watermark:null,container:null,overlay:null,topPanel:null,bottom:null,notificationPanel:null,panel:null,audioContainer:null,audio:{},center:null,localUserMobile:null,userBlock:null,ear:{left:null,right:null},userList:{container:null,addButton:null},userSelectorContainer:null,pinnedUserContainer:null,renameSlider:{input:null,button:null},pageNavigatorLeft:null,pageNavigatorLeftCounter:null,pageNavigatorRight:null,pageNavigatorRightCounter:null};this.buttons={title:null,grid:null,add:null,share:null,record:null,document:null,microphone:null,camera:null,speaker:null,screen:null,mobileMenu:null,chat:null,users:null,history:null,hangup:null,fullscreen:null,overlay:null,status:null,returnToCall:null,recordStatus:null,participants:null,participantsMobile:null,watermark:null,hd:null,protected:null,more:null};this.size=BX.Call.View.Size.Full;this.maxWidth=null;this.isMuted=false;this.isCameraOn=false;this.isFullScreen=false;this.isUserBlockFolded=false;this.recordState=this.getDefaultRecordState();this.blockedButtons={};var o=BX.prop.getArray(s,"blockedButtons",[]);o.forEach((function(e){this.blockedButtons[e]=true}),this);this.hiddenButtons={};this.overflownButtons={};if(!this.showUsersButton){this.hiddenButtons["users"]=true}var r=BX.prop.getArray(s,"hiddenButtons",[]);r.forEach((function(e){this.hiddenButtons[e]=true}),this);this.hiddenTopButtons={};var a=BX.prop.getArray(s,"hiddenTopButtons",[]);a.forEach((function(e){this.hiddenTopButtons[e]=true}),this);this.uiState=s.uiState||t.Calling;this.layout=s.layout||e.Centered;this.eventEmitter=new BX.Event.EventEmitter(this,"BX.Call.View");this.scrollInterval=0;this._onFullScreenChangeHandler=this._onFullScreenChange.bind(this);this._onResizeHandler=this._onResize.bind(this);this._onOrientationChangeHandler=BX.debounce(this._onOrientationChange.bind(this),500);this._onKeyDownHandler=this._onKeyDown.bind(this);this._onKeyUpHandler=this._onKeyUp.bind(this);this.resizeObserver=new BX.ResizeObserver(this._onResizeHandler);this.intersectionObserver=null;this.switchPresenterTimeout=0;this.deviceSelector=null;this.userSelector=null;this.pinnedUserContainer=null;this.callMenu=null;this.userMenu=null;this.participantsMenu=null;this.renameSlider=null;this.userSize={width:0,height:0};this.hintManager=BX.UI.Hint.createInstance({popupParameters:{targetContainer:document.body,className:"bx-messenger-videocall-panel-item-hotkey-hint",bindOptions:{forceBindPosition:true}}});this.hotKey={all:BX.Call.Util.isDesktop(),microphone:true,microphoneSpace:true,camera:true,screen:true,record:true,speaker:true,chat:true,users:true,floorRequest:true,muteSpeaker:true,grid:true};this.hotKeyTemporaryBlock=0;this.init();this.subscribeEvents(s);if(BX.type.isPlainObject(s.userStates)){this.appendUsers(s.userStates)}};BX.Call.View.prototype.init=function(){if(this.isFullScreenSupported()){if(BX.browser.IsChrome()||BX.browser.IsSafari()){window.addEventListener("fullscreenchange",this._onFullScreenChangeHandler);window.addEventListener("webkitfullscreenchange",this._onFullScreenChangeHandler)}else if(BX.browser.IsFirefox()){window.addEventListener("mozfullscreenchange",this._onFullScreenChangeHandler)}}if(BX.browser.IsMobile()){document.documentElement.style.setProperty("--view-height",window.innerHeight+"px");window.addEventListener("orientationchange",this._onOrientationChangeHandler)}this.elements.audioContainer=BX.create("div",{props:{className:"bx-messenger-videocall-audio-container"}});if(BX.Call.Hardware.initialized){this.setSpeakerId(BX.Call.Hardware.defaultSpeaker)}else{BX.Call.Hardware.subscribe(BX.Call.Hardware.Events.initialized,function(){this.setSpeakerId(BX.Call.Hardware.defaultSpeaker)}.bind(this))}window.addEventListener("keydown",this._onKeyDownHandler);window.addEventListener("keyup",this._onKeyUpHandler);if(BX.browser.IsMac()){this.keyModifier="⌘ + Shift"}else{this.keyModifier="Ctrl + Shift"}this.container.appendChild(this.elements.audioContainer)};BX.Call.View.prototype.subscribeEvents=function(e){for(var t in s){if(s.hasOwnProperty(t)&&BX.type.isFunction(e[t])){this.setCallback(t,e[t])}}};BX.Call.View.prototype.setCallback=function(e,t){if(BX.type.isFunction(t)&&s.hasOwnProperty(e)){this.eventEmitter.subscribe(e,(function(e){t(e.data)}))}};BX.Call.View.prototype.subscribe=function(e,t){return this.eventEmitter.subscribe(e,t)};BX.Call.View.prototype.unsubscribe=function(e,t){return this.eventEmitter.unsubscribe(e,t)};BX.Call.View.prototype.getNextPosition=function(){return this.lastPosition++};BX.Call.View.prototype.appendUsers=function(e){if(!BX.type.isPlainObject(e)){return}var t=Object.keys(e);for(var s=0;s<t.length;s++){var i=t[s];this.addUser(i,e[i]?e[i]:BX.Call.UserState.Idle)}};BX.Call.View.prototype.setCentralUser=function(t){if(this.centralUser.id==t){return}if(t==this.userId&&this.getUsersWithVideo().length>0){return}if(!this.users[t]&&t!=this.userId){return}var i=this.centralUser;this.centralUser=t==this.userId?this.localUser:this.users[t];if(this.layout==e.Centered||this.layout==e.Mobile){i.dismount();this.updateUserList()}if(this.layout==e.Mobile){if(this.centralUserMobile){this.centralUserMobile.setUserModel(this.userRegistry.get(t))}else{this.centralUserMobile=new m({userModel:this.userRegistry.get(t),onClick:function(){this.showUserMenu(this.centralUser.id)}.bind(this)});this.centralUserMobile.mount(this.elements.pinnedUserContainer)}}this.userRegistry.users.forEach((function(e){e.centralUser=e.id==t}));this.eventEmitter.emit(s.onSetCentralUser,{userId:t,stream:t==this.userId?this.localUser.stream:this.users[t].stream})};BX.Call.View.prototype.getLeftUser=function(e){var t=null;for(var s=0;s<this.userRegistry.users.length;s++){var i=this.userRegistry.users[s];if(i.id==e&&t){return t}if(!i.localUser&&i.state==BX.Call.UserState.Connected){t=i.id}}return t};BX.Call.View.prototype.getRightUser=function(e){var t=null;for(var s=this.userRegistry.users.length-1;s>=0;s--){var i=this.userRegistry.users[s];if(i.id==e&&t){return t}if(!i.localUser&&i.state==BX.Call.UserState.Connected){t=i.id}}return t};BX.Call.View.prototype.getUserCount=function(){return Object.keys(this.users).length};BX.Call.View.prototype.getConnectedUserCount=function(e){var t=this.getConnectedUsers().length;if(e){var s=parseInt(this.userId,10);if(!this.broadcastingMode||this.broadcastingPresenters.includes(s)){t+=1}}return t};BX.Call.View.prototype.getUsersWithVideo=function(){var e=[];for(var t in this.users){if(this.users[t].hasVideo()){e.push(t)}}return e};BX.Call.View.prototype.getConnectedUsers=function(){var e=[];for(var t=0;t<this.userRegistry.users.length;t++){var s=this.userRegistry.users[t];if(s.id!=this.userId&&s.state==BX.Call.UserState.Connected){e.push(s.id)}}return e};BX.Call.View.prototype.getDisplayedUsers=function(){var e=[];for(var t=0;t<this.userRegistry.users.length;t++){var s=this.userRegistry.users[t];if(s.id!=this.userId&&(s.state==BX.Call.UserState.Connected||s.state==BX.Call.UserState.Connecting)){e.push(s.id)}}return e};BX.Call.View.prototype.hasUserWithScreenSharing=function(){return this.userRegistry.users.some((function(e){return e.screenState}))};BX.Call.View.prototype.getPresenterUserId=function(){var e=this.presenterId||0;if(e==this.localUser.id){e=0}var t;var s=this.userRegistry.get(e);if(s&&s.screenState===true){return e}for(t in this.users){if(this.users.hasOwnProperty(t)&&this.userRegistry.get(t).screenState===true){return parseInt(t,10)}}if(s&&s.wasTalkingAgo()<1e3){return e}var i=0;var n=0;for(t in this.users){if(!this.users.hasOwnProperty(t)){continue}var o=this.userRegistry.get(t).wasTalkingAgo();if(o<1e3){return parseInt(t,10)}if(o<i){n=parseInt(t,10)}}if(n){return n}return this.centralUser.id};BX.Call.View.prototype.switchPresenter=function(){var t=this.getPresenterUserId();if(!t){return}this.presenterId=t;this.userRegistry.users.forEach((function(e){e.presenter=e.id==this.presenterId}),this);if(this.pinnedUser===null){this.setCentralUser(t)}if(this.layout==e.Grid){var s=this.findUsersPage(this.presenterId);if(s){this.setCurrentPage(s)}}};BX.Call.View.prototype.switchPresenterDeferred=function(){clearTimeout(this.switchPresenterTimeout);this.switchPresenterTimeout=setTimeout(this.switchPresenter.bind(this),1e3)};BX.Call.View.prototype.cancelSwitchPresenter=function(){clearTimeout(this.switchPresenterTimeout)};BX.Call.View.prototype.setUiState=function(e){if(this.uiState==e){return}this.uiState=e;if(this.uiState==t.Error&&this.elements.container){BX.cleanNode(this.elements.container);this.elements.container.appendChild(this.elements.overlay)}if(!this.elements.root){return}this.updateButtons();if(this.uiState==t.Preparing){this.elements.wrap.classList.add("with-clouds")}else{this.elements.wrap.classList.remove("with-clouds")}};BX.Call.View.prototype.setLayout=function(t){if(t==this.layout){return}this.layout=t;if(this.layout==e.Centered||this.layout==e.Mobile){this.elements.root.classList.remove("bx-messenger-videocall-grid");this.elements.root.classList.add("bx-messenger-videocall-centered");this.centralUser.mount(this.elements.center);this.elements.container.appendChild(this.elements.userBlock);if(this.layout!=e.Mobile){this.elements.userBlock.appendChild(this.elements.userList.container)}this.centralUser.playVideo()}if(this.layout==e.Grid){this.elements.root.classList.remove("bx-messenger-videocall-centered");this.elements.root.classList.add("bx-messenger-videocall-grid");this.elements.container.appendChild(this.elements.userList.container);this.elements.container.removeChild(this.elements.userBlock);if(this.isFullScreen&&this.buttons.participants){this.buttons.participants.update({foldButtonState:S.FoldButtonState.Hidden})}this.unpinUser()}if(this.layout==e.Centered&&this.isFullScreen){this.setUserBlockFolded(true)}if(this.layout==e.Mobile){this.elements.root.classList.add("bx-messenger-videocall-fullscreen-mobile")}else{this.elements.root.classList.remove("bx-messenger-videocall-fullscreen-mobile")}this.renderUserList();this.toggleEars();this.updateButtons();this.eventEmitter.emit(s.onLayoutChange,{layout:this.layout})};BX.Call.View.prototype.setCurrentPage=function(t){if(t<1||t>this.pagesCount||t==this.currentPage){return}this.currentPage=t;if(this.elements.root){this.elements.pageNavigatorLeftCounter.innerHTML=this.currentPage-1+" / "+this.pagesCount;this.elements.pageNavigatorRightCounter.innerHTML=this.currentPage+1+" / "+this.pagesCount}if(this.layout!==e.Grid){return}this.renderUserList();this.toggleEars()};BX.Call.View.prototype.calculateUsersPerPage=function(){if(!this.elements.userList){return 1e3}var e=this.elements.userList.container.getBoundingClientRect();var t=Math.floor(e.width/u)||1;var s=Math.floor(e.height/d)||1;var i=t*s-1;if(!i){return 1e3}if(i<=h){return i}else{var n=BX.Call.Util.findBestElementSize(e.width,e.height,h+1,u,d);t=Math.floor(e.width/n.width);s=Math.floor(e.height/n.height);return t*s-1}};BX.Call.View.prototype.calculatePagesCount=function(e){var t=Math.ceil(this.getDisplayedUsers().length/e);return t>0?t:1};BX.Call.View.prototype.recalculatePages=function(){this.usersPerPage=this.calculateUsersPerPage();this.pagesCount=this.calculatePagesCount(this.usersPerPage);if(this.elements.root){this.elements.pageNavigatorLeftCounter.innerHTML=this.currentPage-1+" / "+this.pagesCount;this.elements.pageNavigatorRightCounter.innerHTML=this.currentPage+1+" / "+this.pagesCount}};BX.Call.View.prototype.findUsersPage=function(e){if(e==this.userId||this.usersPerPage===0){return 0}var t=this.getDisplayedUsers();var s=0;for(var i=0;i<t.length;i++){if(t[i]==e){s=i+1;break}}return s?Math.ceil(s/this.usersPerPage):0};BX.Call.View.prototype.setCameraId=function(e){if(this.cameraId==e){return}if(this.localUser.stream&&this.localUser.stream.getVideoTracks().length>0){throw new Error("Can not set camera id while having active stream")}this.cameraId=e};BX.Call.View.prototype.setMicrophoneId=function(e){if(this.microphoneId==e){return}if(this.localUser.stream&&this.localUser.stream.getAudioTracks().length>0){throw new Error("Can not set microphone id while having active stream")}this.microphoneId=e};BX.Call.View.prototype.setMicrophoneLevel=function(e){this.microphoneLevel=e;if(this.buttons.microphone){this.buttons.microphone.setLevel(e)}};BX.Call.View.prototype.setCameraState=function(e){e=!!e;if(this.isCameraOn==e){return}this.isCameraOn=e;if(this.buttons.camera){if(this.isCameraOn){this.buttons.camera.enable()}else{this.buttons.camera.disable()}}};BX.Call.View.prototype.setMuted=function(e){e=!!e;if(this.isMuted==e){return}this.isMuted=e;if(this.buttons.microphone){if(this.isMuted){this.buttons.microphone.disable()}else{this.buttons.microphone.enable()}}this.userRegistry.get(this.userId).microphoneState=!e};BX.Call.View.prototype.setLocalUserId=function(e){if(e==this.userId){return}this.userId=parseInt(e);this.localUser.userModel.id=this.userId;this.localUser.userModel.name=this.userData[this.userId]?this.userData[this.userId].name:"";this.localUser.userModel.avatar=this.userData[this.userId]?this.userData[this.userId].avatar_hr:""};BX.Call.View.prototype.setUserBlockFolded=function(t){this.isUserBlockFolded=t;if(this.isUserBlockFolded){if(this.elements.userBlock){this.elements.userBlock.classList.add("folded")}if(this.elements.root){this.elements.root.classList.add("bx-messenger-videocall-userblock-folded")}if(this.buttons.participants&&this.layout==e.Centered){this.buttons.participants.update({foldButtonState:S.FoldButtonState.Unfold})}}else{if(this.elements.userBlock){this.elements.userBlock.classList.remove("folded")}if(this.elements.root){this.elements.root.classList.remove("bx-messenger-videocall-userblock-folded")}if(this.buttons.participants){this.buttons.participants.update({foldButtonState:this.isFullScreen&&this.layout==e.Centered?S.FoldButtonState.Fold:S.FoldButtonState.Hidden})}}};BX.Call.View.prototype.addUser=function(e,t,s){e=parseInt(e,10);if(this.users[e]){return}t=t||BX.Call.UserState.Idle;if(!s){if(this.broadcastingPresenters.length>0&&!this.broadcastingPresenters.includes(e)){s=BX.Call.EndpointDirection.RecvOnly}else{s=BX.Call.EndpointDirection.SendRecv}}var n=new V({id:e,name:this.userData[e]?this.userData[e].name:"",avatar:this.userData[e]?this.userData[e].avatar_hr:"",state:t,order:t==BX.Call.UserState.Connected?this.getNextPosition():i,direction:s});this.userRegistry.push(n);if(!this.elements.audio[e]){this.elements.audio[e]=BX.create("audio");this.elements.audioContainer.appendChild(this.elements.audio[e])}this.users[e]=new p({parentContainer:this.container,userModel:n,audioElement:this.elements.audio[e],allowPinButton:this.getConnectedUserCount()>1,onClick:this._onUserClick.bind(this),onPin:this._onUserPin.bind(this),onUnPin:this._onUserUnPin.bind(this)});this.screenUsers[e]=new p({parentContainer:this.container,userModel:n,allowPinButton:false,screenSharingUser:true});if(this.elements.root){this.updateUserList();this.updateButtons();this.updateUserButtons()}};BX.Call.View.prototype.setUserDirection=function(e,t){var s=this.userRegistry.get(e);if(!s||s.direction==t){return}s.direction=t;this.updateUserList()};BX.Call.View.prototype.setLocalUserDirection=function(e){if(this.localUser.userModel.direction!=e){this.localUser.userModel.direction=e;this.updateUserList()}};BX.Call.View.prototype.setUserState=function(e,s){var n=this.userRegistry.get(e);if(!n){return}if(s===BX.Call.UserState.Connected&&this.uiState===t.Calling){this.setUiState(t.Connected)}n.state=s;if(this.centralUser.id==this.userId&&s==BX.Call.UserState.Connected){this.setCentralUser(e)}else if(e==this.centralUser.id){if(s==BX.Call.UserState.Connecting||s==BX.Call.UserState.Failed){this.centralUser.blurVideo()}else if(s==BX.Call.UserState.Connected){this.centralUser.blurVideo(false)}else if(s==BX.Call.UserState.Idle){var o=this.getUsersWithVideo();var r=this.getConnectedUsers();if(r.length===0){this.setCentralUser(this.userId)}else if(o.length>0){this.setCentralUser(o[0])}else{this.setCentralUser(r[0])}}}if(s==BX.Call.UserState.Connected&&n.order==i){n.order=this.getNextPosition()}if(e==this.localUser.id){this.setCameraState(this.localUser.hasVideo());this.localUser.userModel.cameraState=this.localUser.hasVideo()}this.updateUserList();this.updateButtons();this.updateUserButtons()};BX.Call.View.prototype.setTitle=function(e){this.title=e};BX.Call.View.prototype.getUserTalking=function(e){var t=this.userRegistry.get(e);if(!t){return false}return!!t.talking};BX.Call.View.prototype.setUserTalking=function(e,t){var s=this.userRegistry.get(e);if(s){s.talking=t}if(e==this.userId){return}if(e==this.presenterId&&!t){this.switchPresenterDeferred()}else{this.switchPresenter()}};BX.Call.View.prototype.setUserMicrophoneState=function(e,t){var s=this.userRegistry.get(e);if(s){s.microphoneState=t}};BX.Call.View.prototype.setUserCameraState=function(e,t){var s=this.userRegistry.get(e);if(s){s.cameraState=t}};BX.Call.View.prototype.setUserVideoPaused=function(e,t){var s=this.userRegistry.get(e);if(s){s.videoPaused=t}};BX.Call.View.prototype.getUserFloorRequestState=function(e){var t=this.userRegistry.get(e);if(!t){return false}return!!t.floorRequestState};BX.Call.View.prototype.setUserFloorRequestState=function(e,t){var s=this.userRegistry.get(e);if(!s){return}if(s.floorRequestState!=t){s.floorRequestState=t;if(e!=this.localUser.id&&t){this.showFloorRequestNotification(e)}}if(e==this.userId){this.setButtonActive("floorRequest",t)}};BX.Call.View.prototype.pinUser=function(e){if(!(e in this.users)){console.error("User "+e+" is not known");return}this.pinnedUser=this.users[e];this.userRegistry.users.forEach((function(t){t.pinned=t.id==e}));this.setCentralUser(e);this.eventEmitter.emit(s.onUserPinned,{userId:e})};BX.Call.View.prototype.unpinUser=function(){this.pinnedUser=null;this.userRegistry.users.forEach((function(e){e.pinned=false}));this.eventEmitter.emit(s.onUserPinned,{userId:null});this.switchPresenterDeferred()};BX.Call.View.prototype.showFloorRequestNotification=function(e){if(!this.userData[e]){return}var t=this.userRegistry.get(e);if(!t){return}var s=N.create({userModel:t});s.mount(this.elements.notificationPanel);L.Instance.addNotification(s)};BX.Call.View.prototype.setUserScreenState=function(e,t){var s=this.userRegistry.get(e);if(!s){return}s.screenState=t;if(e!=this.userId){if(t===true&&this.layout===BX.Call.View.Layout.Grid){this.setLayout(BX.Call.View.Layout.Centered);this.returnToGridAfterScreenStopped=true}if(t===false&&this.layout===BX.Call.View.Layout.Centered&&!this.hasUserWithScreenSharing()&&!this.pinnedUser&&this.returnToGridAfterScreenStopped){this.returnToGridAfterScreenStopped=false;this.setLayout(BX.Call.View.Layout.Grid)}this.switchPresenter()}};BX.Call.View.prototype.flipLocalVideo=function(e){this.localUser.flipVideo=!!e};BX.Call.View.prototype.setLocalStream=function(t,s){this.localUser.videoTrack=t.getVideoTracks().length>0?t.getVideoTracks()[0]:null;if(!BX.type.isUndefined(s)){this.flipLocalVideo(s)}this.setCameraState(this.localUser.hasVideo());this.localUser.userModel.cameraState=this.localUser.hasVideo();var i=t.getVideoTracks();if(i.length>0){var n=i[0].getSettings();this.cameraId=n.deviceId||""}else{this.cameraId=""}var o=t.getAudioTracks();if(o.length>0){var r=o[0].getSettings();this.microphoneId=r.deviceId||""}if(this.layout!==e.Grid&&this.centralUser.id==this.userId){if(this.localUser.hasVideo()||Object.keys(this.users).length===0){this.centralUser.stream=t}else{this.setCentralUser(Object.keys(this.users)[0])}}else{this.updateUserList()}};BX.Call.View.prototype.setSpeakerId=function(e){if(this.speakerId==e){return}if(!("setSinkId"in HTMLMediaElement.prototype)){console.error("Speaker selection is not supported")}this.speakerId=e;for(var t in this.elements.audio){this.elements.audio[t].setSinkId(this.speakerId)}};BX.Call.View.prototype.muteSpeaker=function(e){this.speakerMuted=!!e;for(var t in this.elements.audio){this.elements.audio[t].volume=this.speakerMuted?0:1}if(!this.buttons.speaker){return}if(this.speakerMuted){this.buttons.speaker.disable();this.buttons.speaker.hideArrow()}else{this.buttons.speaker.enable();if(BX.Call.Hardware.canSelectSpeaker()){this.buttons.speaker.showArrow()}}};BX.Call.View.prototype.setStream=function(e,t){console.error("BX.Call.View.prototype.setStream is deprecated");return;if(!this.users[e]){throw Error("User "+e+" is not a part of this call")}if(!(t instanceof MediaStream)){throw Error("mediaStream should be instance of MediaStream")}if(t.getAudioTracks().length>0&&t!=this.elements.audio[e].srcObject){if(this.speakerId&&this.elements.audio[e].setSinkId){this.elements.audio[e].setSinkId(this.speakerId).then(function(){this.elements.audio[e].srcObject=t;this.elements.audio[e].play().catch(T)}.bind(this)).catch(console.error)}else{this.elements.audio[e].srcObject=t;this.elements.audio[e].play().catch(T)}}this.users[e].stream=t.getVideoTracks().length>0?t:null};BX.Call.View.prototype.setVideoRenderer=function(e,t){if(!this.users[e]){throw Error("User "+e+" is not a part of this call")}if(t===null){this.users[e].videoRenderer=null;return}if(!("render"in t)||!BX.type.isFunction(t.render)){throw Error("mediaRenderer should have method render")}if(!("kind"in t)||t.kind!=="video"&&t.kind!=="sharing"){throw Error("mediaRenderer should be of video kind")}this.users[e].videoRenderer=t};BX.Call.View.prototype.setUserMedia=function(e,t,s){if(t==="audio"){this.users[e].audioTrack=s}if(t==="video"){this.users[e].videoTrack=s}if(t==="screen"){this.screenUsers[e].videoTrack=s;this.updateUserList();this.setUserScreenState(e,s!==null)}};BX.Call.View.prototype.applyIncomingVideoConstraints=function(){var e;var t;if(this.layout===BX.Call.View.Layout.Grid){for(e in this.users){t=this.users[e];t.setIncomingVideoConstraints(this.userSize.width,this.userSize.height)}}else if(this.layout===BX.Call.View.Layout.Centered){for(e in this.users){t=this.users[e];if(e==this.centralUser.id){var s=this.elements.center.getBoundingClientRect();t.setIncomingVideoConstraints(Math.floor(s.width),Math.floor(s.height))}else{t.setIncomingVideoConstraints(l,c)}}}};BX.Call.View.prototype.getDefaultRecordState=function(){return{state:BX.Call.View.RecordState.Stopped,userId:0,date:{start:null,pause:[]}}};BX.Call.View.prototype.setRecordState=function(e){this.recordState=e;if(this.buttons.recordStatus){this.buttons.recordStatus.update(this.recordState)}if(this.recordState.userId!=this.userId){if(this.recordState.state===BX.Call.View.RecordState.Stopped){this.unblockButtons(["record"])}else{this.blockButtons(["record"])}}if(this.elements.topPanel){if(this.recordState.state===BX.Call.View.RecordState.Stopped){delete this.elements.topPanel.dataset.recordState}else{this.elements.topPanel.dataset.recordState=e.state}}};BX.Call.View.prototype.show=function(){if(!this.elements.root){this.render()}this.container.appendChild(this.elements.root);if(this.layout!==e.Mobile){this.startIntersectionObserver()}this.updateButtons();this.updateUserList();this.resumeVideo();this.toggleEars();this.visible=true;this.eventEmitter.emit(s.onShow)};BX.Call.View.prototype.hide=function(){if(this.overflownButtonsPopup){this.overflownButtonsPopup.close()}BX.remove(this.elements.root);this.visible=false};BX.Call.View.prototype.startIntersectionObserver=function(){if(!("IntersectionObserver"in window)){return}this.intersectionObserver=new IntersectionObserver(this._onIntersectionChange.bind(this),{root:this.elements.userList.container,threshold:.5})};BX.Call.View.prototype.observeIntersections=function(e){if(this.intersectionObserver&&e.elements.root){this.intersectionObserver.observe(e.elements.root)}};BX.Call.View.prototype.unobserveIntersections=function(e){if(this.intersectionObserver&&e.elements.root){this.intersectionObserver.unobserve(e.elements.root)}};BX.Call.View.prototype.showDeviceSelector=function(e){if(this.deviceSelector){return}this.deviceSelector=new U({viewElement:this.container,parentElement:e,microphoneEnabled:!this.isMuted,microphoneId:this.microphoneId||BX.Call.Hardware.defaultMicrophone,cameraEnabled:this.isCameraOn,cameraId:this.cameraId,speakerEnabled:!this.speakerMuted,speakerId:this.speakerId,allowHdVideo:BX.Call.Hardware.preferHdQuality,faceImproveEnabled:BX.Call.Util.isDesktop()&&typeof BX.desktop!=="undefined"&&BX.desktop.cameraSmoothingStatus(),allowFaceImprove:BX.Call.Util.isDesktop()&&typeof BX.desktop!=="undefined"&&BX.desktop.enableInVersion(64),allowBackground:BX.Call.Hardware.BackgroundDialog.isAvailable()&&this.isIntranetOrExtranet,allowAdvancedSettings:typeof BXIM!=="undefined"&&this.isIntranetOrExtranet,showCameraBlock:!this.isButtonBlocked("camera"),events:{onMicrophoneSelect:this._onMicrophoneSelected.bind(this),onMicrophoneSwitch:this._onMicrophoneButtonClick.bind(this),onCameraSelect:this._onCameraSelected.bind(this),onCameraSwitch:this._onCameraButtonClick.bind(this),onSpeakerSelect:this._onSpeakerSelected.bind(this),onSpeakerSwitch:this._onSpeakerButtonClick.bind(this),onChangeHdVideo:this._onChangeHdVideo.bind(this),onChangeMicAutoParams:this._onChangeMicAutoParams.bind(this),onChangeFaceImprove:this._onChangeFaceImprove.bind(this),onDestroy:function(){this.deviceSelector=null}.bind(this)}});this.deviceSelector.show()};BX.Call.View.prototype.showCallMenu=function(){var e=[{text:BX.message("IM_M_CALL_BTN_WANT_TO_SAY"),iconClass:"hand",onClick:this._onMobileCallMenuFloorRequestClick.bind(this)},{text:BX.message("IM_M_CALL_MOBILE_MENU_PARTICIPANTS_LIST"),iconClass:"participants",onClick:this._onMobileCallMenShowParticipantsClick.bind(this)},{text:BX.message("IM_M_CALL_MOBILE_MENU_COPY_INVITE"),iconClass:"add-participant",onClick:this._onMobileCallMenuCopyInviteClick.bind(this)},!this.isIntranetOrExtranet?{text:BX.message("IM_M_CALL_MOBILE_MENU_CHANGE_MY_NAME"),iconClass:"change-name",onClick:function(){this.callMenu.close();setTimeout(this.showRenameSlider.bind(this),100)}.bind(this)}:null,{separator:true},{text:BX.message("IM_M_CALL_MOBILE_MENU_CANCEL"),enabled:false,onClick:this._onMobileCallMenuCancelClick.bind(this)}];this.callMenu=new g({parent:this.elements.root,items:e,onClose:function(){this.callMenu.destroy()}.bind(this),onDestroy:function(){this.callMenu=null}.bind(this)});this.callMenu.show()};BX.Call.View.prototype.showUserMenu=function(e){var t=this.userRegistry.get(e);if(!t){return false}var s=null;if(this.pinnedUser&&this.pinnedUser.id==e){s={text:BX.message("IM_M_CALL_MOBILE_MENU_UNPIN"),iconClass:"unpin",onClick:function(){this.userMenu.close();this.unpinUser()}.bind(this)}}else if(this.userId!=e){s={text:BX.message("IM_M_CALL_MOBILE_MENU_PIN"),iconClass:"pin",onClick:function(){this.userMenu.close();this.pinUser(e)}.bind(this)}}var i=[{userModel:t,enabled:false},{separator:true},s,this.userId==e&&!this.isIntranetOrExtranet?{text:BX.message("IM_M_CALL_MOBILE_MENU_CHANGE_MY_NAME"),iconClass:"change-name",onClick:function(){this.userMenu.close();setTimeout(this.showRenameSlider.bind(this),100)}.bind(this)}:null,{separator:true},{text:BX.message("IM_M_CALL_MOBILE_MENU_CANCEL"),enabled:false,onClick:function(){this.userMenu.close()}.bind(this)}];this.userMenu=new g({parent:this.elements.root,items:i,onClose:function(){this.userMenu.destroy()}.bind(this),onDestroy:function(){this.userMenu=null}.bind(this)});this.userMenu.show()};BX.Call.View.prototype.showParticipantsMenu=function(){if(this.participantsMenu){return}var e=[];e.push({userModel:this.localUser.userModel,showSubMenu:true,onClick:function(){this.participantsMenu.close();this.showUserMenu(this.localUser.userModel.id)}.bind(this)});this.userRegistry.users.forEach((function(t){if(t.localUser||t.state!=BX.Call.UserState.Connected){return}if(e.length>0){e.push({separator:true})}e.push({userModel:t,showSubMenu:true,onClick:function(){this.participantsMenu.close();this.showUserMenu(t.id)}.bind(this)})}),this);if(e.length===0){return false}this.participantsMenu=new g({parent:this.elements.root,items:e,header:BX.message("IM_M_CALL_PARTICIPANTS").replace("#COUNT#",this.getConnectedUserCount(true)),largeIcons:true,onClose:function(){this.participantsMenu.destroy()}.bind(this),onDestroy:function(){this.participantsMenu=null}.bind(this)});this.participantsMenu.show();return true};BX.Call.View.prototype.showMessage=function(e){if(!this.elements.root){this.render();this.container.appendChild(this.elements.root)}var t=BX.create("div",{props:{className:"bx-messenger-videocall-user-status bx-messenger-videocall-user-status-wide"}});if(BX.type.isNotEmptyString(e.text)){var s=BX.create("div",{props:{className:"bx-messenger-videocall-status-text"},text:e.text});t.appendChild(s)}if(this.elements.overlay.childElementCount){BX.cleanNode(this.elements.overlay)}this.elements.overlay.appendChild(t)};BX.Call.View.prototype.hideMessage=function(){this.elements.overlay.textContent=""};BX.Call.View.prototype.showFatalError=function(e){this.showMessage(e);this.setUiState(t.Error)};BX.Call.View.prototype.close=function(){if(this.buttons.recordStatus){this.buttons.recordStatus.stopViewUpdate()}this.recordState=this.getDefaultRecordState();if(this.elements.root){BX.remove(this.elements.root)}this.visible=false;this.eventEmitter.emit(s.onClose)};BX.Call.View.prototype.setSize=function(e){if(this.size==e){return}this.size=e;if(this.size==BX.Call.View.Size.Folded){if(this.overflownButtonsPopup){this.overflownButtonsPopup.close()}if(this.elements.panel){this.elements.panel.classList.add("bx-messenger-videocall-panel-folded")}BX.remove(this.elements.container);BX.remove(this.elements.topPanel);this.elements.root.style.removeProperty("max-width");this.updateButtons()}else{if(this.elements.panel){this.elements.panel.classList.remove("bx-messenger-videocall-panel-folded")}this.elements.wrap.appendChild(this.elements.topPanel);this.elements.wrap.appendChild(this.elements.container);if(this.maxWidth>0){this.elements.root.style.maxWidth=Math.max(this.maxWidth,a)+"px"}this.updateButtons();this.updateUserList();this.resumeVideo()}};BX.Call.View.prototype.isButtonBlocked=function(e){switch(e){case"camera":return this.uiState!==t.Preparing&&this.uiState!==t.Connected||this.blockedButtons[e]===true;case"chat":return!this.showChatButtons||this.blockedButtons[e]===true;case"floorRequest":return this.uiState!==t.Connected||this.blockedButtons[e]===true;case"screen":return!this.showShareButton||(!this.isScreenSharingSupported()||this.isFullScreen)||this.blockedButtons[e]===true;case"users":return!this.showUsersButton||this.blockedButtons[e]===true;case"record":return!this.showRecordButton||this.blockedButtons[e]===true;case"document":return!this.showDocumentButton||this.blockedButtons[e]===true;default:return this.blockedButtons[e]===true}};BX.Call.View.prototype.isButtonHidden=function(e){return this.hiddenButtons[e]===true};BX.Call.View.prototype.showButton=function(e){this.showButtons([e])};BX.Call.View.prototype.hideButton=function(e){this.hideButtons([e])};BX.Call.View.prototype.checkPanelOverflow=function(){var e=this.elements.panel.scrollWidth-this.elements.panel.offsetWidth;var t=55;if(e>0){var s=Math.ceil(e/t);if(Object.keys(this.overflownButtons).length===0){s+=1}var i=this.getButtonList();for(var n=i.length-1;n>0;n--){if(i[n]==="hangup"||i[n]==="close"||i[n]==="more"){continue}this.overflownButtons[i[n]]=true;s-=1;if(!s){break}}return true}else{var o=Object.keys(this.overflownButtons).length;if(o>0){var r=this.calculateUnusedPanelSpace();if(r>t){var a=Math.min(Math.floor(r/t),o);var l=o-a;if(l===1){a+=1}if(a==o){this.overflownButtons={}}else{for(n=0;n<a;n++){delete this.overflownButtons[Object.keys(this.overflownButtons)[0]]}}return true}}}return false};BX.Call.View.prototype.showButtons=function(e){if(!BX.type.isArray(e)){console.error("buttons should be array")}e.forEach((function(e){if(this.hiddenButtons.hasOwnProperty(e)){delete this.hiddenButtons[e]}}),this);this.updateButtons()};BX.Call.View.prototype.hideButtons=function(e){if(!BX.type.isArray(e)){console.error("buttons should be array")}e.forEach((function(e){this.hiddenButtons[e]=true}),this);this.updateButtons()};BX.Call.View.prototype.blockAddUser=function(){this.blockedButtons["add"]=true;if(this.elements.userList.addButton){BX.remove(this.elements.userList.addButton);this.elements.userList.addButton=null}};BX.Call.View.prototype.blockSwitchCamera=function(){this.blockedButtons["camera"]=true};BX.Call.View.prototype.unblockSwitchCamera=function(){delete this.blockedButtons["camera"]};BX.Call.View.prototype.blockScreenSharing=function(){this.blockedButtons["screen"]=true};BX.Call.View.prototype.blockHistoryButton=function(){this.blockedButtons["history"]=true};BX.Call.View.prototype.blockButtons=function(e){if(!BX.type.isArray(e)){console.error("buttons should be array")}e.forEach((function(e){this.blockedButtons[e]=true;if(this.buttons[e]){this.buttons[e].setBlocked(true)}}),this)};BX.Call.View.prototype.unblockButtons=function(e){if(!BX.type.isArray(e)){console.error("buttons should be array")}e.forEach((function(e){delete this.blockedButtons[e];if(this.buttons[e]){this.buttons[e].setBlocked(this.isButtonBlocked(e))}}),this)};BX.Call.View.prototype.disableMediaSelection=function(){this.mediaSelectionBlocked=true};BX.Call.View.prototype.enableMediaSelection=function(){this.mediaSelectionBlocked=false;if(this.buttons.microphone&&this.isMediaSelectionAllowed()){this.buttons.microphone.showArrow()}if(this.buttons.camera&&this.isMediaSelectionAllowed()){this.buttons.camera.showArrow()}};BX.Call.View.prototype.isMediaSelectionAllowed=function(){return this.layout!=e.Mobile&&(this.uiState==t.Preparing||this.uiState==t.Connected)&&!this.mediaSelectionBlocked&&!this.isFullScreen};BX.Call.View.prototype.getButtonList=function(){if(this.uiState==t.Error){return["close"]}if(this.uiState==t.Initializing){return["hangup"]}if(this.size==BX.Call.View.Size.Folded){return["title","spacer","returnToCall","hangup"]}var s=[];s.push("microphone");s.push("camera");if(this.layout!=e.Mobile){s.push("speaker")}else{s.push("mobileMenu")}s.push("chat");s.push("users");if(this.layout!=e.Mobile){s.push("floorRequest");s.push("screen");s.push("record");s.push("document")}s=s.filter((function(e){return!this.hiddenButtons.hasOwnProperty(e)&&!this.overflownButtons.hasOwnProperty(e)}),this);if(Object.keys(this.overflownButtons).length>0){s.push("more")}if(this.uiState==t.Preparing){s.push("close")}else{s.push("hangup")}return s};BX.Call.View.prototype.getTopButtonList=function(){var s=[];if(this.layout==e.Mobile){return["participantsMobile"]}s.push("watermark");s.push("hd");s.push("separator");s.push("protected");s.push("recordStatus");s.push("spacer");var i=false;if(this.uiState===t.Connected&&this.layout!=e.Mobile){s.push("grid");i=true}if(this.uiState!=t.Preparing&&this.isFullScreenSupported()&&this.layout!=e.Mobile){s.push("fullscreen");i=true}if(this.uiState!=t.Preparing){if(i){s.push("separator")}s.push("participants")}var n="";s=s.filter((function(e){if(n==="spacer"&&e==="separator"){return true}n=e;return!this.hiddenTopButtons.hasOwnProperty(e)}),this);return s};BX.Call.View.prototype.render=function(){this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall"},children:[this.elements.wrap=BX.create("div",{props:{className:"bx-messenger-videocall-wrap"},children:[this.elements.container=BX.create("div",{props:{className:"bx-messenger-videocall-inner"},children:[this.elements.center=BX.create("div",{props:{className:"bx-messenger-videocall-central-user"},events:{touchstart:this._onCenterTouchStart.bind(this),touchend:this._onCenterTouchEnd.bind(this)}}),this.elements.pageNavigatorLeft=BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator left"},children:[this.elements.pageNavigatorLeftCounter=BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator-counter left"},html:this.currentPage-1+" / "+this.pagesCount}),BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator-icon left"}})],events:{click:this._onLeftPageNavigatorClick.bind(this)}}),this.elements.pageNavigatorRight=BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator right"},children:[this.elements.pageNavigatorRightCounter=BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator-counter right"},html:this.currentPage+1+" / "+this.pagesCount}),BX.create("div",{props:{className:"bx-messenger-videocall-page-navigator-icon right"}})],events:{click:this._onRightPageNavigatorClick.bind(this)}})]}),this.elements.topPanel=BX.create("div",{props:{className:"bx-messenger-videocall-top-panel"}}),this.elements.notificationPanel=BX.create("div",{props:{className:"bx-messenger-videocall-notification-panel"}}),this.elements.bottom=BX.create("div",{props:{className:"bx-messenger-videocall-bottom"},children:[this.elements.userSelectorContainer=BX.create("div",{props:{className:"bx-messenger-videocall-bottom-user-selector-container"}}),this.elements.pinnedUserContainer=BX.create("div",{props:{className:"bx-messenger-videocall-bottom-pinned-user-container"}})]})]})],events:{click:this._onBodyClick.bind(this)}});if(this.uiState==t.Preparing){this.elements.wrap.classList.add("with-clouds")}if(this.showButtonPanel){this.elements.panel=BX.create("div",{props:{className:"bx-messenger-videocall-panel"}});this.elements.bottom.appendChild(this.elements.panel)}else{this.elements.root.classList.add("bx-messenger-videocall-no-button-panel")}if(this.layout==e.Mobile){this.userSelector=new f({userRegistry:this.userRegistry});this.userSelector.mount(this.elements.userSelectorContainer);this.elements.ear.left=BX.create("div",{props:{className:"bx-messenger-videocall-mobile-ear left"},events:{click:this._onLeftEarClick.bind(this)}});this.elements.ear.right=BX.create("div",{props:{className:"bx-messenger-videocall-mobile-ear right"},events:{click:this._onRightEarClick.bind(this)}});this.elements.localUserMobile=BX.create("div",{props:{className:"bx-messenger-videocall-local-user-mobile"}});if(window.innerHeight<window.innerWidth){this.elements.root.classList.add("orientation-landscape")}this.elements.wrap.appendChild(this.elements.ear.left);this.elements.wrap.appendChild(this.elements.ear.right);this.elements.wrap.appendChild(this.elements.localUserMobile)}this.centralUser.mount(this.elements.center);this.elements.overlay=BX.create("div",{props:{className:"bx-messenger-videocall-overlay"}});this.elements.userBlock=BX.create("div",{props:{className:"bx-messenger-videocall-user-block"},children:[this.elements.ear.top=BX.create("div",{props:{className:"bx-messenger-videocall-ear bx-messenger-videocall-ear-top"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-ear-icon"}})],events:{mouseenter:this.scrollUserListUp.bind(this),mouseleave:this.stopScroll.bind(this)}}),this.elements.ear.bottom=BX.create("div",{props:{className:"bx-messenger-videocall-ear bx-messenger-videocall-ear-bottom"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-ear-icon"}})],events:{mouseenter:this.scrollUserListDown.bind(this),mouseleave:this.stopScroll.bind(this)}})]});this.elements.userList.container=BX.create("div",{props:{className:"bx-messenger-videocall-user-list"},events:{scroll:BX.debounce(this.toggleEars.bind(this),300),wheel:function(e){this.elements.userList.container.scrollTop+=e.deltaY}.bind(this)}});this.elements.userList.addButton=BX.create("div",{props:{className:"bx-messenger-videocall-user-add"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-add-inner"}})],style:{order:o},events:{click:this._onAddButtonClick.bind(this)}});if(this.layout==e.Centered||this.layout==e.Mobile){this.centralUser.mount(this.elements.center);this.elements.root.classList.add("bx-messenger-videocall-centered");if(this.layout!=e.Mobile){this.elements.container.appendChild(this.elements.userBlock)}}if(this.layout==e.Grid){this.elements.root.classList.add("bx-messenger-videocall-grid")}if(this.layout==e.Mobile){this.elements.root.classList.add("bx-messenger-videocall-fullscreen-mobile")}this.resizeObserver.observe(this.elements.root);this.resizeObserver.observe(this.container);return this.elements.root};BX.Call.View.prototype.renderUserList=function(){var s=this.shouldShowLocalUser();var i=0;var n=0;var o=0;var r=0;if(this.layout==e.Grid&&this.pagesCount>1){n=(this.currentPage-1)*this.usersPerPage}for(var a=0;a<this.userRegistry.users.length;a++){var l=this.userRegistry.users[a];var c=l.id;if(!this.users.hasOwnProperty(c)){continue}var h=this.users[c];var u=this.screenUsers[c];if(c==this.centralUser.id&&(this.layout==e.Centered||this.layout==e.Mobile)){this.unobserveIntersections(h);if(u.hasVideo()){u.mount(this.elements.center);u.visible=true;h.mount(this.elements.userList.container)}else{h.visible=true;h.mount(this.elements.center);u.dismount()}continue}var d=l.state;var p=d!=BX.Call.UserState.Idle&&d!=BX.Call.UserState.Declined&&d!=BX.Call.UserState.Unavailable&&d!=BX.Call.UserState.Busy&&l.direction!=BX.Call.EndpointDirection.RecvOnly;if(p&&n>0&&o<n){o++;p=false}if(p&&this.layout==e.Grid&&this.usersPerPage>0&&r>=this.usersPerPage){p=false}if(!p){h.dismount();this.unobserveIntersections(h);u.dismount();continue}if(u.hasVideo()){u.mount(this.elements.userList.container);i++}else{u.dismount()}h.mount(this.elements.userList.container);this.observeIntersections(h);r++;i++}if(s){if(this.layout==e.Centered&&this.userId==this.centralUser.id||this.layout==e.Mobile){this.localUser.mount(this.elements.center,true);this.localUser.visible=true}else{this.localUser.mount(this.elements.userList.container);if(this.layout==e.Centered&&this.intersectionObserver){}else{this.localUser.visible=true}}i++}else{this.localUser.dismount()}if(this.layout==e.Grid){this.updateGridUserSize(i)}else{this.elements.userList.container.classList.add("bx-messenger-videocall-user-list-small");this.elements.userList.container.style.removeProperty("--avatar-size");this.updateCentralUserAvatarSize()}this.applyIncomingVideoConstraints();var m=this.layout==e.Centered&&i>0&&this.uiState===t.Connected&&!this.isButtonBlocked("add")&&this.getConnectedUserCount()<this.userLimit-1;if(m&&!this.isFullScreen){this.elements.userList.container.appendChild(this.elements.userList.addButton)}else{BX.remove(this.elements.userList.addButton)}this.elements.root.classList.toggle("bx-messenger-videocall-user-list-empty",this.elements.userList.container.childElementCount===0);this.localUser.updatePanelDeferred()};BX.Call.View.prototype.shouldShowLocalUser=function(){return this.localUser.userModel.state!=BX.Call.UserState.Idle&&this.localUser.userModel.direction!=BX.Call.EndpointDirection.RecvOnly};BX.Call.View.prototype.updateGridUserSize=function(e){var t=this.elements.userList.container.getBoundingClientRect();this.userSize=BX.Call.Util.findBestElementSize(t.width,t.height,e,u,d);var s=Math.round(this.userSize.height*.45);this.elements.userList.container.style.setProperty("--grid-user-width",this.userSize.width+"px");this.elements.userList.container.style.setProperty("--grid-user-height",this.userSize.height+"px");this.elements.userList.container.style.setProperty("--avatar-size",s+"px");if(this.userSize.width<220){this.elements.userList.container.classList.add("bx-messenger-videocall-user-list-small")}else{this.elements.userList.container.classList.remove("bx-messenger-videocall-user-list-small")}};BX.Call.View.prototype.updateCentralUserAvatarSize=function(){var t;var s;if(this.layout==e.Mobile){t=this.elements.root.getBoundingClientRect();s=Math.round(t.width*.55)}else if(this.layout==e.Centered){t=this.elements.center.getBoundingClientRect();s=Math.round(t.height*.45);s=Math.min(s,142);this.centralUser.setIncomingVideoConstraints(Math.floor(t.width),Math.floor(t.height))}this.elements.center.style.setProperty("--avatar-size",s+"px")};BX.Call.View.prototype.renderButtons=function(t){var s,i,n,o;s=BX.create("div",{props:{className:"bx-messenger-videocall-panel-inner"}});if(this.layout===e.Mobile||this.size===BX.Call.View.Size.Folded){i=s;n=s;o=s}else{i=BX.create("div",{props:{className:"bx-messenger-videocall-panel-inner-left"}});n=BX.create("div",{props:{className:"bx-messenger-videocall-panel-inner-center"}});o=BX.create("div",{props:{className:"bx-messenger-videocall-panel-inner-right"}});s.appendChild(i);s.appendChild(n);s.appendChild(o)}for(var r=0;r<t.length;r++){switch(t[r]){case"title":this.buttons.title=new B({text:this.title,isGroupCall:Object.keys(this.users).length>1});i.appendChild(this.buttons.title.render());break;case"share":this.buttons.share=new C({class:"share",text:BX.message("IM_M_CALL_BTN_LINK"),onClick:this._onShareButtonClick.bind(this)});n.appendChild(this.buttons.share.render());break;case"microphone":this.buttons.microphone=new w({class:"microphone",text:BX.message("IM_M_CALL_BTN_MIC"),enabled:!this.isMuted,arrowHidden:this.layout==e.Mobile,arrowEnabled:this.isMediaSelectionAllowed(),blocked:this.isButtonBlocked("microphone"),showLevel:true,onClick:function(e){this._onMicrophoneButtonClick(e);this._showMicrophoneHint(e)}.bind(this),onArrowClick:this._onMicrophoneArrowClick.bind(this),onMouseOver:this._showMicrophoneHint.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)});i.appendChild(this.buttons.microphone.render());break;case"camera":this.buttons.camera=new w({class:"camera",text:BX.message("IM_M_CALL_BTN_CAMERA"),enabled:this.isCameraOn,arrowHidden:this.layout==e.Mobile,arrowEnabled:this.isMediaSelectionAllowed(),blocked:this.isButtonBlocked("camera"),onClick:this._onCameraButtonClick.bind(this),onArrowClick:this._onCameraArrowClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget.firstChild,"camera",this.keyModifier+" + V")}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)});i.appendChild(this.buttons.camera.render());break;case"screen":if(!this.buttons.screen){this.buttons.screen=new C({class:"screen",text:BX.message("IM_M_CALL_BTN_SCREEN"),blocked:this.isButtonBlocked("screen"),onClick:this._onScreenButtonClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget,"screen",this.keyModifier+" + S")}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)})}else{this.buttons.screen.setBlocked(this.isButtonBlocked("screen"))}n.appendChild(this.buttons.screen.render());break;case"users":if(!this.buttons.users){this.buttons.users=new C({class:"users",backgroundClass:"calm-counter",text:BX.message("IM_M_CALL_BTN_USERS"),blocked:this.isButtonBlocked("users"),onClick:this._onUsersButtonClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget,"users",this.keyModifier+" + U")}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)})}else{this.buttons.users.setBlocked(this.isButtonBlocked("users"))}n.appendChild(this.buttons.users.render());break;case"record":if(!this.buttons.record){this.buttons.record=new C({class:"record",backgroundClass:"bx-messenger-videocall-panel-background-record",text:BX.message("IM_M_CALL_BTN_RECORD"),blocked:this.isButtonBlocked("record"),onClick:this._onRecordToggleClick.bind(this),onMouseOver:function(e){if(this.isRecordingHotKeySupported()){this._showHotKeyHint(e.currentTarget,"record",this.keyModifier+" + R")}}.bind(this),onMouseOut:function(e){if(this.isRecordingHotKeySupported()){this._destroyHotKeyHint()}}.bind(this)})}else{this.buttons.record.setBlocked(this.isButtonBlocked("record"))}n.appendChild(this.buttons.record.render());break;case"document":if(!this.buttons.document){this.buttons.document=new C({class:"document",text:BX.message("IM_M_CALL_BTN_DOCUMENT"),blocked:this.isButtonBlocked("document"),onClick:this._onDocumentButtonClick.bind(this)})}else{this.buttons.document.setBlocked(this.isButtonBlocked("document"))}n.appendChild(this.buttons.document.render());break;case"returnToCall":this.buttons.returnToCall=new C({class:"returnToCall",text:BX.message("IM_M_CALL_BTN_RETURN_TO_CALL"),onClick:this._onBodyClick.bind(this)});o.appendChild(this.buttons.returnToCall.render());break;case"hangup":this.buttons.hangup=new C({class:"hangup",backgroundClass:"bx-messenger-videocall-panel-icon-background-hangup",text:Object.keys(this.users).length>1?BX.message("IM_M_CALL_BTN_DISCONNECT"):BX.message("IM_M_CALL_BTN_HANGUP"),onClick:this._onHangupButtonClick.bind(this)});o.appendChild(this.buttons.hangup.render());break;case"close":this.buttons.close=new C({class:"close",backgroundClass:"bx-messenger-videocall-panel-icon-background-hangup",text:BX.message("IM_M_CALL_BTN_CLOSE"),onClick:this._onCloseButtonClick.bind(this)});o.appendChild(this.buttons.close.render());break;case"speaker":break;case"mobileMenu":if(!this.buttons.mobileMenu){this.buttons.mobileMenu=new C({class:"sandwich",text:BX.message("IM_M_CALL_BTN_MENU"),onClick:this._onMobileMenuButtonClick.bind(this)})}n.appendChild(this.buttons.mobileMenu.render());break;case"chat":if(!this.buttons.chat){this.buttons.chat=new C({class:"chat",text:BX.message("IM_M_CALL_BTN_CHAT"),blocked:this.isButtonBlocked("chat"),onClick:this._onChatButtonClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget,"chat",this.keyModifier+" + C")}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)})}else{this.buttons.chat.setBlocked(this.isButtonBlocked("chat"))}n.appendChild(this.buttons.chat.render());break;case"floorRequest":if(!this.buttons.floorRequest){this.buttons.floorRequest=new C({class:"floor-request",backgroundClass:"bx-messenger-videocall-panel-background-floor-request",text:BX.message("IM_M_CALL_BTN_WANT_TO_SAY"),blocked:this.isButtonBlocked("floorRequest"),onClick:this._onFloorRequestButtonClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget,"floorRequest",this.keyModifier+" + H")}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)})}else{this.buttons.floorRequest.setBlocked(this.isButtonBlocked("floorRequest"))}n.appendChild(this.buttons.floorRequest.render());break;case"more":if(!this.buttons.more){this.buttons.more=new C({class:"more",onClick:this._onMoreButtonClick.bind(this)})}n.appendChild(this.buttons.more.render());break;case"spacer":s.appendChild(BX.create("div",{props:{className:"bx-messenger-videocall-panel-spacer"}}));break}}return s};BX.Call.View.prototype.renderTopButtons=function(t){var s=BX.createFragment();for(var i=0;i<t.length;i++){switch(t[i]){case"watermark":this.buttons.waterMark=new y({language:this.language});s.appendChild(this.buttons.waterMark.render());break;case"hd":this.buttons.hd=new k({iconClass:"hd"});s.appendChild(this.buttons.hd.render());break;case"protected":this.buttons.protected=new k({iconClass:"protected",textClass:"protected",text:BX.message("IM_M_CALL_PROTECTED"),onMouseOver:function(e){this.hintManager.show(e.currentTarget,BX.message("IM_M_CALL_PROTECTED_HINT"))}.bind(this),onMouseOut:function(e){this.hintManager.hide()}.bind(this)});s.appendChild(this.buttons.protected.render());break;case"recordStatus":if(this.buttons.recordStatus){this.buttons.recordStatus.updateView()}else{this.buttons.recordStatus=new _({userId:this.userId,recordState:this.recordState,onPauseClick:this._onRecordPauseClick.bind(this),onStopClick:this._onRecordStopClick.bind(this),onMouseOver:this._onRecordMouseOver.bind(this),onMouseOut:this._onRecordMouseOut.bind(this)})}s.appendChild(this.buttons.recordStatus.render());break;case"grid":this.buttons.grid=new X({iconClass:this.layout==e.Grid?"speaker":"grid",text:this.layout==e.Grid?BX.message("IM_M_CALL_SPEAKER_MODE"):BX.message("IM_M_CALL_GRID_MODE"),onClick:this._onGridButtonClick.bind(this),onMouseOver:function(e){this._showHotKeyHint(e.currentTarget,"grid",this.keyModifier+" + W",{position:"bottom"})}.bind(this),onMouseOut:function(e){this._destroyHotKeyHint()}.bind(this)});s.appendChild(this.buttons.grid.render());break;case"fullscreen":this.buttons.fullscreen=new X({iconClass:this.isFullScreen?"fullscreen-leave":"fullscreen-enter",text:this.isFullScreen?BX.message("IM_M_CALL_WINDOW_MODE"):BX.message("IM_M_CALL_FULLSCREEN_MODE"),onClick:this._onFullScreenButtonClick.bind(this)});s.appendChild(this.buttons.fullscreen.render());break;case"participants":var n;if(this.isFullScreen&&this.layout==e.Centered){n=this.isUserBlockFolded?S.FoldButtonState.Unfold:S.FoldButtonState.Fold}else if(this.showUsersButton){n=S.FoldButtonState.Active}else{n=S.FoldButtonState.Hidden}if(this.buttons.participants){this.buttons.participants.update({foldButtonState:n,allowAdding:!this.isButtonBlocked("add"),count:this.getConnectedUserCount(true)})}else{this.buttons.participants=new S({foldButtonState:n,allowAdding:!this.isButtonBlocked("add"),count:this.getConnectedUserCount(true),onListClick:this._onParticipantsButtonListClick.bind(this),onAddClick:this._onAddButtonClick.bind(this)})}s.appendChild(this.buttons.participants.render());break;case"participantsMobile":this.buttons.participantsMobile=new M({count:this.getConnectedUserCount(true),onClick:this._onParticipantsButtonMobileListClick.bind(this)});s.appendChild(this.buttons.participantsMobile.render());break;case"separator":s.appendChild(BX.create("div",{props:{className:"bx-messenger-videocall-top-separator"}}));break;case"spacer":s.appendChild(BX.create("div",{props:{className:"bx-messenger-videocall-top-panel-spacer"}}));break}}return s};BX.Call.View.prototype.calculateUnusedPanelSpace=function(e){if(!e){e=this.getButtonList()}var t=0;for(var s=0;s<e.length;s++){var i=this.buttons[e[s]];if(!i){continue}buttonWidth=i.elements.root?i.elements.root.getBoundingClientRect().width:0;t+=buttonWidth}return this.elements.panel.scrollWidth-t-32};BX.Call.View.prototype.setButtonActive=function(e,t){if(!this.buttons[e]){return}this.buttons[e].setActive(t)};BX.Call.View.prototype.getButtonActive=function(e){if(!this.buttons[e]){return false}return this.buttons[e].isActive};BX.Call.View.prototype.setButtonCounter=function(e,t){if(!this.buttons[e]){return}this.buttons[e].setCounter(t)};BX.Call.View.prototype.updateUserList=function(){if(this.layout==e.Mobile){if(this.localUser!=this.centralUser){if(this.localUser.hasVideo()){this.localUser.mount(this.elements.localUserMobile);this.localUser.visible=true}else{this.localUser.dismount()}this.centralUser.mount(this.elements.center);this.centralUser.visible=true}return}if(this.layout==e.Grid&&this.size==BX.Call.View.Size.Full){this.recalculatePages()}this.renderUserList();if(this.layout==e.Centered){if(!this.elements.userList.container.parentElement){this.elements.userBlock.appendChild(this.elements.userList.container)}}else if(this.layout==e.Grid){if(!this.elements.userList.container.parentElement){this.elements.container.appendChild(this.elements.userList.container)}}this.toggleEars()};BX.Call.View.prototype.showOverflownButtonsPopup=function(){if(this.overflownButtonsPopup){this.overflownButtonsPopup.show();return}var e=this.buttons.more&&this.buttons.more.elements.root?this.buttons.more.elements.root:this.elements.panel;this.overflownButtonsPopup=new BX.PopupWindow("bx-call-buttons-popup",e,{targetContainer:this.container,content:this.renderButtons(Object.keys(this.overflownButtons)),cacheable:false,closeIcon:false,autoHide:true,overlay:{backgroundColor:"white",opacity:0},bindOptions:{position:"top"},angle:{position:"bottom",offset:49},className:"bx-call-buttons-popup",contentBackground:"unset",events:{onPopupDestroy:function(){this.overflownButtonsPopup=null;this.buttons.more.setActive(false)}.bind(this)}});this.overflownButtonsPopup.show()};BX.Call.View.prototype.resumeVideo=function(){for(var e in this.users){var t=this.users[e];t.playVideo();var s=this.screenUsers[e];s.playVideo()}this.localUser.playVideo(true)};BX.Call.View.prototype.updateUserButtons=function(){for(var e in this.users){if(this.users.hasOwnProperty(e)){this.users[e].allowPinButton=this.getConnectedUserCount()>1}}};BX.Call.View.prototype.updateButtons=function(){if(!this.elements.panel){return}BX.cleanNode(this.elements.panel);BX.cleanNode(this.elements.topPanel);this.elements.panel.appendChild(this.renderButtons(this.getButtonList()));if(this.elements.topPanel){this.elements.topPanel.appendChild(this.renderTopButtons(this.getTopButtonList()))}if(this.buttons.participantsMobile){this.buttons.participantsMobile.setCount(this.getConnectedUserCount(true))}};BX.Call.View.prototype.updateUserData=function(e){for(var t in e){if(!this.userData[t]){this.userData[t]={name:"",avatar_hr:"",gender:"M"}}if(e[t].name){this.userData[t].name=e[t].name}if(e[t].avatar_hr){this.userData[t].avatar_hr=BX.Call.Util.isAvatarBlank(e[t].avatar_hr)?"":e[t].avatar_hr}else if(e[t].avatar){this.userData[t].avatar_hr=BX.Call.Util.isAvatarBlank(e[t].avatar)?"":e[t].avatar}if(e[t].gender){this.userData[t].gender=e[t].gender==="F"?"F":"M"}var s=this.userRegistry.get(t);if(s){s.name=this.userData[t].name;s.avatar=this.userData[t].avatar_hr}}};BX.Call.View.prototype.isScreenSharingSupported=function(){return navigator.mediaDevices&&typeof navigator.mediaDevices.getDisplayMedia==="function"||typeof BXDesktopSystem!=="undefined"};BX.Call.View.prototype.isRecordingHotKeySupported=function(){return typeof BXDesktopSystem!=="undefined"&&BXDesktopSystem.ApiVersion()>=60};BX.Call.View.prototype.isFullScreenSupported=function(){if(BX.browser.IsChrome()||BX.browser.IsSafari()){return document.webkitFullscreenEnabled===true}else if(BX.browser.IsFirefox()){return document.fullscreenEnabled===true}else{return false}};BX.Call.View.prototype.toggleEars=function(){this.toggleTopEar();this.toggleBottomEar();if(this.layout==e.Grid&&this.pagesCount>1&&this.currentPage>1){this.elements.pageNavigatorLeft.classList.add("active")}else{this.elements.pageNavigatorLeft.classList.remove("active")}if(this.layout==e.Grid&&this.pagesCount>1&&this.currentPage<this.pagesCount){this.elements.pageNavigatorRight.classList.add("active")}else{this.elements.pageNavigatorRight.classList.remove("active")}};BX.Call.View.prototype.toggleTopEar=function(){if(this.layout!==e.Grid&&this.elements.userList.container.scrollHeight>this.elements.userList.container.offsetHeight&&this.elements.userList.container.scrollTop>0){this.elements.ear.top.classList.add("active")}else{this.elements.ear.top.classList.remove("active")}};BX.Call.View.prototype.toggleBottomEar=function(){if(this.layout!==e.Grid&&this.elements.userList.container.offsetHeight+this.elements.userList.container.scrollTop<this.elements.userList.container.scrollHeight){this.elements.ear.bottom.classList.add("active")}else{this.elements.ear.bottom.classList.remove("active")}};BX.Call.View.prototype.scrollUserListUp=function(){this.stopScroll();this.scrollInterval=setInterval(function(){this.elements.userList.container.scrollTop-=10}.bind(this),20)};BX.Call.View.prototype.scrollUserListDown=function(){this.stopScroll();this.scrollInterval=setInterval(function(){this.elements.userList.container.scrollTop+=10}.bind(this),20)};BX.Call.View.prototype.stopScroll=function(){if(this.scrollInterval){clearInterval(this.scrollInterval);this.scrollInterval=0}};BX.Call.View.prototype.toggleRenameSliderInputLoader=function(){this.elements.renameSlider.button.classList.add("ui-btn-wait")};BX.Call.View.prototype.setHotKeyTemporaryBlock=function(e,t){if(!!e){this.hotKeyTemporaryBlock++}else{this.hotKeyTemporaryBlock--;if(this.hotKeyTemporaryBlock<0||t){this.hotKeyTemporaryBlock=0}}};BX.Call.View.prototype.setHotKeyActive=function(e,t){if(typeof this.hotKey[e]==="undefined"){return}this.hotKey[e]=!!t};BX.Call.View.prototype.isHotKeyActive=function(e){if(!this.hotKey["all"]){return false}if(this.hotKeyTemporaryBlock>0){return false}if(this.isButtonHidden(e)){return false}if(this.isButtonBlocked(e)){return false}return!!this.hotKey[e]};BX.Call.View.prototype._onBodyClick=function(e){this.eventEmitter.emit(s.onBodyClick)};BX.Call.View.prototype._onCenterTouchStart=function(e){this.centerTouchX=e.pageX};BX.Call.View.prototype._onCenterTouchEnd=function(e){var t=e.pageX-this.centerTouchX;if(t>100){this.pinUser(this.getRightUser(this.centralUser.id));e.preventDefault()}if(t<-100){this.pinUser(this.getLeftUser(this.centralUser.id));e.preventDefault()}};BX.Call.View.prototype._onFullScreenChange=function(e){if("webkitFullscreenElement"in document){this.isFullScreen=!!document.webkitFullscreenElement}else if("fullscreenElement"in document){this.isFullScreen=!!document.fullscreenElement}else{return}setTimeout(function(){if(!this.elements.root){return}if(this.isFullScreen){this.elements.root.classList.add("bx-messenger-videocall-fullscreen")}else{this.elements.root.classList.remove("bx-messenger-videocall-fullscreen")}this.updateUserList();this.updateButtons();this.setUserBlockFolded(this.isFullScreen)}.bind(this),0)};BX.Call.View.prototype._onIntersectionChange=function(e){var t={};e.forEach((function(e){t[e.target.dataset.userId]=e.isIntersecting}));for(var s in t){if(this.users[s]){this.users[s].visible=t[s]}if(s==this.localUser.id){this.localUser.visible=t[s]}}};BX.Call.View.prototype._onResize=function(){if(!this.elements.root){return}if(this.centralUser){}if(BX.browser.IsMobile()){document.documentElement.style.setProperty("--view-height",window.innerHeight+"px")}if(this.layout==e.Grid){this.updateUserList()}else{this.updateCentralUserAvatarSize();this.toggleEars()}var t=this.elements.root.getBoundingClientRect();this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-450",t.width<450);this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-550",t.width<550);this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-650",t.width<650);this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-700",t.width<700);this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-850",t.width<850);this.elements.root.classList.toggle("bx-messenger-videocall-width-lt-900",t.width<900);if(this.checkPanelOverflow()){this.updateButtons();if(this.overflownButtonsPopup&&!Object.keys(this.overflownButtons).length){this.overflownButtonsPopup.close()}}};BX.Call.View.prototype._onOrientationChange=function(){if(!this.elements.root){return}if(window.innerHeight>window.innerWidth){this.elements.root.classList.remove("orientation-landscape")}else{this.elements.root.classList.add("orientation-landscape")}};BX.Call.View.prototype._showHotKeyHint=function(e,t,s,i){var n=BX.PopupWindowManager.getPopupById("ui-hint-popup");if(n){n.destroy()}if(!this.isHotKeyActive(t)){return}i=i||{};this.hintManager.popupParameters.events={onShow:function(t){var s=t.getTarget();s.getPopupContainer().style.display="block";if(i.position==="bottom"){s.setOffset({offsetTop:10,offsetLeft:e.offsetWidth/2-s.getPopupContainer().offsetWidth/2})}else{s.setOffset({offsetLeft:e.offsetWidth/2-s.getPopupContainer().offsetWidth/2})}}};this.hintManager.show(e,s)};BX.Call.View.prototype._destroyHotKeyHint=function(){if(!BX.Call.Util.isDesktop()){return}if(!this.hintManager.popup){return}this.hintManager.popup.destroy();this.hintManager.popup=null};BX.Call.View.prototype._showMicrophoneHint=function(e){this.hintManager.hide();if(!this.isHotKeyActive("microphone")){return}var t="";if(this.isMuted&&this.isHotKeyActive("microphoneSpace")){t=BX.message("IM_SPACE_HOTKEY")+"<br>"}t+=this.keyModifier+" + A";this._showHotKeyHint(e.currentTarget.firstChild,"microphone",t)};BX.Call.View.prototype._onKeyDown=function(t){if(!BX.Call.Util.isDesktop()){return}if(!(t.shiftKey&&(t.ctrlKey||t.metaKey))&&!(t.code==="Space")){return}if(event.repeat){return}var s=this.size===BX.Call.View.Size.Folded;if(t.code==="KeyA"&&this.isHotKeyActive("microphone")){t.preventDefault();this._onMicrophoneButtonClick(t)}else if(t.code==="Space"&&this.isMuted&&this.isHotKeyActive("microphoneSpace")){if(!s){t.preventDefault();this.pushToTalk=true;this.microphoneHotkeyTimerId=setTimeout(function(){this._onMicrophoneButtonClick(t)}.bind(this),100)}}else if(t.code==="KeyS"&&this.isHotKeyActive("screen")){t.preventDefault();this._onScreenButtonClick(t)}else if(t.code==="KeyV"&&this.isHotKeyActive("camera")){t.preventDefault();this._onCameraButtonClick(t)}else if(t.code==="KeyU"&&this.isHotKeyActive("users")){t.preventDefault();this._onUsersButtonClick(t)}else if(t.code==="KeyR"&&this.isRecordingHotKeySupported()&&this.isHotKeyActive("record")){t.preventDefault();this._onForceRecordToggleClick(t)}else if(t.code==="KeyH"&&this.isHotKeyActive("floorRequest")){t.preventDefault();this._onFloorRequestButtonClick(t)}else if(t.code==="KeyC"&&this.isHotKeyActive("chat")){t.preventDefault();if(s){this._onBodyClick(t)}else{this._onChatButtonClick(t);this._destroyHotKeyHint()}}else if(t.code==="KeyM"&&this.isHotKeyActive("muteSpeaker")){t.preventDefault();this.muteSpeaker(!this.speakerMuted);BX.UI.Notification.Center.notify({content:BX.message(this.speakerMuted?"IM_M_CALL_MUTE_SPEAKERS_OFF":"IM_M_CALL_MUTE_SPEAKERS_ON"),position:"top-right",autoHideDelay:3e3,closeButton:true})}else if(t.code==="KeyW"&&this.isHotKeyActive("grid")){t.preventDefault();this.setLayout(this.layout==e.Centered?e.Grid:e.Centered)}};BX.Call.View.prototype._onKeyUp=function(e){if(!BX.Call.Util.isDesktop()){return}clearTimeout(this.microphoneHotkeyTimerId);if(this.pushToTalk&&!this.isMuted&&e.code==="Space"){e.preventDefault();this.pushToTalk=false;this._onMicrophoneButtonClick(e)}};BX.Call.View.prototype._onUserClick=function(t){var i=t.userId;if(i==this.userId){return}if(i==this.centralUser.id&&this.layout!=e.Grid){this.elements.root.classList.toggle("bx-messenger-videocall-hidden-panels")}if(this.layout==e.Centered&&i!=this.centralUser.id){this.pinUser(i)}this.eventEmitter.emit(s.onUserClick,{userId:i,stream:i==this.userId?this.localUser.stream:this.users[i].stream})};BX.Call.View.prototype._onUserRename=function(e){this.eventEmitter.emit(s.onUserRename,{newName:e})};BX.Call.View.prototype._onUserRenameInputFocus=function(e){this.setHotKeyTemporaryBlock(true)};BX.Call.View.prototype._onUserRenameInputBlur=function(e){this.setHotKeyTemporaryBlock(false)};BX.Call.View.prototype._onUserPin=function(t){if(this.layout==e.Grid){this.setLayout(e.Centered)}this.pinUser(t.userId)};BX.Call.View.prototype._onUserUnPin=function(e){this.unpinUser()};BX.Call.View.prototype._onRecordToggleClick=function(e){if(this.recordState.state===BX.Call.View.RecordState.Stopped){this._onRecordStartClick(e)}else{this._onRecordStopClick(e)}};BX.Call.View.prototype._onForceRecordToggleClick=function(e){if(this.recordState.state===BX.Call.View.RecordState.Stopped){this._onForceRecordStartClick(BX.Call.View.RecordType.Video)}else{this._onRecordStopClick(e)}};BX.Call.View.prototype._onForceRecordStartClick=function(e){if(typeof e==="undefined"){e=BX.Call.View.RecordType.None}this.eventEmitter.emit(s.onButtonClick,{buttonName:"record",recordState:BX.Call.View.RecordState.Started,forceRecord:e,node:null})};BX.Call.View.prototype._onRecordStartClick=function(e){this.eventEmitter.emit(s.onButtonClick,{buttonName:"record",recordState:BX.Call.View.RecordState.Started,node:e.currentTarget})};BX.Call.View.prototype._onRecordPauseClick=function(e){var t;if(this.recordState.state===BX.Call.View.RecordState.Paused){this.recordState.state=BX.Call.View.RecordState.Started;t=BX.Call.View.RecordState.Resumed}else{this.recordState.state=BX.Call.View.RecordState.Paused;t=this.recordState.state}this.buttons.recordStatus.update(this.recordState);this.eventEmitter.emit(s.onButtonClick,{buttonName:"record",recordState:t,node:e.currentTarget})};BX.Call.View.prototype._onRecordStopClick=function(e){this.recordState.state=BX.Call.View.RecordState.Stopped;this.buttons.recordStatus.update(this.recordState);this.eventEmitter.emit(s.onButtonClick,{buttonName:"record",recordState:this.recordState.state,node:e.currentTarget})};BX.Call.View.prototype._onRecordMouseOver=function(e){if(this.recordState.userId==this.userId||!this.userData[this.recordState.userId]){return}var t=BX.util.htmlspecialchars(this.userData[this.recordState.userId].name);this.hintManager.show(e.currentTarget,BX.message("IM_M_CALL_RECORD_HINT").replace("#USER_NAME#",t))};BX.Call.View.prototype._onRecordMouseOut=function(e){this.hintManager.hide()};BX.Call.View.prototype._onDocumentButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"document",node:e.target})};BX.Call.View.prototype._onGridButtonClick=function(t){this.setLayout(this.layout==e.Centered?e.Grid:e.Centered)};BX.Call.View.prototype._onAddButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"inviteUser",node:e.currentTarget})};BX.Call.View.prototype._onShareButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"share",node:e.currentTarget})};BX.Call.View.prototype._onMicrophoneButtonClick=function(e){if("stopPropagation"in e){e.stopPropagation()}this.eventEmitter.emit(s.onButtonClick,{buttonName:"toggleMute",muted:!this.isMuted})};BX.Call.View.prototype._onMicrophoneArrowClick=function(e){e.stopPropagation();this.showDeviceSelector(e.currentTarget)};BX.Call.View.prototype._onMicrophoneSelected=function(e){if(e.data.deviceId===this.microphoneId){return}this.eventEmitter.emit(s.onReplaceMicrophone,{deviceId:e.data.deviceId})};BX.Call.View.prototype._onCameraButtonClick=function(e){if("stopPropagation"in e){e.stopPropagation()}this.eventEmitter.emit(s.onButtonClick,{buttonName:"toggleVideo",video:!this.isCameraOn})};BX.Call.View.prototype._onCameraArrowClick=function(e){e.stopPropagation();this.showDeviceSelector(e.currentTarget)};BX.Call.View.prototype._onCameraSelected=function(e){if(e.data.deviceId===this.cameraId){return}this.eventEmitter.emit(s.onReplaceCamera,{deviceId:e.data.deviceId})};BX.Call.View.prototype._onSpeakerButtonClick=function(e){this.muteSpeaker(!this.speakerMuted)};BX.Call.View.prototype._onChangeHdVideo=function(e){this.eventEmitter.emit(s.onChangeHdVideo,e.data)};BX.Call.View.prototype._onChangeMicAutoParams=function(e){this.eventEmitter.emit(s.onChangeMicAutoParams,e.data)};BX.Call.View.prototype._onChangeFaceImprove=function(e){this.eventEmitter.emit(s.onChangeFaceImprove,e.data)};BX.Call.View.prototype._onSpeakerSelected=function(e){this.setSpeakerId(e.data.deviceId);this.eventEmitter.emit(s.onReplaceSpeaker,{deviceId:e.data.deviceId})};BX.Call.View.prototype._onScreenButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"toggleScreenSharing",node:e.target})};BX.Call.View.prototype._onChatButtonClick=function(e){this.hintManager.hide();e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"showChat",node:e.target})};BX.Call.View.prototype._onUsersButtonClick=function(e){this.hintManager.hide();e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"toggleUsers",node:e.target})};BX.Call.View.prototype._onMobileMenuButtonClick=function(e){e.stopPropagation();this.showCallMenu()};BX.Call.View.prototype._onFloorRequestButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"floorRequest",node:e.target})};BX.Call.View.prototype._onMoreButtonClick=function(e){e.stopPropagation();if(this.overflownButtonsPopup){this.overflownButtonsPopup.close();this.buttons.more.setActive(false)}else{this.showOverflownButtonsPopup();this.buttons.more.setActive(true)}};BX.Call.View.prototype._onHistoryButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"showHistory",node:e.target})};BX.Call.View.prototype._onHangupButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"hangup",node:e.target})};BX.Call.View.prototype._onCloseButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"close",node:e.target})};BX.Call.View.prototype._onFullScreenButtonClick=function(e){e.stopPropagation();this.eventEmitter.emit(s.onButtonClick,{buttonName:"fullscreen",node:e.target})};BX.Call.View.prototype._onParticipantsButtonListClick=function(e){if(!this.isButtonBlocked("users")){this._onUsersButtonClick(e);return}if(!this.isFullScreen){return}this.setUserBlockFolded(!this.isUserBlockFolded)};BX.Call.View.prototype._onParticipantsListButtonClick=function(e){e.stopPropagation();var t=new BX.Event.BaseEvent({data:{buttonName:"participantsList",node:e.target},compatData:["participantsList",e.target]});this.eventEmitter.emit(s.onButtonClick,t);if(t.isDefaultPrevented()){return}x.create({parentElement:e.currentTarget,userList:Object.values(this.users),current:this.centralUser.id,onSelect:function(e){this.setCentralUser(e)}.bind(this)}).show()};BX.Call.View.prototype._onParticipantsButtonMobileListClick=function(e){this.showParticipantsMenu()};BX.Call.View.prototype._onMobileCallMenuFloorRequestClick=function(){this.callMenu.close();this.eventEmitter.emit(s.onButtonClick,{buttonName:"floorRequest"})};BX.Call.View.prototype._onMobileCallMenShowParticipantsClick=function(){this.callMenu.close();this.showParticipantsMenu()};BX.Call.View.prototype._onMobileCallMenuCopyInviteClick=function(){this.callMenu.close();this.eventEmitter.emit(s.onButtonClick,{buttonName:"share",node:null})};BX.Call.View.prototype.showRenameSlider=function(){if(!this.renameSlider){this.renameSlider=new v({parent:this.elements.root,content:this.renderRenameSlider(),onClose:function(){this.renameSlider.destroy()}.bind(this),onDestroy:function(){this.renameSlider=null}.bind(this)})}this.renameSlider.show();setTimeout(function(){this.elements.renameSlider.input.focus();this.elements.renameSlider.input.select()}.bind(this),400)};BX.Call.View.prototype.renderRenameSlider=function(){return BX.create("div",{props:{className:"bx-videocall-mobile-rename-slider-wrap"},children:[BX.create("div",{props:{className:"bx-videocall-mobile-rename-slider-title"},text:BX.message("IM_M_CALL_MOBILE_MENU_CHANGE_MY_NAME")}),this.elements.renameSlider.input=BX.create("input",{props:{className:"bx-videocall-mobile-rename-slider-input"},attrs:{type:"text",value:this.localUser.userModel.name}}),this.elements.renameSlider.button=BX.create("button",{props:{className:"bx-videocall-mobile-rename-slider-button ui-btn ui-btn-md ui-btn-primary"},text:BX.message("IM_M_CALL_MOBILE_RENAME_CONFIRM"),events:{click:this._onMobileUserRename.bind(this)}})]})};BX.Call.View.prototype._onMobileUserRename=function(e){e.stopPropagation();var t=this.elements.renameSlider.input.value;var s=t.trim();var i=true;if(s===this.localUser.userModel.name||s===""){i=false}if(i){this.toggleRenameSliderInputLoader();this._onUserRename(s)}else{this.renameSlider.close()}};BX.Call.View.prototype._onMobileCallMenuCancelClick=function(){this.callMenu.close()};BX.Call.View.prototype._onLeftEarClick=function(){this.pinUser(this.getLeftUser(this.centralUser.id))};BX.Call.View.prototype._onRightEarClick=function(){this.pinUser(this.getRightUser(this.centralUser.id))};BX.Call.View.prototype._onLeftPageNavigatorClick=function(e){e.stopPropagation();this.setCurrentPage(this.currentPage-1)};BX.Call.View.prototype._onRightPageNavigatorClick=function(e){e.stopPropagation();this.setCurrentPage(this.currentPage+1)};BX.Call.View.prototype.setMaxWidth=function(t){if(this.maxWidth!==t){var s=650;if(t<s&&(!this.maxWidth||this.maxWidth>s)&&this.layout===e.Centered){this.setLayout(e.Grid)}var i=this.maxWidth===null;this.maxWidth=t;if(this.size!==BX.Call.View.Size.Folded){this._applyMaxWidth(i)}}};BX.Call.View.prototype.removeMaxWidth=function(){this.setMaxWidth(null)};BX.Call.View.prototype._applyMaxWidth=function(e){var t=this.container.getBoundingClientRect();if(this.maxWidth!==null){if(!this.elements.root.style.maxWidth&&e){this.elements.root.style.maxWidth=t.width+"px"}setTimeout(function(){this.elements.root.style.maxWidth=Math.max(this.maxWidth,a)+"px"}.bind(this),0)}else{this.elements.root.style.maxWidth=t.width+"px";this.elements.root.addEventListener("transitionend",function(){this.elements.root.style.removeProperty("max-width")}.bind(this),{once:true})}};BX.Call.View.prototype.releaseLocalMedia=function(){this.localUser.releaseStream();if(this.centralUser.id==this.userId){this.centralUser.releaseStream()}};BX.Call.View.prototype.destroy=function(){if(this.overflownButtonsPopup){this.overflownButtonsPopup.close()}if(this.elements.root){BX.cleanNode(this.elements.root,true);this.elements.root=null}this.visible=false;window.removeEventListener("webkitfullscreenchange",this._onFullScreenChangeHandler);window.removeEventListener("mozfullscreenchange",this._onFullScreenChangeHandler);window.removeEventListener("orientationchange",this._onOrientationChangeHandler);window.removeEventListener("keydown",this._onKeyDownHandler);window.removeEventListener("keyup",this._onKeyUpHandler);this.resizeObserver.disconnect();this.resizeObserver=null;if(this.intersectionObserver){this.intersectionObserver.disconnect();this.intersectionObserver=null}for(var e in this.users){if(this.users.hasOwnProperty(e)){this.users[e].destroy()}}this.userData=null;this.centralUser.destroy();this.hintManager.hide();this.hintManager=null;clearTimeout(this.switchPresenterTimeout);if(this.buttons.recordStatus){this.buttons.recordStatus.stopViewUpdate()}this.recordState=this.getDefaultRecordState();this.buttons=null;this.eventEmitter.emit(s.onDestroy);this.eventEmitter.unsubscribeAll()};var p=function(e){this.parentContainer=e.parentContainer;this.userModel=e.userModel;this.allowBackgroundItem=BX.prop.getBoolean(e,"allowBackgroundItem",true);this.userModel.subscribe("changed",this._onUserFieldChanged.bind(this));this.incomingVideoConstraints={width:0,height:0};this._allowPinButton=BX.prop.getBoolean(e,"allowPinButton",true);this._visible=true;this.screenSharingUser=BX.prop.getBoolean(e,"screenSharingUser",false);Object.defineProperty(this,"allowPinButton",{get:function(){return this._allowPinButton},set:function(e){if(this._allowPinButton==e){return}this._allowPinButton=e;this.update()}});Object.defineProperty(this,"id",{get:function(){return this.userModel.id}});this._audioTrack=e.audioTrack;this._audioStream=this._audioTrack?new MediaStream([this._audioTrack]):null;Object.defineProperty(this,"audioTrack",{get:function(){return this._audioTrack},set:function(e){if(this._audioTrack===e){return}this._audioTrack=e;this._audioStream=this._audioTrack?new MediaStream([this._audioTrack]):null;this.playAudio()}});Object.defineProperty(this,"audioStream",{get:function(){return this._audioStream}});this._videoTrack=e.videoTrack;this._stream=this._videoTrack?new MediaStream([this._videoTrack]):null;Object.defineProperty(this,"videoTrack",{get:function(){return this._videoTrack},set:function(e){if(this._videoTrack===e){return}this._videoTrack=e;this._stream=this._videoTrack?new MediaStream([this._videoTrack]):null;this.update()}});Object.defineProperty(this,"stream",{get:function(){return this._stream}});this._videoRenderer=null;Object.defineProperty(this,"videoRenderer",{get:function(){return this._videoRenderer},set:function(e){this._videoRenderer=e;this.update();this.updateRendererState()}});this._flipVideo=false;Object.defineProperty(this,"flipVideo",{get:function(){return this._flipVideo},set:function(e){this._flipVideo=e;this.update()}});Object.defineProperty(this,"visible",{get:function(){return this._visible},set:function(e){if(this._visible!==e){console.warn("user "+this.id+" is "+(e?"visible":"invisible"));this._visible=e;this.update();this.updateRendererState()}}});this.hidden=false;this.videoBlurState=false;this.isChangingName=false;this.elements={root:null,container:null,videoContainer:null,video:null,audio:e.audioElement||null,videoBorder:null,avatarContainer:null,avatar:null,nameContainer:null,name:null,changeNameIcon:null,changeNameContainer:null,changeNameCancel:null,changeNameInput:null,changeNameConfirm:null,introduceYourselfContainer:null,floorRequest:null,state:null,removeButton:null,micState:null,cameraState:null,panel:null,buttonMenu:null,buttonBackground:null,buttonPin:null,buttonUnPin:null};this.menu=null;this.callBacks={onClick:BX.type.isFunction(e.onClick)?e.onClick:BX.DoNothing,onUserRename:BX.type.isFunction(e.onUserRename)?e.onUserRename:BX.DoNothing,onUserRenameInputFocus:BX.type.isFunction(e.onUserRenameInputFocus)?e.onUserRenameInputFocus:BX.DoNothing,onUserRenameInputBlur:BX.type.isFunction(e.onUserRenameInputBlur)?e.onUserRenameInputBlur:BX.DoNothing,onPin:BX.type.isFunction(e.onPin)?e.onPin:BX.DoNothing,onUnPin:BX.type.isFunction(e.onUnPin)?e.onUnPin:BX.DoNothing};this.checkAspectInterval=setInterval(this.checkVideoAspect.bind(this),500)};p.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-user"},dataset:{userId:this.userModel.id,order:this.userModel.order},children:[this.elements.videoBorder=BX.create("div",{props:{className:"bx-messenger-videocall-user-border"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-talking-icon"}})]}),this.elements.container=BX.create("div",{props:{className:"bx-messenger-videocall-user-inner"},children:[this.elements.avatarBackground=BX.create("div",{props:{className:"bx-messenger-videocall-user-avatar-background"}}),this.elements.avatarContainer=BX.create("div",{props:{className:"bx-messenger-videocall-user-avatar-border"},children:[this.elements.avatar=BX.create("div",{props:{className:"bx-messenger-videocall-user-avatar"}}),BX.create("div",{props:{className:"bx-messenger-videocall-user-avatar-overlay-border"}})]}),this.elements.panel=BX.create("div",{props:{className:"bx-messenger-videocall-user-panel"}}),this.elements.state=BX.create("div",{props:{className:"bx-messenger-videocall-user-status-text"},text:this.getStateMessage(this.userModel.state)}),BX.create("div",{props:{className:"bx-messenger-videocall-user-bottom"},children:[this.elements.nameContainer=BX.create("div",{props:{className:"bx-messenger-videocall-user-name-container"+(this.userModel.allowRename&&!this.userModel.wasRenamed?" hidden":"")},children:[this.elements.micState=BX.create("div",{props:{className:"bx-messenger-videocall-user-device-state mic"+(this.userModel.microphoneState?" hidden":"")}}),this.elements.cameraState=BX.create("div",{props:{className:"bx-messenger-videocall-user-device-state camera"+(this.userModel.cameraState?" hidden":"")}}),this.elements.name=BX.create("span",{props:{className:"bx-messenger-videocall-user-name"},text:this.screenSharingUser?BX.message("IM_CALL_USERS_SCREEN").replace("#NAME#",this.userModel.name):this.userModel.name}),this.elements.changeNameIcon=BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-icon hidden"}})],events:{click:this.toggleNameInput.bind(this)}}),this.elements.changeNameContainer=BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-container hidden"},children:[this.elements.changeNameCancel=BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-cancel"},events:{click:this.toggleNameInput.bind(this)}}),this.elements.changeNameInput=BX.create("input",{props:{className:"bx-messenger-videocall-user-change-name-input"},attrs:{type:"text",value:this.userModel.name},events:{keydown:this.onNameInputKeyDown.bind(this),focus:this.callBacks.onUserRenameInputFocus,blur:this.callBacks.onUserRenameInputBlur}}),this.elements.changeNameConfirm=BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-confirm"},events:{click:this.changeName.bind(this)}}),this.elements.changeNameLoader=BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-loader hidden"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-change-name-loader-icon"}})]})]}),this.elements.introduceYourselfContainer=BX.create("div",{props:{className:"bx-messenger-videocall-user-introduce-yourself-container"+(!this.userModel.allowRename||this.userModel.wasRenamed?" hidden":"")},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-introduce-yourself-text"},text:BX.message("IM_CALL_GUEST_INTRODUCE_YOURSELF")})],events:{click:this.toggleNameInput.bind(this)}})]}),this.elements.floorRequest=BX.create("div",{props:{className:"bx-messenger-videocall-user-floor-request bx-messenger-videocall-floor-request-icon"}})]})],style:{order:this.userModel.order},events:{click:function(e){e.stopPropagation();this.callBacks.onClick({userId:this.id})}.bind(this)}});if(this.userModel.talking){this.elements.root.classList.add("bx-messenger-videocall-user-talking")}if(this.userModel.localUser){this.elements.root.classList.add("bx-messenger-videocall-user-self")}if(this.userModel.avatar!==""){this.elements.root.style.setProperty("--avatar","url('"+this.userModel.avatar+"')")}else{this.elements.root.style.removeProperty("--avatar")}this.elements.videoContainer=BX.create("div",{props:{className:"bx-messenger-videocall-video-container"},children:[this.elements.video=BX.create("video",{props:{className:"bx-messenger-videocall-video",volume:0,autoplay:true},attrs:{playsinline:true,muted:true}})]});this.elements.container.appendChild(this.elements.videoContainer);if(this.stream&&this.stream.active){this.elements.video.srcObject=this.stream}if(this.flipVideo){this.elements.video.classList.add("bx-messenger-videocall-video-flipped")}if(this.userModel.screenState){this.elements.video.classList.add("bx-messenger-videocall-video-contain")}if(this.userModel.cameraState&&this.userModel.microphoneState){this.elements.nameContainer.classList.add("extra-padding")}this.elements.buttonBackground=BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-icon background"}}),BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-text"},text:BX.message("IM_CALL_CHANGE_BACKGROUND")})],events:{click:function(){BX.Call.Hardware.BackgroundDialog.open()}}});this.elements.buttonMenu=BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-icon menu"}})],events:{click:this.showMenu.bind(this)}});this.elements.buttonPin=BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-icon pin"}}),BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-text"},text:BX.message("IM_CALL_PIN")})],events:{click:function(e){e.stopPropagation();this.callBacks.onPin({userId:this.userModel.id})}.bind(this)}});this.elements.buttonUnPin=BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-icon unpin"}}),BX.create("div",{props:{className:"bx-messenger-videocall-user-panel-button-text"},text:BX.message("IM_CALL_UNPIN")})],events:{click:function(e){e.stopPropagation();this.callBacks.onUnPin()}.bind(this)}});this.updatePanelDeferred();return this.elements.root};p.prototype.setIncomingVideoConstraints=function(e,t){this.incomingVideoConstraints.width=typeof e==="undefined"?this.incomingVideoConstraints.width:e;this.incomingVideoConstraints.height=typeof t==="undefined"?this.incomingVideoConstraints.height:t;if(!this.videoRenderer){return}if(this.incomingVideoConstraints.width>=320&&this.incomingVideoConstraints.width<=640){this.incomingVideoConstraints.width=640}if(this.incomingVideoConstraints.height>=180&&this.incomingVideoConstraints.height<=360){this.incomingVideoConstraints.height=360}this.videoRenderer.requestVideoSize(this.incomingVideoConstraints.width,this.incomingVideoConstraints.height)};p.prototype.updateRendererState=function(){if(this.elements.video&&this.elements.video.srcObject){if(this.visible){this.elements.video.play()}else{this.elements.video.pause()}}};p.prototype._onUserFieldChanged=function(e){var t=e.data;switch(t.fieldName){case"id":return this.updateId();case"name":return this.updateName();case"avatar":return this.updateAvatar();case"state":return this.updateState();case"talking":return this.updateTalking();case"microphoneState":return this.updateMicrophoneState();case"cameraState":return this.updateCameraState();case"videoPaused":return this.updateVideoPaused();case"floorRequestState":return this.updateFloorRequestState();case"screenState":return this.updateScreenState();case"pinned":return this.updatePanel();case"allowRename":return this.updateRenameAllowed();case"wasRenamed":return this.updateWasRenamed();case"renameRequested":return this.updateRenameRequested();case"order":return this.updateOrder()}};p.prototype.toggleRenameIcon=function(){if(!this.userModel.allowRename){return}this.elements.changeNameIcon.classList.toggle("hidden")};p.prototype.toggleNameInput=function(e){if(!this.userModel.allowRename||!this.elements.root){return}e.stopPropagation();if(this.isChangingName){this.isChangingName=false;if(!this.userModel.wasRenamed){this.elements.introduceYourselfContainer.classList.remove("hidden");this.elements.changeNameContainer.classList.add("hidden")}else{this.elements.changeNameContainer.classList.add("hidden");this.elements.nameContainer.classList.remove("hidden")}}else{if(!this.userModel.wasRenamed){this.elements.introduceYourselfContainer.classList.add("hidden")}this.isChangingName=true;this.elements.nameContainer.classList.add("hidden");this.elements.changeNameContainer.classList.remove("hidden");this.elements.changeNameInput.value=this.userModel.name;this.elements.changeNameInput.focus();this.elements.changeNameInput.select()}};p.prototype.onNameInputKeyDown=function(e){if(!this.userModel.allowRename){return}if(e.keyCode===13){this.changeName(e)}else if(e.keyCode===27){this.toggleNameInput(e)}};p.prototype.onNameInputFocus=function(e){};p.prototype.onNameInputBlur=function(e){};p.prototype.changeName=function(e){e.stopPropagation();var t=this.elements.changeNameInput.value;var s=t.trim();var i=true;if(s===this.userModel.name||s===""){i=false}if(i){this.elements.changeNameConfirm.classList.toggle("hidden");this.elements.changeNameLoader.classList.toggle("hidden");this.callBacks.onUserRename(s)}else{this.toggleNameInput(e)}};p.prototype.showMenu=function(){var e=[];if(this.userModel.localUser&&this.allowBackgroundItem){e.push({text:BX.message("IM_CALL_CHANGE_BACKGROUND"),onclick:function(){this.menu.close();BX.Call.Hardware.BackgroundDialog.open()}.bind(this)})}if(e.length===0){return}this.menu=BX.PopupMenu.create("call-view-user-menu-"+this.userModel.id,this.elements.buttonMenu,e,{targetContainer:this.parentContainer,autoHide:true,closeByEsc:true,offsetTop:0,offsetLeft:0,bindOptions:{position:"bottom"},angle:{position:"top"},overlay:{backgroundColor:"white",opacity:0},events:{onPopupClose:function(){this.menu.popupWindow.destroy();BX.PopupMenu.destroy("call-view-select-device"+this.userModel.id)}.bind(this),onPopupDestroy:function(){this.menu=null}.bind(this)}});this.menu.popupWindow.show()};p.prototype.updateAvatar=function(){if(this.elements.root){if(this.userModel.avatar!==""){this.elements.root.style.setProperty("--avatar","url('"+this.userModel.avatar+"')")}else{this.elements.root.style.removeProperty("--avatar")}}};p.prototype.updateId=function(){if(this.elements.root){this.elements.root.dataset.userId=this.userModel.id}};p.prototype.updateName=function(){if(this.isChangingName){this.isChangingName=false;this.elements.changeNameConfirm.classList.toggle("hidden");this.elements.changeNameLoader.classList.toggle("hidden");this.elements.changeNameContainer.classList.add("hidden");this.elements.nameContainer.classList.remove("hidden")}if(this.elements.name){this.elements.name.innerText=this.screenSharingUser?BX.message("IM_CALL_USERS_SCREEN").replace("#NAME#",this.userModel.name):this.userModel.name}};p.prototype.updateRenameAllowed=function(){if(this.userModel.allowRename&&this.elements.nameContainer&&this.elements.introduceYourselfContainer){this.elements.nameContainer.classList.add("hidden");this.elements.introduceYourselfContainer.classList.remove("hidden")}};p.prototype.updateWasRenamed=function(){if(!this.elements.root){return}if(this.userModel.allowRename){this.elements.introduceYourselfContainer.classList.add("hidden");this.elements.changeNameIcon.classList.remove("hidden");if(this.elements.changeNameContainer.classList.contains("hidden")){this.elements.nameContainer.classList.remove("hidden")}}};p.prototype.updateRenameRequested=function(){if(this.userModel.allowRename){this.elements.introduceYourselfContainer.classList.add("hidden")}};p.prototype.updateOrder=function(){if(this.elements.root){this.elements.root.dataset.order=this.userModel.order;this.elements.root.style.order=this.userModel.order}};p.prototype.updatePanelDeferred=function(){setTimeout(this.updatePanel.bind(this),0)};p.prototype.updatePanel=function(){if(!this.isMounted()){return}var e=this.elements.root.offsetWidth;BX.clean(this.elements.panel);if(this.userModel.localUser&&this.allowBackgroundItem){if(e>250){this.elements.panel.appendChild(this.elements.buttonBackground)}else{this.elements.panel.appendChild(this.elements.buttonMenu)}}if(!this.userModel.localUser&&this.allowPinButton){if(this.userModel.pinned){this.elements.panel.appendChild(this.elements.buttonUnPin)}else{this.elements.panel.appendChild(this.elements.buttonPin)}if(e>250){this.elements.buttonPin.classList.remove("no-text");this.elements.buttonUnPin.classList.remove("no-text")}else{this.elements.buttonPin.classList.add("no-text");this.elements.buttonUnPin.classList.add("no-text")}}};p.prototype.update=function(){if(!this.elements.root){return}if(this.hasVideo()){if(this.videoRenderer){this.videoRenderer.render(this.elements.video)}else if(this.elements.video.srcObject!=this.stream){this.elements.video.srcObject=this.stream}BX.remove(this.elements.avatarContainer);if(this.flipVideo){this.elements.video.classList.add("bx-messenger-videocall-video-flipped")}else{this.elements.video.classList.remove("bx-messenger-videocall-video-flipped")}if(this.userModel.screenState){this.elements.video.classList.add("bx-messenger-videocall-video-contain")}else{this.elements.video.classList.remove("bx-messenger-videocall-video-contain")}}else{this.elements.video.srcObject=null;this.elements.container.insertBefore(this.elements.avatarContainer,this.elements.panel)}this.updatePanelDeferred()};p.prototype.playAudio=function(){if(!this.audioStream){this.elements.audio.srcObject=null;return}if(this.speakerId&&this.elements.audio.setSinkId){this.elements.audio.setSinkId(this.speakerId).then(function(){this.elements.audio.srcObject=this.audioStream;this.elements.audio.play().catch(T)}.bind(this)).catch(console.error)}else{this.elements.audio.srcObject=this.audioStream;this.elements.audio.play().catch(T)}};p.prototype.playVideo=function(){if(this.elements.video){this.elements.video.play().catch(T)}};p.prototype.blurVideo=function(e){e=!!e;if(this.videoBlurState==e){return}this.videoBlurState=e;if(this.elements.video){this.elements.video.classList.toggle("bx-messenger-videocall-video-blurred")}};p.prototype.getStateMessage=function(e,t){switch(e){case BX.Call.UserState.Idle:return"";case BX.Call.UserState.Calling:return BX.message("IM_M_CALL_STATUS_WAIT_ANSWER");case BX.Call.UserState.Declined:return BX.message("IM_M_CALL_STATUS_DECLINED");case BX.Call.UserState.Ready:case BX.Call.UserState.Connecting:return BX.message("IM_M_CALL_STATUS_WAIT_CONNECT");case BX.Call.UserState.Connected:return t?BX.message("IM_M_CALL_STATUS_VIDEO_PAUSED"):"";case BX.Call.UserState.Failed:return BX.message("IM_M_CALL_STATUS_CONNECTION_ERROR");case BX.Call.UserState.Unavailable:return BX.message("IM_M_CALL_STATUS_UNAVAILABLE");default:return""}};p.prototype.mount=function(e,t){t=t===true;if(!this.elements.root){this.render()}if(this.isMounted()&&this.elements.root.parentElement==e&&!t){this.updatePanelDeferred();return false}e.appendChild(this.elements.root);this.update()};p.prototype.dismount=function(){if(!this.isMounted()){return false}this.elements.video.srcObject=null;BX.remove(this.elements.root)};p.prototype.isMounted=function(){return!!(this.elements.root&&this.elements.root.parentElement)};p.prototype.updateState=function(){if(!this.elements.root){return}if(this.userModel.state==BX.Call.UserState.Calling||this.userModel.state==BX.Call.UserState.Connecting){this.elements.avatar.classList.add("bx-messenger-videocall-user-avatar-pulse")}else{this.elements.avatar.classList.remove("bx-messenger-videocall-user-avatar-pulse")}this.elements.state.innerText=this.getStateMessage(this.userModel.state,this.userModel.videoPaused);this.update()};p.prototype.updateTalking=function(){if(!this.elements.root){return}if(this.userModel.talking){this.elements.root.classList.add("bx-messenger-videocall-user-talking")}else{this.elements.root.classList.remove("bx-messenger-videocall-user-talking")}};p.prototype.updateMicrophoneState=function(){if(!this.elements.root){return}if(this.userModel.microphoneState){this.elements.micState.classList.add("hidden")}else{this.elements.micState.classList.remove("hidden")}if(this.userModel.cameraState&&this.userModel.microphoneState){this.elements.nameContainer.classList.add("extra-padding")}else{this.elements.nameContainer.classList.remove("extra-padding")}};p.prototype.updateCameraState=function(){if(!this.elements.root){return}if(this.userModel.cameraState){this.elements.cameraState.classList.add("hidden")}else{this.elements.cameraState.classList.remove("hidden")}if(this.userModel.cameraState&&this.userModel.microphoneState){this.elements.nameContainer.classList.add("extra-padding")}else{this.elements.nameContainer.classList.remove("extra-padding")}};p.prototype.updateVideoPaused=function(){if(!this.elements.root){return}if(this.stream&&this.hasVideo()){this.blurVideo(this.userModel.videoPaused)}this.updateState()};p.prototype.updateFloorRequestState=function(){if(!this.elements.floorRequest){return}if(this.userModel.floorRequestState){this.elements.floorRequest.classList.add("active")}else{this.elements.floorRequest.classList.remove("active")}};p.prototype.updateScreenState=function(){if(!this.elements.video){return}if(this.userModel.screenState){this.elements.video.classList.add("bx-messenger-videocall-video-contain")}else{this.elements.video.classList.remove("bx-messenger-videocall-video-contain")}};p.prototype.hide=function(){if(!this.elements.root){return}this.elements.root.dataset.hidden=1};p.prototype.show=function(){if(!this.elements.root){return}delete this.elements.root.dataset.hidden};p.prototype.hasVideo=function(){return this.userModel.state==BX.Call.UserState.Connected&&(!!this._videoTrack||!!this._videoRenderer)};p.prototype.checkVideoAspect=function(){if(!this.elements.video){return}if(this.elements.video.videoHeight>this.elements.video.videoWidth){this.elements.video.classList.add("bx-messenger-videocall-video-vertical")}else{this.elements.video.classList.remove("bx-messenger-videocall-video-vertical")}};p.prototype.releaseStream=function(){if(this.elements.video){this.elements.video.srcObject=null}this.videoTrack=null};p.prototype.destroy=function(){this.releaseStream();clearInterval(this.checkAspectInterval);clearInterval(this.checkResolutionInterval)};var m=function(e){this.userModel=e.userModel;this.elements={root:null,avatar:null,avatarOutline:null,userName:null,userStatus:null,menuArrow:null,floorRequest:null,mic:null,cam:null};this._onUserFieldChangeHandler=this._onUserFieldChange.bind(this);this.userModel.subscribe("changed",this._onUserFieldChangeHandler);this.callbacks={onClick:BX.prop.getFunction(e,"onClick",BX.DoNothing)}};m.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile"},children:[this.elements.avatar=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-avatar"+(this.userModel.talking?" talking":"")},children:[this.elements.floorRequest=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-floor-request bx-messenger-videocall-floor-request-icon"}})]}),BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-body"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-text"},children:[this.elements.mic=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-icon"+(this.userModel.microphoneState?"":" bx-call-view-icon-red-microphone-off")}}),this.elements.cam=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-icon"+(this.userModel.cameraState?"":" bx-call-view-icon-red-camera-off")}}),this.elements.userName=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-username"},text:this.userModel.name}),BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-menu-arrow"}})]}),this.elements.userStatus=BX.create("div",{props:{className:"bx-messenger-videocall-user-mobile-user-status"},text:this.userModel.pinned?BX.message("IM_M_CALL_PINNED_USER"):BX.message("IM_M_CALL_CURRENT_PRESENTER")})]})],events:{click:this.callbacks.onClick}});return this.elements.root};m.prototype.update=function(){if(!this.elements.root){return}this.elements.userName.innerText=this.userModel.name;if(this.userModel.avatar!==""){this.elements.root.style.setProperty("--avatar","url('"+this.userModel.avatar+"')")}else{this.elements.root.style.removeProperty("--avatar")}this.userModel.talking?this.elements.avatar.classList.add("talking"):this.elements.avatar.classList.remove("talking");this.userModel.floorRequestState?this.elements.floorRequest.classList.add("active"):this.elements.floorRequest.classList.remove("active");this.userModel.microphoneState?this.elements.mic.classList.remove("bx-call-view-icon-red-microphone-off"):this.elements.mic.classList.add("bx-call-view-icon-red-microphone-off");this.userModel.cameraState?this.elements.cam.classList.remove("bx-call-view-icon-red-camera-off"):this.elements.cam.classList.add("bx-call-view-icon-red-camera-off");this.elements.userStatus.innerText=this.userModel.pinned?BX.message("IM_M_CALL_PINNED_USER"):BX.message("IM_M_CALL_CURRENT_PRESENTER")};m.prototype.mount=function(e){e.appendChild(this.render())};m.prototype.dismount=function(){if(!this.elements.root){return}BX.remove(this.elements.root)};m.prototype.setUserModel=function(e){this.userModel.unsubscribe("changed",this._onUserFieldChangeHandler);this.userModel=e;this.userModel.subscribe("changed",this._onUserFieldChangeHandler);this.update()};m.prototype._onUserFieldChange=function(e){this.update()};var f=function(e){this.userRegistry=e.userRegistry;this.userRegistry.subscribe("userAdded",this._onUserAdded.bind(this));this.userRegistry.subscribe("userChanged",this._onUserChanged.bind(this));this.elements={root:null,users:{}}};f.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-user-selector-mobile"}});this.updateUsers();return this.elements.root};f.prototype.renderUser=function(e){return P("svg",{attrNS:{width:14.5,height:11.6},style:{order:e.order},children:[P("circle",{attrNS:{class:"bx-messenger-videocall-user-selector-mobile-border"+(e.talking?" talking":""),cx:7.25,cy:5.8,r:4.6}}),P("circle",{attrNS:{class:"bx-messenger-videocall-user-selector-mobile-dot"+(e.centralUser?" pinned":""),cx:7.25,cy:5.8,r:3.3}})]})};f.prototype.updateUsers=function(){this.userRegistry.users.forEach((function(e){if(e.localUser||e.state!=BX.Call.UserState.Connected){if(this.elements.users[e.id]){BX.remove(this.elements.users[e.id]);this.elements.users[e.id]=null}}else{var t=this.renderUser(e);if(this.elements.users[e.id]){BX.replace(this.elements.users[e.id],t)}else{this.elements.root.appendChild(t)}this.elements.users[e.id]=t}}),this)};f.prototype._onUserAdded=function(e){this.updateUsers()};f.prototype._onUserChanged=function(e){this.updateUsers()};f.prototype.mount=function(e){e.appendChild(this.render())};f.prototype.dismount=function(){if(!this.elements.root){return}BX.remove(this.elements.root)};var v=function(e){this.parent=e.parent||null;this.content=e.content||null;this.elements={background:null,root:null,handle:null,body:null};this.callbacks={onClose:BX.prop.getFunction(e,"onClose",BX.DoNothing),onDestroy:BX.prop.getFunction(e,"onDestroy",BX.DoNothing)};this.touchStartY=0;this.processedTouchId=0};v.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.background=BX.create("div",{props:{className:"bx-videocall-mobile-menu-background"},events:{click:this._onBackgroundClick.bind(this)}});this.elements.root=BX.create("div",{props:{className:"bx-videocall-mobile-menu-container"},children:[this.elements.handle=BX.create("div",{props:{className:"bx-videocall-mobile-menu-handle"}}),this.elements.body=BX.create("div",{props:{className:"bx-videocall-mobile-menu"},children:[this.content]})],events:{touchstart:this._onTouchStart.bind(this),touchmove:this._onTouchMove.bind(this),touchend:this._onTouchEnd.bind(this)}});return this.elements.root};v.prototype.show=function(){if(this.parent){this.render();this.parent.appendChild(this.elements.root);this.parent.appendChild(this.elements.background)}};v.prototype.close=function(){BX.remove(this.elements.root);BX.remove(this.elements.background);this.callbacks.onClose()};v.prototype.closeWithAnimation=function(){if(!this.elements.root){return}this.elements.root.classList.add("closing");this.elements.background.classList.add("closing");this.elements.root.addEventListener("animationend",function(){this.close()}.bind(this))};v.prototype._onTouchStart=function(e){this.touchStartY=e.pageY;if(this.processedTouchId||e.touches.length>1){return}if(e.target==this.elements.header||e.target==this.elements.root||this.elements.body.scrollTop===0){this.processedTouchId=e.touches[0].identifier}};v.prototype._onTouchMove=function(e){if(e.touches.length>1){return}if(e.touches[0].identifier!=this.processedTouchId){return}var t=this.touchStartY-e.pageY;if(t>0){t=0}this.elements.root.style.bottom=t+"px";if(t){e.preventDefault()}};v.prototype._onTouchEnd=function(e){var t=false;for(var s=0;s<e.changedTouches.length;s++){if(e.changedTouches[s].identifier==this.processedTouchId){t=true;break}}if(!t){return}var i=e.pageY-this.touchStartY;if(i>100){this.closeWithAnimation();e.preventDefault()}else{this.elements.root.style.removeProperty("bottom")}this.processedTouchId=0;this.touchStartY=0};v.prototype.destroy=function(){this.callbacks.onDestroy();this.elements={};this.callbacks={};this.parent=null};v.prototype._onBackgroundClick=function(){this.closeWithAnimation()};var g=function(e){this.parent=e.parent||null;this.header=BX.prop.getString(e,"header","");this.largeIcons=BX.prop.getBoolean(e,"largeIcons",false);this.slider=null;var t=BX.prop.getArray(e,"items",[]);if(t.length===0){throw Error("Items array should not be empty")}this.items=t.filter((function(e){return typeof e==="object"&&!!e})).map((function(e){return new b(e)}));this.elements={root:null,header:null,body:null};this.callbacks={onClose:BX.prop.getFunction(e,"onClose",BX.DoNothing),onDestroy:BX.prop.getFunction(e,"onDestroy",BX.DoNothing)}};g.prototype.render=function(){this.elements.header=BX.create("div",{props:{className:"bx-videocall-mobile-menu-header"},text:this.header});this.elements.body=BX.create("div",{props:{className:"bx-videocall-mobile-menu-body"+(this.largeIcons?" bx-videocall-mobile-menu-large":"")}});this.items.forEach((function(e){if(e){this.elements.body.appendChild(e.render())}}),this);return BX.createFragment([this.elements.header,this.elements.body])};g.prototype.setHeader=function(e){this.header=e;if(this.elements.header){this.elements.header.innerText=e}};g.prototype.show=function(){if(!this.slider){this.slider=new v({parent:this.parent,content:this.render(),onClose:this.onSliderClose.bind(this),onDestroy:this.onSliderDestroy.bind(this)})}this.slider.show()};g.prototype.close=function(){if(this.slider){this.slider.close()}};g.prototype.onSliderClose=function(){this.slider.destroy()};g.prototype.onSliderDestroy=function(){this.slider=null;this.destroy()};g.prototype.destroy=function(){if(this.slider){this.slider.destroy()}this.slider=null;this.items.forEach((function(e){e.destroy()}));this.items=[];this.callbacks.onDestroy();this.elements={};this.callbacks={};this.parent=null};var b=function(e){this.id=BX.prop.getString(e,"id",BX.Call.Util.getUuidv4());this.icon=BX.prop.getString(e,"icon","");this.iconClass=BX.prop.getString(e,"iconClass","");this.text=BX.prop.getString(e,"text","");this.showSubMenu=BX.prop.getBoolean(e,"showSubMenu",false);this.separator=BX.prop.getBoolean(e,"separator",false);this.enabled=BX.prop.getBoolean(e,"enabled",true);this.userModel=BX.prop.get(e,"userModel",null);if(this.userModel){this._userChangeHandler=this._onUserChange.bind(this);this.subscribeUserEvents();this.text=this.userModel.name;this.icon=this.userModel.avatar;this.iconClass="user-avatar"}this.elements={root:null,icon:null,content:null,submenu:null,separator:null,mic:null,cam:null};this.callbacks={click:BX.prop.getFunction(e,"onClick",BX.DoNothing),clickSubMenu:BX.prop.getFunction(e,"onClickSubMenu",BX.DoNothing)}};b.prototype.render=function(){if(this.elements.root){return this.elements.root}if(this.separator){this.elements.root=BX.create("hr",{props:{className:"bx-videocall-mobile-menu-item-separator"}})}else{this.elements.root=BX.create("div",{props:{className:"bx-videocall-mobile-menu-item"+(this.enabled?"":" disabled")},children:[this.elements.icon=BX.create("div",{props:{className:"bx-videocall-mobile-menu-item-icon "+this.iconClass}}),this.elements.content=BX.create("div",{props:{className:"bx-videocall-mobile-menu-item-content"},children:[BX.create("span",{text:this.text})]})],events:{click:this.callbacks.click}});if(this.icon!=""){this.elements.icon.style.backgroundImage='url("'+this.icon+'")'}if(this.showSubMenu){this.elements.submenu=BX.create("div",{props:{className:"bx-videocall-mobile-menu-item-submenu-icon"}});this.elements.root.appendChild(this.elements.submenu)}if(this.userModel){this.elements.mic=BX.create("div",{props:{className:"bx-videocall-mobile-menu-icon-user bx-call-view-icon-red-microphone-off"}});this.elements.cam=BX.create("div",{props:{className:"bx-videocall-mobile-menu-icon-user bx-call-view-icon-red-camera-off"}});if(!this.userModel.cameraState){this.elements.content.prepend(this.elements.cam)}if(!this.userModel.microphoneState){this.elements.content.prepend(this.elements.mic)}}}return this.elements.root};b.prototype.updateUserIcons=function(){if(!this.userModel){return}if(this.userModel.microphoneState){BX.remove(this.elements.mic)}else{this.elements.content.prepend(this.elements.mic)}if(this.userModel.cameraState){BX.remove(this.elements.cam)}else{this.elements.content.prepend(this.elements.cam)}};b.prototype.subscribeUserEvents=function(){this.userModel.subscribe("changed",this._userChangeHandler)};b.prototype._onUserChange=function(e){this.updateUserIcons()};b.prototype.destroy=function(){if(this.userModel){this.userModel.unsubscribe("changed",this._userChangeHandler);this.userModel=null}this.callbacks=null;this.elements=null};var B=function(e){this.elements={root:null};this.text=BX.type.isNotEmptyString(e.text)?e.text:"";this.isGroupCall=e.isGroupCall};B.prototype.render=function(){this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-panel-title"},html:this.getTitle()});return this.elements.root};B.prototype.getTitle=function(){var e='<span class="bx-messenger-videocall-panel-title-name">'+BX.util.htmlspecialchars(this.text)+"</span>";if(this.isGroupCall){return BX.message("IM_M_GROUP_CALL_WITH").replace("#CHAT_NAME#",e)}else{return BX.message("IM_M_CALL_WITH").replace("#USER_NAME#",e)}};var C=function(e){this.class=e.class;this.backgroundClass=BX.prop.getString(e,"backgroundClass","");this.backgroundClass="bx-messenger-videocall-panel-icon-background"+(this.backgroundClass?" ":"")+this.backgroundClass;this.blocked=e.blocked===true;this.text=BX.prop.getString(e,"text","");this.isActive=false;this.counter=BX.prop.getInteger(e,"counter",0);this.elements={root:null,counter:null};this.callbacks={onClick:BX.prop.getFunction(e,"onClick",BX.DoNothing),onMouseOver:BX.prop.getFunction(e,"onMouseOver",BX.DoNothing),onMouseOut:BX.prop.getFunction(e,"onMouseOut",BX.DoNothing)}};C.prototype.render=function(){if(this.elements.root){return this.elements.root}var e;if(this.text!==""){e=BX.create("div",{props:{className:"bx-messenger-videocall-panel-text"},text:this.text})}else{e=null}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-panel-item"+(this.blocked?" blocked":"")},children:[BX.create("div",{props:{className:this.backgroundClass},children:[BX.create("div",{props:{className:"bx-messenger-videocall-panel-icon bx-messenger-videocall-panel-icon-"+this.class},children:[this.elements.counter=BX.create("span",{props:{className:"bx-messenger-videocall-panel-item-counter"},text:0,dataset:{counter:0,counterType:"digits"}})]})]}),e,BX.create("div",{props:{className:"bx-messenger-videocall-panel-item-bottom-spacer"}})],events:{click:this.callbacks.onClick,mouseover:this.callbacks.onMouseOver,mouseout:this.callbacks.onMouseOut}});if(this.isActive){this.elements.root.classList.add("active")}if(this.counter){this.setCounter(this.counter)}return this.elements.root};C.prototype.setActive=function(e){if(this.isActive==e){return}this.isActive=e;if(!this.elements.root){return}if(this.isActive){this.elements.root.classList.add("active")}else{this.elements.root.classList.remove("active")}};C.prototype.setBlocked=function(e){if(this.blocked==e){return}this.blocked=e;if(this.blocked){this.elements.root.classList.add("blocked")}else{this.elements.root.classList.remove("blocked")}};C.prototype.setCounter=function(e){this.counter=parseInt(e,10);var t=this.counter;if(t>999){t=999}var s="digits";if(t.toString().length===2){s="dozens"}else if(t.toString().length>2){s="hundreds"}this.elements.counter.dataset.counter=t;this.elements.counter.dataset.counterType=s;this.elements.counter.innerText=t};var w=function(e){this.class=e.class;this.text=e.text;this.enabled=e.enabled===true;this.arrowEnabled=e.arrowEnabled===true;this.arrowHidden=e.arrowHidden===true;this.blocked=e.blocked===true;this.showLevel=e.showLevel===true;this.level=e.level||0;this.elements={root:null,icon:null,arrow:null,levelMeter:null};this.callbacks={onClick:BX.type.isFunction(e.onClick)?e.onClick:BX.DoNothing,onArrowClick:BX.type.isFunction(e.onArrowClick)?e.onArrowClick:BX.DoNothing,onMouseOver:BX.prop.getFunction(e,"onMouseOver",BX.DoNothing),onMouseOut:BX.prop.getFunction(e,"onMouseOut",BX.DoNothing)}};w.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-panel-item-with-arrow"+(this.blocked?" blocked":"")},children:[BX.create("div",{props:{className:"bx-messenger-videocall-panel-item-with-arrow-left"},children:[this.elements.icon=BX.create("div",{props:{className:this.getIconClass()}}),BX.create("div",{props:{className:"bx-messenger-videocall-panel-text"},text:this.text})]})],events:{click:this.callbacks.onClick,mouseover:this.callbacks.onMouseOver,mouseout:this.callbacks.onMouseOut}});this.elements.arrow=BX.create("div",{props:{className:"bx-messenger-videocall-panel-item-with-arrow-right"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-panel-item-with-arrow-right-icon"}})],events:{click:function(e){this.callbacks.onArrowClick.apply(this,arguments);e.stopPropagation()}.bind(this)}});if(!this.arrowHidden){this.elements.root.appendChild(this.elements.arrow)}if(this.showLevel){this.elements.icon.appendChild(P("svg",{attrNS:{class:"bx-messenger-videocall-panel-item-level-meter-container",width:3,height:20},children:[P("g",{attrNS:{fill:"#30B1DC"},children:[P("rect",{attrNS:{x:0,y:0,width:3,height:20,rx:1.5,opacity:.1}}),this.elements.levelMeter=P("rect",{attrNS:{x:0,y:20,width:3,height:20,rx:1.5}})]})]}))}return this.elements.root};w.prototype.getIconClass=function(){return"bx-messenger-videocall-panel-item-with-arrow-icon bx-messenger-videocall-panel-item-with-arrow-icon-"+this.class+(this.enabled?"":"-off")};w.prototype.enable=function(){if(this.enabled){return}this.enabled=true;this.elements.icon.className=this.getIconClass();if(this.elements.levelMeter){this.elements.levelMeter.setAttribute("y",Math.round((1-this.level)*20))}};w.prototype.disable=function(){if(!this.enabled){return}this.enabled=false;this.elements.icon.className=this.getIconClass();if(this.elements.levelMeter){this.elements.levelMeter.setAttribute("y",20)}};w.prototype.setBlocked=function(e){if(this.blocked==e){return}this.blocked=e;this.elements.icon.className=this.getIconClass();if(this.blocked){this.elements.root.classList.add("blocked")}else{this.elements.root.classList.remove("blocked")}};w.prototype.showArrow=function(){if(!this.arrowHidden){return}this.arrowHidden=false;this.elements.root.appendChild(this.elements.arrow)};w.prototype.hideArrow=function(){if(this.arrowHidden){return}this.arrowHidden=false;this.elements.root.removeChild(this.elements.arrow)};w.prototype.setLevel=function(e){this.level=Math.log(e*100)/4.6;if(this.showLevel&&this.enabled){this.elements.levelMeter.setAttribute("y",Math.round((1-this.level)*20))}};var y=function(e){this.language=e.language};y.prototype.render=function(){return BX.create("div",{props:{className:"bx-messenger-videocall-watermark"},children:[BX.create("img",{props:{className:"bx-messenger-videocall-watermark-img",src:this.getWatermarkUrl(this.language)}})]})};y.prototype.getWatermarkUrl=function(e){switch(e){case"ua":return"/bitrix/js/im/images/watermark-white-ua.svg";case"ru":case"kz":case"by":return"/bitrix/js/im/images/watermark-white-ru.svg";default:return"/bitrix/js/im/images/watermark-white-en.svg"}};var X=function(e){this.iconClass=BX.prop.getString(e,"iconClass","");this.text=BX.prop.getString(e,"text","");this.callbacks={onClick:BX.prop.getFunction(e,"onClick",BX.DoNothing),onMouseOver:BX.prop.getFunction(e,"onMouseOver",BX.DoNothing),onMouseOut:BX.prop.getFunction(e,"onMouseOut",BX.DoNothing)}};X.prototype.render=function(){return BX.create("div",{props:{className:"bx-messenger-videocall-top-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon "+this.iconClass}}),BX.create("div",{props:{className:"bx-messenger-videocall-top-button-text "},text:this.text})],events:{click:this.callbacks.onClick,mouseover:this.callbacks.onMouseOver,mouseout:this.callbacks.onMouseOut}})};var k=function(e){this.iconClass=BX.prop.getString(e,"iconClass","");this.textClass=BX.prop.getString(e,"textClass","");this.text=BX.prop.getString(e,"text","");this.callbacks={onClick:BX.prop.getFunction(e,"onClick",BX.DoNothing),onMouseOver:BX.prop.getFunction(e,"onMouseOver",BX.DoNothing),onMouseOut:BX.prop.getFunction(e,"onMouseOut",BX.DoNothing)}};k.prototype.render=function(){return BX.create("div",{props:{className:"bx-messenger-videocall-top-button-frameless"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon "+this.iconClass}}),this.text!=""?BX.create("div",{props:{className:"bx-messenger-videocall-top-button-text "+this.textClass},text:this.text}):null],events:{click:this.callbacks.onClick,mouseover:this.callbacks.onMouseOver,mouseout:this.callbacks.onMouseOut}})};var S=function(e){this.count=BX.prop.getInteger(e,"count",0);this.foldButtonState=BX.prop.getString(e,"foldButtonState",S.FoldButtonState.Hidden);this.allowAdding=BX.prop.getBoolean(e,"allowAdding",false);this.elements={root:null,leftContainer:null,rightContainer:null,foldIcon:null,count:null,separator:null};this.callbacks={onListClick:BX.prop.getFunction(e,"onListClick",BX.DoNothing),onAddClick:BX.prop.getFunction(e,"onAddClick",BX.DoNothing)}};S.FoldButtonState={Active:"active",Fold:"fold",Unfold:"unfold",Hidden:"hidden"};S.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants"},children:[this.elements.leftContainer=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-inner left"+(this.foldButtonState!=S.FoldButtonState.Hidden?" active":"")},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon participants"}}),this.elements.count=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-text-count"},text:this.count}),this.elements.foldIcon=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-fold-icon "+this.foldButtonState}})],events:{click:this.callbacks.onListClick}})]});this.elements.separator=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-separator"}});this.elements.rightContainer=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-inner active"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon add"}}),BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-text"},text:BX.message("IM_M_CALL_BTN_ADD")})],events:{click:this.callbacks.onAddClick}});if(this.allowAdding){this.elements.root.appendChild(this.elements.separator);this.elements.root.appendChild(this.elements.rightContainer)}return this.elements.root};S.prototype.update=function(e){this.count=BX.prop.getInteger(e,"count",this.count);this.foldButtonState=BX.prop.getString(e,"foldButtonState",this.foldButtonState);this.allowAdding=BX.prop.getBoolean(e,"allowAdding",this.allowAdding);this.elements.count.innerText=this.count;this.elements.foldIcon.className="bx-messenger-videocall-top-participants-fold-icon "+this.foldButtonState;if(this.foldButtonState==S.FoldButtonState.Hidden){this.elements.leftContainer.classList.remove("active")}else{this.elements.leftContainer.classList.add("active")}if(this.allowAdding&&!this.elements.separator.parentElement){this.elements.root.appendChild(this.elements.separator);this.elements.root.appendChild(this.elements.rightContainer)}if(!this.allowAdding&&this.elements.separator.parentElement){BX.remove(this.elements.separator);BX.remove(this.elements.rightContainer)}};var M=function(e){this.count=BX.prop.getInteger(e,"count",0);this.elements={root:null,icon:null,text:null,arrow:null};this.callbacks={onClick:BX.prop.getFunction(e,"onClick",BX.DoNothing)}};M.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-mobile"},children:[this.elements.icon=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-mobile-icon"}}),this.elements.text=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-mobile-text"},text:BX.message("IM_M_CALL_PARTICIPANTS").replace("#COUNT#",this.count)}),this.elements.arrow=BX.create("div",{props:{className:"bx-messenger-videocall-top-participants-mobile-arrow"}})],events:{click:this.callbacks.onClick}});return this.elements.root};M.prototype.setCount=function(e){if(this.count==e){return}this.count=e;this.elements.text.innerText=BX.message("IM_M_CALL_PARTICIPANTS").replace("#COUNT#",this.count)};var _=function(e){this.userId=e.userId;this.recordState=e.recordState;this.updateViewInterval=null;this.elements={root:null,timeText:null,stateText:null};this.callbacks={onPauseClick:BX.prop.getFunction(e,"onPauseClick",BX.DoNothing),onStopClick:BX.prop.getFunction(e,"onStopClick",BX.DoNothing),onMouseOver:BX.prop.getFunction(e,"onMouseOver",BX.DoNothing),onMouseOut:BX.prop.getFunction(e,"onMouseOut",BX.DoNothing)}};_.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus record-status-"+this.recordState.state+" "+(this.recordState.userId==this.userId?"":"record-user-viewer")},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-status"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon record-status"}})]}),BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-time"},children:[this.elements.timeText=BX.create("span",{props:{className:"bx-messenger-videocall-top-recordstatus-time-text"},text:this.getTimeText()}),BX.create("span",{props:{className:"bx-messenger-videocall-top-recordstatus-time-separator"},html:" – "}),this.elements.stateText=BX.create("span",{props:{className:"bx-messenger-videocall-top-recordstatus-time-state"},text:BX.message("IM_M_CALL_RECORD_TITLE")})]}),BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-buttons"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-separator"}}),BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon record-pause"}})],events:{click:this.callbacks.onPauseClick}}),BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-separator"}}),BX.create("div",{props:{className:"bx-messenger-videocall-top-recordstatus-button"},children:[BX.create("div",{props:{className:"bx-messenger-videocall-top-button-icon record-stop"}})],events:{click:this.callbacks.onStopClick}})]})],events:{mouseover:this.callbacks.onMouseOver,mouseout:this.callbacks.onMouseOut}});return this.elements.root};_.prototype.getTimeText=function(){if(this.recordState.state===BX.Call.View.RecordState.Stopped){return""}var e=new Date;var t=new Date(this.recordState.date.start);if(t.getTime()<e.getDate()){t=e}var s=this.recordState.date.pause.map((function(t){var s=t.finish?new Date(t.finish):e;return s-new Date(t.start)})).reduce((function(e,t){return e+t}),0);var i=e-t-s;if(i<=0){i=0}var n=Math.floor(i/1e3);var o=Math.floor(n/60/60);if(o>0){n-=o*60*60}var r=Math.floor(n/60);if(r>0){n-=r*60}return(o>0?o+":":"")+(o>0?r.toString().padStart(2,"0")+":":r+":")+n.toString().padStart(2,"0")};_.prototype.update=function(e){if(this.recordState.state!==e.state){clearInterval(this.updateViewInterval);if(e.state===BX.Call.View.RecordState.Started){this.updateViewInterval=setInterval(this.updateView.bind(this),1e3)}}this.recordState=e;this.updateView()};_.prototype.updateView=function(){var e=this.getTimeText();if(this.elements.timeText.innerText!==e){this.elements.timeText.innerText=this.getTimeText()}if(!this.elements.root.classList.contains("record-status-"+this.recordState.state)){this.elements.root.className="bx-messenger-videocall-top-recordstatus record-status-"+this.recordState.state+" "+(this.recordState.userId==this.userId?"":"record-user-viewer")}};_.prototype.stopViewUpdate=function(){if(this.updateViewInterval){clearInterval(this.updateViewInterval);this.updateViewInterval=null}};var U=function(e){this.viewElement=e.viewElement||null;this.parentElement=e.parentElement;this.cameraEnabled=BX.prop.getBoolean(e,"cameraEnabled",false);this.cameraId=BX.prop.getString(e,"cameraId",false);this.microphoneEnabled=BX.prop.getBoolean(e,"microphoneEnabled",false);this.microphoneId=BX.prop.getString(e,"microphoneId",false);this.speakerEnabled=BX.prop.getBoolean(e,"speakerEnabled",false);this.speakerId=BX.prop.getString(e,"speakerId",false);this.allowHdVideo=BX.prop.getBoolean(e,"allowHdVideo",false);this.faceImproveEnabled=BX.prop.getBoolean(e,"faceImproveEnabled",false);this.allowFaceImprove=BX.prop.getBoolean(e,"allowFaceImprove",false);this.allowBackground=BX.prop.getBoolean(e,"allowBackground",true);this.allowAdvancedSettings=BX.prop.getBoolean(e,"allowAdvancedSettings",false);this.showCameraBlock=BX.prop.getBoolean(e,"showCameraBlock",true);this.popup=null;this.eventEmitter=new BX.Event.EventEmitter(this,"DeviceSelector");this.elements={root:null,micContainer:null,cameraContainer:null,speakerContainer:null};var t=BX.prop.getObject(e,"events",{});Object.values(U.Events).forEach((function(e){if(t[e]){this.eventEmitter.subscribe(e,t[e])}}),this)};U.create=function(e){return new U(e)};U.Events={onMicrophoneSelect:"onMicrophoneSelect",onMicrophoneSwitch:"onMicrophoneSwitch",onCameraSelect:"onCameraSelect",onCameraSwitch:"onCameraSwitch",onSpeakerSelect:"onSpeakerSelect",onSpeakerSwitch:"onSpeakerSwitch",onChangeHdVideo:"onChangeHdVideo",onChangeMicAutoParams:"onChangeMicAutoParams",onChangeFaceImprove:"onChangeFaceImprove",onDestroy:"onDestroy"};U.prototype.show=function(){if(this.popup){this.popup.show();return}this.popup=new BX.PopupWindow("call-view-device-selector",this.parentElement,{targetContainer:this.viewElement,autoHide:true,zIndex:window["BX"]&&BX.MessengerCommon?BX.MessengerCommon.getDefaultZIndex()+500:1500,closeByEsc:true,offsetTop:0,offsetLeft:0,bindOptions:{position:"top"},angle:{position:"bottom"},overlay:{backgroundColor:"white",opacity:0},content:this.render(),events:{onPopupClose:function(){this.popup.destroy()}.bind(this),onPopupDestroy:function(){this.destroy()}.bind(this)}});this.popup.show()};U.prototype.render=function(){if(this.elements.root){return this.elements.root}return BX.create("div",{props:{className:"bx-call-view-device-selector"},children:[BX.create("div",{props:{className:"bx-call-view-device-selector-top"},children:[I.create({deviceLabel:BX.message("IM_M_CALL_BTN_MIC"),deviceList:BX.Call.Hardware.getMicrophoneList(),selectedDevice:this.microphoneId,deviceEnabled:this.microphoneEnabled,icons:["microphone","microphone-off"],events:{onSwitch:this.onMicrophoneSwitch.bind(this),onSelect:this.onMicrophoneSelect.bind(this)}}).render(),this.showCameraBlock?I.create({deviceLabel:BX.message("IM_M_CALL_BTN_CAMERA"),deviceList:BX.Call.Hardware.getCameraList(),selectedDevice:this.cameraId,deviceEnabled:this.cameraEnabled,icons:["camera","camera-off"],events:{onSwitch:this.onCameraSwitch.bind(this),onSelect:this.onCameraSelect.bind(this)}}).render():null,BX.Call.Hardware.canSelectSpeaker()?I.create({deviceLabel:BX.message("IM_M_CALL_BTN_SPEAKER"),deviceList:BX.Call.Hardware.getSpeakerList(),selectedDevice:this.speakerId,deviceEnabled:this.speakerEnabled,icons:["speaker","speaker-off"],events:{onSwitch:this.onSpeakerSwitch.bind(this),onSelect:this.onSpeakerSelect.bind(this)}}).render():null]}),BX.create("div",{props:{className:"bx-call-view-device-selector-bottom"},children:[BX.create("div",{props:{className:"bx-call-view-device-selector-bottom-item"},children:[BX.create("input",{props:{id:"device-selector-hd-video",className:"bx-call-view-device-selector-bottom-item-checkbox"},attrs:{type:"checkbox",checked:this.allowHdVideo},events:{change:this.onAllowHdVideoChange.bind(this)}}),BX.create("label",{props:{className:"bx-call-view-device-selector-bottom-item-label"},attrs:{for:"device-selector-hd-video"},text:BX.message("IM_M_CALL_HD_VIDEO")})]}),this.allowFaceImprove?BX.create("div",{props:{className:"bx-call-view-device-selector-bottom-item"},children:[BX.create("input",{props:{id:"device-selector-mic-auto-params",className:"bx-call-view-device-selector-bottom-item-checkbox"},attrs:{type:"checkbox",checked:this.faceImproveEnabled},events:{change:this.onFaceImproveChange.bind(this)}}),BX.create("label",{props:{className:"bx-call-view-device-selector-bottom-item-label"},attrs:{for:"device-selector-mic-auto-params"},text:BX.message("IM_SETTINGS_HARDWARE_CAMERA_FACE_IMPROVE")})]}):null,this.allowBackground?BX.create("div",{props:{className:"bx-call-view-device-selector-bottom-item"},children:[BX.create("span",{props:{className:"bx-call-view-device-selector-bottom-item-action"},text:BX.message("IM_M_CALL_BACKGROUND_CHANGE"),events:{click:function(){BX.Call.Hardware.BackgroundDialog.open();this.popup.close()}.bind(this)}})]}):null,this.allowAdvancedSettings?BX.create("div",{props:{className:"bx-call-view-device-selector-bottom-item"},children:[BX.create("span",{props:{className:"bx-call-view-device-selector-bottom-item-action"},text:BX.message("IM_M_CALL_ADVANCED_SETTINGS"),events:{click:function(){BXIM.openSettings({onlyPanel:"hardware"});this.popup.close()}.bind(this)}})]}):null]})]})};U.prototype.onMicrophoneSwitch=function(e){this.microphoneEnabled=!this.microphoneEnabled;this.eventEmitter.emit(U.Events.onMicrophoneSwitch,{microphoneEnabled:this.microphoneEnabled})};U.prototype.onMicrophoneSelect=function(e){this.eventEmitter.emit(U.Events.onMicrophoneSelect,{deviceId:e.data.deviceId})};U.prototype.onCameraSwitch=function(e){this.cameraEnabled=!this.cameraEnabled;this.eventEmitter.emit(U.Events.onCameraSwitch,{cameraEnabled:this.cameraEnabled})};U.prototype.onCameraSelect=function(e){this.eventEmitter.emit(U.Events.onCameraSelect,{deviceId:e.data.deviceId})};U.prototype.onSpeakerSwitch=function(e){this.speakerEnabled=!this.speakerEnabled;this.eventEmitter.emit(U.Events.onSpeakerSwitch,{speakerEnabled:this.speakerEnabled})};U.prototype.onSpeakerSelect=function(e){this.eventEmitter.emit(U.Events.onSpeakerSelect,{deviceId:e.data.deviceId})};U.prototype.onAllowHdVideoChange=function(e){this.allowHdVideo=e.currentTarget.checked;this.eventEmitter.emit(U.Events.onChangeHdVideo,{allowHdVideo:this.allowHdVideo})};U.prototype.onAllowMirroringVideoChange=function(e){BX.Call.Hardware.enableMirroring=e.target.checked};U.prototype.onFaceImproveChange=function(e){this.faceImproveEnabled=e.currentTarget.checked;this.eventEmitter.emit(U.Events.onChangeFaceImprove,{faceImproveEnabled:this.faceImproveEnabled})};U.prototype.destroy=function(){this.popup=null;this.eventEmitter.emit(U.Events.onDestroy,{})};var I=function(e){e=BX.type.isObject(e)?e:{};this.deviceList=BX.prop.getArray(e,"deviceList",[]);this.selectedDevice=BX.prop.getString(e,"selectedDevice","");this.deviceEnabled=BX.prop.getBoolean(e,"deviceEnabled",false);this.deviceLabel=BX.prop.getString(e,"deviceLabel","");this.icons=BX.prop.getArray(e,"icons",[]);this.eventEmitter=new BX.Event.EventEmitter(this,"DeviceMenu");this.elements={root:null,switchIcon:null,menuInner:null,menuItems:{}};var t=BX.prop.getObject(e,"events",{});for(var s in t){if(!t.hasOwnProperty(s)){continue}this.eventEmitter.subscribe(s,t[s])}};I.create=function(e){return new I(e)};I.Events={onSelect:"onSelect",onSwitch:"onSwitch"};I.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-call-view-device-selector-menu-container"},children:[BX.create("div",{props:{className:"bx-call-view-device-selector-switch-wrapper"},children:[this.elements.switchIcon=BX.create("div",{props:{className:"bx-call-view-device-selector-device-icon "+this.getDeviceIconClass()}}),BX.create("span",{props:{className:"bx-call-view-device-selector-device-text"},text:this.deviceLabel}),BX.create("div",{props:{className:"bx-call-view-device-selector-device-switch"},children:[new BX.UI.Switcher({size:"small",checked:this.deviceEnabled,handlers:{toggled:this.onSwitchToggled.bind(this)}}).getNode()]})]}),this.elements.menuInner=BX.create("div",{props:{className:"bx-call-view-device-selector-menu-inner"+(this.deviceEnabled?"":" inactive")},children:this.deviceList.map(this.renderDevice.bind(this))})]});return this.elements.root};I.prototype.renderDevice=function(e){var t=this.selectedDevice===e.deviceId?"selected":"";var s={};s.root=BX.create("div",{props:{className:"bx-call-view-device-selector-menu-item"},dataset:{deviceId:e.deviceId},children:[s.icon=BX.create("div",{props:{className:"bx-call-view-device-selector-menu-item-icon "+t}}),BX.create("div",{props:{className:"bx-call-view-device-selector-menu-item-text"},text:e.label||"("+BX.message("IM_M_CALL_DEVICE_NO_NAME")+")"})],events:{click:this.onMenuItemClick.bind(this)}});this.elements.menuItems[e.deviceId]=s;return s.root};I.prototype.getDeviceIconClass=function(){var e="";if(this.deviceEnabled&&this.icons.length>0){e=this.icons[0]}else if(!this.deviceEnabled&&this.icons.length>1){e=this.icons[1]}return e};I.prototype.onSwitchToggled=function(e){this.deviceEnabled=!this.deviceEnabled;this.elements.switchIcon.className="bx-call-view-device-selector-device-icon "+this.getDeviceIconClass();if(this.deviceEnabled){this.elements.menuInner.classList.remove("inactive")}else{this.elements.menuInner.classList.add("inactive")}this.eventEmitter.emit(I.Events.onSwitch,{deviceEnabled:this.deviceEnabled})};I.prototype.onMenuItemClick=function(e){var t=this.selectedDevice;var s=e.currentTarget.dataset.deviceId;if(t==s){return}this.selectedDevice=s;if(this.elements.menuItems[t]){this.elements.menuItems[t]["icon"].classList.remove("selected")}if(this.elements.menuItems[this.selectedDevice]){this.elements.menuItems[this.selectedDevice]["icon"].classList.add("selected")}this.eventEmitter.emit(I.Events.onSelect,{deviceId:this.selectedDevice})};var x=function(e){this.userList=e.userList;this.current=e.current;this.parentElement=e.parentElement;this.menu=null;this.callbacks={onSelect:BX.type.isFunction(e.onSelect)?e.onSelect:BX.DoNothing}};x.create=function(e){return new x(e)};x.prototype.show=function(){var e=this;var t=[];this.userList.forEach((function(s){t.push({id:s.id,text:s.name||"unknown ("+s.id+")",className:e.current==s.id?"menu-popup-item-accept":"device-selector-empty",onclick:function(){e.menu.close();e.callbacks.onSelect(s.id)}})}));this.menu=BX.PopupMenu.create("call-view-select-user",this.parentElement,t,{autoHide:true,zIndex:window["BX"]&&BX.MessengerCommon?BX.MessengerCommon.getDefaultZIndex()+500:500,closeByEsc:true,offsetTop:0,offsetLeft:0,bindOptions:{position:"bottom"},angle:false,overlay:{backgroundColor:"white",opacity:0},events:{onPopupClose:function(){e.menu.popupWindow.destroy();BX.PopupMenu.destroy("call-view-select-device")},onPopupDestroy:function(){e.menu=null}}});this.menu.popupWindow.show()};var N=function(e){this.hideTime=BX.prop.getInteger(e,"hideTime",10);this.userModel=e.userModel;this.eventEmitter=new BX.Event.EventEmitter(this,"FloorRequest");this.elements={root:null,avatar:null};this._hideTimeout=null;this._onUserModelChangedHandler=this._onUserModelChanged.bind(this);this.userModel.subscribe("changed",this._onUserModelChangedHandler)};N.create=function(e){return new N(e)};N.prototype.mount=function(e){e.appendChild(this.render());this.scheduleDismount()};N.prototype.dismount=function(){BX.remove(this.elements.root);this.destroy()};N.prototype.dismountWithAnimation=function(){if(!this.elements.root){return}this.elements.root.classList.add("closing");this.elements.root.addEventListener("animationend",function(){this.dismount()}.bind(this))};N.prototype.render=function(){if(this.elements.root){return this.elements.root}this.elements.root=BX.create("div",{props:{className:"bx-call-view-floor-request-notification"},children:[BX.create("div",{props:{className:"bx-call-view-floor-request-notification-icon-container"},children:[this.elements.avatar=BX.create("div",{props:{className:"bx-call-view-floor-request-notification-avatar"}}),BX.create("div",{props:{className:"bx-call-view-floor-request-notification-icon bx-messenger-videocall-floor-request-icon"}})]}),BX.create("span",{props:{className:"bx-call-view-floor-request-notification-text-container"},html:BX.message("IM_CALL_WANTS_TO_SAY_"+(this.userModel.gender=="F"?"F":"M")).replace("#NAME#",'<span class ="bx-call-view-floor-request-notification-text-name">'+BX.util.htmlspecialchars(this.userModel.name)+"</span>")}),BX.create("div",{props:{className:"bx-call-view-floor-request-notification-close"},events:{click:this.dismount.bind(this)}})]});if(this.userModel.avatar){this.elements.avatar.style.setProperty("--avatar","url('"+this.userModel.avatar+"')")}return this.elements.root};N.prototype.scheduleDismount=function(){return;this._hideTimeout=setTimeout(this.dismountWithAnimation.bind(this),this.hideTime*1e3)};N.prototype.subscribe=function(e,t){this.eventEmitter.subscribe(e,t)};N.prototype._onUserModelChanged=function(e){var t=e.data;if(t.fieldName=="floorRequestState"&&!this.userModel.floorRequestState){this.dismountWithAnimation()}};N.prototype.destroy=function(){clearTimeout(this._hideTimeout);this._hideTimeout=null;this.elements=null;if(this.userModel){this.userModel.unsubscribe("changed",this._onUserModelChangedHandler);this.userModel=null}this.eventEmitter.emit("onDestroy",{})};var L=function(){this.maxNotification=r;this.notifications=[]};var E=new L;Object.defineProperty(L,"Instance",{get:function(){return E}});L.prototype.addNotification=function(e){e.subscribe("onDestroy",function(){this.onNotificationDestroy(e)}.bind(this));this.notifications.push(e);if(this.notifications.length>this.maxNotification){var t=this.notifications.shift();t.dismount()}};L.prototype.onNotificationDestroy=function(e){var t=this.notifications.indexOf(e);if(t!=-1){this.notifications.splice(t,1)}};var V=function(e){this.data={id:BX.prop.getInteger(e,"id",0),name:BX.prop.getString(e,"name",""),avatar:BX.prop.getString(e,"avatar",""),gender:BX.prop.getString(e,"gender",""),state:BX.prop.getString(e,"state",BX.Call.UserState.Idle),talking:BX.prop.getBoolean(e,"talking",false),cameraState:BX.prop.getBoolean(e,"cameraState",true),microphoneState:BX.prop.getBoolean(e,"microphoneState",true),screenState:BX.prop.getBoolean(e,"screenState",false),videoPaused:BX.prop.getBoolean(e,"videoPaused",false),floorRequestState:BX.prop.getBoolean(e,"floorRequestState",false),localUser:BX.prop.getBoolean(e,"localUser",false),centralUser:BX.prop.getBoolean(e,"centralUser",false),pinned:BX.prop.getBoolean(e,"pinned",false),presenter:BX.prop.getBoolean(e,"presenter",false),order:BX.prop.getInteger(e,"order",false),allowRename:BX.prop.getBoolean(e,"allowRename",false),wasRenamed:BX.prop.getBoolean(e,"wasRenamed",false),renameRequested:BX.prop.getBoolean(e,"renameRequested",false),direction:BX.prop.getString(e,"direction",BX.Call.EndpointDirection.SendRecv)};for(var t in this.data){if(this.data.hasOwnProperty(t)){Object.defineProperty(this,t,{get:this._getField(t).bind(this),set:this._setField(t).bind(this)})}}this.onUpdate={talking:this._onUpdateTalking.bind(this),state:this._onUpdateState.bind(this)};this.talkingStop=null;this.eventEmitter=new BX.Event.EventEmitter(this,"UserModel")};V.prototype._getField=function(e){return function(){return this.data[e]}};V.prototype._setField=function(e){return function(t){var s=this.data[e];if(s==t){return}this.data[e]=t;if(this.onUpdate.hasOwnProperty(e)){this.onUpdate[e](t,s)}this.eventEmitter.emit("changed",{user:this,fieldName:e,oldValue:s,newValue:t})}};V.prototype._onUpdateTalking=function(e){if(e){this.floorRequestState=false}else{this.talkingStop=(new Date).getTime()}};V.prototype._onUpdateState=function(e){if(e!=BX.Call.UserState.Connected){this.talking=false;this.screenState=false}};V.prototype.wasTalkingAgo=function(){if(this.state!=BX.Call.UserState.Connected){return+Infinity}if(this.talking){return 0}if(!this.talkingStop){return+Infinity}return(new Date).getTime()-this.talkingStop};V.prototype.subscribe=function(e,t){this.eventEmitter.subscribe(e,t)};V.prototype.unsubscribe=function(e,t){this.eventEmitter.unsubscribe(e,t)};var R=function(e){this.users=BX.prop.getArray(e,"users",[]);this.eventEmitter=new BX.Event.EventEmitter(this,"UserRegistry");this._sort()};R.prototype.subscribe=function(e,t){this.eventEmitter.subscribe(e,t)};R.prototype.get=function(e){for(var t=0;t<this.users.length;t++){if(this.users[t].id==e){return this.users[t]}}return null};R.prototype.push=function(e){if(!(e instanceof V)){throw Error("user should be instance of UserModel")}this.users.push(e);this._sort();e.subscribe("changed",this._onUserChanged.bind(this));this.eventEmitter.emit("userAdded",{user:e})};R.prototype._onUserChanged=function(e){if(e.data.fieldName==="order"){this._sort()}this.eventEmitter.emit("userChanged",e.data)};R.prototype._sort=function(){this.users=this.users.sort((function(e,t){return e.order-t.order}))};function P(e,t){var s=document.createElementNS("http://www.w3.org/2000/svg",e);if("attrNS"in t&&BX.type.isObject(t.attrNS)){for(var i in t.attrNS){if(t.attrNS.hasOwnProperty(i)){s.setAttributeNS(null,i,t.attrNS[i])}}}BX.adjust(s,t);return s}function T(e){console.error("Playback start error: ",e)}BX.Call.View.Layout=e;BX.Call.View.Size={Folded:"folded",Full:"full"};BX.Call.View.RecordState={Started:"started",Resumed:"resumed",Paused:"paused",Stopped:"stopped"};BX.Call.View.RecordType={None:"none",Video:"video",Audio:"audio"};BX.Call.View.RecordSource={Chat:"BXCLIENT_CHAT"};BX.Call.View.UiState=t;BX.Call.View.Event=s;BX.Call.View.DeviceSelector=U;BX.Call.View.NotificationManager=L;Object.defineProperty(BX.Call.View,"MIN_WIDTH",{value:a,writable:false})})(); //# sourceMappingURL=view.map.js
| ver. 1.4 |
Github
|
.
| PHP 7.4.33 | Generation time: 0.24 |
proxy
|
phpinfo
|
Settings