@whereby.com/browser-sdk 2.0.0-alpha13 → 2.0.0-alpha15

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/README.md CHANGED
@@ -89,6 +89,26 @@ function MyCallUX( { roomUrl, localStream }) {
89
89
 
90
90
  ```
91
91
 
92
+ ##### Usage with Next.js
93
+ If you are integrating these React hooks with Next.js, you need to ensure your custom video experience components are
94
+ reneded client side, as the underlying APIs we use are only available in the browser context. Simply add `"use client";`
95
+ to the top of component, like in the following example:
96
+
97
+ ```js
98
+ "use client";
99
+
100
+ import { VideoView, useLocalMedia } from "@whereby.com/browser-sdk";
101
+
102
+ export default function MyNextVideoExperience() {
103
+ const { state, actions } = useLocalMedia({ audio: false, video: true });
104
+
105
+ return (
106
+ <p>{ state.localStream && <VideoView muted stream={state.localStream} /> }</p>
107
+ );
108
+ }
109
+
110
+ ```
111
+
92
112
  ### Web component for embedding
93
113
 
94
114
  Use the `<whereby-embed />` web component to make use of Whereby's pre-built responsive UI. Refer to our [documentation](https://docs.whereby.com/embedding-rooms/in-a-web-page/using-the-whereby-embed-element) to learn which attributes are supported.
package/dist/lib.cjs CHANGED
@@ -150,7 +150,7 @@ heresy.define("WherebyEmbed", {
150
150
  if (roomUrl.searchParams.get("roomKey")) {
151
151
  this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
152
152
  }
153
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha13", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
153
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha15", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
154
154
  // add to URL if set in any way
155
155
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
156
156
  if (!this.url.searchParams.has(k) && typeof v === "string") {
@@ -8379,9 +8379,11 @@ class RoomConnection extends TypedEventTarget {
8379
8379
  super();
8380
8380
  this.localParticipant = null;
8381
8381
  this.remoteParticipants = [];
8382
+ this._deviceCredentials = null;
8382
8383
  this._ownsLocalMedia = false;
8383
8384
  this.organizationId = "";
8384
8385
  this.roomConnectionStatus = "";
8386
+ this.selfId = null;
8385
8387
  this.roomUrl = new URL(roomUrl); // Throw if invalid Whereby room url
8386
8388
  const searchParams = new URLSearchParams(this.roomUrl.search);
8387
8389
  this._roomKey = roomKey || searchParams.get("roomKey");
@@ -8437,6 +8439,12 @@ class RoomConnection extends TypedEventTarget {
8437
8439
  this.signalSocket.on("knocker_left", this._handleKnockerLeft.bind(this));
8438
8440
  this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
8439
8441
  this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
8442
+ this.signalSocket.on("cloud_recording_stopped", this._handleCloudRecordingStopped.bind(this));
8443
+ this.signalSocket.on("streaming_stopped", this._handleStreamingStopped.bind(this));
8444
+ this.signalSocket.on("disconnect", this._handleDisconnect.bind(this));
8445
+ this.signalSocket.on("connect_error", this._handleDisconnect.bind(this));
8446
+ this.signalSocketManager = this.signalSocket.getManager();
8447
+ this.signalSocketManager.on("reconnect", this._handleReconnect.bind(this));
8440
8448
  // Set up local media listeners
8441
8449
  this.localMedia.addEventListener("camera_enabled", (e) => {
8442
8450
  const { enabled } = e.detail;
@@ -8478,7 +8486,35 @@ class RoomConnection extends TypedEventTarget {
8478
8486
  _handleNewChatMessage(message) {
8479
8487
  this.dispatchEvent(new CustomEvent("chat_message", { detail: message }));
8480
8488
  }
8489
+ _handleCloudRecordingStarted({ client }) {
8490
+ this.dispatchEvent(new CustomEvent("cloud_recording_started", {
8491
+ detail: {
8492
+ status: "recording",
8493
+ startedAt: client.startedCloudRecordingAt
8494
+ ? new Date(client.startedCloudRecordingAt).getTime()
8495
+ : new Date().getTime(),
8496
+ },
8497
+ }));
8498
+ }
8499
+ _handleStreamingStarted() {
8500
+ this.dispatchEvent(new CustomEvent("streaming_started", {
8501
+ detail: {
8502
+ status: "streaming",
8503
+ // We don't have the streaming start time stored on the
8504
+ // server, so we use the current time instead. This gives
8505
+ // an invalid timestamp for "Client B" if "Client A" has
8506
+ // been streaming for a while before "Client B" joins.
8507
+ startedAt: new Date().getTime(),
8508
+ },
8509
+ }));
8510
+ }
8481
8511
  _handleNewClient({ client }) {
8512
+ if (client.role.roleName === "recorder") {
8513
+ this._handleCloudRecordingStarted({ client });
8514
+ }
8515
+ if (client.role.roleName === "streamer") {
8516
+ this._handleStreamingStarted();
8517
+ }
8482
8518
  if (NON_PERSON_ROLES.includes(client.role.roleName)) {
8483
8519
  return;
8484
8520
  }
@@ -8523,7 +8559,11 @@ class RoomConnection extends TypedEventTarget {
8523
8559
  }));
8524
8560
  }
8525
8561
  _handleKnockHandled(payload) {
8526
- const { resolution } = payload;
8562
+ const { clientId, resolution } = payload;
8563
+ // If the knocker is not the local participant, ignore the event
8564
+ if (clientId !== this.selfId) {
8565
+ return;
8566
+ }
8527
8567
  if (resolution === "accepted") {
8528
8568
  this.roomConnectionStatus = "accepted";
8529
8569
  this._roomKey = payload.metadata.roomKey;
@@ -8546,6 +8586,7 @@ class RoomConnection extends TypedEventTarget {
8546
8586
  }
8547
8587
  _handleRoomJoined(event) {
8548
8588
  const { error, isLocked, room, selfId } = event;
8589
+ this.selfId = selfId;
8549
8590
  if (error === "room_locked" && isLocked) {
8550
8591
  this.roomConnectionStatus = "room_locked";
8551
8592
  this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
@@ -8565,8 +8606,17 @@ class RoomConnection extends TypedEventTarget {
8565
8606
  if (!localClient)
8566
8607
  throw new Error("Missing local client");
8567
8608
  this.localParticipant = new LocalParticipant(Object.assign(Object.assign({}, localClient), { stream: this.localMedia.stream || undefined }));
8609
+ const recorderClient = clients.find((c) => c.role.roleName === "recorder");
8610
+ if (recorderClient) {
8611
+ this._handleCloudRecordingStarted({ client: recorderClient });
8612
+ }
8613
+ const streamerClient = clients.find((c) => c.role.roleName === "streamer");
8614
+ if (streamerClient) {
8615
+ this._handleStreamingStarted();
8616
+ }
8568
8617
  this.remoteParticipants = clients
8569
8618
  .filter((c) => c.id !== selfId)
8619
+ .filter((c) => !NON_PERSON_ROLES.includes(c.role.roleName))
8570
8620
  .map((c) => new RemoteParticipant(Object.assign(Object.assign({}, c), { newJoiner: false })));
8571
8621
  this.roomConnectionStatus = "connected";
8572
8622
  this.dispatchEvent(new CustomEvent("room_joined", {
@@ -8586,6 +8636,27 @@ class RoomConnection extends TypedEventTarget {
8586
8636
  detail: { participantId: clientId, displayName },
8587
8637
  }));
8588
8638
  }
8639
+ _handleReconnect() {
8640
+ this.logger.log("Reconnected to signal socket");
8641
+ this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
8642
+ this.signalSocket.once("device_identified", () => {
8643
+ this._joinRoom();
8644
+ });
8645
+ }
8646
+ _handleDisconnect() {
8647
+ this.roomConnectionStatus = "disconnected";
8648
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
8649
+ detail: {
8650
+ roomConnectionStatus: this.roomConnectionStatus,
8651
+ },
8652
+ }));
8653
+ }
8654
+ _handleCloudRecordingStopped() {
8655
+ this.dispatchEvent(new CustomEvent("cloud_recording_stopped"));
8656
+ }
8657
+ _handleStreamingStopped() {
8658
+ this.dispatchEvent(new CustomEvent("streaming_stopped"));
8659
+ }
8589
8660
  _handleRtcEvent(eventName, data) {
8590
8661
  if (eventName === "rtc_manager_created") {
8591
8662
  return this._handleRtcManagerCreated(data);
@@ -8593,6 +8664,9 @@ class RoomConnection extends TypedEventTarget {
8593
8664
  else if (eventName === "stream_added") {
8594
8665
  return this._handleStreamAdded(data);
8595
8666
  }
8667
+ else if (eventName === "rtc_manager_destroyed") {
8668
+ return this._handleRtcManagerDestroyed();
8669
+ }
8596
8670
  else {
8597
8671
  this.logger.log(`Unhandled RTC event ${eventName}`);
8598
8672
  }
@@ -8608,6 +8682,9 @@ class RoomConnection extends TypedEventTarget {
8608
8682
  this._handleAcceptStreams(this.remoteParticipants);
8609
8683
  }
8610
8684
  }
8685
+ _handleRtcManagerDestroyed() {
8686
+ this.rtcManager = undefined;
8687
+ }
8611
8688
  _handleAcceptStreams(remoteParticipants) {
8612
8689
  var _a, _b;
8613
8690
  if (!this.rtcManager) {
@@ -8706,9 +8783,9 @@ class RoomConnection extends TypedEventTarget {
8706
8783
  yield this.localMedia.start();
8707
8784
  }
8708
8785
  // Identify device on signal connection
8709
- const deviceCredentials = yield this.credentialsService.getCredentials();
8786
+ this._deviceCredentials = yield this.credentialsService.getCredentials();
8710
8787
  this.logger.log("Connected to signal socket");
8711
- this.signalSocket.emit("identify_device", { deviceCredentials });
8788
+ this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
8712
8789
  this.signalSocket.once("device_identified", () => {
8713
8790
  this._joinRoom();
8714
8791
  });
@@ -8779,11 +8856,19 @@ class RoomConnection extends TypedEventTarget {
8779
8856
 
8780
8857
  const initialState = {
8781
8858
  chatMessages: [],
8782
- roomConnectionStatus: "",
8859
+ cloudRecording: {
8860
+ status: "",
8861
+ startedAt: null,
8862
+ },
8783
8863
  isJoining: false,
8784
8864
  joinError: null,
8785
8865
  mostRecentChatMessage: null,
8786
8866
  remoteParticipants: [],
8867
+ roomConnectionStatus: "",
8868
+ streaming: {
8869
+ status: "",
8870
+ startedAt: null,
8871
+ },
8787
8872
  waitingParticipants: [],
8788
8873
  };
8789
8874
  function updateParticipant(remoteParticipants, participantId, updates) {
@@ -8802,6 +8887,16 @@ function reducer(state, action) {
8802
8887
  switch (action.type) {
8803
8888
  case "CHAT_MESSAGE":
8804
8889
  return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, action.payload], mostRecentChatMessage: action.payload });
8890
+ case "CLOUD_RECORDING_STARTED":
8891
+ return Object.assign(Object.assign({}, state), { cloudRecording: {
8892
+ status: action.payload.status,
8893
+ startedAt: action.payload.startedAt,
8894
+ } });
8895
+ case "CLOUD_RECORDING_STOPPED":
8896
+ return Object.assign(Object.assign({}, state), { cloudRecording: {
8897
+ status: "",
8898
+ startedAt: null,
8899
+ } });
8805
8900
  case "ROOM_JOINED":
8806
8901
  return Object.assign(Object.assign({}, state), { localParticipant: action.payload.localParticipant, remoteParticipants: action.payload.remoteParticipants, waitingParticipants: action.payload.waitingParticipants, roomConnectionStatus: "connected" });
8807
8902
  case "ROOM_CONNECTION_STATUS_CHANGED":
@@ -8830,6 +8925,16 @@ function reducer(state, action) {
8830
8925
  if (!state.localParticipant)
8831
8926
  return state;
8832
8927
  return Object.assign(Object.assign({}, state), { localParticipant: Object.assign(Object.assign({}, state.localParticipant), { displayName: action.payload.displayName }) });
8928
+ case "STREAMING_STARTED":
8929
+ return Object.assign(Object.assign({}, state), { streaming: {
8930
+ status: action.payload.status,
8931
+ startedAt: action.payload.startedAt,
8932
+ } });
8933
+ case "STREAMING_STOPPED":
8934
+ return Object.assign(Object.assign({}, state), { streaming: {
8935
+ status: "",
8936
+ startedAt: null,
8937
+ } });
8833
8938
  case "WAITING_PARTICIPANT_JOINED":
8834
8939
  return Object.assign(Object.assign({}, state), { waitingParticipants: [
8835
8940
  ...state.waitingParticipants,
@@ -8852,6 +8957,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8852
8957
  const chatMessage = e.detail;
8853
8958
  dispatch({ type: "CHAT_MESSAGE", payload: chatMessage });
8854
8959
  });
8960
+ roomConnection.addEventListener("cloud_recording_started", (e) => {
8961
+ const { status, startedAt } = e.detail;
8962
+ dispatch({ type: "CLOUD_RECORDING_STARTED", payload: { status, startedAt } });
8963
+ });
8964
+ roomConnection.addEventListener("cloud_recording_stopped", () => {
8965
+ dispatch({ type: "CLOUD_RECORDING_STOPPED" });
8966
+ });
8855
8967
  roomConnection.addEventListener("participant_audio_enabled", (e) => {
8856
8968
  const { participantId, isAudioEnabled } = e.detail;
8857
8969
  dispatch({ type: "PARTICIPANT_AUDIO_ENABLED", payload: { participantId, isAudioEnabled } });
@@ -8884,6 +8996,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8884
8996
  const { participantId, displayName } = e.detail;
8885
8997
  dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
8886
8998
  });
8999
+ roomConnection.addEventListener("streaming_started", (e) => {
9000
+ const { status, startedAt } = e.detail;
9001
+ dispatch({ type: "STREAMING_STARTED", payload: { status, startedAt } });
9002
+ });
9003
+ roomConnection.addEventListener("streaming_stopped", () => {
9004
+ dispatch({ type: "STREAMING_STOPPED" });
9005
+ });
8887
9006
  roomConnection.addEventListener("waiting_participant_joined", (e) => {
8888
9007
  const { participantId, displayName } = e.detail;
8889
9008
  dispatch({ type: "WAITING_PARTICIPANT_JOINED", payload: { participantId, displayName } });
@@ -8930,7 +9049,7 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8930
9049
  };
8931
9050
  }
8932
9051
 
8933
- const sdkVersion = "2.0.0-alpha13";
9052
+ const sdkVersion = "2.0.0-alpha15";
8934
9053
 
8935
9054
  exports.VideoView = VideoView;
8936
9055
  exports.sdkVersion = sdkVersion;
package/dist/lib.esm.js CHANGED
@@ -128,7 +128,7 @@ define("WherebyEmbed", {
128
128
  if (roomUrl.searchParams.get("roomKey")) {
129
129
  this.url.searchParams.append("roomKey", roomUrl.searchParams.get("roomKey"));
130
130
  }
131
- Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha13", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
131
+ Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({ jsApi: true, we: "2.0.0-alpha15", iframeSource: subdomain }, (displayName && { displayName })), (lang && { lang })), (metadata && { metadata })), (groups && { groups })), (virtualBackgroundUrl && { virtualBackgroundUrl })), (avatarUrl && { avatarUrl })), (minimal != null && { embed: minimal })), boolAttrs.reduce(
132
132
  // add to URL if set in any way
133
133
  (o, v) => (this[v.toLowerCase()] != null ? Object.assign(Object.assign({}, o), { [v]: this[v.toLowerCase()] }) : o), {}))).forEach(([k, v]) => {
134
134
  if (!this.url.searchParams.has(k) && typeof v === "string") {
@@ -8357,9 +8357,11 @@ class RoomConnection extends TypedEventTarget {
8357
8357
  super();
8358
8358
  this.localParticipant = null;
8359
8359
  this.remoteParticipants = [];
8360
+ this._deviceCredentials = null;
8360
8361
  this._ownsLocalMedia = false;
8361
8362
  this.organizationId = "";
8362
8363
  this.roomConnectionStatus = "";
8364
+ this.selfId = null;
8363
8365
  this.roomUrl = new URL(roomUrl); // Throw if invalid Whereby room url
8364
8366
  const searchParams = new URLSearchParams(this.roomUrl.search);
8365
8367
  this._roomKey = roomKey || searchParams.get("roomKey");
@@ -8415,6 +8417,12 @@ class RoomConnection extends TypedEventTarget {
8415
8417
  this.signalSocket.on("knocker_left", this._handleKnockerLeft.bind(this));
8416
8418
  this.signalSocket.on("room_joined", this._handleRoomJoined.bind(this));
8417
8419
  this.signalSocket.on("room_knocked", this._handleRoomKnocked.bind(this));
8420
+ this.signalSocket.on("cloud_recording_stopped", this._handleCloudRecordingStopped.bind(this));
8421
+ this.signalSocket.on("streaming_stopped", this._handleStreamingStopped.bind(this));
8422
+ this.signalSocket.on("disconnect", this._handleDisconnect.bind(this));
8423
+ this.signalSocket.on("connect_error", this._handleDisconnect.bind(this));
8424
+ this.signalSocketManager = this.signalSocket.getManager();
8425
+ this.signalSocketManager.on("reconnect", this._handleReconnect.bind(this));
8418
8426
  // Set up local media listeners
8419
8427
  this.localMedia.addEventListener("camera_enabled", (e) => {
8420
8428
  const { enabled } = e.detail;
@@ -8456,7 +8464,35 @@ class RoomConnection extends TypedEventTarget {
8456
8464
  _handleNewChatMessage(message) {
8457
8465
  this.dispatchEvent(new CustomEvent("chat_message", { detail: message }));
8458
8466
  }
8467
+ _handleCloudRecordingStarted({ client }) {
8468
+ this.dispatchEvent(new CustomEvent("cloud_recording_started", {
8469
+ detail: {
8470
+ status: "recording",
8471
+ startedAt: client.startedCloudRecordingAt
8472
+ ? new Date(client.startedCloudRecordingAt).getTime()
8473
+ : new Date().getTime(),
8474
+ },
8475
+ }));
8476
+ }
8477
+ _handleStreamingStarted() {
8478
+ this.dispatchEvent(new CustomEvent("streaming_started", {
8479
+ detail: {
8480
+ status: "streaming",
8481
+ // We don't have the streaming start time stored on the
8482
+ // server, so we use the current time instead. This gives
8483
+ // an invalid timestamp for "Client B" if "Client A" has
8484
+ // been streaming for a while before "Client B" joins.
8485
+ startedAt: new Date().getTime(),
8486
+ },
8487
+ }));
8488
+ }
8459
8489
  _handleNewClient({ client }) {
8490
+ if (client.role.roleName === "recorder") {
8491
+ this._handleCloudRecordingStarted({ client });
8492
+ }
8493
+ if (client.role.roleName === "streamer") {
8494
+ this._handleStreamingStarted();
8495
+ }
8460
8496
  if (NON_PERSON_ROLES.includes(client.role.roleName)) {
8461
8497
  return;
8462
8498
  }
@@ -8501,7 +8537,11 @@ class RoomConnection extends TypedEventTarget {
8501
8537
  }));
8502
8538
  }
8503
8539
  _handleKnockHandled(payload) {
8504
- const { resolution } = payload;
8540
+ const { clientId, resolution } = payload;
8541
+ // If the knocker is not the local participant, ignore the event
8542
+ if (clientId !== this.selfId) {
8543
+ return;
8544
+ }
8505
8545
  if (resolution === "accepted") {
8506
8546
  this.roomConnectionStatus = "accepted";
8507
8547
  this._roomKey = payload.metadata.roomKey;
@@ -8524,6 +8564,7 @@ class RoomConnection extends TypedEventTarget {
8524
8564
  }
8525
8565
  _handleRoomJoined(event) {
8526
8566
  const { error, isLocked, room, selfId } = event;
8567
+ this.selfId = selfId;
8527
8568
  if (error === "room_locked" && isLocked) {
8528
8569
  this.roomConnectionStatus = "room_locked";
8529
8570
  this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
@@ -8543,8 +8584,17 @@ class RoomConnection extends TypedEventTarget {
8543
8584
  if (!localClient)
8544
8585
  throw new Error("Missing local client");
8545
8586
  this.localParticipant = new LocalParticipant(Object.assign(Object.assign({}, localClient), { stream: this.localMedia.stream || undefined }));
8587
+ const recorderClient = clients.find((c) => c.role.roleName === "recorder");
8588
+ if (recorderClient) {
8589
+ this._handleCloudRecordingStarted({ client: recorderClient });
8590
+ }
8591
+ const streamerClient = clients.find((c) => c.role.roleName === "streamer");
8592
+ if (streamerClient) {
8593
+ this._handleStreamingStarted();
8594
+ }
8546
8595
  this.remoteParticipants = clients
8547
8596
  .filter((c) => c.id !== selfId)
8597
+ .filter((c) => !NON_PERSON_ROLES.includes(c.role.roleName))
8548
8598
  .map((c) => new RemoteParticipant(Object.assign(Object.assign({}, c), { newJoiner: false })));
8549
8599
  this.roomConnectionStatus = "connected";
8550
8600
  this.dispatchEvent(new CustomEvent("room_joined", {
@@ -8564,6 +8614,27 @@ class RoomConnection extends TypedEventTarget {
8564
8614
  detail: { participantId: clientId, displayName },
8565
8615
  }));
8566
8616
  }
8617
+ _handleReconnect() {
8618
+ this.logger.log("Reconnected to signal socket");
8619
+ this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
8620
+ this.signalSocket.once("device_identified", () => {
8621
+ this._joinRoom();
8622
+ });
8623
+ }
8624
+ _handleDisconnect() {
8625
+ this.roomConnectionStatus = "disconnected";
8626
+ this.dispatchEvent(new CustomEvent("room_connection_status_changed", {
8627
+ detail: {
8628
+ roomConnectionStatus: this.roomConnectionStatus,
8629
+ },
8630
+ }));
8631
+ }
8632
+ _handleCloudRecordingStopped() {
8633
+ this.dispatchEvent(new CustomEvent("cloud_recording_stopped"));
8634
+ }
8635
+ _handleStreamingStopped() {
8636
+ this.dispatchEvent(new CustomEvent("streaming_stopped"));
8637
+ }
8567
8638
  _handleRtcEvent(eventName, data) {
8568
8639
  if (eventName === "rtc_manager_created") {
8569
8640
  return this._handleRtcManagerCreated(data);
@@ -8571,6 +8642,9 @@ class RoomConnection extends TypedEventTarget {
8571
8642
  else if (eventName === "stream_added") {
8572
8643
  return this._handleStreamAdded(data);
8573
8644
  }
8645
+ else if (eventName === "rtc_manager_destroyed") {
8646
+ return this._handleRtcManagerDestroyed();
8647
+ }
8574
8648
  else {
8575
8649
  this.logger.log(`Unhandled RTC event ${eventName}`);
8576
8650
  }
@@ -8586,6 +8660,9 @@ class RoomConnection extends TypedEventTarget {
8586
8660
  this._handleAcceptStreams(this.remoteParticipants);
8587
8661
  }
8588
8662
  }
8663
+ _handleRtcManagerDestroyed() {
8664
+ this.rtcManager = undefined;
8665
+ }
8589
8666
  _handleAcceptStreams(remoteParticipants) {
8590
8667
  var _a, _b;
8591
8668
  if (!this.rtcManager) {
@@ -8684,9 +8761,9 @@ class RoomConnection extends TypedEventTarget {
8684
8761
  yield this.localMedia.start();
8685
8762
  }
8686
8763
  // Identify device on signal connection
8687
- const deviceCredentials = yield this.credentialsService.getCredentials();
8764
+ this._deviceCredentials = yield this.credentialsService.getCredentials();
8688
8765
  this.logger.log("Connected to signal socket");
8689
- this.signalSocket.emit("identify_device", { deviceCredentials });
8766
+ this.signalSocket.emit("identify_device", { deviceCredentials: this._deviceCredentials });
8690
8767
  this.signalSocket.once("device_identified", () => {
8691
8768
  this._joinRoom();
8692
8769
  });
@@ -8757,11 +8834,19 @@ class RoomConnection extends TypedEventTarget {
8757
8834
 
8758
8835
  const initialState = {
8759
8836
  chatMessages: [],
8760
- roomConnectionStatus: "",
8837
+ cloudRecording: {
8838
+ status: "",
8839
+ startedAt: null,
8840
+ },
8761
8841
  isJoining: false,
8762
8842
  joinError: null,
8763
8843
  mostRecentChatMessage: null,
8764
8844
  remoteParticipants: [],
8845
+ roomConnectionStatus: "",
8846
+ streaming: {
8847
+ status: "",
8848
+ startedAt: null,
8849
+ },
8765
8850
  waitingParticipants: [],
8766
8851
  };
8767
8852
  function updateParticipant(remoteParticipants, participantId, updates) {
@@ -8780,6 +8865,16 @@ function reducer(state, action) {
8780
8865
  switch (action.type) {
8781
8866
  case "CHAT_MESSAGE":
8782
8867
  return Object.assign(Object.assign({}, state), { chatMessages: [...state.chatMessages, action.payload], mostRecentChatMessage: action.payload });
8868
+ case "CLOUD_RECORDING_STARTED":
8869
+ return Object.assign(Object.assign({}, state), { cloudRecording: {
8870
+ status: action.payload.status,
8871
+ startedAt: action.payload.startedAt,
8872
+ } });
8873
+ case "CLOUD_RECORDING_STOPPED":
8874
+ return Object.assign(Object.assign({}, state), { cloudRecording: {
8875
+ status: "",
8876
+ startedAt: null,
8877
+ } });
8783
8878
  case "ROOM_JOINED":
8784
8879
  return Object.assign(Object.assign({}, state), { localParticipant: action.payload.localParticipant, remoteParticipants: action.payload.remoteParticipants, waitingParticipants: action.payload.waitingParticipants, roomConnectionStatus: "connected" });
8785
8880
  case "ROOM_CONNECTION_STATUS_CHANGED":
@@ -8808,6 +8903,16 @@ function reducer(state, action) {
8808
8903
  if (!state.localParticipant)
8809
8904
  return state;
8810
8905
  return Object.assign(Object.assign({}, state), { localParticipant: Object.assign(Object.assign({}, state.localParticipant), { displayName: action.payload.displayName }) });
8906
+ case "STREAMING_STARTED":
8907
+ return Object.assign(Object.assign({}, state), { streaming: {
8908
+ status: action.payload.status,
8909
+ startedAt: action.payload.startedAt,
8910
+ } });
8911
+ case "STREAMING_STOPPED":
8912
+ return Object.assign(Object.assign({}, state), { streaming: {
8913
+ status: "",
8914
+ startedAt: null,
8915
+ } });
8811
8916
  case "WAITING_PARTICIPANT_JOINED":
8812
8917
  return Object.assign(Object.assign({}, state), { waitingParticipants: [
8813
8918
  ...state.waitingParticipants,
@@ -8830,6 +8935,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8830
8935
  const chatMessage = e.detail;
8831
8936
  dispatch({ type: "CHAT_MESSAGE", payload: chatMessage });
8832
8937
  });
8938
+ roomConnection.addEventListener("cloud_recording_started", (e) => {
8939
+ const { status, startedAt } = e.detail;
8940
+ dispatch({ type: "CLOUD_RECORDING_STARTED", payload: { status, startedAt } });
8941
+ });
8942
+ roomConnection.addEventListener("cloud_recording_stopped", () => {
8943
+ dispatch({ type: "CLOUD_RECORDING_STOPPED" });
8944
+ });
8833
8945
  roomConnection.addEventListener("participant_audio_enabled", (e) => {
8834
8946
  const { participantId, isAudioEnabled } = e.detail;
8835
8947
  dispatch({ type: "PARTICIPANT_AUDIO_ENABLED", payload: { participantId, isAudioEnabled } });
@@ -8862,6 +8974,13 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8862
8974
  const { participantId, displayName } = e.detail;
8863
8975
  dispatch({ type: "PARTICIPANT_METADATA_CHANGED", payload: { participantId, displayName } });
8864
8976
  });
8977
+ roomConnection.addEventListener("streaming_started", (e) => {
8978
+ const { status, startedAt } = e.detail;
8979
+ dispatch({ type: "STREAMING_STARTED", payload: { status, startedAt } });
8980
+ });
8981
+ roomConnection.addEventListener("streaming_stopped", () => {
8982
+ dispatch({ type: "STREAMING_STOPPED" });
8983
+ });
8865
8984
  roomConnection.addEventListener("waiting_participant_joined", (e) => {
8866
8985
  const { participantId, displayName } = e.detail;
8867
8986
  dispatch({ type: "WAITING_PARTICIPANT_JOINED", payload: { participantId, displayName } });
@@ -8908,6 +9027,6 @@ function useRoomConnection(roomUrl, roomConnectionOptions) {
8908
9027
  };
8909
9028
  }
8910
9029
 
8911
- const sdkVersion = "2.0.0-alpha13";
9030
+ const sdkVersion = "2.0.0-alpha15";
8912
9031
 
8913
9032
  export { VideoView, sdkVersion, useLocalMedia, useRoomConnection };
package/dist/types.d.ts CHANGED
@@ -166,6 +166,14 @@ interface RoomConnectionOptions {
166
166
  }
167
167
  type ChatMessage = Pick<ChatMessage$1, "senderId" | "timestamp" | "text">;
168
168
  type RoomConnectionStatus = "" | "connecting" | "connected" | "room_locked" | "knocking" | "disconnecting" | "disconnected" | "accepted" | "rejected";
169
+ type CloudRecordingState = {
170
+ status: "" | "recording";
171
+ startedAt: number | null;
172
+ };
173
+ type StreamingState = {
174
+ status: "" | "streaming";
175
+ startedAt: number | null;
176
+ };
169
177
  type RoomJoinedEvent = {
170
178
  localParticipant: LocalParticipant;
171
179
  remoteParticipants: RemoteParticipant[];
@@ -205,6 +213,7 @@ type WaitingParticipantLeftEvent = {
205
213
  };
206
214
  interface RoomEventsMap {
207
215
  chat_message: CustomEvent<ChatMessage>;
216
+ cloud_recording_started: CustomEvent<CloudRecordingState>;
208
217
  participant_audio_enabled: CustomEvent<ParticipantAudioEnabledEvent>;
209
218
  participant_joined: CustomEvent<ParticipantJoinedEvent>;
210
219
  participant_left: CustomEvent<ParticipantLeftEvent>;
@@ -213,6 +222,7 @@ interface RoomEventsMap {
213
222
  participant_video_enabled: CustomEvent<ParticipantVideoEnabledEvent>;
214
223
  room_connection_status_changed: CustomEvent<RoomConnectionStatusChangedEvent>;
215
224
  room_joined: CustomEvent<RoomJoinedEvent>;
225
+ streaming_started: CustomEvent<StreamingState>;
216
226
  waiting_participant_joined: CustomEvent<WaitingParticipantJoinedEvent>;
217
227
  waiting_participant_left: CustomEvent<WaitingParticipantLeftEvent>;
218
228
  }
@@ -235,10 +245,13 @@ declare class RoomConnection extends TypedEventTarget {
235
245
  private organizationServiceCache;
236
246
  private organizationApiClient;
237
247
  private roomService;
248
+ private _deviceCredentials;
238
249
  private signalSocket;
250
+ private signalSocketManager;
239
251
  private rtcManagerDispatcher?;
240
252
  private rtcManager?;
241
253
  private roomConnectionStatus;
254
+ private selfId;
242
255
  private logger;
243
256
  private _ownsLocalMedia;
244
257
  private displayName?;
@@ -246,6 +259,8 @@ declare class RoomConnection extends TypedEventTarget {
246
259
  constructor(roomUrl: string, { displayName, localMedia, localMediaConstraints, logger, roomKey }: RoomConnectionOptions);
247
260
  get roomKey(): string | null;
248
261
  private _handleNewChatMessage;
262
+ private _handleCloudRecordingStarted;
263
+ private _handleStreamingStarted;
249
264
  private _handleNewClient;
250
265
  private _handleClientLeft;
251
266
  private _handleClientAudioEnabled;
@@ -255,8 +270,13 @@ declare class RoomConnection extends TypedEventTarget {
255
270
  private _handleKnockerLeft;
256
271
  private _handleRoomJoined;
257
272
  private _handleRoomKnocked;
273
+ private _handleReconnect;
274
+ private _handleDisconnect;
275
+ private _handleCloudRecordingStopped;
276
+ private _handleStreamingStopped;
258
277
  private _handleRtcEvent;
259
278
  private _handleRtcManagerCreated;
279
+ private _handleRtcManagerDestroyed;
260
280
  private _handleAcceptStreams;
261
281
  private _handleStreamAdded;
262
282
  private _joinRoom;
@@ -272,12 +292,14 @@ declare class RoomConnection extends TypedEventTarget {
272
292
  type RemoteParticipantState = Omit<RemoteParticipant, "updateStreamState">;
273
293
  interface RoomConnectionState {
274
294
  chatMessages: ChatMessage[];
295
+ cloudRecording: CloudRecordingState;
275
296
  isJoining: boolean;
276
297
  joinError: unknown;
277
298
  localParticipant?: LocalParticipant;
278
299
  mostRecentChatMessage: ChatMessage | null;
279
- roomConnectionStatus: RoomConnectionStatus;
280
300
  remoteParticipants: RemoteParticipantState[];
301
+ roomConnectionStatus: RoomConnectionStatus;
302
+ streaming: StreamingState;
281
303
  waitingParticipants: WaitingParticipant[];
282
304
  }
283
305
  interface UseRoomConnectionOptions extends Omit<RoomConnectionOptions, "localMedia"> {
@@ -303,6 +325,6 @@ type RoomConnectionRef = {
303
325
  };
304
326
  declare function useRoomConnection(roomUrl: string, roomConnectionOptions: UseRoomConnectionOptions): RoomConnectionRef;
305
327
 
306
- declare const sdkVersion = "2.0.0-alpha13";
328
+ declare const sdkVersion = "2.0.0-alpha15";
307
329
 
308
330
  export { _default as VideoView, sdkVersion, useLocalMedia, useRoomConnection };
@@ -7,7 +7,7 @@ function D(e){return e.join(P).replace(B,q).replace(N,U)}var I=" \\f\\n\\r\\t",j
7
7
  /*! (c) Andrea Giammarchi - ISC */
8
8
  var J=function(e){var t="fragment",i="template",n="content"in a(i)?function(e){var t=a(i);return t.innerHTML=e,t.content}:function(e){var n=a(t),r=a(i),o=null;if(/^[^\S]*?<(col(?:group)?|t(?:head|body|foot|r|d|h))/i.test(e)){var c=RegExp.$1;r.innerHTML="<table>"+e+"</table>",o=r.querySelectorAll(c)}else r.innerHTML=e,o=r.childNodes;return s(n,o),n};return function(e,t){return("svg"===t?r:n)(e)};function s(e,t){for(var i=t.length;i--;)e.appendChild(t[0])}function a(i){return i===t?e.createDocumentFragment():e.createElementNS("http://www.w3.org/1999/xhtml",i)}function r(e){var i=a(t),n=a("div");return n.innerHTML='<svg xmlns="http://www.w3.org/2000/svg">'+e+"</svg>",s(i,n.firstChild.childNodes),i}}(document),Q=(e,t,i,n,s)=>{const a=i.length;let r=t.length,o=a,c=0,p=0,d=null;for(;c<r||p<o;)if(r===c){const t=o<a?p?n(i[p-1],-0).nextSibling:n(i[o-p],0):s;for(;p<o;)e.insertBefore(n(i[p++],1),t)}else if(o===p)for(;c<r;)d&&d.has(t[c])||e.removeChild(n(t[c],-1)),c++;else if(t[c]===i[p])c++,p++;else if(t[r-1]===i[o-1])r--,o--;else if(t[c]===i[o-1]&&i[p]===t[r-1]){const s=n(t[--r],-1).nextSibling;e.insertBefore(n(i[p++],1),n(t[c++],-1).nextSibling),e.insertBefore(n(i[--o],1),s),t[r]=i[o]}else{if(!d){d=new Map;let e=p;for(;e<o;)d.set(i[e],e++)}if(d.has(t[c])){const s=d.get(t[c]);if(p<s&&s<o){let a=c,l=1;for(;++a<r&&a<o&&d.get(t[a])===s+l;)l++;if(l>s-p){const a=n(t[c],0);for(;p<s;)e.insertBefore(n(i[p++],1),a)}else e.replaceChild(n(i[p++],1),n(t[c++],-1))}else c++}else e.removeChild(n(t[c++],-1))}return i},Y=function(e,t,i,n,s){var a=s in e,r=e.createDocumentFragment();return r.appendChild(e.createTextNode("g")),r.appendChild(e.createTextNode("")),(a?e.importNode(r,!0):r.cloneNode(!0)).childNodes.length<2?function e(t,i){for(var n=t.cloneNode(),s=t.childNodes||[],a=s.length,r=0;i&&r<a;r++)n.appendChild(e(s[r],i));return n}:a?e.importNode:function(e,t){return e.cloneNode(!!t)}}(document,0,0,0,"importNode"),X="".trim||function(){return String(this).replace(/^\s+|\s+/g,"")},Z=T?function(e,t){var i=t.join(" ");return t.slice.call(e,0).sort((function(e,t){return i.indexOf(e.name)<=i.indexOf(t.name)?-1:1}))}:function(e,t){return t.slice.call(e,0)};function ee(e,t){for(var i=t.length,n=0;n<i;)e=e.childNodes[t[n++]];return e}function te(e,t,i,n){for(var s=e.childNodes,a=s.length,r=0;r<a;){var o=s[r];switch(o.nodeType){case 1:var c=n.concat(r);ie(o,t,i,c),te(o,t,i,c);break;case 8:var p=o.textContent;if(p===k)i.shift(),t.push(E.test(e.nodeName)?ae(e,n):ne(o,n.concat(r)));else switch(p.slice(0,2)){case"/*":if("*/"!==p.slice(-2))break;case"👻":e.removeChild(o),r--,a--}break;case 3:E.test(e.nodeName)&&X.call(o.textContent)===P&&(i.shift(),t.push(ae(e,n)))}r++}}function ie(e,t,i,n){for(var s=e.attributes,a=[],r=[],o=Z(s,i),c=o.length,p=0;p<c;){var d,l=o[p++],u=l.value===k;if(u||1<(d=l.value.split(P)).length){var m=l.name;if(a.indexOf(m)<0){a.push(m);var h=i.shift().replace(u?/^(?:|[\S\s]*?\s)(\S+?)\s*=\s*('|")?$/:new RegExp("^(?:|[\\S\\s]*?\\s)("+m+")\\s*=\\s*('|\")[\\S\\s]*","i"),"$1"),f=s[h]||s[h.toLowerCase()];if(u)t.push(se(f,n,h,null));else{for(var g=d.length-2;g--;)i.shift();t.push(se(f,n,h,d))}}r.push(l)}}p=0;for(var v=(0<(c=r.length)&&T&&!("ownerSVGElement"in e));p<c;){var b=r[p++];v&&(b.value=""),e.removeAttribute(b.name)}var _=e.nodeName;if(/^script$/i.test(_)){var y=document.createElement(_);for(c=s.length,p=0;p<c;)y.setAttributeNode(s[p++].cloneNode(!0));y.textContent=e.textContent,e.parentNode.replaceChild(y,e)}}function ne(e,t){return{type:"any",node:e,path:t}}function se(e,t,i,n){return{type:"attr",node:e,path:t,name:i,sparse:n}}function ae(e,t){return{type:"text",node:e,path:t}}var re=G(new _);function oe(e,t){var i=(e.convert||D)(t),n=e.transform;n&&(i=n(i));var s=J(i,e.type);de(s);var a=[];return te(s,a,t.slice(0),[]),{content:s,updates:function(i){for(var n=[],s=a.length,r=0,o=0;r<s;){var c=a[r++],p=ee(i,c.path);switch(c.type){case"any":n.push({fn:e.any(p,[]),sparse:!1});break;case"attr":var d=c.sparse,l=e.attribute(p,c.name,c.node);null===d?n.push({fn:l,sparse:!1}):(o+=d.length-2,n.push({fn:l,sparse:!0,values:d}));break;case"text":n.push({fn:e.text(p),sparse:!1}),p.textContent=""}}return s+=o,function(){var e=arguments.length;if(s!==e-1)throw new Error(e-1+" values instead of "+s+"\n"+t.join("${value}"));for(var a=1,r=1;a<e;){var o=n[a-r];if(o.sparse){var c=o.values,p=c[0],d=1,l=c.length;for(r+=l-2;d<l;)p+=arguments[a++]+c[d++];o.fn(p)}else o.fn(arguments[a++])}return i}}}}function ce(e,t){var i=re.get(t)||re.set(t,oe(e,t));return i.updates(Y.call(document,i.content,!0))}var pe=[];function de(e){for(var t=e.childNodes,i=t.length;i--;){var n=t[i];1!==n.nodeType&&0===X.call(n.textContent).length&&e.removeChild(n)}}
9
9
  /*! (c) Andrea Giammarchi - ISC */var le=function(){var e=/acit|ex(?:s|g|n|p|$)|rph|ows|mnc|ntw|ine[ch]|zoo|^ord/i,t=/([^A-Z])([A-Z]+)/g;return function(e,t){return"ownerSVGElement"in e?function(e,t){var i;t?i=t.cloneNode(!0):(e.setAttribute("style","--hyper:style;"),i=e.getAttributeNode("style"));return i.value="",e.setAttributeNode(i),n(i,!0)}(e,t):n(e.style,!1)};function i(e,t,i){return t+"-"+i.toLowerCase()}function n(n,s){var a,r;return function(o){var c,p,d,l;switch(typeof o){case"object":if(o){if("object"===a){if(!s&&r!==o)for(p in r)p in o||(n[p]="")}else s?n.value="":n.cssText="";for(p in c=s?{}:n,o)d="number"!=typeof(l=o[p])||e.test(p)?l:l+"px",!s&&/^--/.test(p)?c.setProperty(p,d):c[p]=d;a="object",s?n.value=function(e){var n,s=[];for(n in e)s.push(n.replace(t,i),":",e[n],";");return s.join("")}(r=c):r=o;break}default:r!=o&&(a="string",r=o,s?n.value=o||"":n.cssText=o||"")}}}}();const ue=(e,t)=>{let i,n=!0;const s=document.createAttributeNS(null,t);return t=>{i!==t&&(i=t,null==i?n||(e.removeAttributeNode(s),n=!0):(s.value=t,n&&(e.setAttributeNodeNS(s),n=!1)))}},me=({dataset:e})=>t=>{for(const i in t){const n=t[i];null==n?delete e[i]:e[i]=n}},he=(e,t)=>"dataset"===t?me(e):i=>{e[t]=i},fe=/^(?:form|list)$/i,ge=(e,t)=>e.ownerDocument.createTextNode(t);function ve(e){return this.type=e,function(e){var t=pe,i=de;return function(n){return t!==n&&(i=ce(e,t=n)),i.apply(null,arguments)}}(this)}function be(e){return e(this)}ve.prototype={attribute(e,t,i){const n="svg"===this.type;switch(t){case"class":if(n)return ue(e,t);t="className";case"props":return he(e,t);case"aria":return(e=>t=>{for(const i in t){const n="role"===i?i:`aria-${i}`,s=t[i];null==s?e.removeAttribute(n):e.setAttribute(n,s)}})(e);case"style":return le(e,i,n);case"ref":return(e=>t=>{"function"==typeof t?t(e):t.current=e})(e);case".dataset":return me(e);default:return"."===t.slice(0,1)?he(e,t.slice(1)):"?"===t.slice(0,1)?((e,t,i)=>n=>{i!==!!n&&((i=!!n)?e.setAttribute(t,""):e.removeAttribute(t))})(e,t.slice(1)):"on"===t.slice(0,2)?((e,t)=>{let i,n=t.slice(2);return!(t in e)&&t.toLowerCase()in e&&(n=n.toLowerCase()),t=>{const s=$(t)?t:[t,!1];i!==s[0]&&(i&&e.removeEventListener(n,i,s[1]),(i=s[0])&&e.addEventListener(n,i,s[1]))}})(e,t):!(t in e)||n||fe.test(t)?ue(e,t):((e,t)=>{let i;return n=>{i!==n&&(i=n,e[t]!==n&&(null==n?(e[t]="",e.removeAttribute(t)):e[t]=n))}})(e,t)}},any(e,t){const{type:i}=this;let n,s=!1;const a=r=>{switch(typeof r){case"string":case"number":case"boolean":s?n!==r&&(n=r,t[0].textContent=r):(s=!0,n=r,t=Q(e.parentNode,t,[ge(e,r)],H,e));break;case"function":a(r(e));break;case"object":case"undefined":if(null==r){s=!1,t=Q(e.parentNode,t,[],H,e);break}default:if(s=!1,n=r,$(r))if(0===r.length)t.length&&(t=Q(e.parentNode,t,[],H,e));else switch(typeof r[0]){case"string":case"number":case"boolean":a(String(r));break;case"function":a(r.map(be,e));break;case"object":$(r[0])&&(r=r.concat.apply([],r));default:t=Q(e.parentNode,t,r,H,e)}else"ELEMENT_NODE"in r?t=Q(e.parentNode,t,11===r.nodeType?W.call(r.childNodes):[r],H,e):"text"in r?a(String(r.text)):"any"in r?a(r.any):"html"in r?t=Q(e.parentNode,t,W.call(J([].concat(r.html).join(""),i).childNodes),H,e):"length"in r&&a(W.call(r))}};return a},text(e){let t;const i=n=>{if(t!==n){t=n;const s=typeof n;"object"===s&&n?"text"in n?i(String(n.text)):"any"in n?i(n.any):"html"in n?i([].concat(n.html).join("")):"length"in n&&i(W.call(n).join("")):"function"===s?i(n(e)):e.textContent=null==n?"":n}};return i}};const{create:_e,freeze:ye,keys:xe}=Object,we=ve.prototype,Se=G(new _),Re=e=>({html:ke("html",e),svg:ke("svg",e),render(t,i){const n="function"==typeof i?i():i,s=Se.get(t)||Se.set(t,Ce()),a=n instanceof Ee?Te(e,s,n):n;return a!==s.wire&&(s.wire=a,t.textContent="",t.appendChild(a.valueOf())),t}}),Ce=()=>({stack:[],entry:null,wire:null}),ke=(e,t)=>{const i=G(new _);return n.for=(e,s)=>{const a=i.get(e)||i.set(e,_e(null));return a[s]||(a[s]=(e=>function(){return Te(t,e,n.apply(null,arguments))})(Ce()))},n.node=function(){return Te(t,Ce(),n.apply(null,arguments)).valueOf()},n;function n(){return new Ee(e,De.apply(null,arguments))}},Te=(e,t,{type:i,template:n,values:s})=>{const{length:a}=s;Pe(e,t,s,a);let{entry:r}=t;if(r&&r.template===n&&r.type===i)r.tag(n,...s);else{const a=new e(i);t.entry=r={type:i,template:n,tag:a,wire:K(a(n,...s))}}return r.wire},Pe=(e,{stack:t},i,n)=>{for(let s=0;s<n;s++){const n=i[s];n instanceof Oe?i[s]=Te(e,t[s]||(t[s]=Ce()),n):$(n)?Pe(e,t[s]||(t[s]=Ce()),n,n.length):t[s]=null}n<t.length&&t.splice(n)};function Ee(e,t){this.type=e,this.template=t.shift(),this.values=t}ye(Ee);const Oe=Ee;function De(){let e=[],t=0,{length:i}=arguments;for(;t<i;)e.push(arguments[t++]);return e}Re(ve);var Ie="function"==typeof cancelAnimationFrame,je=Ie?cancelAnimationFrame:clearTimeout,Le=Ie?requestAnimationFrame:setTimeout;function Me(e){var t,i,n,s,a;return o(),function(e,o,p){return n=e,s=o,a=p,i||(i=Le(r)),--t<0&&c(!0),c};function r(){o(),n.apply(s,a||[])}function o(){t=e||1/0,i=Ie?0:null}function c(e){var t=!!i;return t&&(je(i),e&&r()),t}}
10
- /*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=G(new WeakMap),Be=(e,t,i)=>{e.apply(t,i)},Fe={async:!1,always:!1},Ue=(e,t)=>"function"==typeof t?t(e):t,ze=(e,t,i,n)=>{const s=Ae.i++,{hook:a,args:r,stack:o,length:c}=Ae;s===c&&(Ae.length=o.push({}));const p=o[s];if(p.args=r,s===c){const s="function"==typeof i,{async:r,always:o}=(s?n:i)||n||Fe;p.$=s?i(t):Ue(void 0,t),p._=r?Ne.get(a)||Ne.set(a,Me()):Be,p.f=t=>{const i=e(p.$,t);(o||p.$!==i)&&(p.$=i,p._(a,null,p.args))}}return[p.$,p.f]},qe=new WeakMap;function $e({hook:e}){return e===this.hook}const Ve=new WeakMap,We=G(Ve),Ge=()=>{},He=e=>(t,i)=>{const n=Ae.i++,{hook:s,after:a,stack:r,length:o}=Ae;if(n<o){const s=r[n],{update:o,values:c,stop:p}=s;if(!i||i.some(Xe,c)){s.values=i,e&&p(e);const{clean:n}=s;n&&(s.clean=null,n());const r=()=>{s.clean=t()};e?o(r):a.push(r)}}else{const n=e?Me():Ge,o={clean:null,update:n,values:i,stop:Ge};Ae.length=r.push(o),(We.get(s)||We.set(s,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=n(c):a.push(c)}},Ke=e=>{(Ve.get(e)||[]).forEach((e=>{const{clean:t,stop:i}=e;i(),t&&(e.clean=null,t())}))};Ve.has.bind(Ve);const Je=He(!0),Qe=He(!1),Ye=(e,t)=>{const i=Ae.i++,{stack:n,length:s}=Ae;return i===s?Ae.length=n.push({$:e(),_:t}):t&&!t.some(Xe,n[i]._)||(n[i]={$:e(),_:t}),n[i].$};function Xe(e,t){return e!==this[t]}let Ze=null;try{Ze=new{o(){}}.o}catch(Yt){}let et=e=>class extends e{};if(Ze){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:i}="object"==typeof Reflect?Reflect:{construct(e,i,n){const s=[null];for(let e=0;e<i.length;e++)s.push(i[e]);const a=e.bind.apply(e,s);return t(new a,n.prototype)}};et=function(n,s){function a(){return i(s?e(n):n,arguments,a)}return t(a.prototype,n.prototype),t(a,n)}}const tt={map:{},re:null},it=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let nt=null;const st=(e,t)=>{const{map:i,re:n}=nt||t;return e.replace(n,((e,t,n,s)=>{const{tagName:a,is:r,element:o}=i[n];return o?t?`</${r}>`:`<${r}${s}`:t?`</${a}>`:`<${a} is="${r}"${s}`}))},at=({tagName:e,is:t,element:i})=>i?t:`${e}[is="${t}"]`,rt=()=>nt,ot=e=>{nt=e},ct={useCallback:(e,t)=>Ye((()=>e),t),useContext:e=>{const{hook:t,args:i}=Ae,n=qe.get(e),s={hook:t,args:i};return n.some($e,s)||n.push(s),e.value},useEffect:Je,useLayoutEffect:Qe,useMemo:Ye,useReducer:ze,useRef:e=>{const t=Ae.i++,{stack:i,length:n}=Ae;return t===n&&(Ae.length=i.push({current:e})),i[t]},useState:(e,t)=>ze(Ue,e,void 0,t)},{render:pt,html:dt,svg:lt}=(e=>{const t=_e(we);return xe(e).forEach((i=>{t[i]=e[i](t[i]||("convert"===i?D:String))})),i.prototype=t,Re(i);function i(){return ve.apply(this,arguments)}})({transform:()=>e=>st(e,tt)}),{defineProperties:ut}=Object,mt=new _,ht=new _,ft=new _,gt=new C,vt="attributeChangedCallback",bt="connectedCallback",_t=`dis${bt}`,yt=(e,t,i)=>{if(i in e){const n=e[i];t[i]={configurable:true,value(){return It.call(this),n.apply(this,arguments)}}}else t[i]={configurable:true,value:It}},xt=e=>{const{prototype:t}=e,i=[],n={html:{configurable:true,get:Et},svg:{configurable:true,get:Ot}};if(n["_🔥"]={value:{events:i,info:null}},"handleEvent"in t||(n.handleEvent={configurable:true,value:Dt}),"render"in t&&t.render.length){const{oninit:e}=t;ut(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function i(){const n=Ae,s=[];Ae={hook:i,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{Ae=n;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,ct));ut(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ke.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(i.push("init"),yt(t,n,"render")),yt(t,n,vt),yt(t,n,bt),yt(t,n,_t),[[vt,"onattributechanged",jt],[bt,"onconnected",Lt],[_t,"ondisconnected",At],[bt,"render",Mt]].forEach((([e,s,a])=>{if(!(e in t)&&s in t)if("render"!==s&&i.push(s.slice(2)),e in n){const t=n[e].value;n[e]={configurable:true,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else n[e]={configurable:true,value:a}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const s=new _,a="on"+e in t;a&&i.push(e),n[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),a){const i=wt(e);if(i.detail=t,gt.has(this))this.dispatchEvent(i);else{const e=ft.get(this);e?e.push(i):ft.set(this,[i])}}}}})),ut(t,n);const r=s.concat(a);return r.length?ut(e,{observedAttributes:{configurable:true,get:()=>r}}):e},wt=e=>new x(e),St=(...e)=>new Oe("html",e);St.for=dt.for;const Rt=(...e)=>new Oe("svg",e);Rt.for=lt.for;const Ct=(e,t,i)=>{const n=kt(e,t,new _);return i.set(e,n),n},kt=(e,t,i)=>(n,...s)=>{const a=i.get(n)||((e,t,{info:i})=>{const n=i?st(t.join("_🔥"),i).split("_🔥"):t;return e.set(t,n),n})(i,n,e["_🔥"]);return pt(e,(()=>t(a,...s)))};function Tt(e){this.addEventListener(e,this)}function Pt(e){this.dispatchEvent(e)}function Et(){return mt.get(this)||Ct(this,St,mt)}function Ot(){return ht.get(this)||Ct(this,Rt,ht)}function Dt(e){this[`on${e.type}`](e)}function It(){if(!gt.has(this)){gt.add(this),this["_🔥"].events.forEach(Tt,this),this.dispatchEvent(wt("init"));const e=ft.get(this);e&&(ft.delete(this),e.forEach(Pt,this))}}function jt(e,t,i){const n=wt("attributechanged");n.attributeName=e,n.oldValue=t,n.newValue=i,this.dispatchEvent(n)}function Lt(){this.dispatchEvent(wt("connected"))}function Mt(){this.render()}function At(){this.dispatchEvent(wt("disconnected"))}const{create:Nt,defineProperty:Bt,defineProperties:Ft,getOwnPropertyNames:Ut,getOwnPropertySymbols:zt,getOwnPropertyDescriptor:qt,keys:$t}=Object,Vt={element:HTMLElement},Wt=new _;new _;const Gt=new _;new _;const Ht=e=>{const t=Nt(null),i=Nt(null),n={prototype:i,statics:t};return Ut(e).concat(zt(e)).forEach((n=>{const s=qt(e,n);switch(s.enumerable=!1,n){case"extends":n="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[n]=s;break;default:i[n]=s}})),n},Kt=(e,t,i)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:n,$3:s,$4:a}=RegExp;let r=s||a||t.tagName||t.extends||"element";const o="fragment"===r;if(o)r="element";else if(!/^[A-Za-z0-9:._-]+$/.test(r))throw"Invalid tag";let c="",p="";r.indexOf("-")<0?(c=n.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+i,c.indexOf("-")<0&&(p="-heresy")):(c=r+i,r="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=et("object"==typeof t?Gt.get(t)||((e,t)=>{const{statics:i,prototype:n}=Ht(e),s=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(s.prototype,n),Ft(s,i),Gt.set(e,xt(s)),s})(t,r):Wt.get(t)||(e=>{const t=et(e,!1);return Wt.set(e,xt(t)),t})(t),!0),u="element"===r;if(Bt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(r,{is:d})}),Bt(l.prototype,"is",{value:d}),""===i){const e=(e=>{const{length:t}=e;let i=0,n=0;for(;n<t;)i=(i<<5)-i+e.charCodeAt(n++),i&=i;return i.toString(36)})(c.toUpperCase());tt.map[n]=Jt(l,r,d,{id:e,i:0}),tt.re=it($t(tt.map))}if(o){const{render:e}=l.prototype;Bt(l.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const i=document.createRange();i.setStartBefore(e),i.setEndAfter(this.lastChild),t=i.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const m=[d,l];return u||m.push({extends:r}),customElements.define(...m),{Class:l,is:d,name:n,tagName:r}},Jt=(e,t,i,n)=>{const{prototype:s}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,i),r=[at(a)],o=e.includes||e.contains;if(o){const e={};$t(o).forEach((t=>{const i=`-${n.id}-${n.i++}`,{Class:s,is:a,name:c,tagName:p}=Kt(t,o[t],i);r.push(at(e[c]=Jt(s,p,a,n)))}));const t=it($t(e)),{events:i}=s["_🔥"],a={events:i,info:{map:e,re:t}};if(Bt(s,"_🔥",{value:a}),"render"in s){const{render:e}=s,{info:t}=a;Bt(s,"render",{configurable:!0,value(){const i=rt();ot(t);const n=e.apply(this,arguments);return ot(i),n}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const i=document.head||document.querySelector("head");i.insertBefore(t,i.lastChild)}})(e.style(...r)),a},Qt=["audio","background","cameraaccess","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var Yt,Xt;function Zt(e,t,i,n){return new(i||(i=Promise))((function(s,a){function r(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((n=n.apply(e,t||[])).next())}))}Yt="WherebyEmbed",Xt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage)},ondisconnected(){window.removeEventListener("message",this.onmessage)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Qt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:i,payload:n}=t;this.dispatchEvent(new CustomEvent(i,{detail:n}))},render(){const{avatarurl:e,displayname:t,lang:i,metadata:n,minimal:s,room:a,groups:r,virtualbackgroundurl:o}=this;if(!a)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha13",iframeSource:p},t&&{displayName:t}),i&&{lang:i}),n&&{metadata:n}),r&&{groups:r}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=s&&{embed:s}),Qt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
10
+ /*! (c) Andrea Giammarchi - ISC */let Ae=null;const Ne=G(new WeakMap),Be=(e,t,i)=>{e.apply(t,i)},Fe={async:!1,always:!1},Ue=(e,t)=>"function"==typeof t?t(e):t,ze=(e,t,i,n)=>{const s=Ae.i++,{hook:a,args:r,stack:o,length:c}=Ae;s===c&&(Ae.length=o.push({}));const p=o[s];if(p.args=r,s===c){const s="function"==typeof i,{async:r,always:o}=(s?n:i)||n||Fe;p.$=s?i(t):Ue(void 0,t),p._=r?Ne.get(a)||Ne.set(a,Me()):Be,p.f=t=>{const i=e(p.$,t);(o||p.$!==i)&&(p.$=i,p._(a,null,p.args))}}return[p.$,p.f]},qe=new WeakMap;function $e({hook:e}){return e===this.hook}const Ve=new WeakMap,We=G(Ve),Ge=()=>{},He=e=>(t,i)=>{const n=Ae.i++,{hook:s,after:a,stack:r,length:o}=Ae;if(n<o){const s=r[n],{update:o,values:c,stop:p}=s;if(!i||i.some(Xe,c)){s.values=i,e&&p(e);const{clean:n}=s;n&&(s.clean=null,n());const r=()=>{s.clean=t()};e?o(r):a.push(r)}}else{const n=e?Me():Ge,o={clean:null,update:n,values:i,stop:Ge};Ae.length=r.push(o),(We.get(s)||We.set(s,[])).push(o);const c=()=>{o.clean=t()};e?o.stop=n(c):a.push(c)}},Ke=e=>{(Ve.get(e)||[]).forEach((e=>{const{clean:t,stop:i}=e;i(),t&&(e.clean=null,t())}))};Ve.has.bind(Ve);const Je=He(!0),Qe=He(!1),Ye=(e,t)=>{const i=Ae.i++,{stack:n,length:s}=Ae;return i===s?Ae.length=n.push({$:e(),_:t}):t&&!t.some(Xe,n[i]._)||(n[i]={$:e(),_:t}),n[i].$};function Xe(e,t){return e!==this[t]}let Ze=null;try{Ze=new{o(){}}.o}catch(Yt){}let et=e=>class extends e{};if(Ze){const{getPrototypeOf:e,setPrototypeOf:t}=Object,{construct:i}="object"==typeof Reflect?Reflect:{construct(e,i,n){const s=[null];for(let e=0;e<i.length;e++)s.push(i[e]);const a=e.bind.apply(e,s);return t(new a,n.prototype)}};et=function(n,s){function a(){return i(s?e(n):n,arguments,a)}return t(a.prototype,n.prototype),t(a,n)}}const tt={map:{},re:null},it=e=>new RegExp(`<(/)?(${e.join("|")})([^A-Za-z0-9:._-])`,"g");let nt=null;const st=(e,t)=>{const{map:i,re:n}=nt||t;return e.replace(n,((e,t,n,s)=>{const{tagName:a,is:r,element:o}=i[n];return o?t?`</${r}>`:`<${r}${s}`:t?`</${a}>`:`<${a} is="${r}"${s}`}))},at=({tagName:e,is:t,element:i})=>i?t:`${e}[is="${t}"]`,rt=()=>nt,ot=e=>{nt=e},ct={useCallback:(e,t)=>Ye((()=>e),t),useContext:e=>{const{hook:t,args:i}=Ae,n=qe.get(e),s={hook:t,args:i};return n.some($e,s)||n.push(s),e.value},useEffect:Je,useLayoutEffect:Qe,useMemo:Ye,useReducer:ze,useRef:e=>{const t=Ae.i++,{stack:i,length:n}=Ae;return t===n&&(Ae.length=i.push({current:e})),i[t]},useState:(e,t)=>ze(Ue,e,void 0,t)},{render:pt,html:dt,svg:lt}=(e=>{const t=_e(we);return xe(e).forEach((i=>{t[i]=e[i](t[i]||("convert"===i?D:String))})),i.prototype=t,Re(i);function i(){return ve.apply(this,arguments)}})({transform:()=>e=>st(e,tt)}),{defineProperties:ut}=Object,mt=new _,ht=new _,ft=new _,gt=new C,vt="attributeChangedCallback",bt="connectedCallback",_t=`dis${bt}`,yt=(e,t,i)=>{if(i in e){const n=e[i];t[i]={configurable:true,value(){return It.call(this),n.apply(this,arguments)}}}else t[i]={configurable:true,value:It}},xt=e=>{const{prototype:t}=e,i=[],n={html:{configurable:true,get:Et},svg:{configurable:true,get:Ot}};if(n["_🔥"]={value:{events:i,info:null}},"handleEvent"in t||(n.handleEvent={configurable:true,value:Dt}),"render"in t&&t.render.length){const{oninit:e}=t;ut(t,{oninit:{configurable:true,value(){const t=(e=>{const t=[];return function i(){const n=Ae,s=[];Ae={hook:i,args:arguments,stack:t,i:0,length:t.length,after:s};try{return e.apply(null,arguments)}finally{Ae=n;for(let e=0,{length:t}=s;e<t;e++)s[e]()}}})(this.render.bind(this,ct));ut(this,{render:{configurable:true,value:t}}),this.addEventListener("disconnected",Ke.bind(null,t),!1),e&&e.apply(this,arguments)}}})}"oninit"in t&&(i.push("init"),yt(t,n,"render")),yt(t,n,vt),yt(t,n,bt),yt(t,n,_t),[[vt,"onattributechanged",jt],[bt,"onconnected",Lt],[_t,"ondisconnected",At],[bt,"render",Mt]].forEach((([e,s,a])=>{if(!(e in t)&&s in t)if("render"!==s&&i.push(s.slice(2)),e in n){const t=n[e].value;n[e]={configurable:true,value(){return t.apply(this,arguments),a.apply(this,arguments)}}}else n[e]={configurable:true,value:a}}));const s=e.booleanAttributes||[];s.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.hasAttribute(e)},set(t){t&&"false"!==t?this.setAttribute(e,t):this.removeAttribute(e)}})}));const a=e.observedAttributes||[];a.forEach((e=>{e in t||(n[e]={configurable:true,get(){return this.getAttribute(e)},set(t){null==t?this.removeAttribute(e):this.setAttribute(e,t)}})}));(e.mappedAttributes||[]).forEach((e=>{const s=new _,a="on"+e in t;a&&i.push(e),n[e]={configurable:true,get(){return s.get(this)},set(t){if(s.set(this,t),a){const i=wt(e);if(i.detail=t,gt.has(this))this.dispatchEvent(i);else{const e=ft.get(this);e?e.push(i):ft.set(this,[i])}}}}})),ut(t,n);const r=s.concat(a);return r.length?ut(e,{observedAttributes:{configurable:true,get:()=>r}}):e},wt=e=>new x(e),St=(...e)=>new Oe("html",e);St.for=dt.for;const Rt=(...e)=>new Oe("svg",e);Rt.for=lt.for;const Ct=(e,t,i)=>{const n=kt(e,t,new _);return i.set(e,n),n},kt=(e,t,i)=>(n,...s)=>{const a=i.get(n)||((e,t,{info:i})=>{const n=i?st(t.join("_🔥"),i).split("_🔥"):t;return e.set(t,n),n})(i,n,e["_🔥"]);return pt(e,(()=>t(a,...s)))};function Tt(e){this.addEventListener(e,this)}function Pt(e){this.dispatchEvent(e)}function Et(){return mt.get(this)||Ct(this,St,mt)}function Ot(){return ht.get(this)||Ct(this,Rt,ht)}function Dt(e){this[`on${e.type}`](e)}function It(){if(!gt.has(this)){gt.add(this),this["_🔥"].events.forEach(Tt,this),this.dispatchEvent(wt("init"));const e=ft.get(this);e&&(ft.delete(this),e.forEach(Pt,this))}}function jt(e,t,i){const n=wt("attributechanged");n.attributeName=e,n.oldValue=t,n.newValue=i,this.dispatchEvent(n)}function Lt(){this.dispatchEvent(wt("connected"))}function Mt(){this.render()}function At(){this.dispatchEvent(wt("disconnected"))}const{create:Nt,defineProperty:Bt,defineProperties:Ft,getOwnPropertyNames:Ut,getOwnPropertySymbols:zt,getOwnPropertyDescriptor:qt,keys:$t}=Object,Vt={element:HTMLElement},Wt=new _;new _;const Gt=new _;new _;const Ht=e=>{const t=Nt(null),i=Nt(null),n={prototype:i,statics:t};return Ut(e).concat(zt(e)).forEach((n=>{const s=qt(e,n);switch(s.enumerable=!1,n){case"extends":n="tagName";case"contains":case"includes":case"name":case"booleanAttributes":case"mappedAttributes":case"observedAttributes":case"style":case"tagName":t[n]=s;break;default:i[n]=s}})),n},Kt=(e,t,i)=>{if(!/^([A-Z][A-Za-z0-9_]*)(<([A-Za-z0-9:._-]+)>|:([A-Za-z0-9:._-]+))?$/.test(e))throw"Invalid name";const{$1:n,$3:s,$4:a}=RegExp;let r=s||a||t.tagName||t.extends||"element";const o="fragment"===r;if(o)r="element";else if(!/^[A-Za-z0-9:._-]+$/.test(r))throw"Invalid tag";let c="",p="";r.indexOf("-")<0?(c=n.replace(/(([A-Z0-9])([A-Z0-9][a-z]))|(([a-z])([A-Z]))/g,"$2$5-$3$6").toLowerCase()+i,c.indexOf("-")<0&&(p="-heresy")):(c=r+i,r="element");const d=c+p;if(customElements.get(d))throw`Duplicated ${d} definition`;const l=et("object"==typeof t?Gt.get(t)||((e,t)=>{const{statics:i,prototype:n}=Ht(e),s=et(Vt[t]||(Vt[t]=document.createElement(t).constructor),!1);return Ft(s.prototype,n),Ft(s,i),Gt.set(e,xt(s)),s})(t,r):Wt.get(t)||(e=>{const t=et(e,!1);return Wt.set(e,xt(t)),t})(t),!0),u="element"===r;if(Bt(l,"new",{value:u?()=>document.createElement(d):()=>document.createElement(r,{is:d})}),Bt(l.prototype,"is",{value:d}),""===i){const e=(e=>{const{length:t}=e;let i=0,n=0;for(;n<t;)i=(i<<5)-i+e.charCodeAt(n++),i&=i;return i.toString(36)})(c.toUpperCase());tt.map[n]=Jt(l,r,d,{id:e,i:0}),tt.re=it($t(tt.map))}if(o){const{render:e}=l.prototype;Bt(l.prototype,"render",{configurable:!0,value(){if(e&&e.apply(this,arguments),this.parentNode){const{firstChild:e}=this;let t=null;if(e){const i=document.createRange();i.setStartBefore(e),i.setEndAfter(this.lastChild),t=i.extractContents(),this.parentNode.replaceChild(t,this)}}}})}const m=[d,l];return u||m.push({extends:r}),customElements.define(...m),{Class:l,is:d,name:n,tagName:r}},Jt=(e,t,i,n)=>{const{prototype:s}=e,a=((e,t)=>({tagName:e,is:t,element:"element"===e}))(t,i),r=[at(a)],o=e.includes||e.contains;if(o){const e={};$t(o).forEach((t=>{const i=`-${n.id}-${n.i++}`,{Class:s,is:a,name:c,tagName:p}=Kt(t,o[t],i);r.push(at(e[c]=Jt(s,p,a,n)))}));const t=it($t(e)),{events:i}=s["_🔥"],a={events:i,info:{map:e,re:t}};if(Bt(s,"_🔥",{value:a}),"render"in s){const{render:e}=s,{info:t}=a;Bt(s,"render",{configurable:!0,value(){const i=rt();ot(t);const n=e.apply(this,arguments);return ot(i),n}})}}return"style"in e&&(e=>{if((e||"").length){const t=document.createElement("style");t.type="text/css",t.styleSheet?t.styleSheet.cssText=e:t.appendChild(document.createTextNode(e));const i=document.head||document.querySelector("head");i.insertBefore(t,i.lastChild)}})(e.style(...r)),a},Qt=["audio","background","cameraaccess","chat","people","embed","emptyRoomInvitation","help","leaveButton","precallReview","screenshare","video","floatSelf","recording","logo","locking","participantCount","settingsButton","pipButton","moreButton","personality","subgridLabels","lowData","breakout"];var Yt,Xt;function Zt(e,t,i,n){return new(i||(i=Promise))((function(s,a){function r(e){try{c(n.next(e))}catch(e){a(e)}}function o(e){try{c(n.throw(e))}catch(e){a(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof i?t:new i((function(e){e(t)}))).then(r,o)}c((n=n.apply(e,t||[])).next())}))}Yt="WherebyEmbed",Xt={oninit(){this.iframe=((e,t)=>e?e[t]||(e[t]={current:null}):{current:null})()},onconnected(){window.addEventListener("message",this.onmessage)},ondisconnected(){window.removeEventListener("message",this.onmessage)},observedAttributes:["displayName","minimal","room","subdomain","lang","metadata","groups","virtualBackgroundUrl","avatarUrl",...Qt].map((e=>e.toLowerCase())),onattributechanged({attributeName:e,oldValue:t}){["room","subdomain"].includes(e)&&null==t||this.render()},style:e=>`\n ${e} {\n display: block;\n }\n ${e} iframe {\n border: none;\n height: 100%;\n width: 100%;\n }\n `,_postCommand(e,t=[]){this.iframe.current&&this.iframe.current.contentWindow.postMessage({command:e,args:t},this.url.origin)},startRecording(){this._postCommand("start_recording")},stopRecording(){this._postCommand("stop_recording")},toggleCamera(e){this._postCommand("toggle_camera",[e])},toggleMicrophone(e){this._postCommand("toggle_microphone",[e])},toggleScreenshare(e){this._postCommand("toggle_screenshare",[e])},onmessage({origin:e,data:t}){if(e!==this.url.origin)return;const{type:i,payload:n}=t;this.dispatchEvent(new CustomEvent(i,{detail:n}))},render(){const{avatarurl:e,displayname:t,lang:i,metadata:n,minimal:s,room:a,groups:r,virtualbackgroundurl:o}=this;if(!a)return this.html`Whereby: Missing room attribute.`;const c=/https:\/\/([^.]+)(\.whereby.com|-ip-\d+-\d+-\d+-\d+.hereby.dev:4443)\/.+/.exec(a),p=c&&c[1]||this.subdomain;if(!p)return this.html`Whereby: Missing subdomain attr.`;if(!c)return this.html`could not parse URL.`;const d=c[2]||".whereby.com";this.url=new URL(a,`https://${p}${d}`);const l=new URL(a);return l.searchParams.get("roomKey")&&this.url.searchParams.append("roomKey",l.searchParams.get("roomKey")),Object.entries(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({jsApi:!0,we:"2.0.0-alpha15",iframeSource:p},t&&{displayName:t}),i&&{lang:i}),n&&{metadata:n}),r&&{groups:r}),o&&{virtualBackgroundUrl:o}),e&&{avatarUrl:e}),null!=s&&{embed:s}),Qt.reduce(((e,t)=>null!=this[t.toLowerCase()]?Object.assign(Object.assign({},e),{[t]:this[t.toLowerCase()]}):e),{}))).forEach((([e,t])=>{this.url.searchParams.has(e)||"string"!=typeof t||this.url.searchParams.set(e,t)})),this.html`
11
11
  <iframe
12
12
  ref=${this.iframe}
13
13
  src=${this.url}
@@ -40,4 +40,4 @@ let Kc;Uc.AwaitQueue=class{constructor(){this.pendingTasks=new Map,this.nextTask
40
40
  * Copyright(c) 2015 Douglas Christopher Wilson
41
41
  * MIT Licensed
42
42
  */
43
- function(e){var t=Nf,i=g.extname,n=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function a(e){if(!e||"string"!=typeof e)return!1;var i=n.exec(e),a=i&&t[i[1].toLowerCase()];return a&&a.charset?a.charset:!(!i||!s.test(i[1]))&&"UTF-8"}e.charset=a,e.charsets={lookup:a},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var n=e.charset(i);n&&(i+="; charset="+n.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=n.exec(t),s=i&&e.extensions[i[1].toLowerCase()];if(!s||!s.length)return!1;return s[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var n=i("x."+t).toLowerCase().substr(1);if(!n)return!1;return e.types[n]||!1},e.types=Object.create(null),function(e,i){var n=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(s){var a=t[s],r=a.extensions;if(r&&r.length){e[s]=r;for(var o=0;o<r.length;o++){var c=r[o];if(i[c]){var p=n.indexOf(t[i[c]].source),d=n.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>d||p===d&&"application/"===i[c].substr(0,12)))continue}i[c]=s}}}))}(e.extensions,e.types)}(Af);var Ff=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)};var Uf=Ff,zf=function(e){var t=!1;return Uf((function(){t=!0})),function(i,n){t?e(i,n):Uf((function(){e(i,n)}))}};var qf=function(e){Object.keys(e.jobs).forEach($f.bind(e)),e.jobs={}};function $f(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Vf=zf,Wf=qf,Gf=function(e,t,i,n){var s=i.keyedList?i.keyedList[i.index]:i.index;i.jobs[s]=function(e,t,i,n){var s;s=2==e.length?e(i,Vf(n)):e(i,t,Vf(n));return s}(t,s,e[s],(function(e,t){s in i.jobs&&(delete i.jobs[s],e?Wf(i):i.results[s]=t,n(e,i.results))}))};var Hf=function(e,t){var i=!Array.isArray(e),n={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&n.keyedList.sort(i?t:function(i,n){return t(e[i],e[n])});return n};var Kf=qf,Jf=zf,Qf=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Kf(this),Jf(e)(null,this.results)};var Yf=Gf,Xf=Hf,Zf=Qf,eg=function(e,t,i){var n=Xf(e);for(;n.index<(n.keyedList||e).length;)Yf(e,t,n,(function(e,t){e?i(e,t):0!==Object.keys(n.jobs).length||i(null,n.results)})),n.index++;return Zf.bind(n,i)};var tg={},ig=Gf,ng=Hf,sg=Qf;function ag(e,t){return e<t?-1:e>t?1:0}({get exports(){return tg},set exports(e){tg=e}}).exports=function(e,t,i,n){var s=ng(e,i);return ig(e,t,s,(function i(a,r){a?n(a,r):(s.index++,s.index<(s.keyedList||e).length?ig(e,t,s,i):n(null,s.results))})),sg.bind(s,n)},tg.ascending=ag,tg.descending=function(e,t){return-1*ag(e,t)};var rg=tg;var og={parallel:eg,serial:function(e,t,i){return rg(e,t,null,i)},serialOrdered:tg},cg=Lf,pg=h,dg=g,lg=n,ug=s,mg=t.parse,hg=e,fg=a.Stream,gg=Af,vg=og,bg=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e},_g=yg;function yg(e){if(!(this instanceof yg))return new yg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],cg.call(this),e=e||{})this[t]=e[t]}function xg(e){return Rf.isPlainObject(e)||Rf.isArray(e)}function wg(e){return Rf.endsWith(e,"[]")?e.slice(0,-2):e}function Sg(e,t,i){return e?e.concat(t).map((function(e,t){return e=wg(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}pg.inherits(yg,cg),yg.LINE_BREAK="\r\n",yg.DEFAULT_CONTENT_TYPE="application/octet-stream",yg.prototype.append=function(e,t,i){"string"==typeof(i=i||{})&&(i={filename:i});var n=cg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),pg.isArray(t))this._error(new Error("Arrays are not supported."));else{var s=this._multiPartHeader(e,t,i),a=this._multiPartFooter();n(s),n(t),n(a),this._trackLength(s,t,i)}},yg.prototype._trackLength=function(e,t,i){var n=0;null!=i.knownLength?n+=+i.knownLength:Buffer.isBuffer(t)?n=t.length:"string"==typeof t&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+yg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof fg)&&(i.knownLength||this._valuesToMeasure.push(t))},yg.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):hg.stat(e.path,(function(i,n){var s;i?t(i):(s=n.size-(e.start?e.start:0),t(null,s))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},yg.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var n,s=this._getContentDisposition(t,i),a=this._getContentType(t,i),r="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof i.header&&bg(o,i.header),o)o.hasOwnProperty(c)&&null!=(n=o[c])&&(Array.isArray(n)||(n=[n]),n.length&&(r+=c+": "+n.join("; ")+yg.LINE_BREAK));return"--"+this.getBoundary()+yg.LINE_BREAK+r+yg.LINE_BREAK},yg.prototype._getContentDisposition=function(e,t){var i,n;return"string"==typeof t.filepath?i=dg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=dg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(i=dg.basename(e.client._httpMessage.path||"")),i&&(n='filename="'+i+'"'),n},yg.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=gg.lookup(e.name)),!i&&e.path&&(i=gg.lookup(e.path)),!i&&e.readable&&e.hasOwnProperty("httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=gg.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=yg.DEFAULT_CONTENT_TYPE),i},yg.prototype._multiPartFooter=function(){return function(e){var t=yg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},yg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+yg.LINE_BREAK},yg.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(i[t.toLowerCase()]=e[t]);return i},yg.prototype.setBoundary=function(e){this._boundary=e},yg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},yg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,n=this._streams.length;i<n;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(yg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},yg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},yg.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},yg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},yg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?vg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,n){i?e(i):(n.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},yg.prototype.submit=function(e,t){var i,n,s={method:"post"};return"string"==typeof e?(e=mg(e),n=bg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(n=bg(e,s)).port||(n.port="https:"==n.protocol?443:80),n.headers=this.getHeaders(e.headers),i="https:"==n.protocol?ug.request(n):lg.request(n),this.getLength(function(e,n){if(e&&"Unknown stream"!==e)this._error(e);else if(n&&i.setHeader("Content-Length",n),this.pipe(i),t){var s,a=function(e,n){return i.removeListener("error",a),i.removeListener("response",s),t.call(this,e,n)};s=a.bind(this,null),i.on("error",a),i.on("response",s)}}.bind(this)),i},yg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},yg.prototype.toString=function(){return"[object FormData]"};const Rg=Rf.toFlatObject(Rf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Cg(e,t,i){if(!Rf.isObject(e))throw new TypeError("target must be an object");t=t||new(_g||FormData);const n=(i=Rf.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Rf.isUndefined(t[e])}))).metaTokens,s=i.visitor||d,a=i.dots,r=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&Rf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!Rf.isFunction(s))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(Rf.isDate(e))return e.toISOString();if(!o&&Rf.isBlob(e))throw new Cf("Blob is not supported. Use a Buffer instead.");return Rf.isArrayBuffer(e)||Rf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,i,s){let o=e;if(e&&!s&&"object"==typeof e)if(Rf.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(Rf.isArray(e)&&function(e){return Rf.isArray(e)&&!e.some(xg)}(e)||Rf.isFileList(e)||Rf.endsWith(i,"[]")&&(o=Rf.toArray(e)))return i=wg(i),o.forEach((function(e,n){!Rf.isUndefined(e)&&null!==e&&t.append(!0===r?Sg([i],n,a):null===r?i:i+"[]",p(e))})),!1;return!!xg(e)||(t.append(Sg(s,i,a),p(e)),!1)}const l=[],u=Object.assign(Rg,{defaultVisitor:d,convertValue:p,isVisitable:xg});if(!Rf.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!Rf.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),Rf.forEach(i,(function(i,a){!0===(!(Rf.isUndefined(i)||null===i)&&s.call(t,i,Rf.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function kg(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Tg(e,t){this._pairs=[],e&&Cg(e,this,t)}const Pg=Tg.prototype;function Eg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Og(e,t,i){if(!t)return e;const n=i&&i.encode||Eg,s=i&&i.serialize;let a;if(a=s?s(t,i):Rf.isURLSearchParams(t)?t.toString():new Tg(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Pg.append=function(e,t){this._pairs.push([e,t])},Pg.toString=function(e){const t=e?function(t){return e.call(this,t,kg)}:kg;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Dg{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Rf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ig={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jg={isNode:!0,classes:{URLSearchParams:t.URLSearchParams,FormData:_g,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Lg(e){function t(e,i,n,s){let a=e[s++];const r=Number.isFinite(+a),o=s>=e.length;if(a=!a&&Rf.isArray(n)?n.length:a,o)return Rf.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&Rf.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],s)&&Rf.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const s=i.length;let a;for(n=0;n<s;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(Rf.isFormData(e)&&Rf.isFunction(e.entries)){const i={};return Rf.forEachEntry(e,((e,n)=>{t(function(e){return Rf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const Mg={"Content-Type":void 0};const Ag={transitional:Ig,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,s=Rf.isObject(e);s&&Rf.isHTMLForm(e)&&(e=new FormData(e));if(Rf.isFormData(e))return n&&n?JSON.stringify(Lg(e)):e;if(Rf.isArrayBuffer(e)||Rf.isBuffer(e)||Rf.isStream(e)||Rf.isFile(e)||Rf.isBlob(e))return e;if(Rf.isArrayBufferView(e))return e.buffer;if(Rf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cg(e,new jg.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return Rf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Rf.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cg(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,i){if(Rf.isString(e))try{return(t||JSON.parse)(e),Rf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ag.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Rf.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Cf.from(e,Cf.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jg.classes.FormData,Blob:jg.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Rf.forEach(["delete","get","head"],(function(e){Ag.headers[e]={}})),Rf.forEach(["post","put","patch"],(function(e){Ag.headers[e]=Rf.merge(Mg)}));const Ng=Rf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Bg=Symbol("internals");function Fg(e){return e&&String(e).trim().toLowerCase()}function Ug(e){return!1===e||null==e?e:Rf.isArray(e)?e.map(Ug):String(e)}function zg(e,t,i,n){return Rf.isFunction(n)?n.call(this,t,i):Rf.isString(t)?Rf.isString(n)?-1!==t.indexOf(n):Rf.isRegExp(n)?n.test(t):void 0:void 0}class qg{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function s(e,t,i){const s=Fg(t);if(!s)throw new Error("header name must be a non-empty string");const a=Rf.findKey(n,s);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=Ug(e))}const a=(e,t)=>Rf.forEach(e,((e,i)=>s(e,i,t)));return Rf.isPlainObject(e)||e instanceof this.constructor?a(e,t):Rf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?a((e=>{const t={};let i,n,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!i||t[i]&&Ng[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t):null!=e&&s(t,e,i),this}get(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(Rf.isFunction(t))return t.call(this,e,i);if(Rf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);return!(!i||t&&!zg(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function s(e){if(e=Fg(e)){const s=Rf.findKey(i,e);!s||t&&!zg(0,i[s],s,t)||(delete i[s],n=!0)}}return Rf.isArray(e)?e.forEach(s):s(e),n}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,i={};return Rf.forEach(this,((n,s)=>{const a=Rf.findKey(i,s);if(a)return t[a]=Ug(n),void delete t[s];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(s):String(s).trim();r!==s&&delete t[s],t[r]=Ug(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Rf.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&Rf.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Bg]=this[Bg]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=Fg(e);t[n]||(!function(e,t){const i=Rf.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,s){return this[n].call(this,t,e,i,s)},configurable:!0})}))}(i,e),t[n]=!0)}return Rf.isArray(e)?e.forEach(n):n(e),this}}function $g(e,t){const i=this||Ag,n=t||i,s=qg.from(n.headers);let a=n.data;return Rf.forEach(e,(function(e){a=e.call(i,a,s.normalize(),t?t.status:void 0)})),s.normalize(),a}function Vg(e){return!(!e||!e.__CANCEL__)}function Wg(e,t,i){Cf.call(this,null==e?"canceled":e,Cf.ERR_CANCELED,t,i),this.name="CanceledError"}function Gg(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new Cf("Request failed with status code "+i.status,[Cf.ERR_BAD_REQUEST,Cf.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Hg(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}qg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),Rf.freezeMethods(qg.prototype),Rf.freezeMethods(qg),Rf.inherits(Wg,Cf,{__CANCEL__:!0});var Kg=t.parse,Jg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Qg=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function Yg(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Xg,Zg=function(e){var t="string"==typeof e?Kg(e):e||{},i=t.protocol,n=t.host,s=t.port;if("string"!=typeof n||!n||"string"!=typeof i)return"";if(i=i.split(":",1)[0],!function(e,t){var i=(Yg("npm_config_no_proxy")||Yg("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var n=i.match(/^(.+):(\d+)$/),s=n?n[1]:i,a=n?parseInt(n[2]):0;return!(!a||a===t)||(/^[.*]/.test(s)?("*"===s.charAt(0)&&(s=s.slice(1)),!Qg.call(e,s)):e!==s)}))}(n=n.replace(/:\d*$/,""),s=parseInt(s)||Jg[i]||0))return"";var a=Yg("npm_config_"+i+"_proxy")||Yg(i+"_proxy")||Yg("npm_config_proxy")||Yg("all_proxy");return a&&-1===a.indexOf("://")&&(a=i+"://"+a),a},ev={},tv={get exports(){return ev},set exports(e){ev=e}},iv=t,nv=iv.URL,sv=n,av=s,rv=a.Writable,ov=u,cv=function(){if(!Xg){try{Xg=jo("follow-redirects")}catch(e){}"function"!=typeof Xg&&(Xg=function(){})}Xg.apply(null,arguments)},pv=["abort","aborted","connect","error","socket","timeout"],dv=Object.create(null);pv.forEach((function(e){dv[e]=function(t,i,n){this._redirectable.emit(e,t,i,n)}}));var lv=xv("ERR_INVALID_URL","Invalid URL",TypeError),uv=xv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),mv=xv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),hv=xv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fv=xv("ERR_STREAM_WRITE_AFTER_END","write after end");function gv(e,t){rv.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var i=this;this._onNativeResponse=function(e){i._processResponse(e)},this._performRequest()}function vv(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(n){var s=n+":",a=i[s]=e[n],r=t[n]=Object.create(a);Object.defineProperties(r,{request:{value:function(e,n,a){if(Sv(e)){var r;try{r=_v(new nv(e))}catch(t){r=iv.parse(e)}if(!Sv(r.protocol))throw new lv({input:e});e=r}else nv&&e instanceof nv?e=_v(e):(a=n,n=e,e={protocol:s});return Rv(n)&&(a=n,n=null),(n=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,n)).nativeProtocols=i,Sv(n.host)||Sv(n.hostname)||(n.hostname="::1"),ov.equal(n.protocol,s,"protocol mismatch"),cv("options",n),new gv(n,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var n=r.request(e,t,i);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function bv(){}function _v(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function yv(e,t){var i;for(var n in t)e.test(n)&&(i=t[n],delete t[n]);return null==i?void 0:String(i).trim()}function xv(e,t,i){function n(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return n.prototype=new(i||Error),n.prototype.constructor=n,n.prototype.name="Error ["+e+"]",n}function wv(e){for(var t of pv)e.removeListener(t,dv[t]);e.on("error",bv),e.abort()}function Sv(e){return"string"==typeof e||e instanceof String}function Rv(e){return"function"==typeof e}gv.prototype=Object.create(rv.prototype),gv.prototype.abort=function(){wv(this._currentRequest),this.emit("abort")},gv.prototype.write=function(e,t,i){if(this._ending)throw new fv;if(!Sv(e)&&("object"!=typeof(n=e)||!("length"in n)))throw new TypeError("data should be a string, Buffer or Uint8Array");var n;Rv(t)&&(i=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,i)):(this.emit("error",new hv),this.abort()):i&&i()},gv.prototype.end=function(e,t,i){if(Rv(e)?(i=e,e=t=null):Rv(t)&&(i=t,t=null),e){var n=this,s=this._currentRequest;this.write(e,t,(function(){n._ended=!0,s.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},gv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},gv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},gv.prototype.setTimeout=function(e,t){var i=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),a()}),e),n(t)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",n),this.on("abort",a),this.on("error",a),this.on("response",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){gv.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(gv.prototype,e,{get:function(){return this._currentRequest[e]}})})),gv.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},gv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(n._redirectable=this,pv))n.on(s,dv[s]);if(this._currentUrl=/^\//.test(this._options.path)?iv.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;!function e(t){if(n===r._currentRequest)if(t)r.emit("error",t);else if(a<o.length){var i=o[a++];n.finished||n.write(i.data,i.encoding,e)}else r._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},gv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i=e.headers.location;if(!i||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(wv(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new mv);else{var n,s=this._options.beforeRedirect;s&&(n=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],yv(/^content-/i,this._options.headers));var r,o=yv(/^host$/i,this._options.headers),c=iv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(i)?this._currentUrl:iv.format(Object.assign(c,{host:p}));try{r=iv.resolve(d,i)}catch(e){return void this.emit("error",new uv({cause:e}))}cv("redirecting to",r),this._isRedirect=!0;var l=iv.parse(r);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){ov(Sv(e)&&Sv(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(l.host,p))&&yv(/^(?:authorization|cookie)$/i,this._options.headers),Rv(s)){var u={headers:e.headers,statusCode:t},m={url:d,method:a,headers:n};try{s(this._options,u,m)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new uv({cause:e}))}}},tv.exports=vv({http:sv,https:av}),ev.wrap=vv;function Cv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const kv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Tv(e,t){e=e||10;const i=new Array(e),n=new Array(e);let s,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=n[r];s||(s=c),i[a]=o,n[a]=c;let d=r,l=0;for(;d!==a;)l+=i[d++],d%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-s<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Pv=Symbol("internals");class Ev extends a.Transform{constructor(e){super({readableHighWaterMark:(e=Rf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Rf.isUndefined(t[e])))).chunkSize});const t=this,i=this[Pv]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},n=Tv(i.ticksRate*e.samplesCount,i.timeWindow);this.on("newListener",(e=>{"progress"===e&&(i.isCaptured||(i.isCaptured=!0))}));let s=0;i.updateProgress=function(e,t){let i=0;const n=1e3/t;let s=null;return function(t,a){const r=Date.now();if(t||r-i>n)return s&&(clearTimeout(s),s=null),i=r,e.apply(null,a);s||(s=setTimeout((()=>(s=null,i=Date.now(),e.apply(null,a))),n-(r-i)))}}((function(){const e=i.length,a=i.bytesSeen,r=a-s;if(!r||t.destroyed)return;const o=n(r);s=a,process.nextTick((()=>{t.emit("progress",{loaded:a,total:e,progress:e?a/e:void 0,bytes:r,rate:o||void 0,estimated:o&&e&&a<=e?(e-a)/o:void 0})}))}),i.ticksRate);const a=()=>{i.updateProgress(!0)};this.once("end",a),this.once("error",a)}_read(e){const t=this[Pv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const n=this,s=this[Pv],a=s.maxRate,r=this.readableHighWaterMark,o=s.timeWindow,c=a/(1e3/o),p=!1!==s.minChunkSize?Math.max(s.minChunkSize,.01*c):0;const d=(e,t)=>{const i=Buffer.byteLength(e);let d,l=null,u=r,m=0;if(a){const e=Date.now();(!s.ts||(m=e-s.ts)>=o)&&(s.ts=e,d=c-s.bytes,s.bytes=d<0?-d:0,m=0),d=c-s.bytes}if(a){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&i>u&&i-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const i=Buffer.byteLength(e);s.bytesSeen+=i,s.bytes+=i,s.isCaptured&&s.updateProgress(),n.push(e)?process.nextTick(t):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,n){if(t)return i(t);n?d(n,e):i(null)}))}setLength(e){return this[Pv].length=+e,this}}const Ov={flush:r.constants.Z_SYNC_FLUSH,finishFlush:r.constants.Z_SYNC_FLUSH},Dv={flush:r.constants.BROTLI_OPERATION_FLUSH,finishFlush:r.constants.BROTLI_OPERATION_FLUSH},Iv=Rf.isFunction(r.createBrotliDecompress),{http:jv,https:Lv}=ev,Mv=/https:?/,Av=jg.protocols.map((e=>e+":"));function Nv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Bv(e,t,i){let n=t;if(!n&&!1!==n){const e=Zg(i);e&&(n=new URL(e))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t,e.host=t,e.port=n.port,e.path=i,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(e){Bv(e,t,e.href)}}var Fv="undefined"!=typeof process&&"process"===Rf.kindOf(process)&&function(e){return new Promise((function(t,i){let o=e.data;const c=e.responseType,p=e.responseEncoding,l=e.method.toUpperCase();let u,m,h,f=!1;const g=new d;function v(){u||(u=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,n){m||(m=!0,n&&(f=!0,v()),n?i(e):t(e))}const _=function(e){b(e)},y=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Wg(null,e,h):t)}g.once("abort",y),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=Hg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==l)return Gg(_,y,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,i){const n=i&&i.Blob||jg.classes.Blob,s=Cv(e);if(void 0===t&&n&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const i=kv.exec(e);if(!i)throw new Cf("Invalid URL",Cf.ERR_INVALID_URL);const a=i[1],r=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),r?"base64":"utf8");if(t){if(!n)throw new Cf("Blob is not supported",Cf.ERR_NOT_SUPPORT);return new n([c],{type:a})}return c}throw new Cf("Unsupported protocol "+s,Cf.ERR_NOT_SUPPORT)}(e.url,"blob"===c,{Blob:e.env&&e.env.Blob})}catch(t){throw Cf.from(t,Cf.ERR_BAD_REQUEST,e)}return"text"===c?(t=t.toString(p),p&&"utf8"!==p||(o=Rf.stripBOM(t))):"stream"===c&&(t=a.Readable.from(t)),Gg(_,y,{data:t,status:200,statusText:"OK",headers:new qg,config:e})}if(-1===Av.indexOf(R))return y(new Cf("Unsupported protocol "+R,Cf.ERR_BAD_REQUEST,e));const C=qg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const k=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(Rf.isFormData(o)&&Rf.isFunction(o.getHeaders))C.set(o.getHeaders());else if(o&&!Rf.isStream(o)){if(Buffer.isBuffer(o));else if(Rf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else{if(!Rf.isString(o))return y(new Cf("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Cf.ERR_BAD_REQUEST,e));o=Buffer.from(o,"utf-8")}if(C.set("Content-Length",o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return y(new Cf("Request body larger than maxBodyLength limit",Cf.ERR_BAD_REQUEST,e))}const D=Rf.toFiniteNumber(C.getContentLength());let I,j;if(Rf.isArray(P)?(E=P[0],O=P[1]):E=O=P,o&&(T||E)&&(Rf.isStream(o)||(o=a.Readable.from(o,{objectMode:!1})),o=a.pipeline([o,new Ev({length:D,maxRate:Rf.toFiniteNumber(E)})],Rf.noop),T&&o.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){I=(e.auth.username||"")+":"+(e.auth.password||"")}if(!I&&S.username){I=S.username+":"+S.password}I&&C.delete("authorization");try{j=Og(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,y(i)}C.set("Accept-Encoding","gzip, compress, deflate"+(Iv?", br":""),!1);const L={path:j,method:l,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:I,protocol:R,beforeRedirect:Nv,beforeRedirects:{}};let M;e.socketPath?L.socketPath=e.socketPath:(L.hostname=S.hostname,L.port=S.port,Bv(L,e.proxy,R+"//"+S.hostname+(S.port?":"+S.port:"")+L.path));const A=Mv.test(L.protocol);if(L.agent=A?e.httpsAgent:e.httpAgent,e.transport?M=e.transport:0===e.maxRedirects?M=A?s:n:(e.maxRedirects&&(L.maxRedirects=e.maxRedirects),e.beforeRedirect&&(L.beforeRedirects.config=e.beforeRedirect),M=A?Lv:jv),e.maxBodyLength>-1?L.maxBodyLength=e.maxBodyLength:L.maxBodyLength=1/0,e.insecureHTTPParser&&(L.insecureHTTPParser=e.insecureHTTPParser),h=M.request(L,(function(t){if(h.destroyed)return;const i=[t],n=+t.headers["content-length"];if(k){const e=new Ev({length:Rf.toFiniteNumber(n),maxRate:Rf.toFiniteNumber(O)});k&&e.on("progress",(e=>{k(Object.assign(e,{download:!0}))})),i.push(e)}let s=t;const o=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==l&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":i.push(r.createUnzip(Ov)),delete t.headers["content-encoding"];break;case"br":Iv&&(i.push(r.createBrotliDecompress(Dv)),delete t.headers["content-encoding"])}s=i.length>1?a.pipeline(i,Rf.noop):i[0];const d=a.finished(s,(()=>{d(),v()})),u={status:t.statusCode,statusText:t.statusMessage,headers:new qg(t.headers),config:e,request:o};if("stream"===c)u.data=s,Gg(_,y,u);else{const t=[];let i=0;s.on("data",(function(n){t.push(n),i+=n.length,e.maxContentLength>-1&&i>e.maxContentLength&&(f=!0,s.destroy(),y(new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o)))})),s.on("aborted",(function(){if(f)return;const t=new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o);s.destroy(t),y(t)})),s.on("error",(function(t){h.destroyed||y(Cf.from(t,null,e,o))})),s.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==c&&(e=e.toString(p),p&&"utf8"!==p||(e=Rf.stripBOM(e))),u.data=e}catch(t){y(Cf.from(t,null,e,u.request,u))}Gg(_,y,u)}))}g.once("abort",(e=>{s.destroyed||(s.emit("error",e),s.destroy())}))})),g.once("abort",(e=>{y(e),h.destroy(e)})),h.on("error",(function(t){y(Cf.from(t,null,e,h))})),h.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void y(new Cf("error trying to parse `config.timeout` to int",Cf.ERR_BAD_OPTION_VALUE,e,h));h.setTimeout(t,(function(){if(m)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),y(new Cf(t,i.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,h)),x()}))}if(Rf.isStream(o)){let t=!1,i=!1;o.on("end",(()=>{t=!0})),o.once("error",(e=>{i=!0,h.destroy(e)})),o.on("close",(()=>{t||i||x(new Wg("Request stream has been aborted",e,h))})),o.pipe(h)}else h.end(o)}))},Uv=jg.isStandardBrowserEnv?{write:function(e,t,i,n,s,a){const r=[];r.push(e+"="+encodeURIComponent(t)),Rf.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),Rf.isString(n)&&r.push("path="+n),Rf.isString(s)&&r.push("domain="+s),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},zv=jg.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function n(i){let n=i;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return i=n(window.location.href),function(e){const t=Rf.isString(e)?n(e):e;return t.protocol===i.protocol&&t.host===i.host}}():function(){return!0};function qv(e,t){let i=0;const n=Tv(50,250);return s=>{const a=s.loaded,r=s.lengthComputable?s.total:void 0,o=a-i,c=n(o);i=a;const p={loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:s};p[t?"download":"upload"]=!0,e(p)}}var $v="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){let n=e.data;const s=qg.from(e.headers).normalize(),a=e.responseType;let r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}Rf.isFormData(n)&&(jg.isStandardBrowserEnv||jg.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+i))}const p=Hg(e.baseURL,e.url);function d(){if(!c)return;const n=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Gg((function(e){t(e),o()}),(function(e){i(e),o()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Og(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(i(new Cf("Request aborted",Cf.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new Cf("Network Error",Cf.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new Cf(t,n.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,c)),c=null},jg.isStandardBrowserEnv){const t=(e.withCredentials||zv(p))&&e.xsrfCookieName&&Uv.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===n&&s.setContentType(null),"setRequestHeader"in c&&Rf.forEach(s.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Rf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",qv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",qv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(r=t=>{c&&(i(!t||t.type?new Wg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r)));const l=Cv(p);l&&-1===jg.protocols.indexOf(l)?i(new Cf("Unsupported protocol "+l+":",Cf.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const Vv={http:Fv,xhr:$v};Rf.forEach(Vv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Wv=e=>{e=Rf.isArray(e)?e:[e];const{length:t}=e;let i,n;for(let s=0;s<t&&(i=e[s],!(n=Rf.isString(i)?Vv[i.toLowerCase()]:i));s++);if(!n){if(!1===n)throw new Cf(`Adapter ${i} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Rf.hasOwnProp(Vv,i)?`Adapter '${i}' is not available in the build`:`Unknown adapter '${i}'`)}if(!Rf.isFunction(n))throw new TypeError("adapter is not a function");return n};function Gv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Hv(e){Gv(e),e.headers=qg.from(e.headers),e.data=$g.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Wv(e.adapter||Ag.adapter)(e).then((function(t){return Gv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Gv(e),t&&t.response&&(t.response.data=$g.call(e,e.transformResponse,t.response),t.response.headers=qg.from(t.response.headers))),Promise.reject(t)}))}const Kv=e=>e instanceof qg?e.toJSON():e;function Jv(e,t){t=t||{};const i={};function n(e,t,i){return Rf.isPlainObject(e)&&Rf.isPlainObject(t)?Rf.merge.call({caseless:i},e,t):Rf.isPlainObject(t)?Rf.merge({},t):Rf.isArray(t)?t.slice():t}function s(e,t,i){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e,i):n(e,t,i)}function a(e,t){if(!Rf.isUndefined(t))return n(void 0,t)}function r(e,t){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function o(i,s,a){return a in t?n(i,s):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>s(Kv(e),Kv(t),!0)};return Rf.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const a=c[n]||s,r=a(e[n],t[n],n);Rf.isUndefined(r)&&a!==o||(i[n]=r)})),i}const Qv={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Qv[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Yv={};Qv.transitional=function(e,t,i){function n(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,a)=>{if(!1===e)throw new Cf(n(s," has been removed"+(t?" in "+t:"")),Cf.ERR_DEPRECATED);return t&&!Yv[s]&&(Yv[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,a)}};var Xv={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Cf("options must be an object",Cf.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const a=n[s],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Cf("option "+a+" must be "+i,Cf.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Cf("Unknown option "+a,Cf.ERR_BAD_OPTION)}},validators:Qv};const Zv=Xv.validators;class eb{constructor(e){this.defaults=e,this.interceptors={request:new Dg,response:new Dg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jv(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:s}=t;let a;void 0!==i&&Xv.assertOptions(i,{silentJSONParsing:Zv.transitional(Zv.boolean),forcedJSONParsing:Zv.transitional(Zv.boolean),clarifyTimeoutError:Zv.transitional(Zv.boolean)},!1),void 0!==n&&Xv.assertOptions(n,{encode:Zv.function,serialize:Zv.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=s&&Rf.merge(s.common,s[t.method]),a&&Rf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=qg.concat(a,s);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!o){const e=[Hv.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=r.length;let u=t;for(l=0;l<d;){const e=r[l++],t=r[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Hv.call(this,u)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)p=p.then(c[l++],c[l++]);return p}getUri(e){return Og(Hg((e=Jv(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Rf.forEach(["delete","get","head","options"],(function(e){eb.prototype[e]=function(t,i){return this.request(Jv(i||{},{method:e,url:t,data:(i||{}).data}))}})),Rf.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,s){return this.request(Jv(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}eb.prototype[e]=t(),eb.prototype[e+"Form"]=t(!0)}));class tb{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,s){i.reason||(i.reason=new Wg(e,n,s),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new tb((function(t){e=t})),cancel:e}}}const ib={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ib).forEach((([e,t])=>{ib[t]=e}));const nb=function e(t){const i=new eb(t),n=Kh(eb.prototype.request,i);return Rf.extend(n,eb.prototype,i,{allOwnKeys:!0}),Rf.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(Jv(t,i))},n}(Ag);nb.Axios=eb,nb.CanceledError=Wg,nb.CancelToken=tb,nb.isCancel=Vg,nb.VERSION="1.2.3",nb.toFormData=Cg,nb.AxiosError=Cf,nb.Cancel=nb.CanceledError,nb.all=function(e){return Promise.all(e)},nb.spread=function(e){return function(t){return e.apply(null,t)}},nb.isAxiosError=function(e){return Rf.isObject(e)&&!0===e.isAxiosError},nb.mergeConfig=Jv,nb.AxiosHeaders=qg,nb.formToJSON=e=>Lg(Rf.isHTMLForm(e)?new FormData(e):e),nb.HttpStatusCode=ib,nb.default=nb;class sb{constructor(e={}){this.data=void 0===e.data?{}:e.data,this.headers=e.headers||{},this.status=e.status||200,this.statusText=e.statusText||"OK",this.url=e.url||null}}function ab(e,t){return u.ok(e,`${t} is required`),e}function rb(e,t){return u.ok("boolean"==typeof e,`${t}<boolean> is required`),e}function ob(e,t){return u.ok("number"==typeof e,`${t}<number> is required`),e}function cb(e,t){return u.ok("string"==typeof e,`${t}<string> is required`),e}function pb(e,t,i){const n=i||t.name[0].toLowerCase()+t.name.substring(1);return u.ok(e instanceof t,`${n}<${t.name}> is required`),e}function db(e,t="roomName"){return cb(e,t),u.equal("string"==typeof e&&e[0],"/",`${t} must begin with a '/'`),e}function lb(e,t){return u.ok(Array.isArray(e),`${t}<array> is required`),e}function ub(e,t){if(null==e||"object"!=typeof e||Array.isArray(e))throw new Error(`${t} must be a record. ${JSON.stringify(e)}`);return e}function mb(e,t,i){cb(t,"name"),function(e,t,i,n){cb(i,"name");const s=n||`${i} must be null or of type ${t}`;u.ok(null===e||typeof e===t,s)}(e,"string",t,i)}function hb({baseUrl:e,url:t}){return u.ok("string"==typeof t,"url<String> is required"),e?e+t:t}class fb{constructor({baseUrl:e}){cb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const i=Object.assign({},t,{url:e,baseURL:this._baseUrl});return nb.request(i)}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this._requestAxios(e,t).then((e=>{const{data:t,headers:i,status:n,statusText:s,config:a}=e,r=a&&a.url?hb({baseUrl:a.baseURL,url:a.url}):null;return new sb({data:t,headers:i,status:n,statusText:s,url:r})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:i,headers:n,status:s,statusText:a,config:r}=t,o=r&&r.url?hb({baseUrl:r.baseURL,url:r.url}):null;return Promise.reject(new sb({data:i,headers:n,status:s,statusText:a,url:o}))}))}}class gb{constructor({httpClient:e}){u.ok(e,"httpClient is required"),this._httpClient=e}static dataToFormData(e){u.ok(e,"data is required");const t=new FormData;return Object.keys(e).forEach((i=>{const n=e[i];t.append(i,n)})),t}request(e,t={}){const i=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:i,transformRequest:gb.dataToFormData}))}}let vb;vb="object"==typeof window?window.btoa||Hh:"object"==typeof global&&global.btoa||Hh;const bb=()=>Promise.resolve(null);class _b{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((i=>{const n=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${vb(t)}`}}return{}}(i),{"X-Appearin-Device-Platform":"web"}),s=Object.assign({},t,{headers:n});return this._httpClient.request(e,s)}))}}class yb{constructor({baseUrl:e="https://api.appearin.net",fetchDeviceCredentials:t=bb}={}){cb(e,"baseUrl"),u.ok("function"==typeof t,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new _b({httpClient:new fb({baseUrl:e}),fetchDeviceCredentials:t}),this.authenticatedFormDataHttpClient=new gb({httpClient:this.authenticatedHttpClient})}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedHttpClient.request(e,t)}requestMultipart(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedFormDataHttpClient.request(e,t)}}function xb(e,t){return cb(ub(e,"data")[t],t)}const wb=(Sb=xb,(e,t)=>{const i=ub(e,"data")[t];return null==i?null:Sb(e,t)});var Sb;function Rb(e,t){const i=xb(e,t),n=new Date(i);if(isNaN(n.getTime()))throw new Error(`Invalid date for ${i}`);return n}function Cb(e,t,i){return function(e,t){return lb(ub(e,"data")[t],t)}(e,t).map((e=>i(e)))}class kb{constructor(e,t,i){this.credentials={uuid:e},this.hmac=t,this.userId=i}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new kb(xb(function(e,t){const i=ub(e,"data")[t];return void 0===i?null:i}(e,"credentials"),"uuid"),xb(e,"hmac"),wb(e,"userId")||void 0)}}class Tb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>kb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Pb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(i=>{t(i[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Eb{constructor(e,t){ab(t,"localStorage"),this._key=cb(e,"key"),this._localStorage=t}loadOrDefault(e){try{const t=this._localStorage.getItem(this._key);if(t)try{return Promise.resolve(JSON.parse(t))}catch(e){}return Promise.resolve(e)}catch(t){return console.warn("Error getting access to storage. Are cookies blocked?",t),Promise.resolve(e)}}save(e){try{return this._localStorage.setItem(this._key,JSON.stringify(e)),Promise.resolve()}catch(e){return console.warn("Error getting access to storage. Are cookies blocked?",e),Promise.reject(e)}}}let Ob;try{Ob=self.localStorage}catch(e){Ob={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Db=Ob;const Ib="credentials_saved";class jb extends d{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=pb(e,Tb),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:i="localStorage"}){const n=new Tb({apiClient:new yb({baseUrl:e})});let s=null;if("localStorage"===i)s=new Eb(t,Db);else{if("chromeStorage"!==i)throw new Error(`Unknown store type: ${i}`);s=new Pb(t,window.chrome.storage.local)}return new jb({deviceService:n,credentialsStore:s})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const i=()=>{this._deviceService.getCredentials().then((i=>e.save(i?i.toJson():null).then((()=>t(i))))).catch((()=>{setTimeout(i,2e3)}))};i()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?kb.fromJson(e):null))}getCredentials(){return this.credentialsPromise||(this.credentialsPromise=this.getCurrentCredentials().then((e=>e||this._fetchNewCredentialsFromApi()))),this.credentialsPromise}saveCredentials(e){return this.credentialsPromise=void 0,this._credentialsStore.save(e.toJson()).then((()=>(this.emit(Ib,e),e)))}setUserId(e){return this.getCurrentCredentials().then((t=>{t||console.error("Illegal state: no credentials to set user id for.");if(null===t||t.userId!==e)return this._credentialsStore.save(Object.assign({},null==t?void 0:t.toJson(),{userId:e}))})).then((()=>{}))}}const Lb=()=>Promise.resolve(void 0);class Mb{constructor({apiClient:e,fetchOrganization:t=Lb}){this._apiClient=pb(e,yb),u.ok("function"==typeof t,"fetchOrganization<Function> is required"),this._fetchOrganization=t,this._apiClient=e}_callRequestMethod(e,t,i){return cb(t,"url"),u.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(i,"options are required"),this._fetchOrganization().then((n=>{if(!n)return this._apiClient[e](t,i);const{organizationId:s}=n;return this._apiClient[e](`/organizations/${encodeURIComponent(s)}${t}`,i)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class Ab{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:i,totalMinutesUsed:n}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=i,this.totalMinutesUsed=n}static fromJson(e){return new Ab({isExhausted:rb(e.isExhausted,"isExhausted"),renewsAt:new Date(cb(e.renewsAt,"renewsAt")),totalMinutesLimit:ob(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:ob(e.totalMinutesUsed,"totalMinutesUsed")})}}class Nb{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:i,isOnTrial:n,onTrialUntil:s,trialStatus:a}){this.basePlanId=e,this.isDeactivated=i,this.isOnTrial=n,this.onTrialUntil=s||null,this.trialStatus=a||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new Nb({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:rb(e.isDeactivated,"isDeactivated"),isOnTrial:rb(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?Ab.fromJson(e.embeddedFreeTierStatus):null})}}function Bb(e){return null!=e}function Fb(e={}){return{maxNumberOfInvitationsAndUsers:Bb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Bb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Bb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Bb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Bb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Ub{constructor(e){this.logoImageUrl=null,this.roomBackgroundImageUrl=null,this.roomBackgroundThumbnailUrl=null,this.roomKnockPageBackgroundImageUrl=null,this.roomKnockPageBackgroundThumbnailUrl=null,this.preferences=null,this.onboardingSurvey=null,this.type=null,pb(e,Object,"properties"),cb(e.organizationId,"organizationId"),cb(e.organizationName,"organizationName"),cb(e.subdomain,"subdomain"),pb(e.permissions,Object,"permissions"),pb(e.limits,Object,"limits"),this.organizationId=e.organizationId,this.organizationName=e.organizationName,this.subdomain=e.subdomain,this.permissions=e.permissions,this.limits=e.limits,this.account=e.account?new Nb(e.account):null,this.logoImageUrl=e.logoImageUrl,this.roomBackgroundImageUrl=e.roomBackgroundImageUrl,this.roomBackgroundThumbnailUrl=e.roomBackgroundThumbnailUrl,this.roomKnockPageBackgroundImageUrl=e.roomKnockPageBackgroundImageUrl,this.roomKnockPageBackgroundThumbnailUrl=e.roomKnockPageBackgroundThumbnailUrl,this.preferences=e.preferences,this.onboardingSurvey=e.onboardingSurvey,this.type=e.type}static fromJson(e){const t=pb(e,Object,"data"),i=(null==t?void 0:t.preferences)||{},n=(null==t?void 0:t.onboardingSurvey)||null,s=pb(t.permissions,Object,"permissions");return new Ub({organizationId:cb(t.organizationId,"organizationId"),organizationName:cb(t.organizationName,"organizationName"),subdomain:cb(t.subdomain,"subdomain"),permissions:s,limits:Fb(pb(t.limits,Object,"limits")),account:t.account?Nb.fromJson(t.account):null,logoImageUrl:"string"==typeof t.logoImageUrl?t.logoImageUrl:null,roomBackgroundImageUrl:"string"==typeof t.roomBackgroundImageUrl?t.roomBackgroundImageUrl:null,roomBackgroundThumbnailUrl:"string"==typeof t.roomBackgroundThumbnailUrl?t.roomBackgroundThumbnailUrl:null,roomKnockPageBackgroundImageUrl:"string"==typeof t.roomKnockPageBackgroundImageUrl?t.roomKnockPageBackgroundImageUrl:null,roomKnockPageBackgroundThumbnailUrl:"string"==typeof t.roomKnockPageBackgroundThumbnailUrl?t.roomKnockPageBackgroundThumbnailUrl:null,preferences:i,onboardingSurvey:n,type:"string"==typeof t.type?t.type:null})}}Ub.GLOBAL_ORGANIZATION_ID="1";class zb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}createOrganization({organizationName:e,subdomain:t,owner:i}){const{displayName:n,consents:s}=i||{},a="email"in i?{value:i.email,verificationCode:cb(i.verificationCode,"owner.verificationCode")}:null,r="idToken"in i?i.idToken:null;if(cb(t,"subdomain"),cb(e,"organizationName"),cb(n,"owner.displayName"),u.ok(a||r,"owner.email or owner.idToken is required"),s){lb(s,"consents");for(const{consentRevisionId:e,action:t}of s)cb(e,"consentRevisionId"),mb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:e,type:"private",subdomain:t,owner:Object.assign(Object.assign(Object.assign(Object.assign({},a&&{email:a}),r&&{idToken:r}),s&&{consents:s}),{displayName:n})}}).then((({data:e})=>xb(e,"organizationId")))}getOrganizationBySubdomain(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return cb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(e){const{code:t}=e,i="email"in e?e.email:null,n="phoneNumber"in e?e.phoneNumber:null;u.ok((i||n)&&!(i&&n),"either email or phoneNumber is required"),cb(t,"code");const s=i?{type:"email",value:i}:{type:"phoneNumber",value:n};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:s,code:t}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return cb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getSubdomainAvailability(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(pb(e,Object,"data"),{status:xb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return ab(e,"organizationId"),ab(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return ab(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class qb{constructor({organizationService:e,subdomain:t}){pb(e,zb),cb(t,"subdomain"),this._organizationService=e,this._subdomain=t,this._organizationPromise=null}initOrganization(){return this.fetchOrganization().then((()=>{}))}fetchOrganization(){return this._organizationPromise||(this._organizationPromise=this._organizationService.getOrganizationBySubdomain(this._subdomain)),this._organizationPromise}}class $b{constructor(e={}){u.ok(e instanceof Object,"properties<object> must be empty or an object"),this.isClaimed=!1,this.isBanned=!1,this.isLocked=!1,this.knockPage={backgroundImageUrl:null,backgroundThumbnailUrl:null},this.logoUrl=null,this.backgroundImageUrl=null,this.backgroundThumbnailUrl=null,this.type=null,this.legacyRoomType=null,this.mode=null,this.product=null,this.roomName=null,this.theme=null,this.preferences={},this.protectedPreferences={},this.publicProfile=null;const t={};Object.getOwnPropertyNames(e).forEach((i=>{-1!==Object.getOwnPropertyNames(this).indexOf(i)&&(t[i]=e[i])})),void 0!==e.ownerId&&(this.ownerId=e.ownerId),void 0!==e.meeting&&(this.meeting=e.meeting),Object.assign(this,t)}}class Vb{constructor({meetingId:e,roomName:t,roomUrl:i,startDate:n,endDate:s,hostRoomUrl:a,viewerRoomUrl:r}){cb(e,"meetingId"),cb(t,"roomName"),cb(i,"roomUrl"),pb(n,Date,"startDate"),pb(s,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=i,this.startDate=n,this.endDate=s,this.hostRoomUrl=a,this.viewerRoomUrl=r}static fromJson(e){return new Vb({meetingId:xb(e,"meetingId"),roomName:xb(e,"roomName"),roomUrl:xb(e,"roomUrl"),startDate:Rb(e,"startDate"),endDate:Rb(e,"endDate"),hostRoomUrl:wb(e,"hostRoomUrl"),viewerRoomUrl:wb(e,"viewerRoomUrl")})}}function Wb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Gb{constructor({organizationApiClient:e}){this._organizationApiClient=pb(e,Mb)}getRooms({types:e,fields:t=[]}={}){return lb(e,"types"),lb(t,"fields"),this._organizationApiClient.request("/room",{method:"GET",params:{types:e.join(","),fields:t.join(","),includeOnlyLegacyRoomType:"false"}}).then((({data:e})=>e.rooms.map((e=>new $b(e)))))}getRoom({roomName:e,fields:t}){db(e);const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${i}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new $b(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Vb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new $b({roomName:e,isClaimed:!1,mode:"normal",product:{categoryName:"personal_free"},type:"personal",legacyRoomType:"free"});if(400===t.status&&"Banned room"===t.data.error)return new $b({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:i,isLocked:n}){return db(e),cb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof i&&{mode:i}),"boolean"==typeof n&&{isLocked:n})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){db(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){db(e),cb(t,"newRoomName");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){db(e),cb(t,"mode");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return db(e),this._organizationApiClient.request(Wb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:i}=e.data;return{permissions:t,limits:i}}))}getRoomMetrics({roomName:e,metrics:t,from:i,to:n}){return db(e),cb(t,"metrics"),this._organizationApiClient.request(Wb(e,"/metrics"),{method:"GET",params:{metrics:t,from:i,to:n}}).then((e=>e.data))}changeType({roomName:e,type:t}){db(e),function(e,t,i){if(ab(e,"value"),lb(t,"allowedValues"),!t.includes(e))throw new Error(`${i}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return db(e),ob(t,"count"),this._organizationApiClient.request(Wb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Hb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=i,this.isAudioEnabled=n,this.isVideoEnabled=s}}class Kb extends Hb{constructor({displayName:e,id:t,newJoiner:i,streams:n,isAudioEnabled:s,isVideoEnabled:a}){super({displayName:e,id:t,isAudioEnabled:s,isVideoEnabled:a}),this.newJoiner=i,this.streams=n.map((e=>({id:e,state:i?"new_accept":"to_accept"})))}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Hb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){super({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}),this.isLocalParticipant=!0}}const Qb=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"];const Zb=()=>{},e_=EventTarget;class t_ extends e_{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:n,logger:s,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.roomUrl=new URL(e);const r=new URLSearchParams(this.roomUrl.search);this._roomKey=a||r.get("roomKey"),this.roomName=this.roomUrl.pathname,this.logger=s||{debug:Zb,error:Zb,log:Zb,warn:Zb},this.displayName=t,this.localMediaConstraints=n;const o=Gh({host:this.roomUrl.host});if(i)this.localMedia=i;else{if(!n)throw new Error("Missing constraints");this.localMedia=new fi(n),this._ownsLocalMedia=!0}this.credentialsService=jb.create({baseUrl:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),this.organizationService=new zb({apiClient:this.apiClient}),this.organizationServiceCache=new qb({organizationService:this.organizationService,subdomain:o.subdomain}),this.organizationApiClient=new Mb({apiClient:this.apiClient,fetchOrganization:()=>Zt(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Gb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,host:i,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4,withCredentials:!0})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("chat_message",this._handleNewChatMessage.bind(this)),this.signalSocket.on("client_left",this._handleClientLeft.bind(this)),this.signalSocket.on("audio_enabled",this._handleClientAudioEnabled.bind(this)),this.signalSocket.on("video_enabled",this._handleClientVideoEnabled.bind(this)),this.signalSocket.on("client_metadata_received",this._handleClientMetadataReceived.bind(this)),this.signalSocket.on("knock_handled",this._handleKnockHandled.bind(this)),this.signalSocket.on("knocker_left",this._handleKnockerLeft.bind(this)),this.signalSocket.on("room_joined",this._handleRoomJoined.bind(this)),this.signalSocket.on("room_knocked",this._handleRoomKnocked.bind(this)),this.localMedia.addEventListener("camera_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_video",{enabled:t})})),this.localMedia.addEventListener("microphone_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_audio",{enabled:t})}));const c={getMediaConstraints:()=>({audio:this.localMedia.isMicrophoneEnabled(),video:this.localMedia.isCameraEnabled()}),deferrable:e=>!e};this.rtcManagerDispatcher=new Vh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleNewClient({client:e}){if(Xb.includes(e.role.roleName))return;const t=new Kb(Object.assign(Object.assign({},e),{newJoiner:!0}));this.remoteParticipants=[...this.remoteParticipants,t],this._handleAcceptStreams([t]),this.dispatchEvent(new CustomEvent("participant_joined",{detail:{remoteParticipant:t}}))}_handleClientLeft({clientId:e}){const t=this.remoteParticipants.find((t=>t.id===e));this.remoteParticipants=this.remoteParticipants.filter((t=>t.id!==e)),t&&this.dispatchEvent(new CustomEvent("participant_left",{detail:{participantId:t.id}}))}_handleClientAudioEnabled({clientId:e,isAudioEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:i.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:i.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:i.id,displayName:t}}))}_handleKnockHandled(e){const{resolution:t}=e;"accepted"===t?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===t&&(this.roomConnectionStatus="rejected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})))}_handleKnockerLeft(e){const{clientId:t}=e;this.dispatchEvent(new CustomEvent("waiting_participant_left",{detail:{participantId:t}}))}_handleRoomJoined(e){const{error:t,isLocked:i,room:n,selfId:s}=e;if("room_locked"===t&&i)return this.roomConnectionStatus="room_locked",void this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));if(n){const{clients:e,knockers:t}=n,i=e.find((e=>e.id===s));if(!i)throw new Error("Missing local client");this.localParticipant=new Jb(Object.assign(Object.assign({},i),{stream:this.localMedia.stream||void 0})),this.remoteParticipants=e.filter((e=>e.id!==s)).map((e=>new Kb(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.roomConnectionStatus="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants,waitingParticipants:t.map((e=>({id:e.clientId,displayName:e.displayName})))}}))}}_handleRoomKnocked(e){const{clientId:t,displayName:i}=e;this.dispatchEvent(new CustomEvent("waiting_participant_joined",{detail:{participantId:t,displayName:i}}))}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t;this.rtcManager=e,this.localMedia.addRtcManager(e),this.localMedia.stream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localMedia.stream,!this.localMedia.isMicrophoneEnabled(),!this.localMedia.isCameraEnabled())),this.remoteParticipants.length&&this._handleAcceptStreams(this.remoteParticipants)}_handleAcceptStreams(e){var t,i;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const n=null===(i=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===i?void 0:i.call(t);e.forEach((e=>{const{id:t,streams:i,newJoiner:s}=e;i.forEach((i=>{var a,r;const{id:o,state:c}=i;let p;if("done_accept"!==c&&(p=(s&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&n||"old_accept"===p&&!n)this.logger.log(`Accepting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.acceptNewStream({streamId:"0"===o?t:o,clientId:t,shouldAddLocalVideo:"0"===o,activeBreakout:false});else if("new_accept"===p||"old_accept"===p);else if("to_unaccept"===p)this.logger.log(`Disconnecting stream ${o} from ${t}`),null===(r=this.rtcManager)||void 0===r||r.disconnect("0"===o?t:o,false);else if("done_accept"!==p)return void this.logger.warn(`Stream state not handled: ${p} for ${t}-${o}`);e.updateStreamState(o,c.replace(/to_|new_|old_/,"done_"))}}))}))}_handleStreamAdded({clientId:e,stream:t,streamId:i}){this.remoteParticipants.find((t=>t.id===e))?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:i}})):this.logger.log("WARN: Could not find participant for incoming stream")}_joinRoom(){this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:this.localMedia.isMicrophoneEnabled(),isVideoEnabled:this.localMedia.isCameraEnabled()},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:this.organizationId,roomKey:this.roomKey,roomName:this.roomName,selfId:"",userAgent:`browser-sdk:${r_}`})}join(){return Zt(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionStatus))return void console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);this.logger.log("Joining room"),this.signalSocket.connect(),this.roomConnectionStatus="connecting",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");this.organizationId=e.organizationId,this._ownsLocalMedia&&(yield this.localMedia.start());const t=yield this.credentialsService.getCredentials();this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:t}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}))}knock(){this.roomConnectionStatus="knocking",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})),this.signalSocket.emit("knock_room",{displayName:this.displayName,imageUrl:null,kickFromOtherRooms:!0,liveVideo:!1,organizationId:this.organizationId,roomKey:this._roomKey,roomName:this.roomName})}leave(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}sendChatMessage(e){this.signalSocket.emit("chat_message",{text:e})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}acceptWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"accept",clientId:e,response:{}})}rejectWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"reject",clientId:e,response:{}})}}const i_={chatMessages:[],roomConnectionStatus:"",isJoining:!1,joinError:null,mostRecentChatMessage:null,remoteParticipants:[],waitingParticipants:[]};function n_(e,t,i){const n=e.find((e=>e.id===t));if(!n)return e;const s=e.indexOf(n);return[...e.slice(0,s),Object.assign(Object.assign({},n),i),...e.slice(s+1)]}function s_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,waitingParticipants:t.payload.waitingParticipants,roomConnectionStatus:"connected"});case"ROOM_CONNECTION_STATUS_CHANGED":return Object.assign(Object.assign({},e),{roomConnectionStatus:t.payload.roomConnectionStatus});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{isAudioEnabled:t.payload.isAudioEnabled})});case"PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants,t.payload.paritipant]});case"PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.filter((e=>e.id!==t.payload.participantId))]});case"PARTICIPANT_STREAM_ADDED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{isVideoEnabled:t.payload.isVideoEnabled})});case"PARTICIPANT_METADATA_CHANGED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.map((e=>e.id===t.payload.participantId?Object.assign(Object.assign({},e),{displayName:t.payload.displayName}):e))]});case"LOCAL_CLIENT_DISPLAY_NAME_CHANGED":return e.localParticipant?Object.assign(Object.assign({},e),{localParticipant:Object.assign(Object.assign({},e.localParticipant),{displayName:t.payload.displayName})}):e;case"WAITING_PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{waitingParticipants:[...e.waitingParticipants,{id:t.payload.participantId,displayName:t.payload.displayName}]});case"WAITING_PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{waitingParticipants:e.waitingParticipants.filter((e=>e.id!==t.payload.participantId))});default:throw e}}function a_(e,t){const[i]=si.useState((()=>{var i;return new t_(e,Object.assign(Object.assign({},t),{localMedia:(null===(i=null==t?void 0:t.localMedia)||void 0===i?void 0:i._ref)||void 0}))})),[n,s]=si.useReducer(s_,i_);return si.useEffect((()=>(i.addEventListener("chat_message",(e=>{const t=e.detail;s({type:"CHAT_MESSAGE",payload:t})})),i.addEventListener("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:i}=e.detail;s({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:i}})})),i.addEventListener("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;s({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),i.addEventListener("participant_left",(e=>{const{participantId:t}=e.detail;s({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),i.addEventListener("participant_stream_added",(e=>{const{participantId:t,stream:i}=e.detail;s({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:i}})})),i.addEventListener("room_connection_status_changed",(e=>{const{roomConnectionStatus:t}=e.detail;s({type:"ROOM_CONNECTION_STATUS_CHANGED",payload:{roomConnectionStatus:t}})})),i.addEventListener("room_joined",(e=>{const{localParticipant:t,remoteParticipants:i,waitingParticipants:n}=e.detail;s({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:i,waitingParticipants:n}})})),i.addEventListener("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:i}=e.detail;s({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:i}})})),i.addEventListener("participant_metadata_changed",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:i}})})),i.addEventListener("waiting_participant_joined",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"WAITING_PARTICIPANT_JOINED",payload:{participantId:t,displayName:i}})})),i.addEventListener("waiting_participant_left",(e=>{const{participantId:t}=e.detail;s({type:"WAITING_PARTICIPANT_LEFT",payload:{participantId:t}})})),i.join(),()=>{i.leave()})),[]),{state:n,actions:{knock:()=>{i.knock()},sendChatMessage:e=>{i.sendChatMessage(e)},setDisplayName:e=>{i.setDisplayName(e),s({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})},toggleCamera:e=>{i.localMedia.toggleCameraEnabled(e)},toggleMicrophone:e=>{i.localMedia.toggleMichrophoneEnabled(e)},acceptWaitingParticipant:e=>{i.acceptWaitingParticipant(e)},rejectWaitingParticipant:e=>{i.rejectWaitingParticipant(e)}},components:{VideoView:mi},_ref:i}}const r_="2.0.0-alpha13";export{mi as VideoView,r_ as sdkVersion,bi as useLocalMedia,a_ as useRoomConnection};
43
+ function(e){var t=Nf,i=g.extname,n=/^\s*([^;\s]*)(?:;|\s|$)/,s=/^text\//i;function a(e){if(!e||"string"!=typeof e)return!1;var i=n.exec(e),a=i&&t[i[1].toLowerCase()];return a&&a.charset?a.charset:!(!i||!s.test(i[1]))&&"UTF-8"}e.charset=a,e.charsets={lookup:a},e.contentType=function(t){if(!t||"string"!=typeof t)return!1;var i=-1===t.indexOf("/")?e.lookup(t):t;if(!i)return!1;if(-1===i.indexOf("charset")){var n=e.charset(i);n&&(i+="; charset="+n.toLowerCase())}return i},e.extension=function(t){if(!t||"string"!=typeof t)return!1;var i=n.exec(t),s=i&&e.extensions[i[1].toLowerCase()];if(!s||!s.length)return!1;return s[0]},e.extensions=Object.create(null),e.lookup=function(t){if(!t||"string"!=typeof t)return!1;var n=i("x."+t).toLowerCase().substr(1);if(!n)return!1;return e.types[n]||!1},e.types=Object.create(null),function(e,i){var n=["nginx","apache",void 0,"iana"];Object.keys(t).forEach((function(s){var a=t[s],r=a.extensions;if(r&&r.length){e[s]=r;for(var o=0;o<r.length;o++){var c=r[o];if(i[c]){var p=n.indexOf(t[i[c]].source),d=n.indexOf(a.source);if("application/octet-stream"!==i[c]&&(p>d||p===d&&"application/"===i[c].substr(0,12)))continue}i[c]=s}}}))}(e.extensions,e.types)}(Af);var Ff=function(e){var t="function"==typeof setImmediate?setImmediate:"object"==typeof process&&"function"==typeof process.nextTick?process.nextTick:null;t?t(e):setTimeout(e,0)};var Uf=Ff,zf=function(e){var t=!1;return Uf((function(){t=!0})),function(i,n){t?e(i,n):Uf((function(){e(i,n)}))}};var qf=function(e){Object.keys(e.jobs).forEach($f.bind(e)),e.jobs={}};function $f(e){"function"==typeof this.jobs[e]&&this.jobs[e]()}var Vf=zf,Wf=qf,Gf=function(e,t,i,n){var s=i.keyedList?i.keyedList[i.index]:i.index;i.jobs[s]=function(e,t,i,n){var s;s=2==e.length?e(i,Vf(n)):e(i,t,Vf(n));return s}(t,s,e[s],(function(e,t){s in i.jobs&&(delete i.jobs[s],e?Wf(i):i.results[s]=t,n(e,i.results))}))};var Hf=function(e,t){var i=!Array.isArray(e),n={index:0,keyedList:i||t?Object.keys(e):null,jobs:{},results:i?{}:[],size:i?Object.keys(e).length:e.length};t&&n.keyedList.sort(i?t:function(i,n){return t(e[i],e[n])});return n};var Kf=qf,Jf=zf,Qf=function(e){if(!Object.keys(this.jobs).length)return;this.index=this.size,Kf(this),Jf(e)(null,this.results)};var Yf=Gf,Xf=Hf,Zf=Qf,eg=function(e,t,i){var n=Xf(e);for(;n.index<(n.keyedList||e).length;)Yf(e,t,n,(function(e,t){e?i(e,t):0!==Object.keys(n.jobs).length||i(null,n.results)})),n.index++;return Zf.bind(n,i)};var tg={},ig=Gf,ng=Hf,sg=Qf;function ag(e,t){return e<t?-1:e>t?1:0}({get exports(){return tg},set exports(e){tg=e}}).exports=function(e,t,i,n){var s=ng(e,i);return ig(e,t,s,(function i(a,r){a?n(a,r):(s.index++,s.index<(s.keyedList||e).length?ig(e,t,s,i):n(null,s.results))})),sg.bind(s,n)},tg.ascending=ag,tg.descending=function(e,t){return-1*ag(e,t)};var rg=tg;var og={parallel:eg,serial:function(e,t,i){return rg(e,t,null,i)},serialOrdered:tg},cg=Lf,pg=h,dg=g,lg=n,ug=s,mg=t.parse,hg=e,fg=a.Stream,gg=Af,vg=og,bg=function(e,t){return Object.keys(t).forEach((function(i){e[i]=e[i]||t[i]})),e},_g=yg;function yg(e){if(!(this instanceof yg))return new yg(e);for(var t in this._overheadLength=0,this._valueLength=0,this._valuesToMeasure=[],cg.call(this),e=e||{})this[t]=e[t]}function xg(e){return Rf.isPlainObject(e)||Rf.isArray(e)}function wg(e){return Rf.endsWith(e,"[]")?e.slice(0,-2):e}function Sg(e,t,i){return e?e.concat(t).map((function(e,t){return e=wg(e),!i&&t?"["+e+"]":e})).join(i?".":""):t}pg.inherits(yg,cg),yg.LINE_BREAK="\r\n",yg.DEFAULT_CONTENT_TYPE="application/octet-stream",yg.prototype.append=function(e,t,i){"string"==typeof(i=i||{})&&(i={filename:i});var n=cg.prototype.append.bind(this);if("number"==typeof t&&(t=""+t),pg.isArray(t))this._error(new Error("Arrays are not supported."));else{var s=this._multiPartHeader(e,t,i),a=this._multiPartFooter();n(s),n(t),n(a),this._trackLength(s,t,i)}},yg.prototype._trackLength=function(e,t,i){var n=0;null!=i.knownLength?n+=+i.knownLength:Buffer.isBuffer(t)?n=t.length:"string"==typeof t&&(n=Buffer.byteLength(t)),this._valueLength+=n,this._overheadLength+=Buffer.byteLength(e)+yg.LINE_BREAK.length,t&&(t.path||t.readable&&t.hasOwnProperty("httpVersion")||t instanceof fg)&&(i.knownLength||this._valuesToMeasure.push(t))},yg.prototype._lengthRetriever=function(e,t){e.hasOwnProperty("fd")?null!=e.end&&e.end!=1/0&&null!=e.start?t(null,e.end+1-(e.start?e.start:0)):hg.stat(e.path,(function(i,n){var s;i?t(i):(s=n.size-(e.start?e.start:0),t(null,s))})):e.hasOwnProperty("httpVersion")?t(null,+e.headers["content-length"]):e.hasOwnProperty("httpModule")?(e.on("response",(function(i){e.pause(),t(null,+i.headers["content-length"])})),e.resume()):t("Unknown stream")},yg.prototype._multiPartHeader=function(e,t,i){if("string"==typeof i.header)return i.header;var n,s=this._getContentDisposition(t,i),a=this._getContentType(t,i),r="",o={"Content-Disposition":["form-data",'name="'+e+'"'].concat(s||[]),"Content-Type":[].concat(a||[])};for(var c in"object"==typeof i.header&&bg(o,i.header),o)o.hasOwnProperty(c)&&null!=(n=o[c])&&(Array.isArray(n)||(n=[n]),n.length&&(r+=c+": "+n.join("; ")+yg.LINE_BREAK));return"--"+this.getBoundary()+yg.LINE_BREAK+r+yg.LINE_BREAK},yg.prototype._getContentDisposition=function(e,t){var i,n;return"string"==typeof t.filepath?i=dg.normalize(t.filepath).replace(/\\/g,"/"):t.filename||e.name||e.path?i=dg.basename(t.filename||e.name||e.path):e.readable&&e.hasOwnProperty("httpVersion")&&(i=dg.basename(e.client._httpMessage.path||"")),i&&(n='filename="'+i+'"'),n},yg.prototype._getContentType=function(e,t){var i=t.contentType;return!i&&e.name&&(i=gg.lookup(e.name)),!i&&e.path&&(i=gg.lookup(e.path)),!i&&e.readable&&e.hasOwnProperty("httpVersion")&&(i=e.headers["content-type"]),i||!t.filepath&&!t.filename||(i=gg.lookup(t.filepath||t.filename)),i||"object"!=typeof e||(i=yg.DEFAULT_CONTENT_TYPE),i},yg.prototype._multiPartFooter=function(){return function(e){var t=yg.LINE_BREAK;0===this._streams.length&&(t+=this._lastBoundary()),e(t)}.bind(this)},yg.prototype._lastBoundary=function(){return"--"+this.getBoundary()+"--"+yg.LINE_BREAK},yg.prototype.getHeaders=function(e){var t,i={"content-type":"multipart/form-data; boundary="+this.getBoundary()};for(t in e)e.hasOwnProperty(t)&&(i[t.toLowerCase()]=e[t]);return i},yg.prototype.setBoundary=function(e){this._boundary=e},yg.prototype.getBoundary=function(){return this._boundary||this._generateBoundary(),this._boundary},yg.prototype.getBuffer=function(){for(var e=new Buffer.alloc(0),t=this.getBoundary(),i=0,n=this._streams.length;i<n;i++)"function"!=typeof this._streams[i]&&(e=Buffer.isBuffer(this._streams[i])?Buffer.concat([e,this._streams[i]]):Buffer.concat([e,Buffer.from(this._streams[i])]),"string"==typeof this._streams[i]&&this._streams[i].substring(2,t.length+2)===t||(e=Buffer.concat([e,Buffer.from(yg.LINE_BREAK)])));return Buffer.concat([e,Buffer.from(this._lastBoundary())])},yg.prototype._generateBoundary=function(){for(var e="--------------------------",t=0;t<24;t++)e+=Math.floor(10*Math.random()).toString(16);this._boundary=e},yg.prototype.getLengthSync=function(){var e=this._overheadLength+this._valueLength;return this._streams.length&&(e+=this._lastBoundary().length),this.hasKnownLength()||this._error(new Error("Cannot calculate proper length in synchronous way.")),e},yg.prototype.hasKnownLength=function(){var e=!0;return this._valuesToMeasure.length&&(e=!1),e},yg.prototype.getLength=function(e){var t=this._overheadLength+this._valueLength;this._streams.length&&(t+=this._lastBoundary().length),this._valuesToMeasure.length?vg.parallel(this._valuesToMeasure,this._lengthRetriever,(function(i,n){i?e(i):(n.forEach((function(e){t+=e})),e(null,t))})):process.nextTick(e.bind(this,null,t))},yg.prototype.submit=function(e,t){var i,n,s={method:"post"};return"string"==typeof e?(e=mg(e),n=bg({port:e.port,path:e.pathname,host:e.hostname,protocol:e.protocol},s)):(n=bg(e,s)).port||(n.port="https:"==n.protocol?443:80),n.headers=this.getHeaders(e.headers),i="https:"==n.protocol?ug.request(n):lg.request(n),this.getLength(function(e,n){if(e&&"Unknown stream"!==e)this._error(e);else if(n&&i.setHeader("Content-Length",n),this.pipe(i),t){var s,a=function(e,n){return i.removeListener("error",a),i.removeListener("response",s),t.call(this,e,n)};s=a.bind(this,null),i.on("error",a),i.on("response",s)}}.bind(this)),i},yg.prototype._error=function(e){this.error||(this.error=e,this.pause(),this.emit("error",e))},yg.prototype.toString=function(){return"[object FormData]"};const Rg=Rf.toFlatObject(Rf,{},null,(function(e){return/^is[A-Z]/.test(e)}));function Cg(e,t,i){if(!Rf.isObject(e))throw new TypeError("target must be an object");t=t||new(_g||FormData);const n=(i=Rf.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(e,t){return!Rf.isUndefined(t[e])}))).metaTokens,s=i.visitor||d,a=i.dots,r=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&((c=t)&&Rf.isFunction(c.append)&&"FormData"===c[Symbol.toStringTag]&&c[Symbol.iterator]);var c;if(!Rf.isFunction(s))throw new TypeError("visitor must be a function");function p(e){if(null===e)return"";if(Rf.isDate(e))return e.toISOString();if(!o&&Rf.isBlob(e))throw new Cf("Blob is not supported. Use a Buffer instead.");return Rf.isArrayBuffer(e)||Rf.isTypedArray(e)?o&&"function"==typeof Blob?new Blob([e]):Buffer.from(e):e}function d(e,i,s){let o=e;if(e&&!s&&"object"==typeof e)if(Rf.endsWith(i,"{}"))i=n?i:i.slice(0,-2),e=JSON.stringify(e);else if(Rf.isArray(e)&&function(e){return Rf.isArray(e)&&!e.some(xg)}(e)||Rf.isFileList(e)||Rf.endsWith(i,"[]")&&(o=Rf.toArray(e)))return i=wg(i),o.forEach((function(e,n){!Rf.isUndefined(e)&&null!==e&&t.append(!0===r?Sg([i],n,a):null===r?i:i+"[]",p(e))})),!1;return!!xg(e)||(t.append(Sg(s,i,a),p(e)),!1)}const l=[],u=Object.assign(Rg,{defaultVisitor:d,convertValue:p,isVisitable:xg});if(!Rf.isObject(e))throw new TypeError("data must be an object");return function e(i,n){if(!Rf.isUndefined(i)){if(-1!==l.indexOf(i))throw Error("Circular reference detected in "+n.join("."));l.push(i),Rf.forEach(i,(function(i,a){!0===(!(Rf.isUndefined(i)||null===i)&&s.call(t,i,Rf.isString(a)?a.trim():a,n,u))&&e(i,n?n.concat(a):[a])})),l.pop()}}(e),t}function kg(e){const t={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(e).replace(/[!'()~]|%20|%00/g,(function(e){return t[e]}))}function Tg(e,t){this._pairs=[],e&&Cg(e,this,t)}const Pg=Tg.prototype;function Eg(e){return encodeURIComponent(e).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function Og(e,t,i){if(!t)return e;const n=i&&i.encode||Eg,s=i&&i.serialize;let a;if(a=s?s(t,i):Rf.isURLSearchParams(t)?t.toString():new Tg(t,i).toString(n),a){const t=e.indexOf("#");-1!==t&&(e=e.slice(0,t)),e+=(-1===e.indexOf("?")?"?":"&")+a}return e}Pg.append=function(e,t){this._pairs.push([e,t])},Pg.toString=function(e){const t=e?function(t){return e.call(this,t,kg)}:kg;return this._pairs.map((function(e){return t(e[0])+"="+t(e[1])}),"").join("&")};class Dg{constructor(){this.handlers=[]}use(e,t,i){return this.handlers.push({fulfilled:e,rejected:t,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(e){this.handlers[e]&&(this.handlers[e]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(e){Rf.forEach(this.handlers,(function(t){null!==t&&e(t)}))}}var Ig={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},jg={isNode:!0,classes:{URLSearchParams:t.URLSearchParams,FormData:_g,Blob:"undefined"!=typeof Blob&&Blob||null},protocols:["http","https","file","data"]};function Lg(e){function t(e,i,n,s){let a=e[s++];const r=Number.isFinite(+a),o=s>=e.length;if(a=!a&&Rf.isArray(n)?n.length:a,o)return Rf.hasOwnProp(n,a)?n[a]=[n[a],i]:n[a]=i,!r;n[a]&&Rf.isObject(n[a])||(n[a]=[]);return t(e,i,n[a],s)&&Rf.isArray(n[a])&&(n[a]=function(e){const t={},i=Object.keys(e);let n;const s=i.length;let a;for(n=0;n<s;n++)a=i[n],t[a]=e[a];return t}(n[a])),!r}if(Rf.isFormData(e)&&Rf.isFunction(e.entries)){const i={};return Rf.forEachEntry(e,((e,n)=>{t(function(e){return Rf.matchAll(/\w+|\[(\w*)]/g,e).map((e=>"[]"===e[0]?"":e[1]||e[0]))}(e),n,i,0)})),i}return null}const Mg={"Content-Type":void 0};const Ag={transitional:Ig,adapter:["xhr","http"],transformRequest:[function(e,t){const i=t.getContentType()||"",n=i.indexOf("application/json")>-1,s=Rf.isObject(e);s&&Rf.isHTMLForm(e)&&(e=new FormData(e));if(Rf.isFormData(e))return n&&n?JSON.stringify(Lg(e)):e;if(Rf.isArrayBuffer(e)||Rf.isBuffer(e)||Rf.isStream(e)||Rf.isFile(e)||Rf.isBlob(e))return e;if(Rf.isArrayBufferView(e))return e.buffer;if(Rf.isURLSearchParams(e))return t.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),e.toString();let a;if(s){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(e,t){return Cg(e,new jg.classes.URLSearchParams,Object.assign({visitor:function(e,t,i,n){return Rf.isBuffer(e)?(this.append(t,e.toString("base64")),!1):n.defaultVisitor.apply(this,arguments)}},t))}(e,this.formSerializer).toString();if((a=Rf.isFileList(e))||i.indexOf("multipart/form-data")>-1){const t=this.env&&this.env.FormData;return Cg(a?{"files[]":e}:e,t&&new t,this.formSerializer)}}return s||n?(t.setContentType("application/json",!1),function(e,t,i){if(Rf.isString(e))try{return(t||JSON.parse)(e),Rf.trim(e)}catch(e){if("SyntaxError"!==e.name)throw e}return(i||JSON.stringify)(e)}(e)):e}],transformResponse:[function(e){const t=this.transitional||Ag.transitional,i=t&&t.forcedJSONParsing,n="json"===this.responseType;if(e&&Rf.isString(e)&&(i&&!this.responseType||n)){const i=!(t&&t.silentJSONParsing)&&n;try{return JSON.parse(e)}catch(e){if(i){if("SyntaxError"===e.name)throw Cf.from(e,Cf.ERR_BAD_RESPONSE,this,null,this.response);throw e}}}return e}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:jg.classes.FormData,Blob:jg.classes.Blob},validateStatus:function(e){return e>=200&&e<300},headers:{common:{Accept:"application/json, text/plain, */*"}}};Rf.forEach(["delete","get","head"],(function(e){Ag.headers[e]={}})),Rf.forEach(["post","put","patch"],(function(e){Ag.headers[e]=Rf.merge(Mg)}));const Ng=Rf.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]);const Bg=Symbol("internals");function Fg(e){return e&&String(e).trim().toLowerCase()}function Ug(e){return!1===e||null==e?e:Rf.isArray(e)?e.map(Ug):String(e)}function zg(e,t,i,n){return Rf.isFunction(n)?n.call(this,t,i):Rf.isString(t)?Rf.isString(n)?-1!==t.indexOf(n):Rf.isRegExp(n)?n.test(t):void 0:void 0}class qg{constructor(e){e&&this.set(e)}set(e,t,i){const n=this;function s(e,t,i){const s=Fg(t);if(!s)throw new Error("header name must be a non-empty string");const a=Rf.findKey(n,s);(!a||void 0===n[a]||!0===i||void 0===i&&!1!==n[a])&&(n[a||t]=Ug(e))}const a=(e,t)=>Rf.forEach(e,((e,i)=>s(e,i,t)));return Rf.isPlainObject(e)||e instanceof this.constructor?a(e,t):Rf.isString(e)&&(e=e.trim())&&!/^[-_a-zA-Z]+$/.test(e.trim())?a((e=>{const t={};let i,n,s;return e&&e.split("\n").forEach((function(e){s=e.indexOf(":"),i=e.substring(0,s).trim().toLowerCase(),n=e.substring(s+1).trim(),!i||t[i]&&Ng[i]||("set-cookie"===i?t[i]?t[i].push(n):t[i]=[n]:t[i]=t[i]?t[i]+", "+n:n)})),t})(e),t):null!=e&&s(t,e,i),this}get(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);if(i){const e=this[i];if(!t)return e;if(!0===t)return function(e){const t=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let n;for(;n=i.exec(e);)t[n[1]]=n[2];return t}(e);if(Rf.isFunction(t))return t.call(this,e,i);if(Rf.isRegExp(t))return t.exec(e);throw new TypeError("parser must be boolean|regexp|function")}}}has(e,t){if(e=Fg(e)){const i=Rf.findKey(this,e);return!(!i||t&&!zg(0,this[i],i,t))}return!1}delete(e,t){const i=this;let n=!1;function s(e){if(e=Fg(e)){const s=Rf.findKey(i,e);!s||t&&!zg(0,i[s],s,t)||(delete i[s],n=!0)}}return Rf.isArray(e)?e.forEach(s):s(e),n}clear(){return Object.keys(this).forEach(this.delete.bind(this))}normalize(e){const t=this,i={};return Rf.forEach(this,((n,s)=>{const a=Rf.findKey(i,s);if(a)return t[a]=Ug(n),void delete t[s];const r=e?function(e){return e.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((e,t,i)=>t.toUpperCase()+i))}(s):String(s).trim();r!==s&&delete t[s],t[r]=Ug(n),i[r]=!0})),this}concat(...e){return this.constructor.concat(this,...e)}toJSON(e){const t=Object.create(null);return Rf.forEach(this,((i,n)=>{null!=i&&!1!==i&&(t[n]=e&&Rf.isArray(i)?i.join(", "):i)})),t}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([e,t])=>e+": "+t)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(e){return e instanceof this?e:new this(e)}static concat(e,...t){const i=new this(e);return t.forEach((e=>i.set(e))),i}static accessor(e){const t=(this[Bg]=this[Bg]={accessors:{}}).accessors,i=this.prototype;function n(e){const n=Fg(e);t[n]||(!function(e,t){const i=Rf.toCamelCase(" "+t);["get","set","has"].forEach((n=>{Object.defineProperty(e,n+i,{value:function(e,i,s){return this[n].call(this,t,e,i,s)},configurable:!0})}))}(i,e),t[n]=!0)}return Rf.isArray(e)?e.forEach(n):n(e),this}}function $g(e,t){const i=this||Ag,n=t||i,s=qg.from(n.headers);let a=n.data;return Rf.forEach(e,(function(e){a=e.call(i,a,s.normalize(),t?t.status:void 0)})),s.normalize(),a}function Vg(e){return!(!e||!e.__CANCEL__)}function Wg(e,t,i){Cf.call(this,null==e?"canceled":e,Cf.ERR_CANCELED,t,i),this.name="CanceledError"}function Gg(e,t,i){const n=i.config.validateStatus;i.status&&n&&!n(i.status)?t(new Cf("Request failed with status code "+i.status,[Cf.ERR_BAD_REQUEST,Cf.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):e(i)}function Hg(e,t){return e&&!function(e){return/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)}(t)?function(e,t){return t?e.replace(/\/+$/,"")+"/"+t.replace(/^\/+/,""):e}(e,t):t}qg.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent"]),Rf.freezeMethods(qg.prototype),Rf.freezeMethods(qg),Rf.inherits(Wg,Cf,{__CANCEL__:!0});var Kg=t.parse,Jg={ftp:21,gopher:70,http:80,https:443,ws:80,wss:443},Qg=String.prototype.endsWith||function(e){return e.length<=this.length&&-1!==this.indexOf(e,this.length-e.length)};function Yg(e){return process.env[e.toLowerCase()]||process.env[e.toUpperCase()]||""}var Xg,Zg=function(e){var t="string"==typeof e?Kg(e):e||{},i=t.protocol,n=t.host,s=t.port;if("string"!=typeof n||!n||"string"!=typeof i)return"";if(i=i.split(":",1)[0],!function(e,t){var i=(Yg("npm_config_no_proxy")||Yg("no_proxy")).toLowerCase();if(!i)return!0;if("*"===i)return!1;return i.split(/[,\s]/).every((function(i){if(!i)return!0;var n=i.match(/^(.+):(\d+)$/),s=n?n[1]:i,a=n?parseInt(n[2]):0;return!(!a||a===t)||(/^[.*]/.test(s)?("*"===s.charAt(0)&&(s=s.slice(1)),!Qg.call(e,s)):e!==s)}))}(n=n.replace(/:\d*$/,""),s=parseInt(s)||Jg[i]||0))return"";var a=Yg("npm_config_"+i+"_proxy")||Yg(i+"_proxy")||Yg("npm_config_proxy")||Yg("all_proxy");return a&&-1===a.indexOf("://")&&(a=i+"://"+a),a},ev={},tv={get exports(){return ev},set exports(e){ev=e}},iv=t,nv=iv.URL,sv=n,av=s,rv=a.Writable,ov=u,cv=function(){if(!Xg){try{Xg=jo("follow-redirects")}catch(e){}"function"!=typeof Xg&&(Xg=function(){})}Xg.apply(null,arguments)},pv=["abort","aborted","connect","error","socket","timeout"],dv=Object.create(null);pv.forEach((function(e){dv[e]=function(t,i,n){this._redirectable.emit(e,t,i,n)}}));var lv=xv("ERR_INVALID_URL","Invalid URL",TypeError),uv=xv("ERR_FR_REDIRECTION_FAILURE","Redirected request failed"),mv=xv("ERR_FR_TOO_MANY_REDIRECTS","Maximum number of redirects exceeded"),hv=xv("ERR_FR_MAX_BODY_LENGTH_EXCEEDED","Request body larger than maxBodyLength limit"),fv=xv("ERR_STREAM_WRITE_AFTER_END","write after end");function gv(e,t){rv.call(this),this._sanitizeOptions(e),this._options=e,this._ended=!1,this._ending=!1,this._redirectCount=0,this._redirects=[],this._requestBodyLength=0,this._requestBodyBuffers=[],t&&this.on("response",t);var i=this;this._onNativeResponse=function(e){i._processResponse(e)},this._performRequest()}function vv(e){var t={maxRedirects:21,maxBodyLength:10485760},i={};return Object.keys(e).forEach((function(n){var s=n+":",a=i[s]=e[n],r=t[n]=Object.create(a);Object.defineProperties(r,{request:{value:function(e,n,a){if(Sv(e)){var r;try{r=_v(new nv(e))}catch(t){r=iv.parse(e)}if(!Sv(r.protocol))throw new lv({input:e});e=r}else nv&&e instanceof nv?e=_v(e):(a=n,n=e,e={protocol:s});return Rv(n)&&(a=n,n=null),(n=Object.assign({maxRedirects:t.maxRedirects,maxBodyLength:t.maxBodyLength},e,n)).nativeProtocols=i,Sv(n.host)||Sv(n.hostname)||(n.hostname="::1"),ov.equal(n.protocol,s,"protocol mismatch"),cv("options",n),new gv(n,a)},configurable:!0,enumerable:!0,writable:!0},get:{value:function(e,t,i){var n=r.request(e,t,i);return n.end(),n},configurable:!0,enumerable:!0,writable:!0}})})),t}function bv(){}function _v(e){var t={protocol:e.protocol,hostname:e.hostname.startsWith("[")?e.hostname.slice(1,-1):e.hostname,hash:e.hash,search:e.search,pathname:e.pathname,path:e.pathname+e.search,href:e.href};return""!==e.port&&(t.port=Number(e.port)),t}function yv(e,t){var i;for(var n in t)e.test(n)&&(i=t[n],delete t[n]);return null==i?void 0:String(i).trim()}function xv(e,t,i){function n(i){Error.captureStackTrace(this,this.constructor),Object.assign(this,i||{}),this.code=e,this.message=this.cause?t+": "+this.cause.message:t}return n.prototype=new(i||Error),n.prototype.constructor=n,n.prototype.name="Error ["+e+"]",n}function wv(e){for(var t of pv)e.removeListener(t,dv[t]);e.on("error",bv),e.abort()}function Sv(e){return"string"==typeof e||e instanceof String}function Rv(e){return"function"==typeof e}gv.prototype=Object.create(rv.prototype),gv.prototype.abort=function(){wv(this._currentRequest),this.emit("abort")},gv.prototype.write=function(e,t,i){if(this._ending)throw new fv;if(!Sv(e)&&("object"!=typeof(n=e)||!("length"in n)))throw new TypeError("data should be a string, Buffer or Uint8Array");var n;Rv(t)&&(i=t,t=null),0!==e.length?this._requestBodyLength+e.length<=this._options.maxBodyLength?(this._requestBodyLength+=e.length,this._requestBodyBuffers.push({data:e,encoding:t}),this._currentRequest.write(e,t,i)):(this.emit("error",new hv),this.abort()):i&&i()},gv.prototype.end=function(e,t,i){if(Rv(e)?(i=e,e=t=null):Rv(t)&&(i=t,t=null),e){var n=this,s=this._currentRequest;this.write(e,t,(function(){n._ended=!0,s.end(null,null,i)})),this._ending=!0}else this._ended=this._ending=!0,this._currentRequest.end(null,null,i)},gv.prototype.setHeader=function(e,t){this._options.headers[e]=t,this._currentRequest.setHeader(e,t)},gv.prototype.removeHeader=function(e){delete this._options.headers[e],this._currentRequest.removeHeader(e)},gv.prototype.setTimeout=function(e,t){var i=this;function n(t){t.setTimeout(e),t.removeListener("timeout",t.destroy),t.addListener("timeout",t.destroy)}function s(t){i._timeout&&clearTimeout(i._timeout),i._timeout=setTimeout((function(){i.emit("timeout"),a()}),e),n(t)}function a(){i._timeout&&(clearTimeout(i._timeout),i._timeout=null),i.removeListener("abort",a),i.removeListener("error",a),i.removeListener("response",a),t&&i.removeListener("timeout",t),i.socket||i._currentRequest.removeListener("socket",s)}return t&&this.on("timeout",t),this.socket?s(this.socket):this._currentRequest.once("socket",s),this.on("socket",n),this.on("abort",a),this.on("error",a),this.on("response",a),this},["flushHeaders","getHeader","setNoDelay","setSocketKeepAlive"].forEach((function(e){gv.prototype[e]=function(t,i){return this._currentRequest[e](t,i)}})),["aborted","connection","socket"].forEach((function(e){Object.defineProperty(gv.prototype,e,{get:function(){return this._currentRequest[e]}})})),gv.prototype._sanitizeOptions=function(e){if(e.headers||(e.headers={}),e.host&&(e.hostname||(e.hostname=e.host),delete e.host),!e.pathname&&e.path){var t=e.path.indexOf("?");t<0?e.pathname=e.path:(e.pathname=e.path.substring(0,t),e.search=e.path.substring(t))}},gv.prototype._performRequest=function(){var e=this._options.protocol,t=this._options.nativeProtocols[e];if(t){if(this._options.agents){var i=e.slice(0,-1);this._options.agent=this._options.agents[i]}var n=this._currentRequest=t.request(this._options,this._onNativeResponse);for(var s of(n._redirectable=this,pv))n.on(s,dv[s]);if(this._currentUrl=/^\//.test(this._options.path)?iv.format(this._options):this._options.path,this._isRedirect){var a=0,r=this,o=this._requestBodyBuffers;!function e(t){if(n===r._currentRequest)if(t)r.emit("error",t);else if(a<o.length){var i=o[a++];n.finished||n.write(i.data,i.encoding,e)}else r._ended&&n.end()}()}}else this.emit("error",new TypeError("Unsupported protocol "+e))},gv.prototype._processResponse=function(e){var t=e.statusCode;this._options.trackRedirects&&this._redirects.push({url:this._currentUrl,headers:e.headers,statusCode:t});var i=e.headers.location;if(!i||!1===this._options.followRedirects||t<300||t>=400)return e.responseUrl=this._currentUrl,e.redirects=this._redirects,this.emit("response",e),void(this._requestBodyBuffers=[]);if(wv(this._currentRequest),e.destroy(),++this._redirectCount>this._options.maxRedirects)this.emit("error",new mv);else{var n,s=this._options.beforeRedirect;s&&(n=Object.assign({Host:e.req.getHeader("host")},this._options.headers));var a=this._options.method;((301===t||302===t)&&"POST"===this._options.method||303===t&&!/^(?:GET|HEAD)$/.test(this._options.method))&&(this._options.method="GET",this._requestBodyBuffers=[],yv(/^content-/i,this._options.headers));var r,o=yv(/^host$/i,this._options.headers),c=iv.parse(this._currentUrl),p=o||c.host,d=/^\w+:/.test(i)?this._currentUrl:iv.format(Object.assign(c,{host:p}));try{r=iv.resolve(d,i)}catch(e){return void this.emit("error",new uv({cause:e}))}cv("redirecting to",r),this._isRedirect=!0;var l=iv.parse(r);if(Object.assign(this._options,l),(l.protocol!==c.protocol&&"https:"!==l.protocol||l.host!==p&&!function(e,t){ov(Sv(e)&&Sv(t));var i=e.length-t.length-1;return i>0&&"."===e[i]&&e.endsWith(t)}(l.host,p))&&yv(/^(?:authorization|cookie)$/i,this._options.headers),Rv(s)){var u={headers:e.headers,statusCode:t},m={url:d,method:a,headers:n};try{s(this._options,u,m)}catch(e){return void this.emit("error",e)}this._sanitizeOptions(this._options)}try{this._performRequest()}catch(e){this.emit("error",new uv({cause:e}))}}},tv.exports=vv({http:sv,https:av}),ev.wrap=vv;function Cv(e){const t=/^([-+\w]{1,25})(:?\/\/|:)/.exec(e);return t&&t[1]||""}const kv=/^(?:([^;]+);)?(?:[^;]+;)?(base64|),([\s\S]*)$/;function Tv(e,t){e=e||10;const i=new Array(e),n=new Array(e);let s,a=0,r=0;return t=void 0!==t?t:1e3,function(o){const c=Date.now(),p=n[r];s||(s=c),i[a]=o,n[a]=c;let d=r,l=0;for(;d!==a;)l+=i[d++],d%=e;if(a=(a+1)%e,a===r&&(r=(r+1)%e),c-s<t)return;const u=p&&c-p;return u?Math.round(1e3*l/u):void 0}}const Pv=Symbol("internals");class Ev extends a.Transform{constructor(e){super({readableHighWaterMark:(e=Rf.toFlatObject(e,{maxRate:0,chunkSize:65536,minChunkSize:100,timeWindow:500,ticksRate:2,samplesCount:15},null,((e,t)=>!Rf.isUndefined(t[e])))).chunkSize});const t=this,i=this[Pv]={length:e.length,timeWindow:e.timeWindow,ticksRate:e.ticksRate,chunkSize:e.chunkSize,maxRate:e.maxRate,minChunkSize:e.minChunkSize,bytesSeen:0,isCaptured:!1,notifiedBytesLoaded:0,ts:Date.now(),bytes:0,onReadCallback:null},n=Tv(i.ticksRate*e.samplesCount,i.timeWindow);this.on("newListener",(e=>{"progress"===e&&(i.isCaptured||(i.isCaptured=!0))}));let s=0;i.updateProgress=function(e,t){let i=0;const n=1e3/t;let s=null;return function(t,a){const r=Date.now();if(t||r-i>n)return s&&(clearTimeout(s),s=null),i=r,e.apply(null,a);s||(s=setTimeout((()=>(s=null,i=Date.now(),e.apply(null,a))),n-(r-i)))}}((function(){const e=i.length,a=i.bytesSeen,r=a-s;if(!r||t.destroyed)return;const o=n(r);s=a,process.nextTick((()=>{t.emit("progress",{loaded:a,total:e,progress:e?a/e:void 0,bytes:r,rate:o||void 0,estimated:o&&e&&a<=e?(e-a)/o:void 0})}))}),i.ticksRate);const a=()=>{i.updateProgress(!0)};this.once("end",a),this.once("error",a)}_read(e){const t=this[Pv];return t.onReadCallback&&t.onReadCallback(),super._read(e)}_transform(e,t,i){const n=this,s=this[Pv],a=s.maxRate,r=this.readableHighWaterMark,o=s.timeWindow,c=a/(1e3/o),p=!1!==s.minChunkSize?Math.max(s.minChunkSize,.01*c):0;const d=(e,t)=>{const i=Buffer.byteLength(e);let d,l=null,u=r,m=0;if(a){const e=Date.now();(!s.ts||(m=e-s.ts)>=o)&&(s.ts=e,d=c-s.bytes,s.bytes=d<0?-d:0,m=0),d=c-s.bytes}if(a){if(d<=0)return setTimeout((()=>{t(null,e)}),o-m);d<u&&(u=d)}u&&i>u&&i-u>p&&(l=e.subarray(u),e=e.subarray(0,u)),function(e,t){const i=Buffer.byteLength(e);s.bytesSeen+=i,s.bytes+=i,s.isCaptured&&s.updateProgress(),n.push(e)?process.nextTick(t):s.onReadCallback=()=>{s.onReadCallback=null,process.nextTick(t)}}(e,l?()=>{process.nextTick(t,null,l)}:t)};d(e,(function e(t,n){if(t)return i(t);n?d(n,e):i(null)}))}setLength(e){return this[Pv].length=+e,this}}const Ov={flush:r.constants.Z_SYNC_FLUSH,finishFlush:r.constants.Z_SYNC_FLUSH},Dv={flush:r.constants.BROTLI_OPERATION_FLUSH,finishFlush:r.constants.BROTLI_OPERATION_FLUSH},Iv=Rf.isFunction(r.createBrotliDecompress),{http:jv,https:Lv}=ev,Mv=/https:?/,Av=jg.protocols.map((e=>e+":"));function Nv(e){e.beforeRedirects.proxy&&e.beforeRedirects.proxy(e),e.beforeRedirects.config&&e.beforeRedirects.config(e)}function Bv(e,t,i){let n=t;if(!n&&!1!==n){const e=Zg(i);e&&(n=new URL(e))}if(n){if(n.username&&(n.auth=(n.username||"")+":"+(n.password||"")),n.auth){(n.auth.username||n.auth.password)&&(n.auth=(n.auth.username||"")+":"+(n.auth.password||""));const t=Buffer.from(n.auth,"utf8").toString("base64");e.headers["Proxy-Authorization"]="Basic "+t}e.headers.host=e.hostname+(e.port?":"+e.port:"");const t=n.hostname||n.host;e.hostname=t,e.host=t,e.port=n.port,e.path=i,n.protocol&&(e.protocol=n.protocol.includes(":")?n.protocol:`${n.protocol}:`)}e.beforeRedirects.proxy=function(e){Bv(e,t,e.href)}}var Fv="undefined"!=typeof process&&"process"===Rf.kindOf(process)&&function(e){return new Promise((function(t,i){let o=e.data;const c=e.responseType,p=e.responseEncoding,l=e.method.toUpperCase();let u,m,h,f=!1;const g=new d;function v(){u||(u=!0,e.cancelToken&&e.cancelToken.unsubscribe(x),e.signal&&e.signal.removeEventListener("abort",x),g.removeAllListeners())}function b(e,n){m||(m=!0,n&&(f=!0,v()),n?i(e):t(e))}const _=function(e){b(e)},y=function(e){b(e,!0)};function x(t){g.emit("abort",!t||t.type?new Wg(null,e,h):t)}g.once("abort",y),(e.cancelToken||e.signal)&&(e.cancelToken&&e.cancelToken.subscribe(x),e.signal&&(e.signal.aborted?x():e.signal.addEventListener("abort",x)));const w=Hg(e.baseURL,e.url),S=new URL(w),R=S.protocol||Av[0];if("data:"===R){let t;if("GET"!==l)return Gg(_,y,{status:405,statusText:"method not allowed",headers:{},config:e});try{t=function(e,t,i){const n=i&&i.Blob||jg.classes.Blob,s=Cv(e);if(void 0===t&&n&&(t=!0),"data"===s){e=s.length?e.slice(s.length+1):e;const i=kv.exec(e);if(!i)throw new Cf("Invalid URL",Cf.ERR_INVALID_URL);const a=i[1],r=i[2],o=i[3],c=Buffer.from(decodeURIComponent(o),r?"base64":"utf8");if(t){if(!n)throw new Cf("Blob is not supported",Cf.ERR_NOT_SUPPORT);return new n([c],{type:a})}return c}throw new Cf("Unsupported protocol "+s,Cf.ERR_NOT_SUPPORT)}(e.url,"blob"===c,{Blob:e.env&&e.env.Blob})}catch(t){throw Cf.from(t,Cf.ERR_BAD_REQUEST,e)}return"text"===c?(t=t.toString(p),p&&"utf8"!==p||(o=Rf.stripBOM(t))):"stream"===c&&(t=a.Readable.from(t)),Gg(_,y,{data:t,status:200,statusText:"OK",headers:new qg,config:e})}if(-1===Av.indexOf(R))return y(new Cf("Unsupported protocol "+R,Cf.ERR_BAD_REQUEST,e));const C=qg.from(e.headers).normalize();C.set("User-Agent","axios/1.2.3",!1);const k=e.onDownloadProgress,T=e.onUploadProgress,P=e.maxRate;let E,O;if(Rf.isFormData(o)&&Rf.isFunction(o.getHeaders))C.set(o.getHeaders());else if(o&&!Rf.isStream(o)){if(Buffer.isBuffer(o));else if(Rf.isArrayBuffer(o))o=Buffer.from(new Uint8Array(o));else{if(!Rf.isString(o))return y(new Cf("Data after transformation must be a string, an ArrayBuffer, a Buffer, or a Stream",Cf.ERR_BAD_REQUEST,e));o=Buffer.from(o,"utf-8")}if(C.set("Content-Length",o.length,!1),e.maxBodyLength>-1&&o.length>e.maxBodyLength)return y(new Cf("Request body larger than maxBodyLength limit",Cf.ERR_BAD_REQUEST,e))}const D=Rf.toFiniteNumber(C.getContentLength());let I,j;if(Rf.isArray(P)?(E=P[0],O=P[1]):E=O=P,o&&(T||E)&&(Rf.isStream(o)||(o=a.Readable.from(o,{objectMode:!1})),o=a.pipeline([o,new Ev({length:D,maxRate:Rf.toFiniteNumber(E)})],Rf.noop),T&&o.on("progress",(e=>{T(Object.assign(e,{upload:!0}))}))),e.auth){I=(e.auth.username||"")+":"+(e.auth.password||"")}if(!I&&S.username){I=S.username+":"+S.password}I&&C.delete("authorization");try{j=Og(S.pathname+S.search,e.params,e.paramsSerializer).replace(/^\?/,"")}catch(t){const i=new Error(t.message);return i.config=e,i.url=e.url,i.exists=!0,y(i)}C.set("Accept-Encoding","gzip, compress, deflate"+(Iv?", br":""),!1);const L={path:j,method:l,headers:C.toJSON(),agents:{http:e.httpAgent,https:e.httpsAgent},auth:I,protocol:R,beforeRedirect:Nv,beforeRedirects:{}};let M;e.socketPath?L.socketPath=e.socketPath:(L.hostname=S.hostname,L.port=S.port,Bv(L,e.proxy,R+"//"+S.hostname+(S.port?":"+S.port:"")+L.path));const A=Mv.test(L.protocol);if(L.agent=A?e.httpsAgent:e.httpAgent,e.transport?M=e.transport:0===e.maxRedirects?M=A?s:n:(e.maxRedirects&&(L.maxRedirects=e.maxRedirects),e.beforeRedirect&&(L.beforeRedirects.config=e.beforeRedirect),M=A?Lv:jv),e.maxBodyLength>-1?L.maxBodyLength=e.maxBodyLength:L.maxBodyLength=1/0,e.insecureHTTPParser&&(L.insecureHTTPParser=e.insecureHTTPParser),h=M.request(L,(function(t){if(h.destroyed)return;const i=[t],n=+t.headers["content-length"];if(k){const e=new Ev({length:Rf.toFiniteNumber(n),maxRate:Rf.toFiniteNumber(O)});k&&e.on("progress",(e=>{k(Object.assign(e,{download:!0}))})),i.push(e)}let s=t;const o=t.req||h;if(!1!==e.decompress&&t.headers["content-encoding"])switch("HEAD"!==l&&204!==t.statusCode||delete t.headers["content-encoding"],t.headers["content-encoding"]){case"gzip":case"x-gzip":case"compress":case"x-compress":case"deflate":i.push(r.createUnzip(Ov)),delete t.headers["content-encoding"];break;case"br":Iv&&(i.push(r.createBrotliDecompress(Dv)),delete t.headers["content-encoding"])}s=i.length>1?a.pipeline(i,Rf.noop):i[0];const d=a.finished(s,(()=>{d(),v()})),u={status:t.statusCode,statusText:t.statusMessage,headers:new qg(t.headers),config:e,request:o};if("stream"===c)u.data=s,Gg(_,y,u);else{const t=[];let i=0;s.on("data",(function(n){t.push(n),i+=n.length,e.maxContentLength>-1&&i>e.maxContentLength&&(f=!0,s.destroy(),y(new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o)))})),s.on("aborted",(function(){if(f)return;const t=new Cf("maxContentLength size of "+e.maxContentLength+" exceeded",Cf.ERR_BAD_RESPONSE,e,o);s.destroy(t),y(t)})),s.on("error",(function(t){h.destroyed||y(Cf.from(t,null,e,o))})),s.on("end",(function(){try{let e=1===t.length?t[0]:Buffer.concat(t);"arraybuffer"!==c&&(e=e.toString(p),p&&"utf8"!==p||(e=Rf.stripBOM(e))),u.data=e}catch(t){y(Cf.from(t,null,e,u.request,u))}Gg(_,y,u)}))}g.once("abort",(e=>{s.destroyed||(s.emit("error",e),s.destroy())}))})),g.once("abort",(e=>{y(e),h.destroy(e)})),h.on("error",(function(t){y(Cf.from(t,null,e,h))})),h.on("socket",(function(e){e.setKeepAlive(!0,6e4)})),e.timeout){const t=parseInt(e.timeout,10);if(isNaN(t))return void y(new Cf("error trying to parse `config.timeout` to int",Cf.ERR_BAD_OPTION_VALUE,e,h));h.setTimeout(t,(function(){if(m)return;let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const i=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),y(new Cf(t,i.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,h)),x()}))}if(Rf.isStream(o)){let t=!1,i=!1;o.on("end",(()=>{t=!0})),o.once("error",(e=>{i=!0,h.destroy(e)})),o.on("close",(()=>{t||i||x(new Wg("Request stream has been aborted",e,h))})),o.pipe(h)}else h.end(o)}))},Uv=jg.isStandardBrowserEnv?{write:function(e,t,i,n,s,a){const r=[];r.push(e+"="+encodeURIComponent(t)),Rf.isNumber(i)&&r.push("expires="+new Date(i).toGMTString()),Rf.isString(n)&&r.push("path="+n),Rf.isString(s)&&r.push("domain="+s),!0===a&&r.push("secure"),document.cookie=r.join("; ")},read:function(e){const t=document.cookie.match(new RegExp("(^|;\\s*)("+e+")=([^;]*)"));return t?decodeURIComponent(t[3]):null},remove:function(e){this.write(e,"",Date.now()-864e5)}}:{write:function(){},read:function(){return null},remove:function(){}},zv=jg.isStandardBrowserEnv?function(){const e=/(msie|trident)/i.test(navigator.userAgent),t=document.createElement("a");let i;function n(i){let n=i;return e&&(t.setAttribute("href",n),n=t.href),t.setAttribute("href",n),{href:t.href,protocol:t.protocol?t.protocol.replace(/:$/,""):"",host:t.host,search:t.search?t.search.replace(/^\?/,""):"",hash:t.hash?t.hash.replace(/^#/,""):"",hostname:t.hostname,port:t.port,pathname:"/"===t.pathname.charAt(0)?t.pathname:"/"+t.pathname}}return i=n(window.location.href),function(e){const t=Rf.isString(e)?n(e):e;return t.protocol===i.protocol&&t.host===i.host}}():function(){return!0};function qv(e,t){let i=0;const n=Tv(50,250);return s=>{const a=s.loaded,r=s.lengthComputable?s.total:void 0,o=a-i,c=n(o);i=a;const p={loaded:a,total:r,progress:r?a/r:void 0,bytes:o,rate:c||void 0,estimated:c&&r&&a<=r?(r-a)/c:void 0,event:s};p[t?"download":"upload"]=!0,e(p)}}var $v="undefined"!=typeof XMLHttpRequest&&function(e){return new Promise((function(t,i){let n=e.data;const s=qg.from(e.headers).normalize(),a=e.responseType;let r;function o(){e.cancelToken&&e.cancelToken.unsubscribe(r),e.signal&&e.signal.removeEventListener("abort",r)}Rf.isFormData(n)&&(jg.isStandardBrowserEnv||jg.isStandardBrowserWebWorkerEnv)&&s.setContentType(!1);let c=new XMLHttpRequest;if(e.auth){const t=e.auth.username||"",i=e.auth.password?unescape(encodeURIComponent(e.auth.password)):"";s.set("Authorization","Basic "+btoa(t+":"+i))}const p=Hg(e.baseURL,e.url);function d(){if(!c)return;const n=qg.from("getAllResponseHeaders"in c&&c.getAllResponseHeaders());Gg((function(e){t(e),o()}),(function(e){i(e),o()}),{data:a&&"text"!==a&&"json"!==a?c.response:c.responseText,status:c.status,statusText:c.statusText,headers:n,config:e,request:c}),c=null}if(c.open(e.method.toUpperCase(),Og(p,e.params,e.paramsSerializer),!0),c.timeout=e.timeout,"onloadend"in c?c.onloadend=d:c.onreadystatechange=function(){c&&4===c.readyState&&(0!==c.status||c.responseURL&&0===c.responseURL.indexOf("file:"))&&setTimeout(d)},c.onabort=function(){c&&(i(new Cf("Request aborted",Cf.ECONNABORTED,e,c)),c=null)},c.onerror=function(){i(new Cf("Network Error",Cf.ERR_NETWORK,e,c)),c=null},c.ontimeout=function(){let t=e.timeout?"timeout of "+e.timeout+"ms exceeded":"timeout exceeded";const n=e.transitional||Ig;e.timeoutErrorMessage&&(t=e.timeoutErrorMessage),i(new Cf(t,n.clarifyTimeoutError?Cf.ETIMEDOUT:Cf.ECONNABORTED,e,c)),c=null},jg.isStandardBrowserEnv){const t=(e.withCredentials||zv(p))&&e.xsrfCookieName&&Uv.read(e.xsrfCookieName);t&&s.set(e.xsrfHeaderName,t)}void 0===n&&s.setContentType(null),"setRequestHeader"in c&&Rf.forEach(s.toJSON(),(function(e,t){c.setRequestHeader(t,e)})),Rf.isUndefined(e.withCredentials)||(c.withCredentials=!!e.withCredentials),a&&"json"!==a&&(c.responseType=e.responseType),"function"==typeof e.onDownloadProgress&&c.addEventListener("progress",qv(e.onDownloadProgress,!0)),"function"==typeof e.onUploadProgress&&c.upload&&c.upload.addEventListener("progress",qv(e.onUploadProgress)),(e.cancelToken||e.signal)&&(r=t=>{c&&(i(!t||t.type?new Wg(null,e,c):t),c.abort(),c=null)},e.cancelToken&&e.cancelToken.subscribe(r),e.signal&&(e.signal.aborted?r():e.signal.addEventListener("abort",r)));const l=Cv(p);l&&-1===jg.protocols.indexOf(l)?i(new Cf("Unsupported protocol "+l+":",Cf.ERR_BAD_REQUEST,e)):c.send(n||null)}))};const Vv={http:Fv,xhr:$v};Rf.forEach(Vv,((e,t)=>{if(e){try{Object.defineProperty(e,"name",{value:t})}catch(e){}Object.defineProperty(e,"adapterName",{value:t})}}));var Wv=e=>{e=Rf.isArray(e)?e:[e];const{length:t}=e;let i,n;for(let s=0;s<t&&(i=e[s],!(n=Rf.isString(i)?Vv[i.toLowerCase()]:i));s++);if(!n){if(!1===n)throw new Cf(`Adapter ${i} is not supported by the environment`,"ERR_NOT_SUPPORT");throw new Error(Rf.hasOwnProp(Vv,i)?`Adapter '${i}' is not available in the build`:`Unknown adapter '${i}'`)}if(!Rf.isFunction(n))throw new TypeError("adapter is not a function");return n};function Gv(e){if(e.cancelToken&&e.cancelToken.throwIfRequested(),e.signal&&e.signal.aborted)throw new Wg(null,e)}function Hv(e){Gv(e),e.headers=qg.from(e.headers),e.data=$g.call(e,e.transformRequest),-1!==["post","put","patch"].indexOf(e.method)&&e.headers.setContentType("application/x-www-form-urlencoded",!1);return Wv(e.adapter||Ag.adapter)(e).then((function(t){return Gv(e),t.data=$g.call(e,e.transformResponse,t),t.headers=qg.from(t.headers),t}),(function(t){return Vg(t)||(Gv(e),t&&t.response&&(t.response.data=$g.call(e,e.transformResponse,t.response),t.response.headers=qg.from(t.response.headers))),Promise.reject(t)}))}const Kv=e=>e instanceof qg?e.toJSON():e;function Jv(e,t){t=t||{};const i={};function n(e,t,i){return Rf.isPlainObject(e)&&Rf.isPlainObject(t)?Rf.merge.call({caseless:i},e,t):Rf.isPlainObject(t)?Rf.merge({},t):Rf.isArray(t)?t.slice():t}function s(e,t,i){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e,i):n(e,t,i)}function a(e,t){if(!Rf.isUndefined(t))return n(void 0,t)}function r(e,t){return Rf.isUndefined(t)?Rf.isUndefined(e)?void 0:n(void 0,e):n(void 0,t)}function o(i,s,a){return a in t?n(i,s):a in e?n(void 0,i):void 0}const c={url:a,method:a,data:a,baseURL:r,transformRequest:r,transformResponse:r,paramsSerializer:r,timeout:r,timeoutMessage:r,withCredentials:r,adapter:r,responseType:r,xsrfCookieName:r,xsrfHeaderName:r,onUploadProgress:r,onDownloadProgress:r,decompress:r,maxContentLength:r,maxBodyLength:r,beforeRedirect:r,transport:r,httpAgent:r,httpsAgent:r,cancelToken:r,socketPath:r,responseEncoding:r,validateStatus:o,headers:(e,t)=>s(Kv(e),Kv(t),!0)};return Rf.forEach(Object.keys(e).concat(Object.keys(t)),(function(n){const a=c[n]||s,r=a(e[n],t[n],n);Rf.isUndefined(r)&&a!==o||(i[n]=r)})),i}const Qv={};["object","boolean","number","function","string","symbol"].forEach(((e,t)=>{Qv[e]=function(i){return typeof i===e||"a"+(t<1?"n ":" ")+e}}));const Yv={};Qv.transitional=function(e,t,i){function n(e,t){return"[Axios v1.2.3] Transitional option '"+e+"'"+t+(i?". "+i:"")}return(i,s,a)=>{if(!1===e)throw new Cf(n(s," has been removed"+(t?" in "+t:"")),Cf.ERR_DEPRECATED);return t&&!Yv[s]&&(Yv[s]=!0,console.warn(n(s," has been deprecated since v"+t+" and will be removed in the near future"))),!e||e(i,s,a)}};var Xv={assertOptions:function(e,t,i){if("object"!=typeof e)throw new Cf("options must be an object",Cf.ERR_BAD_OPTION_VALUE);const n=Object.keys(e);let s=n.length;for(;s-- >0;){const a=n[s],r=t[a];if(r){const t=e[a],i=void 0===t||r(t,a,e);if(!0!==i)throw new Cf("option "+a+" must be "+i,Cf.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new Cf("Unknown option "+a,Cf.ERR_BAD_OPTION)}},validators:Qv};const Zv=Xv.validators;class eb{constructor(e){this.defaults=e,this.interceptors={request:new Dg,response:new Dg}}request(e,t){"string"==typeof e?(t=t||{}).url=e:t=e||{},t=Jv(this.defaults,t);const{transitional:i,paramsSerializer:n,headers:s}=t;let a;void 0!==i&&Xv.assertOptions(i,{silentJSONParsing:Zv.transitional(Zv.boolean),forcedJSONParsing:Zv.transitional(Zv.boolean),clarifyTimeoutError:Zv.transitional(Zv.boolean)},!1),void 0!==n&&Xv.assertOptions(n,{encode:Zv.function,serialize:Zv.function},!0),t.method=(t.method||this.defaults.method||"get").toLowerCase(),a=s&&Rf.merge(s.common,s[t.method]),a&&Rf.forEach(["delete","get","head","post","put","patch","common"],(e=>{delete s[e]})),t.headers=qg.concat(a,s);const r=[];let o=!0;this.interceptors.request.forEach((function(e){"function"==typeof e.runWhen&&!1===e.runWhen(t)||(o=o&&e.synchronous,r.unshift(e.fulfilled,e.rejected))}));const c=[];let p;this.interceptors.response.forEach((function(e){c.push(e.fulfilled,e.rejected)}));let d,l=0;if(!o){const e=[Hv.bind(this),void 0];for(e.unshift.apply(e,r),e.push.apply(e,c),d=e.length,p=Promise.resolve(t);l<d;)p=p.then(e[l++],e[l++]);return p}d=r.length;let u=t;for(l=0;l<d;){const e=r[l++],t=r[l++];try{u=e(u)}catch(e){t.call(this,e);break}}try{p=Hv.call(this,u)}catch(e){return Promise.reject(e)}for(l=0,d=c.length;l<d;)p=p.then(c[l++],c[l++]);return p}getUri(e){return Og(Hg((e=Jv(this.defaults,e)).baseURL,e.url),e.params,e.paramsSerializer)}}Rf.forEach(["delete","get","head","options"],(function(e){eb.prototype[e]=function(t,i){return this.request(Jv(i||{},{method:e,url:t,data:(i||{}).data}))}})),Rf.forEach(["post","put","patch"],(function(e){function t(t){return function(i,n,s){return this.request(Jv(s||{},{method:e,headers:t?{"Content-Type":"multipart/form-data"}:{},url:i,data:n}))}}eb.prototype[e]=t(),eb.prototype[e+"Form"]=t(!0)}));class tb{constructor(e){if("function"!=typeof e)throw new TypeError("executor must be a function.");let t;this.promise=new Promise((function(e){t=e}));const i=this;this.promise.then((e=>{if(!i._listeners)return;let t=i._listeners.length;for(;t-- >0;)i._listeners[t](e);i._listeners=null})),this.promise.then=e=>{let t;const n=new Promise((e=>{i.subscribe(e),t=e})).then(e);return n.cancel=function(){i.unsubscribe(t)},n},e((function(e,n,s){i.reason||(i.reason=new Wg(e,n,s),t(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(e){this.reason?e(this.reason):this._listeners?this._listeners.push(e):this._listeners=[e]}unsubscribe(e){if(!this._listeners)return;const t=this._listeners.indexOf(e);-1!==t&&this._listeners.splice(t,1)}static source(){let e;return{token:new tb((function(t){e=t})),cancel:e}}}const ib={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(ib).forEach((([e,t])=>{ib[t]=e}));const nb=function e(t){const i=new eb(t),n=Kh(eb.prototype.request,i);return Rf.extend(n,eb.prototype,i,{allOwnKeys:!0}),Rf.extend(n,i,null,{allOwnKeys:!0}),n.create=function(i){return e(Jv(t,i))},n}(Ag);nb.Axios=eb,nb.CanceledError=Wg,nb.CancelToken=tb,nb.isCancel=Vg,nb.VERSION="1.2.3",nb.toFormData=Cg,nb.AxiosError=Cf,nb.Cancel=nb.CanceledError,nb.all=function(e){return Promise.all(e)},nb.spread=function(e){return function(t){return e.apply(null,t)}},nb.isAxiosError=function(e){return Rf.isObject(e)&&!0===e.isAxiosError},nb.mergeConfig=Jv,nb.AxiosHeaders=qg,nb.formToJSON=e=>Lg(Rf.isHTMLForm(e)?new FormData(e):e),nb.HttpStatusCode=ib,nb.default=nb;class sb{constructor(e={}){this.data=void 0===e.data?{}:e.data,this.headers=e.headers||{},this.status=e.status||200,this.statusText=e.statusText||"OK",this.url=e.url||null}}function ab(e,t){return u.ok(e,`${t} is required`),e}function rb(e,t){return u.ok("boolean"==typeof e,`${t}<boolean> is required`),e}function ob(e,t){return u.ok("number"==typeof e,`${t}<number> is required`),e}function cb(e,t){return u.ok("string"==typeof e,`${t}<string> is required`),e}function pb(e,t,i){const n=i||t.name[0].toLowerCase()+t.name.substring(1);return u.ok(e instanceof t,`${n}<${t.name}> is required`),e}function db(e,t="roomName"){return cb(e,t),u.equal("string"==typeof e&&e[0],"/",`${t} must begin with a '/'`),e}function lb(e,t){return u.ok(Array.isArray(e),`${t}<array> is required`),e}function ub(e,t){if(null==e||"object"!=typeof e||Array.isArray(e))throw new Error(`${t} must be a record. ${JSON.stringify(e)}`);return e}function mb(e,t,i){cb(t,"name"),function(e,t,i,n){cb(i,"name");const s=n||`${i} must be null or of type ${t}`;u.ok(null===e||typeof e===t,s)}(e,"string",t,i)}function hb({baseUrl:e,url:t}){return u.ok("string"==typeof t,"url<String> is required"),e?e+t:t}class fb{constructor({baseUrl:e}){cb(e,"baseUrl"),this._baseUrl=e}_requestAxios(e,t){const i=Object.assign({},t,{url:e,baseURL:this._baseUrl});return nb.request(i)}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this._requestAxios(e,t).then((e=>{const{data:t,headers:i,status:n,statusText:s,config:a}=e,r=a&&a.url?hb({baseUrl:a.baseURL,url:a.url}):null;return new sb({data:t,headers:i,status:n,statusText:s,url:r})})).catch((e=>{const t=e.response;if(!t)throw new Error("Could not make the request.");const{data:i,headers:n,status:s,statusText:a,config:r}=t,o=r&&r.url?hb({baseUrl:r.baseURL,url:r.url}):null;return Promise.reject(new sb({data:i,headers:n,status:s,statusText:a,url:o}))}))}}class gb{constructor({httpClient:e}){u.ok(e,"httpClient is required"),this._httpClient=e}static dataToFormData(e){u.ok(e,"data is required");const t=new FormData;return Object.keys(e).forEach((i=>{const n=e[i];t.append(i,n)})),t}request(e,t={}){const i=Object.assign(t.headers||{},{"Content-Type":void 0});return this._httpClient.request(e,Object.assign(t,{headers:i,transformRequest:gb.dataToFormData}))}}let vb;vb="object"==typeof window?window.btoa||Hh:"object"==typeof global&&global.btoa||Hh;const bb=()=>Promise.resolve(null);class _b{constructor({httpClient:e,fetchDeviceCredentials:t}){this._httpClient=e,this._fetchDeviceCredentials=t}request(e,t){return this._fetchDeviceCredentials().then((i=>{const n=Object.assign({},t.headers,function(e){if(e&&e.credentials){const t=`${e.credentials.uuid}:${e.hmac}`;return{Authorization:`Basic ${vb(t)}`}}return{}}(i),{"X-Appearin-Device-Platform":"web"}),s=Object.assign({},t,{headers:n});return this._httpClient.request(e,s)}))}}class yb{constructor({baseUrl:e="https://api.appearin.net",fetchDeviceCredentials:t=bb}={}){cb(e,"baseUrl"),u.ok("function"==typeof t,"fetchDeviceCredentials<Function> is required"),this.authenticatedHttpClient=new _b({httpClient:new fb({baseUrl:e}),fetchDeviceCredentials:t}),this.authenticatedFormDataHttpClient=new gb({httpClient:this.authenticatedHttpClient})}request(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedHttpClient.request(e,t)}requestMultipart(e,t){return cb(e,"url"),u.equal(e[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(t,"options are required"),this.authenticatedFormDataHttpClient.request(e,t)}}function xb(e,t){return cb(ub(e,"data")[t],t)}const wb=(Sb=xb,(e,t)=>{const i=ub(e,"data")[t];return null==i?null:Sb(e,t)});var Sb;function Rb(e,t){const i=xb(e,t),n=new Date(i);if(isNaN(n.getTime()))throw new Error(`Invalid date for ${i}`);return n}function Cb(e,t,i){return function(e,t){return lb(ub(e,"data")[t],t)}(e,t).map((e=>i(e)))}class kb{constructor(e,t,i){this.credentials={uuid:e},this.hmac=t,this.userId=i}toJson(){return Object.assign({credentials:this.credentials,hmac:this.hmac},this.userId&&{userId:this.userId})}static fromJson(e){return new kb(xb(function(e,t){const i=ub(e,"data")[t];return void 0===i?null:i}(e,"credentials"),"uuid"),xb(e,"hmac"),wb(e,"userId")||void 0)}}class Tb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}getCredentials(){return this._apiClient.request("/devices",{method:"post"}).then((({data:e})=>kb.fromJson(e))).catch((e=>{if(e.response&&404===e.response.status)return null;throw e}))}}class Pb{constructor(e,t){this._key=e,this._chromeStorage=t}loadOrDefault(e){return new Promise((t=>{this._chromeStorage.get(this._key,(i=>{t(i[this._key]||e)}))}))}save(e){return new Promise((t=>{this._chromeStorage.set({[this._key]:e},(()=>{t()}))}))}}class Eb{constructor(e,t){ab(t,"localStorage"),this._key=cb(e,"key"),this._localStorage=t}loadOrDefault(e){try{const t=this._localStorage.getItem(this._key);if(t)try{return Promise.resolve(JSON.parse(t))}catch(e){}return Promise.resolve(e)}catch(t){return console.warn("Error getting access to storage. Are cookies blocked?",t),Promise.resolve(e)}}save(e){try{return this._localStorage.setItem(this._key,JSON.stringify(e)),Promise.resolve()}catch(e){return console.warn("Error getting access to storage. Are cookies blocked?",e),Promise.reject(e)}}}let Ob;try{Ob=self.localStorage}catch(e){Ob={getItem:()=>{},key:()=>{},setItem:()=>{},removeItem:()=>{},hasOwnProperty:()=>{},length:0}}var Db=Ob;const Ib="credentials_saved";class jb extends d{constructor({deviceService:e,credentialsStore:t}){super(),this._deviceService=pb(e,Tb),this._credentialsStore=t}static create({baseUrl:e,storeName:t="CredentialsStorage",storeType:i="localStorage"}){const n=new Tb({apiClient:new yb({baseUrl:e})});let s=null;if("localStorage"===i)s=new Eb(t,Db);else{if("chromeStorage"!==i)throw new Error(`Unknown store type: ${i}`);s=new Pb(t,window.chrome.storage.local)}return new jb({deviceService:n,credentialsStore:s})}_fetchNewCredentialsFromApi(){const e=this._credentialsStore;return new Promise((t=>{const i=()=>{this._deviceService.getCredentials().then((i=>e.save(i?i.toJson():null).then((()=>t(i))))).catch((()=>{setTimeout(i,2e3)}))};i()}))}getCurrentCredentials(){return this._credentialsStore.loadOrDefault(null).then((e=>e?kb.fromJson(e):null))}getCredentials(){return this.credentialsPromise||(this.credentialsPromise=this.getCurrentCredentials().then((e=>e||this._fetchNewCredentialsFromApi()))),this.credentialsPromise}saveCredentials(e){return this.credentialsPromise=void 0,this._credentialsStore.save(e.toJson()).then((()=>(this.emit(Ib,e),e)))}setUserId(e){return this.getCurrentCredentials().then((t=>{t||console.error("Illegal state: no credentials to set user id for.");if(null===t||t.userId!==e)return this._credentialsStore.save(Object.assign({},null==t?void 0:t.toJson(),{userId:e}))})).then((()=>{}))}}const Lb=()=>Promise.resolve(void 0);class Mb{constructor({apiClient:e,fetchOrganization:t=Lb}){this._apiClient=pb(e,yb),u.ok("function"==typeof t,"fetchOrganization<Function> is required"),this._fetchOrganization=t,this._apiClient=e}_callRequestMethod(e,t,i){return cb(t,"url"),u.equal(t[0],"/",'url<String> only accepts relative URLs beginning with "/".'),u.ok(i,"options are required"),this._fetchOrganization().then((n=>{if(!n)return this._apiClient[e](t,i);const{organizationId:s}=n;return this._apiClient[e](`/organizations/${encodeURIComponent(s)}${t}`,i)}))}request(e,t){return this._callRequestMethod("request",e,t)}requestMultipart(e,t){return this._callRequestMethod("requestMultipart",e,t)}}class Ab{constructor({isExhausted:e,renewsAt:t,totalMinutesLimit:i,totalMinutesUsed:n}){this.isExhausted=e,this.renewsAt=t,this.totalMinutesLimit=i,this.totalMinutesUsed=n}static fromJson(e){return new Ab({isExhausted:rb(e.isExhausted,"isExhausted"),renewsAt:new Date(cb(e.renewsAt,"renewsAt")),totalMinutesLimit:ob(e.totalMinutesLimit,"totalMinutesLimit"),totalMinutesUsed:ob(e.totalMinutesUsed,"totalMinutesUsed")})}}class Nb{constructor({basePlanId:e,embeddedFreeTierStatus:t,isDeactivated:i,isOnTrial:n,onTrialUntil:s,trialStatus:a}){this.basePlanId=e,this.isDeactivated=i,this.isOnTrial=n,this.onTrialUntil=s||null,this.trialStatus=a||null,this.embeddedFreeTierStatus=t||null}static fromJson(e){return new Nb({basePlanId:"string"==typeof e.basePlanId?e.basePlanId:null,isDeactivated:rb(e.isDeactivated,"isDeactivated"),isOnTrial:rb(e.isOnTrial,"isOnTrial"),onTrialUntil:"string"==typeof e.onTrialUntil?new Date(e.onTrialUntil):null,trialStatus:"string"==typeof e.trialStatus?e.trialStatus:null,embeddedFreeTierStatus:e.embeddedFreeTierStatus?Ab.fromJson(e.embeddedFreeTierStatus):null})}}function Bb(e){return null!=e}function Fb(e={}){return{maxNumberOfInvitationsAndUsers:Bb(null==e?void 0:e.maxNumberOfInvitationsAndUsers)?Number(null==e?void 0:e.maxNumberOfInvitationsAndUsers):null,maxNumberOfClaimedRooms:Bb(null==e?void 0:e.maxNumberOfClaimedRooms)?Number(null==e?void 0:e.maxNumberOfClaimedRooms):null,maxRoomLimitPerOrganization:Bb(null==e?void 0:e.maxRoomLimitPerOrganization)?Number(null==e?void 0:e.maxRoomLimitPerOrganization):null,trialMinutesLimit:Bb(null==e?void 0:e.trialMinutesLimit)?Number(null==e?void 0:e.trialMinutesLimit):null,includedUnits:Bb(null==e?void 0:e.includedUnits)?Number(null==e?void 0:e.includedUnits):null}}class Ub{constructor(e){this.logoImageUrl=null,this.roomBackgroundImageUrl=null,this.roomBackgroundThumbnailUrl=null,this.roomKnockPageBackgroundImageUrl=null,this.roomKnockPageBackgroundThumbnailUrl=null,this.preferences=null,this.onboardingSurvey=null,this.type=null,pb(e,Object,"properties"),cb(e.organizationId,"organizationId"),cb(e.organizationName,"organizationName"),cb(e.subdomain,"subdomain"),pb(e.permissions,Object,"permissions"),pb(e.limits,Object,"limits"),this.organizationId=e.organizationId,this.organizationName=e.organizationName,this.subdomain=e.subdomain,this.permissions=e.permissions,this.limits=e.limits,this.account=e.account?new Nb(e.account):null,this.logoImageUrl=e.logoImageUrl,this.roomBackgroundImageUrl=e.roomBackgroundImageUrl,this.roomBackgroundThumbnailUrl=e.roomBackgroundThumbnailUrl,this.roomKnockPageBackgroundImageUrl=e.roomKnockPageBackgroundImageUrl,this.roomKnockPageBackgroundThumbnailUrl=e.roomKnockPageBackgroundThumbnailUrl,this.preferences=e.preferences,this.onboardingSurvey=e.onboardingSurvey,this.type=e.type}static fromJson(e){const t=pb(e,Object,"data"),i=(null==t?void 0:t.preferences)||{},n=(null==t?void 0:t.onboardingSurvey)||null,s=pb(t.permissions,Object,"permissions");return new Ub({organizationId:cb(t.organizationId,"organizationId"),organizationName:cb(t.organizationName,"organizationName"),subdomain:cb(t.subdomain,"subdomain"),permissions:s,limits:Fb(pb(t.limits,Object,"limits")),account:t.account?Nb.fromJson(t.account):null,logoImageUrl:"string"==typeof t.logoImageUrl?t.logoImageUrl:null,roomBackgroundImageUrl:"string"==typeof t.roomBackgroundImageUrl?t.roomBackgroundImageUrl:null,roomBackgroundThumbnailUrl:"string"==typeof t.roomBackgroundThumbnailUrl?t.roomBackgroundThumbnailUrl:null,roomKnockPageBackgroundImageUrl:"string"==typeof t.roomKnockPageBackgroundImageUrl?t.roomKnockPageBackgroundImageUrl:null,roomKnockPageBackgroundThumbnailUrl:"string"==typeof t.roomKnockPageBackgroundThumbnailUrl?t.roomKnockPageBackgroundThumbnailUrl:null,preferences:i,onboardingSurvey:n,type:"string"==typeof t.type?t.type:null})}}Ub.GLOBAL_ORGANIZATION_ID="1";class zb{constructor({apiClient:e}){this._apiClient=pb(e,yb)}createOrganization({organizationName:e,subdomain:t,owner:i}){const{displayName:n,consents:s}=i||{},a="email"in i?{value:i.email,verificationCode:cb(i.verificationCode,"owner.verificationCode")}:null,r="idToken"in i?i.idToken:null;if(cb(t,"subdomain"),cb(e,"organizationName"),cb(n,"owner.displayName"),u.ok(a||r,"owner.email or owner.idToken is required"),s){lb(s,"consents");for(const{consentRevisionId:e,action:t}of s)cb(e,"consentRevisionId"),mb(t,"action")}return this._apiClient.request("/organizations",{method:"POST",data:{organizationName:e,type:"private",subdomain:t,owner:Object.assign(Object.assign(Object.assign(Object.assign({},a&&{email:a}),r&&{idToken:r}),s&&{consents:s}),{displayName:n})}}).then((({data:e})=>xb(e,"organizationId")))}getOrganizationBySubdomain(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/?fields=permissions,account,onboardingSurvey`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationByOrganizationId(e){return cb(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}?fields=permissions,account`,{method:"GET"}).then((({data:e})=>Ub.fromJson(e))).catch((e=>{if(e instanceof sb){if(404===e.status)return null;throw new Error(e.statusText)}throw e}))}getOrganizationsByContactPoint(e){const{code:t}=e,i="email"in e?e.email:null,n="phoneNumber"in e?e.phoneNumber:null;u.ok((i||n)&&!(i&&n),"either email or phoneNumber is required"),cb(t,"code");const s=i?{type:"email",value:i}:{type:"phoneNumber",value:n};return this._apiClient.request("/organization-queries",{method:"POST",data:{contactPoint:s,code:t}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(e)))))}getOrganizationsByIdToken({idToken:e}){return cb(e,"idToken"),this._apiClient.request("/organization-queries",{method:"POST",data:{idToken:e}}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getOrganizationsByLoggedInUser(){return this._apiClient.request("/user/organizations",{method:"GET"}).then((({data:e})=>Cb(e,"organizations",(e=>Ub.fromJson(Object.assign({permissions:{},limits:{}},ub(e,"organization")))))))}getSubdomainAvailability(e){return cb(e,"subdomain"),this._apiClient.request(`/organization-subdomains/${encodeURIComponent(e)}/availability`,{method:"GET"}).then((({data:e})=>(pb(e,Object,"data"),{status:xb(e,"status")})))}updatePreferences({organizationId:e,preferences:t}){return ab(e,"organizationId"),ab(t,"preferences"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}deleteOrganization({organizationId:e}){return ab(e,"organizationId"),this._apiClient.request(`/organizations/${encodeURIComponent(e)}`,{method:"DELETE"}).then((()=>{}))}}class qb{constructor({organizationService:e,subdomain:t}){pb(e,zb),cb(t,"subdomain"),this._organizationService=e,this._subdomain=t,this._organizationPromise=null}initOrganization(){return this.fetchOrganization().then((()=>{}))}fetchOrganization(){return this._organizationPromise||(this._organizationPromise=this._organizationService.getOrganizationBySubdomain(this._subdomain)),this._organizationPromise}}class $b{constructor(e={}){u.ok(e instanceof Object,"properties<object> must be empty or an object"),this.isClaimed=!1,this.isBanned=!1,this.isLocked=!1,this.knockPage={backgroundImageUrl:null,backgroundThumbnailUrl:null},this.logoUrl=null,this.backgroundImageUrl=null,this.backgroundThumbnailUrl=null,this.type=null,this.legacyRoomType=null,this.mode=null,this.product=null,this.roomName=null,this.theme=null,this.preferences={},this.protectedPreferences={},this.publicProfile=null;const t={};Object.getOwnPropertyNames(e).forEach((i=>{-1!==Object.getOwnPropertyNames(this).indexOf(i)&&(t[i]=e[i])})),void 0!==e.ownerId&&(this.ownerId=e.ownerId),void 0!==e.meeting&&(this.meeting=e.meeting),Object.assign(this,t)}}class Vb{constructor({meetingId:e,roomName:t,roomUrl:i,startDate:n,endDate:s,hostRoomUrl:a,viewerRoomUrl:r}){cb(e,"meetingId"),cb(t,"roomName"),cb(i,"roomUrl"),pb(n,Date,"startDate"),pb(s,Date,"endDate"),this.meetingId=e,this.roomName=t,this.roomUrl=i,this.startDate=n,this.endDate=s,this.hostRoomUrl=a,this.viewerRoomUrl=r}static fromJson(e){return new Vb({meetingId:xb(e,"meetingId"),roomName:xb(e,"roomName"),roomUrl:xb(e,"roomUrl"),startDate:Rb(e,"startDate"),endDate:Rb(e,"endDate"),hostRoomUrl:wb(e,"hostRoomUrl"),viewerRoomUrl:wb(e,"viewerRoomUrl")})}}function Wb(e,t=""){return`/room/${encodeURIComponent(e.substring(1))}${t}`}class Gb{constructor({organizationApiClient:e}){this._organizationApiClient=pb(e,Mb)}getRooms({types:e,fields:t=[]}={}){return lb(e,"types"),lb(t,"fields"),this._organizationApiClient.request("/room",{method:"GET",params:{types:e.join(","),fields:t.join(","),includeOnlyLegacyRoomType:"false"}}).then((({data:e})=>e.rooms.map((e=>new $b(e)))))}getRoom({roomName:e,fields:t}){db(e);const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/rooms/${i}`,{method:"GET",params:Object.assign({includeOnlyLegacyRoomType:"false"},t&&{fields:t.join(",")})}).then((({data:t})=>new $b(Object.assign({},t,Object.assign({roomName:e},t.meeting&&{meeting:Vb.fromJson(t.meeting)}))))).catch((t=>{if(404===t.status)return new $b({roomName:e,isClaimed:!1,mode:"normal",product:{categoryName:"personal_free"},type:"personal",legacyRoomType:"free"});if(400===t.status&&"Banned room"===t.data.error)return new $b({roomName:e,isBanned:!0});throw new Error(t.data?t.data.error:"Could not fetch room information")}))}claimRoom({roomName:e,type:t,mode:i,isLocked:n}){return db(e),cb(t,"type"),this._organizationApiClient.request("/room/claim",{method:"POST",data:Object.assign(Object.assign({roomName:e,type:t},"string"==typeof i&&{mode:i}),"boolean"==typeof n&&{isLocked:n})}).then((()=>{})).catch((e=>{throw new Error(e.data.error||"Failed to claim room")}))}unclaimRoom(e){db(e);const t=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${t}`,{method:"DELETE"}).then((()=>{}))}renameRoom({roomName:e,newRoomName:t}){db(e),cb(t,"newRoomName");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/roomName`,{method:"PUT",data:{newRoomName:t}}).then((()=>{}))}changeMode({roomName:e,mode:t}){db(e),cb(t,"mode");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/mode`,{method:"PUT",data:{mode:t}}).then((()=>{}))}updatePreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/preferences`,{method:"PATCH",data:t}).then((()=>{}))}updateProtectedPreferences({roomName:e,preferences:t}){db(e),pb(t,Object,"preferences");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/protected-preferences`,{method:"PATCH",data:t}).then((()=>{}))}getRoomPermissions(e,{roomKey:t}={}){return db(e),this._organizationApiClient.request(Wb(e,"/permissions"),Object.assign({method:"GET"},t&&{headers:{"X-Whereby-Room-Key":t}})).then((e=>{const{permissions:t,limits:i}=e.data;return{permissions:t,limits:i}}))}getRoomMetrics({roomName:e,metrics:t,from:i,to:n}){return db(e),cb(t,"metrics"),this._organizationApiClient.request(Wb(e,"/metrics"),{method:"GET",params:{metrics:t,from:i,to:n}}).then((e=>e.data))}changeType({roomName:e,type:t}){db(e),function(e,t,i){if(ab(e,"value"),lb(t,"allowedValues"),!t.includes(e))throw new Error(`${i}<string> must be one of the following: ${t.join(", ")}`)}(t,["personal","personal_xl"],"type");const i=encodeURIComponent(e.substring(1));return this._organizationApiClient.request(`/room/${i}/type`,{method:"PUT",data:{type:t}}).then((()=>{}))}getForestSocialImage({roomName:e,count:t}){return db(e),ob(t,"count"),this._organizationApiClient.request(Wb(e,`/forest-social-image/${t}`),{method:"GET"}).then((e=>e.data.imageUrl))}}class Hb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){this.isLocalParticipant=!1,this.displayName=e,this.id=t,this.stream=i,this.isAudioEnabled=n,this.isVideoEnabled=s}}class Kb extends Hb{constructor({displayName:e,id:t,newJoiner:i,streams:n,isAudioEnabled:s,isVideoEnabled:a}){super({displayName:e,id:t,isAudioEnabled:s,isVideoEnabled:a}),this.newJoiner=i,this.streams=n.map((e=>({id:e,state:i?"new_accept":"to_accept"})))}updateStreamState(e,t){const i=this.streams.find((t=>t.id===e));i&&(i.state=t)}}class Jb extends Hb{constructor({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}){super({displayName:e,id:t,stream:i,isAudioEnabled:n,isVideoEnabled:s}),this.isLocalParticipant=!0}}const Qb=process.env.REACT_APP_API_BASE_URL||"https://api.whereby.dev",Yb=process.env.REACT_APP_SIGNAL_BASE_URL||"wss://signal.appearin.net",Xb=["recorder","streamer"];const Zb=()=>{},e_=EventTarget;class t_ extends e_{constructor(e,{displayName:t,localMedia:i,localMediaConstraints:n,logger:s,roomKey:a}){super(),this.localParticipant=null,this.remoteParticipants=[],this._deviceCredentials=null,this._ownsLocalMedia=!1,this.organizationId="",this.roomConnectionStatus="",this.selfId=null,this.roomUrl=new URL(e);const r=new URLSearchParams(this.roomUrl.search);this._roomKey=a||r.get("roomKey"),this.roomName=this.roomUrl.pathname,this.logger=s||{debug:Zb,error:Zb,log:Zb,warn:Zb},this.displayName=t,this.localMediaConstraints=n;const o=Gh({host:this.roomUrl.host});if(i)this.localMedia=i;else{if(!n)throw new Error("Missing constraints");this.localMedia=new fi(n),this._ownsLocalMedia=!0}this.credentialsService=jb.create({baseUrl:Qb}),this.apiClient=new yb({fetchDeviceCredentials:this.credentialsService.getCredentials.bind(this.credentialsService),baseUrl:Qb}),this.organizationService=new zb({apiClient:this.apiClient}),this.organizationServiceCache=new qb({organizationService:this.organizationService,subdomain:o.subdomain}),this.organizationApiClient=new Mb({apiClient:this.apiClient,fetchOrganization:()=>Zt(this,void 0,void 0,(function*(){return(yield this.organizationServiceCache.fetchOrganization())||void 0}))}),this.roomService=new Gb({organizationApiClient:this.organizationApiClient}),this.signalSocket=function(){const e=new URL(Yb),t=`${e.pathname.replace(/^\/$/,"")}/protocol/socket.io/v4`,i=e.origin;return new po(i,{autoConnect:!1,host:i,path:t,reconnectionDelay:5e3,reconnectionDelayMax:3e4,timeout:1e4,withCredentials:!0})}(),this.signalSocket.on("new_client",this._handleNewClient.bind(this)),this.signalSocket.on("chat_message",this._handleNewChatMessage.bind(this)),this.signalSocket.on("client_left",this._handleClientLeft.bind(this)),this.signalSocket.on("audio_enabled",this._handleClientAudioEnabled.bind(this)),this.signalSocket.on("video_enabled",this._handleClientVideoEnabled.bind(this)),this.signalSocket.on("client_metadata_received",this._handleClientMetadataReceived.bind(this)),this.signalSocket.on("knock_handled",this._handleKnockHandled.bind(this)),this.signalSocket.on("knocker_left",this._handleKnockerLeft.bind(this)),this.signalSocket.on("room_joined",this._handleRoomJoined.bind(this)),this.signalSocket.on("room_knocked",this._handleRoomKnocked.bind(this)),this.signalSocket.on("cloud_recording_stopped",this._handleCloudRecordingStopped.bind(this)),this.signalSocket.on("streaming_stopped",this._handleStreamingStopped.bind(this)),this.signalSocket.on("disconnect",this._handleDisconnect.bind(this)),this.signalSocket.on("connect_error",this._handleDisconnect.bind(this)),this.signalSocketManager=this.signalSocket.getManager(),this.signalSocketManager.on("reconnect",this._handleReconnect.bind(this)),this.localMedia.addEventListener("camera_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_video",{enabled:t})})),this.localMedia.addEventListener("microphone_enabled",(e=>{const{enabled:t}=e.detail;this.signalSocket.emit("enable_audio",{enabled:t})}));const c={getMediaConstraints:()=>({audio:this.localMedia.isMicrophoneEnabled(),video:this.localMedia.isCameraEnabled()}),deferrable:e=>!e};this.rtcManagerDispatcher=new Vh({emitter:{emit:this._handleRtcEvent.bind(this)},serverSocket:this.signalSocket,webrtcProvider:c,features:{lowDataModeEnabled:!1,sfuServerOverrideHost:void 0,turnServerOverrideHost:void 0,useOnlyTURN:void 0,vp9On:!1,h264On:!1,simulcastScreenshareOn:!1}})}get roomKey(){return this._roomKey}_handleNewChatMessage(e){this.dispatchEvent(new CustomEvent("chat_message",{detail:e}))}_handleCloudRecordingStarted({client:e}){this.dispatchEvent(new CustomEvent("cloud_recording_started",{detail:{status:"recording",startedAt:e.startedCloudRecordingAt?new Date(e.startedCloudRecordingAt).getTime():(new Date).getTime()}}))}_handleStreamingStarted(){this.dispatchEvent(new CustomEvent("streaming_started",{detail:{status:"streaming",startedAt:(new Date).getTime()}}))}_handleNewClient({client:e}){if("recorder"===e.role.roleName&&this._handleCloudRecordingStarted({client:e}),"streamer"===e.role.roleName&&this._handleStreamingStarted(),Xb.includes(e.role.roleName))return;const t=new Kb(Object.assign(Object.assign({},e),{newJoiner:!0}));this.remoteParticipants=[...this.remoteParticipants,t],this._handleAcceptStreams([t]),this.dispatchEvent(new CustomEvent("participant_joined",{detail:{remoteParticipant:t}}))}_handleClientLeft({clientId:e}){const t=this.remoteParticipants.find((t=>t.id===e));this.remoteParticipants=this.remoteParticipants.filter((t=>t.id!==e)),t&&this.dispatchEvent(new CustomEvent("participant_left",{detail:{participantId:t.id}}))}_handleClientAudioEnabled({clientId:e,isAudioEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_audio_enabled",{detail:{participantId:i.id,isAudioEnabled:t}}))}_handleClientVideoEnabled({clientId:e,isVideoEnabled:t}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_video_enabled",{detail:{participantId:i.id,isVideoEnabled:t}}))}_handleClientMetadataReceived({payload:{clientId:e,displayName:t}}){const i=this.remoteParticipants.find((t=>t.id===e));i&&this.dispatchEvent(new CustomEvent("participant_metadata_changed",{detail:{participantId:i.id,displayName:t}}))}_handleKnockHandled(e){const{clientId:t,resolution:i}=e;t===this.selfId&&("accepted"===i?(this.roomConnectionStatus="accepted",this._roomKey=e.metadata.roomKey,this._joinRoom()):"rejected"===i&&(this.roomConnectionStatus="rejected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))))}_handleKnockerLeft(e){const{clientId:t}=e;this.dispatchEvent(new CustomEvent("waiting_participant_left",{detail:{participantId:t}}))}_handleRoomJoined(e){const{error:t,isLocked:i,room:n,selfId:s}=e;if(this.selfId=s,"room_locked"===t&&i)return this.roomConnectionStatus="room_locked",void this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));if(n){const{clients:e,knockers:t}=n,i=e.find((e=>e.id===s));if(!i)throw new Error("Missing local client");this.localParticipant=new Jb(Object.assign(Object.assign({},i),{stream:this.localMedia.stream||void 0}));const a=e.find((e=>"recorder"===e.role.roleName));a&&this._handleCloudRecordingStarted({client:a});e.find((e=>"streamer"===e.role.roleName))&&this._handleStreamingStarted(),this.remoteParticipants=e.filter((e=>e.id!==s)).filter((e=>!Xb.includes(e.role.roleName))).map((e=>new Kb(Object.assign(Object.assign({},e),{newJoiner:!1})))),this.roomConnectionStatus="connected",this.dispatchEvent(new CustomEvent("room_joined",{detail:{localParticipant:this.localParticipant,remoteParticipants:this.remoteParticipants,waitingParticipants:t.map((e=>({id:e.clientId,displayName:e.displayName})))}}))}}_handleRoomKnocked(e){const{clientId:t,displayName:i}=e;this.dispatchEvent(new CustomEvent("waiting_participant_joined",{detail:{participantId:t,displayName:i}}))}_handleReconnect(){this.logger.log("Reconnected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}_handleDisconnect(){this.roomConnectionStatus="disconnected",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}))}_handleCloudRecordingStopped(){this.dispatchEvent(new CustomEvent("cloud_recording_stopped"))}_handleStreamingStopped(){this.dispatchEvent(new CustomEvent("streaming_stopped"))}_handleRtcEvent(e,t){return"rtc_manager_created"===e?this._handleRtcManagerCreated(t):"stream_added"===e?this._handleStreamAdded(t):"rtc_manager_destroyed"===e?this._handleRtcManagerDestroyed():void this.logger.log(`Unhandled RTC event ${e}`)}_handleRtcManagerCreated({rtcManager:e}){var t;this.rtcManager=e,this.localMedia.addRtcManager(e),this.localMedia.stream&&(null===(t=this.rtcManager)||void 0===t||t.addNewStream("0",this.localMedia.stream,!this.localMedia.isMicrophoneEnabled(),!this.localMedia.isCameraEnabled())),this.remoteParticipants.length&&this._handleAcceptStreams(this.remoteParticipants)}_handleRtcManagerDestroyed(){this.rtcManager=void 0}_handleAcceptStreams(e){var t,i;if(!this.rtcManager)return void this.logger.log("Unable to accept streams, no rtc manager");const n=null===(i=(t=this.rtcManager).shouldAcceptStreamsFromBothSides)||void 0===i?void 0:i.call(t);e.forEach((e=>{const{id:t,streams:i,newJoiner:s}=e;i.forEach((i=>{var a,r;const{id:o,state:c}=i;let p;if("done_accept"!==c&&(p=(s&&"0"===o?"new":"to")+"_accept"),p){if("to_accept"===p||"new_accept"===p&&n||"old_accept"===p&&!n)this.logger.log(`Accepting stream ${o} from ${t}`),null===(a=this.rtcManager)||void 0===a||a.acceptNewStream({streamId:"0"===o?t:o,clientId:t,shouldAddLocalVideo:"0"===o,activeBreakout:false});else if("new_accept"===p||"old_accept"===p);else if("to_unaccept"===p)this.logger.log(`Disconnecting stream ${o} from ${t}`),null===(r=this.rtcManager)||void 0===r||r.disconnect("0"===o?t:o,false);else if("done_accept"!==p)return void this.logger.warn(`Stream state not handled: ${p} for ${t}-${o}`);e.updateStreamState(o,c.replace(/to_|new_|old_/,"done_"))}}))}))}_handleStreamAdded({clientId:e,stream:t,streamId:i}){this.remoteParticipants.find((t=>t.id===e))?this.dispatchEvent(new CustomEvent("participant_stream_added",{detail:{participantId:e,stream:t,streamId:i}})):this.logger.log("WARN: Could not find participant for incoming stream")}_joinRoom(){this.signalSocket.emit("join_room",{avatarUrl:null,config:{isAudioEnabled:this.localMedia.isMicrophoneEnabled(),isVideoEnabled:this.localMedia.isCameraEnabled()},deviceCapabilities:{canScreenshare:!0},displayName:this.displayName,isCoLocated:!1,isDevicePermissionDenied:!1,kickFromOtherRooms:!1,organizationId:this.organizationId,roomKey:this.roomKey,roomName:this.roomName,selfId:"",userAgent:`browser-sdk:${r_}`})}join(){return Zt(this,void 0,void 0,(function*(){if(["connected","connecting"].includes(this.roomConnectionStatus))return void console.warn(`Trying to join when room state is already ${this.roomConnectionStatus}`);this.logger.log("Joining room"),this.signalSocket.connect(),this.roomConnectionStatus="connecting",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}}));const e=yield this.organizationServiceCache.fetchOrganization();if(!e)throw new Error("Invalid room url");this.organizationId=e.organizationId,this._ownsLocalMedia&&(yield this.localMedia.start()),this._deviceCredentials=yield this.credentialsService.getCredentials(),this.logger.log("Connected to signal socket"),this.signalSocket.emit("identify_device",{deviceCredentials:this._deviceCredentials}),this.signalSocket.once("device_identified",(()=>{this._joinRoom()}))}))}knock(){this.roomConnectionStatus="knocking",this.dispatchEvent(new CustomEvent("room_connection_status_changed",{detail:{roomConnectionStatus:this.roomConnectionStatus}})),this.signalSocket.emit("knock_room",{displayName:this.displayName,imageUrl:null,kickFromOtherRooms:!0,liveVideo:!1,organizationId:this.organizationId,roomKey:this._roomKey,roomName:this.roomName})}leave(){this.roomConnectionStatus="disconnecting",this._ownsLocalMedia&&this.localMedia.stop(),this.rtcManager&&(this.localMedia.removeRtcManager(this.rtcManager),this.rtcManager.disconnectAll(),this.rtcManager=void 0),this.signalSocket&&(this.signalSocket.emit("leave_room"),this.signalSocket.disconnect(),this.roomConnectionStatus="disconnected")}sendChatMessage(e){this.signalSocket.emit("chat_message",{text:e})}setDisplayName(e){this.signalSocket.emit("send_client_metadata",{type:"UserData",payload:{displayName:e}})}acceptWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"accept",clientId:e,response:{}})}rejectWaitingParticipant(e){this.signalSocket.emit("handle_knock",{action:"reject",clientId:e,response:{}})}}const i_={chatMessages:[],cloudRecording:{status:"",startedAt:null},isJoining:!1,joinError:null,mostRecentChatMessage:null,remoteParticipants:[],roomConnectionStatus:"",streaming:{status:"",startedAt:null},waitingParticipants:[]};function n_(e,t,i){const n=e.find((e=>e.id===t));if(!n)return e;const s=e.indexOf(n);return[...e.slice(0,s),Object.assign(Object.assign({},n),i),...e.slice(s+1)]}function s_(e,t){switch(t.type){case"CHAT_MESSAGE":return Object.assign(Object.assign({},e),{chatMessages:[...e.chatMessages,t.payload],mostRecentChatMessage:t.payload});case"CLOUD_RECORDING_STARTED":return Object.assign(Object.assign({},e),{cloudRecording:{status:t.payload.status,startedAt:t.payload.startedAt}});case"CLOUD_RECORDING_STOPPED":return Object.assign(Object.assign({},e),{cloudRecording:{status:"",startedAt:null}});case"ROOM_JOINED":return Object.assign(Object.assign({},e),{localParticipant:t.payload.localParticipant,remoteParticipants:t.payload.remoteParticipants,waitingParticipants:t.payload.waitingParticipants,roomConnectionStatus:"connected"});case"ROOM_CONNECTION_STATUS_CHANGED":return Object.assign(Object.assign({},e),{roomConnectionStatus:t.payload.roomConnectionStatus});case"PARTICIPANT_AUDIO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{isAudioEnabled:t.payload.isAudioEnabled})});case"PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants,t.payload.paritipant]});case"PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.filter((e=>e.id!==t.payload.participantId))]});case"PARTICIPANT_STREAM_ADDED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{stream:t.payload.stream})});case"PARTICIPANT_VIDEO_ENABLED":return Object.assign(Object.assign({},e),{remoteParticipants:n_(e.remoteParticipants,t.payload.participantId,{isVideoEnabled:t.payload.isVideoEnabled})});case"PARTICIPANT_METADATA_CHANGED":return Object.assign(Object.assign({},e),{remoteParticipants:[...e.remoteParticipants.map((e=>e.id===t.payload.participantId?Object.assign(Object.assign({},e),{displayName:t.payload.displayName}):e))]});case"LOCAL_CLIENT_DISPLAY_NAME_CHANGED":return e.localParticipant?Object.assign(Object.assign({},e),{localParticipant:Object.assign(Object.assign({},e.localParticipant),{displayName:t.payload.displayName})}):e;case"STREAMING_STARTED":return Object.assign(Object.assign({},e),{streaming:{status:t.payload.status,startedAt:t.payload.startedAt}});case"STREAMING_STOPPED":return Object.assign(Object.assign({},e),{streaming:{status:"",startedAt:null}});case"WAITING_PARTICIPANT_JOINED":return Object.assign(Object.assign({},e),{waitingParticipants:[...e.waitingParticipants,{id:t.payload.participantId,displayName:t.payload.displayName}]});case"WAITING_PARTICIPANT_LEFT":return Object.assign(Object.assign({},e),{waitingParticipants:e.waitingParticipants.filter((e=>e.id!==t.payload.participantId))});default:throw e}}function a_(e,t){const[i]=si.useState((()=>{var i;return new t_(e,Object.assign(Object.assign({},t),{localMedia:(null===(i=null==t?void 0:t.localMedia)||void 0===i?void 0:i._ref)||void 0}))})),[n,s]=si.useReducer(s_,i_);return si.useEffect((()=>(i.addEventListener("chat_message",(e=>{const t=e.detail;s({type:"CHAT_MESSAGE",payload:t})})),i.addEventListener("cloud_recording_started",(e=>{const{status:t,startedAt:i}=e.detail;s({type:"CLOUD_RECORDING_STARTED",payload:{status:t,startedAt:i}})})),i.addEventListener("cloud_recording_stopped",(()=>{s({type:"CLOUD_RECORDING_STOPPED"})})),i.addEventListener("participant_audio_enabled",(e=>{const{participantId:t,isAudioEnabled:i}=e.detail;s({type:"PARTICIPANT_AUDIO_ENABLED",payload:{participantId:t,isAudioEnabled:i}})})),i.addEventListener("participant_joined",(e=>{const{remoteParticipant:t}=e.detail;s({type:"PARTICIPANT_JOINED",payload:{paritipant:t}})})),i.addEventListener("participant_left",(e=>{const{participantId:t}=e.detail;s({type:"PARTICIPANT_LEFT",payload:{participantId:t}})})),i.addEventListener("participant_stream_added",(e=>{const{participantId:t,stream:i}=e.detail;s({type:"PARTICIPANT_STREAM_ADDED",payload:{participantId:t,stream:i}})})),i.addEventListener("room_connection_status_changed",(e=>{const{roomConnectionStatus:t}=e.detail;s({type:"ROOM_CONNECTION_STATUS_CHANGED",payload:{roomConnectionStatus:t}})})),i.addEventListener("room_joined",(e=>{const{localParticipant:t,remoteParticipants:i,waitingParticipants:n}=e.detail;s({type:"ROOM_JOINED",payload:{localParticipant:t,remoteParticipants:i,waitingParticipants:n}})})),i.addEventListener("participant_video_enabled",(e=>{const{participantId:t,isVideoEnabled:i}=e.detail;s({type:"PARTICIPANT_VIDEO_ENABLED",payload:{participantId:t,isVideoEnabled:i}})})),i.addEventListener("participant_metadata_changed",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"PARTICIPANT_METADATA_CHANGED",payload:{participantId:t,displayName:i}})})),i.addEventListener("streaming_started",(e=>{const{status:t,startedAt:i}=e.detail;s({type:"STREAMING_STARTED",payload:{status:t,startedAt:i}})})),i.addEventListener("streaming_stopped",(()=>{s({type:"STREAMING_STOPPED"})})),i.addEventListener("waiting_participant_joined",(e=>{const{participantId:t,displayName:i}=e.detail;s({type:"WAITING_PARTICIPANT_JOINED",payload:{participantId:t,displayName:i}})})),i.addEventListener("waiting_participant_left",(e=>{const{participantId:t}=e.detail;s({type:"WAITING_PARTICIPANT_LEFT",payload:{participantId:t}})})),i.join(),()=>{i.leave()})),[]),{state:n,actions:{knock:()=>{i.knock()},sendChatMessage:e=>{i.sendChatMessage(e)},setDisplayName:e=>{i.setDisplayName(e),s({type:"LOCAL_CLIENT_DISPLAY_NAME_CHANGED",payload:{displayName:e}})},toggleCamera:e=>{i.localMedia.toggleCameraEnabled(e)},toggleMicrophone:e=>{i.localMedia.toggleMichrophoneEnabled(e)},acceptWaitingParticipant:e=>{i.acceptWaitingParticipant(e)},rejectWaitingParticipant:e=>{i.rejectWaitingParticipant(e)}},components:{VideoView:mi},_ref:i}}const r_="2.0.0-alpha15";export{mi as VideoView,r_ as sdkVersion,bi as useLocalMedia,a_ as useRoomConnection};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whereby.com/browser-sdk",
3
- "version": "2.0.0-alpha13",
3
+ "version": "2.0.0-alpha15",
4
4
  "description": "Modules for integration Whereby video in web apps",
5
5
  "author": "Whereby AS",
6
6
  "license": "MIT",