@signalwire/js 4.0.0-beta.0 → 4.0.0-beta.2

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/index.cjs CHANGED
@@ -12,11 +12,21 @@ var Destroyable = class {
12
12
  this._destroyed$ = new rxjs.Subject();
13
13
  }
14
14
  destroy() {
15
+ this._observableCache?.clear();
15
16
  this.subscriptions.forEach((sub) => sub.unsubscribe());
16
17
  this.subjects.forEach((subject) => subject.complete());
17
18
  this._destroyed$.next();
18
19
  this._destroyed$.complete();
19
20
  }
21
+ cachedObservable(key, factory) {
22
+ this._observableCache ??= /* @__PURE__ */ new Map();
23
+ let cached = this._observableCache.get(key);
24
+ if (!cached) {
25
+ cached = factory();
26
+ this._observableCache.set(key, cached);
27
+ }
28
+ return cached;
29
+ }
20
30
  subscribeTo(observable, observerOrNext) {
21
31
  const subscription = observable.subscribe(observerOrNext);
22
32
  this.subscriptions.push(subscription);
@@ -37,7 +47,7 @@ var Destroyable = class {
37
47
  return subject;
38
48
  }
39
49
  get $() {
40
- return (0, rxjs.merge)(...this.subjects.map((s) => s instanceof rxjs.BehaviorSubject ? s.pipe((0, rxjs.skip)(1)) : s)).pipe((0, rxjs.map)((_) => this));
50
+ return this.cachedObservable("$", () => (0, rxjs.merge)(...this.subjects.map((s) => s instanceof rxjs.BehaviorSubject ? s.pipe((0, rxjs.skip)(1)) : s)).pipe((0, rxjs.map)((_) => this)));
41
51
  }
42
52
  /**
43
53
  * Observable that emits when the instance is destroyed
@@ -613,25 +623,25 @@ var NavigatorDeviceController = class extends Destroyable {
613
623
  return {};
614
624
  }
615
625
  get errors$() {
616
- return this._errors$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
626
+ return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
617
627
  }
618
628
  get audioInputDevices$() {
619
- return this._devicesState$.pipe((0, rxjs.map)((state) => state.audioinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$));
629
+ return this.cachedObservable("audioInputDevices$", () => this._devicesState$.pipe((0, rxjs.map)((state) => state.audioinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$)));
620
630
  }
621
631
  get audioOutputDevices$() {
622
- return this._devicesState$.pipe((0, rxjs.map)((state) => state.audiooutput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$));
632
+ return this.cachedObservable("audioOutputDevices$", () => this._devicesState$.pipe((0, rxjs.map)((state) => state.audiooutput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$)));
623
633
  }
624
634
  get videoInputDevices$() {
625
- return this._devicesState$.pipe((0, rxjs.map)((state) => state.videoinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$));
635
+ return this.cachedObservable("videoInputDevices$", () => this._devicesState$.pipe((0, rxjs.map)((state) => state.videoinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$)));
626
636
  }
627
637
  get selectedAudioInputDevice$() {
628
- return this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.audioinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected audio input device changed:", info)));
638
+ return this.cachedObservable("selectedAudioInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.audioinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected audio input device changed:", info))));
629
639
  }
630
640
  get selectedAudioOutputDevice$() {
631
- return this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.audiooutput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected audio output device changed:", info)));
641
+ return this.cachedObservable("selectedAudioOutputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.audiooutput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected audio output device changed:", info))));
632
642
  }
633
643
  get selectedVideoInputDevice$() {
634
- return this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.videoinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected video input device changed:", info)));
644
+ return this.cachedObservable("selectedVideoInputDevice$", () => this._selectedDevicesState$.asObservable().pipe((0, rxjs.map)((state) => state.videoinput), (0, rxjs.distinctUntilChanged)(), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.tap)((info) => logger$18.debug("[DeviceController] Selected video input device changed:", info))));
635
645
  }
636
646
  get selectedAudioInputDevice() {
637
647
  return this._selectedDevicesState$.value.audioinput;
@@ -1375,7 +1385,7 @@ var SelfCapabilities = class extends Destroyable {
1375
1385
  }
1376
1386
  /** Observable for self member capabilities */
1377
1387
  get self$() {
1378
- return this._state$.pipe((0, rxjs.map)((state) => state.self), (0, rxjs.distinctUntilChanged)());
1388
+ return this.cachedObservable("self$", () => this._state$.pipe((0, rxjs.map)((state) => state.self), (0, rxjs.distinctUntilChanged)()));
1379
1389
  }
1380
1390
  /** Current self member capabilities */
1381
1391
  get self() {
@@ -1383,7 +1393,7 @@ var SelfCapabilities = class extends Destroyable {
1383
1393
  }
1384
1394
  /** Observable for other member capabilities */
1385
1395
  get member$() {
1386
- return this._state$.pipe((0, rxjs.map)((state) => state.member), (0, rxjs.distinctUntilChanged)());
1396
+ return this.cachedObservable("member$", () => this._state$.pipe((0, rxjs.map)((state) => state.member), (0, rxjs.distinctUntilChanged)()));
1387
1397
  }
1388
1398
  /** Current other member capabilities */
1389
1399
  get member() {
@@ -1391,7 +1401,7 @@ var SelfCapabilities = class extends Destroyable {
1391
1401
  }
1392
1402
  /** Observable for end call capability */
1393
1403
  get end$() {
1394
- return this._state$.pipe((0, rxjs.map)((state) => state.end), (0, rxjs.distinctUntilChanged)());
1404
+ return this.cachedObservable("end$", () => this._state$.pipe((0, rxjs.map)((state) => state.end), (0, rxjs.distinctUntilChanged)()));
1395
1405
  }
1396
1406
  /** Current end call capability */
1397
1407
  get end() {
@@ -1399,7 +1409,7 @@ var SelfCapabilities = class extends Destroyable {
1399
1409
  }
1400
1410
  /** Observable for set layout capability */
1401
1411
  get setLayout$() {
1402
- return this._state$.pipe((0, rxjs.map)((state) => state.setLayout), (0, rxjs.distinctUntilChanged)());
1412
+ return this.cachedObservable("setLayout$", () => this._state$.pipe((0, rxjs.map)((state) => state.setLayout), (0, rxjs.distinctUntilChanged)()));
1403
1413
  }
1404
1414
  /** Current set layout capability */
1405
1415
  get setLayout() {
@@ -1407,7 +1417,7 @@ var SelfCapabilities = class extends Destroyable {
1407
1417
  }
1408
1418
  /** Observable for send digit capability */
1409
1419
  get sendDigit$() {
1410
- return this._state$.pipe((0, rxjs.map)((state) => state.sendDigit), (0, rxjs.distinctUntilChanged)());
1420
+ return this.cachedObservable("sendDigit$", () => this._state$.pipe((0, rxjs.map)((state) => state.sendDigit), (0, rxjs.distinctUntilChanged)()));
1411
1421
  }
1412
1422
  /** Current send digit capability */
1413
1423
  get sendDigit() {
@@ -1415,7 +1425,7 @@ var SelfCapabilities = class extends Destroyable {
1415
1425
  }
1416
1426
  /** Observable for vmuted hide capability */
1417
1427
  get vmutedHide$() {
1418
- return this._state$.pipe((0, rxjs.map)((state) => state.vmutedHide), (0, rxjs.distinctUntilChanged)());
1428
+ return this.cachedObservable("vmutedHide$", () => this._state$.pipe((0, rxjs.map)((state) => state.vmutedHide), (0, rxjs.distinctUntilChanged)()));
1419
1429
  }
1420
1430
  /** Current vmuted hide capability */
1421
1431
  get vmutedHide() {
@@ -1423,7 +1433,7 @@ var SelfCapabilities = class extends Destroyable {
1423
1433
  }
1424
1434
  /** Observable for lock capability */
1425
1435
  get lock$() {
1426
- return this._state$.pipe((0, rxjs.map)((state) => state.lock), (0, rxjs.distinctUntilChanged)());
1436
+ return this.cachedObservable("lock$", () => this._state$.pipe((0, rxjs.map)((state) => state.lock), (0, rxjs.distinctUntilChanged)()));
1427
1437
  }
1428
1438
  /** Current lock capability */
1429
1439
  get lock() {
@@ -1431,7 +1441,7 @@ var SelfCapabilities = class extends Destroyable {
1431
1441
  }
1432
1442
  /** Observable for device capability */
1433
1443
  get device$() {
1434
- return this._state$.pipe((0, rxjs.map)((state) => state.device), (0, rxjs.distinctUntilChanged)());
1444
+ return this.cachedObservable("device$", () => this._state$.pipe((0, rxjs.map)((state) => state.device), (0, rxjs.distinctUntilChanged)()));
1435
1445
  }
1436
1446
  /** Current device capability */
1437
1447
  get device() {
@@ -1439,7 +1449,7 @@ var SelfCapabilities = class extends Destroyable {
1439
1449
  }
1440
1450
  /** Observable for screenshare capability */
1441
1451
  get screenshare$() {
1442
- return this._state$.pipe((0, rxjs.map)((state) => state.screenshare), (0, rxjs.distinctUntilChanged)());
1452
+ return this.cachedObservable("screenshare$", () => this._state$.pipe((0, rxjs.map)((state) => state.screenshare), (0, rxjs.distinctUntilChanged)()));
1443
1453
  }
1444
1454
  /** Current screenshare capability */
1445
1455
  get screenshare() {
@@ -1492,83 +1502,83 @@ var Participant = class extends Destroyable {
1492
1502
  }
1493
1503
  /** Observable of the participant's display name. */
1494
1504
  get name$() {
1495
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.name), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1505
+ return this.cachedObservable("name$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.name), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1496
1506
  }
1497
1507
  /** Observable of the participant type (e.g. `'member'`, `'screen'`). */
1498
1508
  get type$() {
1499
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.type), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1509
+ return this.cachedObservable("type$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.type), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1500
1510
  }
1501
1511
  /** Observable indicating whether the participant has raised their hand. */
1502
1512
  get handraised$() {
1503
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.handraised), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1513
+ return this.cachedObservable("handraised$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.handraised), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1504
1514
  }
1505
1515
  /** Observable indicating whether the participant is visible in the layout. */
1506
1516
  get visible$() {
1507
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.visible), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1517
+ return this.cachedObservable("visible$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.visible), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1508
1518
  }
1509
1519
  /** Observable indicating whether the participant's audio is muted. */
1510
1520
  get audioMuted$() {
1511
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.audio_muted), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1521
+ return this.cachedObservable("audioMuted$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.audio_muted), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1512
1522
  }
1513
1523
  /** Observable indicating whether the participant's video is muted. */
1514
1524
  get videoMuted$() {
1515
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.video_muted), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1525
+ return this.cachedObservable("videoMuted$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.video_muted), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1516
1526
  }
1517
1527
  /** Observable indicating whether the participant is deafened. */
1518
1528
  get deaf$() {
1519
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.deaf), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1529
+ return this.cachedObservable("deaf$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.deaf), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1520
1530
  }
1521
1531
  /** Observable of the participant's microphone input volume. */
1522
1532
  get inputVolume$() {
1523
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.input_volume), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1533
+ return this.cachedObservable("inputVolume$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.input_volume), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1524
1534
  }
1525
1535
  /** Observable of the participant's speaker output volume. */
1526
1536
  get outputVolume$() {
1527
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.output_volume), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1537
+ return this.cachedObservable("outputVolume$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.output_volume), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1528
1538
  }
1529
1539
  /** Observable of the microphone input sensitivity level. */
1530
1540
  get inputSensitivity$() {
1531
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.input_sensitivity), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1541
+ return this.cachedObservable("inputSensitivity$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.input_sensitivity), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1532
1542
  }
1533
1543
  /** Observable indicating whether echo cancellation is enabled. */
1534
1544
  get echoCancellation$() {
1535
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.echo_cancellation), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1545
+ return this.cachedObservable("echoCancellation$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.echo_cancellation), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1536
1546
  }
1537
1547
  /** Observable indicating whether auto-gain control is enabled. */
1538
1548
  get autoGain$() {
1539
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.auto_gain), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1549
+ return this.cachedObservable("autoGain$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.auto_gain), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1540
1550
  }
1541
1551
  /** Observable indicating whether noise suppression is enabled. */
1542
1552
  get noiseSuppression$() {
1543
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.noise_suppression), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1553
+ return this.cachedObservable("noiseSuppression$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.noise_suppression), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1544
1554
  }
1545
1555
  /** Observable indicating whether low-bitrate mode is active. */
1546
1556
  get lowbitrate$() {
1547
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.lowbitrate), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1557
+ return this.cachedObservable("lowbitrate$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.lowbitrate), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1548
1558
  }
1549
1559
  /** Observable indicating whether noise reduction is active. */
1550
1560
  get denoise$() {
1551
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.denoise), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1561
+ return this.cachedObservable("denoise$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.denoise), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1552
1562
  }
1553
1563
  /** Observable of custom metadata for this participant. */
1554
1564
  get meta$() {
1555
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.meta), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1565
+ return this.cachedObservable("meta$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.meta), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1556
1566
  }
1557
1567
  /** Observable of the participant's subscriber ID. */
1558
1568
  get subscriberId$() {
1559
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.subscriber_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1569
+ return this.cachedObservable("subscriberId$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.subscriber_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1560
1570
  }
1561
1571
  /** Observable of the participant's address ID. */
1562
1572
  get addressId$() {
1563
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.address_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1573
+ return this.cachedObservable("addressId$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.address_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1564
1574
  }
1565
1575
  /** Observable of the server node ID for this participant. */
1566
1576
  get nodeId$() {
1567
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.node_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1577
+ return this.cachedObservable("nodeId$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.node_id), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1568
1578
  }
1569
1579
  /** Observable indicating whether the participant is currently speaking. */
1570
1580
  get isTalking$() {
1571
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.talking), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1581
+ return this.cachedObservable("isTalking$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.talking), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1572
1582
  }
1573
1583
  /** Whether the participant is currently speaking. */
1574
1584
  get isTalking() {
@@ -1576,7 +1586,7 @@ var Participant = class extends Destroyable {
1576
1586
  }
1577
1587
  /** Observable of the participant's layout position. */
1578
1588
  get position$() {
1579
- return this._state$.pipe((0, rxjs_operators.map)((state) => state.position), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull());
1589
+ return this.cachedObservable("position$", () => this._state$.pipe((0, rxjs_operators.map)((state) => state.position), (0, rxjs_operators.distinctUntilChanged)(), require_operators.filterNull()));
1580
1590
  }
1581
1591
  /** Current layout position. */
1582
1592
  get position() {
@@ -1976,10 +1986,10 @@ var CallEventsManager = class extends Destroyable {
1976
1986
  this.initSubscriptions();
1977
1987
  }
1978
1988
  get participants$() {
1979
- return this._participants$.asObservable().pipe((0, rxjs.map)((participantsRecord) => Object.values(participantsRecord)));
1989
+ return this.cachedObservable("participants$", () => this._participants$.asObservable().pipe((0, rxjs.map)((participantsRecord) => Object.values(participantsRecord))));
1980
1990
  }
1981
1991
  get self$() {
1982
- return this._self$.asObservable().pipe(require_operators.filterNull());
1992
+ return this.cachedObservable("self$", () => this._self$.asObservable().pipe(require_operators.filterNull()));
1983
1993
  }
1984
1994
  get status$() {
1985
1995
  return this._status$.asObservable();
@@ -1997,40 +2007,40 @@ var CallEventsManager = class extends Destroyable {
1997
2007
  return this.callIds.has(callId);
1998
2008
  }
1999
2009
  get recording$() {
2000
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.recording), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2010
+ return this.cachedObservable("recording$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.recording), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2001
2011
  }
2002
2012
  get recordings$() {
2003
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.recordings), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2013
+ return this.cachedObservable("recordings$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.recordings), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2004
2014
  }
2005
2015
  get streaming$() {
2006
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.streaming), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2016
+ return this.cachedObservable("streaming$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.streaming), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2007
2017
  }
2008
2018
  get streams$() {
2009
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.streams), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2019
+ return this.cachedObservable("streams$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.streams), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2010
2020
  }
2011
2021
  get playbacks$() {
2012
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.playbacks), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2022
+ return this.cachedObservable("playbacks$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.playbacks), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2013
2023
  }
2014
2024
  get raiseHandPriority$() {
2015
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.prioritize_handraise), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2025
+ return this.cachedObservable("raiseHandPriority$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.prioritize_handraise), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2016
2026
  }
2017
2027
  get locked$() {
2018
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.locked), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2028
+ return this.cachedObservable("locked$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.locked), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2019
2029
  }
2020
2030
  get meta$() {
2021
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.meta), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2031
+ return this.cachedObservable("meta$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.meta), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2022
2032
  }
2023
2033
  get capabilities$() {
2024
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.capabilities), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2034
+ return this.cachedObservable("capabilities$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.capabilities), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2025
2035
  }
2026
2036
  get layout$() {
2027
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.layout_name), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2037
+ return this.cachedObservable("layout$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.layout_name), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2028
2038
  }
2029
2039
  get layouts$() {
2030
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.layouts), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2040
+ return this.cachedObservable("layouts$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.layouts), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2031
2041
  }
2032
2042
  get layoutLayers$() {
2033
- return this._sessionState$.pipe((0, rxjs.map)((state) => state.layout_layers), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull());
2043
+ return this.cachedObservable("layoutLayers$", () => this._sessionState$.pipe((0, rxjs.map)((state) => state.layout_layers), (0, rxjs.distinctUntilChanged)(), require_operators.filterNull()));
2034
2044
  }
2035
2045
  get self() {
2036
2046
  return this._self$.value;
@@ -2166,19 +2176,19 @@ var CallEventsManager = class extends Destroyable {
2166
2176
  this._participants$.next(this._participants$.value);
2167
2177
  }
2168
2178
  get callJoinedEvent$() {
2169
- return this.webRtcCallSession.callEvent$.pipe((0, rxjs.filter)(isCallJoinedPayload), (0, rxjs.tap)((event) => {
2179
+ return this.cachedObservable("callJoinedEvent$", () => this.webRtcCallSession.callEvent$.pipe((0, rxjs.filter)(isCallJoinedPayload), (0, rxjs.tap)((event) => {
2170
2180
  logger$15.debug("[CallEventsManager] Call joined event:", event);
2171
- }));
2181
+ })));
2172
2182
  }
2173
2183
  get layoutChangedEvent$() {
2174
- return this.webRtcCallSession.callEvent$.pipe(require_operators.filterAs(isLayoutChangedPayload, "layout"), (0, rxjs.tap)((event) => {
2184
+ return this.cachedObservable("layoutChangedEvent$", () => this.webRtcCallSession.callEvent$.pipe(require_operators.filterAs(isLayoutChangedPayload, "layout"), (0, rxjs.tap)((event) => {
2175
2185
  logger$15.debug("[CallEventsManager] Layout changed event:", event);
2176
- }));
2186
+ })));
2177
2187
  }
2178
2188
  get memberUpdates$() {
2179
- return (0, rxjs.merge)(this.webRtcCallSession.memberJoined$, this.webRtcCallSession.memberUpdated$, this.webRtcCallSession.memberTalking$).pipe((0, rxjs.map)((event) => event.member), (0, rxjs.tap)((event) => {
2189
+ return this.cachedObservable("memberUpdates$", () => (0, rxjs.merge)(this.webRtcCallSession.memberJoined$, this.webRtcCallSession.memberUpdated$, this.webRtcCallSession.memberTalking$).pipe((0, rxjs.map)((event) => event.member), (0, rxjs.tap)((event) => {
2180
2190
  logger$15.debug("[CallEventsManager] Member update event:", event);
2181
- }));
2191
+ })));
2182
2192
  }
2183
2193
  destroy() {
2184
2194
  Object.values(this._participants$.value).forEach((participant) => {
@@ -2906,43 +2916,43 @@ var RTCPeerConnectionController = class extends Destroyable {
2906
2916
  };
2907
2917
  }
2908
2918
  get iceGatheringState$() {
2909
- return this._iceGatheringState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2919
+ return this.cachedObservable("iceGatheringState$", () => this._iceGatheringState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2910
2920
  }
2911
2921
  get mediaTrackEnded$() {
2912
- return this.localStreamController.mediaTrackEnded$.pipe((0, rxjs.takeUntil)(this.destroyed$));
2922
+ return this.cachedObservable("mediaTrackEnded$", () => this.localStreamController.mediaTrackEnded$.pipe((0, rxjs.takeUntil)(this.destroyed$)));
2913
2923
  }
2914
2924
  get errors$() {
2915
- return this._errors$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2925
+ return this.cachedObservable("errors$", () => this._errors$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2916
2926
  }
2917
2927
  get iceCandidates$() {
2918
- return this._iceCandidates$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2928
+ return this.cachedObservable("iceCandidates$", () => this._iceCandidates$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2919
2929
  }
2920
2930
  get initialized$() {
2921
- return this._initialized$.asObservable().pipe((0, rxjs.filter)((initialized) => initialized), (0, rxjs.takeUntil)(this.destroyed$));
2931
+ return this.cachedObservable("initialized$", () => this._initialized$.asObservable().pipe((0, rxjs.filter)((initialized) => initialized), (0, rxjs.takeUntil)(this.destroyed$)));
2922
2932
  }
2923
2933
  get remoteDescription$() {
2924
- return this._remoteDescription$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2934
+ return this.cachedObservable("remoteDescription$", () => this._remoteDescription$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2925
2935
  }
2926
2936
  get localStream$() {
2927
- return this.localStreamController.localStream$.pipe((0, rxjs.takeUntil)(this.destroyed$));
2937
+ return this.cachedObservable("localStream$", () => this.localStreamController.localStream$.pipe((0, rxjs.takeUntil)(this.destroyed$)));
2928
2938
  }
2929
2939
  get remoteStream$() {
2930
- return this._remoteStream$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2940
+ return this.cachedObservable("remoteStream$", () => this._remoteStream$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2931
2941
  }
2932
2942
  get localAudioTracks$() {
2933
- return this.localStreamController.localAudioTracks$.pipe((0, rxjs.takeUntil)(this.destroyed$));
2943
+ return this.cachedObservable("localAudioTracks$", () => this.localStreamController.localAudioTracks$.pipe((0, rxjs.takeUntil)(this.destroyed$)));
2934
2944
  }
2935
2945
  get localVideoTracks$() {
2936
- return this.localStreamController.localVideoTracks$.pipe((0, rxjs.takeUntil)(this.destroyed$));
2946
+ return this.cachedObservable("localVideoTracks$", () => this.localStreamController.localVideoTracks$.pipe((0, rxjs.takeUntil)(this.destroyed$)));
2937
2947
  }
2938
2948
  get iceConnectionState$() {
2939
- return this._iceConnectionState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2949
+ return this.cachedObservable("iceConnectionState$", () => this._iceConnectionState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2940
2950
  }
2941
2951
  get connectionState$() {
2942
- return this._connectionState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2952
+ return this.cachedObservable("connectionState$", () => this._connectionState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2943
2953
  }
2944
2954
  get signalingState$() {
2945
- return this._signalingState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$));
2955
+ return this.cachedObservable("signalingState$", () => this._signalingState$.asObservable().pipe((0, rxjs.takeUntil)(this.destroyed$)));
2946
2956
  }
2947
2957
  get type() {
2948
2958
  return this._type;
@@ -3520,11 +3530,11 @@ var WebRTCVertoManager = class extends VertoManager {
3520
3530
  return rtcPeerConnection;
3521
3531
  }
3522
3532
  get signalingStatus$() {
3523
- return (0, rxjs.merge)(this._signalingStatus$.pipe(require_operators.filterNull()), this.mainPeerConnection.connectionState$.pipe((0, rxjs.filter)((connectionState) => [
3533
+ return this.cachedObservable("signalingStatus$", () => (0, rxjs.merge)(this._signalingStatus$.pipe(require_operators.filterNull()), this.mainPeerConnection.connectionState$.pipe((0, rxjs.filter)((connectionState) => [
3524
3534
  "connected",
3525
3535
  "disconnected",
3526
3536
  "failed"
3527
- ].includes(connectionState))));
3537
+ ].includes(connectionState)))));
3528
3538
  }
3529
3539
  initSubscriptions() {
3530
3540
  this.subscribeTo(this.vertoAnswer$, (event) => {
@@ -3572,19 +3582,19 @@ var WebRTCVertoManager = class extends VertoManager {
3572
3582
  return this._selfId$.value;
3573
3583
  }
3574
3584
  get vertoAnswer$() {
3575
- return this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoAnswerInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$));
3585
+ return this.cachedObservable("vertoAnswer$", () => this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoAnswerInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
3576
3586
  }
3577
3587
  get vertoMediaParams$() {
3578
- return this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoMediaParamsInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$));
3588
+ return this.cachedObservable("vertoMediaParams$", () => this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoMediaParamsInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
3579
3589
  }
3580
3590
  get vertoBye$() {
3581
- return this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoByeMessage, "params"), (0, rxjs.takeUntil)(this.destroyed$));
3591
+ return this.cachedObservable("vertoBye$", () => this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoByeMessage, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
3582
3592
  }
3583
3593
  get vertoAttach$() {
3584
- return this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoAttachMessage, "params"), (0, rxjs.takeUntil)(this.destroyed$));
3594
+ return this.cachedObservable("vertoAttach$", () => this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoAttachMessage, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
3585
3595
  }
3586
3596
  get vertoPing$() {
3587
- return this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoPingInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$));
3597
+ return this.cachedObservable("vertoPing$", () => this.webRtcCallSession.webrtcMessages$.pipe(require_operators.filterAs(isVertoPingInnerParams, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
3588
3598
  }
3589
3599
  async executeVerto(message, optionals = {}) {
3590
3600
  const webrtcVertoMessage = WebrtcVerto({
@@ -4145,7 +4155,7 @@ var WebRTCCall = class extends Destroyable {
4145
4155
  }
4146
4156
  /** Observable of the current call status (e.g. `'ringing'`, `'connected'`). */
4147
4157
  get status$() {
4148
- return (0, rxjs.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$);
4158
+ return this.cachedObservable("status$", () => (0, rxjs.merge)(this._status$.asObservable(), this.vertoManager.signalingStatus$));
4149
4159
  }
4150
4160
  /** Observable of the participants list, emits on join/leave/update. */
4151
4161
  get participants$() {
@@ -4249,7 +4259,7 @@ var WebRTCCall = class extends Destroyable {
4249
4259
  return this.vertoManager.mediaDirections;
4250
4260
  }
4251
4261
  get participantsId$() {
4252
- return this.participants$.pipe((0, rxjs.map)((participants) => participants.map((participant) => participant.id)));
4262
+ return this.cachedObservable("participantsId$", () => this.participants$.pipe((0, rxjs.map)((participants) => participants.map((participant) => participant.id))));
4253
4263
  }
4254
4264
  /** Executes a raw JSON-RPC request on the client session. */
4255
4265
  async execute(request, options) {
@@ -4284,35 +4294,35 @@ var WebRTCCall = class extends Destroyable {
4284
4294
  }
4285
4295
  }
4286
4296
  get callSessionEvents$() {
4287
- return this.clientSession.signalingEvent$.pipe((0, rxjs.filter)((event) => this.isCallSessionEvent(event)), (0, rxjs.tap)((event) => logger$9.debug("[Call] Received call session event:", event)), (0, rxjs.takeUntil)(this.destroyed$));
4297
+ return this.cachedObservable("callSessionEvents$", () => this.clientSession.signalingEvent$.pipe((0, rxjs.filter)((event) => this.isCallSessionEvent(event)), (0, rxjs.tap)((event) => logger$9.debug("[Call] Received call session event:", event)), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.share)()));
4288
4298
  }
4289
4299
  /** Observable of call-updated events. */
4290
4300
  get callUpdated$() {
4291
- return this.callSessionEvents$.pipe(require_operators.filterAs(isCallUpdatedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4301
+ return this.cachedObservable("callUpdated$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isCallUpdatedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4292
4302
  }
4293
4303
  /** Observable of member-joined events. */
4294
4304
  get memberJoined$() {
4295
- return this.callSessionEvents$.pipe(require_operators.filterAs(isMemberJoinedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4305
+ return this.cachedObservable("memberJoined$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberJoinedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4296
4306
  }
4297
4307
  /** Observable of member-left events. */
4298
4308
  get memberLeft$() {
4299
- return this.callSessionEvents$.pipe(require_operators.filterAs(isMemberLeftMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4309
+ return this.cachedObservable("memberLeft$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberLeftMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4300
4310
  }
4301
4311
  /** Observable of member-updated events (mute, volume, etc.). */
4302
4312
  get memberUpdated$() {
4303
- return this.callSessionEvents$.pipe(require_operators.filterAs(isMemberUpdatedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4313
+ return this.cachedObservable("memberUpdated$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberUpdatedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4304
4314
  }
4305
4315
  /** Observable of member-talking events (speech start/stop). */
4306
4316
  get memberTalking$() {
4307
- return this.callSessionEvents$.pipe(require_operators.filterAs(isMemberTalkingMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4317
+ return this.cachedObservable("memberTalking$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isMemberTalkingMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4308
4318
  }
4309
4319
  /** Observable of call state-change events. */
4310
4320
  get callStates$() {
4311
- return this.callSessionEvents$.pipe(require_operators.filterAs(isCallStateMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4321
+ return this.cachedObservable("callStates$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isCallStateMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4312
4322
  }
4313
4323
  /** Observable of layout-changed events. */
4314
4324
  get layoutUpdates$() {
4315
- return this.callSessionEvents$.pipe(require_operators.filterAs(isLayoutChangedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$));
4325
+ return this.cachedObservable("layoutUpdates$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isLayoutChangedMetadata, "params"), (0, rxjs.takeUntil)(this.destroyed$)));
4316
4326
  }
4317
4327
  /** Underlying `RTCPeerConnection`, for advanced use cases. */
4318
4328
  get rtcPeerConnection() {
@@ -4320,19 +4330,19 @@ var WebRTCCall = class extends Destroyable {
4320
4330
  }
4321
4331
  /** Observable of raw signaling events as plain objects. */
4322
4332
  get signalingEvent$() {
4323
- return this.callEvent$.pipe((0, rxjs.map)((event) => JSON.parse(JSON.stringify(event))));
4333
+ return this.cachedObservable("signalingEvent$", () => this.callEvent$.pipe((0, rxjs.map)((event) => JSON.parse(JSON.stringify(event)))));
4324
4334
  }
4325
4335
  /** Observable of WebRTC-specific signaling messages. */
4326
4336
  get webrtcMessages$() {
4327
- return this.callSessionEvents$.pipe(require_operators.filterAs(isWebrtcMessageMetadata, "params"), (0, rxjs.tap)((event) => logger$9.debug("[Call] Event is a WebRTC message event:", event)), (0, rxjs.takeUntil)(this.destroyed$));
4337
+ return this.cachedObservable("webrtcMessages$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isWebrtcMessageMetadata, "params"), (0, rxjs.tap)((event) => logger$9.debug("[Call] Event is a WebRTC message event:", event)), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.share)()));
4328
4338
  }
4329
4339
  /** Observable of call-level signaling events. */
4330
4340
  get callEvent$() {
4331
- return this.callSessionEvents$.pipe(require_operators.filterAs(isSignalwireCallMetadata, "params"), (0, rxjs.tap)((event) => logger$9.debug("[Call] Event is a call event:", event)), (0, rxjs.takeUntil)(this.destroyed$));
4341
+ return this.cachedObservable("callEvent$", () => this.callSessionEvents$.pipe(require_operators.filterAs(isSignalwireCallMetadata, "params"), (0, rxjs.tap)((event) => logger$9.debug("[Call] Event is a call event:", event)), (0, rxjs.takeUntil)(this.destroyed$), (0, rxjs.share)()));
4332
4342
  }
4333
4343
  /** Observable of layout-changed signaling events. */
4334
4344
  get layoutEvent$() {
4335
- return this.callEvent$.pipe(require_operators.filterAs(isLayoutChangedMetadata, "params"));
4345
+ return this.cachedObservable("layoutEvent$", () => this.callEvent$.pipe(require_operators.filterAs(isLayoutChangedMetadata, "params")));
4336
4346
  }
4337
4347
  /** Hangs up the call and releases all resources. */
4338
4348
  async hangup() {
@@ -4484,7 +4494,7 @@ var EntityCollection = class extends Destroyable {
4484
4494
  return this.fetchController.hasMore ?? true;
4485
4495
  }
4486
4496
  get updated$() {
4487
- return this.loading$.pipe((0, rxjs.distinctUntilChanged)(), (0, rxjs.skip)(1), (0, rxjs.filter)((loading) => !loading), (0, rxjs.map)(() => void 0), (0, rxjs.takeUntil)(this._destroy$));
4497
+ return this.cachedObservable("updated$", () => this.loading$.pipe((0, rxjs.distinctUntilChanged)(), (0, rxjs.skip)(1), (0, rxjs.filter)((loading) => !loading), (0, rxjs.map)(() => void 0), (0, rxjs.takeUntil)(this._destroy$)));
4488
4498
  }
4489
4499
  get values() {
4490
4500
  return Array.from(this.collectionData.values());
@@ -4564,7 +4574,7 @@ var EntityCollectionTransformed = class {
4564
4574
  return this.originalCollection.values.filter(this.filter).map(this.mapper);
4565
4575
  }
4566
4576
  get values$() {
4567
- return this.originalCollection.values$.pipe((0, rxjs.map)((values) => values.filter(this.filter).map(this.mapper)));
4577
+ return this._values$ ??= this.originalCollection.values$.pipe((0, rxjs.map)((values) => values.filter(this.filter).map(this.mapper)));
4568
4578
  }
4569
4579
  get$(id) {
4570
4580
  const original$ = this.originalCollection.get$(id);
@@ -4637,7 +4647,7 @@ var Address = class extends Destroyable {
4637
4647
  }
4638
4648
  /** Observable of the human-readable display name. */
4639
4649
  get displayName$() {
4640
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.map)((state) => state.display_name), (0, rxjs.takeUntil)(this.destroyed$));
4650
+ return this.cachedObservable("displayName$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.map)((state) => state.display_name), (0, rxjs.takeUntil)(this.destroyed$)));
4641
4651
  }
4642
4652
  /** Human-readable display name. */
4643
4653
  get displayName() {
@@ -4646,7 +4656,7 @@ var Address = class extends Destroyable {
4646
4656
  }
4647
4657
  /** Observable of the preview image URL. */
4648
4658
  get previewUrl$() {
4649
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.map)((state) => state.preview_url), (0, rxjs.takeUntil)(this.destroyed$));
4659
+ return this.cachedObservable("previewUrl$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.map)((state) => state.preview_url), (0, rxjs.takeUntil)(this.destroyed$)));
4650
4660
  }
4651
4661
  /** Preview image URL. */
4652
4662
  get previewUrl() {
@@ -4655,7 +4665,7 @@ var Address = class extends Destroyable {
4655
4665
  }
4656
4666
  /** Observable of the cover image URL. */
4657
4667
  get coverUrl$() {
4658
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.cover_url), (0, rxjs.takeUntil)(this.destroyed$));
4668
+ return this.cachedObservable("coverUrl$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.cover_url), (0, rxjs.takeUntil)(this.destroyed$)));
4659
4669
  }
4660
4670
  /** Cover image URL. */
4661
4671
  get coverUrl() {
@@ -4664,7 +4674,7 @@ var Address = class extends Destroyable {
4664
4674
  }
4665
4675
  /** Observable of the underlying resource ID. */
4666
4676
  get resourceId$() {
4667
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.resource_id), (0, rxjs.takeUntil)(this.destroyed$));
4677
+ return this.cachedObservable("resourceId$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.resource_id), (0, rxjs.takeUntil)(this.destroyed$)));
4668
4678
  }
4669
4679
  /** Underlying resource ID. */
4670
4680
  get resourceId() {
@@ -4673,7 +4683,7 @@ var Address = class extends Destroyable {
4673
4683
  }
4674
4684
  /** Observable of the resource type (e.g. `'room'`, `'subscriber'`). */
4675
4685
  get type$() {
4676
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.type), (0, rxjs.takeUntil)(this.destroyed$));
4686
+ return this.cachedObservable("type$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.type), (0, rxjs.takeUntil)(this.destroyed$)));
4677
4687
  }
4678
4688
  /** Resource type (e.g. `'room'`, `'subscriber'`). */
4679
4689
  get type() {
@@ -4682,7 +4692,7 @@ var Address = class extends Destroyable {
4682
4692
  }
4683
4693
  /** Observable of available communication channels (audio, video, messaging). */
4684
4694
  get channels$() {
4685
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.channels), (0, rxjs.takeUntil)(this.destroyed$));
4695
+ return this.cachedObservable("channels$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.channels), (0, rxjs.takeUntil)(this.destroyed$)));
4686
4696
  }
4687
4697
  /** Available communication channels. */
4688
4698
  get channels() {
@@ -4696,7 +4706,7 @@ var Address = class extends Destroyable {
4696
4706
  }
4697
4707
  /** Observable indicating whether the address (room) is locked. */
4698
4708
  get locked$() {
4699
- return this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.locked), (0, rxjs.takeUntil)(this.destroyed$));
4709
+ return this.cachedObservable("locked$", () => this._state$.pipe(require_operators.filterNull(), (0, rxjs.shareReplay)(1), (0, rxjs.map)((state) => state.locked), (0, rxjs.takeUntil)(this.destroyed$)));
4700
4710
  }
4701
4711
  /** Sends a text message to this address. */
4702
4712
  async sendText(text) {
@@ -4844,7 +4854,7 @@ var ClientSessionManager = class extends Destroyable {
4844
4854
  this.initialized$ = (0, rxjs.defer)(() => (0, rxjs.from)(this.init())).pipe((0, rxjs.shareReplay)(1), (0, rxjs.takeUntil)(this.destroyed$));
4845
4855
  }
4846
4856
  get incomingCalls$() {
4847
- return this.calls$.pipe((0, rxjs.map)((calls) => calls.filter((call) => call.direction === "inbound")));
4857
+ return this.cachedObservable("incomingCalls$", () => this.calls$.pipe((0, rxjs.map)((calls) => calls.filter((call) => call.direction === "inbound"))));
4848
4858
  }
4849
4859
  get incomingCalls() {
4850
4860
  return Object.values(this._calls$.value).filter((call) => call.direction === "inbound");
@@ -4856,7 +4866,7 @@ var ClientSessionManager = class extends Destroyable {
4856
4866
  return this._subscriberInfo$.value;
4857
4867
  }
4858
4868
  get calls$() {
4859
- return this._calls$.pipe((0, rxjs.map)((calls) => Object.values(calls)));
4869
+ return this.cachedObservable("calls$", () => this._calls$.pipe((0, rxjs.map)((calls) => Object.values(calls))));
4860
4870
  }
4861
4871
  get calls() {
4862
4872
  return Object.values(this._calls$.value);
@@ -4959,20 +4969,20 @@ var ClientSessionManager = class extends Destroyable {
4959
4969
  }
4960
4970
  }
4961
4971
  get authStateEvent$() {
4962
- return this.signalingEvent$.pipe((0, rxjs.tap)((msg) => {
4972
+ return this.cachedObservable("authStateEvent$", () => this.signalingEvent$.pipe((0, rxjs.tap)((msg) => {
4963
4973
  logger$6.debug("[Session] Received incoming message:", msg);
4964
4974
  }), require_operators.filterAs(isSignalwireAuthorizationStateMetadata, "params"), (0, rxjs.tap)((event) => {
4965
4975
  logger$6.debug("[Session] Authorization state event received:", event.authorization_state);
4966
- }));
4976
+ })));
4967
4977
  }
4968
4978
  get signalingEvent$() {
4969
- return this.transport.incomingEvent$.pipe(require_operators.filterAs(isSignalwireRequest, "params"));
4979
+ return this.cachedObservable("signalingEvent$", () => this.transport.incomingEvent$.pipe(require_operators.filterAs(isSignalwireRequest, "params"), (0, rxjs.share)()));
4970
4980
  }
4971
4981
  get vertoInvite$() {
4972
- return this.signalingEvent$.pipe((0, rxjs.filter)(isWebrtcMessageMetadata), (0, rxjs.filter)((event) => isVertoInviteMessage(event.params)), (0, rxjs.map)((event) => ({
4982
+ return this.cachedObservable("vertoInvite$", () => this.signalingEvent$.pipe((0, rxjs.filter)(isWebrtcMessageMetadata), (0, rxjs.filter)((event) => isVertoInviteMessage(event.params)), (0, rxjs.map)((event) => ({
4973
4983
  node_id: event.node_id,
4974
4984
  ...event.params.params
4975
- })));
4985
+ }))));
4976
4986
  }
4977
4987
  get contexts() {
4978
4988
  return [];
@@ -5099,12 +5109,15 @@ var ClientSessionManager = class extends Destroyable {
5099
5109
  }
5100
5110
  async createCall(options = {}) {
5101
5111
  try {
5102
- if (!this._directory) throw new require_operators.DependencyError("Directory not initialized");
5103
5112
  const addressURI = getAddressSearchURI(options);
5104
- const addressId = await this._directory.findAddressIdByURI(addressURI);
5105
- if (!addressId) throw new require_operators.DependencyError(`Address name: ${addressURI} not found`);
5106
- const address = this._directory.get(addressId);
5107
- if (!address) throw new require_operators.DependencyError(`Address ID: ${addressId} not found`);
5113
+ let address;
5114
+ if (!addressURI.startsWith("+")) {
5115
+ if (!this._directory) throw new require_operators.DependencyError("Directory not initialized");
5116
+ const addressId = await this._directory.findAddressIdByURI(addressURI);
5117
+ if (!addressId) throw new require_operators.DependencyError(`Address name: ${addressURI} not found`);
5118
+ address = this._directory.get(addressId);
5119
+ if (!address) throw new require_operators.DependencyError(`Address ID: ${addressId} not found`);
5120
+ }
5108
5121
  const callSession = this.callFactory.createCall(address, { ...options });
5109
5122
  callSession.status$.pipe((0, rxjs.filter)((status) => status === "destroyed"), (0, rxjs.take)(1)).subscribe(() => {
5110
5123
  const { [`${callSession.id}`]: _, ...remainingCalls } = this._calls$.value;
@@ -5134,6 +5147,9 @@ var ClientSessionWrapper = class {
5134
5147
  get signalingEvent$() {
5135
5148
  return this.clientSessionManager.signalingEvent$;
5136
5149
  }
5150
+ get iceServers() {
5151
+ return this.clientSessionManager.iceServers;
5152
+ }
5137
5153
  async execute(request, options) {
5138
5154
  return this.clientSessionManager.execute(request, options);
5139
5155
  }
@@ -5776,7 +5792,7 @@ var SignalWire = class extends Destroyable {
5776
5792
  async init() {
5777
5793
  this._subscriber$.next(new Subscriber(this._deps.http));
5778
5794
  if (!this._options.skipConnection) await this.connect();
5779
- if (this._options.skipReconnect && this._attachManager) await this._attachManager.flush();
5795
+ if (!this._options.reconnectAttachedCalls && this._attachManager) await this._attachManager.flush();
5780
5796
  if (!this._options.skipRegister) this.register();
5781
5797
  this.handleAttachments();
5782
5798
  }
@@ -5915,7 +5931,7 @@ var SignalWire = class extends Destroyable {
5915
5931
  }
5916
5932
  /** Observable that emits `true` when the client is both connected and authenticated. */
5917
5933
  get ready$() {
5918
- return this._isConnected$.pipe((0, rxjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, rxjs.of)(false)));
5934
+ return this.cachedObservable("ready$", () => this._isConnected$.pipe((0, rxjs.switchMap)((connected) => connected ? this._clientSession.authenticated$ : (0, rxjs.of)(false))));
5919
5935
  }
5920
5936
  /** Observable stream of errors from transport, authentication, and devices. */
5921
5937
  get errors$() {
@@ -6194,13 +6210,16 @@ exports.Address = Address;
6194
6210
  exports.CallCreateError = require_operators.CallCreateError;
6195
6211
  exports.ClientPreferences = ClientPreferences;
6196
6212
  exports.CollectionFetchError = require_operators.CollectionFetchError;
6213
+ exports.InvalidCredentialsError = require_operators.InvalidCredentialsError;
6197
6214
  exports.MediaTrackError = require_operators.MediaTrackError;
6198
6215
  exports.MessageParseError = require_operators.MessageParseError;
6199
6216
  exports.Participant = Participant;
6217
+ exports.SelfCapabilities = SelfCapabilities;
6200
6218
  exports.SelfParticipant = SelfParticipant;
6201
6219
  exports.SignalWire = SignalWire;
6202
6220
  exports.StaticCredentialProvider = StaticCredentialProvider;
6203
6221
  exports.Subscriber = Subscriber;
6222
+ exports.UnexpectedError = require_operators.UnexpectedError;
6204
6223
  exports.VertoPongError = require_operators.VertoPongError;
6205
6224
  exports.WebRTCCall = WebRTCCall;
6206
6225
  exports.embeddableCall = embeddableCall;