@dtelecom/livekit-client 1.12.10 → 1.12.12

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.
@@ -328,11 +328,27 @@ function setLogExtension(extension) {
328
328
 
329
329
  loglevelExports.getLogger('lk-e2ee');
330
330
 
331
- var long = Long;
332
-
333
- /**
334
- * wasm optimizations, to do native i64 multiplication and divide
331
+ /**
332
+ * @license
333
+ * Copyright 2009 The Closure Library Authors
334
+ * Copyright 2020 Daniel Wirtz / The long.js Authors.
335
+ *
336
+ * Licensed under the Apache License, Version 2.0 (the "License");
337
+ * you may not use this file except in compliance with the License.
338
+ * You may obtain a copy of the License at
339
+ *
340
+ * http://www.apache.org/licenses/LICENSE-2.0
341
+ *
342
+ * Unless required by applicable law or agreed to in writing, software
343
+ * distributed under the License is distributed on an "AS IS" BASIS,
344
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
345
+ * See the License for the specific language governing permissions and
346
+ * limitations under the License.
347
+ *
348
+ * SPDX-License-Identifier: Apache-2.0
335
349
  */
350
+
351
+ // WebAssembly optimizations to do native i64 multiplication and divide
336
352
  var wasm = null;
337
353
  try {
338
354
  wasm = new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 13, 2, 96, 0, 1, 127, 96, 4, 127, 127, 127, 127, 1, 127, 3, 7, 6, 0, 1, 1, 1, 1, 1, 6, 6, 1, 127, 1, 65, 0, 11, 7, 50, 6, 3, 109, 117, 108, 0, 1, 5, 100, 105, 118, 95, 115, 0, 2, 5, 100, 105, 118, 95, 117, 0, 3, 5, 114, 101, 109, 95, 115, 0, 4, 5, 114, 101, 109, 95, 117, 0, 5, 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, 10, 191, 1, 6, 4, 0, 35, 0, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11, 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, 32, 4, 167, 11])), {}).exports;
@@ -340,32 +356,32 @@ try {
340
356
  // no wasm support :(
341
357
  }
342
358
 
343
- /**
344
- * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
345
- * See the from* functions below for more convenient ways of constructing Longs.
346
- * @exports Long
347
- * @class A Long class for representing a 64 bit two's-complement integer value.
348
- * @param {number} low The low (signed) 32 bits of the long
349
- * @param {number} high The high (signed) 32 bits of the long
350
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
351
- * @constructor
359
+ /**
360
+ * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers.
361
+ * See the from* functions below for more convenient ways of constructing Longs.
362
+ * @exports Long
363
+ * @class A Long class for representing a 64 bit two's-complement integer value.
364
+ * @param {number} low The low (signed) 32 bits of the long
365
+ * @param {number} high The high (signed) 32 bits of the long
366
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
367
+ * @constructor
352
368
  */
353
369
  function Long(low, high, unsigned) {
354
- /**
355
- * The low 32 bits as a signed value.
356
- * @type {number}
370
+ /**
371
+ * The low 32 bits as a signed value.
372
+ * @type {number}
357
373
  */
358
374
  this.low = low | 0;
359
375
 
360
- /**
361
- * The high 32 bits as a signed value.
362
- * @type {number}
376
+ /**
377
+ * The high 32 bits as a signed value.
378
+ * @type {number}
363
379
  */
364
380
  this.high = high | 0;
365
381
 
366
- /**
367
- * Whether unsigned or not.
368
- * @type {boolean}
382
+ /**
383
+ * Whether unsigned or not.
384
+ * @type {boolean}
369
385
  */
370
386
  this.unsigned = !!unsigned;
371
387
  }
