"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../node_modules/tslib/tslib.es6.js"),n=require("../node_modules/@rematch/core/dist/core.esm.js"),s={usersList:null,pendingUsers:null,ownerInformations:null,isActive:!1,conferenceStartedFrom:"",conferenceStartTime:null,isOwnerInside:!1,isConferenceMuted:!1,conferenceId:""},r=n.createModel()({state:s,reducers:{updateConferenceUsersList:function(n,s){var r=null,i=!!s&&Object.keys(s).length>0,t={};if(s){var o=Date.now();Object.entries(s).forEach((function(s){var i,a=s[0],_=s[1],u=null===(i=n.usersList)||void 0===i?void 0:i[a];t[a]=e.__assign(e.__assign({},_),{joinTime:(null==u?void 0:u.joinTime)||o,muted:u?u.muted:_.muted}),_.owner&&(r=e.__assign(e.__assign({},_),{joinTime:(null==u?void 0:u.joinTime)||o,muted:u?u.muted:_.muted}))}))}var a=!n.isActive&&i?Date.now():n.conferenceStartTime;return e.__assign(e.__assign({},n),{usersList:t,ownerInformations:r,isActive:i,conferenceStartTime:i?a:null})},updateOwnerInformations:function(n,s){return e.__assign(e.__assign({},n),{ownerInformations:s})},setConferenceActive:function(n,s){return e.__assign(e.__assign({},n),{isActive:s,conferenceStartTime:s&&!n.conferenceStartTime?Date.now():n.conferenceStartTime})},setConferenceStartedFrom:function(n,s){return e.__assign(e.__assign({},n),{conferenceStartedFrom:s})},resetTimer:function(n){return e.__assign(e.__assign({},n),{conferenceStartTime:Date.now()})},resetFirstUserFlag:function(n){return e.__assign(e.__assign({},n),{isFirstUser:!1})},toggleUserMuted:function(n,s){var r=s.extenId,i=s.muted;if(!n.usersList||!n.usersList[r])return n;var t=e.__assign({},n.usersList);t[r]=e.__assign(e.__assign({},t[r]),{muted:void 0!==i?i:!t[r].muted});var o=n.ownerInformations;return n.ownerInformations&&n.ownerInformations.extenId===r&&(o=e.__assign(e.__assign({},n.ownerInformations),{muted:t[r].muted})),e.__assign(e.__assign({},n),{usersList:t,ownerInformations:o})},toggleIsOwnerInside:function(n,s){return e.__assign(e.__assign({},n),{isOwnerInside:s})},toggleIsConferenceMuted:function(n,s){return e.__assign(e.__assign({},n),{isConferenceMuted:s})},updateConferenceId:function(n,s){return e.__assign(e.__assign({},n),{conferenceId:s})},addPendingUser:function(n,s){var r;return e.__assign(e.__assign({},n),{pendingUsers:e.__assign(e.__assign({},n.pendingUsers),(r={},r[s.extenId]=s,r))})},removePendingUser:function(n,s){if(!n.pendingUsers)return n;var r=e.__assign({},n.pendingUsers);return delete r[s],e.__assign(e.__assign({},n),{pendingUsers:Object.keys(r).length>0?r:null})},clearPendingUsers:function(n){return e.__assign(e.__assign({},n),{pendingUsers:null})},resetConference:function(){return s}}});exports.conference=r;
//# sourceMappingURL=conference.js.map
