@100mslive/hms-video-store
Advanced tools
Comparing version 0.2.44 to 0.2.45
@@ -76,2 +76,4 @@ import { HMSMessage, HMSTrackID, HMSTrackSource } from '../schema'; | ||
removePeer(peerID: string, reason: string): Promise<void>; | ||
startRTMPOrRecording(params: sdkTypes.RTMPRecordingConfig): Promise<void>; | ||
stopRTMPAndRecording(): Promise<void>; | ||
setRemoteTrackEnabled(trackID: HMSTrackID | HMSTrackID[], enabled: boolean): Promise<void>; | ||
@@ -78,0 +80,0 @@ setLogLevel(level: HMSLogLevel): void; |
import { HMSException, HMSSimulcastLayer, HMSPeerUpdate, HMSRoomUpdate, HMSTrackUpdate, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSPeer, HMSRoom, HMSMessage, HMSConfig, HMSSpeaker, HMSRole, HMSLocalPeer, HMSRemotePeer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent } from '@100mslive/hms-video'; | ||
export { HMSPeer, HMSRoom, HMSMessage, HMSSpeaker, HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSException, HMSSimulcastLayer, HMSRoomUpdate, HMSPeerUpdate, HMSTrackUpdate, HMSRole, HMSLocalPeer, HMSRemotePeer, HMSLogLevel, SimulcastLayerDefinition, DeviceMap, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, }; | ||
import { RTMPRecordingConfig } from '@100mslive/hms-video/dist/interfaces/rtmp-recording-config'; | ||
export { HMSPeer, HMSRoom, HMSMessage, HMSSpeaker, HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSException, HMSSimulcastLayer, HMSRoomUpdate, HMSPeerUpdate, HMSTrackUpdate, HMSRole, HMSLocalPeer, HMSRemotePeer, HMSLogLevel, SimulcastLayerDefinition, DeviceMap, HMSDeviceChangeEvent, HMSPlaylistItem, HMSPlaylistManager, HMSPlaylistProgressEvent, RTMPRecordingConfig, }; |
import { HMSConfig, HMSSimulcastLayer, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSLogLevel, HMSVideoPlugin, HMSAudioPlugin } from '@100mslive/hms-video'; | ||
import { HMSPeerID, HMSRoleName, HMSTrackSource, IHMSPlaylistActions } from './schema'; | ||
import { HMSRoleChangeRequest } from './selectors'; | ||
import { RTMPRecordingConfig } from './hmsSDKStore/sdkTypes'; | ||
/** | ||
@@ -210,2 +211,15 @@ * The below interface defines our SDK API Surface for taking room related actions. | ||
/** | ||
* If you want to start RTMP streaming or recording. | ||
* @param params.meetingURL This is the meeting url which is opened in a headless chrome instance for streaming and recording. | ||
* Make sure this url leads the joiner straight to the room without any preview screen or requiring additional clicks. | ||
* @param params.RTMPURLs The list of ingest URLs where the call as visible in the meeting url should be streamed. | ||
* Optional, when not specified the method is used to just start the recording. | ||
* @param params.record If you want to start the recording or not. | ||
*/ | ||
startRTMPOrRecording(params: RTMPRecordingConfig): Promise<void>; | ||
/** | ||
* If you want to stop both RTMP streaming and recording. | ||
*/ | ||
stopRTMPAndRecording(): Promise<void>; | ||
/** | ||
* Set the type of logs from the SDK you want to be logged in the browser console. | ||
@@ -212,0 +226,0 @@ * |
@@ -7,2 +7,2 @@ export { IHMSStore, IHMSStoreReadOnly as HMSStoreWrapper } from './IHMSStore'; | ||
export * from './selectors'; | ||
export { HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSSimulcastLayer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, } from './hmsSDKStore/sdkTypes'; | ||
export { HMSConfig, HMSAudioTrackSettings, HMSVideoTrackSettings, HMSSimulcastLayer, SimulcastLayerDefinition, DeviceMap, HMSLogLevel, RTMPRecordingConfig, } from './hmsSDKStore/sdkTypes'; |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("immer")),r=e(require("zustand/vanilla")),n=e(require("zustand/shallow")),o=require("@100mslive/hms-video"),i=require("reselect"),s=e(require("events"));function a(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)}))}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,p,h=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new b(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=k(s,r);if(a){if(a===l)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function p(){}var h={};a(h,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(R([])));y&&y!==t&&r.call(y,o)&&(h=y);var S=p.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(o,i){function s(){return new t((function(n,s){!function n(o,i,s,a){var c=u(e[o],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function b(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function R(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,a(S,"constructor",p),a(p,"constructor",f),f.displayName=a(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},g(m.prototype),a(m.prototype,i,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var s=new m(c(t,r,n,o),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(S),a(S,s,"Generator"),a(S,o,(function(){return this})),a(S,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=R,b.prototype={constructor:b,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:R(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(p={exports:{}}),p.exports);(f=exports.HMSRoomState||(exports.HMSRoomState={})).Disconnected="Disconnected",f.Preview="Preview",f.Connecting="Connecting",f.Connected="Connected",f.Reconnecting="Reconnecting",f.Failed="Failed";var v,y,S,g=function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1,roomState:exports.HMSRoomState.Disconnected},peers:{},tracks:{},playlist:{audio:{list:{},selection:{id:"",hasPrevious:!1,hasNext:!1},progress:0,volume:0,currentTime:0},video:{list:{},selection:{id:"",hasPrevious:!1,hasNext:!1},progress:0,volume:0,currentTime:0}},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:""},devices:{audioInput:[],audioOutput:[],videoInput:[]},roles:{},roleChangeRequests:[],errors:[]}};(exports.HMSMessageType||(exports.HMSMessageType={})).CHAT="chat",(v=exports.HMSNotificationSeverity||(exports.HMSNotificationSeverity={})).INFO="info",v.ERROR="error",v.CRITICAL="critical",(y=exports.HMSNotificationTypes||(exports.HMSNotificationTypes={})).PEER_JOINED="PEER_JOINED",y.PEER_LEFT="PEER_LEFT",y.NEW_MESSAGE="NEW_MESSAGE",y.ERROR="ERROR",y.RECONNECTING="RECONNECTING",y.RECONNECTED="RECONNECTED",y.TRACK_ADDED="TRACK_ADDED",y.TRACK_REMOVED="TRACK_REMOVED",y.TRACK_MUTED="TRACK_MUTED",y.TRACK_UNMUTED="TRACK_UNMUTED",y.ROLE_CHANGE_REQUEST="ROLE_CHANGE_REQUEST",y.ROLE_UPDATED="ROLE_UPDATED",y.CHANGE_TRACK_STATE_REQUEST="CHANGE_TRACK_STATE_REQUEST",y.ROOM_ENDED="ROOM_ENDED",y.REMOVED_FROM_ROOM="REMOVED_FROM_ROOM",y.DEVICE_CHANGE_UPDATE="DEVICE_CHANGE_UPDATE",(S=exports.HMSPlaylistType||(exports.HMSPlaylistType={})).audio="audio",S.video="video";var m=function(e,t){for(var r,n=d(R(Object.keys(e),Object.keys(t)));!(r=n()).done;){var o=r.value,i=e[o],s=t[o];k(i,s)?Object.assign(i,s):x(i,s)?delete e[o]:T(i,s)&&(e[o]=s)}},k=function(e,t){return e&&t},x=function(e,t){return e&&!t},T=function(e,t){return!e&&t},b=function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},R=function(e,t){for(var r,n=new Set,o=d(e);!(r=o()).done;)n.add(r.value);for(var i,s=d(t);!(i=s()).done;)n.add(i.value);return Array.from(n)};function E(e,t,r,n){e.isLocal&&e.videoTrack&&t.videoTrack&&e.videoTrack!==t.videoTrack&&(n[e.videoTrack]=n[t.videoTrack],delete n[t.videoTrack],r[e.videoTrack]=r[t.videoTrack],r[e.videoTrack].id=e.videoTrack,delete r[t.videoTrack],t.videoTrack=e.videoTrack)}var P=function(){function e(){}return e.convertPeer=function(e){var t,r,n;return{id:e.peerId,name:e.name,roleName:null==(t=e.role)?void 0:t.name,isLocal:e.isLocal,videoTrack:null==(r=e.videoTrack)?void 0:r.trackId,audioTrack:null==(n=e.audioTrack)?void 0:n.trackId,auxiliaryTracks:e.auxiliaryTracks.map((function(e){return e.trackId})),customerUserId:e.customerUserId,customerDescription:e.customerDescription}},e.convertTrack=function(e){var t={id:e.trackId,source:e.source,type:e.type,enabled:e.enabled,displayEnabled:e.enabled};return this.enrichTrack(t,e),t},e.enrichTrack=function(t,r){var n=r.getMediaTrackSettings();if("screen"===t.source&&"video"===t.type&&(t.displaySurface=n.displaySurface),t.height=n.height,t.width=n.width,t.deviceID=n.deviceId,r instanceof o.HMSRemoteAudioTrack){var i=r.getVolume()||0;t.volume=i}e.enrichVideoTrack(t,r)},e.enrichVideoTrack=function(e,t){t instanceof o.HMSRemoteVideoTrack&&(e.layer=t.getSimulcastLayer(),e.degraded=t.degraded,b(t.getSimulcastDefinitions(),e.layerDefinitions)||(e.layerDefinitions=t.getSimulcastDefinitions())),(t instanceof o.HMSLocalVideoTrack||t instanceof o.HMSLocalAudioTrack)&&(b(t.getPlugins(),e.plugins)||(e.plugins=t.getPlugins()))},e.convertRoom=function(e){return{id:e.id,name:e.name,hasWaitingRoom:e.hasWaitingRoom,shareableLink:e.shareableLink}},e.convertMessage=function(e){var t,r,n;return{sender:e.sender.peerId,senderName:e.sender.name,senderRole:null==(t=e.sender.role)?void 0:t.name,senderUserId:e.sender.customerUserId,recipientPeer:null==(r=e.recipientPeer)?void 0:r.peerId,recipientRoles:null==(n=e.recipientRoles)?void 0:n.map((function(e){return e.name})),time:e.time,type:e.type,message:e.message}},e.convertRoles=function(e){var t={};return e&&e.forEach((function(e){t[e.name]=e})),t},e.convertRoleChangeRequest=function(e){return{requestedBy:e.requestedBy.peerId,roleName:e.role.name,token:e.token}},e.convertException=function(e){return{code:e.code,action:e.action,name:e.name,message:e.message,description:e.description,isTerminal:e.isTerminal,timestamp:new Date}},e.convertDeviceChangeUpdate=function(e){var t={devices:e.devices,selection:e.selection,type:e.type};return e.error&&(t.error=this.convertException(e.error)),t},e.convertPlaylist=function(e){return{audio:this.getConvertedPlaylistType(e,exports.HMSPlaylistType.audio),video:this.getConvertedPlaylistType(e,exports.HMSPlaylistType.video)}},e.getConvertedPlaylistType=function(e,t){var r={},n=e.getCurrentSelection(t),o=e.getCurrentProgress(t),i=e.isPlaying(t),s=e.getVolume(t),a=e.getList(t),c=e.getCurrentIndex(t);return e.getList(t).forEach((function(e){var t=e.url===(null==n?void 0:n.url);r[e.id]=u({},e,{type:e.type,selected:t,playing:t&&i})})),{list:r,selection:{id:null==n?void 0:n.id,hasPrevious:c>0,hasNext:c<a.length-1},progress:o,volume:s,currentTime:e.getCurrentTime(t)}},e}();function M(e,t,r){void 0===r&&(r=D);var n=void 0,o=void 0;if(t)for(var i,s=d(t.auxiliaryTracks);!(i=s()).done;){var a=e[i.value];r(a)&&(o=w(a)?a:o,n=I(a)?a:n)}return{video:n,audio:o}}function w(e){return e&&"audio"===e.type}function I(e){return e&&"video"===e.type}function D(e){return e&&"screen"===e.source}function O(e){return e&&"videoplaylist"===e.source}function L(e){return Boolean(null==e?void 0:e.degraded)}function N(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].enabled}var A=function(e){return e.room},H=function(e){return e.peers},C=function(e){return e.messages.byID},_=function(e){return e.messages.allIDs},U=function(e){return e.tracks},V=function(e){return e.speakers},K=i.createSelector([A],(function(e){return e&&e.isConnected})),B=i.createSelector([A,H],(function(e,t){return e.peers.map((function(e){return t[e]}))})),j=i.createSelector(U,(function(e){return Object.values(e)})),q=i.createSelector(B,(function(e){return e.filter((function(e){return e.isLocal}))[0]})),F=i.createSelector(q,(function(e){return null==e?void 0:e.id})),G=i.createSelector(q,(function(e){return null==e?void 0:e.audioTrack})),J=i.createSelector(q,(function(e){return null==e?void 0:e.videoTrack})),W=i.createSelector([G,J,i.createSelector(q,(function(e){return null==e?void 0:e.auxiliaryTracks}))],(function(e,t,r){var n=[].concat(r);return e&&n.unshift(e),t&&n.unshift(t),n})),Q=i.createSelector(B,(function(e){return e.filter((function(e){return!e.isLocal}))})),X=i.createSelector(H,V,(function(e,t){var r=Object.entries(t).sort((function(e,t){var r,n,o=(null==(r=e[1])?void 0:r.audioLevel)||0;return((null==(n=t[1])?void 0:n.audioLevel)||0)>o?1:-1}));if(r.length>0&&r[0][1].audioLevel&&r[0][1].audioLevel>0){var n=r[0][1].peerID;if(n in e)return e[n]}return null})),Y=function(e){var t=q(e);return N(e,null==t?void 0:t.videoTrack)},z=function(e){var t=q(e);return function(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].displayEnabled}(e,null==t?void 0:t.videoTrack)},$=i.createSelector(q,U,(function(e,t){var r=M(t,e);return!(!r.video&&!r.audio)})),Z=i.createSelector(H,U,(function(e,t){var r=void 0;for(var n in e){var o=e[n],i=M(t,o);if(i.video)return o;i.audio&&!r&&(r=o)}return r})),ee=i.createSelector(Z,(function(e){return!!e})),te=i.createSelector(H,U,(function(e,t){for(var r in e){var n=e[r],o=M(t,n);if(!o.video&&o.audio)return n}})),re=i.createSelector(H,U,(function(e,t){var r=[],n=[];for(var o in e){var i=e[o],s=M(t,i),a=s.audio;s.video?r.push(i):a&&n.push(i)}return r.concat(n)})),ne=i.createSelector(H,U,(function(e,t){for(var r in e){var n=e[r];if(M(t,n,O).video)return n}})),oe=i.createSelector(j,(function(e){return e.filter(L)})),ie=i.createSelector(_,(function(e){return e.length})),se=i.createSelector(C,(function(e){return Object.values(e).filter((function(e){return!e.read})).length})),ae=i.createSelector(_,C,(function(e,t){var r=[];return e.forEach((function(e){r.push(t[e])})),r})),ce=i.createSelector([A],(function(e){return e&&e.roomState})),ue=i.createSelector(ce,(function(e){return e===exports.HMSRoomState.Preview})),le=i.createSelector(A,(function(e){return e.roomState!==exports.HMSRoomState.Disconnected})),de=function(e){return e.roles},fe=i.createSelector([de],(function(e){return Object.keys(e)})),pe=i.createSelector([q,de],(function(e,t){return null!=e&&e.roleName?t[e.roleName]:null})),he=i.createSelector([pe],(function(e){var t;return!(null==e||null==(t=e.subscribeParams)||!t.subscribeToRoles)&&e.subscribeParams.subscribeToRoles.length>0})),ve=i.createSelector(pe,(function(e){return null==e?void 0:e.permissions})),ye=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].list}},Se=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].selection}},ge=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].progress}},me=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].currentTime}},ke=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].volume}},xe=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),i.createSelector(ye(e),(function(e){return Object.values(e)}))},Te=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),i.createSelector(ye(e),Se(e),(function(e,t){if(t.id)return e[t.id]}))},be={selection:Se(exports.HMSPlaylistType.audio),progress:ge(exports.HMSPlaylistType.audio),currentTime:me(exports.HMSPlaylistType.audio),volume:ke(exports.HMSPlaylistType.audio),list:xe(exports.HMSPlaylistType.audio),selectedItem:Te(exports.HMSPlaylistType.audio)},Re={selection:Se(exports.HMSPlaylistType.video),progress:ge(exports.HMSPlaylistType.video),currentTime:me(exports.HMSPlaylistType.audio),volume:ke(exports.HMSPlaylistType.video),list:xe(exports.HMSPlaylistType.video),selectedItem:Te(exports.HMSPlaylistType.video)},Ee="HMS-Store:",Pe=function(){function e(){}return e.v=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.log.apply(this,[o.HMSLogLevel.VERBOSE,e].concat(r))},e.d=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.DEBUG].concat(t))},e.i=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.INFO].concat(t))},e.w=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.WARN].concat(t))},e.e=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.ERROR].concat(t))},e.log=function(e){if(!(this.level.valueOf()>e.valueOf())){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];switch(e){case o.HMSLogLevel.VERBOSE:var i;(i=console).log.apply(i,[Ee].concat(r));break;case o.HMSLogLevel.DEBUG:var s;(s=console).debug.apply(s,[Ee].concat(r));break;case o.HMSLogLevel.INFO:var a;(a=console).info.apply(a,[Ee].concat(r));break;case o.HMSLogLevel.WARN:var c;(c=console).warn.apply(c,[Ee].concat(r));break;case o.HMSLogLevel.ERROR:var u;(u=console).error.apply(u,[Ee].concat(r))}}},e}();function Me(e){return function(t){return function(r){return e(r,t)}}}Pe.level=o.HMSLogLevel.VERBOSE;var we=function(e,t){return t},Ie=function(e,t){return t},De=i.createSelector([H,we],(function(e,t){return t?e[t]:null})),Oe=i.createSelector([U,function(e,t){return t}],(function(e,t){return t?e[t]:null})),Le=Me(De),Ne=Me(i.createSelector(De,(function(e){return null==e?void 0:e.name}))),Ae=Me(Oe),He=Me((function(e,t){var r=De(e,t);if(r&&r.videoTrack&&""!==r.videoTrack)return e.tracks[r.videoTrack]})),Ce=Me((function(e,t){var r=De(e,t);if(r&&r.audioTrack&&""!==r.audioTrack)return e.tracks[r.audioTrack]})),_e=He,Ue=Me((function(e,t){var r=De(e,t);return(null==r?void 0:r.auxiliaryTracks.map((function(t){return e.tracks[t]})))||[]})),Ve=function(e,t){return t?e.speakers[t]:null},Ke=Me(i.createSelector(Ve,(function(e){return(null==e?void 0:e.audioLevel)||0}))),Be=Me(i.createSelector((function(e,t){var r=Ce(t)(e);return Ve(e,null==r?void 0:r.id)}),(function(e){return(null==e?void 0:e.audioLevel)||0}))),je=Me((function(e,t){var r=De(e,t);if(r){var n=null==r?void 0:r.auxiliaryTracks.find((function(t){return w(e.tracks[t])}));return n?e.tracks[n]:void 0}})),qe=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return O(r)&&I(r)}));return r?e[r]:void 0}))),Fe=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return O(r)&&w(r)}));return r?e[r]:void 0}))),Ge=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return function(e){return e&&"audioplaylist"===e.source}(r)&&w(r)}));return r?e[r]:void 0}))),Je=Me(i.createSelector(U,De,(function(e,t){return M(e,t)}))),We=function(e){return i.createSelector(Je(e),(function(e){return e.audio}))},Qe=Me((function(e,t){var r=De(e,t);return N(e,null==r?void 0:r.audioTrack)})),Xe=Me((function(e,t){var r=De(e,t);return N(e,null==r?void 0:r.videoTrack)})),Ye=Me((function(e,t){if(t&&e.tracks[t])return 0===e.tracks[t].volume})),ze=Me((function(e,t){var r=De(e,t);return Ye(null==r?void 0:r.audioTrack)(e)})),$e=Me((function(e,t){var r=We(t)(e);return Ye(null==r?void 0:r.id)(e)})),Ze=Me((function(e,t){var r=Oe(e,t);if(r)return"audio"!==r.type?void Pe.w("Please pass audio track here"):r.volume})),et=Me((function(e,t){var r=De(e,t);return Ze(null==r?void 0:r.audioTrack)(e)})),tt=Me((function(e,t){var r=We(t)(e);return Ze(null==r?void 0:r.id)(e)})),rt=Me((function(e,t){var r=Oe(e,t);if(r)return"video"!==r.type?void Pe.w("Please pass video track here"):r.layer})),nt=i.createSelector([ae,F,we],(function(e,t,r){if(r)return e.filter((function(e){var n;return!!(e.recipientPeer||null!=(n=e.recipientRoles)&&n.length)&&!![t,r].includes(e.sender)&&[t,r].includes(e.recipientPeer)}))})),ot=i.createSelector([ae,Ie],(function(e,t){if(t)return e.filter((function(e){var r,n;return!(null==(r=e.recipientRoles)||!r.length)&&(null==(n=e.recipientRoles)?void 0:n.includes(t))}))})),it=i.createSelector(ae,(function(e){return e.filter((function(e){var t;return!(e.recipientPeer||null!=(t=e.recipientRoles)&&t.length)}))})),st=i.createSelector([ot,Ie],(function(e){return e?e.filter((function(e){return!e.read})).length:0})),at=i.createSelector([nt,we],(function(e){return e?e.filter((function(e){return!e.read})).length:0})),ct=i.createSelector(it,(function(e){return e.filter((function(e){return!e.read})).length})),ut=Me(nt),lt=Me(ot),dt=Me(st),ft=Me(at),pt=i.createSelector([H,U],(function(e,t){return Object.values(e).map((function(e){var r;return{peer:e,isAudioEnabled:!!e.audioTrack&&(null==(r=t[e.audioTrack])?void 0:r.enabled)}}))})),ht=i.createSelector([function(e){return e.roleChangeRequests[0]||null},H,de],(function(e,t,r){return e?{requestedBy:t[e.requestedBy],role:r[e.roleName],token:e.token}:null})),vt=i.createSelector([pe],(function(e){var t,r=!1,n=!1,o=!1;return null!=e&&null!=(t=e.publishParams)&&t.allowed&&(r=e.publishParams.allowed.includes("video"),n=e.publishParams.allowed.includes("audio"),o=e.publishParams.allowed.includes("screen")),{video:r,audio:n,screen:o}})),yt=i.createSelector([J,U],(function(e,t){var r,n=null;return e&&(n=t[e]),(null==(r=n)?void 0:r.plugins)||[]})),St=i.createSelector([G,U],(function(e,t){var r,n=null;return e&&(n=t[e]),(null==(r=n)?void 0:r.plugins)||[]}));function gt(e){return e instanceof o.HMSRemoteAudioTrack||e instanceof o.HMSRemoteVideoTrack}var mt,kt,xt=function(){function e(e,t,r){this.playlistManager=e,this.syncPlaylistState=r,this.type=t}var t=e.prototype;return t.play=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Please pass id and type to pause"),e.abrupt("return");case 3:return e.next=5,this.playlistManager.setEnabled(!0,{id:t,type:this.type});case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.pause=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Please pass id and type to pause"),e.abrupt("return");case 3:return e.next=5,this.playlistManager.setEnabled(!1,{id:t,type:this.type});case 5:this.syncPlaylistState("pauseOn"+this.type+"Playlist");case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.playNext=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.playNext(this.type);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.playPrevious=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.playPrevious(this.type);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.seek=function(e){this.playlistManager.seek(e,this.type),this.syncPlaylistState("seekOn"+this.type+"Playlist")},t.seekTo=function(e){this.playlistManager.seekTo(e,this.type),this.syncPlaylistState("seekToOn"+this.type+"Playlist")},t.setVolume=function(e){this.playlistManager.setVolume(e,this.type),this.syncPlaylistState("setVolumeOn"+this.type+"Playlist")},t.setList=function(e){this.playlistManager.setList(e),this.syncPlaylistState("setListOn"+this.type+"Playlist")},t.stop=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.stop(this.type);case 2:this.syncPlaylistState("stop"+this.type+"Playlist");case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),e}(),Tt=function(){function e(e,t,r){var n=this;this.hmsSDKTracks={},this.hmsSDKPeers={},this.isRoomJoinCalled=!1,this.setProgress=function(e){var t=e.type,r=e.progress;n.setState((function(e){e.playlist[t].progress=r,e.playlist[t].currentTime=n.sdk.getPlaylistManager().getCurrentTime(t)}),"playlistProgress")},this.syncPlaylistState=function(e){for(var t,r=n.sdk.getPeers(),o={},i=d(r);!(t=i()).done;)for(var s,a=t.value,c=d([a.audioTrack,a.videoTrack].concat(a.auxiliaryTracks));!(s=c()).done;){var u=s.value;if(u){var l=P.convertTrack(u);o[l.id]=l}}n.setState((function(e){m(e.tracks,o),Object.assign(e.playlist,P.convertPlaylist(n.sdk.getPlaylistManager()))}),e)},this.setState=function(e,t){return n.store.namedSetState(e,t)},this.store=e,this.sdk=t,this.hmsNotifications=r}var t=e.prototype;return t.unblockAudio=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.getAudioOutput().unblockAutoplay();case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setVolume=function(e,t){t?this.setTrackVolume(e,t):(this.sdk.getAudioOutput().setVolume(e),this.syncRoomState("setVolume"))},t.setAudioOutputDevice=function(e){this.sdk.getAudioOutput().setDevice(e),this.syncRoomState("setAudioOutput")},t.setPreferredLayer=function(e,t){var r=this.hmsSDKTracks[e];r?r instanceof o.HMSRemoteVideoTrack?(r.preferLayer(t),this.syncRoomState("setPreferredLayer")):Pe.w("track "+e+" is not an video track"):this.logPossibleInconsistency("track "+e+" not present, unable to set preffer layer")},t.preview=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isRoomJoinCalled){e.next=3;break}return this.logPossibleInconsistency("attempting to call preview after join was called"),e.abrupt("return");case 3:return e.prev=3,e.next=6,this.sdkPreviewWithListeners(t);case 6:this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connecting}),"preview"),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),Pe.e("Cannot show preview. Failed to connect to room - ",e.t0),e.t0;case 13:case"end":return e.stop()}}),e,this,[[3,9]])})));return function(t){return e.apply(this,arguments)}}(),t.join=function(e){if(this.isRoomJoinCalled)this.logPossibleInconsistency("room join is called again");else try{this.sdkJoinWithListeners(e),this.isRoomJoinCalled=!0,this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connecting}),"join")}catch(e){throw this.isRoomJoinCalled=!1,Pe.e("Failed to connect to room - ",e),e}},t.leave=function(){var e=c(h.mark((function e(){var t=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(le)){e.next=4;break}return this.logPossibleInconsistency("room leave is called when no room is connected"),e.abrupt("return");case 4:return e.abrupt("return",this.sdk.leave().then((function(){t.resetState("leave"),Pe.i("left room")})).catch((function(e){Pe.e("error in leaving room - ",e)})));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setScreenShareEnabled=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.startScreenShare(r);case 3:e.next=7;break;case 5:return e.next=7,this.stopScreenShare();case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addTrack=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r="regular"),e.next=3,this.sdk.addTrack(t,r);case 3:this.syncRoomState("addTrack");case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.removeTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.removeTrack(t);case 2:this.syncRoomState("removeTrack");case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalAudioEnabled=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(G))){e.next=4;break}return e.next=4,this.setEnabledTrack(r,t);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalVideoEnabled=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(J))){e.next=4;break}return e.next=4,this.setEnabledTrack(r,t);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setEnabledTrack=function(){var e=c(h.mark((function e(t,r){var n,i=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((null==(n=this.store.getState().tracks[t])?void 0:n.enabled)!==r){e.next=4;break}return this.logPossibleInconsistency("local track["+t+"] enabled state - "+r),e.abrupt("return");case 4:return this.setState((function(e){e.tracks[t]?e.tracks[t].displayEnabled=r:i.logPossibleInconsistency("track id not found for setEnabled")}),"displayEnabled"),e.prev=5,e.next=8,this.setEnabledSDKTrack(t,r);case 8:this.syncRoomState("setEnabled"),e.next=16;break;case 11:throw e.prev=11,e.t0=e.catch(5),this.setState((function(e){e.tracks[t].displayEnabled=!r}),"rollbackDisplayEnabled"),this.hmsNotifications.sendError(P.convertException(e.t0)),e.t0;case 16:this.hmsNotifications.sendTrackUpdate(r?o.HMSTrackUpdate.TRACK_UNMUTED:o.HMSTrackUpdate.TRACK_MUTED,t);case 18:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,r){return e.apply(this,arguments)}}(),t.setAudioSettings=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(G))){e.next=5;break}return e.next=4,this.setSDKLocalAudioTrackSettings(r,t);case 4:this.syncRoomState("setAudioSettings");case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setVideoSettings=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(J))){e.next=5;break}return e.next=4,this.setSDKLocalVideoTrackSettings(r,t);case 4:this.syncRoomState("setVideoSettings");case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.sendMessage=function(e){this.sendBroadcastMessage(e)},t.sendBroadcastMessage=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.sendBroadcastMessage(t,r);case 2:this.updateMessageInStore(e.sent,{message:t,type:r});case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.sendGroupMessage=function(){var e=c(h.mark((function e(t,r,n){var o,i;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.store.getState(de),i=r.map((function(e){return o[e]})),e.next=4,this.sdk.sendGroupMessage(t,i,n);case 4:this.updateMessageInStore(e.sent,{message:t,recipientRoles:r,type:n});case 6:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.sendDirectMessage=function(){var e=c(h.mark((function e(t,r,n){var o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.hmsSDKPeers[r],e.next=3,this.sdk.sendDirectMessage(t,o);case 3:this.updateMessageInStore(e.sent,{message:t,recipientPeer:o.peerId,type:n});case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.updateMessageInStore=function(e,t){if(!e)throw Pe.w("sendMessage","Failed to send message",t),Error("sendMessage Failed - "+JSON.stringify(t));var r=P.convertMessage(e);return r.read=!0,r.senderName="You",this.onHMSMessage(r),r},t.setMessageRead=function(e,t){var r=this;this.setState((function(n){t?n.messages.byID[t]?n.messages.byID[t].read=e:r.logPossibleInconsistency("no message with id is found"):n.messages.allIDs.forEach((function(t){n.messages.byID[t].read=e}))}),"setMessageRead")},t.attachVideo=function(){var e=c(h.mark((function e(t,r){var n=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.localAndVideoUnmuting(t)){e.next=4;break}return e.abrupt("return",new Promise((function(e){var o=n.store.subscribe(function(){var i=c(h.mark((function i(s){return h.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!s){i.next=5;break}return i.next=3,n.attachVideoInternal(t,r);case 3:o(),e();case 5:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}(),Y)})));case 4:return e.next=6,this.attachVideoInternal(t,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.detachVideo=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=6;break}return e.next=4,n.removeSink(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("no video track found to remove sink");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addPluginToVideoTrack=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveVideoPlugin(t,"add",r));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addPluginToAudioTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveAudioPlugin(t,"add"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.removePluginFromVideoTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveVideoPlugin(t,"remove"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.removePluginFromAudioTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveAudioPlugin(t,"remove"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.changeRole=function(){var e=c(h.mark((function e(t,r,n){var o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===n&&(n=!1),o=this.hmsSDKPeers[t]){e.next=5;break}return this.logPossibleInconsistency("Unknown peer ID given "+t+" for changerole"),e.abrupt("return");case 5:return e.next=7,this.sdk.changeRole(o,r,n);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.acceptChangeRole=function(){var e=c(h.mark((function e(t){var r,n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=t.requestedBy?this.hmsSDKPeers[t.requestedBy.id]:void 0)||Pe.w("peer for which role change is requested no longer available - "+t.requestedBy),n={requestedBy:r,role:t.role,token:t.token},e.next=5,this.sdk.acceptChangeRole(n);case 5:this.removeRoleChangeRequest(t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.rejectChangeRole=function(e){this.removeRoleChangeRequest(e)},t.endRoom=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=this.store.getState(ve))&&n.endRoom){e.next=4;break}return Pe.w("You are not allowed to perform this action - endRoom"),e.abrupt("return");case 4:return e.next=6,this.sdk.endRoom(t,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.removePeer=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKPeers[t])||n.isLocal){e.next=6;break}return e.next=4,this.sdk.removePeer(n,r);case 4:e.next=8;break;case 6:return this.logPossibleInconsistency("No remote peer found for peerID - "+t),e.abrupt("return");case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setRemoteTrackEnabled=function(){var e=c(h.mark((function e(t,r){var n,o=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=10;break}if(!(n=this.hmsSDKTracks[t])||!gt(n)){e.next=7;break}return e.next=5,this.sdk.changeTrackState(n,r);case 5:e.next=8;break;case 7:this.logPossibleInconsistency("No remote track with ID "+t+" found for change track state");case 8:e.next=11;break;case 10:Array.isArray(t)&&t.forEach((function(e){return o.setRemoteTrackEnabled(e,r)}));case 11:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setLogLevel=function(e){Pe.level=e,this.sdk.setLogLevel(e)},t.resetState=function(e){void 0===e&&(e="resetState"),this.setState((function(e){Object.assign(e,g())}),e),this.isRoomJoinCalled=!1,this.hmsSDKTracks={}},t.sdkJoinWithListeners=function(e){this.sdk.join(e,{onJoin:this.onJoin.bind(this),onRoomUpdate:this.onRoomUpdate.bind(this),onPeerUpdate:this.onPeerUpdate.bind(this),onTrackUpdate:this.onTrackUpdate.bind(this),onMessageReceived:this.onMessageReceived.bind(this),onError:this.onError.bind(this),onReconnected:this.onReconnected.bind(this),onReconnecting:this.onReconnecting.bind(this),onRoleChangeRequest:this.onRoleChangeRequest.bind(this),onRoleUpdate:this.onRoleUpdate.bind(this),onDeviceChange:this.onDeviceChange.bind(this),onChangeTrackStateRequest:this.onChangeTrackStateRequest.bind(this),onRemovedFromRoom:this.onRemovedFromRoom.bind(this)}),this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)})},t.onRemovedFromRoom=function(e){var t=this.store.getState(Le(e.requestedBy.peerId));t?(this.hmsNotifications.sendLeaveRoom(u({},e,{requestedBy:t})),Pe.i("resetting state after peer removed",e),this.resetState(e.roomEnded?"roomEnded":"removedFromRoom")):this.logPossibleInconsistency("Not found peer who requested leave room, "+e.requestedBy)},t.onDeviceChange=function(e){var t=e.devices;if(t&&(this.setState((function(e){b(e.devices.audioInput,t.audioInput)||(e.devices.audioInput=t.audioInput),b(e.devices.videoInput,t.videoInput)||(e.devices.videoInput=t.videoInput),b(e.devices.audioOutput,t.audioOutput)||(e.devices.audioOutput=t.audioOutput)}),"deviceChange"),this.syncRoomState("deviceChangeSync"),e.selection)){var r=P.convertDeviceChangeUpdate(e);this.hmsNotifications.sendDeviceChange(r)}},t.sdkPreviewWithListeners=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.preview(t,{onPreview:this.onPreview.bind(this),onError:this.onError.bind(this),onDeviceChange:this.onDeviceChange.bind(this)});case 2:this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)});case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.startScreenShare=function(){var e=c(h.mark((function e(t){var r=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState($)){e.next=7;break}return e.next=4,this.sdk.startScreenShare((function(){return r.syncRoomState("screenshareStopped")}),t);case 4:this.syncRoomState("startScreenShare"),e.next=8;break;case 7:this.logPossibleInconsistency("start screenshare is called while it's on");case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.stopScreenShare=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.store.getState($)){e.next=7;break}return e.next=4,this.sdk.stopScreenShare();case 4:this.syncRoomState("stopScreenShare"),e.next=8;break;case 7:this.logPossibleInconsistency("stop screenshare is called while it's not on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.attachVideoInternal=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=7;break}return e.next=4,n.addSink(r);case 4:n instanceof o.HMSRemoteVideoTrack&&n.getSimulcastDefinitions().length>0&&this.setState((function(e){var r=n.getSimulcastLayer();e.tracks[t].layer=r}),"updateLayerOnAttach"),e.next=8;break;case 7:this.logPossibleInconsistency("no video track found to add sink");case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.syncRoomState=function(e){for(var t,r=this,n={},o=[],i={},s={},a={},c=d(this.sdk.getPeers());!(t=c()).done;){var u=t.value,l=P.convertPeer(u);n[l.id]=l,o.push(l.id),this.hmsSDKPeers[l.id]=u;for(var f,p=d([u.audioTrack,u.videoTrack].concat(u.auxiliaryTracks));!(f=p()).done;){var h=f.value;if(h){var v=P.convertTrack(h);i[v.id]=v,s[h.trackId]=h}}l.isLocal&&Object.assign(a,this.getMediaSettings(u))}this.setState((function(e){e.room.peers=o;var t=e.tracks;!function(e,t,r,n){for(var o,i=d(R(Object.keys(e),Object.keys(t)));!(o=i()).done;){var s=o.value,a=e[s],c=t[s];k(a,c)?(b(a.auxiliaryTracks,c.auxiliaryTracks)&&(c.auxiliaryTracks=a.auxiliaryTracks),E(a,c,r,n),Object.assign(a,c)):x(a,c)?delete e[s]:T(a,c)&&(e[s]=c)}}(e.peers,n,i,s),m(t,i),Object.assign(e.settings,a),r.hmsSDKTracks=s,Object.assign(e.roles,P.convertRoles(r.sdk.getRoles())),Object.assign(e.playlist,P.convertPlaylist(r.sdk.getPlaylistManager()))}),e)},t.onPreview=function(e){this.setState((function(t){Object.assign(t.room,P.convertRoom(e)),t.room.roomState=exports.HMSRoomState.Preview}),"previewStart"),this.syncRoomState("previewSync")},t.onJoin=function(e){var t=this;this.setState((function(t){Object.assign(t.room,P.convertRoom(e)),t.room.isConnected=!0,t.room.roomState=exports.HMSRoomState.Connected}),"joined"),this.audioPlaylist=new xt(this.sdk.getPlaylistManager(),exports.HMSPlaylistType.audio,this.syncPlaylistState.bind(this)),this.videoPlaylist=new xt(this.sdk.getPlaylistManager(),exports.HMSPlaylistType.video,this.syncRoomState.bind(this)),this.syncRoomState("joinSync"),this.sdk.getPlaylistManager().onProgress(this.setProgress),this.sdk.getPlaylistManager().onNewTrackStart((function(e){t.syncPlaylistState("playOn"+e.type+"Playlist")})),this.sdk.getPlaylistManager().onPlaylistEnded((function(e){t.syncPlaylistState(e+"PlaylistEnded")}))},t.onRoomUpdate=function(){this.syncRoomState("roomUpdate")},t.onPeerUpdate=function(e,t){if(e!==o.HMSPeerUpdate.BECAME_DOMINANT_SPEAKER&&e!==o.HMSPeerUpdate.RESIGNED_DOMINANT_SPEAKER){var r=this.store.getState(Le(t.peerId)),n="peerUpdate";e===o.HMSPeerUpdate.PEER_JOINED?n="peerJoined":e===o.HMSPeerUpdate.PEER_LEFT&&(n="peerLeft"),this.syncRoomState(n),r||(r=this.store.getState(Le(t.peerId))),this.hmsNotifications.sendPeerUpdate(e,r)}},t.onTrackUpdate=function(e,t,r){e===o.HMSTrackUpdate.TRACK_REMOVED?(this.hmsNotifications.sendTrackUpdate(e,t.trackId),this.handleTrackRemove(t,r)):(this.syncRoomState(e===o.HMSTrackUpdate.TRACK_ADDED?"trackAdded":"trackUpdate"),this.hmsNotifications.sendTrackUpdate(e,t.trackId))},t.onMessageReceived=function(e){var t=P.convertMessage(e);t.read=!1,this.onHMSMessage(t),this.hmsNotifications.sendMessageReceived(t)},t.onHMSMessage=function(e){var t=this;this.setState((function(r){e.id=String(t.store.getState(ie)+1),r.messages.byID[e.id]=e,r.messages.allIDs.push(e.id)}),"newMessage")},t.onAudioLevelUpdate=function(e){this.setState((function(t){var r={};e.forEach((function(e){if(e.track&&e.peer){var n=e.track.trackId;r[n]=e.audioLevel,t.speakers[n]||(t.speakers[n]={audioLevel:e.audioLevel,peerID:e.peer.peerId,trackID:n})}}));for(var n=0,o=Object.entries(t.speakers);n<o.length;n++){var i=o[n],s=i[0],a=i[1];a.audioLevel=r[s]||0,0===a.audioLevel&&delete t.speakers[s]}}),"audioLevel")},t.onChangeTrackStateRequest=function(e){var t=this.store.getState(Le(e.requestedBy.peerId)),r=this.getStoreLocalTrackIDfromSDKTrack(e.track),n=this.store.getState(Ae(r));return t?n?(e.enabled||this.syncRoomState("changeTrackStateRequest"),void this.hmsNotifications.sendChangeTrackStateRequest({requestedBy:t,track:n,enabled:e.enabled})):this.logPossibleInconsistency("Not found track for which track state change was requested, "+e.track):this.logPossibleInconsistency("Not found peer who requested track state change, "+e.requestedBy)},t.onReconnected=function(){this.syncRoomState("reconnectedSync"),this.hmsNotifications.sendReconnected(),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connected}),"reconnected")},t.onReconnecting=function(e){var t=P.convertException(e);Pe.e("Reconnection: received error from sdk",t),this.hmsNotifications.sendReconnecting(t),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Reconnecting,e.errors.push(t)}),"reconnecting")},t.onError=function(e){var t=P.convertException(e);t.isTerminal?(this.leave().then((function(){return console.log("error from SDK, left room.")})),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Failed,e.errors.push(t)}),"errorTerminal")):this.store.getState().errors.length<50&&this.setState((function(e){e.errors.push(t)}),"error"),this.hmsNotifications.sendError(t),Pe.e("received error from sdk",t)},t.handleTrackRemove=function(e,t){var r=this;this.setState((function(n){var o=n.peers[t.peerId],i=n.tracks;if(r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.audioTrack))null==o||delete o.audioTrack;else if(r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.videoTrack))null==o||delete o.videoTrack;else{var s=null==o?void 0:o.auxiliaryTracks.indexOf(e.trackId);s>-1&&r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.auxiliaryTracks[s])&&(null==o||o.auxiliaryTracks.splice(s,1))}delete i[e.trackId],delete r.hmsSDKTracks[e.trackId]}),"trackRemoved")},t.setEnabledSDKTrack=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setEnabled(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("track "+t+" not present, unable to enabled/disable");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalVideoTrackSettings=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalAudioTrackSettings=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.getMediaSettings=function(e){var t,r,n,o,i;return{audioInputDeviceId:null==(t=e.audioTrack)||null==(r=t.getMediaTrackSettings())?void 0:r.deviceId,videoInputDeviceId:null==(n=e.videoTrack)||null==(o=n.getMediaTrackSettings())?void 0:o.deviceId,audioOutputDeviceId:null==(i=this.sdk.getAudioOutput().getDevice())?void 0:i.deviceId}},t.setTrackVolume=function(e,t){var r=this.hmsSDKTracks[t];r?r instanceof o.HMSAudioTrack?(r.setVolume(e),this.syncRoomState("trackVolume")):Pe.w("track "+t+" is not an audio track"):this.logPossibleInconsistency("track "+t+" not present, unable to set volume")},t.localAndVideoUnmuting=function(e){if(this.store.getState(q).videoTrack!==e)return!1;var t=this.store.getState(z),r=this.store.getState(Y);return t&&!r},t.logPossibleInconsistency=function(e){Pe.w("possible inconsistency detected - ",e)},t.addRemoveVideoPlugin=function(){var e=c(h.mark((function e(t,r,n){var o,i;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Invalid plugin received in store"),e.abrupt("return");case 3:if(!(o=this.store.getState(J))){e.next=19;break}if(!(i=this.hmsSDKTracks[o])){e.next=18;break}if("add"!==r){e.next=12;break}return e.next=10,i.addPlugin(t,n);case 10:e.next=15;break;case 12:if("remove"!==r){e.next=15;break}return e.next=15,i.removePlugin(t);case 15:this.syncRoomState(r+"VideoPlugin"),e.next=19;break;case 18:this.logPossibleInconsistency("track "+o+" not present, unable to remove plugin");case 19:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.addRemoveAudioPlugin=function(){var e=c(h.mark((function e(t,r){var n,o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Invalid plugin received in store"),e.abrupt("return");case 3:if(!(n=this.store.getState(G))){e.next=19;break}if(!(o=this.hmsSDKTracks[n])){e.next=18;break}if("add"!==r){e.next=12;break}return e.next=10,o.addPlugin(t);case 10:e.next=15;break;case 12:if("remove"!==r){e.next=15;break}return e.next=15,o.removePlugin(t);case 15:this.syncRoomState(r+"AudioPlugin"),e.next=19;break;case 18:this.logPossibleInconsistency("track "+n+" not present, unable to remove plugin");case 19:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.isSameStoreSDKTrack=function(e,t){var r;return!!t&&(null==(r=this.hmsSDKTracks[t])?void 0:r.trackId)===e},t.onRoleChangeRequest=function(e){this.setState((function(t){0===t.roleChangeRequests.length&&t.roleChangeRequests.push(P.convertRoleChangeRequest(e))}),"roleChangeRequest")},t.removeRoleChangeRequest=function(e){this.setState((function(t){var r=t.roleChangeRequests.findIndex((function(t){return t.token===e.token}));-1!==r&&t.roleChangeRequests.splice(r,1)}),"removeRoleChangeRequest")},t.onRoleUpdate=function(){this.syncRoomState("roleUpdate")},t.getStoreLocalTrackIDfromSDKTrack=function(e){var t=this;return this.store.getState(W).find((function(r){return t.hmsSDKTracks[r].trackId===e.trackId}))},e}(),bt=((mt={})[o.HMSPeerUpdate.PEER_JOINED]=exports.HMSNotificationTypes.PEER_JOINED,mt[o.HMSPeerUpdate.PEER_LEFT]=exports.HMSNotificationTypes.PEER_LEFT,mt[o.HMSPeerUpdate.ROLE_UPDATED]=exports.HMSNotificationTypes.ROLE_UPDATED,mt[o.HMSPeerUpdate.AUDIO_TOGGLED]="PEER_AUDIO_UPDATED",mt[o.HMSPeerUpdate.VIDEO_TOGGLED]="PEER_VIDEO_UPDATED",mt),Rt=((kt={})[o.HMSTrackUpdate.TRACK_ADDED]=exports.HMSNotificationTypes.TRACK_ADDED,kt[o.HMSTrackUpdate.TRACK_REMOVED]=exports.HMSNotificationTypes.TRACK_REMOVED,kt[o.HMSTrackUpdate.TRACK_MUTED]=exports.HMSNotificationTypes.TRACK_MUTED,kt[o.HMSTrackUpdate.TRACK_UNMUTED]=exports.HMSNotificationTypes.TRACK_UNMUTED,kt),Et=function(){function e(e){var t=this;this.id=0,this.onNotification=function(e){return t.eventEmitter.addListener("hmsNotification",e),function(){t.eventEmitter.removeListener("hmsNotification",e)}},this.store=e,this.eventEmitter=new s}var t=e.prototype;return t.sendDeviceChange=function(e){var t,r=this.createNotification(exports.HMSNotificationTypes.DEVICE_CHANGE_UPDATE,e,e.error?exports.HMSNotificationSeverity.ERROR:exports.HMSNotificationSeverity.INFO,"Selected "+e.type+" device - "+(null==(t=e.selection)?void 0:t.label));this.emitEvent(r)},t.sendLeaveRoom=function(e){var t=this.createNotification(e.roomEnded?exports.HMSNotificationTypes.ROOM_ENDED:exports.HMSNotificationTypes.REMOVED_FROM_ROOM,e,exports.HMSNotificationSeverity.INFO,(e.roomEnded?"Room ended":"Removed from room")+" by "+e.requestedBy.name);this.emitEvent(t)},t.sendPeerUpdate=function(e,t){var r=this.store.getState(Le(null==t?void 0:t.id))||t,n=bt[e];if(n){var o=this.createNotification(n,r,exports.HMSNotificationSeverity.INFO);this.emitEvent(o)}},t.sendTrackUpdate=function(e,t){var r=this.store.getState(Ae(t)),n=Rt[e];if(n){var o=this.createNotification(n,r,exports.HMSNotificationSeverity.INFO);this.emitEvent(o)}},t.sendMessageReceived=function(e){var t=this.createNotification(exports.HMSNotificationTypes.NEW_MESSAGE,e,exports.HMSNotificationSeverity.INFO);this.emitEvent(t)},t.sendError=function(e){var t=this.createNotification(exports.HMSNotificationTypes.ERROR,e,exports.HMSNotificationSeverity.ERROR);this.emitEvent(t)},t.sendReconnecting=function(e){var t=this.createNotification(exports.HMSNotificationTypes.RECONNECTING,e,exports.HMSNotificationSeverity.ERROR);this.emitEvent(t)},t.sendReconnected=function(){var e=this.createNotification(exports.HMSNotificationTypes.RECONNECTED,null,exports.HMSNotificationSeverity.INFO);this.emitEvent(e)},t.sendChangeTrackStateRequest=function(e){var t=this.createNotification(exports.HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST,e,exports.HMSNotificationSeverity.INFO);this.emitEvent(t)},t.emitEvent=function(e){this.eventEmitter.emit("hmsNotification",e)},t.createNotification=function(e,t,r,n){return void 0===n&&(n=""),this.id++,{id:this.id,type:e,message:n,data:t,severity:r}},e}(),Pt=function(){function e(t,r,n){this.store=t||e.createNewHMSStore(),this.notifications=n||new Et(this.store),this.actions=r||new Tt(this.store,new o.HMSSdk,this.notifications),this.initialTriggerOnSubscribe=!1}var i=e.prototype;return i.triggerOnSubscribe=function(){this.initialTriggerOnSubscribe||(e.makeStoreTriggerOnSubscribe(this.store),this.initialTriggerOnSubscribe=!0)},i.getStore=function(){return this.store},i.getHMSActions=function(){return this.actions},i.getNotifications=function(){return{onNotification:this.notifications.onNotification}},e.createNewHMSStore=function(){var n=r((function(){return g()})),o=n.setState;n.setState=function(e){var r="function"==typeof e?t(e):e;o(r)};var i=n.getState;return n.getState=function(e){return e?e(i()):i()},e.useShallowCheckInSubscribe(n),u({},n,{namedSetState:e.setUpDevtools(n,"HMSStore")})},e.makeStoreTriggerOnSubscribe=function(e){var t=e.subscribe;e.subscribe=function(r,n,o){return r(e.getState(n),void 0),t(r,n,o)}},e.useShallowCheckInSubscribe=function(e){var t=e.subscribe;e.subscribe=function(e,r,o){return r||(r=function(e){return e}),t(e,r,o=o||n)}},e.setUpDevtools=function(t,r){var n;try{n=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!n)return function(e){t.setState(e)};var o=n.connect(e.devtoolsOptions(r));o.prefix=r?r+" > ":"";var i=t.setState;return t.setState=function(e){i(e),o.send(o.prefix+"setState",t.getState())},o.subscribe(e.devtoolsSubscribe(o,t,i)),o.send("setUpStore",t.getState()),function(e,r){i(e),o.send(r||o.prefix+"action",t.getState())}},e.devtoolsOptions=function(e){return{name:e,actionsBlacklist:["audioLevel","playlistProgress"]}},e.devtoolsSubscribe=function(e,t,r){return function(n){var o,i;if("DISPATCH"===n.type&&n.state)["JUMP_TO_ACTION","JUMP_TO_STATE"].includes(n.payload.type)?r(JSON.parse(n.state)):t.setState(JSON.parse(n.state));else if("DISPATCH"===n.type&&"COMMIT"===(null==(o=n.payload)?void 0:o.type))e.init(t.getState());else if("DISPATCH"===n.type&&"IMPORT_STATE"===(null==(i=n.payload)?void 0:i.type)){var s,a,c=null==(s=n.payload.nextLiftedState)?void 0:s.actionsById;((null==(a=n.payload.nextLiftedState)?void 0:a.computedStates)||[]).forEach((function(n,o){var i=n.state,s=c[o]||e.prefix+"setState";0===o?e.init(i):(r(i),e.send(s,t.getState()))}))}}},e}();Object.defineProperty(exports,"HMSLogLevel",{enumerable:!0,get:function(){return o.HMSLogLevel}}),Object.defineProperty(exports,"HMSSimulcastLayer",{enumerable:!0,get:function(){return o.HMSSimulcastLayer}}),exports.HMSReactiveStore=Pt,exports.createDefaultStoreState=g,exports.selectAudioPlaylist=be,exports.selectAudioPlaylistTrackByPeerID=Ge,exports.selectAudioTrackByPeerID=Ce,exports.selectAudioTrackVolume=Ze,exports.selectAudioVolumeByPeerID=et,exports.selectAuxiliaryAudioByPeerID=je,exports.selectAuxiliaryTracksByPeerID=Ue,exports.selectAvailableRoleNames=fe,exports.selectBroadcastMessages=it,exports.selectBroadcastMessagesUnreadCount=ct,exports.selectCameraStreamByPeerID=_e,exports.selectDegradedTracks=oe,exports.selectDevices=function(e){return e.devices},exports.selectDominantSpeaker=X,exports.selectHMSMessages=ae,exports.selectHMSMessagesCount=ie,exports.selectIsAllowedToPublish=vt,exports.selectIsAllowedToSubscribe=he,exports.selectIsAudioLocallyMuted=Ye,exports.selectIsConnectedToRoom=K,exports.selectIsInPreview=ue,exports.selectIsLocalAudioEnabled=function(e){var t=q(e);return N(e,null==t?void 0:t.audioTrack)},exports.selectIsLocalAudioPluginPresent=function(e){return i.createSelector([St],(function(t){return t.includes(e)}))},exports.selectIsLocalScreenShared=$,exports.selectIsLocalVideoDisplayEnabled=z,exports.selectIsLocalVideoEnabled=Y,exports.selectIsLocalVideoPluginPresent=function(e){return i.createSelector([yt],(function(t){return t.includes(e)}))},exports.selectIsLocallyMutedByPeerID=ze,exports.selectIsPeerAudioEnabled=Qe,exports.selectIsPeerVideoEnabled=Xe,exports.selectIsScreenShareLocallyMutedByPeerID=$e,exports.selectIsSomeoneScreenSharing=ee,exports.selectLocalAudioTrackID=G,exports.selectLocalMediaSettings=function(e){return e.settings},exports.selectLocalPeer=q,exports.selectLocalPeerID=F,exports.selectLocalPeerRole=pe,exports.selectLocalTrackIDs=W,exports.selectLocalVideoTrackID=J,exports.selectMessageIDsInOrder=_,exports.selectMessagesByPeerID=ut,exports.selectMessagesByRole=lt,exports.selectMessagesMap=C,exports.selectMessagesUnreadCountByPeerID=ft,exports.selectMessagesUnreadCountByRole=dt,exports.selectPeerAudioByID=Be,exports.selectPeerByID=Le,exports.selectPeerNameByID=Ne,exports.selectPeerScreenSharing=Z,exports.selectPeerSharingAudio=te,exports.selectPeerSharingVideoPlaylist=ne,exports.selectPeers=B,exports.selectPeersMap=H,exports.selectPeersScreenSharing=re,exports.selectPeersWithAudioStatus=pt,exports.selectPermissions=ve,exports.selectRemotePeers=Q,exports.selectRoleByRoleName=function(e){return i.createSelector([de],(function(t){return t[e]}))},exports.selectRoleChangeRequest=ht,exports.selectRolesMap=de,exports.selectRoom=A,exports.selectRoomStarted=le,exports.selectRoomState=ce,exports.selectScreenShareAudioByPeerID=We,exports.selectScreenShareByPeerID=function(e){return i.createSelector(Je(e),(function(e){return e.video}))},exports.selectScreenSharesByPeerId=Je,exports.selectScreenshareAudioVolumeByPeerID=tt,exports.selectSimulcastLayerByTrack=rt,exports.selectSpeakers=V,exports.selectTrackAudioByID=Ke,exports.selectTrackByID=Ae,exports.selectTracksMap=U,exports.selectUnreadHMSMessagesCount=se,exports.selectVideoPlaylist=Re,exports.selectVideoPlaylistAudioTrackByPeerID=Fe,exports.selectVideoPlaylistVideoTrackByPeerID=qe,exports.selectVideoTrackByPeerID=He; | ||
"use strict";function e(e){return e&&"object"==typeof e&&"default"in e?e.default:e}Object.defineProperty(exports,"__esModule",{value:!0});var t=e(require("immer")),r=e(require("zustand/vanilla")),n=e(require("zustand/shallow")),o=require("@100mslive/hms-video"),i=require("reselect"),s=e(require("events"));function a(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function c(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function s(e){a(i,n,o,s,c,"next",e)}function c(e){a(i,n,o,s,c,"throw",e)}s(void 0)}))}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function d(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(r)return(r=r.call(e)).next.bind(r);if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return l(e,void 0);var r=Object.prototype.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?l(e,void 0):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var f,p,h=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",i=n.asyncIterator||"@@asyncIterator",s=n.toStringTag||"@@toStringTag";function a(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{a({},"")}catch(e){a=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof d?t:d).prototype),i=new R(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,i){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw i;return{value:void 0,done:!0}}for(r.method=o,r.arg=i;;){var s=r.delegate;if(s){var a=k(s,r);if(a){if(a===l)continue;return a}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=u(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===l)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,i),o}function u(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var l={};function d(){}function f(){}function p(){}var h={};a(h,o,(function(){return this}));var v=Object.getPrototypeOf,y=v&&v(v(b([])));y&&y!==t&&r.call(y,o)&&(h=y);var S=p.prototype=d.prototype=Object.create(h);function g(e){["next","throw","return"].forEach((function(t){a(e,t,(function(e){return this._invoke(t,e)}))}))}function m(e,t){var n;this._invoke=function(o,i){function s(){return new t((function(n,s){!function n(o,i,s,a){var c=u(e[o],e,i);if("throw"!==c.type){var l=c.arg,d=l.value;return d&&"object"==typeof d&&r.call(d,"__await")?t.resolve(d.__await).then((function(e){n("next",e,s,a)}),(function(e){n("throw",e,s,a)})):t.resolve(d).then((function(e){l.value=e,s(l)}),(function(e){return n("throw",e,s,a)}))}a(c.arg)}(o,i,n,s)}))}return n=n?n.then(s,s):s()}}function k(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,k(e,t),"throw"===t.method))return l;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return l}var n=u(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,l;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,l):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,l)}function x(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function T(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function R(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(x,this),this.reset(!0)}function b(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:E}}function E(){return{value:void 0,done:!0}}return f.prototype=p,a(S,"constructor",p),a(p,"constructor",f),f.displayName=a(p,s,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,p):(e.__proto__=p,a(e,s,"GeneratorFunction")),e.prototype=Object.create(S),e},e.awrap=function(e){return{__await:e}},g(m.prototype),a(m.prototype,i,(function(){return this})),e.AsyncIterator=m,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var s=new m(c(t,r,n,o),i);return e.isGeneratorFunction(r)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},g(S),a(S,s,"Generator"),a(S,o,(function(){return this})),a(S,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=b,R.prototype={constructor:R,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(T),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return s.type="throw",s.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var i=this.tryEntries[o],s=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var a=r.call(i,"catchLoc"),c=r.call(i,"finallyLoc");if(a&&c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=e,s.arg=t,i?(this.method="next",this.next=i.finallyLoc,l):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),l},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),T(r),l}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;T(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:b(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),l}},e}(e.exports);try{regeneratorRuntime=t}catch(e){"object"==typeof globalThis?globalThis.regeneratorRuntime=t:Function("r","regeneratorRuntime = r")(t)}}(p={exports:{}}),p.exports);(f=exports.HMSRoomState||(exports.HMSRoomState={})).Disconnected="Disconnected",f.Preview="Preview",f.Connecting="Connecting",f.Connected="Connected",f.Reconnecting="Reconnecting",f.Failed="Failed";var v,y,S,g=function(){return{room:{id:"",isConnected:!1,name:"",peers:[],shareableLink:"",hasWaitingRoom:!1,roomState:exports.HMSRoomState.Disconnected},peers:{},tracks:{},playlist:{audio:{list:{},selection:{id:"",hasPrevious:!1,hasNext:!1},progress:0,volume:0,currentTime:0},video:{list:{},selection:{id:"",hasPrevious:!1,hasNext:!1},progress:0,volume:0,currentTime:0}},messages:{byID:{},allIDs:[]},speakers:{},settings:{audioInputDeviceId:"",audioOutputDeviceId:"",videoInputDeviceId:""},devices:{audioInput:[],audioOutput:[],videoInput:[]},roles:{},roleChangeRequests:[],errors:[]}};(exports.HMSMessageType||(exports.HMSMessageType={})).CHAT="chat",(v=exports.HMSNotificationSeverity||(exports.HMSNotificationSeverity={})).INFO="info",v.ERROR="error",v.CRITICAL="critical",(y=exports.HMSNotificationTypes||(exports.HMSNotificationTypes={})).PEER_JOINED="PEER_JOINED",y.PEER_LEFT="PEER_LEFT",y.NEW_MESSAGE="NEW_MESSAGE",y.ERROR="ERROR",y.RECONNECTING="RECONNECTING",y.RECONNECTED="RECONNECTED",y.TRACK_ADDED="TRACK_ADDED",y.TRACK_REMOVED="TRACK_REMOVED",y.TRACK_MUTED="TRACK_MUTED",y.TRACK_UNMUTED="TRACK_UNMUTED",y.ROLE_CHANGE_REQUEST="ROLE_CHANGE_REQUEST",y.ROLE_UPDATED="ROLE_UPDATED",y.CHANGE_TRACK_STATE_REQUEST="CHANGE_TRACK_STATE_REQUEST",y.ROOM_ENDED="ROOM_ENDED",y.REMOVED_FROM_ROOM="REMOVED_FROM_ROOM",y.DEVICE_CHANGE_UPDATE="DEVICE_CHANGE_UPDATE",(S=exports.HMSPlaylistType||(exports.HMSPlaylistType={})).audio="audio",S.video="video";var m=function(e,t){for(var r,n=d(b(Object.keys(e),Object.keys(t)));!(r=n()).done;){var o=r.value,i=e[o],s=t[o];k(i,s)?Object.assign(i,s):x(i,s)?delete e[o]:T(i,s)&&(e[o]=s)}},k=function(e,t){return e&&t},x=function(e,t){return e&&!t},T=function(e,t){return!e&&t},R=function(e,t){if(e===t)return!0;if(!e||!t||e.length!==t.length)return!1;for(var r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0},b=function(e,t){for(var r,n=new Set,o=d(e);!(r=o()).done;)n.add(r.value);for(var i,s=d(t);!(i=s()).done;)n.add(i.value);return Array.from(n)};function E(e,t,r,n){e.isLocal&&e.videoTrack&&t.videoTrack&&e.videoTrack!==t.videoTrack&&(n[e.videoTrack]=n[t.videoTrack],delete n[t.videoTrack],r[e.videoTrack]=r[t.videoTrack],r[e.videoTrack].id=e.videoTrack,delete r[t.videoTrack],t.videoTrack=e.videoTrack)}var P=function(){function e(){}return e.convertPeer=function(e){var t,r,n;return{id:e.peerId,name:e.name,roleName:null==(t=e.role)?void 0:t.name,isLocal:e.isLocal,videoTrack:null==(r=e.videoTrack)?void 0:r.trackId,audioTrack:null==(n=e.audioTrack)?void 0:n.trackId,auxiliaryTracks:e.auxiliaryTracks.map((function(e){return e.trackId})),customerUserId:e.customerUserId,customerDescription:e.customerDescription}},e.convertTrack=function(e){var t={id:e.trackId,source:e.source,type:e.type,enabled:e.enabled,displayEnabled:e.enabled};return this.enrichTrack(t,e),t},e.enrichTrack=function(t,r){var n=r.getMediaTrackSettings();if("screen"===t.source&&"video"===t.type&&(t.displaySurface=n.displaySurface),t.height=n.height,t.width=n.width,t.deviceID=n.deviceId,r instanceof o.HMSRemoteAudioTrack){var i=r.getVolume()||0;t.volume=i}e.enrichVideoTrack(t,r)},e.enrichVideoTrack=function(e,t){t instanceof o.HMSRemoteVideoTrack&&(e.layer=t.getSimulcastLayer(),e.degraded=t.degraded,R(t.getSimulcastDefinitions(),e.layerDefinitions)||(e.layerDefinitions=t.getSimulcastDefinitions())),(t instanceof o.HMSLocalVideoTrack||t instanceof o.HMSLocalAudioTrack)&&(R(t.getPlugins(),e.plugins)||(e.plugins=t.getPlugins()))},e.convertRoom=function(e){return{id:e.id,name:e.name,hasWaitingRoom:e.hasWaitingRoom,shareableLink:e.shareableLink}},e.convertMessage=function(e){var t,r,n;return{sender:e.sender.peerId,senderName:e.sender.name,senderRole:null==(t=e.sender.role)?void 0:t.name,senderUserId:e.sender.customerUserId,recipientPeer:null==(r=e.recipientPeer)?void 0:r.peerId,recipientRoles:null==(n=e.recipientRoles)?void 0:n.map((function(e){return e.name})),time:e.time,type:e.type,message:e.message}},e.convertRoles=function(e){var t={};return e&&e.forEach((function(e){t[e.name]=e})),t},e.convertRoleChangeRequest=function(e){return{requestedBy:e.requestedBy.peerId,roleName:e.role.name,token:e.token}},e.convertException=function(e){return{code:e.code,action:e.action,name:e.name,message:e.message,description:e.description,isTerminal:e.isTerminal,timestamp:new Date}},e.convertDeviceChangeUpdate=function(e){var t={devices:e.devices,selection:e.selection,type:e.type};return e.error&&(t.error=this.convertException(e.error)),t},e.convertPlaylist=function(e){return{audio:this.getConvertedPlaylistType(e,exports.HMSPlaylistType.audio),video:this.getConvertedPlaylistType(e,exports.HMSPlaylistType.video)}},e.getConvertedPlaylistType=function(e,t){var r={},n=e.getCurrentSelection(t),o=e.getCurrentProgress(t),i=e.isPlaying(t),s=e.getVolume(t),a=e.getList(t),c=e.getCurrentIndex(t);return e.getList(t).forEach((function(e){var t=e.url===(null==n?void 0:n.url);r[e.id]=u({},e,{type:e.type,selected:t,playing:t&&i})})),{list:r,selection:{id:null==n?void 0:n.id,hasPrevious:c>0,hasNext:c<a.length-1},progress:o,volume:s,currentTime:e.getCurrentTime(t)}},e}();function M(e,t,r){void 0===r&&(r=D);var n=void 0,o=void 0;if(t)for(var i,s=d(t.auxiliaryTracks);!(i=s()).done;){var a=e[i.value];r(a)&&(o=w(a)?a:o,n=I(a)?a:n)}return{video:n,audio:o}}function w(e){return e&&"audio"===e.type}function I(e){return e&&"video"===e.type}function D(e){return e&&"screen"===e.source}function O(e){return e&&"videoplaylist"===e.source}function L(e){return Boolean(null==e?void 0:e.degraded)}function N(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].enabled}var A=function(e){return e.room},H=function(e){return e.peers},C=function(e){return e.messages.byID},_=function(e){return e.messages.allIDs},U=function(e){return e.tracks},V=function(e){return e.speakers},K=i.createSelector([A],(function(e){return e&&e.isConnected})),B=i.createSelector([A,H],(function(e,t){return e.peers.map((function(e){return t[e]}))})),j=i.createSelector(U,(function(e){return Object.values(e)})),q=i.createSelector(B,(function(e){return e.filter((function(e){return e.isLocal}))[0]})),F=i.createSelector(q,(function(e){return null==e?void 0:e.id})),G=i.createSelector(q,(function(e){return null==e?void 0:e.audioTrack})),J=i.createSelector(q,(function(e){return null==e?void 0:e.videoTrack})),W=i.createSelector([G,J,i.createSelector(q,(function(e){return null==e?void 0:e.auxiliaryTracks}))],(function(e,t,r){var n=[].concat(r);return e&&n.unshift(e),t&&n.unshift(t),n})),Q=i.createSelector(B,(function(e){return e.filter((function(e){return!e.isLocal}))})),X=i.createSelector(H,V,(function(e,t){var r=Object.entries(t).sort((function(e,t){var r,n,o=(null==(r=e[1])?void 0:r.audioLevel)||0;return((null==(n=t[1])?void 0:n.audioLevel)||0)>o?1:-1}));if(r.length>0&&r[0][1].audioLevel&&r[0][1].audioLevel>0){var n=r[0][1].peerID;if(n in e)return e[n]}return null})),Y=function(e){var t=q(e);return N(e,null==t?void 0:t.videoTrack)},z=function(e){var t=q(e);return function(e,t){return!(!t||!e.tracks[t])&&e.tracks[t].displayEnabled}(e,null==t?void 0:t.videoTrack)},$=i.createSelector(q,U,(function(e,t){var r=M(t,e);return!(!r.video&&!r.audio)})),Z=i.createSelector(H,U,(function(e,t){var r=void 0;for(var n in e){var o=e[n],i=M(t,o);if(i.video)return o;i.audio&&!r&&(r=o)}return r})),ee=i.createSelector(Z,(function(e){return!!e})),te=i.createSelector(H,U,(function(e,t){for(var r in e){var n=e[r],o=M(t,n);if(!o.video&&o.audio)return n}})),re=i.createSelector(H,U,(function(e,t){var r=[],n=[];for(var o in e){var i=e[o],s=M(t,i),a=s.audio;s.video?r.push(i):a&&n.push(i)}return r.concat(n)})),ne=i.createSelector(H,U,(function(e,t){for(var r in e){var n=e[r];if(M(t,n,O).video)return n}})),oe=i.createSelector(j,(function(e){return e.filter(L)})),ie=i.createSelector(_,(function(e){return e.length})),se=i.createSelector(C,(function(e){return Object.values(e).filter((function(e){return!e.read})).length})),ae=i.createSelector(_,C,(function(e,t){var r=[];return e.forEach((function(e){r.push(t[e])})),r})),ce=i.createSelector([A],(function(e){return e&&e.roomState})),ue=i.createSelector(ce,(function(e){return e===exports.HMSRoomState.Preview})),le=i.createSelector(A,(function(e){return e.roomState!==exports.HMSRoomState.Disconnected})),de=function(e){return e.roles},fe=i.createSelector([de],(function(e){return Object.keys(e)})),pe=i.createSelector([q,de],(function(e,t){return null!=e&&e.roleName?t[e.roleName]:null})),he=i.createSelector([pe],(function(e){var t;return!(null==e||null==(t=e.subscribeParams)||!t.subscribeToRoles)&&e.subscribeParams.subscribeToRoles.length>0})),ve=i.createSelector(pe,(function(e){return null==e?void 0:e.permissions})),ye=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].list}},Se=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].selection}},ge=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].progress}},me=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].currentTime}},ke=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),function(t){return t.playlist[e].volume}},xe=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),i.createSelector(ye(e),(function(e){return Object.values(e)}))},Te=function(e){return void 0===e&&(e=exports.HMSPlaylistType.audio),i.createSelector(ye(e),Se(e),(function(e,t){if(t.id)return e[t.id]}))},Re={selection:Se(exports.HMSPlaylistType.audio),progress:ge(exports.HMSPlaylistType.audio),currentTime:me(exports.HMSPlaylistType.audio),volume:ke(exports.HMSPlaylistType.audio),list:xe(exports.HMSPlaylistType.audio),selectedItem:Te(exports.HMSPlaylistType.audio)},be={selection:Se(exports.HMSPlaylistType.video),progress:ge(exports.HMSPlaylistType.video),currentTime:me(exports.HMSPlaylistType.audio),volume:ke(exports.HMSPlaylistType.video),list:xe(exports.HMSPlaylistType.video),selectedItem:Te(exports.HMSPlaylistType.video)},Ee="HMS-Store:",Pe=function(){function e(){}return e.v=function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];this.log.apply(this,[o.HMSLogLevel.VERBOSE,e].concat(r))},e.d=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.DEBUG].concat(t))},e.i=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.INFO].concat(t))},e.w=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.WARN].concat(t))},e.e=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];this.log.apply(this,[o.HMSLogLevel.ERROR].concat(t))},e.log=function(e){if(!(this.level.valueOf()>e.valueOf())){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];switch(e){case o.HMSLogLevel.VERBOSE:var i;(i=console).log.apply(i,[Ee].concat(r));break;case o.HMSLogLevel.DEBUG:var s;(s=console).debug.apply(s,[Ee].concat(r));break;case o.HMSLogLevel.INFO:var a;(a=console).info.apply(a,[Ee].concat(r));break;case o.HMSLogLevel.WARN:var c;(c=console).warn.apply(c,[Ee].concat(r));break;case o.HMSLogLevel.ERROR:var u;(u=console).error.apply(u,[Ee].concat(r))}}},e}();function Me(e){return function(t){return function(r){return e(r,t)}}}Pe.level=o.HMSLogLevel.VERBOSE;var we=function(e,t){return t},Ie=function(e,t){return t},De=i.createSelector([H,we],(function(e,t){return t?e[t]:null})),Oe=i.createSelector([U,function(e,t){return t}],(function(e,t){return t?e[t]:null})),Le=Me(De),Ne=Me(i.createSelector(De,(function(e){return null==e?void 0:e.name}))),Ae=Me(Oe),He=Me((function(e,t){var r=De(e,t);if(r&&r.videoTrack&&""!==r.videoTrack)return e.tracks[r.videoTrack]})),Ce=Me((function(e,t){var r=De(e,t);if(r&&r.audioTrack&&""!==r.audioTrack)return e.tracks[r.audioTrack]})),_e=He,Ue=Me((function(e,t){var r=De(e,t);return(null==r?void 0:r.auxiliaryTracks.map((function(t){return e.tracks[t]})))||[]})),Ve=function(e,t){return t?e.speakers[t]:null},Ke=Me(i.createSelector(Ve,(function(e){return(null==e?void 0:e.audioLevel)||0}))),Be=Me(i.createSelector((function(e,t){var r=Ce(t)(e);return Ve(e,null==r?void 0:r.id)}),(function(e){return(null==e?void 0:e.audioLevel)||0}))),je=Me((function(e,t){var r=De(e,t);if(r){var n=null==r?void 0:r.auxiliaryTracks.find((function(t){return w(e.tracks[t])}));return n?e.tracks[n]:void 0}})),qe=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return O(r)&&I(r)}));return r?e[r]:void 0}))),Fe=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return O(r)&&w(r)}));return r?e[r]:void 0}))),Ge=Me(i.createSelector(U,De,(function(e,t){var r=null==t?void 0:t.auxiliaryTracks.find((function(t){var r=e[t];return function(e){return e&&"audioplaylist"===e.source}(r)&&w(r)}));return r?e[r]:void 0}))),Je=Me(i.createSelector(U,De,(function(e,t){return M(e,t)}))),We=function(e){return i.createSelector(Je(e),(function(e){return e.audio}))},Qe=Me((function(e,t){var r=De(e,t);return N(e,null==r?void 0:r.audioTrack)})),Xe=Me((function(e,t){var r=De(e,t);return N(e,null==r?void 0:r.videoTrack)})),Ye=Me((function(e,t){if(t&&e.tracks[t])return 0===e.tracks[t].volume})),ze=Me((function(e,t){var r=De(e,t);return Ye(null==r?void 0:r.audioTrack)(e)})),$e=Me((function(e,t){var r=We(t)(e);return Ye(null==r?void 0:r.id)(e)})),Ze=Me((function(e,t){var r=Oe(e,t);if(r)return"audio"!==r.type?void Pe.w("Please pass audio track here"):r.volume})),et=Me((function(e,t){var r=De(e,t);return Ze(null==r?void 0:r.audioTrack)(e)})),tt=Me((function(e,t){var r=We(t)(e);return Ze(null==r?void 0:r.id)(e)})),rt=Me((function(e,t){var r=Oe(e,t);if(r)return"video"!==r.type?void Pe.w("Please pass video track here"):r.layer})),nt=i.createSelector([ae,F,we],(function(e,t,r){if(r)return e.filter((function(e){var n;return!!(e.recipientPeer||null!=(n=e.recipientRoles)&&n.length)&&!![t,r].includes(e.sender)&&[t,r].includes(e.recipientPeer)}))})),ot=i.createSelector([ae,Ie],(function(e,t){if(t)return e.filter((function(e){var r,n;return!(null==(r=e.recipientRoles)||!r.length)&&(null==(n=e.recipientRoles)?void 0:n.includes(t))}))})),it=i.createSelector(ae,(function(e){return e.filter((function(e){var t;return!(e.recipientPeer||null!=(t=e.recipientRoles)&&t.length)}))})),st=i.createSelector([ot,Ie],(function(e){return e?e.filter((function(e){return!e.read})).length:0})),at=i.createSelector([nt,we],(function(e){return e?e.filter((function(e){return!e.read})).length:0})),ct=i.createSelector(it,(function(e){return e.filter((function(e){return!e.read})).length})),ut=Me(nt),lt=Me(ot),dt=Me(st),ft=Me(at),pt=i.createSelector([H,U],(function(e,t){return Object.values(e).map((function(e){var r;return{peer:e,isAudioEnabled:!!e.audioTrack&&(null==(r=t[e.audioTrack])?void 0:r.enabled)}}))})),ht=i.createSelector([function(e){return e.roleChangeRequests[0]||null},H,de],(function(e,t,r){return e?{requestedBy:t[e.requestedBy],role:r[e.roleName],token:e.token}:null})),vt=i.createSelector([pe],(function(e){var t,r=!1,n=!1,o=!1;return null!=e&&null!=(t=e.publishParams)&&t.allowed&&(r=e.publishParams.allowed.includes("video"),n=e.publishParams.allowed.includes("audio"),o=e.publishParams.allowed.includes("screen")),{video:r,audio:n,screen:o}})),yt=i.createSelector([J,U],(function(e,t){var r,n=null;return e&&(n=t[e]),(null==(r=n)?void 0:r.plugins)||[]})),St=i.createSelector([G,U],(function(e,t){var r,n=null;return e&&(n=t[e]),(null==(r=n)?void 0:r.plugins)||[]}));function gt(e){return e instanceof o.HMSRemoteAudioTrack||e instanceof o.HMSRemoteVideoTrack}var mt,kt,xt=function(){function e(e,t,r){this.playlistManager=e,this.syncPlaylistState=r,this.type=t}var t=e.prototype;return t.play=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Please pass id and type to pause"),e.abrupt("return");case 3:return e.next=5,this.playlistManager.setEnabled(!0,{id:t,type:this.type});case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.pause=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Please pass id and type to pause"),e.abrupt("return");case 3:return e.next=5,this.playlistManager.setEnabled(!1,{id:t,type:this.type});case 5:this.syncPlaylistState("pauseOn"+this.type+"Playlist");case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.playNext=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.playNext(this.type);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.playPrevious=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.playPrevious(this.type);case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.seek=function(e){this.playlistManager.seek(e,this.type),this.syncPlaylistState("seekOn"+this.type+"Playlist")},t.seekTo=function(e){this.playlistManager.seekTo(e,this.type),this.syncPlaylistState("seekToOn"+this.type+"Playlist")},t.setVolume=function(e){this.playlistManager.setVolume(e,this.type),this.syncPlaylistState("setVolumeOn"+this.type+"Playlist")},t.setList=function(e){this.playlistManager.setList(e),this.syncPlaylistState("setListOn"+this.type+"Playlist")},t.stop=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.playlistManager.stop(this.type);case 2:this.syncPlaylistState("stop"+this.type+"Playlist");case 3:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),e}(),Tt=function(){function e(e,t,r){var n=this;this.hmsSDKTracks={},this.hmsSDKPeers={},this.isRoomJoinCalled=!1,this.setProgress=function(e){var t=e.type,r=e.progress;n.setState((function(e){e.playlist[t].progress=r,e.playlist[t].currentTime=n.sdk.getPlaylistManager().getCurrentTime(t)}),"playlistProgress")},this.syncPlaylistState=function(e){for(var t,r=n.sdk.getPeers(),o={},i=d(r);!(t=i()).done;)for(var s,a=t.value,c=d([a.audioTrack,a.videoTrack].concat(a.auxiliaryTracks));!(s=c()).done;){var u=s.value;if(u){var l=P.convertTrack(u);o[l.id]=l}}n.setState((function(e){m(e.tracks,o),Object.assign(e.playlist,P.convertPlaylist(n.sdk.getPlaylistManager()))}),e)},this.setState=function(e,t){return n.store.namedSetState(e,t)},this.store=e,this.sdk=t,this.hmsNotifications=r}var t=e.prototype;return t.unblockAudio=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.getAudioOutput().unblockAutoplay();case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setVolume=function(e,t){t?this.setTrackVolume(e,t):(this.sdk.getAudioOutput().setVolume(e),this.syncRoomState("setVolume"))},t.setAudioOutputDevice=function(e){this.sdk.getAudioOutput().setDevice(e),this.syncRoomState("setAudioOutput")},t.setPreferredLayer=function(e,t){var r=this.hmsSDKTracks[e];r?r instanceof o.HMSRemoteVideoTrack?(r.preferLayer(t),this.syncRoomState("setPreferredLayer")):Pe.w("track "+e+" is not an video track"):this.logPossibleInconsistency("track "+e+" not present, unable to set preffer layer")},t.preview=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.isRoomJoinCalled){e.next=3;break}return this.logPossibleInconsistency("attempting to call preview after join was called"),e.abrupt("return");case 3:return e.prev=3,e.next=6,this.sdkPreviewWithListeners(t);case 6:this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connecting}),"preview"),e.next=13;break;case 9:throw e.prev=9,e.t0=e.catch(3),Pe.e("Cannot show preview. Failed to connect to room - ",e.t0),e.t0;case 13:case"end":return e.stop()}}),e,this,[[3,9]])})));return function(t){return e.apply(this,arguments)}}(),t.join=function(e){if(this.isRoomJoinCalled)this.logPossibleInconsistency("room join is called again");else try{this.sdkJoinWithListeners(e),this.isRoomJoinCalled=!0,this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connecting}),"join")}catch(e){throw this.isRoomJoinCalled=!1,Pe.e("Failed to connect to room - ",e),e}},t.leave=function(){var e=c(h.mark((function e(){var t=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState(le)){e.next=4;break}return this.logPossibleInconsistency("room leave is called when no room is connected"),e.abrupt("return");case 4:return e.abrupt("return",this.sdk.leave().then((function(){t.resetState("leave"),Pe.i("left room")})).catch((function(e){Pe.e("error in leaving room - ",e)})));case 5:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setScreenShareEnabled=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,this.startScreenShare(r);case 3:e.next=7;break;case 5:return e.next=7,this.stopScreenShare();case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addTrack=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return void 0===r&&(r="regular"),e.next=3,this.sdk.addTrack(t,r);case 3:this.syncRoomState("addTrack");case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.removeTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.removeTrack(t);case 2:this.syncRoomState("removeTrack");case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalAudioEnabled=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(G))){e.next=4;break}return e.next=4,this.setEnabledTrack(r,t);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setLocalVideoEnabled=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(J))){e.next=4;break}return e.next=4,this.setEnabledTrack(r,t);case 4:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setEnabledTrack=function(){var e=c(h.mark((function e(t,r){var n,i=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((null==(n=this.store.getState().tracks[t])?void 0:n.enabled)!==r){e.next=4;break}return this.logPossibleInconsistency("local track["+t+"] enabled state - "+r),e.abrupt("return");case 4:return this.setState((function(e){e.tracks[t]?e.tracks[t].displayEnabled=r:i.logPossibleInconsistency("track id not found for setEnabled")}),"displayEnabled"),e.prev=5,e.next=8,this.setEnabledSDKTrack(t,r);case 8:this.syncRoomState("setEnabled"),e.next=16;break;case 11:throw e.prev=11,e.t0=e.catch(5),this.setState((function(e){e.tracks[t].displayEnabled=!r}),"rollbackDisplayEnabled"),this.hmsNotifications.sendError(P.convertException(e.t0)),e.t0;case 16:this.hmsNotifications.sendTrackUpdate(r?o.HMSTrackUpdate.TRACK_UNMUTED:o.HMSTrackUpdate.TRACK_MUTED,t);case 18:case"end":return e.stop()}}),e,this,[[5,11]])})));return function(t,r){return e.apply(this,arguments)}}(),t.setAudioSettings=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(G))){e.next=5;break}return e.next=4,this.setSDKLocalAudioTrackSettings(r,t);case 4:this.syncRoomState("setAudioSettings");case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.setVideoSettings=function(){var e=c(h.mark((function e(t){var r;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(r=this.store.getState(J))){e.next=5;break}return e.next=4,this.setSDKLocalVideoTrackSettings(r,t);case 4:this.syncRoomState("setVideoSettings");case 5:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.sendMessage=function(e){this.sendBroadcastMessage(e)},t.sendBroadcastMessage=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.sendBroadcastMessage(t,r);case 2:this.updateMessageInStore(e.sent,{message:t,type:r});case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.sendGroupMessage=function(){var e=c(h.mark((function e(t,r,n){var o,i;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.store.getState(de),i=r.map((function(e){return o[e]})),e.next=4,this.sdk.sendGroupMessage(t,i,n);case 4:this.updateMessageInStore(e.sent,{message:t,recipientRoles:r,type:n});case 6:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.sendDirectMessage=function(){var e=c(h.mark((function e(t,r,n){var o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=this.hmsSDKPeers[r],e.next=3,this.sdk.sendDirectMessage(t,o);case 3:this.updateMessageInStore(e.sent,{message:t,recipientPeer:o.peerId,type:n});case 5:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.updateMessageInStore=function(e,t){if(!e)throw Pe.w("sendMessage","Failed to send message",t),Error("sendMessage Failed - "+JSON.stringify(t));var r=P.convertMessage(e);return r.read=!0,r.senderName="You",this.onHMSMessage(r),r},t.setMessageRead=function(e,t){var r=this;this.setState((function(n){t?n.messages.byID[t]?n.messages.byID[t].read=e:r.logPossibleInconsistency("no message with id is found"):n.messages.allIDs.forEach((function(t){n.messages.byID[t].read=e}))}),"setMessageRead")},t.attachVideo=function(){var e=c(h.mark((function e(t,r){var n=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.localAndVideoUnmuting(t)){e.next=4;break}return e.abrupt("return",new Promise((function(e){var o=n.store.subscribe(function(){var i=c(h.mark((function i(s){return h.wrap((function(i){for(;;)switch(i.prev=i.next){case 0:if(!s){i.next=5;break}return i.next=3,n.attachVideoInternal(t,r);case 3:o(),e();case 5:case"end":return i.stop()}}),i)})));return function(e){return i.apply(this,arguments)}}(),Y)})));case 4:return e.next=6,this.attachVideoInternal(t,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.detachVideo=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=6;break}return e.next=4,n.removeSink(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("no video track found to remove sink");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addPluginToVideoTrack=function(){var e=c(h.mark((function e(t,r){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveVideoPlugin(t,"add",r));case 1:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.addPluginToAudioTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveAudioPlugin(t,"add"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.removePluginFromVideoTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveVideoPlugin(t,"remove"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.removePluginFromAudioTrack=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.addRemoveAudioPlugin(t,"remove"));case 1:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.changeRole=function(){var e=c(h.mark((function e(t,r,n){var o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(void 0===n&&(n=!1),o=this.hmsSDKPeers[t]){e.next=5;break}return this.logPossibleInconsistency("Unknown peer ID given "+t+" for changerole"),e.abrupt("return");case 5:return e.next=7,this.sdk.changeRole(o,r,n);case 7:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.acceptChangeRole=function(){var e=c(h.mark((function e(t){var r,n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return(r=t.requestedBy?this.hmsSDKPeers[t.requestedBy.id]:void 0)||Pe.w("peer for which role change is requested no longer available - "+t.requestedBy),n={requestedBy:r,role:t.role,token:t.token},e.next=5,this.sdk.acceptChangeRole(n);case 5:this.removeRoleChangeRequest(t);case 6:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.rejectChangeRole=function(e){this.removeRoleChangeRequest(e)},t.endRoom=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(null!=(n=this.store.getState(ve))&&n.endRoom){e.next=4;break}return Pe.w("You are not allowed to perform this action - endRoom"),e.abrupt("return");case 4:return e.next=6,this.sdk.endRoom(t,r);case 6:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.removePeer=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKPeers[t])||n.isLocal){e.next=6;break}return e.next=4,this.sdk.removePeer(n,r);case 4:e.next=8;break;case 6:return this.logPossibleInconsistency("No remote peer found for peerID - "+t),e.abrupt("return");case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.startRTMPOrRecording=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.startRTMPOrRecording(t);case 2:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.stopRTMPAndRecording=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.stopRTMPAndRecording();case 2:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.setRemoteTrackEnabled=function(){var e=c(h.mark((function e(t,r){var n,o=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if("string"!=typeof t){e.next=10;break}if(!(n=this.hmsSDKTracks[t])||!gt(n)){e.next=7;break}return e.next=5,this.sdk.changeTrackState(n,r);case 5:e.next=8;break;case 7:this.logPossibleInconsistency("No remote track with ID "+t+" found for change track state");case 8:e.next=11;break;case 10:Array.isArray(t)&&t.forEach((function(e){return o.setRemoteTrackEnabled(e,r)}));case 11:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setLogLevel=function(e){Pe.level=e,this.sdk.setLogLevel(e)},t.resetState=function(e){void 0===e&&(e="resetState"),this.setState((function(e){Object.assign(e,g())}),e),this.isRoomJoinCalled=!1,this.hmsSDKTracks={}},t.sdkJoinWithListeners=function(e){this.sdk.join(e,{onJoin:this.onJoin.bind(this),onRoomUpdate:this.onRoomUpdate.bind(this),onPeerUpdate:this.onPeerUpdate.bind(this),onTrackUpdate:this.onTrackUpdate.bind(this),onMessageReceived:this.onMessageReceived.bind(this),onError:this.onError.bind(this),onReconnected:this.onReconnected.bind(this),onReconnecting:this.onReconnecting.bind(this),onRoleChangeRequest:this.onRoleChangeRequest.bind(this),onRoleUpdate:this.onRoleUpdate.bind(this),onDeviceChange:this.onDeviceChange.bind(this),onChangeTrackStateRequest:this.onChangeTrackStateRequest.bind(this),onRemovedFromRoom:this.onRemovedFromRoom.bind(this)}),this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)})},t.onRemovedFromRoom=function(e){var t=this.store.getState(Le(e.requestedBy.peerId));t?(this.hmsNotifications.sendLeaveRoom(u({},e,{requestedBy:t})),Pe.i("resetting state after peer removed",e),this.resetState(e.roomEnded?"roomEnded":"removedFromRoom")):this.logPossibleInconsistency("Not found peer who requested leave room, "+e.requestedBy)},t.onDeviceChange=function(e){var t=e.devices;if(t&&(this.setState((function(e){R(e.devices.audioInput,t.audioInput)||(e.devices.audioInput=t.audioInput),R(e.devices.videoInput,t.videoInput)||(e.devices.videoInput=t.videoInput),R(e.devices.audioOutput,t.audioOutput)||(e.devices.audioOutput=t.audioOutput)}),"deviceChange"),this.syncRoomState("deviceChangeSync"),e.selection)){var r=P.convertDeviceChangeUpdate(e);this.hmsNotifications.sendDeviceChange(r)}},t.sdkPreviewWithListeners=function(){var e=c(h.mark((function e(t){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sdk.preview(t,{onPreview:this.onPreview.bind(this),onError:this.onError.bind(this),onDeviceChange:this.onDeviceChange.bind(this)});case 2:this.sdk.addAudioListener({onAudioLevelUpdate:this.onAudioLevelUpdate.bind(this)});case 3:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.startScreenShare=function(){var e=c(h.mark((function e(t){var r=this;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.store.getState($)){e.next=7;break}return e.next=4,this.sdk.startScreenShare((function(){return r.syncRoomState("screenshareStopped")}),t);case 4:this.syncRoomState("startScreenShare"),e.next=8;break;case 7:this.logPossibleInconsistency("start screenshare is called while it's on");case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),t.stopScreenShare=function(){var e=c(h.mark((function e(){return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!this.store.getState($)){e.next=7;break}return e.next=4,this.sdk.stopScreenShare();case 4:this.syncRoomState("stopScreenShare"),e.next=8;break;case 7:this.logPossibleInconsistency("stop screenshare is called while it's not on");case 8:case"end":return e.stop()}}),e,this)})));return function(){return e.apply(this,arguments)}}(),t.attachVideoInternal=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])||"video"!==n.type){e.next=7;break}return e.next=4,n.addSink(r);case 4:n instanceof o.HMSRemoteVideoTrack&&n.getSimulcastDefinitions().length>0&&this.setState((function(e){var r=n.getSimulcastLayer();e.tracks[t].layer=r}),"updateLayerOnAttach"),e.next=8;break;case 7:this.logPossibleInconsistency("no video track found to add sink");case 8:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.syncRoomState=function(e){for(var t,r=this,n={},o=[],i={},s={},a={},c=d(this.sdk.getPeers());!(t=c()).done;){var u=t.value,l=P.convertPeer(u);n[l.id]=l,o.push(l.id),this.hmsSDKPeers[l.id]=u;for(var f,p=d([u.audioTrack,u.videoTrack].concat(u.auxiliaryTracks));!(f=p()).done;){var h=f.value;if(h){var v=P.convertTrack(h);i[v.id]=v,s[h.trackId]=h}}l.isLocal&&Object.assign(a,this.getMediaSettings(u))}this.setState((function(e){e.room.peers=o;var t=e.tracks;!function(e,t,r,n){for(var o,i=d(b(Object.keys(e),Object.keys(t)));!(o=i()).done;){var s=o.value,a=e[s],c=t[s];k(a,c)?(R(a.auxiliaryTracks,c.auxiliaryTracks)&&(c.auxiliaryTracks=a.auxiliaryTracks),E(a,c,r,n),Object.assign(a,c)):x(a,c)?delete e[s]:T(a,c)&&(e[s]=c)}}(e.peers,n,i,s),m(t,i),Object.assign(e.settings,a),r.hmsSDKTracks=s,Object.assign(e.roles,P.convertRoles(r.sdk.getRoles())),Object.assign(e.playlist,P.convertPlaylist(r.sdk.getPlaylistManager()))}),e)},t.onPreview=function(e){this.setState((function(t){Object.assign(t.room,P.convertRoom(e)),t.room.roomState=exports.HMSRoomState.Preview}),"previewStart"),this.syncRoomState("previewSync")},t.onJoin=function(e){var t=this;this.setState((function(t){Object.assign(t.room,P.convertRoom(e)),t.room.isConnected=!0,t.room.roomState=exports.HMSRoomState.Connected}),"joined"),this.audioPlaylist=new xt(this.sdk.getPlaylistManager(),exports.HMSPlaylistType.audio,this.syncPlaylistState.bind(this)),this.videoPlaylist=new xt(this.sdk.getPlaylistManager(),exports.HMSPlaylistType.video,this.syncRoomState.bind(this)),this.syncRoomState("joinSync"),this.sdk.getPlaylistManager().onProgress(this.setProgress),this.sdk.getPlaylistManager().onNewTrackStart((function(e){t.syncPlaylistState("playOn"+e.type+"Playlist")})),this.sdk.getPlaylistManager().onPlaylistEnded((function(e){t.syncPlaylistState(e+"PlaylistEnded")}))},t.onRoomUpdate=function(){this.syncRoomState("roomUpdate")},t.onPeerUpdate=function(e,t){if(e!==o.HMSPeerUpdate.BECAME_DOMINANT_SPEAKER&&e!==o.HMSPeerUpdate.RESIGNED_DOMINANT_SPEAKER){var r=this.store.getState(Le(t.peerId)),n="peerUpdate";e===o.HMSPeerUpdate.PEER_JOINED?n="peerJoined":e===o.HMSPeerUpdate.PEER_LEFT&&(n="peerLeft"),this.syncRoomState(n),r||(r=this.store.getState(Le(t.peerId))),this.hmsNotifications.sendPeerUpdate(e,r)}},t.onTrackUpdate=function(e,t,r){e===o.HMSTrackUpdate.TRACK_REMOVED?(this.hmsNotifications.sendTrackUpdate(e,t.trackId),this.handleTrackRemove(t,r)):(this.syncRoomState(e===o.HMSTrackUpdate.TRACK_ADDED?"trackAdded":"trackUpdate"),this.hmsNotifications.sendTrackUpdate(e,t.trackId))},t.onMessageReceived=function(e){var t=P.convertMessage(e);t.read=!1,this.onHMSMessage(t),this.hmsNotifications.sendMessageReceived(t)},t.onHMSMessage=function(e){var t=this;this.setState((function(r){e.id=String(t.store.getState(ie)+1),r.messages.byID[e.id]=e,r.messages.allIDs.push(e.id)}),"newMessage")},t.onAudioLevelUpdate=function(e){this.setState((function(t){var r={};e.forEach((function(e){if(e.track&&e.peer){var n=e.track.trackId;r[n]=e.audioLevel,t.speakers[n]||(t.speakers[n]={audioLevel:e.audioLevel,peerID:e.peer.peerId,trackID:n})}}));for(var n=0,o=Object.entries(t.speakers);n<o.length;n++){var i=o[n],s=i[0],a=i[1];a.audioLevel=r[s]||0,0===a.audioLevel&&delete t.speakers[s]}}),"audioLevel")},t.onChangeTrackStateRequest=function(e){var t=this.store.getState(Le(e.requestedBy.peerId)),r=this.getStoreLocalTrackIDfromSDKTrack(e.track),n=this.store.getState(Ae(r));return t?n?(e.enabled||this.syncRoomState("changeTrackStateRequest"),void this.hmsNotifications.sendChangeTrackStateRequest({requestedBy:t,track:n,enabled:e.enabled})):this.logPossibleInconsistency("Not found track for which track state change was requested, "+e.track):this.logPossibleInconsistency("Not found peer who requested track state change, "+e.requestedBy)},t.onReconnected=function(){this.syncRoomState("reconnectedSync"),this.hmsNotifications.sendReconnected(),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Connected}),"reconnected")},t.onReconnecting=function(e){var t=P.convertException(e);Pe.e("Reconnection: received error from sdk",t),this.hmsNotifications.sendReconnecting(t),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Reconnecting,e.errors.push(t)}),"reconnecting")},t.onError=function(e){var t=P.convertException(e);t.isTerminal?(this.leave().then((function(){return console.log("error from SDK, left room.")})),this.setState((function(e){e.room.roomState=exports.HMSRoomState.Failed,e.errors.push(t)}),"errorTerminal")):this.store.getState().errors.length<50&&this.setState((function(e){e.errors.push(t)}),"error"),this.hmsNotifications.sendError(t),Pe.e("received error from sdk",t)},t.handleTrackRemove=function(e,t){var r=this;this.setState((function(n){var o=n.peers[t.peerId],i=n.tracks;if(r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.audioTrack))null==o||delete o.audioTrack;else if(r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.videoTrack))null==o||delete o.videoTrack;else{var s=null==o?void 0:o.auxiliaryTracks.indexOf(e.trackId);s>-1&&r.isSameStoreSDKTrack(e.trackId,null==o?void 0:o.auxiliaryTracks[s])&&(null==o||o.auxiliaryTracks.splice(s,1))}delete i[e.trackId],delete r.hmsSDKTracks[e.trackId]}),"trackRemoved")},t.setEnabledSDKTrack=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setEnabled(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("track "+t+" not present, unable to enabled/disable");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalVideoTrackSettings=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.setSDKLocalAudioTrackSettings=function(){var e=c(h.mark((function e(t,r){var n;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!(n=this.hmsSDKTracks[t])){e.next=6;break}return e.next=4,n.setSettings(r);case 4:e.next=7;break;case 6:this.logPossibleInconsistency("local track "+t+" not present, unable to set settings");case 7:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.getMediaSettings=function(e){var t,r,n,o,i;return{audioInputDeviceId:null==(t=e.audioTrack)||null==(r=t.getMediaTrackSettings())?void 0:r.deviceId,videoInputDeviceId:null==(n=e.videoTrack)||null==(o=n.getMediaTrackSettings())?void 0:o.deviceId,audioOutputDeviceId:null==(i=this.sdk.getAudioOutput().getDevice())?void 0:i.deviceId}},t.setTrackVolume=function(e,t){var r=this.hmsSDKTracks[t];r?r instanceof o.HMSAudioTrack?(r.setVolume(e),this.syncRoomState("trackVolume")):Pe.w("track "+t+" is not an audio track"):this.logPossibleInconsistency("track "+t+" not present, unable to set volume")},t.localAndVideoUnmuting=function(e){if(this.store.getState(q).videoTrack!==e)return!1;var t=this.store.getState(z),r=this.store.getState(Y);return t&&!r},t.logPossibleInconsistency=function(e){Pe.w("possible inconsistency detected - ",e)},t.addRemoveVideoPlugin=function(){var e=c(h.mark((function e(t,r,n){var o,i;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Invalid plugin received in store"),e.abrupt("return");case 3:if(!(o=this.store.getState(J))){e.next=19;break}if(!(i=this.hmsSDKTracks[o])){e.next=18;break}if("add"!==r){e.next=12;break}return e.next=10,i.addPlugin(t,n);case 10:e.next=15;break;case 12:if("remove"!==r){e.next=15;break}return e.next=15,i.removePlugin(t);case 15:this.syncRoomState(r+"VideoPlugin"),e.next=19;break;case 18:this.logPossibleInconsistency("track "+o+" not present, unable to remove plugin");case 19:case"end":return e.stop()}}),e,this)})));return function(t,r,n){return e.apply(this,arguments)}}(),t.addRemoveAudioPlugin=function(){var e=c(h.mark((function e(t,r){var n,o;return h.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=3;break}return Pe.w("Invalid plugin received in store"),e.abrupt("return");case 3:if(!(n=this.store.getState(G))){e.next=19;break}if(!(o=this.hmsSDKTracks[n])){e.next=18;break}if("add"!==r){e.next=12;break}return e.next=10,o.addPlugin(t);case 10:e.next=15;break;case 12:if("remove"!==r){e.next=15;break}return e.next=15,o.removePlugin(t);case 15:this.syncRoomState(r+"AudioPlugin"),e.next=19;break;case 18:this.logPossibleInconsistency("track "+n+" not present, unable to remove plugin");case 19:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),t.isSameStoreSDKTrack=function(e,t){var r;return!!t&&(null==(r=this.hmsSDKTracks[t])?void 0:r.trackId)===e},t.onRoleChangeRequest=function(e){this.setState((function(t){0===t.roleChangeRequests.length&&t.roleChangeRequests.push(P.convertRoleChangeRequest(e))}),"roleChangeRequest")},t.removeRoleChangeRequest=function(e){this.setState((function(t){var r=t.roleChangeRequests.findIndex((function(t){return t.token===e.token}));-1!==r&&t.roleChangeRequests.splice(r,1)}),"removeRoleChangeRequest")},t.onRoleUpdate=function(){this.syncRoomState("roleUpdate")},t.getStoreLocalTrackIDfromSDKTrack=function(e){var t=this;return this.store.getState(W).find((function(r){return t.hmsSDKTracks[r].trackId===e.trackId}))},e}(),Rt=((mt={})[o.HMSPeerUpdate.PEER_JOINED]=exports.HMSNotificationTypes.PEER_JOINED,mt[o.HMSPeerUpdate.PEER_LEFT]=exports.HMSNotificationTypes.PEER_LEFT,mt[o.HMSPeerUpdate.ROLE_UPDATED]=exports.HMSNotificationTypes.ROLE_UPDATED,mt[o.HMSPeerUpdate.AUDIO_TOGGLED]="PEER_AUDIO_UPDATED",mt[o.HMSPeerUpdate.VIDEO_TOGGLED]="PEER_VIDEO_UPDATED",mt),bt=((kt={})[o.HMSTrackUpdate.TRACK_ADDED]=exports.HMSNotificationTypes.TRACK_ADDED,kt[o.HMSTrackUpdate.TRACK_REMOVED]=exports.HMSNotificationTypes.TRACK_REMOVED,kt[o.HMSTrackUpdate.TRACK_MUTED]=exports.HMSNotificationTypes.TRACK_MUTED,kt[o.HMSTrackUpdate.TRACK_UNMUTED]=exports.HMSNotificationTypes.TRACK_UNMUTED,kt),Et=function(){function e(e){var t=this;this.id=0,this.onNotification=function(e){return t.eventEmitter.addListener("hmsNotification",e),function(){t.eventEmitter.removeListener("hmsNotification",e)}},this.store=e,this.eventEmitter=new s}var t=e.prototype;return t.sendDeviceChange=function(e){var t,r=this.createNotification(exports.HMSNotificationTypes.DEVICE_CHANGE_UPDATE,e,e.error?exports.HMSNotificationSeverity.ERROR:exports.HMSNotificationSeverity.INFO,"Selected "+e.type+" device - "+(null==(t=e.selection)?void 0:t.label));this.emitEvent(r)},t.sendLeaveRoom=function(e){var t=this.createNotification(e.roomEnded?exports.HMSNotificationTypes.ROOM_ENDED:exports.HMSNotificationTypes.REMOVED_FROM_ROOM,e,exports.HMSNotificationSeverity.INFO,(e.roomEnded?"Room ended":"Removed from room")+" by "+e.requestedBy.name);this.emitEvent(t)},t.sendPeerUpdate=function(e,t){var r=this.store.getState(Le(null==t?void 0:t.id))||t,n=Rt[e];if(n){var o=this.createNotification(n,r,exports.HMSNotificationSeverity.INFO);this.emitEvent(o)}},t.sendTrackUpdate=function(e,t){var r=this.store.getState(Ae(t)),n=bt[e];if(n){var o=this.createNotification(n,r,exports.HMSNotificationSeverity.INFO);this.emitEvent(o)}},t.sendMessageReceived=function(e){var t=this.createNotification(exports.HMSNotificationTypes.NEW_MESSAGE,e,exports.HMSNotificationSeverity.INFO);this.emitEvent(t)},t.sendError=function(e){var t=this.createNotification(exports.HMSNotificationTypes.ERROR,e,exports.HMSNotificationSeverity.ERROR);this.emitEvent(t)},t.sendReconnecting=function(e){var t=this.createNotification(exports.HMSNotificationTypes.RECONNECTING,e,exports.HMSNotificationSeverity.ERROR);this.emitEvent(t)},t.sendReconnected=function(){var e=this.createNotification(exports.HMSNotificationTypes.RECONNECTED,null,exports.HMSNotificationSeverity.INFO);this.emitEvent(e)},t.sendChangeTrackStateRequest=function(e){var t=this.createNotification(exports.HMSNotificationTypes.CHANGE_TRACK_STATE_REQUEST,e,exports.HMSNotificationSeverity.INFO);this.emitEvent(t)},t.emitEvent=function(e){this.eventEmitter.emit("hmsNotification",e)},t.createNotification=function(e,t,r,n){return void 0===n&&(n=""),this.id++,{id:this.id,type:e,message:n,data:t,severity:r}},e}(),Pt=function(){function e(t,r,n){this.store=t||e.createNewHMSStore(),this.notifications=n||new Et(this.store),this.actions=r||new Tt(this.store,new o.HMSSdk,this.notifications),this.initialTriggerOnSubscribe=!1}var i=e.prototype;return i.triggerOnSubscribe=function(){this.initialTriggerOnSubscribe||(e.makeStoreTriggerOnSubscribe(this.store),this.initialTriggerOnSubscribe=!0)},i.getStore=function(){return this.store},i.getHMSActions=function(){return this.actions},i.getNotifications=function(){return{onNotification:this.notifications.onNotification}},e.createNewHMSStore=function(){var n=r((function(){return g()})),o=n.setState;n.setState=function(e){var r="function"==typeof e?t(e):e;o(r)};var i=n.getState;return n.getState=function(e){return e?e(i()):i()},e.useShallowCheckInSubscribe(n),u({},n,{namedSetState:e.setUpDevtools(n,"HMSStore")})},e.makeStoreTriggerOnSubscribe=function(e){var t=e.subscribe;e.subscribe=function(r,n,o){return r(e.getState(n),void 0),t(r,n,o)}},e.useShallowCheckInSubscribe=function(e){var t=e.subscribe;e.subscribe=function(e,r,o){return r||(r=function(e){return e}),t(e,r,o=o||n)}},e.setUpDevtools=function(t,r){var n;try{n=window.__REDUX_DEVTOOLS_EXTENSION__||window.top.__REDUX_DEVTOOLS_EXTENSION__}catch(e){}if(!n)return function(e){t.setState(e)};var o=n.connect(e.devtoolsOptions(r));o.prefix=r?r+" > ":"";var i=t.setState;return t.setState=function(e){i(e),o.send(o.prefix+"setState",t.getState())},o.subscribe(e.devtoolsSubscribe(o,t,i)),o.send("setUpStore",t.getState()),function(e,r){i(e),o.send(r||o.prefix+"action",t.getState())}},e.devtoolsOptions=function(e){return{name:e,actionsBlacklist:["audioLevel","playlistProgress"]}},e.devtoolsSubscribe=function(e,t,r){return function(n){var o,i;if("DISPATCH"===n.type&&n.state)["JUMP_TO_ACTION","JUMP_TO_STATE"].includes(n.payload.type)?r(JSON.parse(n.state)):t.setState(JSON.parse(n.state));else if("DISPATCH"===n.type&&"COMMIT"===(null==(o=n.payload)?void 0:o.type))e.init(t.getState());else if("DISPATCH"===n.type&&"IMPORT_STATE"===(null==(i=n.payload)?void 0:i.type)){var s,a,c=null==(s=n.payload.nextLiftedState)?void 0:s.actionsById;((null==(a=n.payload.nextLiftedState)?void 0:a.computedStates)||[]).forEach((function(n,o){var i=n.state,s=c[o]||e.prefix+"setState";0===o?e.init(i):(r(i),e.send(s,t.getState()))}))}}},e}();Object.defineProperty(exports,"HMSLogLevel",{enumerable:!0,get:function(){return o.HMSLogLevel}}),Object.defineProperty(exports,"HMSSimulcastLayer",{enumerable:!0,get:function(){return o.HMSSimulcastLayer}}),exports.HMSReactiveStore=Pt,exports.createDefaultStoreState=g,exports.selectAudioPlaylist=Re,exports.selectAudioPlaylistTrackByPeerID=Ge,exports.selectAudioTrackByPeerID=Ce,exports.selectAudioTrackVolume=Ze,exports.selectAudioVolumeByPeerID=et,exports.selectAuxiliaryAudioByPeerID=je,exports.selectAuxiliaryTracksByPeerID=Ue,exports.selectAvailableRoleNames=fe,exports.selectBroadcastMessages=it,exports.selectBroadcastMessagesUnreadCount=ct,exports.selectCameraStreamByPeerID=_e,exports.selectDegradedTracks=oe,exports.selectDevices=function(e){return e.devices},exports.selectDominantSpeaker=X,exports.selectHMSMessages=ae,exports.selectHMSMessagesCount=ie,exports.selectIsAllowedToPublish=vt,exports.selectIsAllowedToSubscribe=he,exports.selectIsAudioLocallyMuted=Ye,exports.selectIsConnectedToRoom=K,exports.selectIsInPreview=ue,exports.selectIsLocalAudioEnabled=function(e){var t=q(e);return N(e,null==t?void 0:t.audioTrack)},exports.selectIsLocalAudioPluginPresent=function(e){return i.createSelector([St],(function(t){return t.includes(e)}))},exports.selectIsLocalScreenShared=$,exports.selectIsLocalVideoDisplayEnabled=z,exports.selectIsLocalVideoEnabled=Y,exports.selectIsLocalVideoPluginPresent=function(e){return i.createSelector([yt],(function(t){return t.includes(e)}))},exports.selectIsLocallyMutedByPeerID=ze,exports.selectIsPeerAudioEnabled=Qe,exports.selectIsPeerVideoEnabled=Xe,exports.selectIsScreenShareLocallyMutedByPeerID=$e,exports.selectIsSomeoneScreenSharing=ee,exports.selectLocalAudioTrackID=G,exports.selectLocalMediaSettings=function(e){return e.settings},exports.selectLocalPeer=q,exports.selectLocalPeerID=F,exports.selectLocalPeerRole=pe,exports.selectLocalTrackIDs=W,exports.selectLocalVideoTrackID=J,exports.selectMessageIDsInOrder=_,exports.selectMessagesByPeerID=ut,exports.selectMessagesByRole=lt,exports.selectMessagesMap=C,exports.selectMessagesUnreadCountByPeerID=ft,exports.selectMessagesUnreadCountByRole=dt,exports.selectPeerAudioByID=Be,exports.selectPeerByID=Le,exports.selectPeerNameByID=Ne,exports.selectPeerScreenSharing=Z,exports.selectPeerSharingAudio=te,exports.selectPeerSharingVideoPlaylist=ne,exports.selectPeers=B,exports.selectPeersMap=H,exports.selectPeersScreenSharing=re,exports.selectPeersWithAudioStatus=pt,exports.selectPermissions=ve,exports.selectRemotePeers=Q,exports.selectRoleByRoleName=function(e){return i.createSelector([de],(function(t){return t[e]}))},exports.selectRoleChangeRequest=ht,exports.selectRolesMap=de,exports.selectRoom=A,exports.selectRoomStarted=le,exports.selectRoomState=ce,exports.selectScreenShareAudioByPeerID=We,exports.selectScreenShareByPeerID=function(e){return i.createSelector(Je(e),(function(e){return e.video}))},exports.selectScreenSharesByPeerId=Je,exports.selectScreenshareAudioVolumeByPeerID=tt,exports.selectSimulcastLayerByTrack=rt,exports.selectSpeakers=V,exports.selectTrackAudioByID=Ke,exports.selectTrackByID=Ae,exports.selectTracksMap=U,exports.selectUnreadHMSMessagesCount=se,exports.selectVideoPlaylist=be,exports.selectVideoPlaylistAudioTrackByPeerID=Fe,exports.selectVideoPlaylistVideoTrackByPeerID=qe,exports.selectVideoTrackByPeerID=He; | ||
//# sourceMappingURL=hms-video-store.cjs.production.min.js.map |
{ | ||
"version": "0.2.44", | ||
"version": "0.2.45", | ||
"license": "MIT", | ||
@@ -58,8 +58,8 @@ "main": "dist/index.js", | ||
"peerDependencies": { | ||
"@100mslive/hms-video": "0.0.187", | ||
"@100mslive/hms-video": "0.0.190", | ||
"events": "^3.3.0" | ||
}, | ||
"devDependencies": { | ||
"@100mslive/hms-video": "0.0.190", | ||
"@size-limit/file": "^5.0.3", | ||
"@100mslive/hms-video": "0.0.187", | ||
"events": "^3.3.0", | ||
@@ -66,0 +66,0 @@ "husky": "^6.0.0", |
@@ -421,2 +421,10 @@ import { | ||
async startRTMPOrRecording(params: sdkTypes.RTMPRecordingConfig) { | ||
await this.sdk.startRTMPOrRecording(params); | ||
} | ||
async stopRTMPAndRecording() { | ||
await this.sdk.stopRTMPAndRecording(); | ||
} | ||
async setRemoteTrackEnabled(trackID: HMSTrackID | HMSTrackID[], enabled: boolean) { | ||
@@ -423,0 +431,0 @@ if (typeof trackID === 'string') { |
@@ -26,2 +26,4 @@ import { | ||
import { RTMPRecordingConfig } from '@100mslive/hms-video/dist/interfaces/rtmp-recording-config'; | ||
export { | ||
@@ -50,2 +52,3 @@ HMSPeer, | ||
HMSPlaylistProgressEvent, | ||
RTMPRecordingConfig, | ||
}; |
@@ -12,2 +12,3 @@ import { | ||
import { HMSRoleChangeRequest } from './selectors'; | ||
import { RTMPRecordingConfig } from './hmsSDKStore/sdkTypes'; | ||
@@ -248,2 +249,17 @@ /** | ||
/** | ||
* If you want to start RTMP streaming or recording. | ||
* @param params.meetingURL This is the meeting url which is opened in a headless chrome instance for streaming and recording. | ||
* Make sure this url leads the joiner straight to the room without any preview screen or requiring additional clicks. | ||
* @param params.RTMPURLs The list of ingest URLs where the call as visible in the meeting url should be streamed. | ||
* Optional, when not specified the method is used to just start the recording. | ||
* @param params.record If you want to start the recording or not. | ||
*/ | ||
startRTMPOrRecording(params: RTMPRecordingConfig): Promise<void>; | ||
/** | ||
* If you want to stop both RTMP streaming and recording. | ||
*/ | ||
stopRTMPAndRecording(): Promise<void>; | ||
/** | ||
* Set the type of logs from the SDK you want to be logged in the browser console. | ||
@@ -250,0 +266,0 @@ * |
@@ -15,2 +15,3 @@ export { IHMSStore, IHMSStoreReadOnly as HMSStoreWrapper } from './IHMSStore'; | ||
HMSLogLevel, | ||
RTMPRecordingConfig, | ||
} from './hmsSDKStore/sdkTypes'; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1292511
14414