@@ -387,54 +403,65 @@ function Long(low, high, unsigned) {
387
403
  // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from*
388
404
  // methods on which they depend.
389
405
 
390
- /**
391
- * An indicator used to reliably determine if an object is a Long or not.
392
- * @type {boolean}
393
- * @const
394
- * @private
406
+ /**
407
+ * An indicator used to reliably determine if an object is a Long or not.
408
+ * @type {boolean}
409
+ * @const
410
+ * @private
395
411
  */
396
412
  Long.prototype.__isLong__;
397
413
  Object.defineProperty(Long.prototype, "__isLong__", {
398
414
  value: true
399
415
  });
400
416
 
401
- /**
402
- * @function
403
- * @param {*} obj Object
404
- * @returns {boolean}
405
- * @inner
417
+ /**
418
+ * @function
419
+ * @param {*} obj Object
420
+ * @returns {boolean}
421
+ * @inner
406
422
  */
407
423
  function isLong(obj) {
408
424
  return (obj && obj["__isLong__"]) === true;
409
425
  }
410
426
 
411
- /**
412
- * Tests if the specified object is a Long.
413
- * @function
414
- * @param {*} obj Object
415
- * @returns {boolean}
427
+ /**
428
+ * @function
429
+ * @param {*} value number
430
+ * @returns {number}
431
+ * @inner
432
+ */
433
+ function ctz32(value) {
434
+ var c = Math.clz32(value & -value);
435
+ return value ? 31 - c : c;
436
+ }
437
+
438
+ /**
439
+ * Tests if the specified object is a Long.
440
+ * @function
441
+ * @param {*} obj Object
442
+ * @returns {boolean}
416
443
  */
417
444
  Long.isLong = isLong;
418
445
 
419
- /**
420
- * A cache of the Long representations of small integer values.
421
- * @type {!Object}
422
- * @inner
446
+ /**
447
+ * A cache of the Long representations of small integer values.
448
+ * @type {!Object}
449
+ * @inner
423
450
  */
424
451
  var INT_CACHE = {};
425
452
 
426
- /**
427
- * A cache of the Long representations of small unsigned integer values.
428
- * @type {!Object}
429
- * @inner
453
+ /**
454
+ * A cache of the Long representations of small unsigned integer values.
455
+ * @type {!Object}
456
+ * @inner
430
457
  */
431
458
  var UINT_CACHE = {};
432
459
 
433
- /**
434
- * @param {number} value
435
- * @param {boolean=} unsigned
436
- * @returns {!Long}
437
- * @inner
460
+ /**
461
+ * @param {number} value
462
+ * @param {boolean=} unsigned
463
+ * @returns {!Long}
464
+ * @inner
438
465
  */
439
466
  function fromInt(value, unsigned) {
440
467
  var obj, cachedObj, cache;
@@ -444,7 +471,7 @@ function fromInt(value, unsigned) {
444
471
  cachedObj = UINT_CACHE[value];
445
472
  if (cachedObj) return cachedObj;
446
473
  }
447
- obj = fromBits(value, (value | 0) < 0 ? -1 : 0, true);
474
+ obj = fromBits(value, 0, true);
448
475
  if (cache) UINT_CACHE[value] = obj;
449
476
  return obj;
450
477
  } else {
@@ -459,20 +486,20 @@ function fromInt(value, unsigned) {
459
486
  }
460
487
  }
461
488
 
462
- /**
463
- * Returns a Long representing the given 32 bit integer value.
464
- * @function
465
- * @param {number} value The 32 bit integer in question
466
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
467
- * @returns {!Long} The corresponding Long value
489
+ /**
490
+ * Returns a Long representing the given 32 bit integer value.
491
+ * @function
492
+ * @param {number} value The 32 bit integer in question
493
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
494
+ * @returns {!Long} The corresponding Long value
468
495
  */
469
496
  Long.fromInt = fromInt;
470
497
 
471
- /**
472
- * @param {number} value
473
- * @param {boolean=} unsigned
474
- * @returns {!Long}
475
- * @inner
498
+ /**
499
+ * @param {number} value
500
+ * @param {boolean=} unsigned
501
+ * @returns {!Long}
502
+ * @inner
476
503
  */
477
504
  function fromNumber(value, unsigned) {
478
505
  if (isNaN(value)) return unsigned ? UZERO : ZERO;
@@ -487,62 +514,63 @@ function fromNumber(value, unsigned) {
487
514
  return fromBits(value % TWO_PWR_32_DBL | 0, value / TWO_PWR_32_DBL | 0, unsigned);
488
515
  }
489
516
 
490
- /**
491
- * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
492
- * @function
493
- * @param {number} value The number in question
494
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
495
- * @returns {!Long} The corresponding Long value
517
+ /**
518
+ * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned.
519
+ * @function
520
+ * @param {number} value The number in question
521
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
522
+ * @returns {!Long} The corresponding Long value
496
523
  */
497
524
  Long.fromNumber = fromNumber;
498
525
 
499
- /**
500
- * @param {number} lowBits
501
- * @param {number} highBits
502
- * @param {boolean=} unsigned
503
- * @returns {!Long}
504
- * @inner
526
+ /**
527
+ * @param {number} lowBits
528
+ * @param {number} highBits
529
+ * @param {boolean=} unsigned
530
+ * @returns {!Long}
531
+ * @inner
505
532
  */
506
533
  function fromBits(lowBits, highBits, unsigned) {
507
534
  return new Long(lowBits, highBits, unsigned);
508
535
  }
509
536
 
510
- /**
511
- * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
512
- * assumed to use 32 bits.
513
- * @function
514
- * @param {number} lowBits The low 32 bits
515
- * @param {number} highBits The high 32 bits
516
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
517
- * @returns {!Long} The corresponding Long value
537
+ /**
538
+ * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is
539
+ * assumed to use 32 bits.
540
+ * @function
541
+ * @param {number} lowBits The low 32 bits
542
+ * @param {number} highBits The high 32 bits
543
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
544
+ * @returns {!Long} The corresponding Long value
518
545
  */
519
546
  Long.fromBits = fromBits;
520
547
 
521
- /**
522
- * @function
523
- * @param {number} base
524
- * @param {number} exponent
525
- * @returns {number}
526
- * @inner
548
+ /**
549
+ * @function
550
+ * @param {number} base
551
+ * @param {number} exponent
552
+ * @returns {number}
553
+ * @inner
527
554
  */
528
555
  var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4)
529
556
 
530
- /**
531
- * @param {string} str
532
- * @param {(boolean|number)=} unsigned
533
- * @param {number=} radix
534
- * @returns {!Long}
535
- * @inner
557
+ /**
558
+ * @param {string} str
559
+ * @param {(boolean|number)=} unsigned
560
+ * @param {number=} radix
561
+ * @returns {!Long}
562
+ * @inner
536
563
  */
537
564
  function fromString(str, unsigned, radix) {
538
565
  if (str.length === 0) throw Error('empty string');
539
- if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return ZERO;
540
566
  if (typeof unsigned === 'number') {
541
567
  // For goog.math.long compatibility
542
- radix = unsigned, unsigned = false;
568
+ radix = unsigned;
569
+ unsigned = false;
543
570
  } else {
544
571
  unsigned = !!unsigned;
545
572
  }
573
+ if (str === "NaN" || str === "Infinity" || str === "+Infinity" || str === "-Infinity") return unsigned ? UZERO : ZERO;
546
574
  radix = radix || 10;
547
575
  if (radix < 2 || 36 < radix) throw RangeError('radix');
548
576
  var p;
@@ -569,22 +597,22 @@ function fromString(str, unsigned, radix) {
569
597
  return result;
570
598
  }
571
599
 
572
- /**
573
- * Returns a Long representation of the given string, written using the specified radix.
574
- * @function
575
- * @param {string} str The textual representation of the Long
576
- * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
577
- * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
578
- * @returns {!Long} The corresponding Long value
600
+ /**
601
+ * Returns a Long representation of the given string, written using the specified radix.
602
+ * @function
603
+ * @param {string} str The textual representation of the Long
604
+ * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed
605
+ * @param {number=} radix The radix in which the text is written (2-36), defaults to 10
606
+ * @returns {!Long} The corresponding Long value
579
607
  */
580
608
  Long.fromString = fromString;
581
609
 
582
- /**
583
- * @function
584
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
585
- * @param {boolean=} unsigned
586
- * @returns {!Long}
587
- * @inner
610
+ /**
611
+ * @function
612
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val
613
+ * @param {boolean=} unsigned
614
+ * @returns {!Long}
615
+ * @inner
588
616
  */
589
617
  function fromValue(val, unsigned) {
590
618
  if (typeof val === 'number') return fromNumber(val, unsigned);
@@ -593,185 +621,188 @@ function fromValue(val, unsigned) {
593
621
  return fromBits(val.low, val.high, typeof unsigned === 'boolean' ? unsigned : val.unsigned);
594
622
  }
595
623
 
596
- /**
597
- * Converts the specified value to a Long using the appropriate from* function for its type.
598
- * @function
599
- * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
600
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
601
- * @returns {!Long}
624
+ /**
625
+ * Converts the specified value to a Long using the appropriate from* function for its type.
626
+ * @function
627
+ * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val Value
628
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
629
+ * @returns {!Long}
602
630
  */
603
631
  Long.fromValue = fromValue;
604
632
 
605
633
  // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be
606
634
  // no runtime penalty for these.
607
635
 
608
- /**
609
- * @type {number}
610
- * @const
611
- * @inner
636
+ /**
637
+ * @type {number}
638
+ * @const
639
+ * @inner
612
640
  */
613
641
  var TWO_PWR_16_DBL = 1 << 16;
614
642
 
615
- /**
616
- * @type {number}
617
- * @const
618
- * @inner
643
+ /**
644
+ * @type {number}
645
+ * @const
646
+ * @inner
619
647
  */
620
648
  var TWO_PWR_24_DBL = 1 << 24;
621
649
 
622
- /**
623
- * @type {number}
624
- * @const
625
- * @inner
650
+ /**
651
+ * @type {number}
652
+ * @const
653
+ * @inner
626
654
  */
627
655
  var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL;
628
656
 
629
- /**
630
- * @type {number}
631
- * @const
632
- * @inner
657
+ /**
658
+ * @type {number}
659
+ * @const
660
+ * @inner
633
661
  */
634
662
  var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL;
635
663
 
636
- /**
637
- * @type {number}
638
- * @const
639
- * @inner
664
+ /**
665
+ * @type {number}
666
+ * @const
667
+ * @inner
640
668
  */
641
669
  var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2;
642
670
 
643
- /**
644
- * @type {!Long}
645
- * @const
646
- * @inner
671
+ /**
672
+ * @type {!Long}
673
+ * @const
674
+ * @inner
647
675
  */
648
676
  var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL);
649
677
 
650
- /**
651
- * @type {!Long}
652
- * @inner
678
+ /**
679
+ * @type {!Long}
680
+ * @inner
653
681
  */
654
682
  var ZERO = fromInt(0);
655
683
 
656
- /**
657
- * Signed zero.
658
- * @type {!Long}
684
+ /**
685
+ * Signed zero.
686
+ * @type {!Long}
659
687
  */
660
688
  Long.ZERO = ZERO;
661
689
 
662
- /**
663
- * @type {!Long}
664
- * @inner
690
+ /**
691
+ * @type {!Long}
692
+ * @inner
665
693
  */
666
694
  var UZERO = fromInt(0, true);
667
695
 
668
- /**
669
- * Unsigned zero.
670
- * @type {!Long}
696
+ /**
697
+ * Unsigned zero.
698
+ * @type {!Long}
671
699
  */
672
700
  Long.UZERO = UZERO;
673
701
 
674
- /**
675
- * @type {!Long}
676
- * @inner
702
+ /**
703
+ * @type {!Long}
704
+ * @inner
677
705
  */
678
706
  var ONE = fromInt(1);
679
707
 
680
- /**
681
- * Signed one.
682
- * @type {!Long}
708
+ /**
709
+ * Signed one.
710
+ * @type {!Long}
683
711
  */
684
712
  Long.ONE = ONE;
685
713
 
686
- /**
687
- * @type {!Long}
688
- * @inner
714
+ /**
715
+ * @type {!Long}
716
+ * @inner
689
717
  */
690
718
  var UONE = fromInt(1, true);
691
719
 
692
- /**
693
- * Unsigned one.
694
- * @type {!Long}
720
+ /**
721
+ * Unsigned one.
722
+ * @type {!Long}
695
723
  */
696
724
  Long.UONE = UONE;
697
725
 
698
- /**
699
- * @type {!Long}
700
- * @inner
726
+ /**
727
+ * @type {!Long}
728
+ * @inner
701
729
  */
702
730
  var NEG_ONE = fromInt(-1);
703
731
 
704
- /**
705
- * Signed negative one.
706
- * @type {!Long}
732
+ /**
733
+ * Signed negative one.
734
+ * @type {!Long}
707
735
  */
708
736
  Long.NEG_ONE = NEG_ONE;
709
737
 
710
- /**
711
- * @type {!Long}
712
- * @inner
738
+ /**
739
+ * @type {!Long}
740
+ * @inner
713
741
  */
714
742
  var MAX_VALUE = fromBits(0xFFFFFFFF | 0, 0x7FFFFFFF | 0, false);
715
743
 
716
- /**
717
- * Maximum signed value.
718
- * @type {!Long}
744
+ /**
745
+ * Maximum signed value.
746
+ * @type {!Long}
719
747
  */
720
748
  Long.MAX_VALUE = MAX_VALUE;
721
749
 
722
- /**
723
- * @type {!Long}
724
- * @inner
750
+ /**
751
+ * @type {!Long}
752
+ * @inner
725
753
  */
726
754
  var MAX_UNSIGNED_VALUE = fromBits(0xFFFFFFFF | 0, 0xFFFFFFFF | 0, true);
727
755
 
728
- /**
729
- * Maximum unsigned value.
730
- * @type {!Long}
756
+ /**
757
+ * Maximum unsigned value.
758
+ * @type {!Long}
731
759
  */
732
760
  Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE;
733
761
 
734
- /**
735
- * @type {!Long}
736
- * @inner
762
+ /**
763
+ * @type {!Long}
764
+ * @inner
737
765
  */
738
766
  var MIN_VALUE = fromBits(0, 0x80000000 | 0, false);
739
767
 
740
- /**
741
- * Minimum signed value.
742
- * @type {!Long}
768
+ /**
769
+ * Minimum signed value.
770
+ * @type {!Long}
743
771
  */
744
772
  Long.MIN_VALUE = MIN_VALUE;
745
773
 
746
- /**
747
- * @alias Long.prototype
748
- * @inner
774
+ /**
775
+ * @alias Long.prototype
776
+ * @inner
749
777
  */
750
778
  var LongPrototype = Long.prototype;
751
779
 
752
- /**
753
- * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
754
- * @returns {number}
780
+ /**
781
+ * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer.
782
+ * @this {!Long}
783
+ * @returns {number}
755
784
  */
756
785
  LongPrototype.toInt = function toInt() {
757
786
  return this.unsigned ? this.low >>> 0 : this.low;
758
787
  };
759
788
 
760
- /**
761
- * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
762
- * @returns {number}
789
+ /**
790
+ * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa).
791
+ * @this {!Long}
792
+ * @returns {number}
763
793
  */
764
794
  LongPrototype.toNumber = function toNumber() {
765
795
  if (this.unsigned) return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0);
766
796
  return this.high * TWO_PWR_32_DBL + (this.low >>> 0);
767
797
  };
768
798
 
769
- /**
770
- * Converts the Long to a string written in the specified radix.
771
- * @param {number=} radix Radix (2-36), defaults to 10
772
- * @returns {string}
773
- * @override
774
- * @throws {RangeError} If `radix` is out of range
799
+ /**
800
+ * Converts the Long to a string written in the specified radix.
801
+ * @this {!Long}
802
+ * @param {number=} radix Radix (2-36), defaults to 10
803
+ * @returns {string}
804
+ * @override
805
+ * @throws {RangeError} If `radix` is out of range
775
806
  */
776
807
  LongPrototype.toString = function toString(radix) {
777
808
  radix = radix || 10;
@@ -806,41 +837,46 @@ LongPrototype.toString = function toString(radix) {
806
837
  }
807
838
  };
808
839
 
809
- /**
810
- * Gets the high 32 bits as a signed integer.
811
- * @returns {number} Signed high bits
840
+ /**
841
+ * Gets the high 32 bits as a signed integer.
842
+ * @this {!Long}
843
+ * @returns {number} Signed high bits
812
844
  */
813
845
  LongPrototype.getHighBits = function getHighBits() {
814
846
  return this.high;
815
847
  };
816
848
 
817
- /**
818
- * Gets the high 32 bits as an unsigned integer.
819
- * @returns {number} Unsigned high bits
849
+ /**
850
+ * Gets the high 32 bits as an unsigned integer.
851
+ * @this {!Long}
852
+ * @returns {number} Unsigned high bits
820
853
  */
821
854
  LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() {
822
855
  return this.high >>> 0;
823
856
  };
824
857
 
825
- /**
826
- * Gets the low 32 bits as a signed integer.
827
- * @returns {number} Signed low bits
858
+ /**
859
+ * Gets the low 32 bits as a signed integer.
860
+ * @this {!Long}
861
+ * @returns {number} Signed low bits
828
862
  */
829
863
  LongPrototype.getLowBits = function getLowBits() {
830
864
  return this.low;
831
865
  };
832
866
 
833
- /**
834
- * Gets the low 32 bits as an unsigned integer.
835
- * @returns {number} Unsigned low bits
867
+ /**
868
+ * Gets the low 32 bits as an unsigned integer.
869
+ * @this {!Long}
870
+ * @returns {number} Unsigned low bits
836
871
  */
837
872
  LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() {
838
873
  return this.low >>> 0;
839
874
  };
840
875
 
841
- /**
842
- * Gets the number of bits needed to represent the absolute value of this Long.
843
- * @returns {number}
876
+ /**
877
+ * Gets the number of bits needed to represent the absolute value of this Long.
878
+ * @this {!Long}
879
+ * @returns {number}
844
880
  */
845
881
  LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
846
882
  if (this.isNegative())
@@ -851,56 +887,62 @@ LongPrototype.getNumBitsAbs = function getNumBitsAbs() {
851
887
  return this.high != 0 ? bit + 33 : bit + 1;
852
888
  };
853
889
 
854
- /**
855
- * Tests if this Long's value equals zero.
856
- * @returns {boolean}
890
+ /**
891
+ * Tests if this Long's value equals zero.
892
+ * @this {!Long}
893
+ * @returns {boolean}
857
894
  */
858
895
  LongPrototype.isZero = function isZero() {
859
896
  return this.high === 0 && this.low === 0;
860
897
  };
861
898
 
862
- /**
863
- * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
864
- * @returns {boolean}
899
+ /**
900
+ * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}.
901
+ * @returns {boolean}
865
902
  */
866
903
  LongPrototype.eqz = LongPrototype.isZero;
867
904
 
868
- /**
869
- * Tests if this Long's value is negative.
870
- * @returns {boolean}
905
+ /**
906
+ * Tests if this Long's value is negative.
907
+ * @this {!Long}
908
+ * @returns {boolean}
871
909
  */
872
910
  LongPrototype.isNegative = function isNegative() {
873
911
  return !this.unsigned && this.high < 0;
874
912
  };
875
913
 
876
- /**
877
- * Tests if this Long's value is positive.
878
- * @returns {boolean}
914
+ /**
915
+ * Tests if this Long's value is positive or zero.
916
+ * @this {!Long}
917
+ * @returns {boolean}
879
918
  */
880
919
  LongPrototype.isPositive = function isPositive() {
881
920
  return this.unsigned || this.high >= 0;
882
921
  };
883
922
 
884
- /**
885
- * Tests if this Long's value is odd.
886
- * @returns {boolean}
923
+ /**
924
+ * Tests if this Long's value is odd.
925
+ * @this {!Long}
926
+ * @returns {boolean}
887
927
  */
888
928
  LongPrototype.isOdd = function isOdd() {
889
929
  return (this.low & 1) === 1;
890
930
  };
891
931
 
892
- /**
893
- * Tests if this Long's value is even.
894
- * @returns {boolean}
932
+ /**
933
+ * Tests if this Long's value is even.
934
+ * @this {!Long}
935
+ * @returns {boolean}
895
936
  */
896
937
  LongPrototype.isEven = function isEven() {
897
938
  return (this.low & 1) === 0;
898
939
  };
899
940
 
900
- /**
901
- * Tests if this Long's value equals the specified's.
902
- * @param {!Long|number|string} other Other value
903
- * @returns {boolean}
941
+ /**
942
+ * Tests if this Long's value equals the specified's.
943
+ * @this {!Long}
944
+ * @param {!Long|number|string} other Other value
945
+ * @returns {boolean}
904
946
  */
905
947
  LongPrototype.equals = function equals(other) {
906
948
  if (!isLong(other)) other = fromValue(other);
@@ -908,128 +950,134 @@ LongPrototype.equals = function equals(other) {
908
950
  return this.high === other.high && this.low === other.low;
909
951
  };
910
952
 
911
- /**
912
- * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
913
- * @function
914
- * @param {!Long|number|string} other Other value
915
- * @returns {boolean}
953
+ /**
954
+ * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}.
955
+ * @function
956
+ * @param {!Long|number|string} other Other value
957
+ * @returns {boolean}
916
958
  */
917
959
  LongPrototype.eq = LongPrototype.equals;
918
960
 
919
- /**
920
- * Tests if this Long's value differs from the specified's.
921
- * @param {!Long|number|string} other Other value
922
- * @returns {boolean}
961
+ /**
962
+ * Tests if this Long's value differs from the specified's.
963
+ * @this {!Long}
964
+ * @param {!Long|number|string} other Other value
965
+ * @returns {boolean}
923
966
  */
924
967
  LongPrototype.notEquals = function notEquals(other) {
925
968
  return !this.eq( /* validates */other);
926
969
  };
927
970
 
928
- /**
929
- * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
930
- * @function
931
- * @param {!Long|number|string} other Other value
932
- * @returns {boolean}
971
+ /**
972
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
973
+ * @function
974
+ * @param {!Long|number|string} other Other value
975
+ * @returns {boolean}
933
976
  */
934
977
  LongPrototype.neq = LongPrototype.notEquals;
935
978
 
936
- /**
937
- * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
938
- * @function
939
- * @param {!Long|number|string} other Other value
940
- * @returns {boolean}
979
+ /**
980
+ * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}.
981
+ * @function
982
+ * @param {!Long|number|string} other Other value
983
+ * @returns {boolean}
941
984
  */
942
985
  LongPrototype.ne = LongPrototype.notEquals;
943
986
 
944
- /**
945
- * Tests if this Long's value is less than the specified's.
946
- * @param {!Long|number|string} other Other value
947
- * @returns {boolean}
987
+ /**
988
+ * Tests if this Long's value is less than the specified's.
989
+ * @this {!Long}
990
+ * @param {!Long|number|string} other Other value
991
+ * @returns {boolean}
948
992
  */
949
993
  LongPrototype.lessThan = function lessThan(other) {
950
994
  return this.comp( /* validates */other) < 0;
951
995
  };
952
996
 
953
- /**
954
- * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
955
- * @function
956
- * @param {!Long|number|string} other Other value
957
- * @returns {boolean}
997
+ /**
998
+ * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}.
999
+ * @function
1000
+ * @param {!Long|number|string} other Other value
1001
+ * @returns {boolean}
958
1002
  */
959
1003
  LongPrototype.lt = LongPrototype.lessThan;
960
1004
 
961
- /**
962
- * Tests if this Long's value is less than or equal the specified's.
963
- * @param {!Long|number|string} other Other value
964
- * @returns {boolean}
1005
+ /**
1006
+ * Tests if this Long's value is less than or equal the specified's.
1007
+ * @this {!Long}
1008
+ * @param {!Long|number|string} other Other value
1009
+ * @returns {boolean}
965
1010
  */
966
1011
  LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) {
967
1012
  return this.comp( /* validates */other) <= 0;
968
1013
  };
969
1014
 
970
- /**
971
- * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
972
- * @function
973
- * @param {!Long|number|string} other Other value
974
- * @returns {boolean}
1015
+ /**
1016
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
1017
+ * @function
1018
+ * @param {!Long|number|string} other Other value
1019
+ * @returns {boolean}
975
1020
  */
976
1021
  LongPrototype.lte = LongPrototype.lessThanOrEqual;
977
1022
 
978
- /**
979
- * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
980
- * @function
981
- * @param {!Long|number|string} other Other value
982
- * @returns {boolean}
1023
+ /**
1024
+ * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}.
1025
+ * @function
1026
+ * @param {!Long|number|string} other Other value
1027
+ * @returns {boolean}
983
1028
  */
984
1029
  LongPrototype.le = LongPrototype.lessThanOrEqual;
985
1030
 
986
- /**
987
- * Tests if this Long's value is greater than the specified's.
988
- * @param {!Long|number|string} other Other value
989
- * @returns {boolean}
1031
+ /**
1032
+ * Tests if this Long's value is greater than the specified's.
1033
+ * @this {!Long}
1034
+ * @param {!Long|number|string} other Other value
1035
+ * @returns {boolean}
990
1036
  */
991
1037
  LongPrototype.greaterThan = function greaterThan(other) {
992
1038
  return this.comp( /* validates */other) > 0;
993
1039
  };
994
1040
 
995
- /**
996
- * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
997
- * @function
998
- * @param {!Long|number|string} other Other value
999
- * @returns {boolean}
1041
+ /**
1042
+ * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}.
1043
+ * @function
1044
+ * @param {!Long|number|string} other Other value
1045
+ * @returns {boolean}
1000
1046
  */
1001
1047
  LongPrototype.gt = LongPrototype.greaterThan;
1002
1048
 
1003
- /**
1004
- * Tests if this Long's value is greater than or equal the specified's.
1005
- * @param {!Long|number|string} other Other value
1006
- * @returns {boolean}
1049
+ /**
1050
+ * Tests if this Long's value is greater than or equal the specified's.
1051
+ * @this {!Long}
1052
+ * @param {!Long|number|string} other Other value
1053
+ * @returns {boolean}
1007
1054
  */
1008
1055
  LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) {
1009
1056
  return this.comp( /* validates */other) >= 0;
1010
1057
  };
