@webex/internal-media-core 0.0.16-beta → 1.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -2533,7 +2533,8 @@ var getErrorDescription = error => {
2533
2533
  };
2534
2534
 
2535
2535
  var NUM$1 = '\\d+';
2536
- var TOKEN = '\\S+';
2536
+ var SDP_TOKEN$1 = "[!#$%&'*+\\-.^_`{|}~a-zA-Z0-9]+";
2537
+ var ANY_NON_WS$1 = '\\S+';
2537
2538
  var SP$1 = '\\s';
2538
2539
  var REST$1 = '.+';
2539
2540
  class Line$1 {}
@@ -2627,7 +2628,7 @@ class CandidateLine$1 extends Line$1 {
2627
2628
  }
2628
2629
  _a$4$1 = CandidateLine$1;
2629
2630
  CandidateLine$1.ICE_CHARS = "[a-zA-Z0-9+/]+";
2630
- CandidateLine$1.regex = new RegExp("^candidate:(".concat(_a$4$1.ICE_CHARS, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(NUM$1, ") typ (").concat(TOKEN, ")(?: raddr (").concat(TOKEN, "))?(?: rport (").concat(NUM$1, "))?(?: (").concat(REST$1, "))?"));
2631
+ CandidateLine$1.regex = new RegExp("^candidate:(".concat(_a$4$1.ICE_CHARS, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") typ (").concat(ANY_NON_WS$1, ")(?: raddr (").concat(ANY_NON_WS$1, "))?(?: rport (").concat(NUM$1, "))?(?: (").concat(REST$1, "))?"));
2631
2632
  class ConnectionLine$1 extends Line$1 {
2632
2633
  constructor(netType, addrType, ipAddr) {
2633
2634
  super();
@@ -2649,7 +2650,7 @@ class ConnectionLine$1 extends Line$1 {
2649
2650
  return "c=".concat(this.netType, " ").concat(this.addrType, " ").concat(this.ipAddr);
2650
2651
  }
2651
2652
  }
2652
- ConnectionLine$1.regex = new RegExp("^(".concat(TOKEN, ") (").concat(TOKEN, ") (").concat(TOKEN, ")"));
2653
+ ConnectionLine$1.regex = new RegExp("^(".concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ")"));
2653
2654
  class ContentLine$1 extends Line$1 {
2654
2655
  constructor(values) {
2655
2656
  super();
@@ -2721,7 +2722,7 @@ class ExtMapLine$1 extends Line$1 {
2721
2722
  }
2722
2723
  _a$3$1 = ExtMapLine$1;
2723
2724
  ExtMapLine$1.EXTMAP_DIRECTION = "sendonly|recvonly|sendrecv|inactive";
2724
- ExtMapLine$1.regex = new RegExp("^extmap:(".concat(NUM$1, ")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION, "))? (").concat(TOKEN, ")(?: (").concat(REST$1, "))?"));
2725
+ ExtMapLine$1.regex = new RegExp("^extmap:(".concat(NUM$1, ")(?:/(").concat(_a$3$1.EXTMAP_DIRECTION, "))? (").concat(ANY_NON_WS$1, ")(?: (").concat(REST$1, "))?"));
2725
2726
  class FingerprintLine$1 extends Line$1 {
2726
2727
  constructor(fingerprint) {
2727
2728
  super();
@@ -2795,7 +2796,7 @@ class IcePwdLine$1 extends Line$1 {
2795
2796
  return "a=ice-pwd:".concat(this.pwd);
2796
2797
  }
2797
2798
  }
2798
- IcePwdLine$1.regex = new RegExp("^ice-pwd:(".concat(TOKEN, ")$"));
2799
+ IcePwdLine$1.regex = new RegExp("^ice-pwd:(".concat(ANY_NON_WS$1, ")$"));
2799
2800
  class IceUfragLine$1 extends Line$1 {
2800
2801
  constructor(ufrag) {
2801
2802
  super();
@@ -2813,7 +2814,7 @@ class IceUfragLine$1 extends Line$1 {
2813
2814
  return "a=ice-ufrag:".concat(this.ufrag);
2814
2815
  }
2815
2816
  }
2816
- IceUfragLine$1.regex = new RegExp("^ice-ufrag:(".concat(TOKEN, ")$"));
2817
+ IceUfragLine$1.regex = new RegExp("^ice-ufrag:(".concat(ANY_NON_WS$1, ")$"));
2817
2818
  class MaxMessageSizeLine$1 extends Line$1 {
2818
2819
  constructor(maxMessageSize) {
2819
2820
  super();
@@ -2858,7 +2859,7 @@ class MediaLine$1 extends Line$1 {
2858
2859
  }
2859
2860
  _a$2$1 = MediaLine$1;
2860
2861
  MediaLine$1.MEDIA_TYPE = 'audio|video|application';
2861
- MediaLine$1.regex = new RegExp("^(".concat(_a$2$1.MEDIA_TYPE, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(REST$1, ")"));
2862
+ MediaLine$1.regex = new RegExp("^(".concat(_a$2$1.MEDIA_TYPE, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(REST$1, ")"));
2862
2863
  class MidLine$1 extends Line$1 {
2863
2864
  constructor(mid) {
2864
2865
  super();
@@ -2876,7 +2877,7 @@ class MidLine$1 extends Line$1 {
2876
2877
  return "a=mid:".concat(this.mid);
2877
2878
  }
2878
2879
  }
2879
- MidLine$1.regex = new RegExp("^mid:(".concat(TOKEN, ")$"));
2880
+ MidLine$1.regex = new RegExp("^mid:(".concat(ANY_NON_WS$1, ")$"));
2880
2881
  class OriginLine$1 extends Line$1 {
2881
2882
  constructor(username, sessionId, sessionVersion, netType, addrType, ipAddr) {
2882
2883
  super();
@@ -2904,7 +2905,7 @@ class OriginLine$1 extends Line$1 {
2904
2905
  return "o=".concat(this.username, " ").concat(this.sessionId, " ").concat(this.sessionVersion, " ").concat(this.netType, " ").concat(this.addrType, " ").concat(this.ipAddr);
2905
2906
  }
2906
2907
  }
2907
- OriginLine$1.regex = new RegExp("^(".concat(TOKEN, ") (").concat(TOKEN, ") (").concat(NUM$1, ") (").concat(TOKEN, ") (").concat(TOKEN, ") (").concat(TOKEN, ")"));
2908
+ OriginLine$1.regex = new RegExp("^(".concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(NUM$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ") (").concat(ANY_NON_WS$1, ")"));
2908
2909
  var _a$1$1;
2909
2910
  class RidLine$1 extends Line$1 {
2910
2911
  constructor(id, direction, params) {
@@ -3172,7 +3173,60 @@ class SimulcastLine$1 extends Line$1 {
3172
3173
  return str;
3173
3174
  }
3174
3175
  }
3175
- SimulcastLine$1.regex = new RegExp("^simulcast:(send|recv) (".concat(TOKEN, ")(?: (send|recv) (").concat(TOKEN, "))?"));
3176
+ SimulcastLine$1.regex = new RegExp("^simulcast:(send|recv) (".concat(ANY_NON_WS$1, ")(?: (send|recv) (").concat(ANY_NON_WS$1, "))?"));
3177
+ class SsrcLine$1 extends Line$1 {
3178
+ constructor(ssrcId, attribute) {
3179
+ var attributeValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
3180
+ var attributeData = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : undefined;
3181
+ super();
3182
+ this.ssrcId = ssrcId;
3183
+ this.attribute = attribute;
3184
+ this.attributeValue = attributeValue;
3185
+ this.attributeData = attributeData;
3186
+ }
3187
+ static fromSdpLine(line) {
3188
+ if (!SsrcLine$1.regex.test(line)) {
3189
+ return undefined;
3190
+ }
3191
+ var tokens = line.match(SsrcLine$1.regex);
3192
+ var ssrcId = parseInt(tokens[1], 10);
3193
+ var attribute = tokens[2];
3194
+ var attributeValue = tokens[3];
3195
+ var attributeData = tokens[4];
3196
+ return new SsrcLine$1(ssrcId, attribute, attributeValue, attributeData);
3197
+ }
3198
+ toSdpLine() {
3199
+ var str = "a=ssrc:".concat(this.ssrcId, " ").concat(this.attribute);
3200
+ if (this.attributeValue) {
3201
+ str += ":".concat(this.attributeValue);
3202
+ }
3203
+ if (this.attributeData) {
3204
+ str += " ".concat(this.attributeData);
3205
+ }
3206
+ return str;
3207
+ }
3208
+ }
3209
+ SsrcLine$1.regex = new RegExp("^ssrc:(".concat(NUM$1, ") (").concat(SDP_TOKEN$1, ")(?::(").concat(SDP_TOKEN$1, ")?(?: (").concat(ANY_NON_WS$1, "))?)?$"));
3210
+ class SsrcGroupLine$1 extends Line$1 {
3211
+ constructor(semantics, ssrcs) {
3212
+ super();
3213
+ this.semantics = semantics;
3214
+ this.ssrcs = ssrcs;
3215
+ }
3216
+ static fromSdpLine(line) {
3217
+ if (!SsrcGroupLine$1.regex.test(line)) {
3218
+ return undefined;
3219
+ }
3220
+ var tokens = line.match(SsrcGroupLine$1.regex);
3221
+ var semantics = tokens[1];
3222
+ var ssrcs = tokens[2].split(' ').map(ssrcStr => parseInt(ssrcStr, 10));
3223
+ return new SsrcGroupLine$1(semantics, ssrcs);
3224
+ }
3225
+ toSdpLine() {
3226
+ return "a=ssrc-group:".concat(this.semantics, " ").concat(this.ssrcs.join(' '));
3227
+ }
3228
+ }
3229
+ SsrcGroupLine$1.regex = new RegExp("^ssrc-group:(SIM|FID|FEC) ((?:".concat(NUM$1).concat(SP$1, "*)+)"));
3176
3230
  class TimingLine$1 extends Line$1 {
3177
3231
  constructor(startTime, stopTime) {
3178
3232
  super();
@@ -3409,6 +3463,8 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3409
3463
  this.rids = [];
3410
3464
  this.codecs = new Map();
3411
3465
  this.rtcpMux = false;
3466
+ this.ssrcs = [];
3467
+ this.ssrcGroups = [];
3412
3468
  this.pts = mediaLine.formats.map(fmt => {
3413
3469
  return parseInt(fmt, 10);
3414
3470
  });
@@ -3448,6 +3504,8 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3448
3504
  lines.push(new DirectionLine$1(this.direction));
3449
3505
  }
3450
3506
  this.codecs.forEach(codec => lines.push(...codec.toLines()));
3507
+ lines.push(...this.ssrcs);
3508
+ lines.push(...this.ssrcGroups);
3451
3509
  lines.push(...this.otherLines);
3452
3510
  return lines;
3453
3511
  }
@@ -3486,6 +3544,14 @@ class AvMediaDescription$1 extends MediaDescription$1 {
3486
3544
  codec.addLine(line);
3487
3545
  return true;
3488
3546
  }
3547
+ if (line instanceof SsrcLine$1) {
3548
+ this.ssrcs.push(line);
3549
+ return true;
3550
+ }
3551
+ if (line instanceof SsrcGroupLine$1) {
3552
+ this.ssrcGroups.push(line);
3553
+ return true;
3554
+ }
3489
3555
  this.otherLines.push(line);
3490
3556
  return true;
3491
3557
  }
@@ -3630,6 +3696,8 @@ class SdpGrammar$1 extends Grammar$1 {
3630
3696
  this.addParser('a', RidLine$1.fromSdpLine);
3631
3697
  this.addParser('a', CandidateLine$1.fromSdpLine);
3632
3698
  this.addParser('a', SimulcastLine$1.fromSdpLine);
3699
+ this.addParser('a', SsrcLine$1.fromSdpLine);
3700
+ this.addParser('a', SsrcGroupLine$1.fromSdpLine);
3633
3701
  }
3634
3702
  }
3635
3703
  var DefaultSdpGrammar$1 = new SdpGrammar$1();
@@ -4857,7 +4925,12 @@ class LocalTrack extends EventEmitter$2 {
4857
4925
  * Cleanup local microphone track.
4858
4926
  */
4859
4927
  disposeEffects() {
4860
- this.effects.forEach(effect => effect.dispose());
4928
+ if (this.effects.size > 0) {
4929
+ this.effects.forEach(effect => effect.dispose());
4930
+ this.effects.clear();
4931
+ this.underlyingStream = this.originalStream;
4932
+ this.emit(LocalTrackEvents.UnderlyingTrackChange);
4933
+ }
4861
4934
  }
4862
4935
  }
4863
4936
  LocalTrack.Events = LocalTrackEvents;
@@ -8044,10 +8117,11 @@ adapterFactory$1({
8044
8117
  /**
8045
8118
  * Creates an RTCPeerConnection.
8046
8119
  *
8120
+ * @param configuration - Config to the RTCPeerConnection constructor.
8047
8121
  * @returns An RTCPeerConnection instance.
8048
8122
  */
8049
- function createRTCPeerConnection() {
8050
- return new RTCPeerConnection();
8123
+ function createRTCPeerConnection(configuration) {
8124
+ return new RTCPeerConnection(configuration);
8051
8125
  }
8052
8126
 
8053
8127
  /**
@@ -8069,11 +8143,13 @@ var PeerConnectionEvents;
8069
8143
  class PeerConnection extends EventEmitter$2 {
8070
8144
  /**
8071
8145
  * Creates an instance of the RTCPeerConnection.
8146
+ *
8147
+ * @param configuration - Config to the RTCPeerConnection constructor.
8072
8148
  */
8073
- constructor() {
8149
+ constructor(configuration) {
8074
8150
  super();
8075
8151
  logger$3.log('PeerConnection init');
8076
- this.pc = createRTCPeerConnection();
8152
+ this.pc = createRTCPeerConnection(configuration);
8077
8153
  this.connectionStateHandler = new ConnectionStateHandler(() => {
8078
8154
  return {
8079
8155
  connectionState: this.pc.connectionState,
@@ -8265,6 +8341,17 @@ class PeerConnection extends EventEmitter$2 {
8265
8341
  getTransceivers() {
8266
8342
  return this.pc.getTransceivers();
8267
8343
  }
8344
+ /**
8345
+ * Get statistics about either the overall connection or about the specified MediaStreamTrack.
8346
+ *
8347
+ * @param selector - An optional MediaStreamTrack for which to gather statistics. If not provided,
8348
+ * statistics will be gathered for the entire underlying RTCPeerConnection.
8349
+ * @returns - A Promise which resolves with an RTCStatsReport object providing connection
8350
+ * statistics.
8351
+ */
8352
+ getStats(selector) {
8353
+ return this.pc.getStats(selector);
8354
+ }
8268
8355
  /**
8269
8356
  * Returns a string that describes the connections' ICE gathering state.
8270
8357
  *
@@ -8850,7 +8937,11 @@ class JmpSession extends EventEmitter$4 {
8850
8937
  }
8851
8938
  updateSourceIndication(numTotalSources, numLiveSources, sources) {
8852
8939
  var _a;
8853
- var sourceIndicationMsg = new SourceIndicationMsg(this.currSourceIndicationSeqNum++, numTotalSources, numLiveSources, sources);
8940
+ var filteredSources = sources.filter(source => {
8941
+ var _a;
8942
+ return (_a = this.lastReceivedScr) === null || _a === void 0 ? void 0 : _a.requests.some(req => req.ids.find(streamId => compareStreamIds(streamId, source.id)));
8943
+ });
8944
+ var sourceIndicationMsg = new SourceIndicationMsg(this.currSourceIndicationSeqNum++, numTotalSources, numLiveSources, filteredSources);
8854
8945
  var jmpMsg = new JmpMsg(this.mediaFamily, this.mediaContent, {
8855
8946
  msgType: JmpMsgType$1.SourceIndication,
8856
8947
  payload: sourceIndicationMsg
@@ -8995,94 +9086,13 @@ class JmpSession extends EventEmitter$4 {
8995
9086
  (_a = this.txCallback) === null || _a === void 0 ? void 0 : _a.call(this, JSON.stringify(homerMsg));
8996
9087
  }
8997
9088
  }
8998
- var MediaCodecMimeType;
8999
- (function (MediaCodecMimeType) {
9000
- MediaCodecMimeType["H264"] = "video/H264";
9001
- MediaCodecMimeType["AV1"] = "video/AV1";
9002
- MediaCodecMimeType["OPUS"] = "audio/opus";
9003
- })(MediaCodecMimeType || (MediaCodecMimeType = {}));
9004
- var defaultGlobalMaxVideoFrameSize = 8160;
9005
- var defaultGlobalMaxVideoMbps = 244800;
9006
- var defaultMaxFrameSize = 3600;
9007
- var maxFrameSizeToMaxBitrateMap = new Map([[60, 99000], [240, 199000], [576, 300000], [920, 640000], [1296, 720000], [2304, 880000], [3600, 2500000], [8160, 4000000]]);
9008
- function parseFmtpParams(fmtpParams) {
9009
- fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
9010
- var fmtpObj = {};
9011
- fmtpParams.split(';').forEach(param => {
9012
- var paramArr = param && param.split('=');
9013
- if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
9014
- throw new Error("Fmtp params is invalid with ".concat(fmtpParams));
9015
- }
9016
- fmtpObj[paramArr[0]] = paramArr[1];
9017
- });
9018
- return fmtpObj;
9019
- }
9020
- function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
9021
- var senderProfile = Number.parseInt("0x".concat(senderProfileLevelId), 16);
9022
- var recvProfile = Number.parseInt("0x".concat(receiverProfileLevelId), 16);
9023
- var senderProfileIdc = senderProfile >> 16;
9024
- var recvProfileIdc = recvProfile >> 16;
9025
- var senderProfileIop = (senderProfile & 0x00ff00) >> 8;
9026
- var recvProfileIop = (recvProfile & 0x00ff00) >> 8;
9027
- var senderLevelIdc = senderProfile & 0x0000ff;
9028
- var recvLevelIdc = recvProfile & 0x0000ff;
9029
- var areProfileCompatible = senderProfileIdc === recvProfileIdc && senderProfileIop === recvProfileIop || senderProfileIdc === 0x42 && recvProfileIdc === 0x42 && (senderProfileIop & 0x40) === (recvProfileIop & 0x40);
9030
- var isLevelIdcCompatible = levelAsymmetryAllowed ? true : senderLevelIdc <= recvLevelIdc;
9031
- return areProfileCompatible && isLevelIdcCompatible;
9032
- }
9033
- function areCodecsCompatible(senderCodec, receiverCodec) {
9034
- return Object.keys(receiverCodec).every(key => {
9035
- if (!senderCodec[key] || !receiverCodec[key]) {
9036
- return false;
9037
- }
9038
- if (key === 'payloadType') {
9039
- return true;
9040
- }
9041
- if (key === 'sdpFmtpLine') {
9042
- var fmtpForSender = parseFmtpParams(senderCodec[key]);
9043
- var fmtpForReceiver = parseFmtpParams(receiverCodec[key]);
9044
- var levelAsymmetryAllowed = Object.keys(fmtpForSender).some(senderFmtpParamKey => {
9045
- return senderFmtpParamKey === 'level-asymmetry-allowed' && fmtpForReceiver[senderFmtpParamKey] === '1' && fmtpForSender[senderFmtpParamKey] === '1';
9046
- });
9047
- return Object.keys(fmtpForSender).every(senderFmtpParamKey => {
9048
- if (fmtpForReceiver[senderFmtpParamKey]) {
9049
- if (senderFmtpParamKey === 'profile-level-id') {
9050
- return areProfileLevelIdsCompatible(fmtpForSender[senderFmtpParamKey], fmtpForReceiver[senderFmtpParamKey], levelAsymmetryAllowed);
9051
- }
9052
- }
9053
- if (senderFmtpParamKey === 'packetization-mode') {
9054
- return fmtpForSender[senderFmtpParamKey] === fmtpForReceiver[senderFmtpParamKey];
9055
- }
9056
- return true;
9057
- });
9058
- }
9059
- return senderCodec[key] === receiverCodec[key];
9060
- });
9061
- }
9062
- function gcd(a, b) {
9063
- return b === 0 ? a : gcd(b, a % b);
9064
- }
9065
- function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
9066
- var _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
9067
- var minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
9068
- var minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
9069
- return Math.floor(Math.sqrt(requestedMaxFs * 16 * 16 / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight;
9070
- }
9071
- function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
9072
- return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
9073
- }
9074
- function getMaxBitrate(requestedMaxFs) {
9075
- var maxFs = requestedMaxFs || defaultMaxFrameSize;
9076
- var expectedHeight = [...maxFrameSizeToMaxBitrateMap.keys()].sort((a, b) => b - a).find(h => maxFs >= h);
9077
- return maxFrameSizeToMaxBitrateMap.get(expectedHeight);
9078
- }
9079
9089
  class MediaRequest {
9080
- constructor(policy, policySpecificInfo, receiveSlots, codecInfos) {
9081
- var _a, _b;
9090
+ constructor(policy, policySpecificInfo, receiveSlots, maxPayloadBitsPerSecond) {
9091
+ var codecInfos = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : [];
9082
9092
  this.policy = policy;
9083
9093
  this.policySpecificInfo = policySpecificInfo;
9084
9094
  this.receiveSlots = receiveSlots;
9085
- this.maxPayloadBitsPerSecond = getMaxBitrate((_b = (_a = codecInfos === null || codecInfos === void 0 ? void 0 : codecInfos[0]) === null || _a === void 0 ? void 0 : _a.h264) === null || _b === void 0 ? void 0 : _b.maxFs);
9095
+ this.maxPayloadBitsPerSecond = maxPayloadBitsPerSecond;
9086
9096
  this.codecInfos = codecInfos;
9087
9097
  }
9088
9098
  _toJmpScrRequest() {
@@ -9682,6 +9692,41 @@ var uuid_1 = require$$0;
9682
9692
  var deepCopy$1 = function deepCopy$1(value) {
9683
9693
  return JSON.parse(JSON.stringify(value));
9684
9694
  };
9695
+ /**
9696
+ * Check deep equality between two values.
9697
+ *
9698
+ * @param value1 - First value to check.
9699
+ * @param value2 - Second value to check.
9700
+ * @returns True if values are deeply equal, false otherwise.
9701
+ */
9702
+ var deepEqual = function deepEqual(value1, value2) {
9703
+ // If both immutable values are equal, return true.
9704
+ if (value1 === value2) {
9705
+ return true;
9706
+ }
9707
+ // If both are objects, we check the length and properties of each.
9708
+ if (value1 && value2 && typeof value1 === 'object' && typeof value2 === 'object') {
9709
+ if (value1.constructor !== value2.constructor) return false;
9710
+ // Return false if the objects are of different sizes.
9711
+ if (Object.keys(value1).length !== Object.keys(value2).length) {
9712
+ return false;
9713
+ }
9714
+ // Deep equal check each property in the opject.
9715
+ for (var prop in value1) {
9716
+ if (value2.hasOwnProperty(prop)) {
9717
+ if (!deepEqual(value1[prop], value2[prop])) {
9718
+ return false;
9719
+ }
9720
+ } else {
9721
+ return false;
9722
+ }
9723
+ }
9724
+ // Return true if we found no differing properties.
9725
+ return true;
9726
+ }
9727
+ // Return false if no other conditions are met.
9728
+ return false;
9729
+ };
9685
9730
  /**
9686
9731
  * Translates a RTCStatsReport into an object.
9687
9732
  *
@@ -9698,6 +9743,18 @@ var map2obj = function map2obj(report) {
9698
9743
  });
9699
9744
  return o;
9700
9745
  };
9746
+ var persistedKeys = ['type', 'id', 'timestamp'];
9747
+ /**
9748
+ * Check to see if the report consists of more than just the persisted metadata.
9749
+ *
9750
+ * @param report - The report line being checked.
9751
+ * @returns True if the report item contains non-persisted keys, false otherwise.
9752
+ */
9753
+ var hasNonMetadata = function hasNonMetadata(report) {
9754
+ return !!Object.keys(report).filter(function (key) {
9755
+ return !persistedKeys.includes(key);
9756
+ }).length;
9757
+ };
9701
9758
  /**
9702
9759
  * Apply a delta compression to the stats report. Reduces size by ~90%.
9703
9760
  * To reduce further, report keys could be compressed.
@@ -9710,19 +9767,21 @@ var deltaCompression = function deltaCompression(oldStats, newStats) {
9710
9767
  var updatedStats = deepCopy$1(newStats);
9711
9768
  Object.keys(updatedStats).forEach(function (id) {
9712
9769
  var report = updatedStats[id];
9713
- delete report.id;
9714
9770
  if (!oldStats[id]) {
9715
9771
  return;
9716
9772
  }
9773
+ // Persist specific values beyond delta compression, as long as they
9774
+ // aren't the only non-deduped keys.
9717
9775
  Object.keys(report).forEach(function (name) {
9718
- if (report[name] === oldStats[id][name]) {
9776
+ if (deepEqual(report[name], oldStats[id][name]) && !persistedKeys.includes(name)) {
9719
9777
  delete updatedStats[id][name];
9720
9778
  }
9721
- if (Object.keys(report).length === 0 || Object.keys(report).length === 1 && report.timestamp) {
9779
+ if (!hasNonMetadata(report)) {
9722
9780
  delete updatedStats[id];
9723
9781
  }
9724
9782
  });
9725
9783
  });
9784
+ // Use the most recent timestamp.
9726
9785
  var timestamp = -Infinity;
9727
9786
  Object.keys(updatedStats).forEach(function (id) {
9728
9787
  var report = updatedStats[id];
@@ -9730,15 +9789,42 @@ var deltaCompression = function deltaCompression(oldStats, newStats) {
9730
9789
  timestamp = report.timestamp;
9731
9790
  }
9732
9791
  });
9792
+ // Delete the timestamps on each item.
9733
9793
  Object.keys(updatedStats).forEach(function (id) {
9734
9794
  var report = updatedStats[id];
9735
9795
  if (report.timestamp === timestamp) {
9736
- report.timestamp = 0;
9796
+ delete report.timestamp;
9737
9797
  }
9738
9798
  });
9739
9799
  updatedStats.timestamp = timestamp;
9740
9800
  return updatedStats;
9741
9801
  };
9802
+ /**
9803
+ * Format the stats report into an array.
9804
+ *
9805
+ * @param report - A WebRTC stats report.
9806
+ * @returns - An array of Stats Report items.
9807
+ */
9808
+ var formatStatsReport = function formatStatsReport(report) {
9809
+ return Object.keys(report).filter(function (name) {
9810
+ return name !== 'timestamp';
9811
+ }).map(function (name) {
9812
+ return report[name];
9813
+ });
9814
+ };
9815
+ /**
9816
+ * Parametrize a single string event to contain type and an (empty) id.
9817
+ *
9818
+ * @param value - The value to parametrize.
9819
+ * @returns An event object.
9820
+ */
9821
+ var makeEvent = function makeEvent(value) {
9822
+ return [{
9823
+ value: value,
9824
+ type: 'string',
9825
+ id: ''
9826
+ }];
9827
+ };
9742
9828
  /**
9743
9829
  * Attach a Peer Connection to periodically get updated on events and stats.
9744
9830
  *
@@ -9761,51 +9847,50 @@ var rtcStats = function rtcStats(pc, logger, intervalTime, id, statsPreProcessor
9761
9847
  /**
9762
9848
  * Log stats or event data with additional tracking information.
9763
9849
  *
9764
- * @param args - Array of parameters to log of any type.
9850
+ * @param name - Name of the event to log.
9851
+ * @param payload - Log data pertaining to the event.
9765
9852
  */
9766
- var trace = function trace(eventName, data) {
9853
+ var trace = function trace(name, payload, timestamp) {
9767
9854
  logger({
9768
- name: '[rtcstats]',
9769
9855
  id: id,
9770
- eventName: eventName,
9771
- data: data
9856
+ timestamp: timestamp ? Math.round(timestamp) : Date.now(),
9857
+ name: name,
9858
+ payload: payload
9772
9859
  });
9773
9860
  };
9774
- trace('creating stats report');
9775
9861
  pc.addEventListener('icecandidate', function (e) {
9776
- trace('onicecandidate', e.candidate);
9862
+ if (e.candidate) {
9863
+ trace('onicecandidate', makeEvent(JSON.stringify(e.candidate)));
9864
+ }
9777
9865
  });
9778
9866
  pc.addEventListener('icecandidateerror', function (event) {
9779
9867
  var _a = event,
9780
9868
  errorCode = _a.errorCode,
9781
9869
  errorText = _a.errorText;
9782
- trace('onicecandidateerror', {
9783
- errorText: errorText,
9784
- errorCode: errorCode
9785
- });
9870
+ trace('onicecandidateerror', makeEvent("".concat(errorCode, ": ").concat(errorText)));
9786
9871
  });
9787
9872
  pc.addEventListener('track', function (e) {
9788
- trace('ontrack', "".concat(e.track.kind, ":").concat(e.track.id, " ").concat(e.streams.map(function (stream) {
9873
+ trace('ontrack', makeEvent("".concat(e.track.kind, ":").concat(e.track.id, " ").concat(e.streams.map(function (stream) {
9789
9874
  return "stream:".concat(stream.id);
9790
- })));
9875
+ }).join(' '))));
9791
9876
  });
9792
9877
  pc.addEventListener('signalingstatechange', function () {
9793
- trace('onsignalingstatechange', pc.signalingState);
9878
+ trace('onsignalingstatechange', makeEvent(pc.signalingState));
9794
9879
  });
9795
9880
  pc.addEventListener('iceconnectionstatechange', function () {
9796
- trace('oniceconnectionstatechange', pc.iceConnectionState);
9881
+ trace('oniceconnectionstatechange', makeEvent(pc.iceConnectionState));
9797
9882
  });
9798
9883
  pc.addEventListener('icegatheringstatechange', function () {
9799
- trace('onicegatheringstatechange', pc.iceGatheringState);
9884
+ trace('onicegatheringstatechange', makeEvent(pc.iceGatheringState));
9800
9885
  });
9801
9886
  pc.addEventListener('connectionstatechange', function () {
9802
- trace('onconnectionstatechange', pc.connectionState);
9887
+ trace('onconnectionstatechange', makeEvent(pc.connectionState));
9803
9888
  });
9804
9889
  pc.addEventListener('negotiationneeded', function () {
9805
- trace('onnegotiationneeded');
9890
+ trace('onnegotiationneeded', makeEvent('negotiationneeded'));
9806
9891
  });
9807
9892
  pc.addEventListener('datachannel', function (event) {
9808
- trace('ondatachannel', [event.channel.id, event.channel.label]);
9893
+ trace('ondatachannel', makeEvent("".concat(event.channel.id, ": ").concat(event.channel.label)));
9809
9894
  });
9810
9895
  var interval = window.setInterval(function () {
9811
9896
  if (pc.signalingState === 'closed') {
@@ -9816,7 +9901,8 @@ var rtcStats = function rtcStats(pc, logger, intervalTime, id, statsPreProcessor
9816
9901
  var now = map2obj(res);
9817
9902
  statsPreProcessor(now).then(function () {
9818
9903
  var base = deepCopy$1(now); // our new prev
9819
- trace('stats-report', deltaCompression(prev, now));
9904
+ var compressed = deltaCompression(prev, now);
9905
+ trace('stats-report', formatStatsReport(compressed), compressed.timestamp !== -Infinity ? compressed.timestamp : undefined);
9820
9906
  prev = base;
9821
9907
  });
9822
9908
  });
@@ -10032,6 +10118,22 @@ class FingerprintLine extends Line {
10032
10118
  }
10033
10119
  }
10034
10120
  FingerprintLine.regex = new RegExp("^fingerprint:(".concat(REST, ")"));
10121
+ function parseFmtpParams(fmtpParams) {
10122
+ fmtpParams = fmtpParams.replace(/^a=fmtp:\d+\x20/, '');
10123
+ var fmtpObj = new Map();
10124
+ if (/^\d+([/-]\d+)+$/.test(fmtpParams)) {
10125
+ fmtpObj.set(fmtpParams, undefined);
10126
+ return fmtpObj;
10127
+ }
10128
+ fmtpParams.split(';').forEach(param => {
10129
+ var paramArr = param && param.split('=');
10130
+ if (paramArr.length !== 2 || !paramArr[0] || !paramArr[1]) {
10131
+ throw new Error("Fmtp params is invalid with ".concat(fmtpParams));
10132
+ }
10133
+ fmtpObj.set(paramArr[0], paramArr[1]);
10134
+ });
10135
+ return fmtpObj;
10136
+ }
10035
10137
  class FmtpLine extends Line {
10036
10138
  constructor(payloadType, params) {
10037
10139
  super();
@@ -10045,10 +10147,16 @@ class FmtpLine extends Line {
10045
10147
  var tokens = line.match(FmtpLine.regex);
10046
10148
  var payloadType = parseInt(tokens[1], 10);
10047
10149
  var params = tokens[2];
10048
- return new FmtpLine(payloadType, params);
10150
+ return new FmtpLine(payloadType, parseFmtpParams(params));
10049
10151
  }
10050
10152
  toSdpLine() {
10051
- return "a=fmtp:".concat(this.payloadType, " ").concat(this.params);
10153
+ var fmtParams = Array.from(this.params.keys()).map(key => {
10154
+ if (this.params.get(key) !== undefined) {
10155
+ return "".concat(key, "=").concat(this.params.get(key));
10156
+ }
10157
+ return "".concat(key);
10158
+ }).join(';');
10159
+ return "a=fmtp:".concat(this.payloadType, " ").concat(fmtParams);
10052
10160
  }
10053
10161
  }
10054
10162
  FmtpLine.regex = new RegExp("^fmtp:(".concat(NUM, ") (").concat(REST, ")"));
@@ -10709,7 +10817,7 @@ class ApplicationMediaDescription extends MediaDescription {
10709
10817
  }
10710
10818
  class CodecInfo$1 {
10711
10819
  constructor(pt) {
10712
- this.fmtParams = [];
10820
+ this.fmtParams = new Map();
10713
10821
  this.feedback = [];
10714
10822
  this.pt = pt;
10715
10823
  }
@@ -10721,9 +10829,9 @@ class CodecInfo$1 {
10721
10829
  return true;
10722
10830
  }
10723
10831
  if (line instanceof FmtpLine) {
10724
- this.fmtParams.push(line.params);
10725
- if (line.params.indexOf('apt') !== -1) {
10726
- var apt = line.params.split('=')[1];
10832
+ this.fmtParams = new Map([...Array.from(this.fmtParams.entries()), ...Array.from(line.params.entries())]);
10833
+ if (line.params.has('apt')) {
10834
+ var apt = line.params.get('apt');
10727
10835
  this.primaryCodecPt = parseInt(apt, 10);
10728
10836
  }
10729
10837
  return true;
@@ -10740,9 +10848,9 @@ class CodecInfo$1 {
10740
10848
  this.feedback.forEach(fb => {
10741
10849
  lines.push(new RtcpFbLine(this.pt, fb));
10742
10850
  });
10743
- this.fmtParams.forEach(fmt => {
10744
- lines.push(new FmtpLine(this.pt, fmt));
10745
- });
10851
+ if (this.fmtParams.size > 0) {
10852
+ lines.push(new FmtpLine(this.pt, this.fmtParams));
10853
+ }
10746
10854
  return lines;
10747
10855
  }
10748
10856
  }
@@ -11059,6 +11167,76 @@ function hasCodec(codecName, mLine) {
11059
11167
  return ((_a = ci.name) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === codecName.toLowerCase();
11060
11168
  });
11061
11169
  }
11170
+ var MediaCodecMimeType;
11171
+ (function (MediaCodecMimeType) {
11172
+ MediaCodecMimeType["H264"] = "video/H264";
11173
+ MediaCodecMimeType["AV1"] = "video/AV1";
11174
+ MediaCodecMimeType["OPUS"] = "audio/opus";
11175
+ })(MediaCodecMimeType || (MediaCodecMimeType = {}));
11176
+ var defaultMaxVideoEncodeFrameSize = 8160;
11177
+ var defaultMaxVideoEncodeMbps = 244800;
11178
+ var RecommendedOpusBitrates;
11179
+ (function (RecommendedOpusBitrates) {
11180
+ RecommendedOpusBitrates[RecommendedOpusBitrates["NB"] = 12000] = "NB";
11181
+ RecommendedOpusBitrates[RecommendedOpusBitrates["WB"] = 20000] = "WB";
11182
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB"] = 40000] = "FB";
11183
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB_MONO_MUSIC"] = 64000] = "FB_MONO_MUSIC";
11184
+ RecommendedOpusBitrates[RecommendedOpusBitrates["FB_STEREO_MUSIC"] = 128000] = "FB_STEREO_MUSIC";
11185
+ })(RecommendedOpusBitrates || (RecommendedOpusBitrates = {}));
11186
+ function areProfileLevelIdsCompatible(senderProfileLevelId, receiverProfileLevelId, levelAsymmetryAllowed) {
11187
+ var senderProfile = Number.parseInt("0x".concat(senderProfileLevelId), 16);
11188
+ var recvProfile = Number.parseInt("0x".concat(receiverProfileLevelId), 16);
11189
+ var senderProfileIdc = senderProfile >> 16;
11190
+ var recvProfileIdc = recvProfile >> 16;
11191
+ var senderProfileIop = (senderProfile & 0x00ff00) >> 8;
11192
+ var recvProfileIop = (recvProfile & 0x00ff00) >> 8;
11193
+ var senderLevelIdc = senderProfile & 0x0000ff;
11194
+ var recvLevelIdc = recvProfile & 0x0000ff;
11195
+ var areProfileCompatible = senderProfileIdc === recvProfileIdc && senderProfileIop === recvProfileIop || senderProfileIdc === 0x42 && recvProfileIdc === 0x42 && (senderProfileIop & 0x40) === (recvProfileIop & 0x40);
11196
+ var isLevelIdcCompatible = levelAsymmetryAllowed ? true : senderLevelIdc <= recvLevelIdc;
11197
+ return areProfileCompatible && isLevelIdcCompatible;
11198
+ }
11199
+ function areCodecsCompatible(senderCodec, receiverCodec) {
11200
+ return Object.keys(receiverCodec).every(key => {
11201
+ if (!senderCodec[key] || !receiverCodec[key]) {
11202
+ return false;
11203
+ }
11204
+ if (key === 'payloadType') {
11205
+ return true;
11206
+ }
11207
+ if (key === 'sdpFmtpLine') {
11208
+ var fmtpForSender = Object.fromEntries(parseFmtpParams(senderCodec[key]));
11209
+ var fmtpForReceiver = Object.fromEntries(parseFmtpParams(receiverCodec[key]));
11210
+ var levelAsymmetryAllowed = Object.keys(fmtpForSender).some(senderFmtpParamKey => {
11211
+ return senderFmtpParamKey === 'level-asymmetry-allowed' && fmtpForReceiver[senderFmtpParamKey] === '1' && fmtpForSender[senderFmtpParamKey] === '1';
11212
+ });
11213
+ return Object.keys(fmtpForSender).every(senderFmtpParamKey => {
11214
+ if (fmtpForReceiver[senderFmtpParamKey]) {
11215
+ if (senderFmtpParamKey === 'profile-level-id') {
11216
+ return areProfileLevelIdsCompatible(fmtpForSender[senderFmtpParamKey], fmtpForReceiver[senderFmtpParamKey], levelAsymmetryAllowed);
11217
+ }
11218
+ }
11219
+ if (senderFmtpParamKey === 'packetization-mode') {
11220
+ return fmtpForSender[senderFmtpParamKey] === fmtpForReceiver[senderFmtpParamKey];
11221
+ }
11222
+ return true;
11223
+ });
11224
+ }
11225
+ return senderCodec[key] === receiverCodec[key];
11226
+ });
11227
+ }
11228
+ function gcd(a, b) {
11229
+ return b === 0 ? a : gcd(b, a % b);
11230
+ }
11231
+ function getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs) {
11232
+ var _gcd = gcd(sourceAspectRatio[0], sourceAspectRatio[1]);
11233
+ var minNumberRatiosForWidth = sourceAspectRatio[0] / _gcd;
11234
+ var minNumberRatiosForHeight = sourceAspectRatio[1] / _gcd;
11235
+ return Math.floor(Math.sqrt(requestedMaxFs * 16 * 16 / (minNumberRatiosForWidth * minNumberRatiosForHeight))) * minNumberRatiosForHeight;
11236
+ }
11237
+ function getScaleDownRatio(sourceAspectRatio, sourceHeight, requestedMaxFs) {
11238
+ return sourceHeight / getFrameHeightByMaxFs(sourceAspectRatio, requestedMaxFs);
11239
+ }
11062
11240
  var events = {
11063
11241
  exports: {}
11064
11242
  };
@@ -11448,814 +11626,1429 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
11448
11626
  }
11449
11627
  }
11450
11628
  class EventEmitter extends events.exports.EventEmitter {}
11451
- var es5 = {
11452
- exports: {}
11453
- };
11454
- (function (module, exports) {
11455
- !function (e, t) {
11456
- module.exports = t();
11457
- }(commonjsGlobal$3, function () {
11458
- return function (e) {
11459
- var t = {};
11460
- function r(n) {
11461
- if (t[n]) return t[n].exports;
11462
- var i = t[n] = {
11463
- i: n,
11464
- l: !1,
11465
- exports: {}
11466
- };
11467
- return e[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
11629
+ var OveruseState;
11630
+ (function (OveruseState) {
11631
+ OveruseState[OveruseState["NOT_OVERUSED"] = 0] = "NOT_OVERUSED";
11632
+ OveruseState[OveruseState["OVERUSED"] = 1] = "OVERUSED";
11633
+ })(OveruseState || (OveruseState = {}));
11634
+ class OveruseStateManager {
11635
+ constructor(callback) {
11636
+ this.monitors = [];
11637
+ this.lastOverallOveruseState = OveruseState.NOT_OVERUSED;
11638
+ this.isRunning = false;
11639
+ this.overuseUpdateCallback = callback;
11640
+ }
11641
+ addMonitor(monitor) {
11642
+ this.monitors.push(monitor);
11643
+ if (this.isRunning) {
11644
+ monitor.startMonitoring(() => this.onMonitorOveruseUpdate());
11645
+ }
11646
+ }
11647
+ start() {
11648
+ this.isRunning = true;
11649
+ this.monitors.forEach(monitor => monitor.startMonitoring(() => this.onMonitorOveruseUpdate()));
11650
+ }
11651
+ stop() {
11652
+ this.isRunning = false;
11653
+ this.monitors.forEach(monitor => monitor.stopMonitoring());
11654
+ }
11655
+ onMonitorOveruseUpdate() {
11656
+ var overuseStates = this.monitors.map(monitor => monitor.getLastOveruseState());
11657
+ var overallOveruseState = overuseStates.some(overuseState => overuseState === OveruseState.OVERUSED) ? OveruseState.OVERUSED : OveruseState.NOT_OVERUSED;
11658
+ if (overallOveruseState !== this.lastOverallOveruseState) {
11659
+ this.lastOverallOveruseState = overallOveruseState;
11660
+ this.overuseUpdateCallback(overallOveruseState);
11661
+ }
11662
+ }
11663
+ }
11664
+ var ReceiveSlotEvents;
11665
+ (function (ReceiveSlotEvents) {
11666
+ ReceiveSlotEvents["MediaStarted"] = "media-started";
11667
+ ReceiveSlotEvents["MediaStopped"] = "media-stopped";
11668
+ ReceiveSlotEvents["SourceUpdate"] = "source-update";
11669
+ })(ReceiveSlotEvents || (ReceiveSlotEvents = {}));
11670
+ class ReceiveSlot extends EventEmitter {
11671
+ constructor(idGetter, track) {
11672
+ super();
11673
+ this._idGetter = idGetter;
11674
+ this.handleTrackMuted = this.handleTrackMuted.bind(this);
11675
+ this.handleTrackUnmuted = this.handleTrackUnmuted.bind(this);
11676
+ this._stream = new MediaStream([track]);
11677
+ this.addTrackHandlers(track);
11678
+ }
11679
+ addTrackHandlers(track) {
11680
+ track.addEventListener('mute', this.handleTrackMuted);
11681
+ track.addEventListener('unmute', this.handleTrackUnmuted);
11682
+ }
11683
+ handleTrackMuted() {
11684
+ this.emit(ReceiveSlotEvents.MediaStopped);
11685
+ }
11686
+ handleTrackUnmuted() {
11687
+ this.emit(ReceiveSlotEvents.MediaStarted);
11688
+ }
11689
+ removeTrackHandlers(track) {
11690
+ track.removeEventListener('mute', this.handleTrackMuted);
11691
+ track.removeEventListener('unmute', this.handleTrackUnmuted);
11692
+ }
11693
+ replaceTrack(newTrack) {
11694
+ var _a;
11695
+ var trackToRemove = (_a = this._stream.getTracks()) === null || _a === void 0 ? void 0 : _a[0];
11696
+ if (trackToRemove) {
11697
+ this._stream.removeTrack(trackToRemove);
11698
+ this.removeTrackHandlers(trackToRemove);
11699
+ }
11700
+ this.addTrackHandlers(newTrack);
11701
+ this._stream.addTrack(newTrack);
11702
+ }
11703
+ _updateSource(state, csi) {
11704
+ this.currentRxCsi = csi;
11705
+ this.emit(ReceiveSlotEvents.SourceUpdate, state, csi);
11706
+ }
11707
+ close() {
11708
+ this._stream.getTracks().forEach(t => {
11709
+ this.removeTrackHandlers(t);
11710
+ });
11711
+ }
11712
+ get id() {
11713
+ return this._idGetter();
11714
+ }
11715
+ get stream() {
11716
+ return this._stream;
11717
+ }
11718
+ }
11719
+ ReceiveSlot.Events = ReceiveSlotEvents;
11720
+ class Transceiver {
11721
+ constructor(rtcRtpTransceiver) {
11722
+ this._rtcRtpTransceiver = rtcRtpTransceiver;
11723
+ }
11724
+ replaceTransceiver(newRtcRtpTransceiver) {
11725
+ this._rtcRtpTransceiver = newRtcRtpTransceiver;
11726
+ }
11727
+ get receiver() {
11728
+ return this._rtcRtpTransceiver.receiver;
11729
+ }
11730
+ get sender() {
11731
+ return this._rtcRtpTransceiver.sender;
11732
+ }
11733
+ get mid() {
11734
+ return this._rtcRtpTransceiver.mid;
11735
+ }
11736
+ close() {
11737
+ this._rtcRtpTransceiver.stop();
11738
+ }
11739
+ }
11740
+ class ReceiveOnlyTransceiver extends Transceiver {
11741
+ constructor(rtcRtpTransceiver, idGetter) {
11742
+ super(rtcRtpTransceiver);
11743
+ this._receiveSlot = new ReceiveSlot(() => {
11744
+ if (!this._rtcRtpTransceiver.mid) {
11745
+ return null;
11468
11746
  }
11469
- return r.m = e, r.c = t, r.d = function (e, t, n) {
11470
- r.o(e, t) || Object.defineProperty(e, t, {
11471
- enumerable: !0,
11472
- get: n
11473
- });
11474
- }, r.r = function (e) {
11475
- "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
11476
- value: "Module"
11477
- }), Object.defineProperty(e, "__esModule", {
11478
- value: !0
11747
+ return idGetter(this._rtcRtpTransceiver.mid);
11748
+ }, this._rtcRtpTransceiver.receiver.track);
11749
+ }
11750
+ replaceTransceiver(newRtcRtpTransceiver) {
11751
+ super.replaceTransceiver(newRtcRtpTransceiver);
11752
+ this._receiveSlot.replaceTrack(newRtcRtpTransceiver.receiver.track);
11753
+ }
11754
+ close() {
11755
+ super.close();
11756
+ this._receiveSlot.close();
11757
+ }
11758
+ get receiveSlot() {
11759
+ return this._receiveSlot;
11760
+ }
11761
+ getStats() {
11762
+ return this.receiver.getStats();
11763
+ }
11764
+ }
11765
+ ReceiveOnlyTransceiver.rid = '1';
11766
+ class JmpLine extends Line {
11767
+ static fromSdpLine(line) {
11768
+ if (!JmpLine.regex.test(line)) {
11769
+ return undefined;
11770
+ }
11771
+ return new JmpLine();
11772
+ }
11773
+ toSdpLine() {
11774
+ return "a=jmp";
11775
+ }
11776
+ }
11777
+ JmpLine.regex = /^jmp$/;
11778
+ class JmpStreamIdModeLine extends Line {
11779
+ constructor(streamIdMode) {
11780
+ super();
11781
+ this.streamIdMode = streamIdMode;
11782
+ }
11783
+ static fromSdpLine(line) {
11784
+ if (!JmpStreamIdModeLine.regex.test(line)) {
11785
+ return undefined;
11786
+ }
11787
+ var tokens = line.match(JmpStreamIdModeLine.regex);
11788
+ var mode = tokens[1];
11789
+ return new JmpStreamIdModeLine(mode);
11790
+ }
11791
+ toSdpLine() {
11792
+ return "a=jmp-stream-id-mode:".concat(this.streamIdMode);
11793
+ }
11794
+ }
11795
+ JmpStreamIdModeLine.regex = /^jmp-stream-id-mode:(MID-RID|SSRC)$/;
11796
+ class JmpSourceLine extends Line {
11797
+ constructor(source, csi) {
11798
+ super();
11799
+ this.source = source;
11800
+ this.csi = csi;
11801
+ }
11802
+ static fromSdpLine(line) {
11803
+ if (!JmpSourceLine.regex.test(line)) {
11804
+ return undefined;
11805
+ }
11806
+ var tokens = line.match(JmpSourceLine.regex);
11807
+ var source = tokens[1];
11808
+ var csi = tokens[2];
11809
+ return new JmpSourceLine(source, csi);
11810
+ }
11811
+ toSdpLine() {
11812
+ var line = "a=jmp-source:".concat(this.source);
11813
+ if (this.csi) {
11814
+ line += " csi=".concat(this.csi);
11815
+ }
11816
+ return line;
11817
+ }
11818
+ }
11819
+ JmpSourceLine.regex = new RegExp("^jmp-source:(".concat(ANY_NON_WS, ") (?:csi=(").concat(ANY_NON_WS, "))"));
11820
+ DefaultSdpGrammar.addParser('a', JmpLine.fromSdpLine);
11821
+ DefaultSdpGrammar.addParser('a', JmpSourceLine.fromSdpLine);
11822
+ DefaultSdpGrammar.addParser('a', JmpStreamIdModeLine.fromSdpLine);
11823
+ function deepCopy(source) {
11824
+ return Array.isArray(source) ? source.map(item => deepCopy(item)) : source instanceof Map ? new Map(source) : source instanceof Date ? new Date(source.getTime()) : source && typeof source === 'object' ? Object.getOwnPropertyNames(source).reduce((o, prop) => {
11825
+ Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
11826
+ o[prop] = deepCopy(source[prop]);
11827
+ return o;
11828
+ }, Object.create(Object.getPrototypeOf(source))) : source;
11829
+ }
11830
+ function getMediaTypeForMline(mLine) {
11831
+ var _a, _b;
11832
+ var mediaFamily;
11833
+ if (mLine.type.toLowerCase() === MediaFamily$1.Audio.toLowerCase()) {
11834
+ mediaFamily = MediaFamily$1.Audio;
11835
+ } else if (mLine.type.toLowerCase() === MediaFamily$1.Video.toLowerCase()) {
11836
+ mediaFamily = MediaFamily$1.Video;
11837
+ } else {
11838
+ throw Error("Mline type doesn't match any known MediaFamily: ".concat(mLine.type));
11839
+ }
11840
+ var mediaContent;
11841
+ if ((_b = (_a = mLine.content) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.some(v => v.toLowerCase() === 'slides')) {
11842
+ mediaContent = MediaContent$1.Slides;
11843
+ } else {
11844
+ mediaContent = MediaContent$1.Main;
11845
+ }
11846
+ return getMediaType(mediaFamily, mediaContent);
11847
+ }
11848
+ function filterCodecs(parsedSdp, allowedCodecs) {
11849
+ var allowedLowerCase = allowedCodecs.map(s => s.toLowerCase());
11850
+ parsedSdp.avMedia.map(m => [...m.codecs.values()].map(c => c.name)).flat().filter(codecName => !allowedLowerCase.includes(codecName.toLowerCase())).forEach(c => removeCodec(parsedSdp, c));
11851
+ }
11852
+ function setMaxBandwidth(parsedSdp, maxBandwidth) {
11853
+ parsedSdp.avMedia.forEach(mline => {
11854
+ mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
11855
+ });
11856
+ }
11857
+ function setupBundle(parsedSdp, bundlePolicy) {
11858
+ if (bundlePolicy === 'compat') {
11859
+ var audioMids = parsedSdp.avMedia.filter(m => m.type === 'audio').map(m => m.mid);
11860
+ var videoMids = parsedSdp.avMedia.filter(m => m.type === 'video').map(m => m.mid);
11861
+ parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
11862
+ parsedSdp.session.groups.push(new BundleGroupLine(audioMids));
11863
+ parsedSdp.session.groups.push(new BundleGroupLine(videoMids));
11864
+ }
11865
+ }
11866
+ function filterRecvOnlyMlines(parsedSdp) {
11867
+ var filteredMids = [];
11868
+ parsedSdp.media = parsedSdp.media.filter(mLine => {
11869
+ if (mLine instanceof ApplicationMediaDescription || mLine instanceof AvMediaDescription && mLine.direction !== 'recvonly') {
11870
+ filteredMids.push(mLine.mid);
11871
+ return true;
11872
+ }
11873
+ return false;
11874
+ });
11875
+ parsedSdp.session.groups.forEach(g => {
11876
+ g.mids = g.mids.filter(m => filteredMids.includes(m));
11877
+ });
11878
+ }
11879
+ function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
11880
+ parsedAnswer.session.groups = parsedOffer.session.groups;
11881
+ parsedAnswer.media = parsedOffer.media.map(offerMline => {
11882
+ if (!offerMline.mid) {
11883
+ throw new Error("Offer mline is missing MID");
11884
+ }
11885
+ var answerMline = parsedAnswer.media.find(m => m.mid === offerMline.mid);
11886
+ if (answerMline) {
11887
+ if (answerMline instanceof AvMediaDescription) {
11888
+ [...answerMline.codecs.values()].forEach(ci => {
11889
+ ci.fmtParams.set('x-google-start-bitrate', '60000');
11479
11890
  });
11480
- }, r.t = function (e, t) {
11481
- if (1 & t && (e = r(e)), 8 & t) return e;
11482
- if (4 & t && "object" == typeof e && e && e.__esModule) return e;
11483
- var n = Object.create(null);
11484
- if (r.r(n), Object.defineProperty(n, "default", {
11485
- enumerable: !0,
11486
- value: e
11487
- }), 2 & t && "string" != typeof e) for (var i in e) {
11488
- r.d(n, i, function (t) {
11489
- return e[t];
11490
- }.bind(null, i));
11891
+ }
11892
+ return answerMline;
11893
+ }
11894
+ if (!(offerMline instanceof AvMediaDescription)) {
11895
+ throw new Error("Answer is missing a non-media mline: ".concat(offerMline.mid));
11896
+ }
11897
+ var startingMline = parsedAnswer.avMedia.find(m => m.type === offerMline.type);
11898
+ if (!startingMline) {
11899
+ throw new Error("Answer has no mline of type ".concat(offerMline.type, ", can't generate synthetic answer mline for mid ").concat(offerMline.mid));
11900
+ }
11901
+ var fakeCorrespondingMline = deepCopy(startingMline);
11902
+ fakeCorrespondingMline.mid = offerMline.mid;
11903
+ fakeCorrespondingMline.simulcast = undefined;
11904
+ if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
11905
+ fakeCorrespondingMline.direction = 'recvonly';
11906
+ }
11907
+ if (offerMline.direction === 'recvonly') {
11908
+ fakeCorrespondingMline.direction = 'sendonly';
11909
+ var ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
11910
+ ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
11911
+ }
11912
+ return fakeCorrespondingMline;
11913
+ });
11914
+ }
11915
+ function injectContentTypes(sdp, contentTypeMap) {
11916
+ contentTypeMap.forEach((mediaContent, mid) => {
11917
+ var mline = sdp.media.find(m => m.mid === mid);
11918
+ if (!mline) {
11919
+ throw new Error("Error trying to set content type for mid ".concat(mid, ": not found in SDP"));
11920
+ }
11921
+ if (mediaContent === MediaContent$1.Slides) {
11922
+ mline.addLine(new ContentLine(['slides']));
11923
+ }
11924
+ });
11925
+ }
11926
+ function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
11927
+ parsedSdp.avMedia.filter(mLine => mLine.direction === 'sendrecv' || mLine.direction === 'sendonly').forEach(mLine => {
11928
+ if (!mLine.otherLines.find(line => line instanceof JmpLine)) {
11929
+ mLine.addLine(new JmpLine());
11930
+ }
11931
+ if (!mLine.otherLines.find(line => line instanceof JmpSourceLine)) {
11932
+ var mediaType = getMediaTypeForMline(mLine);
11933
+ var csi = csiMap.get(mediaType);
11934
+ if (!csi) {
11935
+ throw new Error("Unable to find CSI for MediaType ".concat(mediaType));
11936
+ }
11937
+ mLine.addLine(new JmpSourceLine(mLine.mid, csi.toString()));
11938
+ }
11939
+ if (!mLine.otherLines.find(line => line instanceof JmpStreamIdModeLine)) {
11940
+ mLine.addLine(new JmpStreamIdModeLine(streamSignalingMode));
11941
+ }
11942
+ });
11943
+ }
11944
+ class SendOnlyTransceiver extends Transceiver {
11945
+ constructor(rtcpRtpTransceiver, csi) {
11946
+ super(rtcpRtpTransceiver);
11947
+ this.requested = false;
11948
+ this.csi = csi;
11949
+ this.handleTrackChange = this.handleTrackChange.bind(this);
11950
+ }
11951
+ handleTrackChange() {
11952
+ var _a;
11953
+ return __awaiter(this, void 0, void 0, function* () {
11954
+ if (this.requested) {
11955
+ yield this.sender.replaceTrack(((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null);
11956
+ }
11957
+ });
11958
+ }
11959
+ replacePublishedTrack(newTrack) {
11960
+ var _a, _b;
11961
+ return __awaiter(this, void 0, void 0, function* () {
11962
+ (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.off(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
11963
+ (_b = this.publishedTrack) === null || _b === void 0 ? void 0 : _b.setPublished(false);
11964
+ if (this.requested) {
11965
+ yield this.sender.replaceTrack((newTrack === null || newTrack === void 0 ? void 0 : newTrack.underlyingTrack) || null);
11966
+ }
11967
+ this.publishedTrack = newTrack;
11968
+ newTrack === null || newTrack === void 0 ? void 0 : newTrack.on(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
11969
+ newTrack === null || newTrack === void 0 ? void 0 : newTrack.setPublished(true);
11970
+ });
11971
+ }
11972
+ setTrackRequested(requested) {
11973
+ var _a;
11974
+ return __awaiter(this, void 0, void 0, function* () {
11975
+ if (this.requested !== requested) {
11976
+ this.requested = requested;
11977
+ var newTrack = requested ? ((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null : null;
11978
+ yield this.sender.replaceTrack(newTrack);
11979
+ }
11980
+ });
11981
+ }
11982
+ updateSimulcastStreamStates(requestedIdEncodingParamsMap) {
11983
+ return __awaiter(this, void 0, void 0, function* () {
11984
+ var sendParameters = this.sender.getParameters();
11985
+ sendParameters.encodings.forEach((encoding, index) => {
11986
+ var encodingParams = requestedIdEncodingParamsMap.get(index);
11987
+ encoding.active = Boolean(encodingParams);
11988
+ if (encodingParams) {
11989
+ if (encodingParams.scaleDownRatio >= 1 && encoding.scaleResolutionDownBy !== encodingParams.scaleDownRatio) {
11990
+ encoding.scaleResolutionDownBy = encodingParams.scaleDownRatio;
11991
+ }
11992
+ if (encodingParams.maxPayloadBitsPerSecond) {
11993
+ encoding.maxBitrate = encodingParams.maxPayloadBitsPerSecond;
11994
+ }
11491
11995
  }
11492
- return n;
11493
- }, r.n = function (e) {
11494
- var t = e && e.__esModule ? function () {
11495
- return e.default;
11496
- } : function () {
11497
- return e;
11498
- };
11499
- return r.d(t, "a", t), t;
11500
- }, r.o = function (e, t) {
11501
- return Object.prototype.hasOwnProperty.call(e, t);
11502
- }, r.p = "", r(r.s = 90);
11503
- }({
11504
- 17: function _(e, t, r) {
11505
- t.__esModule = !0, t.default = void 0;
11506
- var n = r(18),
11507
- i = function () {
11508
- function e() {}
11509
- return e.getFirstMatch = function (e, t) {
11510
- var r = t.match(e);
11511
- return r && r.length > 0 && r[1] || "";
11512
- }, e.getSecondMatch = function (e, t) {
11513
- var r = t.match(e);
11514
- return r && r.length > 1 && r[2] || "";
11515
- }, e.matchAndReturnConst = function (e, t, r) {
11516
- if (e.test(t)) return r;
11517
- }, e.getWindowsVersionName = function (e) {
11518
- switch (e) {
11519
- case "NT":
11520
- return "NT";
11521
- case "XP":
11522
- return "XP";
11523
- case "NT 5.0":
11524
- return "2000";
11525
- case "NT 5.1":
11526
- return "XP";
11527
- case "NT 5.2":
11528
- return "2003";
11529
- case "NT 6.0":
11530
- return "Vista";
11531
- case "NT 6.1":
11532
- return "7";
11533
- case "NT 6.2":
11534
- return "8";
11535
- case "NT 6.3":
11536
- return "8.1";
11537
- case "NT 10.0":
11538
- return "10";
11539
- default:
11540
- return;
11541
- }
11542
- }, e.getMacOSVersionName = function (e) {
11543
- var t = e.split(".").splice(0, 2).map(function (e) {
11544
- return parseInt(e, 10) || 0;
11545
- });
11546
- if (t.push(0), 10 === t[0]) switch (t[1]) {
11547
- case 5:
11548
- return "Leopard";
11549
- case 6:
11550
- return "Snow Leopard";
11551
- case 7:
11552
- return "Lion";
11553
- case 8:
11554
- return "Mountain Lion";
11555
- case 9:
11556
- return "Mavericks";
11557
- case 10:
11558
- return "Yosemite";
11559
- case 11:
11560
- return "El Capitan";
11561
- case 12:
11562
- return "Sierra";
11563
- case 13:
11564
- return "High Sierra";
11565
- case 14:
11566
- return "Mojave";
11567
- case 15:
11568
- return "Catalina";
11569
- default:
11570
- return;
11571
- }
11572
- }, e.getAndroidVersionName = function (e) {
11573
- var t = e.split(".").splice(0, 2).map(function (e) {
11574
- return parseInt(e, 10) || 0;
11575
- });
11576
- if (t.push(0), !(1 === t[0] && t[1] < 5)) return 1 === t[0] && t[1] < 6 ? "Cupcake" : 1 === t[0] && t[1] >= 6 ? "Donut" : 2 === t[0] && t[1] < 2 ? "Eclair" : 2 === t[0] && 2 === t[1] ? "Froyo" : 2 === t[0] && t[1] > 2 ? "Gingerbread" : 3 === t[0] ? "Honeycomb" : 4 === t[0] && t[1] < 1 ? "Ice Cream Sandwich" : 4 === t[0] && t[1] < 4 ? "Jelly Bean" : 4 === t[0] && t[1] >= 4 ? "KitKat" : 5 === t[0] ? "Lollipop" : 6 === t[0] ? "Marshmallow" : 7 === t[0] ? "Nougat" : 8 === t[0] ? "Oreo" : 9 === t[0] ? "Pie" : void 0;
11577
- }, e.getVersionPrecision = function (e) {
11578
- return e.split(".").length;
11579
- }, e.compareVersions = function (t, r, n) {
11580
- void 0 === n && (n = !1);
11581
- var i = e.getVersionPrecision(t),
11582
- s = e.getVersionPrecision(r),
11583
- a = Math.max(i, s),
11584
- o = 0,
11585
- u = e.map([t, r], function (t) {
11586
- var r = a - e.getVersionPrecision(t),
11587
- n = t + new Array(r + 1).join(".0");
11588
- return e.map(n.split("."), function (e) {
11589
- return new Array(20 - e.length).join("0") + e;
11590
- }).reverse();
11591
- });
11592
- for (n && (o = a - Math.min(i, s)), a -= 1; a >= o;) {
11593
- if (u[0][a] > u[1][a]) return 1;
11594
- if (u[0][a] === u[1][a]) {
11595
- if (a === o) return 0;
11596
- a -= 1;
11597
- } else if (u[0][a] < u[1][a]) return -1;
11598
- }
11599
- }, e.map = function (e, t) {
11600
- var r,
11601
- n = [];
11602
- if (Array.prototype.map) return Array.prototype.map.call(e, t);
11603
- for (r = 0; r < e.length; r += 1) {
11604
- n.push(t(e[r]));
11605
- }
11606
- return n;
11607
- }, e.find = function (e, t) {
11608
- var r, n;
11609
- if (Array.prototype.find) return Array.prototype.find.call(e, t);
11610
- for (r = 0, n = e.length; r < n; r += 1) {
11611
- var i = e[r];
11612
- if (t(i, r)) return i;
11613
- }
11614
- }, e.assign = function (e) {
11615
- for (var t, r, n = e, i = arguments.length, s = new Array(i > 1 ? i - 1 : 0), a = 1; a < i; a++) {
11616
- s[a - 1] = arguments[a];
11617
- }
11618
- if (Object.assign) return Object.assign.apply(Object, [e].concat(s));
11619
- var o = function o() {
11620
- var e = s[t];
11621
- "object" == typeof e && null !== e && Object.keys(e).forEach(function (t) {
11622
- n[t] = e[t];
11623
- });
11624
- };
11625
- for (t = 0, r = s.length; t < r; t += 1) {
11626
- o();
11627
- }
11628
- return e;
11629
- }, e.getBrowserAlias = function (e) {
11630
- return n.BROWSER_ALIASES_MAP[e];
11631
- }, e.getBrowserTypeByAlias = function (e) {
11632
- return n.BROWSER_MAP[e] || "";
11633
- }, e;
11634
- }();
11635
- t.default = i, e.exports = t.default;
11636
- },
11637
- 18: function _(e, t, r) {
11638
- t.__esModule = !0, t.ENGINE_MAP = t.OS_MAP = t.PLATFORMS_MAP = t.BROWSER_MAP = t.BROWSER_ALIASES_MAP = void 0;
11639
- t.BROWSER_ALIASES_MAP = {
11640
- "Amazon Silk": "amazon_silk",
11641
- "Android Browser": "android",
11642
- Bada: "bada",
11643
- BlackBerry: "blackberry",
11644
- Chrome: "chrome",
11645
- Chromium: "chromium",
11646
- Electron: "electron",
11647
- Epiphany: "epiphany",
11648
- Firefox: "firefox",
11649
- Focus: "focus",
11650
- Generic: "generic",
11651
- "Google Search": "google_search",
11652
- Googlebot: "googlebot",
11653
- "Internet Explorer": "ie",
11654
- "K-Meleon": "k_meleon",
11655
- Maxthon: "maxthon",
11656
- "Microsoft Edge": "edge",
11657
- "MZ Browser": "mz",
11658
- "NAVER Whale Browser": "naver",
11659
- Opera: "opera",
11660
- "Opera Coast": "opera_coast",
11661
- PhantomJS: "phantomjs",
11662
- Puffin: "puffin",
11663
- QupZilla: "qupzilla",
11664
- QQ: "qq",
11665
- QQLite: "qqlite",
11666
- Safari: "safari",
11667
- Sailfish: "sailfish",
11668
- "Samsung Internet for Android": "samsung_internet",
11669
- SeaMonkey: "seamonkey",
11670
- Sleipnir: "sleipnir",
11671
- Swing: "swing",
11672
- Tizen: "tizen",
11673
- "UC Browser": "uc",
11674
- Vivaldi: "vivaldi",
11675
- "WebOS Browser": "webos",
11676
- WeChat: "wechat",
11677
- "Yandex Browser": "yandex",
11678
- Roku: "roku"
11679
- };
11680
- t.BROWSER_MAP = {
11681
- amazon_silk: "Amazon Silk",
11682
- android: "Android Browser",
11683
- bada: "Bada",
11684
- blackberry: "BlackBerry",
11685
- chrome: "Chrome",
11686
- chromium: "Chromium",
11687
- electron: "Electron",
11688
- epiphany: "Epiphany",
11689
- firefox: "Firefox",
11690
- focus: "Focus",
11691
- generic: "Generic",
11692
- googlebot: "Googlebot",
11693
- google_search: "Google Search",
11694
- ie: "Internet Explorer",
11695
- k_meleon: "K-Meleon",
11696
- maxthon: "Maxthon",
11697
- edge: "Microsoft Edge",
11698
- mz: "MZ Browser",
11699
- naver: "NAVER Whale Browser",
11700
- opera: "Opera",
11701
- opera_coast: "Opera Coast",
11702
- phantomjs: "PhantomJS",
11703
- puffin: "Puffin",
11704
- qupzilla: "QupZilla",
11705
- qq: "QQ Browser",
11706
- qqlite: "QQ Browser Lite",
11707
- safari: "Safari",
11708
- sailfish: "Sailfish",
11709
- samsung_internet: "Samsung Internet for Android",
11710
- seamonkey: "SeaMonkey",
11711
- sleipnir: "Sleipnir",
11712
- swing: "Swing",
11713
- tizen: "Tizen",
11714
- uc: "UC Browser",
11715
- vivaldi: "Vivaldi",
11716
- webos: "WebOS Browser",
11717
- wechat: "WeChat",
11718
- yandex: "Yandex Browser"
11719
- };
11720
- t.PLATFORMS_MAP = {
11721
- tablet: "tablet",
11722
- mobile: "mobile",
11723
- desktop: "desktop",
11724
- tv: "tv"
11725
- };
11726
- t.OS_MAP = {
11727
- WindowsPhone: "Windows Phone",
11728
- Windows: "Windows",
11729
- MacOS: "macOS",
11730
- iOS: "iOS",
11731
- Android: "Android",
11732
- WebOS: "WebOS",
11733
- BlackBerry: "BlackBerry",
11734
- Bada: "Bada",
11735
- Tizen: "Tizen",
11736
- Linux: "Linux",
11737
- ChromeOS: "Chrome OS",
11738
- PlayStation4: "PlayStation 4",
11739
- Roku: "Roku"
11740
- };
11741
- t.ENGINE_MAP = {
11742
- EdgeHTML: "EdgeHTML",
11743
- Blink: "Blink",
11744
- Trident: "Trident",
11745
- Presto: "Presto",
11746
- Gecko: "Gecko",
11747
- WebKit: "WebKit"
11996
+ });
11997
+ yield this.sender.setParameters(sendParameters);
11998
+ });
11999
+ }
12000
+ getScaleDownRatio(expectedMaxFs) {
12001
+ var _a;
12002
+ if (!expectedMaxFs) {
12003
+ return -1;
12004
+ }
12005
+ if (!this.publishedTrack) {
12006
+ return -1;
12007
+ }
12008
+ var setting = (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
12009
+ var sourceHeight = setting === null || setting === void 0 ? void 0 : setting.height;
12010
+ var sourceWidth = setting === null || setting === void 0 ? void 0 : setting.width;
12011
+ if (!sourceWidth || !sourceHeight) {
12012
+ return -1;
12013
+ }
12014
+ return Math.max(getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs), 1.0);
12015
+ }
12016
+ publishTrack(track) {
12017
+ return this.replacePublishedTrack(track);
12018
+ }
12019
+ unpublishTrack() {
12020
+ return this.replacePublishedTrack();
12021
+ }
12022
+ setActive(enabled) {
12023
+ var direction = enabled ? 'sendrecv' : 'inactive';
12024
+ this._rtcRtpTransceiver.direction = direction;
12025
+ return this._rtcRtpTransceiver.direction !== this._rtcRtpTransceiver.currentDirection;
12026
+ }
12027
+ getIngressPayloadType(mimeType) {
12028
+ var senderCodecs = this.sender.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
12029
+ var receiverCodecs = this.receiver.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
12030
+ if (!senderCodecs || !receiverCodecs || senderCodecs.length === 0 || receiverCodecs.length === 0) {
12031
+ throw new Error("sender codecs or receiver codecs is undefined or empty");
12032
+ }
12033
+ var senderCodec = senderCodecs[0];
12034
+ var targetCodec = receiverCodecs.find(receiverCodec => {
12035
+ return areCodecsCompatible(senderCodec, receiverCodec);
12036
+ });
12037
+ if (!targetCodec || !targetCodec.payloadType) {
12038
+ throw new Error("ingress payload type is not well defined in receiver codecs");
12039
+ }
12040
+ return targetCodec.payloadType;
12041
+ }
12042
+ getStats() {
12043
+ return this.sender.getStats();
12044
+ }
12045
+ }
12046
+ class StatsManager {
12047
+ constructor(statsGetter) {
12048
+ var statsPreprocessor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : () => __awaiter(this, void 0, void 0, function* () {});
12049
+ this.statsGetter = statsGetter;
12050
+ this.statsPreProcessor = statsPreprocessor;
12051
+ }
12052
+ getStats() {
12053
+ return __awaiter(this, void 0, void 0, function* () {
12054
+ var statsReport = yield this.statsGetter();
12055
+ var statsObject = {};
12056
+ statsReport.forEach((value, key) => {
12057
+ statsObject[key] = value;
12058
+ });
12059
+ yield this.statsPreProcessor(statsObject);
12060
+ return statsObject;
12061
+ });
12062
+ }
12063
+ }
12064
+ var simulcastMaxFrameSizes = {
12065
+ 0: '240',
12066
+ 1: '2304',
12067
+ 2: '8160'
12068
+ };
12069
+ class RidIngressStreamSignaler {
12070
+ constructor(mid) {
12071
+ this.mid = mid;
12072
+ }
12073
+ getReceiverId() {
12074
+ return {
12075
+ mid: this.mid,
12076
+ rid: '1'
12077
+ };
12078
+ }
12079
+ signalLocalStreams(mLine) {}
12080
+ signalRemoteStreams(mLine) {}
12081
+ }
12082
+ class RidEgressStreamSignaler {
12083
+ constructor(mid) {
12084
+ this.streamIds = [];
12085
+ this.mid = mid;
12086
+ }
12087
+ signalStreams(simulcastEnabled, _rtxEnabled, mLine) {
12088
+ mLine.ssrcGroups = [];
12089
+ if (this.streamIds.length === 0) {
12090
+ if (simulcastEnabled) {
12091
+ this.streamIds = [{
12092
+ mid: this.mid,
12093
+ rid: 'low'
12094
+ }, {
12095
+ mid: this.mid,
12096
+ rid: 'medium'
12097
+ }, {
12098
+ mid: this.mid,
12099
+ rid: 'high'
12100
+ }];
12101
+ } else {
12102
+ this.streamIds = [{
12103
+ mid: this.mid
12104
+ }];
12105
+ }
12106
+ }
12107
+ if (simulcastEnabled) {
12108
+ mLine.rids = this.streamIds.map((streamId, index) => new RidLine(streamId.rid, 'send', "max-fs=".concat(simulcastMaxFrameSizes[index])));
12109
+ mLine.simulcast = new SimulcastLine(SimulcastLayerList.fromString('low;medium;high'), new SimulcastLayerList());
12110
+ }
12111
+ }
12112
+ getSenderIds() {
12113
+ return this.streamIds;
12114
+ }
12115
+ getEncodingIndexForStreamId(streamId) {
12116
+ return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
12117
+ }
12118
+ }
12119
+ function generateSsrc() {
12120
+ return Math.floor(Math.random() * 0xffffffff) + 1;
12121
+ }
12122
+ class SsrcIngressStreamSignaler {
12123
+ constructor() {
12124
+ this.ssrc = generateSsrc();
12125
+ }
12126
+ getReceiverId() {
12127
+ return Object.assign({
12128
+ ssrc: this.ssrc
12129
+ }, this.rtxSsrc ? {
12130
+ rtxSsrc: this.rtxSsrc
12131
+ } : {});
12132
+ }
12133
+ signalLocalStreams(_mLine) {}
12134
+ signalRemoteStreams(mLine) {
12135
+ mLine.addLine(new SsrcLine(this.ssrc, 'cname', "".concat(this.ssrc, "-cname")));
12136
+ mLine.addLine(new SsrcLine(this.ssrc, 'msid', '-', '1'));
12137
+ if (hasCodec('rtx', mLine)) {
12138
+ this.rtxSsrc = generateSsrc();
12139
+ mLine.addLine(new SsrcLine(this.rtxSsrc, 'cname', "".concat(this.ssrc, "-cname")));
12140
+ mLine.addLine(new SsrcLine(this.rtxSsrc, 'msid', '-', '1'));
12141
+ mLine.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
12142
+ }
12143
+ }
12144
+ }
12145
+ class SsrcEgressStreamSignaler {
12146
+ constructor() {
12147
+ this.streamIds = [];
12148
+ }
12149
+ signalStreams(simulcastEnabled, rtxEnabled, mLine) {
12150
+ mLine.rids = [];
12151
+ mLine.simulcast = undefined;
12152
+ mLine.ssrcs = [];
12153
+ mLine.ssrcGroups = [];
12154
+ if (this.streamIds.length === 0) {
12155
+ var numStreams = simulcastEnabled ? 3 : 1;
12156
+ [...Array(numStreams).keys()].forEach(() => {
12157
+ var newStreamId = {
12158
+ ssrc: generateSsrc()
11748
12159
  };
11749
- },
11750
- 90: function _(e, t, r) {
11751
- t.__esModule = !0, t.default = void 0;
11752
- var n,
11753
- i = (n = r(91)) && n.__esModule ? n : {
11754
- default: n
11755
- },
11756
- s = r(18);
11757
- function a(e, t) {
11758
- for (var r = 0; r < t.length; r++) {
11759
- var n = t[r];
11760
- n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
11761
- }
12160
+ if (rtxEnabled) {
12161
+ newStreamId.rtxSsrc = generateSsrc();
11762
12162
  }
11763
- var o = function () {
11764
- function e() {}
11765
- var t, r, n;
11766
- return e.getParser = function (e, t) {
11767
- if (void 0 === t && (t = !1), "string" != typeof e) throw new Error("UserAgent should be a string");
11768
- return new i.default(e, t);
11769
- }, e.parse = function (e) {
11770
- return new i.default(e).getResult();
11771
- }, t = e, n = [{
11772
- key: "BROWSER_MAP",
11773
- get: function get() {
11774
- return s.BROWSER_MAP;
11775
- }
11776
- }, {
11777
- key: "ENGINE_MAP",
11778
- get: function get() {
11779
- return s.ENGINE_MAP;
11780
- }
11781
- }, {
11782
- key: "OS_MAP",
11783
- get: function get() {
11784
- return s.OS_MAP;
11785
- }
11786
- }, {
11787
- key: "PLATFORMS_MAP",
11788
- get: function get() {
11789
- return s.PLATFORMS_MAP;
11790
- }
11791
- }], (r = null) && a(t.prototype, r), n && a(t, n), e;
11792
- }();
11793
- t.default = o, e.exports = t.default;
11794
- },
11795
- 91: function _(e, t, r) {
11796
- t.__esModule = !0, t.default = void 0;
11797
- var n = u(r(92)),
11798
- i = u(r(93)),
11799
- s = u(r(94)),
11800
- a = u(r(95)),
11801
- o = u(r(17));
11802
- function u(e) {
11803
- return e && e.__esModule ? e : {
11804
- default: e
11805
- };
12163
+ this.streamIds.push(newStreamId);
12164
+ });
12165
+ }
12166
+ this.streamIds.forEach(streamId => {
12167
+ var rtpSsrc = streamId.ssrc;
12168
+ mLine.addLine(new SsrcLine(rtpSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
12169
+ mLine.addLine(new SsrcLine(rtpSsrc, 'msid', '-', '1'));
12170
+ if (rtxEnabled) {
12171
+ var rtxSsrc = streamId.rtxSsrc;
12172
+ mLine.addLine(new SsrcLine(rtxSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
12173
+ mLine.addLine(new SsrcLine(rtxSsrc, 'msid', '-', '1'));
12174
+ mLine.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
12175
+ }
12176
+ });
12177
+ if (simulcastEnabled) {
12178
+ mLine.addLine(new SsrcGroupLine('SIM', this.streamIds.map(streamId => streamId.ssrc)));
12179
+ }
12180
+ }
12181
+ getSenderIds() {
12182
+ return this.streamIds;
12183
+ }
12184
+ getEncodingIndexForStreamId(streamId) {
12185
+ return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
12186
+ }
12187
+ }
12188
+ class StreamSignalerManager {
12189
+ constructor(streamSignalingMode) {
12190
+ this.egressStreamSignalersByMid = new Map();
12191
+ this.ingressStreamsSignalersByMid = new Map();
12192
+ this.ingressStreamSignalingMode = streamSignalingMode;
12193
+ this.egressStreamSignalingMode = streamSignalingMode;
12194
+ }
12195
+ getOrCreateEgressStreamSignaler(mid) {
12196
+ var existing = this.getEgressStreamSignaler(mid);
12197
+ if (existing) {
12198
+ return existing;
12199
+ }
12200
+ var newSignaler;
12201
+ if (this.egressStreamSignalingMode === 'MID-RID') {
12202
+ newSignaler = new RidEgressStreamSignaler(mid);
12203
+ } else {
12204
+ newSignaler = new SsrcEgressStreamSignaler();
12205
+ }
12206
+ this.egressStreamSignalersByMid.set(mid, newSignaler);
12207
+ return newSignaler;
12208
+ }
12209
+ getEgressStreamSignalerOrThrow(mid) {
12210
+ var existing = this.getEgressStreamSignaler(mid);
12211
+ if (!existing) {
12212
+ throw new Error("Couldn't find EgressStreamSignaler for mid ".concat(mid));
12213
+ }
12214
+ return existing;
12215
+ }
12216
+ getEgressStreamSignaler(mid) {
12217
+ return this.egressStreamSignalersByMid.get(mid);
12218
+ }
12219
+ getOrCreateIngressStreamSignaler(mid) {
12220
+ var existing = this.getIngressStreamSignaler(mid);
12221
+ if (existing) {
12222
+ return existing;
12223
+ }
12224
+ var newSignaler;
12225
+ if (this.ingressStreamSignalingMode === 'MID-RID') {
12226
+ newSignaler = new RidIngressStreamSignaler(mid);
12227
+ } else {
12228
+ newSignaler = new SsrcIngressStreamSignaler();
12229
+ }
12230
+ this.ingressStreamsSignalersByMid.set(mid, newSignaler);
12231
+ return newSignaler;
12232
+ }
12233
+ getIngressStreamSignaler(mid) {
12234
+ return this.ingressStreamsSignalersByMid.get(mid);
12235
+ }
12236
+ getIngressStreamSignalerOrThrow(mid) {
12237
+ var existing = this.getIngressStreamSignaler(mid);
12238
+ if (!existing) {
12239
+ throw new Error("Couldn't find IngressStreamSignaler for mid ".concat(mid));
12240
+ }
12241
+ return existing;
12242
+ }
12243
+ }
12244
+ var es5 = {
12245
+ exports: {}
12246
+ };
12247
+ (function (module, exports) {
12248
+ !function (e, t) {
12249
+ module.exports = t();
12250
+ }(commonjsGlobal$3, function () {
12251
+ return function (e) {
12252
+ var t = {};
12253
+ function r(n) {
12254
+ if (t[n]) return t[n].exports;
12255
+ var i = t[n] = {
12256
+ i: n,
12257
+ l: !1,
12258
+ exports: {}
12259
+ };
12260
+ return e[n].call(i.exports, i, i.exports, r), i.l = !0, i.exports;
12261
+ }
12262
+ return r.m = e, r.c = t, r.d = function (e, t, n) {
12263
+ r.o(e, t) || Object.defineProperty(e, t, {
12264
+ enumerable: !0,
12265
+ get: n
12266
+ });
12267
+ }, r.r = function (e) {
12268
+ "undefined" != typeof Symbol && Symbol.toStringTag && Object.defineProperty(e, Symbol.toStringTag, {
12269
+ value: "Module"
12270
+ }), Object.defineProperty(e, "__esModule", {
12271
+ value: !0
12272
+ });
12273
+ }, r.t = function (e, t) {
12274
+ if (1 & t && (e = r(e)), 8 & t) return e;
12275
+ if (4 & t && "object" == typeof e && e && e.__esModule) return e;
12276
+ var n = Object.create(null);
12277
+ if (r.r(n), Object.defineProperty(n, "default", {
12278
+ enumerable: !0,
12279
+ value: e
12280
+ }), 2 & t && "string" != typeof e) for (var i in e) {
12281
+ r.d(n, i, function (t) {
12282
+ return e[t];
12283
+ }.bind(null, i));
11806
12284
  }
11807
- var d = function () {
11808
- function e(e, t) {
11809
- if (void 0 === t && (t = !1), null == e || "" === e) throw new Error("UserAgent parameter can't be empty");
11810
- this._ua = e, this.parsedResult = {}, !0 !== t && this.parse();
11811
- }
11812
- var t = e.prototype;
11813
- return t.getUA = function () {
11814
- return this._ua;
11815
- }, t.test = function (e) {
11816
- return e.test(this._ua);
11817
- }, t.parseBrowser = function () {
11818
- var e = this;
11819
- this.parsedResult.browser = {};
11820
- var t = o.default.find(n.default, function (t) {
11821
- if ("function" == typeof t.test) return t.test(e);
11822
- if (t.test instanceof Array) return t.test.some(function (t) {
11823
- return e.test(t);
12285
+ return n;
12286
+ }, r.n = function (e) {
12287
+ var t = e && e.__esModule ? function () {
12288
+ return e.default;
12289
+ } : function () {
12290
+ return e;
12291
+ };
12292
+ return r.d(t, "a", t), t;
12293
+ }, r.o = function (e, t) {
12294
+ return Object.prototype.hasOwnProperty.call(e, t);
12295
+ }, r.p = "", r(r.s = 90);
12296
+ }({
12297
+ 17: function _(e, t, r) {
12298
+ t.__esModule = !0, t.default = void 0;
12299
+ var n = r(18),
12300
+ i = function () {
12301
+ function e() {}
12302
+ return e.getFirstMatch = function (e, t) {
12303
+ var r = t.match(e);
12304
+ return r && r.length > 0 && r[1] || "";
12305
+ }, e.getSecondMatch = function (e, t) {
12306
+ var r = t.match(e);
12307
+ return r && r.length > 1 && r[2] || "";
12308
+ }, e.matchAndReturnConst = function (e, t, r) {
12309
+ if (e.test(t)) return r;
12310
+ }, e.getWindowsVersionName = function (e) {
12311
+ switch (e) {
12312
+ case "NT":
12313
+ return "NT";
12314
+ case "XP":
12315
+ return "XP";
12316
+ case "NT 5.0":
12317
+ return "2000";
12318
+ case "NT 5.1":
12319
+ return "XP";
12320
+ case "NT 5.2":
12321
+ return "2003";
12322
+ case "NT 6.0":
12323
+ return "Vista";
12324
+ case "NT 6.1":
12325
+ return "7";
12326
+ case "NT 6.2":
12327
+ return "8";
12328
+ case "NT 6.3":
12329
+ return "8.1";
12330
+ case "NT 10.0":
12331
+ return "10";
12332
+ default:
12333
+ return;
12334
+ }
12335
+ }, e.getMacOSVersionName = function (e) {
12336
+ var t = e.split(".").splice(0, 2).map(function (e) {
12337
+ return parseInt(e, 10) || 0;
11824
12338
  });
11825
- throw new Error("Browser's test function is not valid");
11826
- });
11827
- return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser;
11828
- }, t.getBrowser = function () {
11829
- return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
11830
- }, t.getBrowserName = function (e) {
11831
- return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
11832
- }, t.getBrowserVersion = function () {
11833
- return this.getBrowser().version;
11834
- }, t.getOS = function () {
11835
- return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
11836
- }, t.parseOS = function () {
11837
- var e = this;
11838
- this.parsedResult.os = {};
11839
- var t = o.default.find(i.default, function (t) {
11840
- if ("function" == typeof t.test) return t.test(e);
11841
- if (t.test instanceof Array) return t.test.some(function (t) {
11842
- return e.test(t);
11843
- });
11844
- throw new Error("Browser's test function is not valid");
11845
- });
11846
- return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os;
11847
- }, t.getOSName = function (e) {
11848
- var t = this.getOS().name;
11849
- return e ? String(t).toLowerCase() || "" : t || "";
11850
- }, t.getOSVersion = function () {
11851
- return this.getOS().version;
11852
- }, t.getPlatform = function () {
11853
- return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
11854
- }, t.getPlatformType = function (e) {
11855
- void 0 === e && (e = !1);
11856
- var t = this.getPlatform().type;
11857
- return e ? String(t).toLowerCase() || "" : t || "";
11858
- }, t.parsePlatform = function () {
11859
- var e = this;
11860
- this.parsedResult.platform = {};
11861
- var t = o.default.find(s.default, function (t) {
11862
- if ("function" == typeof t.test) return t.test(e);
11863
- if (t.test instanceof Array) return t.test.some(function (t) {
11864
- return e.test(t);
11865
- });
11866
- throw new Error("Browser's test function is not valid");
11867
- });
11868
- return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform;
11869
- }, t.getEngine = function () {
11870
- return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
11871
- }, t.getEngineName = function (e) {
11872
- return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
11873
- }, t.parseEngine = function () {
11874
- var e = this;
11875
- this.parsedResult.engine = {};
11876
- var t = o.default.find(a.default, function (t) {
11877
- if ("function" == typeof t.test) return t.test(e);
11878
- if (t.test instanceof Array) return t.test.some(function (t) {
11879
- return e.test(t);
12339
+ if (t.push(0), 10 === t[0]) switch (t[1]) {
12340
+ case 5:
12341
+ return "Leopard";
12342
+ case 6:
12343
+ return "Snow Leopard";
12344
+ case 7:
12345
+ return "Lion";
12346
+ case 8:
12347
+ return "Mountain Lion";
12348
+ case 9:
12349
+ return "Mavericks";
12350
+ case 10:
12351
+ return "Yosemite";
12352
+ case 11:
12353
+ return "El Capitan";
12354
+ case 12:
12355
+ return "Sierra";
12356
+ case 13:
12357
+ return "High Sierra";
12358
+ case 14:
12359
+ return "Mojave";
12360
+ case 15:
12361
+ return "Catalina";
12362
+ default:
12363
+ return;
12364
+ }
12365
+ }, e.getAndroidVersionName = function (e) {
12366
+ var t = e.split(".").splice(0, 2).map(function (e) {
12367
+ return parseInt(e, 10) || 0;
11880
12368
  });
11881
- throw new Error("Browser's test function is not valid");
11882
- });
11883
- return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine;
11884
- }, t.parse = function () {
11885
- return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
11886
- }, t.getResult = function () {
11887
- return o.default.assign({}, this.parsedResult);
11888
- }, t.satisfies = function (e) {
11889
- var t = this,
11890
- r = {},
11891
- n = 0,
11892
- i = {},
11893
- s = 0;
11894
- if (Object.keys(e).forEach(function (t) {
11895
- var a = e[t];
11896
- "string" == typeof a ? (i[t] = a, s += 1) : "object" == typeof a && (r[t] = a, n += 1);
11897
- }), n > 0) {
11898
- var a = Object.keys(r),
11899
- u = o.default.find(a, function (e) {
11900
- return t.isOS(e);
12369
+ if (t.push(0), !(1 === t[0] && t[1] < 5)) return 1 === t[0] && t[1] < 6 ? "Cupcake" : 1 === t[0] && t[1] >= 6 ? "Donut" : 2 === t[0] && t[1] < 2 ? "Eclair" : 2 === t[0] && 2 === t[1] ? "Froyo" : 2 === t[0] && t[1] > 2 ? "Gingerbread" : 3 === t[0] ? "Honeycomb" : 4 === t[0] && t[1] < 1 ? "Ice Cream Sandwich" : 4 === t[0] && t[1] < 4 ? "Jelly Bean" : 4 === t[0] && t[1] >= 4 ? "KitKat" : 5 === t[0] ? "Lollipop" : 6 === t[0] ? "Marshmallow" : 7 === t[0] ? "Nougat" : 8 === t[0] ? "Oreo" : 9 === t[0] ? "Pie" : void 0;
12370
+ }, e.getVersionPrecision = function (e) {
12371
+ return e.split(".").length;
12372
+ }, e.compareVersions = function (t, r, n) {
12373
+ void 0 === n && (n = !1);
12374
+ var i = e.getVersionPrecision(t),
12375
+ s = e.getVersionPrecision(r),
12376
+ a = Math.max(i, s),
12377
+ o = 0,
12378
+ u = e.map([t, r], function (t) {
12379
+ var r = a - e.getVersionPrecision(t),
12380
+ n = t + new Array(r + 1).join(".0");
12381
+ return e.map(n.split("."), function (e) {
12382
+ return new Array(20 - e.length).join("0") + e;
12383
+ }).reverse();
11901
12384
  });
11902
- if (u) {
11903
- var d = this.satisfies(r[u]);
11904
- if (void 0 !== d) return d;
12385
+ for (n && (o = a - Math.min(i, s)), a -= 1; a >= o;) {
12386
+ if (u[0][a] > u[1][a]) return 1;
12387
+ if (u[0][a] === u[1][a]) {
12388
+ if (a === o) return 0;
12389
+ a -= 1;
12390
+ } else if (u[0][a] < u[1][a]) return -1;
11905
12391
  }
11906
- var c = o.default.find(a, function (e) {
11907
- return t.isPlatform(e);
11908
- });
11909
- if (c) {
11910
- var f = this.satisfies(r[c]);
11911
- if (void 0 !== f) return f;
12392
+ }, e.map = function (e, t) {
12393
+ var r,
12394
+ n = [];
12395
+ if (Array.prototype.map) return Array.prototype.map.call(e, t);
12396
+ for (r = 0; r < e.length; r += 1) {
12397
+ n.push(t(e[r]));
11912
12398
  }
11913
- }
11914
- if (s > 0) {
11915
- var l = Object.keys(i),
11916
- h = o.default.find(l, function (e) {
11917
- return t.isBrowser(e, !0);
12399
+ return n;
12400
+ }, e.find = function (e, t) {
12401
+ var r, n;
12402
+ if (Array.prototype.find) return Array.prototype.find.call(e, t);
12403
+ for (r = 0, n = e.length; r < n; r += 1) {
12404
+ var i = e[r];
12405
+ if (t(i, r)) return i;
12406
+ }
12407
+ }, e.assign = function (e) {
12408
+ for (var t, r, n = e, i = arguments.length, s = new Array(i > 1 ? i - 1 : 0), a = 1; a < i; a++) {
12409
+ s[a - 1] = arguments[a];
12410
+ }
12411
+ if (Object.assign) return Object.assign.apply(Object, [e].concat(s));
12412
+ var o = function o() {
12413
+ var e = s[t];
12414
+ "object" == typeof e && null !== e && Object.keys(e).forEach(function (t) {
12415
+ n[t] = e[t];
11918
12416
  });
11919
- if (void 0 !== h) return this.compareVersion(i[h]);
11920
- }
11921
- }, t.isBrowser = function (e, t) {
11922
- void 0 === t && (t = !1);
11923
- var r = this.getBrowserName().toLowerCase(),
11924
- n = e.toLowerCase(),
11925
- i = o.default.getBrowserTypeByAlias(n);
11926
- return t && i && (n = i.toLowerCase()), n === r;
11927
- }, t.compareVersion = function (e) {
11928
- var t = [0],
11929
- r = e,
11930
- n = !1,
11931
- i = this.getBrowserVersion();
11932
- if ("string" == typeof i) return ">" === e[0] || "<" === e[0] ? (r = e.substr(1), "=" === e[1] ? (n = !0, r = e.substr(2)) : t = [], ">" === e[0] ? t.push(1) : t.push(-1)) : "=" === e[0] ? r = e.substr(1) : "~" === e[0] && (n = !0, r = e.substr(1)), t.indexOf(o.default.compareVersions(i, r, n)) > -1;
11933
- }, t.isOS = function (e) {
11934
- return this.getOSName(!0) === String(e).toLowerCase();
11935
- }, t.isPlatform = function (e) {
11936
- return this.getPlatformType(!0) === String(e).toLowerCase();
11937
- }, t.isEngine = function (e) {
11938
- return this.getEngineName(!0) === String(e).toLowerCase();
11939
- }, t.is = function (e, t) {
11940
- return void 0 === t && (t = !1), this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
11941
- }, t.some = function (e) {
11942
- var t = this;
11943
- return void 0 === e && (e = []), e.some(function (e) {
11944
- return t.is(e);
11945
- });
11946
- }, e;
11947
- }();
11948
- t.default = d, e.exports = t.default;
12417
+ };
12418
+ for (t = 0, r = s.length; t < r; t += 1) {
12419
+ o();
12420
+ }
12421
+ return e;
12422
+ }, e.getBrowserAlias = function (e) {
12423
+ return n.BROWSER_ALIASES_MAP[e];
12424
+ }, e.getBrowserTypeByAlias = function (e) {
12425
+ return n.BROWSER_MAP[e] || "";
12426
+ }, e;
12427
+ }();
12428
+ t.default = i, e.exports = t.default;
11949
12429
  },
11950
- 92: function _(e, t, r) {
11951
- t.__esModule = !0, t.default = void 0;
11952
- var n,
11953
- i = (n = r(17)) && n.__esModule ? n : {
11954
- default: n
11955
- };
11956
- var s = /version\/(\d+(\.?_?\d+)+)/i,
11957
- a = [{
11958
- test: [/googlebot/i],
11959
- describe: function describe(e) {
11960
- var t = {
11961
- name: "Googlebot"
11962
- },
11963
- r = i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, e) || i.default.getFirstMatch(s, e);
11964
- return r && (t.version = r), t;
11965
- }
11966
- }, {
11967
- test: [/opera/i],
11968
- describe: function describe(e) {
11969
- var t = {
11970
- name: "Opera"
11971
- },
11972
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, e);
11973
- return r && (t.version = r), t;
11974
- }
11975
- }, {
11976
- test: [/opr\/|opios/i],
11977
- describe: function describe(e) {
11978
- var t = {
11979
- name: "Opera"
11980
- },
11981
- r = i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, e) || i.default.getFirstMatch(s, e);
11982
- return r && (t.version = r), t;
11983
- }
11984
- }, {
11985
- test: [/SamsungBrowser/i],
11986
- describe: function describe(e) {
11987
- var t = {
11988
- name: "Samsung Internet for Android"
11989
- },
11990
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
11991
- return r && (t.version = r), t;
11992
- }
11993
- }, {
11994
- test: [/Whale/i],
11995
- describe: function describe(e) {
11996
- var t = {
11997
- name: "NAVER Whale Browser"
11998
- },
11999
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, e);
12000
- return r && (t.version = r), t;
12001
- }
12002
- }, {
12003
- test: [/MZBrowser/i],
12004
- describe: function describe(e) {
12005
- var t = {
12006
- name: "MZ Browser"
12007
- },
12008
- r = i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12009
- return r && (t.version = r), t;
12010
- }
12011
- }, {
12012
- test: [/focus/i],
12013
- describe: function describe(e) {
12014
- var t = {
12015
- name: "Focus"
12016
- },
12017
- r = i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12018
- return r && (t.version = r), t;
12019
- }
12020
- }, {
12021
- test: [/swing/i],
12022
- describe: function describe(e) {
12023
- var t = {
12024
- name: "Swing"
12025
- },
12026
- r = i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12027
- return r && (t.version = r), t;
12028
- }
12029
- }, {
12030
- test: [/coast/i],
12031
- describe: function describe(e) {
12032
- var t = {
12033
- name: "Opera Coast"
12034
- },
12035
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, e);
12036
- return r && (t.version = r), t;
12037
- }
12038
- }, {
12039
- test: [/opt\/\d+(?:.?_?\d+)+/i],
12040
- describe: function describe(e) {
12041
- var t = {
12042
- name: "Opera Touch"
12043
- },
12044
- r = i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12045
- return r && (t.version = r), t;
12046
- }
12047
- }, {
12048
- test: [/yabrowser/i],
12049
- describe: function describe(e) {
12050
- var t = {
12051
- name: "Yandex Browser"
12052
- },
12053
- r = i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12054
- return r && (t.version = r), t;
12055
- }
12056
- }, {
12057
- test: [/ucbrowser/i],
12058
- describe: function describe(e) {
12059
- var t = {
12060
- name: "UC Browser"
12061
- },
12062
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12063
- return r && (t.version = r), t;
12064
- }
12065
- }, {
12066
- test: [/Maxthon|mxios/i],
12067
- describe: function describe(e) {
12068
- var t = {
12069
- name: "Maxthon"
12070
- },
12071
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12072
- return r && (t.version = r), t;
12073
- }
12074
- }, {
12075
- test: [/epiphany/i],
12076
- describe: function describe(e) {
12077
- var t = {
12078
- name: "Epiphany"
12079
- },
12080
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, e);
12081
- return r && (t.version = r), t;
12082
- }
12083
- }, {
12084
- test: [/puffin/i],
12085
- describe: function describe(e) {
12086
- var t = {
12087
- name: "Puffin"
12088
- },
12089
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, e);
12090
- return r && (t.version = r), t;
12091
- }
12092
- }, {
12093
- test: [/sleipnir/i],
12094
- describe: function describe(e) {
12095
- var t = {
12096
- name: "Sleipnir"
12097
- },
12098
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, e);
12099
- return r && (t.version = r), t;
12430
+ 18: function _(e, t, r) {
12431
+ t.__esModule = !0, t.ENGINE_MAP = t.OS_MAP = t.PLATFORMS_MAP = t.BROWSER_MAP = t.BROWSER_ALIASES_MAP = void 0;
12432
+ t.BROWSER_ALIASES_MAP = {
12433
+ "Amazon Silk": "amazon_silk",
12434
+ "Android Browser": "android",
12435
+ Bada: "bada",
12436
+ BlackBerry: "blackberry",
12437
+ Chrome: "chrome",
12438
+ Chromium: "chromium",
12439
+ Electron: "electron",
12440
+ Epiphany: "epiphany",
12441
+ Firefox: "firefox",
12442
+ Focus: "focus",
12443
+ Generic: "generic",
12444
+ "Google Search": "google_search",
12445
+ Googlebot: "googlebot",
12446
+ "Internet Explorer": "ie",
12447
+ "K-Meleon": "k_meleon",
12448
+ Maxthon: "maxthon",
12449
+ "Microsoft Edge": "edge",
12450
+ "MZ Browser": "mz",
12451
+ "NAVER Whale Browser": "naver",
12452
+ Opera: "opera",
12453
+ "Opera Coast": "opera_coast",
12454
+ PhantomJS: "phantomjs",
12455
+ Puffin: "puffin",
12456
+ QupZilla: "qupzilla",
12457
+ QQ: "qq",
12458
+ QQLite: "qqlite",
12459
+ Safari: "safari",
12460
+ Sailfish: "sailfish",
12461
+ "Samsung Internet for Android": "samsung_internet",
12462
+ SeaMonkey: "seamonkey",
12463
+ Sleipnir: "sleipnir",
12464
+ Swing: "swing",
12465
+ Tizen: "tizen",
12466
+ "UC Browser": "uc",
12467
+ Vivaldi: "vivaldi",
12468
+ "WebOS Browser": "webos",
12469
+ WeChat: "wechat",
12470
+ "Yandex Browser": "yandex",
12471
+ Roku: "roku"
12472
+ };
12473
+ t.BROWSER_MAP = {
12474
+ amazon_silk: "Amazon Silk",
12475
+ android: "Android Browser",
12476
+ bada: "Bada",
12477
+ blackberry: "BlackBerry",
12478
+ chrome: "Chrome",
12479
+ chromium: "Chromium",
12480
+ electron: "Electron",
12481
+ epiphany: "Epiphany",
12482
+ firefox: "Firefox",
12483
+ focus: "Focus",
12484
+ generic: "Generic",
12485
+ googlebot: "Googlebot",
12486
+ google_search: "Google Search",
12487
+ ie: "Internet Explorer",
12488
+ k_meleon: "K-Meleon",
12489
+ maxthon: "Maxthon",
12490
+ edge: "Microsoft Edge",
12491
+ mz: "MZ Browser",
12492
+ naver: "NAVER Whale Browser",
12493
+ opera: "Opera",
12494
+ opera_coast: "Opera Coast",
12495
+ phantomjs: "PhantomJS",
12496
+ puffin: "Puffin",
12497
+ qupzilla: "QupZilla",
12498
+ qq: "QQ Browser",
12499
+ qqlite: "QQ Browser Lite",
12500
+ safari: "Safari",
12501
+ sailfish: "Sailfish",
12502
+ samsung_internet: "Samsung Internet for Android",
12503
+ seamonkey: "SeaMonkey",
12504
+ sleipnir: "Sleipnir",
12505
+ swing: "Swing",
12506
+ tizen: "Tizen",
12507
+ uc: "UC Browser",
12508
+ vivaldi: "Vivaldi",
12509
+ webos: "WebOS Browser",
12510
+ wechat: "WeChat",
12511
+ yandex: "Yandex Browser"
12512
+ };
12513
+ t.PLATFORMS_MAP = {
12514
+ tablet: "tablet",
12515
+ mobile: "mobile",
12516
+ desktop: "desktop",
12517
+ tv: "tv"
12518
+ };
12519
+ t.OS_MAP = {
12520
+ WindowsPhone: "Windows Phone",
12521
+ Windows: "Windows",
12522
+ MacOS: "macOS",
12523
+ iOS: "iOS",
12524
+ Android: "Android",
12525
+ WebOS: "WebOS",
12526
+ BlackBerry: "BlackBerry",
12527
+ Bada: "Bada",
12528
+ Tizen: "Tizen",
12529
+ Linux: "Linux",
12530
+ ChromeOS: "Chrome OS",
12531
+ PlayStation4: "PlayStation 4",
12532
+ Roku: "Roku"
12533
+ };
12534
+ t.ENGINE_MAP = {
12535
+ EdgeHTML: "EdgeHTML",
12536
+ Blink: "Blink",
12537
+ Trident: "Trident",
12538
+ Presto: "Presto",
12539
+ Gecko: "Gecko",
12540
+ WebKit: "WebKit"
12541
+ };
12542
+ },
12543
+ 90: function _(e, t, r) {
12544
+ t.__esModule = !0, t.default = void 0;
12545
+ var n,
12546
+ i = (n = r(91)) && n.__esModule ? n : {
12547
+ default: n
12548
+ },
12549
+ s = r(18);
12550
+ function a(e, t) {
12551
+ for (var r = 0; r < t.length; r++) {
12552
+ var n = t[r];
12553
+ n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), Object.defineProperty(e, n.key, n);
12554
+ }
12555
+ }
12556
+ var o = function () {
12557
+ function e() {}
12558
+ var t, r, n;
12559
+ return e.getParser = function (e, t) {
12560
+ if (void 0 === t && (t = !1), "string" != typeof e) throw new Error("UserAgent should be a string");
12561
+ return new i.default(e, t);
12562
+ }, e.parse = function (e) {
12563
+ return new i.default(e).getResult();
12564
+ }, t = e, n = [{
12565
+ key: "BROWSER_MAP",
12566
+ get: function get() {
12567
+ return s.BROWSER_MAP;
12100
12568
  }
12101
12569
  }, {
12102
- test: [/k-meleon/i],
12103
- describe: function describe(e) {
12104
- var t = {
12105
- name: "K-Meleon"
12106
- },
12107
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, e);
12108
- return r && (t.version = r), t;
12570
+ key: "ENGINE_MAP",
12571
+ get: function get() {
12572
+ return s.ENGINE_MAP;
12109
12573
  }
12110
12574
  }, {
12111
- test: [/micromessenger/i],
12112
- describe: function describe(e) {
12113
- var t = {
12114
- name: "WeChat"
12115
- },
12116
- r = i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12117
- return r && (t.version = r), t;
12575
+ key: "OS_MAP",
12576
+ get: function get() {
12577
+ return s.OS_MAP;
12118
12578
  }
12119
12579
  }, {
12120
- test: [/qqbrowser/i],
12121
- describe: function describe(e) {
12122
- var t = {
12123
- name: /qqbrowserlite/i.test(e) ? "QQ Browser Lite" : "QQ Browser"
12124
- },
12125
- r = i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12126
- return r && (t.version = r), t;
12580
+ key: "PLATFORMS_MAP",
12581
+ get: function get() {
12582
+ return s.PLATFORMS_MAP;
12127
12583
  }
12128
- }, {
12129
- test: [/msie|trident/i],
12584
+ }], (r = null) && a(t.prototype, r), n && a(t, n), e;
12585
+ }();
12586
+ t.default = o, e.exports = t.default;
12587
+ },
12588
+ 91: function _(e, t, r) {
12589
+ t.__esModule = !0, t.default = void 0;
12590
+ var n = u(r(92)),
12591
+ i = u(r(93)),
12592
+ s = u(r(94)),
12593
+ a = u(r(95)),
12594
+ o = u(r(17));
12595
+ function u(e) {
12596
+ return e && e.__esModule ? e : {
12597
+ default: e
12598
+ };
12599
+ }
12600
+ var d = function () {
12601
+ function e(e, t) {
12602
+ if (void 0 === t && (t = !1), null == e || "" === e) throw new Error("UserAgent parameter can't be empty");
12603
+ this._ua = e, this.parsedResult = {}, !0 !== t && this.parse();
12604
+ }
12605
+ var t = e.prototype;
12606
+ return t.getUA = function () {
12607
+ return this._ua;
12608
+ }, t.test = function (e) {
12609
+ return e.test(this._ua);
12610
+ }, t.parseBrowser = function () {
12611
+ var e = this;
12612
+ this.parsedResult.browser = {};
12613
+ var t = o.default.find(n.default, function (t) {
12614
+ if ("function" == typeof t.test) return t.test(e);
12615
+ if (t.test instanceof Array) return t.test.some(function (t) {
12616
+ return e.test(t);
12617
+ });
12618
+ throw new Error("Browser's test function is not valid");
12619
+ });
12620
+ return t && (this.parsedResult.browser = t.describe(this.getUA())), this.parsedResult.browser;
12621
+ }, t.getBrowser = function () {
12622
+ return this.parsedResult.browser ? this.parsedResult.browser : this.parseBrowser();
12623
+ }, t.getBrowserName = function (e) {
12624
+ return e ? String(this.getBrowser().name).toLowerCase() || "" : this.getBrowser().name || "";
12625
+ }, t.getBrowserVersion = function () {
12626
+ return this.getBrowser().version;
12627
+ }, t.getOS = function () {
12628
+ return this.parsedResult.os ? this.parsedResult.os : this.parseOS();
12629
+ }, t.parseOS = function () {
12630
+ var e = this;
12631
+ this.parsedResult.os = {};
12632
+ var t = o.default.find(i.default, function (t) {
12633
+ if ("function" == typeof t.test) return t.test(e);
12634
+ if (t.test instanceof Array) return t.test.some(function (t) {
12635
+ return e.test(t);
12636
+ });
12637
+ throw new Error("Browser's test function is not valid");
12638
+ });
12639
+ return t && (this.parsedResult.os = t.describe(this.getUA())), this.parsedResult.os;
12640
+ }, t.getOSName = function (e) {
12641
+ var t = this.getOS().name;
12642
+ return e ? String(t).toLowerCase() || "" : t || "";
12643
+ }, t.getOSVersion = function () {
12644
+ return this.getOS().version;
12645
+ }, t.getPlatform = function () {
12646
+ return this.parsedResult.platform ? this.parsedResult.platform : this.parsePlatform();
12647
+ }, t.getPlatformType = function (e) {
12648
+ void 0 === e && (e = !1);
12649
+ var t = this.getPlatform().type;
12650
+ return e ? String(t).toLowerCase() || "" : t || "";
12651
+ }, t.parsePlatform = function () {
12652
+ var e = this;
12653
+ this.parsedResult.platform = {};
12654
+ var t = o.default.find(s.default, function (t) {
12655
+ if ("function" == typeof t.test) return t.test(e);
12656
+ if (t.test instanceof Array) return t.test.some(function (t) {
12657
+ return e.test(t);
12658
+ });
12659
+ throw new Error("Browser's test function is not valid");
12660
+ });
12661
+ return t && (this.parsedResult.platform = t.describe(this.getUA())), this.parsedResult.platform;
12662
+ }, t.getEngine = function () {
12663
+ return this.parsedResult.engine ? this.parsedResult.engine : this.parseEngine();
12664
+ }, t.getEngineName = function (e) {
12665
+ return e ? String(this.getEngine().name).toLowerCase() || "" : this.getEngine().name || "";
12666
+ }, t.parseEngine = function () {
12667
+ var e = this;
12668
+ this.parsedResult.engine = {};
12669
+ var t = o.default.find(a.default, function (t) {
12670
+ if ("function" == typeof t.test) return t.test(e);
12671
+ if (t.test instanceof Array) return t.test.some(function (t) {
12672
+ return e.test(t);
12673
+ });
12674
+ throw new Error("Browser's test function is not valid");
12675
+ });
12676
+ return t && (this.parsedResult.engine = t.describe(this.getUA())), this.parsedResult.engine;
12677
+ }, t.parse = function () {
12678
+ return this.parseBrowser(), this.parseOS(), this.parsePlatform(), this.parseEngine(), this;
12679
+ }, t.getResult = function () {
12680
+ return o.default.assign({}, this.parsedResult);
12681
+ }, t.satisfies = function (e) {
12682
+ var t = this,
12683
+ r = {},
12684
+ n = 0,
12685
+ i = {},
12686
+ s = 0;
12687
+ if (Object.keys(e).forEach(function (t) {
12688
+ var a = e[t];
12689
+ "string" == typeof a ? (i[t] = a, s += 1) : "object" == typeof a && (r[t] = a, n += 1);
12690
+ }), n > 0) {
12691
+ var a = Object.keys(r),
12692
+ u = o.default.find(a, function (e) {
12693
+ return t.isOS(e);
12694
+ });
12695
+ if (u) {
12696
+ var d = this.satisfies(r[u]);
12697
+ if (void 0 !== d) return d;
12698
+ }
12699
+ var c = o.default.find(a, function (e) {
12700
+ return t.isPlatform(e);
12701
+ });
12702
+ if (c) {
12703
+ var f = this.satisfies(r[c]);
12704
+ if (void 0 !== f) return f;
12705
+ }
12706
+ }
12707
+ if (s > 0) {
12708
+ var l = Object.keys(i),
12709
+ h = o.default.find(l, function (e) {
12710
+ return t.isBrowser(e, !0);
12711
+ });
12712
+ if (void 0 !== h) return this.compareVersion(i[h]);
12713
+ }
12714
+ }, t.isBrowser = function (e, t) {
12715
+ void 0 === t && (t = !1);
12716
+ var r = this.getBrowserName().toLowerCase(),
12717
+ n = e.toLowerCase(),
12718
+ i = o.default.getBrowserTypeByAlias(n);
12719
+ return t && i && (n = i.toLowerCase()), n === r;
12720
+ }, t.compareVersion = function (e) {
12721
+ var t = [0],
12722
+ r = e,
12723
+ n = !1,
12724
+ i = this.getBrowserVersion();
12725
+ if ("string" == typeof i) return ">" === e[0] || "<" === e[0] ? (r = e.substr(1), "=" === e[1] ? (n = !0, r = e.substr(2)) : t = [], ">" === e[0] ? t.push(1) : t.push(-1)) : "=" === e[0] ? r = e.substr(1) : "~" === e[0] && (n = !0, r = e.substr(1)), t.indexOf(o.default.compareVersions(i, r, n)) > -1;
12726
+ }, t.isOS = function (e) {
12727
+ return this.getOSName(!0) === String(e).toLowerCase();
12728
+ }, t.isPlatform = function (e) {
12729
+ return this.getPlatformType(!0) === String(e).toLowerCase();
12730
+ }, t.isEngine = function (e) {
12731
+ return this.getEngineName(!0) === String(e).toLowerCase();
12732
+ }, t.is = function (e, t) {
12733
+ return void 0 === t && (t = !1), this.isBrowser(e, t) || this.isOS(e) || this.isPlatform(e);
12734
+ }, t.some = function (e) {
12735
+ var t = this;
12736
+ return void 0 === e && (e = []), e.some(function (e) {
12737
+ return t.is(e);
12738
+ });
12739
+ }, e;
12740
+ }();
12741
+ t.default = d, e.exports = t.default;
12742
+ },
12743
+ 92: function _(e, t, r) {
12744
+ t.__esModule = !0, t.default = void 0;
12745
+ var n,
12746
+ i = (n = r(17)) && n.__esModule ? n : {
12747
+ default: n
12748
+ };
12749
+ var s = /version\/(\d+(\.?_?\d+)+)/i,
12750
+ a = [{
12751
+ test: [/googlebot/i],
12130
12752
  describe: function describe(e) {
12131
12753
  var t = {
12132
- name: "Internet Explorer"
12754
+ name: "Googlebot"
12133
12755
  },
12134
- r = i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, e);
12756
+ r = i.default.getFirstMatch(/googlebot\/(\d+(\.\d+))/i, e) || i.default.getFirstMatch(s, e);
12135
12757
  return r && (t.version = r), t;
12136
12758
  }
12137
12759
  }, {
12138
- test: [/\sedg\//i],
12760
+ test: [/opera/i],
12139
12761
  describe: function describe(e) {
12140
12762
  var t = {
12141
- name: "Microsoft Edge"
12763
+ name: "Opera"
12142
12764
  },
12143
- r = i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, e);
12765
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:opera)[\s/](\d+(\.?_?\d+)+)/i, e);
12144
12766
  return r && (t.version = r), t;
12145
12767
  }
12146
12768
  }, {
12147
- test: [/edg([ea]|ios)/i],
12769
+ test: [/opr\/|opios/i],
12148
12770
  describe: function describe(e) {
12149
12771
  var t = {
12150
- name: "Microsoft Edge"
12772
+ name: "Opera"
12151
12773
  },
12152
- r = i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, e);
12774
+ r = i.default.getFirstMatch(/(?:opr|opios)[\s/](\S+)/i, e) || i.default.getFirstMatch(s, e);
12153
12775
  return r && (t.version = r), t;
12154
12776
  }
12155
12777
  }, {
12156
- test: [/vivaldi/i],
12778
+ test: [/SamsungBrowser/i],
12157
12779
  describe: function describe(e) {
12158
12780
  var t = {
12159
- name: "Vivaldi"
12781
+ name: "Samsung Internet for Android"
12160
12782
  },
12161
- r = i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, e);
12783
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:SamsungBrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12162
12784
  return r && (t.version = r), t;
12163
12785
  }
12164
12786
  }, {
12165
- test: [/seamonkey/i],
12787
+ test: [/Whale/i],
12166
12788
  describe: function describe(e) {
12167
12789
  var t = {
12168
- name: "SeaMonkey"
12790
+ name: "NAVER Whale Browser"
12169
12791
  },
12170
- r = i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, e);
12792
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:whale)[\s/](\d+(?:\.\d+)+)/i, e);
12171
12793
  return r && (t.version = r), t;
12172
12794
  }
12173
12795
  }, {
12174
- test: [/sailfish/i],
12796
+ test: [/MZBrowser/i],
12175
12797
  describe: function describe(e) {
12176
12798
  var t = {
12177
- name: "Sailfish"
12799
+ name: "MZ Browser"
12178
12800
  },
12179
- r = i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, e);
12801
+ r = i.default.getFirstMatch(/(?:MZBrowser)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12180
12802
  return r && (t.version = r), t;
12181
12803
  }
12182
12804
  }, {
12183
- test: [/silk/i],
12805
+ test: [/focus/i],
12184
12806
  describe: function describe(e) {
12185
12807
  var t = {
12186
- name: "Amazon Silk"
12808
+ name: "Focus"
12187
12809
  },
12188
- r = i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, e);
12810
+ r = i.default.getFirstMatch(/(?:focus)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12189
12811
  return r && (t.version = r), t;
12190
12812
  }
12191
12813
  }, {
12192
- test: [/phantom/i],
12814
+ test: [/swing/i],
12193
12815
  describe: function describe(e) {
12194
12816
  var t = {
12195
- name: "PhantomJS"
12817
+ name: "Swing"
12196
12818
  },
12197
- r = i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, e);
12819
+ r = i.default.getFirstMatch(/(?:swing)[\s/](\d+(?:\.\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12198
12820
  return r && (t.version = r), t;
12199
12821
  }
12200
12822
  }, {
12201
- test: [/slimerjs/i],
12823
+ test: [/coast/i],
12202
12824
  describe: function describe(e) {
12203
12825
  var t = {
12204
- name: "SlimerJS"
12826
+ name: "Opera Coast"
12205
12827
  },
12206
- r = i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, e);
12828
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:coast)[\s/](\d+(\.?_?\d+)+)/i, e);
12207
12829
  return r && (t.version = r), t;
12208
12830
  }
12209
12831
  }, {
12210
- test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
12832
+ test: [/opt\/\d+(?:.?_?\d+)+/i],
12211
12833
  describe: function describe(e) {
12212
12834
  var t = {
12213
- name: "BlackBerry"
12835
+ name: "Opera Touch"
12214
12836
  },
12215
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, e);
12837
+ r = i.default.getFirstMatch(/(?:opt)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12216
12838
  return r && (t.version = r), t;
12217
12839
  }
12218
12840
  }, {
12219
- test: [/(web|hpw)[o0]s/i],
12841
+ test: [/yabrowser/i],
12220
12842
  describe: function describe(e) {
12221
12843
  var t = {
12222
- name: "WebOS Browser"
12844
+ name: "Yandex Browser"
12223
12845
  },
12224
- r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, e);
12846
+ r = i.default.getFirstMatch(/(?:yabrowser)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12225
12847
  return r && (t.version = r), t;
12226
12848
  }
12227
12849
  }, {
12228
- test: [/bada/i],
12850
+ test: [/ucbrowser/i],
12229
12851
  describe: function describe(e) {
12230
12852
  var t = {
12231
- name: "Bada"
12853
+ name: "UC Browser"
12232
12854
  },
12233
- r = i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, e);
12855
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:ucbrowser)[\s/](\d+(\.?_?\d+)+)/i, e);
12234
12856
  return r && (t.version = r), t;
12235
12857
  }
12236
12858
  }, {
12237
- test: [/tizen/i],
12859
+ test: [/Maxthon|mxios/i],
12238
12860
  describe: function describe(e) {
12239
12861
  var t = {
12240
- name: "Tizen"
12862
+ name: "Maxthon"
12241
12863
  },
12242
- r = i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12864
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:Maxthon|mxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12243
12865
  return r && (t.version = r), t;
12244
12866
  }
12245
12867
  }, {
12246
- test: [/qupzilla/i],
12868
+ test: [/epiphany/i],
12247
12869
  describe: function describe(e) {
12248
12870
  var t = {
12249
- name: "QupZilla"
12871
+ name: "Epiphany"
12250
12872
  },
12251
- r = i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12873
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:epiphany)[\s/](\d+(\.?_?\d+)+)/i, e);
12252
12874
  return r && (t.version = r), t;
12253
12875
  }
12254
12876
  }, {
12255
- test: [/firefox|iceweasel|fxios/i],
12877
+ test: [/puffin/i],
12256
12878
  describe: function describe(e) {
12257
12879
  var t = {
12258
- name: "Firefox"
12880
+ name: "Puffin"
12881
+ },
12882
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:puffin)[\s/](\d+(\.?_?\d+)+)/i, e);
12883
+ return r && (t.version = r), t;
12884
+ }
12885
+ }, {
12886
+ test: [/sleipnir/i],
12887
+ describe: function describe(e) {
12888
+ var t = {
12889
+ name: "Sleipnir"
12890
+ },
12891
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:sleipnir)[\s/](\d+(\.?_?\d+)+)/i, e);
12892
+ return r && (t.version = r), t;
12893
+ }
12894
+ }, {
12895
+ test: [/k-meleon/i],
12896
+ describe: function describe(e) {
12897
+ var t = {
12898
+ name: "K-Meleon"
12899
+ },
12900
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/(?:k-meleon)[\s/](\d+(\.?_?\d+)+)/i, e);
12901
+ return r && (t.version = r), t;
12902
+ }
12903
+ }, {
12904
+ test: [/micromessenger/i],
12905
+ describe: function describe(e) {
12906
+ var t = {
12907
+ name: "WeChat"
12908
+ },
12909
+ r = i.default.getFirstMatch(/(?:micromessenger)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12910
+ return r && (t.version = r), t;
12911
+ }
12912
+ }, {
12913
+ test: [/qqbrowser/i],
12914
+ describe: function describe(e) {
12915
+ var t = {
12916
+ name: /qqbrowserlite/i.test(e) ? "QQ Browser Lite" : "QQ Browser"
12917
+ },
12918
+ r = i.default.getFirstMatch(/(?:qqbrowserlite|qqbrowser)[/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
12919
+ return r && (t.version = r), t;
12920
+ }
12921
+ }, {
12922
+ test: [/msie|trident/i],
12923
+ describe: function describe(e) {
12924
+ var t = {
12925
+ name: "Internet Explorer"
12926
+ },
12927
+ r = i.default.getFirstMatch(/(?:msie |rv:)(\d+(\.?_?\d+)+)/i, e);
12928
+ return r && (t.version = r), t;
12929
+ }
12930
+ }, {
12931
+ test: [/\sedg\//i],
12932
+ describe: function describe(e) {
12933
+ var t = {
12934
+ name: "Microsoft Edge"
12935
+ },
12936
+ r = i.default.getFirstMatch(/\sedg\/(\d+(\.?_?\d+)+)/i, e);
12937
+ return r && (t.version = r), t;
12938
+ }
12939
+ }, {
12940
+ test: [/edg([ea]|ios)/i],
12941
+ describe: function describe(e) {
12942
+ var t = {
12943
+ name: "Microsoft Edge"
12944
+ },
12945
+ r = i.default.getSecondMatch(/edg([ea]|ios)\/(\d+(\.?_?\d+)+)/i, e);
12946
+ return r && (t.version = r), t;
12947
+ }
12948
+ }, {
12949
+ test: [/vivaldi/i],
12950
+ describe: function describe(e) {
12951
+ var t = {
12952
+ name: "Vivaldi"
12953
+ },
12954
+ r = i.default.getFirstMatch(/vivaldi\/(\d+(\.?_?\d+)+)/i, e);
12955
+ return r && (t.version = r), t;
12956
+ }
12957
+ }, {
12958
+ test: [/seamonkey/i],
12959
+ describe: function describe(e) {
12960
+ var t = {
12961
+ name: "SeaMonkey"
12962
+ },
12963
+ r = i.default.getFirstMatch(/seamonkey\/(\d+(\.?_?\d+)+)/i, e);
12964
+ return r && (t.version = r), t;
12965
+ }
12966
+ }, {
12967
+ test: [/sailfish/i],
12968
+ describe: function describe(e) {
12969
+ var t = {
12970
+ name: "Sailfish"
12971
+ },
12972
+ r = i.default.getFirstMatch(/sailfish\s?browser\/(\d+(\.\d+)?)/i, e);
12973
+ return r && (t.version = r), t;
12974
+ }
12975
+ }, {
12976
+ test: [/silk/i],
12977
+ describe: function describe(e) {
12978
+ var t = {
12979
+ name: "Amazon Silk"
12980
+ },
12981
+ r = i.default.getFirstMatch(/silk\/(\d+(\.?_?\d+)+)/i, e);
12982
+ return r && (t.version = r), t;
12983
+ }
12984
+ }, {
12985
+ test: [/phantom/i],
12986
+ describe: function describe(e) {
12987
+ var t = {
12988
+ name: "PhantomJS"
12989
+ },
12990
+ r = i.default.getFirstMatch(/phantomjs\/(\d+(\.?_?\d+)+)/i, e);
12991
+ return r && (t.version = r), t;
12992
+ }
12993
+ }, {
12994
+ test: [/slimerjs/i],
12995
+ describe: function describe(e) {
12996
+ var t = {
12997
+ name: "SlimerJS"
12998
+ },
12999
+ r = i.default.getFirstMatch(/slimerjs\/(\d+(\.?_?\d+)+)/i, e);
13000
+ return r && (t.version = r), t;
13001
+ }
13002
+ }, {
13003
+ test: [/blackberry|\bbb\d+/i, /rim\stablet/i],
13004
+ describe: function describe(e) {
13005
+ var t = {
13006
+ name: "BlackBerry"
13007
+ },
13008
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/blackberry[\d]+\/(\d+(\.?_?\d+)+)/i, e);
13009
+ return r && (t.version = r), t;
13010
+ }
13011
+ }, {
13012
+ test: [/(web|hpw)[o0]s/i],
13013
+ describe: function describe(e) {
13014
+ var t = {
13015
+ name: "WebOS Browser"
13016
+ },
13017
+ r = i.default.getFirstMatch(s, e) || i.default.getFirstMatch(/w(?:eb)?[o0]sbrowser\/(\d+(\.?_?\d+)+)/i, e);
13018
+ return r && (t.version = r), t;
13019
+ }
13020
+ }, {
13021
+ test: [/bada/i],
13022
+ describe: function describe(e) {
13023
+ var t = {
13024
+ name: "Bada"
13025
+ },
13026
+ r = i.default.getFirstMatch(/dolfin\/(\d+(\.?_?\d+)+)/i, e);
13027
+ return r && (t.version = r), t;
13028
+ }
13029
+ }, {
13030
+ test: [/tizen/i],
13031
+ describe: function describe(e) {
13032
+ var t = {
13033
+ name: "Tizen"
13034
+ },
13035
+ r = i.default.getFirstMatch(/(?:tizen\s?)?browser\/(\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
13036
+ return r && (t.version = r), t;
13037
+ }
13038
+ }, {
13039
+ test: [/qupzilla/i],
13040
+ describe: function describe(e) {
13041
+ var t = {
13042
+ name: "QupZilla"
13043
+ },
13044
+ r = i.default.getFirstMatch(/(?:qupzilla)[\s/](\d+(\.?_?\d+)+)/i, e) || i.default.getFirstMatch(s, e);
13045
+ return r && (t.version = r), t;
13046
+ }
13047
+ }, {
13048
+ test: [/firefox|iceweasel|fxios/i],
13049
+ describe: function describe(e) {
13050
+ var t = {
13051
+ name: "Firefox"
12259
13052
  },
12260
13053
  r = i.default.getFirstMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, e);
12261
13054
  return r && (t.version = r), t;
@@ -12536,806 +13329,241 @@ var es5 = {
12536
13329
  test: [/Macintosh(.*?) FxiOS(.*?)\//],
12537
13330
  describe: function describe() {
12538
13331
  return {
12539
- type: s.PLATFORMS_MAP.tablet,
12540
- vendor: "Apple",
12541
- model: "iPad"
12542
- };
12543
- }
12544
- }, {
12545
- test: [/kftt build/i],
12546
- describe: function describe() {
12547
- return {
12548
- type: s.PLATFORMS_MAP.tablet,
12549
- vendor: "Amazon",
12550
- model: "Kindle Fire HD 7"
12551
- };
12552
- }
12553
- }, {
12554
- test: [/silk/i],
12555
- describe: function describe() {
12556
- return {
12557
- type: s.PLATFORMS_MAP.tablet,
12558
- vendor: "Amazon"
12559
- };
12560
- }
12561
- }, {
12562
- test: [/tablet(?! pc)/i],
12563
- describe: function describe() {
12564
- return {
12565
- type: s.PLATFORMS_MAP.tablet
12566
- };
12567
- }
12568
- }, {
12569
- test: function test(e) {
12570
- var t = e.test(/ipod|iphone/i),
12571
- r = e.test(/like (ipod|iphone)/i);
12572
- return t && !r;
12573
- },
12574
- describe: function describe(e) {
12575
- var t = i.default.getFirstMatch(/(ipod|iphone)/i, e);
12576
- return {
12577
- type: s.PLATFORMS_MAP.mobile,
12578
- vendor: "Apple",
12579
- model: t
12580
- };
12581
- }
12582
- }, {
12583
- test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
12584
- describe: function describe() {
12585
- return {
12586
- type: s.PLATFORMS_MAP.mobile,
12587
- vendor: "Nexus"
12588
- };
12589
- }
12590
- }, {
12591
- test: [/[^-]mobi/i],
12592
- describe: function describe() {
12593
- return {
12594
- type: s.PLATFORMS_MAP.mobile
12595
- };
12596
- }
12597
- }, {
12598
- test: function test(e) {
12599
- return "blackberry" === e.getBrowserName(!0);
12600
- },
12601
- describe: function describe() {
12602
- return {
12603
- type: s.PLATFORMS_MAP.mobile,
12604
- vendor: "BlackBerry"
12605
- };
12606
- }
12607
- }, {
12608
- test: function test(e) {
12609
- return "bada" === e.getBrowserName(!0);
12610
- },
12611
- describe: function describe() {
12612
- return {
12613
- type: s.PLATFORMS_MAP.mobile
12614
- };
12615
- }
12616
- }, {
12617
- test: function test(e) {
12618
- return "windows phone" === e.getBrowserName();
12619
- },
12620
- describe: function describe() {
12621
- return {
12622
- type: s.PLATFORMS_MAP.mobile,
12623
- vendor: "Microsoft"
12624
- };
12625
- }
12626
- }, {
12627
- test: function test(e) {
12628
- var t = Number(String(e.getOSVersion()).split(".")[0]);
12629
- return "android" === e.getOSName(!0) && t >= 3;
12630
- },
12631
- describe: function describe() {
12632
- return {
12633
- type: s.PLATFORMS_MAP.tablet
12634
- };
12635
- }
12636
- }, {
12637
- test: function test(e) {
12638
- return "android" === e.getOSName(!0);
12639
- },
12640
- describe: function describe() {
12641
- return {
12642
- type: s.PLATFORMS_MAP.mobile
12643
- };
12644
- }
12645
- }, {
12646
- test: function test(e) {
12647
- return "macos" === e.getOSName(!0);
12648
- },
12649
- describe: function describe() {
12650
- return {
12651
- type: s.PLATFORMS_MAP.desktop,
12652
- vendor: "Apple"
12653
- };
12654
- }
12655
- }, {
12656
- test: function test(e) {
12657
- return "windows" === e.getOSName(!0);
12658
- },
12659
- describe: function describe() {
12660
- return {
12661
- type: s.PLATFORMS_MAP.desktop
12662
- };
12663
- }
12664
- }, {
12665
- test: function test(e) {
12666
- return "linux" === e.getOSName(!0);
12667
- },
12668
- describe: function describe() {
12669
- return {
12670
- type: s.PLATFORMS_MAP.desktop
12671
- };
12672
- }
12673
- }, {
12674
- test: function test(e) {
12675
- return "playstation 4" === e.getOSName(!0);
12676
- },
12677
- describe: function describe() {
12678
- return {
12679
- type: s.PLATFORMS_MAP.tv
12680
- };
12681
- }
12682
- }, {
12683
- test: function test(e) {
12684
- return "roku" === e.getOSName(!0);
12685
- },
12686
- describe: function describe() {
12687
- return {
12688
- type: s.PLATFORMS_MAP.tv
12689
- };
12690
- }
12691
- }];
12692
- t.default = a, e.exports = t.default;
12693
- },
12694
- 95: function _(e, t, r) {
12695
- t.__esModule = !0, t.default = void 0;
12696
- var n,
12697
- i = (n = r(17)) && n.__esModule ? n : {
12698
- default: n
12699
- },
12700
- s = r(18);
12701
- var a = [{
12702
- test: function test(e) {
12703
- return "microsoft edge" === e.getBrowserName(!0);
12704
- },
12705
- describe: function describe(e) {
12706
- if (/\sedg\//i.test(e)) return {
12707
- name: s.ENGINE_MAP.Blink
12708
- };
12709
- var t = i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, e);
12710
- return {
12711
- name: s.ENGINE_MAP.EdgeHTML,
12712
- version: t
12713
- };
12714
- }
12715
- }, {
12716
- test: [/trident/i],
12717
- describe: function describe(e) {
12718
- var t = {
12719
- name: s.ENGINE_MAP.Trident
12720
- },
12721
- r = i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, e);
12722
- return r && (t.version = r), t;
12723
- }
12724
- }, {
12725
- test: function test(e) {
12726
- return e.test(/presto/i);
12727
- },
12728
- describe: function describe(e) {
12729
- var t = {
12730
- name: s.ENGINE_MAP.Presto
12731
- },
12732
- r = i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, e);
12733
- return r && (t.version = r), t;
12734
- }
12735
- }, {
12736
- test: function test(e) {
12737
- var t = e.test(/gecko/i),
12738
- r = e.test(/like gecko/i);
12739
- return t && !r;
12740
- },
12741
- describe: function describe(e) {
12742
- var t = {
12743
- name: s.ENGINE_MAP.Gecko
12744
- },
12745
- r = i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, e);
12746
- return r && (t.version = r), t;
12747
- }
12748
- }, {
12749
- test: [/(apple)?webkit\/537\.36/i],
12750
- describe: function describe() {
12751
- return {
12752
- name: s.ENGINE_MAP.Blink
12753
- };
12754
- }
12755
- }, {
12756
- test: [/(apple)?webkit/i],
12757
- describe: function describe(e) {
12758
- var t = {
12759
- name: s.ENGINE_MAP.WebKit
12760
- },
12761
- r = i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, e);
12762
- return r && (t.version = r), t;
12763
- }
12764
- }];
12765
- t.default = a, e.exports = t.default;
12766
- }
12767
- });
12768
- });
12769
- })(es5);
12770
- var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5.exports);
12771
- function getBrowserDetails() {
12772
- var browser = Bowser.getParser(window.navigator.userAgent);
12773
- return browser.getBrowser();
12774
- }
12775
- var ReceiveSlotEvents;
12776
- (function (ReceiveSlotEvents) {
12777
- ReceiveSlotEvents["MediaStarted"] = "media-started";
12778
- ReceiveSlotEvents["MediaStopped"] = "media-stopped";
12779
- ReceiveSlotEvents["SourceUpdate"] = "source-update";
12780
- })(ReceiveSlotEvents || (ReceiveSlotEvents = {}));
12781
- class ReceiveSlot extends EventEmitter {
12782
- constructor(idGetter, track) {
12783
- super();
12784
- this._idGetter = idGetter;
12785
- this.handleTrackMuted = this.handleTrackMuted.bind(this);
12786
- this.handleTrackUnmuted = this.handleTrackUnmuted.bind(this);
12787
- this._stream = new MediaStream([track]);
12788
- this.addTrackHandlers(track);
12789
- }
12790
- addTrackHandlers(track) {
12791
- track.addEventListener('mute', this.handleTrackMuted);
12792
- track.addEventListener('unmute', this.handleTrackUnmuted);
12793
- }
12794
- handleTrackMuted() {
12795
- this.emit(ReceiveSlotEvents.MediaStopped);
12796
- }
12797
- handleTrackUnmuted() {
12798
- this.emit(ReceiveSlotEvents.MediaStarted);
12799
- }
12800
- removeTrackHandlers(track) {
12801
- track.removeEventListener('mute', this.handleTrackMuted);
12802
- track.removeEventListener('unmute', this.handleTrackUnmuted);
12803
- }
12804
- replaceTrack(newTrack) {
12805
- var _a;
12806
- var trackToRemove = (_a = this._stream.getTracks()) === null || _a === void 0 ? void 0 : _a[0];
12807
- if (trackToRemove) {
12808
- this._stream.removeTrack(trackToRemove);
12809
- this.removeTrackHandlers(trackToRemove);
12810
- }
12811
- this.addTrackHandlers(newTrack);
12812
- this._stream.addTrack(newTrack);
12813
- }
12814
- _updateSource(state, csi) {
12815
- this.currentRxCsi = csi;
12816
- this.emit(ReceiveSlotEvents.SourceUpdate, state, csi);
12817
- }
12818
- close() {
12819
- this._stream.getTracks().forEach(t => {
12820
- this.removeTrackHandlers(t);
12821
- });
12822
- }
12823
- get id() {
12824
- return this._idGetter();
12825
- }
12826
- get stream() {
12827
- return this._stream;
12828
- }
12829
- }
12830
- ReceiveSlot.Events = ReceiveSlotEvents;
12831
- class Transceiver {
12832
- constructor(rtcRtpTransceiver) {
12833
- this._rtcRtpTransceiver = rtcRtpTransceiver;
12834
- }
12835
- replaceTransceiver(newRtcRtpTransceiver) {
12836
- this._rtcRtpTransceiver = newRtcRtpTransceiver;
12837
- }
12838
- getReceiverStats() {
12839
- return this._rtcRtpTransceiver.receiver.getStats();
12840
- }
12841
- getSenderStats() {
12842
- return this._rtcRtpTransceiver.sender.getStats();
12843
- }
12844
- get receiver() {
12845
- return this._rtcRtpTransceiver.receiver;
12846
- }
12847
- get sender() {
12848
- return this._rtcRtpTransceiver.sender;
12849
- }
12850
- get mid() {
12851
- return this._rtcRtpTransceiver.mid;
12852
- }
12853
- close() {
12854
- this._rtcRtpTransceiver.stop();
12855
- }
12856
- }
12857
- class ReceiveOnlyTransceiver extends Transceiver {
12858
- constructor(rtcRtpTransceiver, idGetter) {
12859
- super(rtcRtpTransceiver);
12860
- this._receiveSlot = new ReceiveSlot(() => {
12861
- if (!this._rtcRtpTransceiver.mid) {
12862
- return null;
12863
- }
12864
- return idGetter(this._rtcRtpTransceiver.mid);
12865
- }, this._rtcRtpTransceiver.receiver.track);
12866
- }
12867
- replaceTransceiver(newRtcRtpTransceiver) {
12868
- super.replaceTransceiver(newRtcRtpTransceiver);
12869
- this._receiveSlot.replaceTrack(newRtcRtpTransceiver.receiver.track);
12870
- }
12871
- close() {
12872
- super.close();
12873
- this._receiveSlot.close();
12874
- }
12875
- get receiveSlot() {
12876
- return this._receiveSlot;
12877
- }
12878
- }
12879
- ReceiveOnlyTransceiver.rid = '1';
12880
- class JmpLine extends Line {
12881
- static fromSdpLine(line) {
12882
- if (!JmpLine.regex.test(line)) {
12883
- return undefined;
12884
- }
12885
- return new JmpLine();
12886
- }
12887
- toSdpLine() {
12888
- return "a=jmp";
12889
- }
12890
- }
12891
- JmpLine.regex = /^jmp$/;
12892
- class JmpStreamIdModeLine extends Line {
12893
- constructor(streamIdMode) {
12894
- super();
12895
- this.streamIdMode = streamIdMode;
12896
- }
12897
- static fromSdpLine(line) {
12898
- if (!JmpStreamIdModeLine.regex.test(line)) {
12899
- return undefined;
12900
- }
12901
- var tokens = line.match(JmpStreamIdModeLine.regex);
12902
- var mode = tokens[1];
12903
- return new JmpStreamIdModeLine(mode);
12904
- }
12905
- toSdpLine() {
12906
- return "a=jmp-stream-id-mode:".concat(this.streamIdMode);
12907
- }
12908
- }
12909
- JmpStreamIdModeLine.regex = /^jmp-stream-id-mode:(MID-RID|SSRC)$/;
12910
- class JmpSourceLine extends Line {
12911
- constructor(source, csi) {
12912
- super();
12913
- this.source = source;
12914
- this.csi = csi;
12915
- }
12916
- static fromSdpLine(line) {
12917
- if (!JmpSourceLine.regex.test(line)) {
12918
- return undefined;
12919
- }
12920
- var tokens = line.match(JmpSourceLine.regex);
12921
- var source = tokens[1];
12922
- var csi = tokens[2];
12923
- return new JmpSourceLine(source, csi);
12924
- }
12925
- toSdpLine() {
12926
- var line = "a=jmp-source:".concat(this.source);
12927
- if (this.csi) {
12928
- line += " csi=".concat(this.csi);
12929
- }
12930
- return line;
12931
- }
12932
- }
12933
- JmpSourceLine.regex = new RegExp("^jmp-source:(".concat(ANY_NON_WS, ") (?:csi=(").concat(ANY_NON_WS, "))"));
12934
- DefaultSdpGrammar.addParser('a', JmpLine.fromSdpLine);
12935
- DefaultSdpGrammar.addParser('a', JmpSourceLine.fromSdpLine);
12936
- DefaultSdpGrammar.addParser('a', JmpStreamIdModeLine.fromSdpLine);
12937
- function deepCopy(source) {
12938
- return Array.isArray(source) ? source.map(item => deepCopy(item)) : source instanceof Map ? new Map(source) : source instanceof Date ? new Date(source.getTime()) : source && typeof source === 'object' ? Object.getOwnPropertyNames(source).reduce((o, prop) => {
12939
- Object.defineProperty(o, prop, Object.getOwnPropertyDescriptor(source, prop));
12940
- o[prop] = deepCopy(source[prop]);
12941
- return o;
12942
- }, Object.create(Object.getPrototypeOf(source))) : source;
12943
- }
12944
- function getMediaTypeForMline(mLine) {
12945
- var _a, _b;
12946
- var mediaFamily;
12947
- if (mLine.type.toLowerCase() === MediaFamily$1.Audio.toLowerCase()) {
12948
- mediaFamily = MediaFamily$1.Audio;
12949
- } else if (mLine.type.toLowerCase() === MediaFamily$1.Video.toLowerCase()) {
12950
- mediaFamily = MediaFamily$1.Video;
12951
- } else {
12952
- throw Error("Mline type doesn't match any known MediaFamily: ".concat(mLine.type));
12953
- }
12954
- var mediaContent;
12955
- if ((_b = (_a = mLine.content) === null || _a === void 0 ? void 0 : _a.values) === null || _b === void 0 ? void 0 : _b.some(v => v.toLowerCase() === 'slides')) {
12956
- mediaContent = MediaContent$1.Slides;
12957
- } else {
12958
- mediaContent = MediaContent$1.Main;
12959
- }
12960
- return getMediaType(mediaFamily, mediaContent);
12961
- }
12962
- function filterCodecs(parsedSdp, allowedCodecs) {
12963
- var allowedLowerCase = allowedCodecs.map(s => s.toLowerCase());
12964
- parsedSdp.avMedia.map(m => [...m.codecs.values()].map(c => c.name)).flat().filter(codecName => !allowedLowerCase.includes(codecName.toLowerCase())).forEach(c => removeCodec(parsedSdp, c));
12965
- }
12966
- function setMaxBandwidth(parsedSdp, maxBandwidth) {
12967
- parsedSdp.avMedia.forEach(mline => {
12968
- mline.bandwidth = new BandwidthLine('TIAS', maxBandwidth);
12969
- });
12970
- }
12971
- function setupBundle(parsedSdp, bundlePolicy) {
12972
- if (bundlePolicy === 'compat') {
12973
- var audioMids = parsedSdp.avMedia.filter(m => m.type === 'audio').map(m => m.mid);
12974
- var videoMids = parsedSdp.avMedia.filter(m => m.type === 'video').map(m => m.mid);
12975
- parsedSdp.session.groups.splice(0, parsedSdp.session.groups.length);
12976
- parsedSdp.session.groups.push(new BundleGroupLine(audioMids));
12977
- parsedSdp.session.groups.push(new BundleGroupLine(videoMids));
12978
- }
12979
- }
12980
- function filterRecvOnlyMlines(parsedSdp) {
12981
- var filteredMids = [];
12982
- parsedSdp.media = parsedSdp.media.filter(mLine => {
12983
- if (mLine instanceof ApplicationMediaDescription || mLine instanceof AvMediaDescription && mLine.direction !== 'recvonly') {
12984
- filteredMids.push(mLine.mid);
12985
- return true;
12986
- }
12987
- return false;
12988
- });
12989
- parsedSdp.session.groups.forEach(g => {
12990
- g.mids = g.mids.filter(m => filteredMids.includes(m));
12991
- });
12992
- }
12993
- function matchMlinesInAnswer(parsedOffer, parsedAnswer, streamSignalerManager) {
12994
- parsedAnswer.session.groups = parsedOffer.session.groups;
12995
- parsedAnswer.media = parsedOffer.media.map(offerMline => {
12996
- if (!offerMline.mid) {
12997
- throw new Error("Offer mline is missing MID");
12998
- }
12999
- var answerMline = parsedAnswer.media.find(m => m.mid === offerMline.mid);
13000
- if (answerMline) {
13001
- if (answerMline instanceof AvMediaDescription) {
13002
- [...answerMline.codecs.values()].forEach(ci => {
13003
- ci.fmtParams.push('x-google-start-bitrate=60000');
13004
- });
13005
- }
13006
- return answerMline;
13007
- }
13008
- if (!(offerMline instanceof AvMediaDescription)) {
13009
- throw new Error("Answer is missing a non-media mline: ".concat(offerMline.mid));
13010
- }
13011
- var startingMline = parsedAnswer.avMedia.find(m => m.type === offerMline.type);
13012
- if (!startingMline) {
13013
- throw new Error("Answer has no mline of type ".concat(offerMline.type, ", can't generate synthetic answer mline for mid ").concat(offerMline.mid));
13014
- }
13015
- var fakeCorrespondingMline = deepCopy(startingMline);
13016
- fakeCorrespondingMline.mid = offerMline.mid;
13017
- fakeCorrespondingMline.simulcast = undefined;
13018
- if (offerMline.direction === 'sendrecv' || offerMline.direction === 'sendonly') {
13019
- fakeCorrespondingMline.direction = 'recvonly';
13020
- }
13021
- if (offerMline.direction === 'recvonly') {
13022
- fakeCorrespondingMline.direction = 'sendonly';
13023
- var ingressSignaler = streamSignalerManager.getIngressStreamSignalerOrThrow(offerMline.mid);
13024
- ingressSignaler.signalRemoteStreams(fakeCorrespondingMline);
13025
- }
13026
- return fakeCorrespondingMline;
13027
- });
13028
- }
13029
- function injectContentTypes(sdp, contentTypeMap) {
13030
- contentTypeMap.forEach((mediaContent, mid) => {
13031
- var mline = sdp.media.find(m => m.mid === mid);
13032
- if (!mline) {
13033
- throw new Error("Error trying to set content type for mid ".concat(mid, ": not found in SDP"));
13034
- }
13035
- if (mediaContent === MediaContent$1.Slides) {
13036
- mline.addLine(new ContentLine(['slides']));
13037
- }
13038
- });
13039
- }
13040
- function injectJmpAttributes(parsedSdp, csiMap, streamSignalingMode) {
13041
- parsedSdp.avMedia.filter(mLine => mLine.direction === 'sendrecv' || mLine.direction === 'sendonly').forEach(mLine => {
13042
- if (!mLine.otherLines.find(line => line instanceof JmpLine)) {
13043
- mLine.addLine(new JmpLine());
13044
- }
13045
- if (!mLine.otherLines.find(line => line instanceof JmpSourceLine)) {
13046
- var mediaType = getMediaTypeForMline(mLine);
13047
- var csi = csiMap.get(mediaType);
13048
- if (!csi) {
13049
- throw new Error("Unable to find CSI for MediaType ".concat(mediaType));
13050
- }
13051
- mLine.addLine(new JmpSourceLine(mLine.mid, csi.toString()));
13052
- }
13053
- if (!mLine.otherLines.find(line => line instanceof JmpStreamIdModeLine)) {
13054
- mLine.addLine(new JmpStreamIdModeLine(streamSignalingMode));
13055
- }
13056
- });
13057
- }
13058
- class SendOnlyTransceiver extends Transceiver {
13059
- constructor(rtcpRtpTransceiver, csi) {
13060
- super(rtcpRtpTransceiver);
13061
- this.requested = false;
13062
- this.csi = csi;
13063
- this.handleTrackChange = this.handleTrackChange.bind(this);
13064
- }
13065
- handleTrackChange() {
13066
- var _a;
13067
- return __awaiter(this, void 0, void 0, function* () {
13068
- if (this.requested) {
13069
- yield this.sender.replaceTrack(((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null);
13070
- }
13071
- });
13072
- }
13073
- replacePublishedTrack(newTrack) {
13074
- var _a, _b;
13075
- return __awaiter(this, void 0, void 0, function* () {
13076
- (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.off(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
13077
- (_b = this.publishedTrack) === null || _b === void 0 ? void 0 : _b.setPublished(false);
13078
- if (this.requested) {
13079
- yield this.sender.replaceTrack((newTrack === null || newTrack === void 0 ? void 0 : newTrack.underlyingTrack) || null);
13080
- }
13081
- this.publishedTrack = newTrack;
13082
- newTrack === null || newTrack === void 0 ? void 0 : newTrack.on(LocalTrackEvents.UnderlyingTrackChange, this.handleTrackChange);
13083
- newTrack === null || newTrack === void 0 ? void 0 : newTrack.setPublished(true);
13084
- });
13085
- }
13086
- setTrackRequested(requested) {
13087
- var _a;
13088
- return __awaiter(this, void 0, void 0, function* () {
13089
- if (this.requested !== requested) {
13090
- this.requested = requested;
13091
- var newTrack = requested ? ((_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack) || null : null;
13092
- yield this.sender.replaceTrack(newTrack);
13093
- }
13094
- });
13095
- }
13096
- updateSimulcastStreamStates(requestedIdEncodingParamsMap) {
13097
- return __awaiter(this, void 0, void 0, function* () {
13098
- var sendParameters = this.sender.getParameters();
13099
- sendParameters.encodings.forEach((encoding, index) => {
13100
- var encodingParams = requestedIdEncodingParamsMap.get(index);
13101
- encoding.active = Boolean(encodingParams);
13102
- if (encodingParams) {
13103
- if (encodingParams.scaleDownRatio >= 1 && encoding.scaleResolutionDownBy !== encodingParams.scaleDownRatio) {
13104
- encoding.scaleResolutionDownBy = encodingParams.scaleDownRatio;
13332
+ type: s.PLATFORMS_MAP.tablet,
13333
+ vendor: "Apple",
13334
+ model: "iPad"
13335
+ };
13105
13336
  }
13106
- if (encodingParams.maxPayloadBitsPerSecond) {
13107
- encoding.maxBitrate = encodingParams.maxPayloadBitsPerSecond;
13337
+ }, {
13338
+ test: [/kftt build/i],
13339
+ describe: function describe() {
13340
+ return {
13341
+ type: s.PLATFORMS_MAP.tablet,
13342
+ vendor: "Amazon",
13343
+ model: "Kindle Fire HD 7"
13344
+ };
13345
+ }
13346
+ }, {
13347
+ test: [/silk/i],
13348
+ describe: function describe() {
13349
+ return {
13350
+ type: s.PLATFORMS_MAP.tablet,
13351
+ vendor: "Amazon"
13352
+ };
13353
+ }
13354
+ }, {
13355
+ test: [/tablet(?! pc)/i],
13356
+ describe: function describe() {
13357
+ return {
13358
+ type: s.PLATFORMS_MAP.tablet
13359
+ };
13360
+ }
13361
+ }, {
13362
+ test: function test(e) {
13363
+ var t = e.test(/ipod|iphone/i),
13364
+ r = e.test(/like (ipod|iphone)/i);
13365
+ return t && !r;
13366
+ },
13367
+ describe: function describe(e) {
13368
+ var t = i.default.getFirstMatch(/(ipod|iphone)/i, e);
13369
+ return {
13370
+ type: s.PLATFORMS_MAP.mobile,
13371
+ vendor: "Apple",
13372
+ model: t
13373
+ };
13374
+ }
13375
+ }, {
13376
+ test: [/nexus\s*[0-6].*/i, /galaxy nexus/i],
13377
+ describe: function describe() {
13378
+ return {
13379
+ type: s.PLATFORMS_MAP.mobile,
13380
+ vendor: "Nexus"
13381
+ };
13382
+ }
13383
+ }, {
13384
+ test: [/[^-]mobi/i],
13385
+ describe: function describe() {
13386
+ return {
13387
+ type: s.PLATFORMS_MAP.mobile
13388
+ };
13389
+ }
13390
+ }, {
13391
+ test: function test(e) {
13392
+ return "blackberry" === e.getBrowserName(!0);
13393
+ },
13394
+ describe: function describe() {
13395
+ return {
13396
+ type: s.PLATFORMS_MAP.mobile,
13397
+ vendor: "BlackBerry"
13398
+ };
13399
+ }
13400
+ }, {
13401
+ test: function test(e) {
13402
+ return "bada" === e.getBrowserName(!0);
13403
+ },
13404
+ describe: function describe() {
13405
+ return {
13406
+ type: s.PLATFORMS_MAP.mobile
13407
+ };
13408
+ }
13409
+ }, {
13410
+ test: function test(e) {
13411
+ return "windows phone" === e.getBrowserName();
13412
+ },
13413
+ describe: function describe() {
13414
+ return {
13415
+ type: s.PLATFORMS_MAP.mobile,
13416
+ vendor: "Microsoft"
13417
+ };
13418
+ }
13419
+ }, {
13420
+ test: function test(e) {
13421
+ var t = Number(String(e.getOSVersion()).split(".")[0]);
13422
+ return "android" === e.getOSName(!0) && t >= 3;
13423
+ },
13424
+ describe: function describe() {
13425
+ return {
13426
+ type: s.PLATFORMS_MAP.tablet
13427
+ };
13428
+ }
13429
+ }, {
13430
+ test: function test(e) {
13431
+ return "android" === e.getOSName(!0);
13432
+ },
13433
+ describe: function describe() {
13434
+ return {
13435
+ type: s.PLATFORMS_MAP.mobile
13436
+ };
13437
+ }
13438
+ }, {
13439
+ test: function test(e) {
13440
+ return "macos" === e.getOSName(!0);
13441
+ },
13442
+ describe: function describe() {
13443
+ return {
13444
+ type: s.PLATFORMS_MAP.desktop,
13445
+ vendor: "Apple"
13446
+ };
13447
+ }
13448
+ }, {
13449
+ test: function test(e) {
13450
+ return "windows" === e.getOSName(!0);
13451
+ },
13452
+ describe: function describe() {
13453
+ return {
13454
+ type: s.PLATFORMS_MAP.desktop
13455
+ };
13456
+ }
13457
+ }, {
13458
+ test: function test(e) {
13459
+ return "linux" === e.getOSName(!0);
13460
+ },
13461
+ describe: function describe() {
13462
+ return {
13463
+ type: s.PLATFORMS_MAP.desktop
13464
+ };
13465
+ }
13466
+ }, {
13467
+ test: function test(e) {
13468
+ return "playstation 4" === e.getOSName(!0);
13469
+ },
13470
+ describe: function describe() {
13471
+ return {
13472
+ type: s.PLATFORMS_MAP.tv
13473
+ };
13474
+ }
13475
+ }, {
13476
+ test: function test(e) {
13477
+ return "roku" === e.getOSName(!0);
13478
+ },
13479
+ describe: function describe() {
13480
+ return {
13481
+ type: s.PLATFORMS_MAP.tv
13482
+ };
13483
+ }
13484
+ }];
13485
+ t.default = a, e.exports = t.default;
13486
+ },
13487
+ 95: function _(e, t, r) {
13488
+ t.__esModule = !0, t.default = void 0;
13489
+ var n,
13490
+ i = (n = r(17)) && n.__esModule ? n : {
13491
+ default: n
13492
+ },
13493
+ s = r(18);
13494
+ var a = [{
13495
+ test: function test(e) {
13496
+ return "microsoft edge" === e.getBrowserName(!0);
13497
+ },
13498
+ describe: function describe(e) {
13499
+ if (/\sedg\//i.test(e)) return {
13500
+ name: s.ENGINE_MAP.Blink
13501
+ };
13502
+ var t = i.default.getFirstMatch(/edge\/(\d+(\.?_?\d+)+)/i, e);
13503
+ return {
13504
+ name: s.ENGINE_MAP.EdgeHTML,
13505
+ version: t
13506
+ };
13507
+ }
13508
+ }, {
13509
+ test: [/trident/i],
13510
+ describe: function describe(e) {
13511
+ var t = {
13512
+ name: s.ENGINE_MAP.Trident
13513
+ },
13514
+ r = i.default.getFirstMatch(/trident\/(\d+(\.?_?\d+)+)/i, e);
13515
+ return r && (t.version = r), t;
13108
13516
  }
13109
- }
13110
- });
13111
- yield this.sender.setParameters(sendParameters);
13112
- });
13113
- }
13114
- getScaleDownRatio(expectedMaxFs) {
13115
- var _a;
13116
- if (!expectedMaxFs) {
13117
- return -1;
13118
- }
13119
- if (!this.publishedTrack) {
13120
- return -1;
13121
- }
13122
- var setting = (_a = this.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
13123
- var sourceHeight = setting === null || setting === void 0 ? void 0 : setting.height;
13124
- var sourceWidth = setting === null || setting === void 0 ? void 0 : setting.width;
13125
- if (!sourceWidth || !sourceHeight) {
13126
- return -1;
13127
- }
13128
- return getScaleDownRatio([sourceWidth, sourceHeight], sourceHeight, expectedMaxFs);
13129
- }
13130
- publishTrack(track) {
13131
- return this.replacePublishedTrack(track);
13132
- }
13133
- unpublishTrack() {
13134
- return this.replacePublishedTrack();
13135
- }
13136
- setActive(enabled) {
13137
- var direction = enabled ? 'sendrecv' : 'inactive';
13138
- this._rtcRtpTransceiver.direction = direction;
13139
- return this._rtcRtpTransceiver.direction !== this._rtcRtpTransceiver.currentDirection;
13140
- }
13141
- getIngressPayloadType(mimeType) {
13142
- var senderCodecs = this.sender.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
13143
- var receiverCodecs = this.receiver.getParameters().codecs.filter(codec => codec.mimeType === mimeType);
13144
- if (!senderCodecs || !receiverCodecs || senderCodecs.length === 0 || receiverCodecs.length === 0) {
13145
- throw new Error("sender codecs or receiver codecs is undefined or empty");
13146
- }
13147
- var senderCodec = senderCodecs[0];
13148
- var targetCodec = receiverCodecs.find(receiverCodec => {
13149
- return areCodecsCompatible(senderCodec, receiverCodec);
13150
- });
13151
- if (!targetCodec || !targetCodec.payloadType) {
13152
- throw new Error("ingress payload type is not well defined in receiver codecs");
13153
- }
13154
- return targetCodec.payloadType;
13155
- }
13156
- }
13157
- var simulcastMaxFrameSizes = {
13158
- 0: '240',
13159
- 1: '2304',
13160
- 2: '8160'
13161
- };
13162
- class RidIngressStreamSignaler {
13163
- constructor(mid) {
13164
- this.mid = mid;
13165
- }
13166
- getReceiverId() {
13167
- return {
13168
- mid: this.mid,
13169
- rid: '1'
13170
- };
13171
- }
13172
- signalLocalStreams(mLine) {}
13173
- signalRemoteStreams(mLine) {}
13174
- }
13175
- class RidEgressStreamSignaler {
13176
- constructor(mid) {
13177
- this.streamIds = [];
13178
- this.mid = mid;
13179
- }
13180
- signalStreams(simulcastEnabled, _rtxEnabled, mLine) {
13181
- mLine.ssrcGroups = [];
13182
- if (this.streamIds.length === 0) {
13183
- if (simulcastEnabled) {
13184
- this.streamIds = [{
13185
- mid: this.mid,
13186
- rid: 'low'
13187
13517
  }, {
13188
- mid: this.mid,
13189
- rid: 'medium'
13518
+ test: function test(e) {
13519
+ return e.test(/presto/i);
13520
+ },
13521
+ describe: function describe(e) {
13522
+ var t = {
13523
+ name: s.ENGINE_MAP.Presto
13524
+ },
13525
+ r = i.default.getFirstMatch(/presto\/(\d+(\.?_?\d+)+)/i, e);
13526
+ return r && (t.version = r), t;
13527
+ }
13190
13528
  }, {
13191
- mid: this.mid,
13192
- rid: 'high'
13193
- }];
13194
- } else {
13195
- this.streamIds = [{
13196
- mid: this.mid
13529
+ test: function test(e) {
13530
+ var t = e.test(/gecko/i),
13531
+ r = e.test(/like gecko/i);
13532
+ return t && !r;
13533
+ },
13534
+ describe: function describe(e) {
13535
+ var t = {
13536
+ name: s.ENGINE_MAP.Gecko
13537
+ },
13538
+ r = i.default.getFirstMatch(/gecko\/(\d+(\.?_?\d+)+)/i, e);
13539
+ return r && (t.version = r), t;
13540
+ }
13541
+ }, {
13542
+ test: [/(apple)?webkit\/537\.36/i],
13543
+ describe: function describe() {
13544
+ return {
13545
+ name: s.ENGINE_MAP.Blink
13546
+ };
13547
+ }
13548
+ }, {
13549
+ test: [/(apple)?webkit/i],
13550
+ describe: function describe(e) {
13551
+ var t = {
13552
+ name: s.ENGINE_MAP.WebKit
13553
+ },
13554
+ r = i.default.getFirstMatch(/webkit\/(\d+(\.?_?\d+)+)/i, e);
13555
+ return r && (t.version = r), t;
13556
+ }
13197
13557
  }];
13198
- }
13199
- }
13200
- if (simulcastEnabled) {
13201
- mLine.rids = this.streamIds.map((streamId, index) => new RidLine(streamId.rid, 'send', "max-fs=".concat(simulcastMaxFrameSizes[index])));
13202
- mLine.simulcast = new SimulcastLine(SimulcastLayerList.fromString('low;medium;high'), new SimulcastLayerList());
13203
- }
13204
- }
13205
- getSenderIds() {
13206
- return this.streamIds;
13207
- }
13208
- getEncodingIndexForStreamId(streamId) {
13209
- return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
13210
- }
13211
- }
13212
- function generateSsrc() {
13213
- return Math.floor(Math.random() * 0xffffffff);
13214
- }
13215
- class SsrcIngressStreamSignaler {
13216
- constructor() {
13217
- this.ssrc = generateSsrc();
13218
- }
13219
- getReceiverId() {
13220
- return Object.assign({
13221
- ssrc: this.ssrc
13222
- }, this.rtxSsrc ? {
13223
- rtxSsrc: this.rtxSsrc
13224
- } : {});
13225
- }
13226
- signalLocalStreams(_mLine) {}
13227
- signalRemoteStreams(mLine) {
13228
- mLine.addLine(new SsrcLine(this.ssrc, 'cname', "".concat(this.ssrc, "-cname")));
13229
- mLine.addLine(new SsrcLine(this.ssrc, 'msid', '-', '1'));
13230
- if (hasCodec('rtx', mLine)) {
13231
- this.rtxSsrc = generateSsrc();
13232
- mLine.addLine(new SsrcLine(this.rtxSsrc, 'cname', "".concat(this.ssrc, "-cname")));
13233
- mLine.addLine(new SsrcLine(this.rtxSsrc, 'msid', '-', '1'));
13234
- mLine.addLine(new SsrcGroupLine('FID', [this.ssrc, this.rtxSsrc]));
13235
- }
13236
- }
13237
- }
13238
- class SsrcEgressStreamSignaler {
13239
- constructor() {
13240
- this.streamIds = [];
13241
- }
13242
- signalStreams(simulcastEnabled, rtxEnabled, mLine) {
13243
- mLine.rids = [];
13244
- mLine.simulcast = undefined;
13245
- mLine.ssrcs = [];
13246
- mLine.ssrcGroups = [];
13247
- if (this.streamIds.length === 0) {
13248
- var numStreams = simulcastEnabled ? 3 : 1;
13249
- [...Array(numStreams).keys()].forEach(() => {
13250
- var newStreamId = {
13251
- ssrc: generateSsrc()
13252
- };
13253
- if (rtxEnabled) {
13254
- newStreamId.rtxSsrc = generateSsrc();
13255
- }
13256
- this.streamIds.push(newStreamId);
13257
- });
13258
- }
13259
- this.streamIds.forEach((streamId, index) => {
13260
- var rtpSsrc = streamId.ssrc;
13261
- mLine.addLine(new SsrcLine(rtpSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
13262
- mLine.addLine(new SsrcLine(rtpSsrc, 'msid', '-', '1'));
13263
- if (simulcastEnabled) {
13264
- mLine.addLine(new SsrcLine(rtpSsrc, 'fmtp', "* max-fs=".concat(simulcastMaxFrameSizes[index])));
13265
- }
13266
- if (rtxEnabled) {
13267
- var rtxSsrc = streamId.rtxSsrc;
13268
- mLine.addLine(new SsrcLine(rtxSsrc, 'cname', "".concat(rtpSsrc, "-cname")));
13269
- mLine.addLine(new SsrcLine(rtxSsrc, 'msid', '-', '1'));
13270
- mLine.addLine(new SsrcGroupLine('FID', [rtpSsrc, rtxSsrc]));
13558
+ t.default = a, e.exports = t.default;
13271
13559
  }
13272
13560
  });
13273
- if (simulcastEnabled) {
13274
- mLine.addLine(new SsrcGroupLine('SIM', this.streamIds.map(streamId => streamId.ssrc)));
13275
- }
13276
- }
13277
- getSenderIds() {
13278
- return this.streamIds;
13279
- }
13280
- getEncodingIndexForStreamId(streamId) {
13281
- return this.streamIds.findIndex(currStreamId => compareStreamIds(currStreamId, streamId));
13282
- }
13283
- }
13284
- class StreamSignalerManager {
13285
- constructor(streamSignalingMode) {
13286
- this.egressStreamSignalersByMid = new Map();
13287
- this.ingressStreamsSignalersByMid = new Map();
13288
- this.ingressStreamSignalingMode = streamSignalingMode;
13289
- this.egressStreamSignalingMode = streamSignalingMode;
13290
- }
13291
- getOrCreateEgressStreamSignaler(mid) {
13292
- var existing = this.getEgressStreamSignaler(mid);
13293
- if (existing) {
13294
- return existing;
13295
- }
13296
- var newSignaler;
13297
- if (this.egressStreamSignalingMode === 'MID-RID') {
13298
- newSignaler = new RidEgressStreamSignaler(mid);
13299
- } else {
13300
- newSignaler = new SsrcEgressStreamSignaler();
13301
- }
13302
- this.egressStreamSignalersByMid.set(mid, newSignaler);
13303
- return newSignaler;
13304
- }
13305
- getEgressStreamSignalerOrThrow(mid) {
13306
- var existing = this.getEgressStreamSignaler(mid);
13307
- if (!existing) {
13308
- throw new Error("Couldn't find EgressStreamSignaler for mid ".concat(mid));
13309
- }
13310
- return existing;
13311
- }
13312
- getEgressStreamSignaler(mid) {
13313
- return this.egressStreamSignalersByMid.get(mid);
13314
- }
13315
- getOrCreateIngressStreamSignaler(mid) {
13316
- var existing = this.getIngressStreamSignaler(mid);
13317
- if (existing) {
13318
- return existing;
13319
- }
13320
- var newSignaler;
13321
- if (this.ingressStreamSignalingMode === 'MID-RID') {
13322
- newSignaler = new RidIngressStreamSignaler(mid);
13323
- } else {
13324
- newSignaler = new SsrcIngressStreamSignaler();
13325
- }
13326
- this.ingressStreamsSignalersByMid.set(mid, newSignaler);
13327
- return newSignaler;
13328
- }
13329
- getIngressStreamSignaler(mid) {
13330
- return this.ingressStreamsSignalersByMid.get(mid);
13331
- }
13332
- getIngressStreamSignalerOrThrow(mid) {
13333
- var existing = this.getIngressStreamSignaler(mid);
13334
- if (!existing) {
13335
- throw new Error("Couldn't find IngressStreamSignaler for mid ".concat(mid));
13336
- }
13337
- return existing;
13338
- }
13561
+ });
13562
+ })(es5);
13563
+ var Bowser = /*@__PURE__*/getDefaultExportFromCjs(es5.exports);
13564
+ function getBrowserDetails() {
13565
+ var browser = Bowser.getParser(window.navigator.userAgent);
13566
+ return browser.getBrowser();
13339
13567
  }
13340
13568
  var logger$1 = {
13341
13569
  exports: {}
@@ -13628,8 +13856,9 @@ var MultistreamConnectionEventNames;
13628
13856
  var defaultMultistreamConnectionOptions = {
13629
13857
  floorControlledPresentation: false,
13630
13858
  disableSimulcast: false,
13631
- streamSignalingMode: 'MID-RID',
13632
- bundlePolicy: 'compat'
13859
+ streamSignalingMode: 'SSRC',
13860
+ bundlePolicy: 'compat',
13861
+ iceServers: undefined
13633
13862
  };
13634
13863
  class MultistreamConnection extends EventEmitter {
13635
13864
  constructor() {
@@ -13640,43 +13869,51 @@ class MultistreamConnection extends EventEmitter {
13640
13869
  this.jmpSessions = new Map();
13641
13870
  this.pendingJmpTasks = [];
13642
13871
  this.metricsCallback = () => {};
13872
+ this.overuseUpdateCallback = () => {};
13643
13873
  this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
13644
13874
  logger$4.info("Creating multistream connection with options ".concat(JSON.stringify(this.options)));
13645
- this.pc = new PeerConnection();
13646
- this.pc.on(PeerConnection.Events.ConnectionStateChange, state => this.emit(MultistreamConnectionEventNames.ConnectionStateUpdate, state));
13875
+ this.initializePeerConnection();
13647
13876
  this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
13648
- this.attachMetricsObserver();
13877
+ this.overuseStateManager = new OveruseStateManager(overuseState => this.overuseUpdateCallback(overuseState));
13878
+ this.overuseStateManager.start();
13879
+ this.statsManager = new StatsManager(() => this.pc.getStats(), stats => this.preProcessStats(stats));
13649
13880
  var mainSceneId = generateSceneId();
13650
- var videoMainEncodingOptions = !this.options.disableSimulcast ? [{
13651
- scaleResolutionDownBy: 4,
13652
- active: true
13653
- }, {
13654
- scaleResolutionDownBy: 2,
13655
- active: true
13656
- }, {
13657
- active: true
13658
- }] : [];
13881
+ var videoMainEncodingOptions = this.getVideoEncodingOptions();
13659
13882
  this.createSendTransceiver(MediaType$1.VideoMain, mainSceneId, videoMainEncodingOptions);
13660
13883
  this.createSendTransceiver(MediaType$1.AudioMain, mainSceneId);
13661
13884
  if (this.options.floorControlledPresentation) {
13662
- var videoPresentationEncodingOptions = !this.options.disableSimulcast ? [{
13663
- scaleResolutionDownBy: 4,
13664
- active: true
13665
- }, {
13666
- scaleResolutionDownBy: 2,
13667
- active: true
13668
- }, {
13669
- active: true
13670
- }] : [];
13885
+ var videoPresentationEncodingOptions = this.getVideoEncodingOptions();
13671
13886
  var contentSceneId = generateSceneId();
13672
13887
  this.createSendTransceiver(MediaType$1.VideoSlides, contentSceneId, videoPresentationEncodingOptions);
13673
13888
  this.createSendTransceiver(MediaType$1.AudioSlides, contentSceneId);
13674
13889
  }
13890
+ }
13891
+ initializePeerConnection() {
13892
+ var _a;
13893
+ (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
13894
+ this.pc = new PeerConnection({
13895
+ iceServers: this.options.iceServers
13896
+ });
13897
+ this.pc.on(PeerConnection.Events.ConnectionStateChange, state => this.emit(MultistreamConnectionEventNames.ConnectionStateUpdate, state));
13898
+ this.attachMetricsObserver();
13675
13899
  this.createDataChannel();
13676
13900
  }
13677
13901
  getConnectionState() {
13678
13902
  return this.pc.getConnectionState();
13679
13903
  }
13904
+ getVideoEncodingOptions() {
13905
+ return !this.options.disableSimulcast ? [{
13906
+ scaleResolutionDownBy: 4,
13907
+ active: false
13908
+ }, {
13909
+ scaleResolutionDownBy: 2,
13910
+ active: false
13911
+ }, {
13912
+ active: false
13913
+ }] : [{
13914
+ active: false
13915
+ }];
13916
+ }
13680
13917
  createSendTransceiver(mediaType, sceneId, sendEncodingsOptions) {
13681
13918
  var rtcTransceiver = this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
13682
13919
  direction: 'sendrecv',
@@ -13684,6 +13921,9 @@ class MultistreamConnection extends EventEmitter {
13684
13921
  });
13685
13922
  var csi = generateCsi(getMediaFamily(mediaType), sceneId);
13686
13923
  this.sendTransceivers.set(mediaType, new SendOnlyTransceiver(rtcTransceiver, csi));
13924
+ this.createJmpSession(mediaType);
13925
+ }
13926
+ createJmpSession(mediaType) {
13687
13927
  var jmpSession = new JmpSession(getMediaFamily(mediaType), getMediaContent(mediaType));
13688
13928
  jmpSession.setTxCallback(msg => {
13689
13929
  var _a;
@@ -13802,14 +14042,16 @@ class MultistreamConnection extends EventEmitter {
13802
14042
  maxPayloadBitsPerSecond
13803
14043
  });
13804
14044
  } else {
13805
- logger$4.warn("Unable to get encoding index for stream ID: ".concat(JSON.stringify(id)));
14045
+ logger$4.warn("".concat(mediaType, ": Unable to get encoding index for stream ID: ").concat(JSON.stringify(id)));
13806
14046
  }
13807
14047
  } else {
13808
- logger$4.warn("Unable to find matching stream ID for requested ID: ".concat(JSON.stringify(id)));
14048
+ logger$4.warn("".concat(mediaType, ": Unable to find matching stream ID for requested ID: ").concat(JSON.stringify(id)));
13809
14049
  }
13810
14050
  });
13811
14051
  sendTransceiver.setTrackRequested(requestedIdEncodingParamsMap.size > 0);
13812
- sendTransceiver.updateSimulcastStreamStates(requestedIdEncodingParamsMap);
14052
+ if (getMediaFamily(mediaType) === MediaFamily$1.Video) {
14053
+ sendTransceiver.updateSimulcastStreamStates(requestedIdEncodingParamsMap);
14054
+ }
13813
14055
  }
13814
14056
  createDataChannel() {
13815
14057
  var dataChannel = this.pc.createDataChannel('datachannel', {});
@@ -14051,8 +14293,8 @@ class MultistreamConnection extends EventEmitter {
14051
14293
  egressSignaler.signalStreams(simulcastEnabled, rtxEnabled, av);
14052
14294
  if (av.type === 'video') {
14053
14295
  [...av.codecs.values()].filter(ci => ci.name === 'H264').forEach(ci => {
14054
- ci.fmtParams.push("max-mbps=".concat(defaultGlobalMaxVideoMbps));
14055
- ci.fmtParams.push("max-fs=".concat(defaultGlobalMaxVideoFrameSize));
14296
+ ci.fmtParams.set('max-mbps', "".concat(defaultMaxVideoEncodeMbps));
14297
+ ci.fmtParams.set('max-fs', "".concat(defaultMaxVideoEncodeFrameSize));
14056
14298
  });
14057
14299
  }
14058
14300
  });
@@ -14074,6 +14316,14 @@ class MultistreamConnection extends EventEmitter {
14074
14316
  });
14075
14317
  injectJmpAttributes(parsed, csiMap, this.options.streamSignalingMode);
14076
14318
  filterRecvOnlyMlines(parsed);
14319
+ parsed.avMedia.filter(av => av.direction === 'sendrecv' && av.type === 'video').forEach(av => {
14320
+ var ssrcGroup = av.ssrcGroups.find(sg => sg.semantics === 'SIM');
14321
+ if (ssrcGroup) {
14322
+ ssrcGroup.ssrcs.forEach((ssrc, index) => {
14323
+ av.addLine(new SsrcLine(ssrc, 'fmtp', "* max-fs=".concat(simulcastMaxFrameSizes[index])));
14324
+ });
14325
+ }
14326
+ });
14077
14327
  return parsed.toString();
14078
14328
  }
14079
14329
  preProcessRemoteAnswer(answer) {
@@ -14116,13 +14366,24 @@ class MultistreamConnection extends EventEmitter {
14116
14366
  this.pendingJmpTasks.push(task);
14117
14367
  }
14118
14368
  }
14119
- renewPeerConnection() {
14120
- var _a;
14121
- (_a = this.pc) === null || _a === void 0 ? void 0 : _a.close();
14122
- this.pc = new PeerConnection();
14123
- this.attachMetricsObserver();
14124
- this.createDataChannel();
14125
- this.sendTransceivers.forEach((transceiver, mediaType) => transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType))));
14369
+ renewPeerConnection(userOptions) {
14370
+ if (userOptions) {
14371
+ this.options = Object.assign(Object.assign({}, defaultMultistreamConnectionOptions), userOptions);
14372
+ }
14373
+ logger$4.info("Renewing multistream connection with options ".concat(JSON.stringify(this.options)));
14374
+ this.initializePeerConnection();
14375
+ this.streamSignalerManager = new StreamSignalerManager(this.options.streamSignalingMode);
14376
+ var mainSceneId = generateSceneId();
14377
+ this.sendTransceivers.forEach((transceiver, mediaType) => {
14378
+ var _a;
14379
+ transceiver.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
14380
+ direction: 'sendrecv',
14381
+ sendEncodings: getMediaFamily(mediaType) === MediaFamily$1.Video ? this.getVideoEncodingOptions() : undefined
14382
+ }));
14383
+ transceiver.csi = generateCsi(getMediaFamily(mediaType), mainSceneId);
14384
+ (_a = this.jmpSessions.get(mediaType)) === null || _a === void 0 ? void 0 : _a.close();
14385
+ this.createJmpSession(mediaType);
14386
+ });
14126
14387
  this.recvTransceivers.forEach((transceivers, mediaType) => {
14127
14388
  transceivers.forEach(t => {
14128
14389
  t.replaceTransceiver(this.pc.addTransceiver(toMediaStreamTrackKind(mediaType), {
@@ -14137,17 +14398,25 @@ class MultistreamConnection extends EventEmitter {
14137
14398
  return Object.keys(receiveSlotId).length === Object.keys(id).length && Object.keys(receiveSlotId).every(key => Object.prototype.hasOwnProperty.call(id, key) && receiveSlotId[key] === id[key]);
14138
14399
  });
14139
14400
  }
14401
+ getStats() {
14402
+ return this.statsManager.getStats();
14403
+ }
14140
14404
  preProcessStats(stats) {
14141
14405
  return __awaiter(this, void 0, void 0, function* () {
14142
14406
  yield Promise.all([...this.sendTransceivers.entries()].map(_ref5 => {
14143
14407
  var [mediaType, transceiver] = _ref5;
14144
14408
  return __awaiter(this, void 0, void 0, function* () {
14145
- (yield transceiver.getSenderStats()).forEach(senderStats => {
14409
+ (yield transceiver.getStats()).forEach(senderStats => {
14410
+ var _a;
14146
14411
  if (senderStats.type === 'outbound-rtp') {
14147
14412
  var statsToModify = stats[senderStats.id];
14148
14413
  statsToModify.mid = transceiver.mid;
14149
14414
  statsToModify.csi = transceiver.csi;
14150
14415
  statsToModify.mediaType = mediaType;
14416
+ var trackSettings = (_a = transceiver.publishedTrack) === null || _a === void 0 ? void 0 : _a.underlyingTrack.getSettings();
14417
+ if (trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate) {
14418
+ statsToModify.targetFrameRate = trackSettings === null || trackSettings === void 0 ? void 0 : trackSettings.frameRate;
14419
+ }
14151
14420
  }
14152
14421
  });
14153
14422
  });
@@ -14156,7 +14425,7 @@ class MultistreamConnection extends EventEmitter {
14156
14425
  var [mediaType, transceivers] = _ref6;
14157
14426
  return __awaiter(this, void 0, void 0, function* () {
14158
14427
  yield Promise.all(transceivers.map(transceiver => __awaiter(this, void 0, void 0, function* () {
14159
- (yield transceiver.getReceiverStats()).forEach(receiverStats => {
14428
+ (yield transceiver.getStats()).forEach(receiverStats => {
14160
14429
  var _a;
14161
14430
  if (receiverStats.type === 'inbound-rtp') {
14162
14431
  var statsToModify = stats[receiverStats.id];
@@ -14180,6 +14449,9 @@ class MultistreamConnection extends EventEmitter {
14180
14449
  setMetricsCallback(callback) {
14181
14450
  this.metricsCallback = callback;
14182
14451
  }
14452
+ setOveruseUpdateCallback(callback) {
14453
+ this.overuseUpdateCallback = callback;
14454
+ }
14183
14455
  getCsiByMediaType(mediaType) {
14184
14456
  var _a;
14185
14457
  return (_a = this.sendTransceivers.get(mediaType)) === null || _a === void 0 ? void 0 : _a.csi;
@@ -23213,6 +23485,9 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
23213
23485
  this.log('getConnectionState()', "called, returning ".concat(connectionState));
23214
23486
  return connectionState;
23215
23487
  }
23488
+ getStats() {
23489
+ return this.multistreamConnection.getStats();
23490
+ }
23216
23491
  roapMessageReceived(roapMessage) {
23217
23492
  this.log('roapMessageReceived()', "called with messageType=".concat(roapMessage.messageType, ", seq=").concat(roapMessage.seq));
23218
23493
  if (!this.sdpNegotiationStarted && roapMessage.messageType === 'OFFER') {
@@ -23220,17 +23495,43 @@ class MultistreamRoapMediaConnection extends EventEmitter$4 {
23220
23495
  }
23221
23496
  this.roap.roapMessageReceived(roapMessage);
23222
23497
  }
23223
- publishTrack(track) {
23224
- if (track.kind === 'audio') {
23225
- return this.multistreamConnection.publishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23226
- }
23227
- return this.multistreamConnection.publishTrack(new LocalCameraTrack(new MediaStream([track])));
23498
+ publishTrack(track, mediaContent) {
23499
+ var _this = this;
23500
+ return _asyncToGenerator__default["default"](function* () {
23501
+ _this.log('publishTrack()', "called with track.kind=".concat(track.kind, ", mediaContent=").concat(mediaContent));
23502
+ if (track.kind === 'audio') {
23503
+ if (mediaContent === 'main') {
23504
+ yield _this.multistreamConnection.publishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23505
+ } else {
23506
+ yield _this.multistreamConnection.publishTrack(new LocalDisplayTrack(new MediaStream([track])));
23507
+ }
23508
+ } else if (track.kind === 'video') {
23509
+ if (mediaContent === 'main') {
23510
+ yield _this.multistreamConnection.publishTrack(new LocalCameraTrack(new MediaStream([track])));
23511
+ } else {
23512
+ yield _this.multistreamConnection.publishTrack(new LocalDisplayTrack(new MediaStream([track])));
23513
+ }
23514
+ }
23515
+ })();
23228
23516
  }
23229
- unpublishTrack(track) {
23230
- if (track.kind === 'audio') {
23231
- return this.multistreamConnection.unpublishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23232
- }
23233
- return this.multistreamConnection.unpublishTrack(new LocalCameraTrack(new MediaStream([track])));
23517
+ unpublishTrack(track, mediaContent) {
23518
+ var _this2 = this;
23519
+ return _asyncToGenerator__default["default"](function* () {
23520
+ _this2.log('unpublishTrack()', "called with track.kind=".concat(track.kind, ", mediaContent=").concat(mediaContent));
23521
+ if (track.kind === 'audio') {
23522
+ if (mediaContent === 'main') {
23523
+ yield _this2.multistreamConnection.unpublishTrack(new LocalMicrophoneTrack(new MediaStream([track])));
23524
+ } else {
23525
+ yield _this2.multistreamConnection.unpublishTrack(new LocalDisplayTrack(new MediaStream([track])));
23526
+ }
23527
+ } else if (track.kind === 'video') {
23528
+ if (mediaContent === 'main') {
23529
+ yield _this2.multistreamConnection.unpublishTrack(new LocalCameraTrack(new MediaStream([track])));
23530
+ } else {
23531
+ yield _this2.multistreamConnection.unpublishTrack(new LocalDisplayTrack(new MediaStream([track])));
23532
+ }
23533
+ }
23534
+ })();
23234
23535
  }
23235
23536
  createReceiveSlot(mediaType) {
23236
23537
  this.log('createReceiveSlot()', "called");