1011
1058
 
1012
- /**
1013
- * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
1014
- * @function
1015
- * @param {!Long|number|string} other Other value
1016
- * @returns {boolean}
1059
+ /**
1060
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
1061
+ * @function
1062
+ * @param {!Long|number|string} other Other value
1063
+ * @returns {boolean}
1017
1064
  */
1018
1065
  LongPrototype.gte = LongPrototype.greaterThanOrEqual;
1019
1066
 
1020
- /**
1021
- * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
1022
- * @function
1023
- * @param {!Long|number|string} other Other value
1024
- * @returns {boolean}
1067
+ /**
1068
+ * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}.
1069
+ * @function
1070
+ * @param {!Long|number|string} other Other value
1071
+ * @returns {boolean}
1025
1072
  */
1026
1073
  LongPrototype.ge = LongPrototype.greaterThanOrEqual;
1027
1074
 
1028
- /**
1029
- * Compares this Long's value with the specified's.
1030
- * @param {!Long|number|string} other Other value
1031
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
1032
- * if the given one is greater
1075
+ /**
1076
+ * Compares this Long's value with the specified's.
1077
+ * @this {!Long}
1078
+ * @param {!Long|number|string} other Other value
1079
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
1080
+ * if the given one is greater
1033
1081
  */
1034
1082
  LongPrototype.compare = function compare(other) {
1035
1083
  if (!isLong(other)) other = fromValue(other);
@@ -1044,35 +1092,37 @@ LongPrototype.compare = function compare(other) {
1044
1092
  return other.high >>> 0 > this.high >>> 0 || other.high === this.high && other.low >>> 0 > this.low >>> 0 ? -1 : 1;
1045
1093
  };
1046
1094
 
1047
- /**
1048
- * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
1049
- * @function
1050
- * @param {!Long|number|string} other Other value
1051
- * @returns {number} 0 if they are the same, 1 if the this is greater and -1
1052
- * if the given one is greater
1095
+ /**
1096
+ * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}.
1097
+ * @function
1098
+ * @param {!Long|number|string} other Other value
1099
+ * @returns {number} 0 if they are the same, 1 if the this is greater and -1
1100
+ * if the given one is greater
1053
1101
  */
1054
1102
  LongPrototype.comp = LongPrototype.compare;
1055
1103
 
1056
- /**
1057
- * Negates this Long's value.
1058
- * @returns {!Long} Negated Long
1104
+ /**
1105
+ * Negates this Long's value.
1106
+ * @this {!Long}
1107
+ * @returns {!Long} Negated Long
1059
1108
  */
1060
1109
  LongPrototype.negate = function negate() {
1061
1110
  if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE;
1062
1111
  return this.not().add(ONE);
1063
1112
  };
1064
1113
 
1065
- /**
1066
- * Negates this Long's value. This is an alias of {@link Long#negate}.
1067
- * @function
1068
- * @returns {!Long} Negated Long
1114
+ /**
1115
+ * Negates this Long's value. This is an alias of {@link Long#negate}.
1116
+ * @function
1117
+ * @returns {!Long} Negated Long
1069
1118
  */
1070
1119
  LongPrototype.neg = LongPrototype.negate;
1071
1120
 
1072
- /**
1073
- * Returns the sum of this and the specified Long.
1074
- * @param {!Long|number|string} addend Addend
1075
- * @returns {!Long} Sum
1121
+ /**
1122
+ * Returns the sum of this and the specified Long.
1123
+ * @this {!Long}
1124
+ * @param {!Long|number|string} addend Addend
1125
+ * @returns {!Long} Sum
1076
1126
  */
1077
1127
  LongPrototype.add = function add(addend) {
1078
1128
  if (!isLong(addend)) addend = fromValue(addend);
@@ -1105,39 +1155,41 @@ LongPrototype.add = function add(addend) {
1105
1155
  return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
1106
1156
  };
1107
1157
 
1108
- /**
1109
- * Returns the difference of this and the specified Long.
1110
- * @param {!Long|number|string} subtrahend Subtrahend
1111
- * @returns {!Long} Difference
1158
+ /**
1159
+ * Returns the difference of this and the specified Long.
1160
+ * @this {!Long}
1161
+ * @param {!Long|number|string} subtrahend Subtrahend
1162
+ * @returns {!Long} Difference
1112
1163
  */
1113
1164
  LongPrototype.subtract = function subtract(subtrahend) {
1114
1165
  if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend);
1115
1166
  return this.add(subtrahend.neg());
1116
1167
  };
1117
1168
 
1118
- /**
1119
- * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
1120
- * @function
1121
- * @param {!Long|number|string} subtrahend Subtrahend
1122
- * @returns {!Long} Difference
1169
+ /**
1170
+ * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}.
1171
+ * @function
1172
+ * @param {!Long|number|string} subtrahend Subtrahend
1173
+ * @returns {!Long} Difference
1123
1174
  */
1124
1175
  LongPrototype.sub = LongPrototype.subtract;
1125
1176
 
1126
- /**
1127
- * Returns the product of this and the specified Long.
1128
- * @param {!Long|number|string} multiplier Multiplier
1129
- * @returns {!Long} Product
1177
+ /**
1178
+ * Returns the product of this and the specified Long.
1179
+ * @this {!Long}
1180
+ * @param {!Long|number|string} multiplier Multiplier
1181
+ * @returns {!Long} Product
1130
1182
  */
1131
1183
  LongPrototype.multiply = function multiply(multiplier) {
1132
- if (this.isZero()) return ZERO;
1184
+ if (this.isZero()) return this;
1133
1185
  if (!isLong(multiplier)) multiplier = fromValue(multiplier);
1134
1186
 
1135
1187
  // use wasm support if present
1136
1188
  if (wasm) {
1137
- var low = wasm.mul(this.low, this.high, multiplier.low, multiplier.high);
1138
- return fromBits(low, wasm.get_high(), this.unsigned);
1189
+ var low = wasm["mul"](this.low, this.high, multiplier.low, multiplier.high);
1190
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1139
1191
  }
1140
- if (multiplier.isZero()) return ZERO;
1192
+ if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO;
1141
1193
  if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO;
1142
1194
  if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO;
1143
1195
  if (this.isNegative()) {
@@ -1185,19 +1237,20 @@ LongPrototype.multiply = function multiply(multiplier) {
1185
1237
  return fromBits(c16 << 16 | c00, c48 << 16 | c32, this.unsigned);
1186
1238
  };
1187
1239
 
1188
- /**
1189
- * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
1190
- * @function
1191
- * @param {!Long|number|string} multiplier Multiplier
1192
- * @returns {!Long} Product
1240
+ /**
1241
+ * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}.
1242
+ * @function
1243
+ * @param {!Long|number|string} multiplier Multiplier
1244
+ * @returns {!Long} Product
1193
1245
  */
1194
1246
  LongPrototype.mul = LongPrototype.multiply;
1195
1247
 
1196
- /**
1197
- * Returns this Long divided by the specified. The result is signed if this Long is signed or
1198
- * unsigned if this Long is unsigned.
1199
- * @param {!Long|number|string} divisor Divisor
1200
- * @returns {!Long} Quotient
1248
+ /**
1249
+ * Returns this Long divided by the specified. The result is signed if this Long is signed or
1250
+ * unsigned if this Long is unsigned.
1251
+ * @this {!Long}
1252
+ * @param {!Long|number|string} divisor Divisor
1253
+ * @returns {!Long} Quotient
1201
1254
  */
1202
1255
  LongPrototype.divide = function divide(divisor) {
1203
1256
  if (!isLong(divisor)) divisor = fromValue(divisor);
@@ -1212,8 +1265,8 @@ LongPrototype.divide = function divide(divisor) {
1212
1265
  // be consistent with non-wasm code path
1213
1266
  return this;
1214
1267
  }
1215
- var low = (this.unsigned ? wasm.div_u : wasm.div_s)(this.low, this.high, divisor.low, divisor.high);
1216
- return fromBits(low, wasm.get_high(), this.unsigned);
1268
+ var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])(this.low, this.high, divisor.low, divisor.high);
1269
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1217
1270
  }
1218
1271
  if (this.isZero()) return this.unsigned ? UZERO : ZERO;
1219
1272
  var approx, rem, res;
@@ -1285,183 +1338,279 @@ LongPrototype.divide = function divide(divisor) {
1285
1338
  return res;
1286
1339
  };
1287
1340
 
1288
- /**
1289
- * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
1290
- * @function
1291
- * @param {!Long|number|string} divisor Divisor
1292
- * @returns {!Long} Quotient
1341
+ /**
1342
+ * Returns this Long divided by the specified. This is an alias of {@link Long#divide}.
1343
+ * @function
1344
+ * @param {!Long|number|string} divisor Divisor
1345
+ * @returns {!Long} Quotient
1293
1346
  */
1294
1347
  LongPrototype.div = LongPrototype.divide;
1295
1348
 
1296
- /**
1297
- * Returns this Long modulo the specified.
1298
- * @param {!Long|number|string} divisor Divisor
1299
- * @returns {!Long} Remainder
1349
+ /**
1350
+ * Returns this Long modulo the specified.
1351
+ * @this {!Long}
1352
+ * @param {!Long|number|string} divisor Divisor
1353
+ * @returns {!Long} Remainder
1300
1354
  */
1301
1355
  LongPrototype.modulo = function modulo(divisor) {
1302
1356
  if (!isLong(divisor)) divisor = fromValue(divisor);
1303
1357
 
1304
1358
  // use wasm support if present
1305
1359
  if (wasm) {
1306
- var low = (this.unsigned ? wasm.rem_u : wasm.rem_s)(this.low, this.high, divisor.low, divisor.high);
1307
- return fromBits(low, wasm.get_high(), this.unsigned);
1360
+ var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])(this.low, this.high, divisor.low, divisor.high);
1361
+ return fromBits(low, wasm["get_high"](), this.unsigned);
1308
1362
  }
1309
1363
  return this.sub(this.div(divisor).mul(divisor));
1310
1364
  };
1311
1365
 
1312
- /**
1313
- * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1314
- * @function
1315
- * @param {!Long|number|string} divisor Divisor
1316
- * @returns {!Long} Remainder
1366
+ /**
1367
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1368
+ * @function
1369
+ * @param {!Long|number|string} divisor Divisor
1370
+ * @returns {!Long} Remainder
1317
1371
  */
1318
1372
  LongPrototype.mod = LongPrototype.modulo;
1319
1373
 
1320
- /**
1321
- * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1322
- * @function
1323
- * @param {!Long|number|string} divisor Divisor
1324
- * @returns {!Long} Remainder
1374
+ /**
1375
+ * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}.
1376
+ * @function
1377
+ * @param {!Long|number|string} divisor Divisor
1378
+ * @returns {!Long} Remainder
1325
1379
  */
1326
1380
  LongPrototype.rem = LongPrototype.modulo;
1327
1381
 
1328
- /**
1329
- * Returns the bitwise NOT of this Long.
1330
- * @returns {!Long}
1382
+ /**
1383
+ * Returns the bitwise NOT of this Long.
1384
+ * @this {!Long}
1385
+ * @returns {!Long}
1331
1386
  */
1332
1387
  LongPrototype.not = function not() {
1333
1388
  return fromBits(~this.low, ~this.high, this.unsigned);
1334
1389
  };
1335
1390
 
1336
- /**
1337
- * Returns the bitwise AND of this Long and the specified.
1338
- * @param {!Long|number|string} other Other Long
1339
- * @returns {!Long}
1391
+ /**
1392
+ * Returns count leading zeros of this Long.
1393
+ * @this {!Long}
1394
+ * @returns {!number}
1395
+ */
1396
+ LongPrototype.countLeadingZeros = function countLeadingZeros() {
1397
+ return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32;
1398
+ };
1399
+
1400
+ /**
1401
+ * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}.
1402
+ * @function
1403
+ * @param {!Long}
1404
+ * @returns {!number}
1405
+ */
1406
+ LongPrototype.clz = LongPrototype.countLeadingZeros;
1407
+
1408
+ /**
1409
+ * Returns count trailing zeros of this Long.
1410
+ * @this {!Long}
1411
+ * @returns {!number}
1412
+ */
1413
+ LongPrototype.countTrailingZeros = function countTrailingZeros() {
1414
+ return this.low ? ctz32(this.low) : ctz32(this.high) + 32;
1415
+ };
1416
+
1417
+ /**
1418
+ * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}.
1419
+ * @function
1420
+ * @param {!Long}
1421
+ * @returns {!number}
1422
+ */
1423
+ LongPrototype.ctz = LongPrototype.countTrailingZeros;
1424
+
1425
+ /**
1426
+ * Returns the bitwise AND of this Long and the specified.
1427
+ * @this {!Long}
1428
+ * @param {!Long|number|string} other Other Long
1429
+ * @returns {!Long}
1340
1430
  */
1341
1431
  LongPrototype.and = function and(other) {
1342
1432
  if (!isLong(other)) other = fromValue(other);
1343
1433
  return fromBits(this.low & other.low, this.high & other.high, this.unsigned);
1344
1434
  };
1345
1435
 
1346
- /**
1347
- * Returns the bitwise OR of this Long and the specified.
1348
- * @param {!Long|number|string} other Other Long
1349
- * @returns {!Long}
1436
+ /**
1437
+ * Returns the bitwise OR of this Long and the specified.
1438
+ * @this {!Long}
1439
+ * @param {!Long|number|string} other Other Long
1440
+ * @returns {!Long}
1350
1441
  */
1351
1442
  LongPrototype.or = function or(other) {
1352
1443
  if (!isLong(other)) other = fromValue(other);
1353
1444
  return fromBits(this.low | other.low, this.high | other.high, this.unsigned);
1354
1445
  };
1355
1446
 
1356
- /**
1357
- * Returns the bitwise XOR of this Long and the given one.
1358
- * @param {!Long|number|string} other Other Long
1359
- * @returns {!Long}
1447
+ /**
1448
+ * Returns the bitwise XOR of this Long and the given one.
1449
+ * @this {!Long}
1450
+ * @param {!Long|number|string} other Other Long
1451
+ * @returns {!Long}
1360
1452
  */
1361
1453
  LongPrototype.xor = function xor(other) {
1362
1454
  if (!isLong(other)) other = fromValue(other);
1363
1455
  return fromBits(this.low ^ other.low, this.high ^ other.high, this.unsigned);
1364
1456
  };
1365
1457
 
1366
- /**
1367
- * Returns this Long with bits shifted to the left by the given amount.
1368
- * @param {number|!Long} numBits Number of bits
1369
- * @returns {!Long} Shifted Long
1458
+ /**
1459
+ * Returns this Long with bits shifted to the left by the given amount.
1460
+ * @this {!Long}
1461
+ * @param {number|!Long} numBits Number of bits
1462
+ * @returns {!Long} Shifted Long
1370
1463
  */
1371
1464
  LongPrototype.shiftLeft = function shiftLeft(numBits) {
1372
1465
  if (isLong(numBits)) numBits = numBits.toInt();
1373
1466
  if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low << numBits, this.high << numBits | this.low >>> 32 - numBits, this.unsigned);else return fromBits(0, this.low << numBits - 32, this.unsigned);
1374
1467
  };
1375
1468
 
1376
- /**
1377
- * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
1378
- * @function
1379
- * @param {number|!Long} numBits Number of bits
1380
- * @returns {!Long} Shifted Long
1469
+ /**
1470
+ * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}.
1471
+ * @function
1472
+ * @param {number|!Long} numBits Number of bits
1473
+ * @returns {!Long} Shifted Long
1381
1474
  */
1382
1475
  LongPrototype.shl = LongPrototype.shiftLeft;
1383
1476
 
1384
- /**
1385
- * Returns this Long with bits arithmetically shifted to the right by the given amount.
1386
- * @param {number|!Long} numBits Number of bits
1387
- * @returns {!Long} Shifted Long
1477
+ /**
1478
+ * Returns this Long with bits arithmetically shifted to the right by the given amount.
1479
+ * @this {!Long}
1480
+ * @param {number|!Long} numBits Number of bits
1481
+ * @returns {!Long} Shifted Long
1388
1482
  */
1389
1483
  LongPrototype.shiftRight = function shiftRight(numBits) {
1390
1484
  if (isLong(numBits)) numBits = numBits.toInt();
1391
1485
  if ((numBits &= 63) === 0) return this;else if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >> numBits, this.unsigned);else return fromBits(this.high >> numBits - 32, this.high >= 0 ? 0 : -1, this.unsigned);
1392
1486
  };
1393
1487
 
1394
- /**
1395
- * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
1396
- * @function
1397
- * @param {number|!Long} numBits Number of bits
1398
- * @returns {!Long} Shifted Long
1488
+ /**
1489
+ * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}.
1490
+ * @function
1491
+ * @param {number|!Long} numBits Number of bits
1492
+ * @returns {!Long} Shifted Long
1399
1493
  */
1400
1494
  LongPrototype.shr = LongPrototype.shiftRight;
1401
1495
 
1402
- /**
1403
- * Returns this Long with bits logically shifted to the right by the given amount.
1404
- * @param {number|!Long} numBits Number of bits
1405
- * @returns {!Long} Shifted Long
1496
+ /**
1497
+ * Returns this Long with bits logically shifted to the right by the given amount.
1498
+ * @this {!Long}
1499
+ * @param {number|!Long} numBits Number of bits
1500
+ * @returns {!Long} Shifted Long
1406
1501
  */
1407
1502
  LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) {
1408
1503
  if (isLong(numBits)) numBits = numBits.toInt();
1409
- numBits &= 63;
1410
- if (numBits === 0) return this;else {
1411
- var high = this.high;
1412
- if (numBits < 32) {
1413
- var low = this.low;
1414
- return fromBits(low >>> numBits | high << 32 - numBits, high >>> numBits, this.unsigned);
1415
- } else if (numBits === 32) return fromBits(high, 0, this.unsigned);else return fromBits(high >>> numBits - 32, 0, this.unsigned);
1416
- }
1504
+ if ((numBits &= 63) === 0) return this;
1505
+ if (numBits < 32) return fromBits(this.low >>> numBits | this.high << 32 - numBits, this.high >>> numBits, this.unsigned);
1506
+ if (numBits === 32) return fromBits(this.high, 0, this.unsigned);
1507
+ return fromBits(this.high >>> numBits - 32, 0, this.unsigned);
1417
1508
  };
1418
1509
 
1419
- /**
1420
- * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1421
- * @function
1422
- * @param {number|!Long} numBits Number of bits
1423
- * @returns {!Long} Shifted Long
1510
+ /**
1511
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1512
+ * @function
1513
+ * @param {number|!Long} numBits Number of bits
1514
+ * @returns {!Long} Shifted Long
1424
1515
  */
1425
1516
  LongPrototype.shru = LongPrototype.shiftRightUnsigned;
1426
1517
 
1427
- /**
1428
- * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1429
- * @function
1430
- * @param {number|!Long} numBits Number of bits
1431
- * @returns {!Long} Shifted Long
1518
+ /**
1519
+ * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}.
1520
+ * @function
1521
+ * @param {number|!Long} numBits Number of bits
1522
+ * @returns {!Long} Shifted Long
1432
1523
  */
1433
1524
  LongPrototype.shr_u = LongPrototype.shiftRightUnsigned;
1434
1525
 
1435
- /**
1436
- * Converts this Long to signed.
1437
- * @returns {!Long} Signed long
1526
+ /**
1527
+ * Returns this Long with bits rotated to the left by the given amount.
1528
+ * @this {!Long}
1529
+ * @param {number|!Long} numBits Number of bits
1530
+ * @returns {!Long} Rotated Long
1531
+ */
1532
+ LongPrototype.rotateLeft = function rotateLeft(numBits) {
1533
+ var b;
1534
+ if (isLong(numBits)) numBits = numBits.toInt();
1535
+ if ((numBits &= 63) === 0) return this;
1536
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1537
+ if (numBits < 32) {
1538
+ b = 32 - numBits;
1539
+ return fromBits(this.low << numBits | this.high >>> b, this.high << numBits | this.low >>> b, this.unsigned);
1540
+ }
1541
+ numBits -= 32;
1542
+ b = 32 - numBits;
1543
+ return fromBits(this.high << numBits | this.low >>> b, this.low << numBits | this.high >>> b, this.unsigned);
1544
+ };
1545
+ /**
1546
+ * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}.
1547
+ * @function
1548
+ * @param {number|!Long} numBits Number of bits
1549
+ * @returns {!Long} Rotated Long
1550
+ */
1551
+ LongPrototype.rotl = LongPrototype.rotateLeft;
1552
+
1553
+ /**
1554
+ * Returns this Long with bits rotated to the right by the given amount.
1555
+ * @this {!Long}
1556
+ * @param {number|!Long} numBits Number of bits
1557
+ * @returns {!Long} Rotated Long
1558
+ */
1559
+ LongPrototype.rotateRight = function rotateRight(numBits) {
1560
+ var b;
1561
+ if (isLong(numBits)) numBits = numBits.toInt();
1562
+ if ((numBits &= 63) === 0) return this;
1563
+ if (numBits === 32) return fromBits(this.high, this.low, this.unsigned);
1564
+ if (numBits < 32) {
1565
+ b = 32 - numBits;
1566
+ return fromBits(this.high << b | this.low >>> numBits, this.low << b | this.high >>> numBits, this.unsigned);
1567
+ }
1568
+ numBits -= 32;
1569
+ b = 32 - numBits;
1570
+ return fromBits(this.low << b | this.high >>> numBits, this.high << b | this.low >>> numBits, this.unsigned);
1571
+ };
1572
+ /**
1573
+ * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}.
1574
+ * @function
1575
+ * @param {number|!Long} numBits Number of bits
1576
+ * @returns {!Long} Rotated Long
1577
+ */
1578
+ LongPrototype.rotr = LongPrototype.rotateRight;
1579
+
1580
+ /**
1581
+ * Converts this Long to signed.
1582
+ * @this {!Long}
1583
+ * @returns {!Long} Signed long
1438
1584
  */
1439
1585
  LongPrototype.toSigned = function toSigned() {
1440
1586
  if (!this.unsigned) return this;
1441
1587
  return fromBits(this.low, this.high, false);
1442
1588
  };
1443
1589
 
1444
- /**
1445
- * Converts this Long to unsigned.
1446
- * @returns {!Long} Unsigned long
1590
+ /**
1591
+ * Converts this Long to unsigned.
1592
+ * @this {!Long}
1593
+ * @returns {!Long} Unsigned long
1447
1594
  */
1448
1595
  LongPrototype.toUnsigned = function toUnsigned() {
1449
1596
  if (this.unsigned) return this;
1450
1597
  return fromBits(this.low, this.high, true);
1451
1598
  };
1452
1599
 
1453
- /**
1454
- * Converts this Long to its byte representation.
1455
- * @param {boolean=} le Whether little or big endian, defaults to big endian
1456
- * @returns {!Array.<number>} Byte representation
1600
+ /**
1601
+ * Converts this Long to its byte representation.
1602
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1603
+ * @this {!Long}
1604
+ * @returns {!Array.<number>} Byte representation
1457
1605
  */
1458
1606
  LongPrototype.toBytes = function toBytes(le) {
1459
1607
  return le ? this.toBytesLE() : this.toBytesBE();
1460
1608
  };
1461
1609
 
1462
- /**
1463
- * Converts this Long to its little endian byte representation.
1464
- * @returns {!Array.<number>} Little endian byte representation
1610
+ /**
1611
+ * Converts this Long to its little endian byte representation.
1612
+ * @this {!Long}
1613
+ * @returns {!Array.<number>} Little endian byte representation
1465
1614
  */
1466
1615
  LongPrototype.toBytesLE = function toBytesLE() {
1467
1616
  var hi = this.high,
@@ -1469,9 +1618,10 @@ LongPrototype.toBytesLE = function toBytesLE() {
1469
1618
  return [lo & 0xff, lo >>> 8 & 0xff, lo >>> 16 & 0xff, lo >>> 24, hi & 0xff, hi >>> 8 & 0xff, hi >>> 16 & 0xff, hi >>> 24];
1470
1619
  };
1471
1620
 
1472
- /**
1473
- * Converts this Long to its big endian byte representation.
1474
- * @returns {!Array.<number>} Big endian byte representation
1621
+ /**
1622
+ * Converts this Long to its big endian byte representation.
1623
+ * @this {!Long}
1624
+ * @returns {!Array.<number>} Big endian byte representation
1475
1625
  */
1476
1626
  LongPrototype.toBytesBE = function toBytesBE() {
1477
1627
  var hi = this.high,
@@ -1479,37 +1629,36 @@ LongPrototype.toBytesBE = function toBytesBE() {
1479
1629
  return [hi >>> 24, hi >>> 16 & 0xff, hi >>> 8 & 0xff, hi & 0xff, lo >>> 24, lo >>> 16 & 0xff, lo >>> 8 & 0xff, lo & 0xff];
1480
1630
  };
1481
1631
 
1482
- /**
1483
- * Creates a Long from its byte representation.
1484
- * @param {!Array.<number>} bytes Byte representation
1485
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1486
- * @param {boolean=} le Whether little or big endian, defaults to big endian
1487
- * @returns {Long} The corresponding Long value
1632
+ /**
1633
+ * Creates a Long from its byte representation.
1634
+ * @param {!Array.<number>} bytes Byte representation
1635
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1636
+ * @param {boolean=} le Whether little or big endian, defaults to big endian
1637
+ * @returns {Long} The corresponding Long value
1488
1638
  */
1489
1639
  Long.fromBytes = function fromBytes(bytes, unsigned, le) {
1490
1640
  return le ? Long.fromBytesLE(bytes, unsigned) : Long.fromBytesBE(bytes, unsigned);
1491
1641
  };
1492
1642
 
1493
- /**
1494
- * Creates a Long from its little endian byte representation.
1495
- * @param {!Array.<number>} bytes Little endian byte representation
1496
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1497
- * @returns {Long} The corresponding Long value
1643
+ /**
1644
+ * Creates a Long from its little endian byte representation.
1645
+ * @param {!Array.<number>} bytes Little endian byte representation
1646
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1647
+ * @returns {Long} The corresponding Long value
1498
1648
  */
1499
1649
  Long.fromBytesLE = function fromBytesLE(bytes, unsigned) {
1500
1650
  return new Long(bytes[0] | bytes[1] << 8 | bytes[2] << 16 | bytes[3] << 24, bytes[4] | bytes[5] << 8 | bytes[6] << 16 | bytes[7] << 24, unsigned);
1501
1651
  };
1502
1652
 
1503
- /**
1504
- * Creates a Long from its big endian byte representation.
1505
- * @param {!Array.<number>} bytes Big endian byte representation
1506
- * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1507
- * @returns {Long} The corresponding Long value
1653
+ /**
1654
+ * Creates a Long from its big endian byte representation.
1655
+ * @param {!Array.<number>} bytes Big endian byte representation
1656
+ * @param {boolean=} unsigned Whether unsigned or not, defaults to signed
1657
+ * @returns {Long} The corresponding Long value
1508
1658
  */
1509
1659
  Long.fromBytesBE = function fromBytesBE(bytes, unsigned) {
1510
1660
  return new Long(bytes[4] << 24 | bytes[5] << 16 | bytes[6] << 8 | bytes[7], bytes[0] << 24 | bytes[1] << 16 | bytes[2] << 8 | bytes[3], unsigned);
1511
1661
  };
1512
- var Long$1 = /*@__PURE__*/getDefaultExportFromCjs(long);
1513
1662
 
1514
1663
  var indexMinimal = {};
1515
1664
 
@@ -4009,8 +4158,8 @@ var _m0 = /*@__PURE__*/getDefaultExportFromCjs(minimal);
4009
4158
  }
4010
4159
  throw "Unable to locate global object";
4011
4160
  })();
4012
- if (_m0.util.Long !== Long$1) {
4013
- _m0.util.Long = Long$1;
4161
+ if (_m0.util.Long !== Long) {
4162
+ _m0.util.Long = Long;
4014
4163
  _m0.configure();
4015
4164
  }
4016
4165
 
@@ -6593,8 +6742,8 @@ function longToNumber$1(long) {
6593
6742
  }
6594
6743
  return long.toNumber();
6595
6744
  }
6596
- if (_m0.util.Long !== Long$1) {
6597
- _m0.util.Long = Long$1;
6745
+ if (_m0.util.Long !== Long) {
6746
+ _m0.util.Long = Long;
6598
6747
  _m0.configure();
6599
6748
  }
6600
6749
  function isSet$1(value) {
@@ -14036,8 +14185,8 @@ function longToNumber(long) {
14036
14185
  }
14037
14186
  return long.toNumber();
14038
14187
  }
14039
- if (_m0.util.Long !== Long$1) {
14040
- _m0.util.Long = Long$1;
14188
+ if (_m0.util.Long !== Long) {
14189
+ _m0.util.Long = Long;
14041
14190
  _m0.configure();
14042
14191
  }
14043
14192
  function isSet(value) {
@@ -14198,7 +14347,7 @@ function getMatch(exp, ua) {
14198
14347
  return match && match.length >= id && match[id] || '';
14199
14348
  }
14200
14349
 
14201
- var version$1 = "1.12.9";
14350
+ var version$1 = "1.12.11";
14202
14351
 
14203
14352
  const version = version$1;
14204
14353
  const protocolVersion = 9;
@@ -20601,7 +20750,7 @@ class RemoteVideoTrack extends RemoteTrack {
20601
20750
  }
20602
20751
  get isAdaptiveStream() {
20603
20752
  var _a;
20604
- return !!((_a = this.adaptiveStreamSettings) === null || _a === void 0 ? void 0 : _a.updateDimensions);
20753
+ return ((_a = this.adaptiveStreamSettings) === null || _a === void 0 ? void 0 : _a.updateDimensions) === true;
20605
20754
  }
20606
20755
  /**
20607
20756
  * Note: When using adaptiveStream, you need to use remoteVideoTrack.attach() to add the track to a HTMLVideoElement, otherwise your video tracks might never start
@@ -20673,7 +20822,8 @@ class RemoteVideoTrack extends RemoteTrack {
20673
20822
  * @internal
20674
20823
  */
20675
20824
  stopObservingElementInfo(elementInfo) {
20676
- if (!this.isAdaptiveStream) {
20825
+ var _a, _b;
20826
+ if (!this.adaptiveStreamSettings) {
20677
20827
  livekitLogger.warn('stopObservingElementInfo ignored');
20678
20828
  return;
20679
20829
  }
@@ -20682,8 +20832,12 @@ class RemoteVideoTrack extends RemoteTrack {
20682
20832
  info.stopObserving();
20683
20833
  }
20684
20834
  this.elementInfos = this.elementInfos.filter(info => info !== elementInfo);
20685
- this.updateVisibility();
20686
- this.debouncedHandleResize();
20835
+ if ((_a = this.adaptiveStreamSettings) === null || _a === void 0 ? void 0 : _a.pauseWhenNotVisible) {
20836
+ this.updateVisibility();
20837
+ }
20838
+ if ((_b = this.adaptiveStreamSettings) === null || _b === void 0 ? void 0 : _b.updateDimensions) {
20839
+ this.debouncedHandleResize();
20840
+ }
20687
20841
  }
20688
20842
  detach(element) {
20689
20843
  let detachedElements = [];
@@ -20745,9 +20899,10 @@ class RemoteVideoTrack extends RemoteTrack {
20745
20899
  get: () => super.handleAppVisibilityChanged
20746
20900
  }
20747
20901
  });
20902
+ var _a, _b;
20748
20903
  return __awaiter(this, void 0, void 0, function* () {
20749
20904
  yield _super.handleAppVisibilityChanged.call(this);
20750
- if (!this.isAdaptiveStream) return;
20905
+ if (!this.isAdaptiveStream && !((_a = this.adaptiveStreamSettings) === null || _a === void 0 ? void 0 : _a.pauseWhenNotVisible) && !((_b = this.adaptiveStreamSettings) === null || _b === void 0 ? void 0 : _b.pauseVideoInBackground)) return;
20751
20906
  this.updateVisibility();
20752
20907
  });
20753
20908
  }
@@ -21273,7 +21428,7 @@ class RemoteTrackPublication extends TrackPublication {
21273
21428
  /** @internal */
21274
21429
  this.allowed = true;
21275
21430
  this.disabled = false;
21276
- this.currentVideoQuality = VideoQuality.HIGH;
21431
+ this.currentVideoQuality = VideoQuality.LOW;
21277
21432
  this.handleEnded = track => {
21278
21433
  this.setTrack(undefined);
21279
21434
  this.emit(TrackEvent.Ended, track);
@@ -21503,8 +21658,8 @@ class RemoteTrackPublication extends TrackPublication {
21503
21658
  } else if (this.currentVideoQuality !== undefined) {
21504
21659
  settings.quality = this.currentVideoQuality;
21505
21660
  } else {
21506
- // defaults to high quality
21507
- settings.quality = VideoQuality.HIGH;
21661
+ // defaults to low quality
21662
+ settings.quality = VideoQuality.LOW;
21508
21663
  }
21509
21664
  this.emit(TrackEvent.UpdateSettings, settings);
21510
21665
  }