@cuekit-ai/react 1.6.6 → 1.6.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-JVYSFKMO.mjs → chunk-ZP7AXODE.mjs} +673 -993
- package/dist/index.d.mts +32 -10
- package/dist/index.d.ts +32 -10
- package/dist/index.js +810 -951
- package/dist/index.mjs +260 -82
- package/dist/{webrtc-service-KN5SEJKS.mjs → webrtc-service-IMARTHNM.mjs} +1 -1
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -5363,7 +5363,7 @@ function supportsAV1() {
|
|
|
5363
5363
|
if (!("getCapabilities" in RTCRtpSender)) {
|
|
5364
5364
|
return false;
|
|
5365
5365
|
}
|
|
5366
|
-
if (isSafari()
|
|
5366
|
+
if (isSafari()) {
|
|
5367
5367
|
return false;
|
|
5368
5368
|
}
|
|
5369
5369
|
const capabilities = RTCRtpSender.getCapabilities("video");
|
|
@@ -5460,9 +5460,9 @@ function isE2EESimulcastSupported() {
|
|
|
5460
5460
|
if (browser) {
|
|
5461
5461
|
if (browser.name !== "Safari" && browser.os !== "iOS") {
|
|
5462
5462
|
return true;
|
|
5463
|
-
} else if (browser.os === "iOS" && browser.osVersion && compareVersions(browser.osVersion
|
|
5463
|
+
} else if (browser.os === "iOS" && browser.osVersion && compareVersions(supportedSafariVersion, browser.osVersion) >= 0) {
|
|
5464
5464
|
return true;
|
|
5465
|
-
} else if (browser.name === "Safari" && compareVersions(browser.version
|
|
5465
|
+
} else if (browser.name === "Safari" && compareVersions(supportedSafariVersion, browser.version) >= 0) {
|
|
5466
5466
|
return true;
|
|
5467
5467
|
} else {
|
|
5468
5468
|
return false;
|
|
@@ -5641,13 +5641,13 @@ function unwrapConstraint(constraint) {
|
|
|
5641
5641
|
if (Array.isArray(constraint)) {
|
|
5642
5642
|
return constraint[0];
|
|
5643
5643
|
}
|
|
5644
|
-
if (constraint.exact
|
|
5644
|
+
if (constraint.exact) {
|
|
5645
5645
|
if (Array.isArray(constraint.exact)) {
|
|
5646
5646
|
return constraint.exact[0];
|
|
5647
5647
|
}
|
|
5648
5648
|
return constraint.exact;
|
|
5649
5649
|
}
|
|
5650
|
-
if (constraint.ideal
|
|
5650
|
+
if (constraint.ideal) {
|
|
5651
5651
|
if (Array.isArray(constraint.ideal)) {
|
|
5652
5652
|
return constraint.ideal[0];
|
|
5653
5653
|
}
|
|
@@ -5870,7 +5870,7 @@ function constraintsForOptions(options) {
|
|
|
5870
5870
|
function detectSilence(track_1) {
|
|
5871
5871
|
return __awaiter(this, arguments, void 0, function(track) {
|
|
5872
5872
|
let timeOffset = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 200;
|
|
5873
|
-
return
|
|
5873
|
+
return function* () {
|
|
5874
5874
|
const ctx = getNewAudioContext();
|
|
5875
5875
|
if (ctx) {
|
|
5876
5876
|
const analyser = ctx.createAnalyser();
|
|
@@ -5886,7 +5886,7 @@ function detectSilence(track_1) {
|
|
|
5886
5886
|
return !someNoise;
|
|
5887
5887
|
}
|
|
5888
5888
|
return false;
|
|
5889
|
-
}
|
|
5889
|
+
}();
|
|
5890
5890
|
});
|
|
5891
5891
|
}
|
|
5892
5892
|
function getNewAudioContext() {
|
|
@@ -7610,7 +7610,7 @@ function isIPPrivate(address) {
|
|
|
7610
7610
|
}
|
|
7611
7611
|
return false;
|
|
7612
7612
|
}
|
|
7613
|
-
var e, h, o, _, FLOAT32_MAX, FLOAT32_MIN, UINT32_MAX, INT32_MAX, INT32_MIN, enumTypeSymbol, Message, TWO_PWR_32_DBL, decimalFrom1e7WithLeadingZeros, protoInt64, ScalarType, LongType, WireType, BinaryWriter, BinaryReader, encTable, decTable, protoBase64, jsonReadDefaults, jsonWriteDefaults, tokenNull, tokenIgnoredUnknownEnum, unknownFieldsSymbol, readDefaults, writeDefaults, InternalFieldList, fieldJsonName, reservedObjectProperties, reservedMessageProperties, fallback, safeMessageProperty, safeObjectProperty, InternalOneofInfo, proto3, Timestamp, MetricsBatch, TimeSeriesMetric, MetricSample, EventMetric, BackupCodecPolicy$1, TrackType, TrackSource, VideoQuality$1, ConnectionQuality$1, ClientConfigSetting, DisconnectReason, ReconnectReason, SubscriptionError, AudioTrackFeature, Room$1, Codec, ParticipantPermission, ParticipantInfo, ParticipantInfo_State, ParticipantInfo_Kind, ParticipantInfo_KindDetail, Encryption_Type, SimulcastCodecInfo, TrackInfo, VideoLayer, DataPacket, DataPacket_Kind, ActiveSpeakerUpdate, SpeakerInfo, UserPacket, SipDTMF, Transcription, TranscriptionSegment, ChatMessage, RpcRequest, RpcAck, RpcResponse, RpcError$1, ParticipantTracks, ServerInfo, ServerInfo_Edition, ClientInfo, ClientInfo_SDK, ClientConfiguration, VideoConfiguration, DisabledCodecs, TimedVersion, DataStream_OperationType, DataStream_TextHeader, DataStream_ByteHeader, DataStream_Header, DataStream_Chunk, DataStream_Trailer, SignalTarget, StreamState, CandidateProtocol, SignalRequest, SignalResponse, SimulcastCodec, AddTrackRequest, TrickleRequest, MuteTrackRequest, JoinResponse, ReconnectResponse, TrackPublishedResponse, TrackUnpublishedResponse, SessionDescription, ParticipantUpdate, UpdateSubscription, UpdateTrackSettings, UpdateLocalAudioTrack, UpdateLocalVideoTrack, LeaveRequest, LeaveRequest_Action, UpdateVideoLayers, UpdateParticipantMetadata, ICEServer, SpeakersChanged, RoomUpdate, ConnectionQualityInfo, ConnectionQualityUpdate, StreamStateInfo, StreamStateUpdate, SubscribedQuality, SubscribedCodec, SubscribedQualityUpdate, TrackPermission, SubscriptionPermission, SubscriptionPermissionUpdate, RoomMovedResponse, SyncState, DataChannelReceiveState, DataChannelInfo, SimulateScenario, Ping, Pong, RegionSettings, RegionInfo, SubscriptionResponse, RequestResponse, RequestResponse_Reason, TrackSubscribed, loglevel$1, loglevel, hasRequiredLoglevel, loglevelExports, LogLevel, LoggerNames, livekitLogger, livekitLoggers, workerLogger, maxRetryDelay, DEFAULT_RETRY_DELAYS_IN_MS, DefaultReconnectPolicy, events, hasRequiredEvents, eventsExports, logDisabled_, deprecationWarnings_, logging, chromeShim, firefoxShim, safariShim, sdp$1, hasRequiredSdp, sdpExports, SDPUtils, sdp, commonShim, DECRYPTION_FAILURE_TOLERANCE, E2EE_FLAG, SALT, KEY_PROVIDER_DEFAULTS, KeyProviderEvent, KeyHandlerEvent, EncryptionEvent, CryptorEvent, BaseKeyProvider, LivekitError, ConnectionErrorReason, ConnectionError, DeviceUnsupportedError, TrackInvalidError, UnsupportedServer, UnexpectedConnectionState, NegotiationError, PublishTrackError, SignalRequestError,
|
|
7613
|
+
var e, h, o, _, FLOAT32_MAX, FLOAT32_MIN, UINT32_MAX, INT32_MAX, INT32_MIN, enumTypeSymbol, Message, TWO_PWR_32_DBL, decimalFrom1e7WithLeadingZeros, protoInt64, ScalarType, LongType, WireType, BinaryWriter, BinaryReader, encTable, decTable, protoBase64, jsonReadDefaults, jsonWriteDefaults, tokenNull, tokenIgnoredUnknownEnum, unknownFieldsSymbol, readDefaults, writeDefaults, InternalFieldList, fieldJsonName, reservedObjectProperties, reservedMessageProperties, fallback, safeMessageProperty, safeObjectProperty, InternalOneofInfo, proto3, Timestamp, MetricsBatch, TimeSeriesMetric, MetricSample, EventMetric, BackupCodecPolicy$1, TrackType, TrackSource, VideoQuality$1, ConnectionQuality$1, ClientConfigSetting, DisconnectReason, ReconnectReason, SubscriptionError, AudioTrackFeature, Room$1, Codec, ParticipantPermission, ParticipantInfo, ParticipantInfo_State, ParticipantInfo_Kind, ParticipantInfo_KindDetail, Encryption_Type, SimulcastCodecInfo, TrackInfo, VideoLayer, DataPacket, DataPacket_Kind, ActiveSpeakerUpdate, SpeakerInfo, UserPacket, SipDTMF, Transcription, TranscriptionSegment, ChatMessage, RpcRequest, RpcAck, RpcResponse, RpcError$1, ParticipantTracks, ServerInfo, ServerInfo_Edition, ClientInfo, ClientInfo_SDK, ClientConfiguration, VideoConfiguration, DisabledCodecs, TimedVersion, DataStream_OperationType, DataStream_TextHeader, DataStream_ByteHeader, DataStream_Header, DataStream_Chunk, DataStream_Trailer, SignalTarget, StreamState, CandidateProtocol, SignalRequest, SignalResponse, SimulcastCodec, AddTrackRequest, TrickleRequest, MuteTrackRequest, JoinResponse, ReconnectResponse, TrackPublishedResponse, TrackUnpublishedResponse, SessionDescription, ParticipantUpdate, UpdateSubscription, UpdateTrackSettings, UpdateLocalAudioTrack, UpdateLocalVideoTrack, LeaveRequest, LeaveRequest_Action, UpdateVideoLayers, UpdateParticipantMetadata, ICEServer, SpeakersChanged, RoomUpdate, ConnectionQualityInfo, ConnectionQualityUpdate, StreamStateInfo, StreamStateUpdate, SubscribedQuality, SubscribedCodec, SubscribedQualityUpdate, TrackPermission, SubscriptionPermission, SubscriptionPermissionUpdate, RoomMovedResponse, SyncState, DataChannelReceiveState, DataChannelInfo, SimulateScenario, Ping, Pong, RegionSettings, RegionInfo, SubscriptionResponse, RequestResponse, RequestResponse_Reason, TrackSubscribed, loglevel$1, loglevel, hasRequiredLoglevel, loglevelExports, LogLevel, LoggerNames, livekitLogger, livekitLoggers, workerLogger, maxRetryDelay, DEFAULT_RETRY_DELAYS_IN_MS, DefaultReconnectPolicy, events, hasRequiredEvents, eventsExports, logDisabled_, deprecationWarnings_, logging, chromeShim, firefoxShim, safariShim, sdp$1, hasRequiredSdp, sdpExports, SDPUtils, sdp, commonShim, DECRYPTION_FAILURE_TOLERANCE, E2EE_FLAG, SALT, KEY_PROVIDER_DEFAULTS, KeyProviderEvent, KeyHandlerEvent, EncryptionEvent, CryptorEvent, BaseKeyProvider, LivekitError, ConnectionErrorReason, ConnectionError, DeviceUnsupportedError, TrackInvalidError, UnsupportedServer, UnexpectedConnectionState, NegotiationError, PublishTrackError, SignalRequestError, MediaDeviceFailure, CryptorErrorReason, RoomEvent, ParticipantEvent, EngineEvent, TrackEvent, commonVersionIdentifier, browserDetails, browsersList, version$1, version, protocolVersion, CriticalTimers, BACKGROUND_REACTION_DELAY, recycledElements, VideoQuality, Track, VideoPreset, backupCodecs, videoCodecs, BackupCodecPolicy, AudioPresets, VideoPresets, VideoPresets43, ScreenSharePresets, separator, ddExtensionURI, resizeObserver, getResizeObserver, intersectionObserver, getIntersectionObserver, emptyAudioStreamTrack, Future, E2EEManager, defaultId, DeviceManager, QueueTaskStatus, AsyncQueue, passThroughQueueSignals, SignalConnectionState, SignalClient, DataPacketBuffer, TTLMap, lib, parser, grammar, hasRequiredGrammar, hasRequiredParser, writer, hasRequiredWriter, hasRequiredLib, libExports, startBitrateForSVC, debounceInterval, PCEvents, PCTransport, defaultVideoCodec, publishDefaults, audioDefaults, videoDefaults, roomOptionDefaults, roomConnectOptionDefaults, PCTransportState, PCTransportManager, RpcError, MAX_PAYLOAD_BYTES, monitorFrequency, isMediaRecorderAvailable, FallbackRecorder, RecorderBase, LocalTrackRecorder, DEFAULT_DIMENSIONS_TIMEOUT, PRE_CONNECT_BUFFER_TIMEOUT, LocalTrack, LocalAudioTrack, presets169, presets43, presetsScreenShare, defaultSimulcastPresets169, defaultSimulcastPresets43, computeDefaultScreenShareSimulcastPresets, videoRids, ScalabilityMode, refreshSubscribedCodecAfterNewCodec, LocalVideoTrack, lossyDataChannel, reliableDataChannel, minReconnectWait, leaveReconnect, reliabeReceiveStateTTL, PCState, RTCEngine, SignalReconnectError, RegionUrlProvider, BaseStreamReader, ByteStreamReader, TextStreamReader, BaseStreamWriter, TextStreamWriter, ByteStreamWriter, RemoteTrack, RemoteAudioTrack, REACTION_DELAY, RemoteVideoTrack, HTMLElementInfo, TrackPublication, LocalTrackPublication, ConnectionQuality, Participant, STREAM_CHUNK_SIZE, LocalParticipant, RemoteTrackPublication, RemoteParticipant, ConnectionState, connectionReconcileFrequency, Room, CheckStatus, Checker, CloudRegionCheck, TEST_DURATION, ConnectionProtocolCheck, PublishAudioCheck, PublishVideoCheck, ReconnectCheck, TURNCheck, WebRTCCheck, WebSocketCheck, ConnectionCheck;
|
|
7614
7614
|
var init_livekit_client_esm = __esm({
|
|
7615
7615
|
"node_modules/livekit-client/dist/livekit-client.esm.mjs"() {
|
|
7616
7616
|
"use strict";
|
|
@@ -11486,22 +11486,6 @@ var init_livekit_client_esm = __esm({
|
|
|
11486
11486
|
this.reasonName = typeof reason === "string" ? reason : RequestResponse_Reason[reason];
|
|
11487
11487
|
}
|
|
11488
11488
|
};
|
|
11489
|
-
(function(DataStreamErrorReason2) {
|
|
11490
|
-
DataStreamErrorReason2[DataStreamErrorReason2["AlreadyOpened"] = 0] = "AlreadyOpened";
|
|
11491
|
-
DataStreamErrorReason2[DataStreamErrorReason2["AbnormalEnd"] = 1] = "AbnormalEnd";
|
|
11492
|
-
DataStreamErrorReason2[DataStreamErrorReason2["DecodeFailed"] = 2] = "DecodeFailed";
|
|
11493
|
-
DataStreamErrorReason2[DataStreamErrorReason2["LengthExceeded"] = 3] = "LengthExceeded";
|
|
11494
|
-
DataStreamErrorReason2[DataStreamErrorReason2["Incomplete"] = 4] = "Incomplete";
|
|
11495
|
-
DataStreamErrorReason2[DataStreamErrorReason2["HandlerAlreadyRegistered"] = 7] = "HandlerAlreadyRegistered";
|
|
11496
|
-
})(DataStreamErrorReason || (DataStreamErrorReason = {}));
|
|
11497
|
-
DataStreamError = class extends LivekitError {
|
|
11498
|
-
constructor(message, reason) {
|
|
11499
|
-
super(16, message);
|
|
11500
|
-
this.name = "DataStreamError";
|
|
11501
|
-
this.reason = reason;
|
|
11502
|
-
this.reasonName = DataStreamErrorReason[reason];
|
|
11503
|
-
}
|
|
11504
|
-
};
|
|
11505
11489
|
(function(MediaDeviceFailure2) {
|
|
11506
11490
|
MediaDeviceFailure2["PermissionDenied"] = "PermissionDenied";
|
|
11507
11491
|
MediaDeviceFailure2["NotFound"] = "NotFound";
|
|
@@ -11713,7 +11697,7 @@ var init_livekit_client_esm = __esm({
|
|
|
11713
11697
|
}
|
|
11714
11698
|
}
|
|
11715
11699
|
];
|
|
11716
|
-
version$1 = "2.15.
|
|
11700
|
+
version$1 = "2.15.4";
|
|
11717
11701
|
version = version$1;
|
|
11718
11702
|
protocolVersion = 16;
|
|
11719
11703
|
CriticalTimers = class {
|
|
@@ -11739,24 +11723,13 @@ var init_livekit_client_esm = __esm({
|
|
|
11739
11723
|
VideoQuality2[VideoQuality2["HIGH"] = 2] = "HIGH";
|
|
11740
11724
|
})(VideoQuality || (VideoQuality = {}));
|
|
11741
11725
|
Track = class _Track extends eventsExports.EventEmitter {
|
|
11742
|
-
/**
|
|
11743
|
-
* indicates current state of stream, it'll indicate `paused` if the track
|
|
11744
|
-
* has been paused by congestion controller
|
|
11745
|
-
*/
|
|
11746
|
-
get streamState() {
|
|
11747
|
-
return this._streamState;
|
|
11748
|
-
}
|
|
11749
|
-
/** @internal */
|
|
11750
|
-
setStreamState(value) {
|
|
11751
|
-
this._streamState = value;
|
|
11752
|
-
}
|
|
11753
11726
|
constructor(mediaTrack, kind) {
|
|
11754
11727
|
let loggerOptions = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
11755
11728
|
var _a;
|
|
11756
11729
|
super();
|
|
11757
11730
|
this.attachedElements = [];
|
|
11758
11731
|
this.isMuted = false;
|
|
11759
|
-
this.
|
|
11732
|
+
this.streamState = _Track.StreamState.Active;
|
|
11760
11733
|
this.isInBackground = false;
|
|
11761
11734
|
this._currentBitrate = 0;
|
|
11762
11735
|
this.log = livekitLogger;
|
|
@@ -12289,20 +12262,6 @@ var init_livekit_client_esm = __esm({
|
|
|
12289
12262
|
room2.localParticipant.on(ParticipantEvent.LocalSenderCreated, (sender, track) => __awaiter(this, void 0, void 0, function* () {
|
|
12290
12263
|
this.setupE2EESender(track, sender);
|
|
12291
12264
|
}));
|
|
12292
|
-
room2.localParticipant.on(ParticipantEvent.LocalTrackPublished, (publication) => {
|
|
12293
|
-
if (!isVideoTrack(publication.track) || !isSafariBased()) {
|
|
12294
|
-
return;
|
|
12295
|
-
}
|
|
12296
|
-
const msg = {
|
|
12297
|
-
kind: "updateCodec",
|
|
12298
|
-
data: {
|
|
12299
|
-
trackId: publication.track.mediaStreamID,
|
|
12300
|
-
codec: mimeTypeToVideoCodecString(publication.trackInfo.codecs[0].mimeType),
|
|
12301
|
-
participantIdentity: this.room.localParticipant.identity
|
|
12302
|
-
}
|
|
12303
|
-
};
|
|
12304
|
-
this.worker.postMessage(msg);
|
|
12305
|
-
});
|
|
12306
12265
|
keyProvider.on(KeyProviderEvent.SetKey, (keyInfo) => this.postKey(keyInfo)).on(KeyProviderEvent.RatchetRequest, (participantId, keyIndex) => this.postRatchetRequest(participantId, keyIndex));
|
|
12307
12266
|
}
|
|
12308
12267
|
postRatchetRequest(participantIdentity, keyIndex) {
|
|
@@ -12513,7 +12472,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12513
12472
|
return __awaiter(this, arguments, void 0, function(kind) {
|
|
12514
12473
|
var _this = this;
|
|
12515
12474
|
let requestPermissions = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
12516
|
-
return
|
|
12475
|
+
return function* () {
|
|
12517
12476
|
var _a;
|
|
12518
12477
|
if (((_a = _DeviceManager.userMediaPromiseMap) === null || _a === void 0 ? void 0 : _a.size) > 0) {
|
|
12519
12478
|
livekitLogger.debug("awaiting getUserMedia promise");
|
|
@@ -12556,7 +12515,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12556
12515
|
devices = devices.filter((device) => device.kind === kind);
|
|
12557
12516
|
}
|
|
12558
12517
|
return devices;
|
|
12559
|
-
}
|
|
12518
|
+
}();
|
|
12560
12519
|
});
|
|
12561
12520
|
}
|
|
12562
12521
|
normalizeDeviceId(kind, deviceId, groupId) {
|
|
@@ -12837,7 +12796,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12837
12796
|
return __awaiter(this, arguments, void 0, function() {
|
|
12838
12797
|
var _this = this;
|
|
12839
12798
|
let updateState = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
12840
|
-
return
|
|
12799
|
+
return function* () {
|
|
12841
12800
|
const unlock = yield _this.closingLock.lock();
|
|
12842
12801
|
try {
|
|
12843
12802
|
_this.clearPingInterval();
|
|
@@ -12869,7 +12828,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12869
12828
|
}
|
|
12870
12829
|
unlock();
|
|
12871
12830
|
}
|
|
12872
|
-
}
|
|
12831
|
+
}();
|
|
12873
12832
|
});
|
|
12874
12833
|
}
|
|
12875
12834
|
// initial offer after joining
|
|
@@ -12923,7 +12882,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12923
12882
|
return __awaiter(this, arguments, void 0, function(metadata, name2) {
|
|
12924
12883
|
var _this2 = this;
|
|
12925
12884
|
let attributes = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
12926
|
-
return
|
|
12885
|
+
return function* () {
|
|
12927
12886
|
const requestId = _this2.getNextRequestId();
|
|
12928
12887
|
yield _this2.sendRequest({
|
|
12929
12888
|
case: "updateMetadata",
|
|
@@ -12935,7 +12894,7 @@ var init_livekit_client_esm = __esm({
|
|
|
12935
12894
|
})
|
|
12936
12895
|
});
|
|
12937
12896
|
return requestId;
|
|
12938
|
-
}
|
|
12897
|
+
}();
|
|
12939
12898
|
});
|
|
12940
12899
|
}
|
|
12941
12900
|
sendUpdateTrackSettings(settings) {
|
|
@@ -13015,7 +12974,7 @@ var init_livekit_client_esm = __esm({
|
|
|
13015
12974
|
return __awaiter(this, arguments, void 0, function(message) {
|
|
13016
12975
|
var _this3 = this;
|
|
13017
12976
|
let fromQueue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
|
|
13018
|
-
return
|
|
12977
|
+
return function* () {
|
|
13019
12978
|
const canQueue = !fromQueue && !canPassThroughQueue(message);
|
|
13020
12979
|
if (canQueue && _this3.state === SignalConnectionState.RECONNECTING) {
|
|
13021
12980
|
_this3.queuedRequests.push(() => __awaiter(_this3, void 0, void 0, function* () {
|
|
@@ -13051,7 +13010,7 @@ var init_livekit_client_esm = __esm({
|
|
|
13051
13010
|
error: e3
|
|
13052
13011
|
}));
|
|
13053
13012
|
}
|
|
13054
|
-
}
|
|
13013
|
+
}();
|
|
13055
13014
|
});
|
|
13056
13015
|
}
|
|
13057
13016
|
handleSignalResponse(res) {
|
|
@@ -14117,7 +14076,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14117
14076
|
return __awaiter(this, arguments, void 0, function(pcTransport, abortController) {
|
|
14118
14077
|
var _this = this;
|
|
14119
14078
|
let timeout = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : this.peerConnectionTimeout;
|
|
14120
|
-
return
|
|
14079
|
+
return function* () {
|
|
14121
14080
|
const connectionState = pcTransport.getConnectionState();
|
|
14122
14081
|
if (connectionState === "connected") {
|
|
14123
14082
|
return;
|
|
@@ -14147,7 +14106,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14147
14106
|
abortController === null || abortController === void 0 ? void 0 : abortController.signal.removeEventListener("abort", abortHandler);
|
|
14148
14107
|
resolve();
|
|
14149
14108
|
}));
|
|
14150
|
-
}
|
|
14109
|
+
}();
|
|
14151
14110
|
});
|
|
14152
14111
|
}
|
|
14153
14112
|
};
|
|
@@ -14328,14 +14287,9 @@ var init_livekit_client_esm = __esm({
|
|
|
14328
14287
|
this.providedByUser = userProvidedTrack;
|
|
14329
14288
|
this.muteLock = new _();
|
|
14330
14289
|
this.pauseUpstreamLock = new _();
|
|
14331
|
-
this.
|
|
14332
|
-
this.
|
|
14333
|
-
|
|
14334
|
-
yield this.setMediaStreamTrack(mediaTrack, true);
|
|
14335
|
-
} finally {
|
|
14336
|
-
unlock();
|
|
14337
|
-
}
|
|
14338
|
-
}));
|
|
14290
|
+
this.processorLock = new _();
|
|
14291
|
+
this.restartLock = new _();
|
|
14292
|
+
this.setMediaStreamTrack(mediaTrack, true);
|
|
14339
14293
|
this._constraints = mediaTrack.getConstraints();
|
|
14340
14294
|
if (constraints) {
|
|
14341
14295
|
this._constraints = constraints;
|
|
@@ -14404,20 +14358,25 @@ var init_livekit_client_esm = __esm({
|
|
|
14404
14358
|
}
|
|
14405
14359
|
let processedTrack;
|
|
14406
14360
|
if (this.processor && newTrack) {
|
|
14407
|
-
this.
|
|
14408
|
-
|
|
14409
|
-
|
|
14410
|
-
|
|
14411
|
-
|
|
14412
|
-
|
|
14413
|
-
this.processorElement
|
|
14361
|
+
const unlock = yield this.processorLock.lock();
|
|
14362
|
+
try {
|
|
14363
|
+
this.log.debug("restarting processor", this.logContext);
|
|
14364
|
+
if (this.kind === "unknown") {
|
|
14365
|
+
throw TypeError("cannot set processor on track of unknown kind");
|
|
14366
|
+
}
|
|
14367
|
+
if (this.processorElement) {
|
|
14368
|
+
attachToElement(newTrack, this.processorElement);
|
|
14369
|
+
this.processorElement.muted = true;
|
|
14370
|
+
}
|
|
14371
|
+
yield this.processor.restart({
|
|
14372
|
+
track: newTrack,
|
|
14373
|
+
kind: this.kind,
|
|
14374
|
+
element: this.processorElement
|
|
14375
|
+
});
|
|
14376
|
+
processedTrack = this.processor.processedTrack;
|
|
14377
|
+
} finally {
|
|
14378
|
+
unlock();
|
|
14414
14379
|
}
|
|
14415
|
-
yield this.processor.restart({
|
|
14416
|
-
track: newTrack,
|
|
14417
|
-
kind: this.kind,
|
|
14418
|
-
element: this.processorElement
|
|
14419
|
-
});
|
|
14420
|
-
processedTrack = this.processor.processedTrack;
|
|
14421
14380
|
}
|
|
14422
14381
|
if (this.sender && ((_a = this.sender.transport) === null || _a === void 0 ? void 0 : _a.state) !== "closed") {
|
|
14423
14382
|
yield this.sender.replaceTrack(processedTrack !== null && processedTrack !== void 0 ? processedTrack : newTrack);
|
|
@@ -14439,7 +14398,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14439
14398
|
return __awaiter(this, arguments, void 0, function() {
|
|
14440
14399
|
var _this = this;
|
|
14441
14400
|
let timeout = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : DEFAULT_DIMENSIONS_TIMEOUT;
|
|
14442
|
-
return
|
|
14401
|
+
return function* () {
|
|
14443
14402
|
var _a;
|
|
14444
14403
|
if (_this.kind === Track.Kind.Audio) {
|
|
14445
14404
|
throw new Error("cannot get dimensions for audio tracks");
|
|
@@ -14456,7 +14415,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14456
14415
|
yield sleep(50);
|
|
14457
14416
|
}
|
|
14458
14417
|
throw new TrackInvalidError("unable to get track dimensions after timeout");
|
|
14459
|
-
}
|
|
14418
|
+
}();
|
|
14460
14419
|
});
|
|
14461
14420
|
}
|
|
14462
14421
|
setDeviceId(deviceId) {
|
|
@@ -14479,7 +14438,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14479
14438
|
return __awaiter(this, arguments, void 0, function() {
|
|
14480
14439
|
var _this2 = this;
|
|
14481
14440
|
let normalize3 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
14482
|
-
return
|
|
14441
|
+
return function* () {
|
|
14483
14442
|
if (_this2.source === Track.Source.ScreenShare) {
|
|
14484
14443
|
return;
|
|
14485
14444
|
}
|
|
@@ -14489,7 +14448,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14489
14448
|
} = _this2._mediaStreamTrack.getSettings();
|
|
14490
14449
|
const kind = _this2.kind === Track.Kind.Audio ? "audioinput" : "videoinput";
|
|
14491
14450
|
return normalize3 ? DeviceManager.getInstance().normalizeDeviceId(kind, deviceId, groupId) : deviceId;
|
|
14492
|
-
}
|
|
14451
|
+
}();
|
|
14493
14452
|
});
|
|
14494
14453
|
}
|
|
14495
14454
|
mute() {
|
|
@@ -14506,35 +14465,30 @@ var init_livekit_client_esm = __esm({
|
|
|
14506
14465
|
}
|
|
14507
14466
|
replaceTrack(track, userProvidedOrOptions) {
|
|
14508
14467
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14509
|
-
|
|
14510
|
-
|
|
14511
|
-
|
|
14512
|
-
|
|
14513
|
-
|
|
14514
|
-
|
|
14515
|
-
|
|
14516
|
-
|
|
14517
|
-
|
|
14518
|
-
|
|
14519
|
-
|
|
14520
|
-
|
|
14521
|
-
|
|
14522
|
-
|
|
14523
|
-
|
|
14524
|
-
yield this.
|
|
14525
|
-
if (stopProcessor && this.processor) {
|
|
14526
|
-
yield this.internalStopProcessor();
|
|
14527
|
-
}
|
|
14528
|
-
return this;
|
|
14529
|
-
} finally {
|
|
14530
|
-
unlock();
|
|
14468
|
+
if (!this.sender) {
|
|
14469
|
+
throw new TrackInvalidError("unable to replace an unpublished track");
|
|
14470
|
+
}
|
|
14471
|
+
let userProvidedTrack;
|
|
14472
|
+
let stopProcessor;
|
|
14473
|
+
if (typeof userProvidedOrOptions === "boolean") {
|
|
14474
|
+
userProvidedTrack = userProvidedOrOptions;
|
|
14475
|
+
} else if (userProvidedOrOptions !== void 0) {
|
|
14476
|
+
userProvidedTrack = userProvidedOrOptions.userProvidedTrack;
|
|
14477
|
+
stopProcessor = userProvidedOrOptions.stopProcessor;
|
|
14478
|
+
}
|
|
14479
|
+
this.providedByUser = userProvidedTrack !== null && userProvidedTrack !== void 0 ? userProvidedTrack : true;
|
|
14480
|
+
this.log.debug("replace MediaStreamTrack", this.logContext);
|
|
14481
|
+
yield this.setMediaStreamTrack(track);
|
|
14482
|
+
if (stopProcessor && this.processor) {
|
|
14483
|
+
yield this.stopProcessor();
|
|
14531
14484
|
}
|
|
14485
|
+
return this;
|
|
14532
14486
|
});
|
|
14533
14487
|
}
|
|
14534
14488
|
restart(constraints) {
|
|
14535
14489
|
return __awaiter(this, void 0, void 0, function* () {
|
|
14536
14490
|
this.manuallyStopped = false;
|
|
14537
|
-
const unlock = yield this.
|
|
14491
|
+
const unlock = yield this.restartLock.lock();
|
|
14538
14492
|
try {
|
|
14539
14493
|
if (!constraints) {
|
|
14540
14494
|
constraints = this._constraints;
|
|
@@ -14556,9 +14510,9 @@ var init_livekit_client_esm = __esm({
|
|
|
14556
14510
|
facingMode
|
|
14557
14511
|
} : true;
|
|
14558
14512
|
} else {
|
|
14559
|
-
streamConstraints.audio = deviceId ?
|
|
14513
|
+
streamConstraints.audio = deviceId ? {
|
|
14560
14514
|
deviceId
|
|
14561
|
-
}
|
|
14515
|
+
} : true;
|
|
14562
14516
|
}
|
|
14563
14517
|
this.attachedElements.forEach((el) => {
|
|
14564
14518
|
detachTrack(this.mediaStreamTrack, el);
|
|
@@ -14567,9 +14521,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14567
14521
|
this._mediaStreamTrack.stop();
|
|
14568
14522
|
const mediaStream = yield navigator.mediaDevices.getUserMedia(streamConstraints);
|
|
14569
14523
|
const newTrack = mediaStream.getTracks()[0];
|
|
14570
|
-
|
|
14571
|
-
yield newTrack.applyConstraints(otherConstraints);
|
|
14572
|
-
}
|
|
14524
|
+
yield newTrack.applyConstraints(otherConstraints);
|
|
14573
14525
|
newTrack.addEventListener("ended", this.handleEnded);
|
|
14574
14526
|
this.log.debug("re-acquired MediaStreamTrack", this.logContext);
|
|
14575
14527
|
yield this.setMediaStreamTrack(newTrack);
|
|
@@ -14708,9 +14660,9 @@ var init_livekit_client_esm = __esm({
|
|
|
14708
14660
|
return __awaiter(this, arguments, void 0, function(processor) {
|
|
14709
14661
|
var _this3 = this;
|
|
14710
14662
|
let showProcessedStreamLocally = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
14711
|
-
return
|
|
14663
|
+
return function* () {
|
|
14712
14664
|
var _a;
|
|
14713
|
-
const unlock = yield _this3.
|
|
14665
|
+
const unlock = yield _this3.processorLock.lock();
|
|
14714
14666
|
try {
|
|
14715
14667
|
_this3.log.debug("setting up processor", _this3.logContext);
|
|
14716
14668
|
const processorElement = document.createElement(_this3.kind);
|
|
@@ -14723,7 +14675,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14723
14675
|
yield processor.init(processorOptions);
|
|
14724
14676
|
_this3.log.debug("processor initialized", _this3.logContext);
|
|
14725
14677
|
if (_this3.processor) {
|
|
14726
|
-
yield _this3.
|
|
14678
|
+
yield _this3.stopProcessor();
|
|
14727
14679
|
}
|
|
14728
14680
|
if (_this3.kind === "unknown") {
|
|
14729
14681
|
throw TypeError("cannot set processor on track of unknown kind");
|
|
@@ -14763,7 +14715,7 @@ var init_livekit_client_esm = __esm({
|
|
|
14763
14715
|
} finally {
|
|
14764
14716
|
unlock();
|
|
14765
14717
|
}
|
|
14766
|
-
}
|
|
14718
|
+
}();
|
|
14767
14719
|
});
|
|
14768
14720
|
}
|
|
14769
14721
|
getProcessor() {
|
|
@@ -14780,40 +14732,21 @@ var init_livekit_client_esm = __esm({
|
|
|
14780
14732
|
return __awaiter(this, arguments, void 0, function() {
|
|
14781
14733
|
var _this4 = this;
|
|
14782
14734
|
let keepElement = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
14783
|
-
return
|
|
14784
|
-
const unlock = yield _this4.trackChangeLock.lock();
|
|
14785
|
-
try {
|
|
14786
|
-
yield _this4.internalStopProcessor(keepElement);
|
|
14787
|
-
} finally {
|
|
14788
|
-
unlock();
|
|
14789
|
-
}
|
|
14790
|
-
})();
|
|
14791
|
-
});
|
|
14792
|
-
}
|
|
14793
|
-
/**
|
|
14794
|
-
* @internal
|
|
14795
|
-
* This method assumes the caller has acquired a trackChangeLock already.
|
|
14796
|
-
* The public facing method for stopping the processor is `stopProcessor` and it wraps this method in the trackChangeLock.
|
|
14797
|
-
*/
|
|
14798
|
-
internalStopProcessor() {
|
|
14799
|
-
return __awaiter(this, arguments, void 0, function() {
|
|
14800
|
-
var _this5 = this;
|
|
14801
|
-
let keepElement = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
14802
|
-
return (function* () {
|
|
14735
|
+
return function* () {
|
|
14803
14736
|
var _a, _b;
|
|
14804
|
-
if (!
|
|
14805
|
-
|
|
14806
|
-
(_a =
|
|
14807
|
-
yield
|
|
14808
|
-
|
|
14737
|
+
if (!_this4.processor) return;
|
|
14738
|
+
_this4.log.debug("stopping processor", _this4.logContext);
|
|
14739
|
+
(_a = _this4.processor.processedTrack) === null || _a === void 0 ? void 0 : _a.stop();
|
|
14740
|
+
yield _this4.processor.destroy();
|
|
14741
|
+
_this4.processor = void 0;
|
|
14809
14742
|
if (!keepElement) {
|
|
14810
|
-
(_b =
|
|
14811
|
-
|
|
14743
|
+
(_b = _this4.processorElement) === null || _b === void 0 ? void 0 : _b.remove();
|
|
14744
|
+
_this4.processorElement = void 0;
|
|
14812
14745
|
}
|
|
14813
|
-
yield
|
|
14814
|
-
yield
|
|
14815
|
-
|
|
14816
|
-
}
|
|
14746
|
+
yield _this4._mediaStreamTrack.applyConstraints(_this4._constraints);
|
|
14747
|
+
yield _this4.setMediaStreamTrack(_this4._mediaStreamTrack, true);
|
|
14748
|
+
_this4.emit(TrackEvent.TrackProcessorUpdate);
|
|
14749
|
+
}();
|
|
14817
14750
|
});
|
|
14818
14751
|
}
|
|
14819
14752
|
/** @internal */
|
|
@@ -15001,13 +14934,13 @@ var init_livekit_client_esm = __esm({
|
|
|
15001
14934
|
setProcessor(processor) {
|
|
15002
14935
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15003
14936
|
var _a;
|
|
15004
|
-
const unlock = yield this.
|
|
14937
|
+
const unlock = yield this.processorLock.lock();
|
|
15005
14938
|
try {
|
|
15006
14939
|
if (!isReactNative() && !this.audioContext) {
|
|
15007
14940
|
throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");
|
|
15008
14941
|
}
|
|
15009
14942
|
if (this.processor) {
|
|
15010
|
-
yield this.
|
|
14943
|
+
yield this.stopProcessor();
|
|
15011
14944
|
}
|
|
15012
14945
|
const processorOptions = {
|
|
15013
14946
|
kind: this.kind,
|
|
@@ -15422,7 +15355,7 @@ var init_livekit_client_esm = __esm({
|
|
|
15422
15355
|
return __awaiter(this, arguments, void 0, function(processor) {
|
|
15423
15356
|
var _this = this;
|
|
15424
15357
|
let showProcessedStreamLocally = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
15425
|
-
return
|
|
15358
|
+
return function* () {
|
|
15426
15359
|
var _a, e_4, _b, _c;
|
|
15427
15360
|
var _d, _e;
|
|
15428
15361
|
yield _super.setProcessor.call(_this, processor, showProcessedStreamLocally);
|
|
@@ -15446,7 +15379,7 @@ var init_livekit_client_esm = __esm({
|
|
|
15446
15379
|
}
|
|
15447
15380
|
}
|
|
15448
15381
|
}
|
|
15449
|
-
}
|
|
15382
|
+
}();
|
|
15450
15383
|
});
|
|
15451
15384
|
}
|
|
15452
15385
|
setDegradationPreference(preference) {
|
|
@@ -15670,7 +15603,7 @@ var init_livekit_client_esm = __esm({
|
|
|
15670
15603
|
let {
|
|
15671
15604
|
channel
|
|
15672
15605
|
} = _ref;
|
|
15673
|
-
return
|
|
15606
|
+
return function* () {
|
|
15674
15607
|
if (!channel) {
|
|
15675
15608
|
return;
|
|
15676
15609
|
}
|
|
@@ -15683,7 +15616,7 @@ var init_livekit_client_esm = __esm({
|
|
|
15683
15616
|
}
|
|
15684
15617
|
_this.log.debug("on data channel ".concat(channel.id, ", ").concat(channel.label), _this.logContext);
|
|
15685
15618
|
channel.onmessage = _this.handleDataMessage;
|
|
15686
|
-
}
|
|
15619
|
+
}();
|
|
15687
15620
|
});
|
|
15688
15621
|
this.handleDataMessage = (message) => __awaiter(this, void 0, void 0, function* () {
|
|
15689
15622
|
var _a2, _b;
|
|
@@ -16566,7 +16499,7 @@ var init_livekit_client_esm = __esm({
|
|
|
16566
16499
|
return __awaiter(this, arguments, void 0, function(kind) {
|
|
16567
16500
|
var _this2 = this;
|
|
16568
16501
|
let subscriber = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.subscriberPrimary;
|
|
16569
|
-
return
|
|
16502
|
+
return function* () {
|
|
16570
16503
|
var _a;
|
|
16571
16504
|
if (!_this2.pcManager) {
|
|
16572
16505
|
throw new UnexpectedConnectionState("PC manager is closed");
|
|
@@ -16599,7 +16532,7 @@ var init_livekit_client_esm = __esm({
|
|
|
16599
16532
|
yield sleep(50);
|
|
16600
16533
|
}
|
|
16601
16534
|
throw new ConnectionError("could not establish ".concat(transportName, " connection, state: ").concat(transport.getICEConnectionState()), ConnectionErrorReason.InternalError);
|
|
16602
|
-
}
|
|
16535
|
+
}();
|
|
16603
16536
|
});
|
|
16604
16537
|
}
|
|
16605
16538
|
ensurePublisherConnected(kind) {
|
|
@@ -16842,72 +16775,30 @@ var init_livekit_client_esm = __esm({
|
|
|
16842
16775
|
get info() {
|
|
16843
16776
|
return this._info;
|
|
16844
16777
|
}
|
|
16845
|
-
|
|
16846
|
-
validateBytesReceived() {
|
|
16847
|
-
let doneReceiving = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : false;
|
|
16848
|
-
if (typeof this.totalByteSize !== "number" || this.totalByteSize === 0) {
|
|
16849
|
-
return;
|
|
16850
|
-
}
|
|
16851
|
-
if (doneReceiving && this.bytesReceived < this.totalByteSize) {
|
|
16852
|
-
throw new DataStreamError("Not enough chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, only received ").concat(this.bytesReceived, " bytes"), DataStreamErrorReason.Incomplete);
|
|
16853
|
-
} else if (this.bytesReceived > this.totalByteSize) {
|
|
16854
|
-
throw new DataStreamError("Extra chunk(s) received - expected ".concat(this.totalByteSize, " bytes of data total, received ").concat(this.bytesReceived, " bytes"), DataStreamErrorReason.LengthExceeded);
|
|
16855
|
-
}
|
|
16856
|
-
}
|
|
16857
|
-
constructor(info, stream, totalByteSize, outOfBandFailureRejectingFuture) {
|
|
16778
|
+
constructor(info, stream, totalByteSize) {
|
|
16858
16779
|
this.reader = stream;
|
|
16859
16780
|
this.totalByteSize = totalByteSize;
|
|
16860
16781
|
this._info = info;
|
|
16861
16782
|
this.bytesReceived = 0;
|
|
16862
|
-
this.outOfBandFailureRejectingFuture = outOfBandFailureRejectingFuture;
|
|
16863
16783
|
}
|
|
16864
16784
|
};
|
|
16865
16785
|
ByteStreamReader = class extends BaseStreamReader {
|
|
16866
16786
|
handleChunkReceived(chunk) {
|
|
16867
16787
|
var _a;
|
|
16868
16788
|
this.bytesReceived += chunk.content.byteLength;
|
|
16869
|
-
this.validateBytesReceived();
|
|
16870
16789
|
const currentProgress = this.totalByteSize ? this.bytesReceived / this.totalByteSize : void 0;
|
|
16871
16790
|
(_a = this.onProgress) === null || _a === void 0 ? void 0 : _a.call(this, currentProgress);
|
|
16872
16791
|
}
|
|
16873
16792
|
[Symbol.asyncIterator]() {
|
|
16874
16793
|
const reader = this.reader.getReader();
|
|
16875
|
-
let rejectingSignalFuture = new Future();
|
|
16876
|
-
let activeSignal = null;
|
|
16877
|
-
let onAbort = null;
|
|
16878
|
-
if (this.signal) {
|
|
16879
|
-
const signal = this.signal;
|
|
16880
|
-
onAbort = () => {
|
|
16881
|
-
var _a;
|
|
16882
|
-
(_a = rejectingSignalFuture.reject) === null || _a === void 0 ? void 0 : _a.call(rejectingSignalFuture, signal.reason);
|
|
16883
|
-
};
|
|
16884
|
-
signal.addEventListener("abort", onAbort);
|
|
16885
|
-
activeSignal = signal;
|
|
16886
|
-
}
|
|
16887
|
-
const cleanup = () => {
|
|
16888
|
-
reader.releaseLock();
|
|
16889
|
-
if (activeSignal && onAbort) {
|
|
16890
|
-
activeSignal.removeEventListener("abort", onAbort);
|
|
16891
|
-
}
|
|
16892
|
-
this.signal = void 0;
|
|
16893
|
-
};
|
|
16894
16794
|
return {
|
|
16895
16795
|
next: () => __awaiter(this, void 0, void 0, function* () {
|
|
16896
|
-
var _a, _b;
|
|
16897
16796
|
try {
|
|
16898
16797
|
const {
|
|
16899
16798
|
done,
|
|
16900
16799
|
value
|
|
16901
|
-
} = yield
|
|
16902
|
-
reader.read(),
|
|
16903
|
-
// Rejects if this.signal is aborted
|
|
16904
|
-
rejectingSignalFuture.promise,
|
|
16905
|
-
// Rejects if something external says it should, like a participant disconnecting, etc
|
|
16906
|
-
(_b = (_a = this.outOfBandFailureRejectingFuture) === null || _a === void 0 ? void 0 : _a.promise) !== null && _b !== void 0 ? _b : new Promise(() => {
|
|
16907
|
-
})
|
|
16908
|
-
]);
|
|
16800
|
+
} = yield reader.read();
|
|
16909
16801
|
if (done) {
|
|
16910
|
-
this.validateBytesReceived(true);
|
|
16911
16802
|
return {
|
|
16912
16803
|
done: true,
|
|
16913
16804
|
value: void 0
|
|
@@ -16919,16 +16810,16 @@ var init_livekit_client_esm = __esm({
|
|
|
16919
16810
|
value: value.content
|
|
16920
16811
|
};
|
|
16921
16812
|
}
|
|
16922
|
-
} catch (
|
|
16923
|
-
|
|
16924
|
-
|
|
16813
|
+
} catch (error) {
|
|
16814
|
+
return {
|
|
16815
|
+
done: true,
|
|
16816
|
+
value: void 0
|
|
16817
|
+
};
|
|
16925
16818
|
}
|
|
16926
16819
|
}),
|
|
16927
|
-
// note: `return` runs only for premature exits, see:
|
|
16928
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#errors_during_iteration
|
|
16929
16820
|
return() {
|
|
16930
16821
|
return __awaiter(this, void 0, void 0, function* () {
|
|
16931
|
-
|
|
16822
|
+
reader.releaseLock();
|
|
16932
16823
|
return {
|
|
16933
16824
|
done: true,
|
|
16934
16825
|
value: void 0
|
|
@@ -16937,45 +16828,29 @@ var init_livekit_client_esm = __esm({
|
|
|
16937
16828
|
}
|
|
16938
16829
|
};
|
|
16939
16830
|
}
|
|
16940
|
-
/**
|
|
16941
|
-
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
16942
|
-
* stream iteration operation.
|
|
16943
|
-
*
|
|
16944
|
-
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
16945
|
-
* the whole iteration operation, not just one individual chunk read.
|
|
16946
|
-
*/
|
|
16947
|
-
withAbortSignal(signal) {
|
|
16948
|
-
this.signal = signal;
|
|
16949
|
-
return this;
|
|
16950
|
-
}
|
|
16951
16831
|
readAll() {
|
|
16952
|
-
return __awaiter(this,
|
|
16953
|
-
var
|
|
16954
|
-
let
|
|
16955
|
-
|
|
16956
|
-
var
|
|
16957
|
-
|
|
16958
|
-
|
|
16832
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16833
|
+
var _a, e_1, _b, _c;
|
|
16834
|
+
let chunks = /* @__PURE__ */ new Set();
|
|
16835
|
+
try {
|
|
16836
|
+
for (var _d = true, _e = __asyncValues(this), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
16837
|
+
_c = _f.value;
|
|
16838
|
+
_d = false;
|
|
16839
|
+
const chunk = _c;
|
|
16840
|
+
chunks.add(chunk);
|
|
16841
|
+
}
|
|
16842
|
+
} catch (e_1_1) {
|
|
16843
|
+
e_1 = {
|
|
16844
|
+
error: e_1_1
|
|
16845
|
+
};
|
|
16846
|
+
} finally {
|
|
16959
16847
|
try {
|
|
16960
|
-
|
|
16961
|
-
_c = iterator_1_1.value;
|
|
16962
|
-
_d = false;
|
|
16963
|
-
const chunk = _c;
|
|
16964
|
-
chunks.add(chunk);
|
|
16965
|
-
}
|
|
16966
|
-
} catch (e_1_1) {
|
|
16967
|
-
e_1 = {
|
|
16968
|
-
error: e_1_1
|
|
16969
|
-
};
|
|
16848
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
16970
16849
|
} finally {
|
|
16971
|
-
|
|
16972
|
-
if (!_d && !_a && (_b = iterator_1.return)) yield _b.call(iterator_1);
|
|
16973
|
-
} finally {
|
|
16974
|
-
if (e_1) throw e_1.error;
|
|
16975
|
-
}
|
|
16850
|
+
if (e_1) throw e_1.error;
|
|
16976
16851
|
}
|
|
16977
|
-
|
|
16978
|
-
|
|
16852
|
+
}
|
|
16853
|
+
return Array.from(chunks);
|
|
16979
16854
|
});
|
|
16980
16855
|
}
|
|
16981
16856
|
};
|
|
@@ -16984,8 +16859,8 @@ var init_livekit_client_esm = __esm({
|
|
|
16984
16859
|
* A TextStreamReader instance can be used as an AsyncIterator that returns the entire string
|
|
16985
16860
|
* that has been received up to the current point in time.
|
|
16986
16861
|
*/
|
|
16987
|
-
constructor(info, stream, totalChunkCount
|
|
16988
|
-
super(info, stream, totalChunkCount
|
|
16862
|
+
constructor(info, stream, totalChunkCount) {
|
|
16863
|
+
super(info, stream, totalChunkCount);
|
|
16989
16864
|
this.receivedChunks = /* @__PURE__ */ new Map();
|
|
16990
16865
|
}
|
|
16991
16866
|
handleChunkReceived(chunk) {
|
|
@@ -16997,7 +16872,6 @@ var init_livekit_client_esm = __esm({
|
|
|
16997
16872
|
}
|
|
16998
16873
|
this.receivedChunks.set(index2, chunk);
|
|
16999
16874
|
this.bytesReceived += chunk.content.byteLength;
|
|
17000
|
-
this.validateBytesReceived();
|
|
17001
16875
|
const currentProgress = this.totalByteSize ? this.bytesReceived / this.totalByteSize : void 0;
|
|
17002
16876
|
(_a = this.onProgress) === null || _a === void 0 ? void 0 : _a.call(this, currentProgress);
|
|
17003
16877
|
}
|
|
@@ -17008,72 +16882,36 @@ var init_livekit_client_esm = __esm({
|
|
|
17008
16882
|
*/
|
|
17009
16883
|
[Symbol.asyncIterator]() {
|
|
17010
16884
|
const reader = this.reader.getReader();
|
|
17011
|
-
const decoder = new TextDecoder(
|
|
17012
|
-
fatal: true
|
|
17013
|
-
});
|
|
17014
|
-
let rejectingSignalFuture = new Future();
|
|
17015
|
-
let activeSignal = null;
|
|
17016
|
-
let onAbort = null;
|
|
17017
|
-
if (this.signal) {
|
|
17018
|
-
const signal = this.signal;
|
|
17019
|
-
onAbort = () => {
|
|
17020
|
-
var _a;
|
|
17021
|
-
(_a = rejectingSignalFuture.reject) === null || _a === void 0 ? void 0 : _a.call(rejectingSignalFuture, signal.reason);
|
|
17022
|
-
};
|
|
17023
|
-
signal.addEventListener("abort", onAbort);
|
|
17024
|
-
activeSignal = signal;
|
|
17025
|
-
}
|
|
17026
|
-
const cleanup = () => {
|
|
17027
|
-
reader.releaseLock();
|
|
17028
|
-
if (activeSignal && onAbort) {
|
|
17029
|
-
activeSignal.removeEventListener("abort", onAbort);
|
|
17030
|
-
}
|
|
17031
|
-
this.signal = void 0;
|
|
17032
|
-
};
|
|
16885
|
+
const decoder = new TextDecoder();
|
|
17033
16886
|
return {
|
|
17034
16887
|
next: () => __awaiter(this, void 0, void 0, function* () {
|
|
17035
|
-
var _a, _b;
|
|
17036
16888
|
try {
|
|
17037
16889
|
const {
|
|
17038
16890
|
done,
|
|
17039
16891
|
value
|
|
17040
|
-
} = yield
|
|
17041
|
-
reader.read(),
|
|
17042
|
-
// Rejects if this.signal is aborted
|
|
17043
|
-
rejectingSignalFuture.promise,
|
|
17044
|
-
// Rejects if something external says it should, like a participant disconnecting, etc
|
|
17045
|
-
(_b = (_a = this.outOfBandFailureRejectingFuture) === null || _a === void 0 ? void 0 : _a.promise) !== null && _b !== void 0 ? _b : new Promise(() => {
|
|
17046
|
-
})
|
|
17047
|
-
]);
|
|
16892
|
+
} = yield reader.read();
|
|
17048
16893
|
if (done) {
|
|
17049
|
-
this.validateBytesReceived(true);
|
|
17050
16894
|
return {
|
|
17051
16895
|
done: true,
|
|
17052
16896
|
value: void 0
|
|
17053
16897
|
};
|
|
17054
16898
|
} else {
|
|
17055
16899
|
this.handleChunkReceived(value);
|
|
17056
|
-
let decodedResult;
|
|
17057
|
-
try {
|
|
17058
|
-
decodedResult = decoder.decode(value.content);
|
|
17059
|
-
} catch (err) {
|
|
17060
|
-
throw new DataStreamError("Cannot decode datastream chunk ".concat(value.chunkIndex, " as text: ").concat(err), DataStreamErrorReason.DecodeFailed);
|
|
17061
|
-
}
|
|
17062
16900
|
return {
|
|
17063
16901
|
done: false,
|
|
17064
|
-
value:
|
|
16902
|
+
value: decoder.decode(value.content)
|
|
17065
16903
|
};
|
|
17066
16904
|
}
|
|
17067
|
-
} catch (
|
|
17068
|
-
|
|
17069
|
-
|
|
16905
|
+
} catch (error) {
|
|
16906
|
+
return {
|
|
16907
|
+
done: true,
|
|
16908
|
+
value: void 0
|
|
16909
|
+
};
|
|
17070
16910
|
}
|
|
17071
16911
|
}),
|
|
17072
|
-
// note: `return` runs only for premature exits, see:
|
|
17073
|
-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#errors_during_iteration
|
|
17074
16912
|
return() {
|
|
17075
16913
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17076
|
-
|
|
16914
|
+
reader.releaseLock();
|
|
17077
16915
|
return {
|
|
17078
16916
|
done: true,
|
|
17079
16917
|
value: void 0
|
|
@@ -17082,215 +16920,31 @@ var init_livekit_client_esm = __esm({
|
|
|
17082
16920
|
}
|
|
17083
16921
|
};
|
|
17084
16922
|
}
|
|
17085
|
-
/**
|
|
17086
|
-
* Injects an AbortSignal, which if aborted, will terminate the currently active
|
|
17087
|
-
* stream iteration operation.
|
|
17088
|
-
*
|
|
17089
|
-
* Note that when using AbortSignal.timeout(...), the timeout applies across
|
|
17090
|
-
* the whole iteration operation, not just one individual chunk read.
|
|
17091
|
-
*/
|
|
17092
|
-
withAbortSignal(signal) {
|
|
17093
|
-
this.signal = signal;
|
|
17094
|
-
return this;
|
|
17095
|
-
}
|
|
17096
16923
|
readAll() {
|
|
17097
|
-
return __awaiter(this, arguments, void 0, function() {
|
|
17098
|
-
var _this2 = this;
|
|
17099
|
-
let opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
17100
|
-
return (function* () {
|
|
17101
|
-
var _a, e_2, _b, _c;
|
|
17102
|
-
let finalString = "";
|
|
17103
|
-
const iterator = opts.signal ? _this2.withAbortSignal(opts.signal) : _this2;
|
|
17104
|
-
try {
|
|
17105
|
-
for (var _d = true, iterator_2 = __asyncValues(iterator), iterator_2_1; iterator_2_1 = yield iterator_2.next(), _a = iterator_2_1.done, !_a; _d = true) {
|
|
17106
|
-
_c = iterator_2_1.value;
|
|
17107
|
-
_d = false;
|
|
17108
|
-
const chunk = _c;
|
|
17109
|
-
finalString += chunk;
|
|
17110
|
-
}
|
|
17111
|
-
} catch (e_2_1) {
|
|
17112
|
-
e_2 = {
|
|
17113
|
-
error: e_2_1
|
|
17114
|
-
};
|
|
17115
|
-
} finally {
|
|
17116
|
-
try {
|
|
17117
|
-
if (!_d && !_a && (_b = iterator_2.return)) yield _b.call(iterator_2);
|
|
17118
|
-
} finally {
|
|
17119
|
-
if (e_2) throw e_2.error;
|
|
17120
|
-
}
|
|
17121
|
-
}
|
|
17122
|
-
return finalString;
|
|
17123
|
-
})();
|
|
17124
|
-
});
|
|
17125
|
-
}
|
|
17126
|
-
};
|
|
17127
|
-
IncomingDataStreamManager = class {
|
|
17128
|
-
constructor() {
|
|
17129
|
-
this.log = livekitLogger;
|
|
17130
|
-
this.byteStreamControllers = /* @__PURE__ */ new Map();
|
|
17131
|
-
this.textStreamControllers = /* @__PURE__ */ new Map();
|
|
17132
|
-
this.byteStreamHandlers = /* @__PURE__ */ new Map();
|
|
17133
|
-
this.textStreamHandlers = /* @__PURE__ */ new Map();
|
|
17134
|
-
}
|
|
17135
|
-
registerTextStreamHandler(topic, callback) {
|
|
17136
|
-
if (this.textStreamHandlers.has(topic)) {
|
|
17137
|
-
throw new DataStreamError('A text stream handler for topic "'.concat(topic, '" has already been set.'), DataStreamErrorReason.HandlerAlreadyRegistered);
|
|
17138
|
-
}
|
|
17139
|
-
this.textStreamHandlers.set(topic, callback);
|
|
17140
|
-
}
|
|
17141
|
-
unregisterTextStreamHandler(topic) {
|
|
17142
|
-
this.textStreamHandlers.delete(topic);
|
|
17143
|
-
}
|
|
17144
|
-
registerByteStreamHandler(topic, callback) {
|
|
17145
|
-
if (this.byteStreamHandlers.has(topic)) {
|
|
17146
|
-
throw new DataStreamError('A byte stream handler for topic "'.concat(topic, '" has already been set.'), DataStreamErrorReason.HandlerAlreadyRegistered);
|
|
17147
|
-
}
|
|
17148
|
-
this.byteStreamHandlers.set(topic, callback);
|
|
17149
|
-
}
|
|
17150
|
-
unregisterByteStreamHandler(topic) {
|
|
17151
|
-
this.byteStreamHandlers.delete(topic);
|
|
17152
|
-
}
|
|
17153
|
-
clearHandlersAndControllers() {
|
|
17154
|
-
this.byteStreamControllers.clear();
|
|
17155
|
-
this.textStreamControllers.clear();
|
|
17156
|
-
this.byteStreamHandlers.clear();
|
|
17157
|
-
this.textStreamHandlers.clear();
|
|
17158
|
-
}
|
|
17159
|
-
validateParticipantHasNoActiveDataStreams(participantIdentity) {
|
|
17160
|
-
var _a, _b, _c, _d;
|
|
17161
|
-
const textStreamsBeingSentByDisconnectingParticipant = Array.from(this.textStreamControllers.entries()).filter((entry) => entry[1].sendingParticipantIdentity === participantIdentity);
|
|
17162
|
-
const byteStreamsBeingSentByDisconnectingParticipant = Array.from(this.byteStreamControllers.entries()).filter((entry) => entry[1].sendingParticipantIdentity === participantIdentity);
|
|
17163
|
-
if (textStreamsBeingSentByDisconnectingParticipant.length > 0 || byteStreamsBeingSentByDisconnectingParticipant.length > 0) {
|
|
17164
|
-
const abnormalEndError = new DataStreamError("Participant ".concat(participantIdentity, " unexpectedly disconnected in the middle of sending data"), DataStreamErrorReason.AbnormalEnd);
|
|
17165
|
-
for (const [id, controller] of byteStreamsBeingSentByDisconnectingParticipant) {
|
|
17166
|
-
(_b = (_a = controller.outOfBandFailureRejectingFuture).reject) === null || _b === void 0 ? void 0 : _b.call(_a, abnormalEndError);
|
|
17167
|
-
this.byteStreamControllers.delete(id);
|
|
17168
|
-
}
|
|
17169
|
-
for (const [id, controller] of textStreamsBeingSentByDisconnectingParticipant) {
|
|
17170
|
-
(_d = (_c = controller.outOfBandFailureRejectingFuture).reject) === null || _d === void 0 ? void 0 : _d.call(_c, abnormalEndError);
|
|
17171
|
-
this.textStreamControllers.delete(id);
|
|
17172
|
-
}
|
|
17173
|
-
}
|
|
17174
|
-
}
|
|
17175
|
-
handleDataStreamPacket(packet) {
|
|
17176
16924
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17177
|
-
|
|
17178
|
-
|
|
17179
|
-
|
|
17180
|
-
|
|
17181
|
-
|
|
17182
|
-
|
|
17183
|
-
|
|
17184
|
-
|
|
17185
|
-
throw new Error('DataPacket of value "'.concat(packet.value.case, '" is not data stream related!'));
|
|
17186
|
-
}
|
|
17187
|
-
});
|
|
17188
|
-
}
|
|
17189
|
-
handleStreamHeader(streamHeader, participantIdentity) {
|
|
17190
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17191
|
-
var _a;
|
|
17192
|
-
if (streamHeader.contentHeader.case === "byteHeader") {
|
|
17193
|
-
const streamHandlerCallback = this.byteStreamHandlers.get(streamHeader.topic);
|
|
17194
|
-
if (!streamHandlerCallback) {
|
|
17195
|
-
this.log.debug("ignoring incoming byte stream due to no handler for topic", streamHeader.topic);
|
|
17196
|
-
return;
|
|
16925
|
+
var _a, e_2, _b, _c;
|
|
16926
|
+
let finalString = "";
|
|
16927
|
+
try {
|
|
16928
|
+
for (var _d = true, _e = __asyncValues(this), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
|
|
16929
|
+
_c = _f.value;
|
|
16930
|
+
_d = false;
|
|
16931
|
+
const chunk = _c;
|
|
16932
|
+
finalString += chunk;
|
|
17197
16933
|
}
|
|
17198
|
-
|
|
17199
|
-
|
|
17200
|
-
|
|
17201
|
-
id: streamHeader.streamId,
|
|
17202
|
-
name: (_a = streamHeader.contentHeader.value.name) !== null && _a !== void 0 ? _a : "unknown",
|
|
17203
|
-
mimeType: streamHeader.mimeType,
|
|
17204
|
-
size: streamHeader.totalLength ? Number(streamHeader.totalLength) : void 0,
|
|
17205
|
-
topic: streamHeader.topic,
|
|
17206
|
-
timestamp: bigIntToNumber(streamHeader.timestamp),
|
|
17207
|
-
attributes: streamHeader.attributes
|
|
16934
|
+
} catch (e_2_1) {
|
|
16935
|
+
e_2 = {
|
|
16936
|
+
error: e_2_1
|
|
17208
16937
|
};
|
|
17209
|
-
|
|
17210
|
-
|
|
17211
|
-
|
|
17212
|
-
|
|
17213
|
-
|
|
17214
|
-
}
|
|
17215
|
-
this.byteStreamControllers.set(streamHeader.streamId, {
|
|
17216
|
-
info,
|
|
17217
|
-
controller: streamController,
|
|
17218
|
-
startTime: Date.now(),
|
|
17219
|
-
sendingParticipantIdentity: participantIdentity,
|
|
17220
|
-
outOfBandFailureRejectingFuture
|
|
17221
|
-
});
|
|
17222
|
-
}
|
|
17223
|
-
});
|
|
17224
|
-
streamHandlerCallback(new ByteStreamReader(info, stream, bigIntToNumber(streamHeader.totalLength), outOfBandFailureRejectingFuture), {
|
|
17225
|
-
identity: participantIdentity
|
|
17226
|
-
});
|
|
17227
|
-
} else if (streamHeader.contentHeader.case === "textHeader") {
|
|
17228
|
-
const streamHandlerCallback = this.textStreamHandlers.get(streamHeader.topic);
|
|
17229
|
-
if (!streamHandlerCallback) {
|
|
17230
|
-
this.log.debug("ignoring incoming text stream due to no handler for topic", streamHeader.topic);
|
|
17231
|
-
return;
|
|
16938
|
+
} finally {
|
|
16939
|
+
try {
|
|
16940
|
+
if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
|
|
16941
|
+
} finally {
|
|
16942
|
+
if (e_2) throw e_2.error;
|
|
17232
16943
|
}
|
|
17233
|
-
let streamController;
|
|
17234
|
-
const outOfBandFailureRejectingFuture = new Future();
|
|
17235
|
-
const info = {
|
|
17236
|
-
id: streamHeader.streamId,
|
|
17237
|
-
mimeType: streamHeader.mimeType,
|
|
17238
|
-
size: streamHeader.totalLength ? Number(streamHeader.totalLength) : void 0,
|
|
17239
|
-
topic: streamHeader.topic,
|
|
17240
|
-
timestamp: Number(streamHeader.timestamp),
|
|
17241
|
-
attributes: streamHeader.attributes
|
|
17242
|
-
};
|
|
17243
|
-
const stream = new ReadableStream({
|
|
17244
|
-
start: (controller) => {
|
|
17245
|
-
streamController = controller;
|
|
17246
|
-
if (this.textStreamControllers.has(streamHeader.streamId)) {
|
|
17247
|
-
throw new DataStreamError("A data stream read is already in progress for a stream with id ".concat(streamHeader.streamId, "."), DataStreamErrorReason.AlreadyOpened);
|
|
17248
|
-
}
|
|
17249
|
-
this.textStreamControllers.set(streamHeader.streamId, {
|
|
17250
|
-
info,
|
|
17251
|
-
controller: streamController,
|
|
17252
|
-
startTime: Date.now(),
|
|
17253
|
-
sendingParticipantIdentity: participantIdentity,
|
|
17254
|
-
outOfBandFailureRejectingFuture
|
|
17255
|
-
});
|
|
17256
|
-
}
|
|
17257
|
-
});
|
|
17258
|
-
streamHandlerCallback(new TextStreamReader(info, stream, bigIntToNumber(streamHeader.totalLength), outOfBandFailureRejectingFuture), {
|
|
17259
|
-
identity: participantIdentity
|
|
17260
|
-
});
|
|
17261
16944
|
}
|
|
16945
|
+
return finalString;
|
|
17262
16946
|
});
|
|
17263
16947
|
}
|
|
17264
|
-
handleStreamChunk(chunk) {
|
|
17265
|
-
const fileBuffer = this.byteStreamControllers.get(chunk.streamId);
|
|
17266
|
-
if (fileBuffer) {
|
|
17267
|
-
if (chunk.content.length > 0) {
|
|
17268
|
-
fileBuffer.controller.enqueue(chunk);
|
|
17269
|
-
}
|
|
17270
|
-
}
|
|
17271
|
-
const textBuffer = this.textStreamControllers.get(chunk.streamId);
|
|
17272
|
-
if (textBuffer) {
|
|
17273
|
-
if (chunk.content.length > 0) {
|
|
17274
|
-
textBuffer.controller.enqueue(chunk);
|
|
17275
|
-
}
|
|
17276
|
-
}
|
|
17277
|
-
}
|
|
17278
|
-
handleStreamTrailer(trailer) {
|
|
17279
|
-
const textBuffer = this.textStreamControllers.get(trailer.streamId);
|
|
17280
|
-
if (textBuffer) {
|
|
17281
|
-
textBuffer.info.attributes = Object.assign(Object.assign({}, textBuffer.info.attributes), trailer.attributes);
|
|
17282
|
-
textBuffer.controller.close();
|
|
17283
|
-
this.textStreamControllers.delete(trailer.streamId);
|
|
17284
|
-
}
|
|
17285
|
-
const fileBuffer = this.byteStreamControllers.get(trailer.streamId);
|
|
17286
|
-
if (fileBuffer) {
|
|
17287
|
-
{
|
|
17288
|
-
fileBuffer.info.attributes = Object.assign(Object.assign({}, fileBuffer.info.attributes), trailer.attributes);
|
|
17289
|
-
fileBuffer.controller.close();
|
|
17290
|
-
this.byteStreamControllers.delete(trailer.streamId);
|
|
17291
|
-
}
|
|
17292
|
-
}
|
|
17293
|
-
}
|
|
17294
16948
|
};
|
|
17295
16949
|
BaseStreamWriter = class {
|
|
17296
16950
|
constructor(writableStream, info, onClose) {
|
|
@@ -17315,277 +16969,6 @@ var init_livekit_client_esm = __esm({
|
|
|
17315
16969
|
};
|
|
17316
16970
|
ByteStreamWriter = class extends BaseStreamWriter {
|
|
17317
16971
|
};
|
|
17318
|
-
STREAM_CHUNK_SIZE = 15e3;
|
|
17319
|
-
OutgoingDataStreamManager = class {
|
|
17320
|
-
constructor(engine, log2) {
|
|
17321
|
-
this.engine = engine;
|
|
17322
|
-
this.log = log2;
|
|
17323
|
-
}
|
|
17324
|
-
setupEngine(engine) {
|
|
17325
|
-
this.engine = engine;
|
|
17326
|
-
}
|
|
17327
|
-
/** {@inheritDoc LocalParticipant.sendText} */
|
|
17328
|
-
sendText(text7, options) {
|
|
17329
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17330
|
-
var _a;
|
|
17331
|
-
const streamId = crypto.randomUUID();
|
|
17332
|
-
const textInBytes = new TextEncoder().encode(text7);
|
|
17333
|
-
const totalTextLength = textInBytes.byteLength;
|
|
17334
|
-
const fileIds = (_a = options === null || options === void 0 ? void 0 : options.attachments) === null || _a === void 0 ? void 0 : _a.map(() => crypto.randomUUID());
|
|
17335
|
-
const progresses = new Array(fileIds ? fileIds.length + 1 : 1).fill(0);
|
|
17336
|
-
const handleProgress = (progress, idx) => {
|
|
17337
|
-
var _a2;
|
|
17338
|
-
progresses[idx] = progress;
|
|
17339
|
-
const totalProgress = progresses.reduce((acc, val) => acc + val, 0);
|
|
17340
|
-
(_a2 = options === null || options === void 0 ? void 0 : options.onProgress) === null || _a2 === void 0 ? void 0 : _a2.call(options, totalProgress);
|
|
17341
|
-
};
|
|
17342
|
-
const writer2 = yield this.streamText({
|
|
17343
|
-
streamId,
|
|
17344
|
-
totalSize: totalTextLength,
|
|
17345
|
-
destinationIdentities: options === null || options === void 0 ? void 0 : options.destinationIdentities,
|
|
17346
|
-
topic: options === null || options === void 0 ? void 0 : options.topic,
|
|
17347
|
-
attachedStreamIds: fileIds,
|
|
17348
|
-
attributes: options === null || options === void 0 ? void 0 : options.attributes
|
|
17349
|
-
});
|
|
17350
|
-
yield writer2.write(text7);
|
|
17351
|
-
handleProgress(1, 0);
|
|
17352
|
-
yield writer2.close();
|
|
17353
|
-
if ((options === null || options === void 0 ? void 0 : options.attachments) && fileIds) {
|
|
17354
|
-
yield Promise.all(options.attachments.map((file, idx) => __awaiter(this, void 0, void 0, function* () {
|
|
17355
|
-
return this._sendFile(fileIds[idx], file, {
|
|
17356
|
-
topic: options.topic,
|
|
17357
|
-
mimeType: file.type,
|
|
17358
|
-
onProgress: (progress) => {
|
|
17359
|
-
handleProgress(progress, idx + 1);
|
|
17360
|
-
}
|
|
17361
|
-
});
|
|
17362
|
-
})));
|
|
17363
|
-
}
|
|
17364
|
-
return writer2.info;
|
|
17365
|
-
});
|
|
17366
|
-
}
|
|
17367
|
-
/**
|
|
17368
|
-
* @internal
|
|
17369
|
-
* @experimental CAUTION, might get removed in a minor release
|
|
17370
|
-
*/
|
|
17371
|
-
streamText(options) {
|
|
17372
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17373
|
-
var _a, _b;
|
|
17374
|
-
const streamId = (_a = options === null || options === void 0 ? void 0 : options.streamId) !== null && _a !== void 0 ? _a : crypto.randomUUID();
|
|
17375
|
-
const info = {
|
|
17376
|
-
id: streamId,
|
|
17377
|
-
mimeType: "text/plain",
|
|
17378
|
-
timestamp: Date.now(),
|
|
17379
|
-
topic: (_b = options === null || options === void 0 ? void 0 : options.topic) !== null && _b !== void 0 ? _b : "",
|
|
17380
|
-
size: options === null || options === void 0 ? void 0 : options.totalSize,
|
|
17381
|
-
attributes: options === null || options === void 0 ? void 0 : options.attributes
|
|
17382
|
-
};
|
|
17383
|
-
const header = new DataStream_Header({
|
|
17384
|
-
streamId,
|
|
17385
|
-
mimeType: info.mimeType,
|
|
17386
|
-
topic: info.topic,
|
|
17387
|
-
timestamp: numberToBigInt(info.timestamp),
|
|
17388
|
-
totalLength: numberToBigInt(options === null || options === void 0 ? void 0 : options.totalSize),
|
|
17389
|
-
attributes: info.attributes,
|
|
17390
|
-
contentHeader: {
|
|
17391
|
-
case: "textHeader",
|
|
17392
|
-
value: new DataStream_TextHeader({
|
|
17393
|
-
version: options === null || options === void 0 ? void 0 : options.version,
|
|
17394
|
-
attachedStreamIds: options === null || options === void 0 ? void 0 : options.attachedStreamIds,
|
|
17395
|
-
replyToStreamId: options === null || options === void 0 ? void 0 : options.replyToStreamId,
|
|
17396
|
-
operationType: (options === null || options === void 0 ? void 0 : options.type) === "update" ? DataStream_OperationType.UPDATE : DataStream_OperationType.CREATE
|
|
17397
|
-
})
|
|
17398
|
-
}
|
|
17399
|
-
});
|
|
17400
|
-
const destinationIdentities = options === null || options === void 0 ? void 0 : options.destinationIdentities;
|
|
17401
|
-
const packet = new DataPacket({
|
|
17402
|
-
destinationIdentities,
|
|
17403
|
-
value: {
|
|
17404
|
-
case: "streamHeader",
|
|
17405
|
-
value: header
|
|
17406
|
-
}
|
|
17407
|
-
});
|
|
17408
|
-
yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
|
17409
|
-
let chunkId = 0;
|
|
17410
|
-
const engine = this.engine;
|
|
17411
|
-
const writableStream = new WritableStream({
|
|
17412
|
-
// Implement the sink
|
|
17413
|
-
write(text7) {
|
|
17414
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17415
|
-
for (const textByteChunk of splitUtf8(text7, STREAM_CHUNK_SIZE)) {
|
|
17416
|
-
yield engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
|
|
17417
|
-
const chunk = new DataStream_Chunk({
|
|
17418
|
-
content: textByteChunk,
|
|
17419
|
-
streamId,
|
|
17420
|
-
chunkIndex: numberToBigInt(chunkId)
|
|
17421
|
-
});
|
|
17422
|
-
const chunkPacket = new DataPacket({
|
|
17423
|
-
destinationIdentities,
|
|
17424
|
-
value: {
|
|
17425
|
-
case: "streamChunk",
|
|
17426
|
-
value: chunk
|
|
17427
|
-
}
|
|
17428
|
-
});
|
|
17429
|
-
yield engine.sendDataPacket(chunkPacket, DataPacket_Kind.RELIABLE);
|
|
17430
|
-
chunkId += 1;
|
|
17431
|
-
}
|
|
17432
|
-
});
|
|
17433
|
-
},
|
|
17434
|
-
close() {
|
|
17435
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17436
|
-
const trailer = new DataStream_Trailer({
|
|
17437
|
-
streamId
|
|
17438
|
-
});
|
|
17439
|
-
const trailerPacket = new DataPacket({
|
|
17440
|
-
destinationIdentities,
|
|
17441
|
-
value: {
|
|
17442
|
-
case: "streamTrailer",
|
|
17443
|
-
value: trailer
|
|
17444
|
-
}
|
|
17445
|
-
});
|
|
17446
|
-
yield engine.sendDataPacket(trailerPacket, DataPacket_Kind.RELIABLE);
|
|
17447
|
-
});
|
|
17448
|
-
},
|
|
17449
|
-
abort(err) {
|
|
17450
|
-
console.log("Sink error:", err);
|
|
17451
|
-
}
|
|
17452
|
-
});
|
|
17453
|
-
let onEngineClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
17454
|
-
yield writer2.close();
|
|
17455
|
-
});
|
|
17456
|
-
engine.once(EngineEvent.Closing, onEngineClose);
|
|
17457
|
-
const writer2 = new TextStreamWriter(writableStream, info, () => this.engine.off(EngineEvent.Closing, onEngineClose));
|
|
17458
|
-
return writer2;
|
|
17459
|
-
});
|
|
17460
|
-
}
|
|
17461
|
-
sendFile(file, options) {
|
|
17462
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17463
|
-
const streamId = crypto.randomUUID();
|
|
17464
|
-
yield this._sendFile(streamId, file, options);
|
|
17465
|
-
return {
|
|
17466
|
-
id: streamId
|
|
17467
|
-
};
|
|
17468
|
-
});
|
|
17469
|
-
}
|
|
17470
|
-
_sendFile(streamId, file, options) {
|
|
17471
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17472
|
-
var _a;
|
|
17473
|
-
const writer2 = yield this.streamBytes({
|
|
17474
|
-
streamId,
|
|
17475
|
-
totalSize: file.size,
|
|
17476
|
-
name: file.name,
|
|
17477
|
-
mimeType: (_a = options === null || options === void 0 ? void 0 : options.mimeType) !== null && _a !== void 0 ? _a : file.type,
|
|
17478
|
-
topic: options === null || options === void 0 ? void 0 : options.topic,
|
|
17479
|
-
destinationIdentities: options === null || options === void 0 ? void 0 : options.destinationIdentities
|
|
17480
|
-
});
|
|
17481
|
-
const reader = file.stream().getReader();
|
|
17482
|
-
while (true) {
|
|
17483
|
-
const {
|
|
17484
|
-
done,
|
|
17485
|
-
value
|
|
17486
|
-
} = yield reader.read();
|
|
17487
|
-
if (done) {
|
|
17488
|
-
break;
|
|
17489
|
-
}
|
|
17490
|
-
yield writer2.write(value);
|
|
17491
|
-
}
|
|
17492
|
-
yield writer2.close();
|
|
17493
|
-
return writer2.info;
|
|
17494
|
-
});
|
|
17495
|
-
}
|
|
17496
|
-
streamBytes(options) {
|
|
17497
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17498
|
-
var _a, _b, _c, _d, _e;
|
|
17499
|
-
const streamId = (_a = options === null || options === void 0 ? void 0 : options.streamId) !== null && _a !== void 0 ? _a : crypto.randomUUID();
|
|
17500
|
-
const destinationIdentities = options === null || options === void 0 ? void 0 : options.destinationIdentities;
|
|
17501
|
-
const info = {
|
|
17502
|
-
id: streamId,
|
|
17503
|
-
mimeType: (_b = options === null || options === void 0 ? void 0 : options.mimeType) !== null && _b !== void 0 ? _b : "application/octet-stream",
|
|
17504
|
-
topic: (_c = options === null || options === void 0 ? void 0 : options.topic) !== null && _c !== void 0 ? _c : "",
|
|
17505
|
-
timestamp: Date.now(),
|
|
17506
|
-
attributes: options === null || options === void 0 ? void 0 : options.attributes,
|
|
17507
|
-
size: options === null || options === void 0 ? void 0 : options.totalSize,
|
|
17508
|
-
name: (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : "unknown"
|
|
17509
|
-
};
|
|
17510
|
-
const header = new DataStream_Header({
|
|
17511
|
-
totalLength: numberToBigInt((_e = info.size) !== null && _e !== void 0 ? _e : 0),
|
|
17512
|
-
mimeType: info.mimeType,
|
|
17513
|
-
streamId,
|
|
17514
|
-
topic: info.topic,
|
|
17515
|
-
timestamp: numberToBigInt(Date.now()),
|
|
17516
|
-
attributes: info.attributes,
|
|
17517
|
-
contentHeader: {
|
|
17518
|
-
case: "byteHeader",
|
|
17519
|
-
value: new DataStream_ByteHeader({
|
|
17520
|
-
name: info.name
|
|
17521
|
-
})
|
|
17522
|
-
}
|
|
17523
|
-
});
|
|
17524
|
-
const packet = new DataPacket({
|
|
17525
|
-
destinationIdentities,
|
|
17526
|
-
value: {
|
|
17527
|
-
case: "streamHeader",
|
|
17528
|
-
value: header
|
|
17529
|
-
}
|
|
17530
|
-
});
|
|
17531
|
-
yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
|
17532
|
-
let chunkId = 0;
|
|
17533
|
-
const writeMutex = new _();
|
|
17534
|
-
const engine = this.engine;
|
|
17535
|
-
const logLocal = this.log;
|
|
17536
|
-
const writableStream = new WritableStream({
|
|
17537
|
-
write(chunk) {
|
|
17538
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17539
|
-
const unlock = yield writeMutex.lock();
|
|
17540
|
-
let byteOffset = 0;
|
|
17541
|
-
try {
|
|
17542
|
-
while (byteOffset < chunk.byteLength) {
|
|
17543
|
-
const subChunk = chunk.slice(byteOffset, byteOffset + STREAM_CHUNK_SIZE);
|
|
17544
|
-
yield engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
|
|
17545
|
-
const chunkPacket = new DataPacket({
|
|
17546
|
-
destinationIdentities,
|
|
17547
|
-
value: {
|
|
17548
|
-
case: "streamChunk",
|
|
17549
|
-
value: new DataStream_Chunk({
|
|
17550
|
-
content: subChunk,
|
|
17551
|
-
streamId,
|
|
17552
|
-
chunkIndex: numberToBigInt(chunkId)
|
|
17553
|
-
})
|
|
17554
|
-
}
|
|
17555
|
-
});
|
|
17556
|
-
yield engine.sendDataPacket(chunkPacket, DataPacket_Kind.RELIABLE);
|
|
17557
|
-
chunkId += 1;
|
|
17558
|
-
byteOffset += subChunk.byteLength;
|
|
17559
|
-
}
|
|
17560
|
-
} finally {
|
|
17561
|
-
unlock();
|
|
17562
|
-
}
|
|
17563
|
-
});
|
|
17564
|
-
},
|
|
17565
|
-
close() {
|
|
17566
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
17567
|
-
const trailer = new DataStream_Trailer({
|
|
17568
|
-
streamId
|
|
17569
|
-
});
|
|
17570
|
-
const trailerPacket = new DataPacket({
|
|
17571
|
-
destinationIdentities,
|
|
17572
|
-
value: {
|
|
17573
|
-
case: "streamTrailer",
|
|
17574
|
-
value: trailer
|
|
17575
|
-
}
|
|
17576
|
-
});
|
|
17577
|
-
yield engine.sendDataPacket(trailerPacket, DataPacket_Kind.RELIABLE);
|
|
17578
|
-
});
|
|
17579
|
-
},
|
|
17580
|
-
abort(err) {
|
|
17581
|
-
logLocal.error("Sink error:", err);
|
|
17582
|
-
}
|
|
17583
|
-
});
|
|
17584
|
-
const byteWriter = new ByteStreamWriter(writableStream, info);
|
|
17585
|
-
return byteWriter;
|
|
17586
|
-
});
|
|
17587
|
-
}
|
|
17588
|
-
};
|
|
17589
16972
|
RemoteTrack = class extends Track {
|
|
17590
16973
|
constructor(mediaTrack, sid, kind, receiver, loggerOptions) {
|
|
17591
16974
|
super(mediaTrack, kind, loggerOptions);
|
|
@@ -17921,13 +17304,6 @@ var init_livekit_client_esm = __esm({
|
|
|
17921
17304
|
get isAdaptiveStream() {
|
|
17922
17305
|
return this.adaptiveStreamSettings !== void 0;
|
|
17923
17306
|
}
|
|
17924
|
-
setStreamState(value) {
|
|
17925
|
-
super.setStreamState(value);
|
|
17926
|
-
console.log("setStreamState", value);
|
|
17927
|
-
if (value === Track.StreamState.Active) {
|
|
17928
|
-
this.updateVisibility();
|
|
17929
|
-
}
|
|
17930
|
-
}
|
|
17931
17307
|
/**
|
|
17932
17308
|
* Note: When using adaptiveStream, you need to use remoteVideoTrack.attach() to add the track to a HTMLVideoElement, otherwise your video tracks might never start
|
|
17933
17309
|
*/
|
|
@@ -18071,13 +17447,13 @@ var init_livekit_client_esm = __esm({
|
|
|
18071
17447
|
this.updateVisibility();
|
|
18072
17448
|
});
|
|
18073
17449
|
}
|
|
18074
|
-
updateVisibility(
|
|
17450
|
+
updateVisibility() {
|
|
18075
17451
|
var _a, _b;
|
|
18076
17452
|
const lastVisibilityChange = this.elementInfos.reduce((prev, info) => Math.max(prev, info.visibilityChangedAt || 0), 0);
|
|
18077
17453
|
const backgroundPause = ((_b = (_a = this.adaptiveStreamSettings) === null || _a === void 0 ? void 0 : _a.pauseVideoInBackground) !== null && _b !== void 0 ? _b : true) ? this.isInBackground : false;
|
|
18078
17454
|
const isPiPMode = this.elementInfos.some((info) => info.pictureInPicture);
|
|
18079
17455
|
const isVisible = this.elementInfos.some((info) => info.visible) && !backgroundPause || isPiPMode;
|
|
18080
|
-
if (this.lastVisible === isVisible
|
|
17456
|
+
if (this.lastVisible === isVisible) {
|
|
18081
17457
|
return;
|
|
18082
17458
|
}
|
|
18083
17459
|
if (!isVisible && Date.now() - lastVisibilityChange < REACTION_DELAY) {
|
|
@@ -18645,9 +18021,10 @@ var init_livekit_client_esm = __esm({
|
|
|
18645
18021
|
}
|
|
18646
18022
|
}
|
|
18647
18023
|
};
|
|
18024
|
+
STREAM_CHUNK_SIZE = 15e3;
|
|
18648
18025
|
LocalParticipant = class extends Participant {
|
|
18649
18026
|
/** @internal */
|
|
18650
|
-
constructor(sid, identity, engine, options, roomRpcHandlers
|
|
18027
|
+
constructor(sid, identity, engine, options, roomRpcHandlers) {
|
|
18651
18028
|
super(sid, identity, void 0, void 0, void 0, {
|
|
18652
18029
|
loggerName: options.loggerName,
|
|
18653
18030
|
loggerContextCb: () => this.engine.logContext
|
|
@@ -18873,7 +18250,6 @@ var init_livekit_client_esm = __esm({
|
|
|
18873
18250
|
this.activeDeviceMap = /* @__PURE__ */ new Map([["audioinput", "default"], ["videoinput", "default"], ["audiooutput", "default"]]);
|
|
18874
18251
|
this.pendingSignalRequests = /* @__PURE__ */ new Map();
|
|
18875
18252
|
this.rpcHandlers = roomRpcHandlers;
|
|
18876
|
-
this.roomOutgoingDataStreamManager = roomOutgoingDataStreamManager;
|
|
18877
18253
|
}
|
|
18878
18254
|
get lastCameraError() {
|
|
18879
18255
|
return this.cameraError;
|
|
@@ -18965,7 +18341,7 @@ var init_livekit_client_esm = __esm({
|
|
|
18965
18341
|
name: name2,
|
|
18966
18342
|
attributes
|
|
18967
18343
|
} = _ref;
|
|
18968
|
-
return
|
|
18344
|
+
return function* () {
|
|
18969
18345
|
return new Promise((resolve, reject) => __awaiter(_this, void 0, void 0, function* () {
|
|
18970
18346
|
var _a2, _b;
|
|
18971
18347
|
try {
|
|
@@ -19000,7 +18376,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19000
18376
|
if (e3 instanceof Error) reject(e3);
|
|
19001
18377
|
}
|
|
19002
18378
|
}));
|
|
19003
|
-
}
|
|
18379
|
+
}();
|
|
19004
18380
|
});
|
|
19005
18381
|
}
|
|
19006
18382
|
/**
|
|
@@ -19269,7 +18645,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19269
18645
|
return __awaiter(this, arguments, void 0, function(track, options) {
|
|
19270
18646
|
var _this2 = this;
|
|
19271
18647
|
let isRepublish = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : false;
|
|
19272
|
-
return
|
|
18648
|
+
return function* () {
|
|
19273
18649
|
var _a, _b, _c, _d;
|
|
19274
18650
|
if (isLocalAudioTrack(track)) {
|
|
19275
18651
|
track.setAudioContext(_this2.audioContext);
|
|
@@ -19394,7 +18770,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19394
18770
|
} finally {
|
|
19395
18771
|
_this2.pendingPublishPromises.delete(track);
|
|
19396
18772
|
}
|
|
19397
|
-
}
|
|
18773
|
+
}();
|
|
19398
18774
|
});
|
|
19399
18775
|
}
|
|
19400
18776
|
waitUntilEngineConnected() {
|
|
@@ -19876,7 +19252,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19876
19252
|
return __awaiter(this, arguments, void 0, function(options) {
|
|
19877
19253
|
var _this3 = this;
|
|
19878
19254
|
let restartTracks = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
19879
|
-
return
|
|
19255
|
+
return function* () {
|
|
19880
19256
|
if (_this3.republishPromise) {
|
|
19881
19257
|
yield _this3.republishPromise;
|
|
19882
19258
|
}
|
|
@@ -19910,7 +19286,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19910
19286
|
}
|
|
19911
19287
|
}));
|
|
19912
19288
|
yield _this3.republishPromise;
|
|
19913
|
-
}
|
|
19289
|
+
}();
|
|
19914
19290
|
});
|
|
19915
19291
|
}
|
|
19916
19292
|
/**
|
|
@@ -19924,7 +19300,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19924
19300
|
return __awaiter(this, arguments, void 0, function(data) {
|
|
19925
19301
|
var _this4 = this;
|
|
19926
19302
|
let options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
|
|
19927
|
-
return
|
|
19303
|
+
return function* () {
|
|
19928
19304
|
const kind = options.reliable ? DataPacket_Kind.RELIABLE : DataPacket_Kind.LOSSY;
|
|
19929
19305
|
const destinationIdentities = options.destinationIdentities;
|
|
19930
19306
|
const topic = options.topic;
|
|
@@ -19941,7 +19317,7 @@ var init_livekit_client_esm = __esm({
|
|
|
19941
19317
|
}
|
|
19942
19318
|
});
|
|
19943
19319
|
yield _this4.engine.sendDataPacket(packet, kind);
|
|
19944
|
-
}
|
|
19320
|
+
}();
|
|
19945
19321
|
});
|
|
19946
19322
|
}
|
|
19947
19323
|
/**
|
|
@@ -19965,7 +19341,6 @@ var init_livekit_client_esm = __esm({
|
|
|
19965
19341
|
yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
|
19966
19342
|
});
|
|
19967
19343
|
}
|
|
19968
|
-
/** @deprecated Consider migrating to {@link sendText} */
|
|
19969
19344
|
sendChatMessage(text7, options) {
|
|
19970
19345
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19971
19346
|
const msg = {
|
|
@@ -19987,7 +19362,6 @@ var init_livekit_client_esm = __esm({
|
|
|
19987
19362
|
return msg;
|
|
19988
19363
|
});
|
|
19989
19364
|
}
|
|
19990
|
-
/** @deprecated Consider migrating to {@link sendText} */
|
|
19991
19365
|
editChatMessage(editText, originalMessage) {
|
|
19992
19366
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19993
19367
|
const msg = Object.assign(Object.assign({}, originalMessage), {
|
|
@@ -20008,51 +19382,264 @@ var init_livekit_client_esm = __esm({
|
|
|
20008
19382
|
return msg;
|
|
20009
19383
|
});
|
|
20010
19384
|
}
|
|
20011
|
-
/**
|
|
20012
|
-
* Sends the given string to participants in the room via the data channel.
|
|
20013
|
-
* For longer messages, consider using {@link streamText} instead.
|
|
20014
|
-
*
|
|
20015
|
-
* @param text The text payload
|
|
20016
|
-
* @param options.topic Topic identifier used to route the stream to appropriate handlers.
|
|
20017
|
-
*/
|
|
20018
19385
|
sendText(text7, options) {
|
|
20019
19386
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20020
|
-
|
|
19387
|
+
var _a;
|
|
19388
|
+
const streamId = crypto.randomUUID();
|
|
19389
|
+
const textInBytes = new TextEncoder().encode(text7);
|
|
19390
|
+
const totalTextLength = textInBytes.byteLength;
|
|
19391
|
+
const fileIds = (_a = options === null || options === void 0 ? void 0 : options.attachments) === null || _a === void 0 ? void 0 : _a.map(() => crypto.randomUUID());
|
|
19392
|
+
const progresses = new Array(fileIds ? fileIds.length + 1 : 1).fill(0);
|
|
19393
|
+
const handleProgress = (progress, idx) => {
|
|
19394
|
+
var _a2;
|
|
19395
|
+
progresses[idx] = progress;
|
|
19396
|
+
const totalProgress = progresses.reduce((acc, val) => acc + val, 0);
|
|
19397
|
+
(_a2 = options === null || options === void 0 ? void 0 : options.onProgress) === null || _a2 === void 0 ? void 0 : _a2.call(options, totalProgress);
|
|
19398
|
+
};
|
|
19399
|
+
const writer2 = yield this.streamText({
|
|
19400
|
+
streamId,
|
|
19401
|
+
totalSize: totalTextLength,
|
|
19402
|
+
destinationIdentities: options === null || options === void 0 ? void 0 : options.destinationIdentities,
|
|
19403
|
+
topic: options === null || options === void 0 ? void 0 : options.topic,
|
|
19404
|
+
attachedStreamIds: fileIds,
|
|
19405
|
+
attributes: options === null || options === void 0 ? void 0 : options.attributes
|
|
19406
|
+
});
|
|
19407
|
+
yield writer2.write(text7);
|
|
19408
|
+
handleProgress(1, 0);
|
|
19409
|
+
yield writer2.close();
|
|
19410
|
+
if ((options === null || options === void 0 ? void 0 : options.attachments) && fileIds) {
|
|
19411
|
+
yield Promise.all(options.attachments.map((file, idx) => __awaiter(this, void 0, void 0, function* () {
|
|
19412
|
+
return this._sendFile(fileIds[idx], file, {
|
|
19413
|
+
topic: options.topic,
|
|
19414
|
+
mimeType: file.type,
|
|
19415
|
+
onProgress: (progress) => {
|
|
19416
|
+
handleProgress(progress, idx + 1);
|
|
19417
|
+
}
|
|
19418
|
+
});
|
|
19419
|
+
})));
|
|
19420
|
+
}
|
|
19421
|
+
return writer2.info;
|
|
20021
19422
|
});
|
|
20022
19423
|
}
|
|
20023
19424
|
/**
|
|
20024
|
-
* Creates a new TextStreamWriter which can be used to stream text incrementally
|
|
20025
|
-
* to participants in the room via the data channel.
|
|
20026
|
-
*
|
|
20027
|
-
* @param options.topic Topic identifier used to route the stream to appropriate handlers.
|
|
20028
|
-
*
|
|
20029
19425
|
* @internal
|
|
20030
19426
|
* @experimental CAUTION, might get removed in a minor release
|
|
20031
19427
|
*/
|
|
20032
19428
|
streamText(options) {
|
|
20033
19429
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20034
|
-
|
|
19430
|
+
var _a, _b;
|
|
19431
|
+
const streamId = (_a = options === null || options === void 0 ? void 0 : options.streamId) !== null && _a !== void 0 ? _a : crypto.randomUUID();
|
|
19432
|
+
const info = {
|
|
19433
|
+
id: streamId,
|
|
19434
|
+
mimeType: "text/plain",
|
|
19435
|
+
timestamp: Date.now(),
|
|
19436
|
+
topic: (_b = options === null || options === void 0 ? void 0 : options.topic) !== null && _b !== void 0 ? _b : "",
|
|
19437
|
+
size: options === null || options === void 0 ? void 0 : options.totalSize,
|
|
19438
|
+
attributes: options === null || options === void 0 ? void 0 : options.attributes
|
|
19439
|
+
};
|
|
19440
|
+
const header = new DataStream_Header({
|
|
19441
|
+
streamId,
|
|
19442
|
+
mimeType: info.mimeType,
|
|
19443
|
+
topic: info.topic,
|
|
19444
|
+
timestamp: numberToBigInt(info.timestamp),
|
|
19445
|
+
totalLength: numberToBigInt(options === null || options === void 0 ? void 0 : options.totalSize),
|
|
19446
|
+
attributes: info.attributes,
|
|
19447
|
+
contentHeader: {
|
|
19448
|
+
case: "textHeader",
|
|
19449
|
+
value: new DataStream_TextHeader({
|
|
19450
|
+
version: options === null || options === void 0 ? void 0 : options.version,
|
|
19451
|
+
attachedStreamIds: options === null || options === void 0 ? void 0 : options.attachedStreamIds,
|
|
19452
|
+
replyToStreamId: options === null || options === void 0 ? void 0 : options.replyToStreamId,
|
|
19453
|
+
operationType: (options === null || options === void 0 ? void 0 : options.type) === "update" ? DataStream_OperationType.UPDATE : DataStream_OperationType.CREATE
|
|
19454
|
+
})
|
|
19455
|
+
}
|
|
19456
|
+
});
|
|
19457
|
+
const destinationIdentities = options === null || options === void 0 ? void 0 : options.destinationIdentities;
|
|
19458
|
+
const packet = new DataPacket({
|
|
19459
|
+
destinationIdentities,
|
|
19460
|
+
value: {
|
|
19461
|
+
case: "streamHeader",
|
|
19462
|
+
value: header
|
|
19463
|
+
}
|
|
19464
|
+
});
|
|
19465
|
+
yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
|
19466
|
+
let chunkId = 0;
|
|
19467
|
+
const localP = this;
|
|
19468
|
+
const writableStream = new WritableStream({
|
|
19469
|
+
// Implement the sink
|
|
19470
|
+
write(text7) {
|
|
19471
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19472
|
+
for (const textByteChunk of splitUtf8(text7, STREAM_CHUNK_SIZE)) {
|
|
19473
|
+
yield localP.engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
|
|
19474
|
+
const chunk = new DataStream_Chunk({
|
|
19475
|
+
content: textByteChunk,
|
|
19476
|
+
streamId,
|
|
19477
|
+
chunkIndex: numberToBigInt(chunkId)
|
|
19478
|
+
});
|
|
19479
|
+
const chunkPacket = new DataPacket({
|
|
19480
|
+
destinationIdentities,
|
|
19481
|
+
value: {
|
|
19482
|
+
case: "streamChunk",
|
|
19483
|
+
value: chunk
|
|
19484
|
+
}
|
|
19485
|
+
});
|
|
19486
|
+
yield localP.engine.sendDataPacket(chunkPacket, DataPacket_Kind.RELIABLE);
|
|
19487
|
+
chunkId += 1;
|
|
19488
|
+
}
|
|
19489
|
+
});
|
|
19490
|
+
},
|
|
19491
|
+
close() {
|
|
19492
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19493
|
+
const trailer = new DataStream_Trailer({
|
|
19494
|
+
streamId
|
|
19495
|
+
});
|
|
19496
|
+
const trailerPacket = new DataPacket({
|
|
19497
|
+
destinationIdentities,
|
|
19498
|
+
value: {
|
|
19499
|
+
case: "streamTrailer",
|
|
19500
|
+
value: trailer
|
|
19501
|
+
}
|
|
19502
|
+
});
|
|
19503
|
+
yield localP.engine.sendDataPacket(trailerPacket, DataPacket_Kind.RELIABLE);
|
|
19504
|
+
});
|
|
19505
|
+
},
|
|
19506
|
+
abort(err) {
|
|
19507
|
+
console.log("Sink error:", err);
|
|
19508
|
+
}
|
|
19509
|
+
});
|
|
19510
|
+
let onEngineClose = () => __awaiter(this, void 0, void 0, function* () {
|
|
19511
|
+
yield writer2.close();
|
|
19512
|
+
});
|
|
19513
|
+
localP.engine.once(EngineEvent.Closing, onEngineClose);
|
|
19514
|
+
const writer2 = new TextStreamWriter(writableStream, info, () => this.engine.off(EngineEvent.Closing, onEngineClose));
|
|
19515
|
+
return writer2;
|
|
20035
19516
|
});
|
|
20036
19517
|
}
|
|
20037
|
-
/** Send a File to all participants in the room via the data channel.
|
|
20038
|
-
* @param file The File object payload
|
|
20039
|
-
* @param options.topic Topic identifier used to route the stream to appropriate handlers.
|
|
20040
|
-
* @param options.onProgress A callback function used to monitor the upload progress percentage.
|
|
20041
|
-
*/
|
|
20042
19518
|
sendFile(file, options) {
|
|
20043
19519
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20044
|
-
|
|
19520
|
+
const streamId = crypto.randomUUID();
|
|
19521
|
+
yield this._sendFile(streamId, file, options);
|
|
19522
|
+
return {
|
|
19523
|
+
id: streamId
|
|
19524
|
+
};
|
|
19525
|
+
});
|
|
19526
|
+
}
|
|
19527
|
+
_sendFile(streamId, file, options) {
|
|
19528
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19529
|
+
var _a;
|
|
19530
|
+
const writer2 = yield this.streamBytes({
|
|
19531
|
+
streamId,
|
|
19532
|
+
totalSize: file.size,
|
|
19533
|
+
name: file.name,
|
|
19534
|
+
mimeType: (_a = options === null || options === void 0 ? void 0 : options.mimeType) !== null && _a !== void 0 ? _a : file.type,
|
|
19535
|
+
topic: options === null || options === void 0 ? void 0 : options.topic,
|
|
19536
|
+
destinationIdentities: options === null || options === void 0 ? void 0 : options.destinationIdentities
|
|
19537
|
+
});
|
|
19538
|
+
const reader = file.stream().getReader();
|
|
19539
|
+
while (true) {
|
|
19540
|
+
const {
|
|
19541
|
+
done,
|
|
19542
|
+
value
|
|
19543
|
+
} = yield reader.read();
|
|
19544
|
+
if (done) {
|
|
19545
|
+
break;
|
|
19546
|
+
}
|
|
19547
|
+
yield writer2.write(value);
|
|
19548
|
+
}
|
|
19549
|
+
yield writer2.close();
|
|
19550
|
+
return writer2.info;
|
|
20045
19551
|
});
|
|
20046
19552
|
}
|
|
20047
|
-
/**
|
|
20048
|
-
* Stream bytes incrementally to participants in the room via the data channel.
|
|
20049
|
-
* For sending files, consider using {@link sendFile} instead.
|
|
20050
|
-
*
|
|
20051
|
-
* @param options.topic Topic identifier used to route the stream to appropriate handlers.
|
|
20052
|
-
*/
|
|
20053
19553
|
streamBytes(options) {
|
|
20054
19554
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20055
|
-
|
|
19555
|
+
var _a, _b, _c, _d, _e;
|
|
19556
|
+
const streamId = (_a = options === null || options === void 0 ? void 0 : options.streamId) !== null && _a !== void 0 ? _a : crypto.randomUUID();
|
|
19557
|
+
const destinationIdentities = options === null || options === void 0 ? void 0 : options.destinationIdentities;
|
|
19558
|
+
const info = {
|
|
19559
|
+
id: streamId,
|
|
19560
|
+
mimeType: (_b = options === null || options === void 0 ? void 0 : options.mimeType) !== null && _b !== void 0 ? _b : "application/octet-stream",
|
|
19561
|
+
topic: (_c = options === null || options === void 0 ? void 0 : options.topic) !== null && _c !== void 0 ? _c : "",
|
|
19562
|
+
timestamp: Date.now(),
|
|
19563
|
+
attributes: options === null || options === void 0 ? void 0 : options.attributes,
|
|
19564
|
+
size: options === null || options === void 0 ? void 0 : options.totalSize,
|
|
19565
|
+
name: (_d = options === null || options === void 0 ? void 0 : options.name) !== null && _d !== void 0 ? _d : "unknown"
|
|
19566
|
+
};
|
|
19567
|
+
const header = new DataStream_Header({
|
|
19568
|
+
totalLength: numberToBigInt((_e = info.size) !== null && _e !== void 0 ? _e : 0),
|
|
19569
|
+
mimeType: info.mimeType,
|
|
19570
|
+
streamId,
|
|
19571
|
+
topic: info.topic,
|
|
19572
|
+
timestamp: numberToBigInt(Date.now()),
|
|
19573
|
+
attributes: info.attributes,
|
|
19574
|
+
contentHeader: {
|
|
19575
|
+
case: "byteHeader",
|
|
19576
|
+
value: new DataStream_ByteHeader({
|
|
19577
|
+
name: info.name
|
|
19578
|
+
})
|
|
19579
|
+
}
|
|
19580
|
+
});
|
|
19581
|
+
const packet = new DataPacket({
|
|
19582
|
+
destinationIdentities,
|
|
19583
|
+
value: {
|
|
19584
|
+
case: "streamHeader",
|
|
19585
|
+
value: header
|
|
19586
|
+
}
|
|
19587
|
+
});
|
|
19588
|
+
yield this.engine.sendDataPacket(packet, DataPacket_Kind.RELIABLE);
|
|
19589
|
+
let chunkId = 0;
|
|
19590
|
+
const writeMutex = new _();
|
|
19591
|
+
const engine = this.engine;
|
|
19592
|
+
const log2 = this.log;
|
|
19593
|
+
const writableStream = new WritableStream({
|
|
19594
|
+
write(chunk) {
|
|
19595
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19596
|
+
const unlock = yield writeMutex.lock();
|
|
19597
|
+
let byteOffset = 0;
|
|
19598
|
+
try {
|
|
19599
|
+
while (byteOffset < chunk.byteLength) {
|
|
19600
|
+
const subChunk = chunk.slice(byteOffset, byteOffset + STREAM_CHUNK_SIZE);
|
|
19601
|
+
yield engine.waitForBufferStatusLow(DataPacket_Kind.RELIABLE);
|
|
19602
|
+
const chunkPacket = new DataPacket({
|
|
19603
|
+
destinationIdentities,
|
|
19604
|
+
value: {
|
|
19605
|
+
case: "streamChunk",
|
|
19606
|
+
value: new DataStream_Chunk({
|
|
19607
|
+
content: subChunk,
|
|
19608
|
+
streamId,
|
|
19609
|
+
chunkIndex: numberToBigInt(chunkId)
|
|
19610
|
+
})
|
|
19611
|
+
}
|
|
19612
|
+
});
|
|
19613
|
+
yield engine.sendDataPacket(chunkPacket, DataPacket_Kind.RELIABLE);
|
|
19614
|
+
chunkId += 1;
|
|
19615
|
+
byteOffset += subChunk.byteLength;
|
|
19616
|
+
}
|
|
19617
|
+
} finally {
|
|
19618
|
+
unlock();
|
|
19619
|
+
}
|
|
19620
|
+
});
|
|
19621
|
+
},
|
|
19622
|
+
close() {
|
|
19623
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19624
|
+
const trailer = new DataStream_Trailer({
|
|
19625
|
+
streamId
|
|
19626
|
+
});
|
|
19627
|
+
const trailerPacket = new DataPacket({
|
|
19628
|
+
destinationIdentities,
|
|
19629
|
+
value: {
|
|
19630
|
+
case: "streamTrailer",
|
|
19631
|
+
value: trailer
|
|
19632
|
+
}
|
|
19633
|
+
});
|
|
19634
|
+
yield engine.sendDataPacket(trailerPacket, DataPacket_Kind.RELIABLE);
|
|
19635
|
+
});
|
|
19636
|
+
},
|
|
19637
|
+
abort(err) {
|
|
19638
|
+
log2.error("Sink error:", err);
|
|
19639
|
+
}
|
|
19640
|
+
});
|
|
19641
|
+
const byteWriter = new ByteStreamWriter(writableStream, info);
|
|
19642
|
+
return byteWriter;
|
|
20056
19643
|
});
|
|
20057
19644
|
}
|
|
20058
19645
|
/**
|
|
@@ -20070,7 +19657,7 @@ var init_livekit_client_esm = __esm({
|
|
|
20070
19657
|
payload,
|
|
20071
19658
|
responseTimeout = 1e4
|
|
20072
19659
|
} = _ref3;
|
|
20073
|
-
return
|
|
19660
|
+
return function* () {
|
|
20074
19661
|
const maxRoundTripLatency = 2e3;
|
|
20075
19662
|
return new Promise((resolve, reject) => __awaiter(_this5, void 0, void 0, function* () {
|
|
20076
19663
|
var _a2, _b, _c, _d;
|
|
@@ -20117,7 +19704,7 @@ var init_livekit_client_esm = __esm({
|
|
|
20117
19704
|
participantIdentity: destinationIdentity
|
|
20118
19705
|
});
|
|
20119
19706
|
}));
|
|
20120
|
-
}
|
|
19707
|
+
}();
|
|
20121
19708
|
});
|
|
20122
19709
|
}
|
|
20123
19710
|
/**
|
|
@@ -20835,6 +20422,10 @@ var init_livekit_client_esm = __esm({
|
|
|
20835
20422
|
this.log = livekitLogger;
|
|
20836
20423
|
this.bufferedEvents = [];
|
|
20837
20424
|
this.isResuming = false;
|
|
20425
|
+
this.byteStreamControllers = /* @__PURE__ */ new Map();
|
|
20426
|
+
this.textStreamControllers = /* @__PURE__ */ new Map();
|
|
20427
|
+
this.byteStreamHandlers = /* @__PURE__ */ new Map();
|
|
20428
|
+
this.textStreamHandlers = /* @__PURE__ */ new Map();
|
|
20838
20429
|
this.rpcHandlers = /* @__PURE__ */ new Map();
|
|
20839
20430
|
this.connect = (url, token2, opts) => __awaiter(this, void 0, void 0, function* () {
|
|
20840
20431
|
var _a2;
|
|
@@ -21049,7 +20640,7 @@ var init_livekit_client_esm = __esm({
|
|
|
21049
20640
|
return __awaiter(_this, [...args_1], void 0, function() {
|
|
21050
20641
|
var _this2 = this;
|
|
21051
20642
|
let stopTracks = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
21052
|
-
return
|
|
20643
|
+
return function* () {
|
|
21053
20644
|
var _a2, _b2, _c2, _d;
|
|
21054
20645
|
const unlock = yield _this2.disconnectLock.lock();
|
|
21055
20646
|
try {
|
|
@@ -21075,7 +20666,7 @@ var init_livekit_client_esm = __esm({
|
|
|
21075
20666
|
} finally {
|
|
21076
20667
|
unlock();
|
|
21077
20668
|
}
|
|
21078
|
-
}
|
|
20669
|
+
}();
|
|
21079
20670
|
});
|
|
21080
20671
|
};
|
|
21081
20672
|
this.onPageLeave = () => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -21283,8 +20874,8 @@ var init_livekit_client_esm = __esm({
|
|
|
21283
20874
|
return;
|
|
21284
20875
|
}
|
|
21285
20876
|
const newStreamState = Track.streamStateFromProto(streamState.state);
|
|
21286
|
-
pub.track.setStreamState(newStreamState);
|
|
21287
20877
|
if (newStreamState !== pub.track.streamState) {
|
|
20878
|
+
pub.track.streamState = newStreamState;
|
|
21288
20879
|
participant.emit(ParticipantEvent.TrackStreamStateChanged, pub, pub.track.streamState);
|
|
21289
20880
|
this.emitWhenConnected(RoomEvent.TrackStreamStateChanged, pub, pub.track.streamState, participant);
|
|
21290
20881
|
}
|
|
@@ -21324,8 +20915,12 @@ var init_livekit_client_esm = __esm({
|
|
|
21324
20915
|
this.handleChatMessage(participant, packet.value.value);
|
|
21325
20916
|
} else if (packet.value.case === "metrics") {
|
|
21326
20917
|
this.handleMetrics(packet.value.value, participant);
|
|
21327
|
-
} else if (packet.value.case === "streamHeader"
|
|
21328
|
-
this.
|
|
20918
|
+
} else if (packet.value.case === "streamHeader") {
|
|
20919
|
+
this.handleStreamHeader(packet.value.value, packet.participantIdentity);
|
|
20920
|
+
} else if (packet.value.case === "streamChunk") {
|
|
20921
|
+
this.handleStreamChunk(packet.value.value);
|
|
20922
|
+
} else if (packet.value.case === "streamTrailer") {
|
|
20923
|
+
this.handleStreamTrailer(packet.value.value);
|
|
21329
20924
|
} else if (packet.value.case === "rpcRequest") {
|
|
21330
20925
|
const rpc = packet.value.value;
|
|
21331
20926
|
this.handleIncomingRpcRequest(packet.participantIdentity, rpc.id, rpc.method, rpc.payload, rpc.responseTimeoutMs, rpc.version);
|
|
@@ -21339,6 +20934,7 @@ var init_livekit_client_esm = __esm({
|
|
|
21339
20934
|
this.emit(RoomEvent.SipDTMFReceived, dtmf, participant);
|
|
21340
20935
|
participant === null || participant === void 0 ? void 0 : participant.emit(ParticipantEvent.SipDTMFReceived, dtmf);
|
|
21341
20936
|
};
|
|
20937
|
+
this.bufferedSegments = /* @__PURE__ */ new Map();
|
|
21342
20938
|
this.handleTranscription = (_remoteParticipant, transcription) => {
|
|
21343
20939
|
const participant = transcription.transcribedParticipantIdentity === this.localParticipant.identity ? this.localParticipant : this.getParticipantByIdentity(transcription.transcribedParticipantIdentity);
|
|
21344
20940
|
const publication = participant === null || participant === void 0 ? void 0 : participant.trackPublications.get(transcription.trackId);
|
|
@@ -21354,10 +20950,6 @@ var init_livekit_client_esm = __esm({
|
|
|
21354
20950
|
this.handleMetrics = (metrics, participant) => {
|
|
21355
20951
|
this.emit(RoomEvent.MetricsReceived, metrics, participant);
|
|
21356
20952
|
};
|
|
21357
|
-
this.handleDataStream = (packet) => {
|
|
21358
|
-
this.incomingDataStreamManager.handleDataStreamPacket(packet);
|
|
21359
|
-
};
|
|
21360
|
-
this.bufferedSegments = /* @__PURE__ */ new Map();
|
|
21361
20953
|
this.handleAudioPlaybackStarted = () => {
|
|
21362
20954
|
if (this.canPlaybackAudio) {
|
|
21363
20955
|
return;
|
|
@@ -21491,10 +21083,8 @@ var init_livekit_client_esm = __esm({
|
|
|
21491
21083
|
this.options.videoCaptureDefaults = Object.assign(Object.assign({}, videoDefaults), options === null || options === void 0 ? void 0 : options.videoCaptureDefaults);
|
|
21492
21084
|
this.options.publishDefaults = Object.assign(Object.assign({}, publishDefaults), options === null || options === void 0 ? void 0 : options.publishDefaults);
|
|
21493
21085
|
this.maybeCreateEngine();
|
|
21494
|
-
this.incomingDataStreamManager = new IncomingDataStreamManager();
|
|
21495
|
-
this.outgoingDataStreamManager = new OutgoingDataStreamManager(this.engine, this.log);
|
|
21496
21086
|
this.disconnectLock = new _();
|
|
21497
|
-
this.localParticipant = new LocalParticipant("", "", this.engine, this.options, this.rpcHandlers
|
|
21087
|
+
this.localParticipant = new LocalParticipant("", "", this.engine, this.options, this.rpcHandlers);
|
|
21498
21088
|
if (this.options.videoCaptureDefaults.deviceId) {
|
|
21499
21089
|
this.localParticipant.activeDeviceMap.set("videoinput", unwrapConstraint(this.options.videoCaptureDefaults.deviceId));
|
|
21500
21090
|
}
|
|
@@ -21520,16 +21110,22 @@ var init_livekit_client_esm = __esm({
|
|
|
21520
21110
|
}
|
|
21521
21111
|
}
|
|
21522
21112
|
registerTextStreamHandler(topic, callback) {
|
|
21523
|
-
|
|
21113
|
+
if (this.textStreamHandlers.has(topic)) {
|
|
21114
|
+
throw new TypeError('A text stream handler for topic "'.concat(topic, '" has already been set.'));
|
|
21115
|
+
}
|
|
21116
|
+
this.textStreamHandlers.set(topic, callback);
|
|
21524
21117
|
}
|
|
21525
21118
|
unregisterTextStreamHandler(topic) {
|
|
21526
|
-
|
|
21119
|
+
this.textStreamHandlers.delete(topic);
|
|
21527
21120
|
}
|
|
21528
21121
|
registerByteStreamHandler(topic, callback) {
|
|
21529
|
-
|
|
21122
|
+
if (this.byteStreamHandlers.has(topic)) {
|
|
21123
|
+
throw new TypeError('A byte stream handler for topic "'.concat(topic, '" has already been set.'));
|
|
21124
|
+
}
|
|
21125
|
+
this.byteStreamHandlers.set(topic, callback);
|
|
21530
21126
|
}
|
|
21531
21127
|
unregisterByteStreamHandler(topic) {
|
|
21532
|
-
|
|
21128
|
+
this.byteStreamHandlers.delete(topic);
|
|
21533
21129
|
}
|
|
21534
21130
|
/**
|
|
21535
21131
|
* Establishes the participant as a receiver for calls of the specified RPC method.
|
|
@@ -21571,6 +21167,44 @@ var init_livekit_client_esm = __esm({
|
|
|
21571
21167
|
unregisterRpcMethod(method) {
|
|
21572
21168
|
this.rpcHandlers.delete(method);
|
|
21573
21169
|
}
|
|
21170
|
+
handleIncomingRpcRequest(callerIdentity, requestId, method, payload, responseTimeout, version2) {
|
|
21171
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21172
|
+
yield this.engine.publishRpcAck(callerIdentity, requestId);
|
|
21173
|
+
if (version2 !== 1) {
|
|
21174
|
+
yield this.engine.publishRpcResponse(callerIdentity, requestId, null, RpcError.builtIn("UNSUPPORTED_VERSION"));
|
|
21175
|
+
return;
|
|
21176
|
+
}
|
|
21177
|
+
const handler = this.rpcHandlers.get(method);
|
|
21178
|
+
if (!handler) {
|
|
21179
|
+
yield this.engine.publishRpcResponse(callerIdentity, requestId, null, RpcError.builtIn("UNSUPPORTED_METHOD"));
|
|
21180
|
+
return;
|
|
21181
|
+
}
|
|
21182
|
+
let responseError = null;
|
|
21183
|
+
let responsePayload = null;
|
|
21184
|
+
try {
|
|
21185
|
+
const response = yield handler({
|
|
21186
|
+
requestId,
|
|
21187
|
+
callerIdentity,
|
|
21188
|
+
payload,
|
|
21189
|
+
responseTimeout
|
|
21190
|
+
});
|
|
21191
|
+
if (byteLength(response) > MAX_PAYLOAD_BYTES) {
|
|
21192
|
+
responseError = RpcError.builtIn("RESPONSE_PAYLOAD_TOO_LARGE");
|
|
21193
|
+
console.warn("RPC Response payload too large for ".concat(method));
|
|
21194
|
+
} else {
|
|
21195
|
+
responsePayload = response;
|
|
21196
|
+
}
|
|
21197
|
+
} catch (error) {
|
|
21198
|
+
if (error instanceof RpcError) {
|
|
21199
|
+
responseError = error;
|
|
21200
|
+
} else {
|
|
21201
|
+
console.warn("Uncaught error returned by RPC handler for ".concat(method, ". Returning APPLICATION_ERROR instead."), error);
|
|
21202
|
+
responseError = RpcError.builtIn("APPLICATION_ERROR");
|
|
21203
|
+
}
|
|
21204
|
+
}
|
|
21205
|
+
yield this.engine.publishRpcResponse(callerIdentity, requestId, responsePayload, responseError);
|
|
21206
|
+
});
|
|
21207
|
+
}
|
|
21574
21208
|
/**
|
|
21575
21209
|
* @experimental
|
|
21576
21210
|
*/
|
|
@@ -21735,9 +21369,6 @@ var init_livekit_client_esm = __esm({
|
|
|
21735
21369
|
if (this.e2eeManager) {
|
|
21736
21370
|
this.e2eeManager.setupEngine(this.engine);
|
|
21737
21371
|
}
|
|
21738
|
-
if (this.outgoingDataStreamManager) {
|
|
21739
|
-
this.outgoingDataStreamManager.setupEngine(this.engine);
|
|
21740
|
-
}
|
|
21741
21372
|
}
|
|
21742
21373
|
/**
|
|
21743
21374
|
* getLocalDevices abstracts navigator.mediaDevices.enumerateDevices.
|
|
@@ -21948,7 +21579,7 @@ var init_livekit_client_esm = __esm({
|
|
|
21948
21579
|
return __awaiter(this, arguments, void 0, function(kind, deviceId) {
|
|
21949
21580
|
var _this3 = this;
|
|
21950
21581
|
let exact = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : true;
|
|
21951
|
-
return
|
|
21582
|
+
return function* () {
|
|
21952
21583
|
var _a, _b, _c, _d, _e, _f;
|
|
21953
21584
|
var _g;
|
|
21954
21585
|
let success = true;
|
|
@@ -22022,7 +21653,7 @@ var init_livekit_client_esm = __esm({
|
|
|
22022
21653
|
_this3.emit(RoomEvent.ActiveDeviceChanged, kind, deviceId);
|
|
22023
21654
|
}
|
|
22024
21655
|
return success;
|
|
22025
|
-
}
|
|
21656
|
+
}();
|
|
22026
21657
|
});
|
|
22027
21658
|
}
|
|
22028
21659
|
setupLocalParticipantEvents() {
|
|
@@ -22084,10 +21715,7 @@ var init_livekit_client_esm = __esm({
|
|
|
22084
21715
|
adaptiveStreamSettings = {};
|
|
22085
21716
|
}
|
|
22086
21717
|
}
|
|
22087
|
-
|
|
22088
|
-
if ((publication === null || publication === void 0 ? void 0 : publication.isEncrypted) && !this.e2eeManager) {
|
|
22089
|
-
this.emit(RoomEvent.EncryptionError, new Error("Encrypted ".concat(publication.source, " track received from participant ").concat(participant.sid, ", but room does not have encryption enabled!")));
|
|
22090
|
-
}
|
|
21718
|
+
participant.addSubscribedMediaTrack(mediaTrack, trackId, stream, receiver, adaptiveStreamSettings);
|
|
22091
21719
|
}
|
|
22092
21720
|
handleDisconnect() {
|
|
22093
21721
|
let shouldStopTracks = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : true;
|
|
@@ -22097,7 +21725,6 @@ var init_livekit_client_esm = __esm({
|
|
|
22097
21725
|
this.isResuming = false;
|
|
22098
21726
|
this.bufferedEvents = [];
|
|
22099
21727
|
this.transcriptionReceivedTimes.clear();
|
|
22100
|
-
this.incomingDataStreamManager.clearHandlersAndControllers();
|
|
22101
21728
|
if (this.state === ConnectionState.Disconnected) {
|
|
22102
21729
|
return;
|
|
22103
21730
|
}
|
|
@@ -22148,7 +21775,6 @@ var init_livekit_client_esm = __esm({
|
|
|
22148
21775
|
if (!participant) {
|
|
22149
21776
|
return;
|
|
22150
21777
|
}
|
|
22151
|
-
this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(identity);
|
|
22152
21778
|
participant.trackPublications.forEach((publication) => {
|
|
22153
21779
|
participant.unpublishTrack(publication.trackSid, true);
|
|
22154
21780
|
});
|
|
@@ -22156,44 +21782,99 @@ var init_livekit_client_esm = __esm({
|
|
|
22156
21782
|
participant.setDisconnected();
|
|
22157
21783
|
(_a = this.localParticipant) === null || _a === void 0 ? void 0 : _a.handleParticipantDisconnected(participant.identity);
|
|
22158
21784
|
}
|
|
22159
|
-
|
|
21785
|
+
handleStreamHeader(streamHeader, participantIdentity) {
|
|
22160
21786
|
return __awaiter(this, void 0, void 0, function* () {
|
|
22161
|
-
|
|
22162
|
-
if (
|
|
22163
|
-
|
|
22164
|
-
|
|
22165
|
-
|
|
22166
|
-
|
|
22167
|
-
if (!handler) {
|
|
22168
|
-
yield this.engine.publishRpcResponse(callerIdentity, requestId, null, RpcError.builtIn("UNSUPPORTED_METHOD"));
|
|
22169
|
-
return;
|
|
22170
|
-
}
|
|
22171
|
-
let responseError = null;
|
|
22172
|
-
let responsePayload = null;
|
|
22173
|
-
try {
|
|
22174
|
-
const response = yield handler({
|
|
22175
|
-
requestId,
|
|
22176
|
-
callerIdentity,
|
|
22177
|
-
payload,
|
|
22178
|
-
responseTimeout
|
|
22179
|
-
});
|
|
22180
|
-
if (byteLength(response) > MAX_PAYLOAD_BYTES) {
|
|
22181
|
-
responseError = RpcError.builtIn("RESPONSE_PAYLOAD_TOO_LARGE");
|
|
22182
|
-
console.warn("RPC Response payload too large for ".concat(method));
|
|
22183
|
-
} else {
|
|
22184
|
-
responsePayload = response;
|
|
21787
|
+
var _a;
|
|
21788
|
+
if (streamHeader.contentHeader.case === "byteHeader") {
|
|
21789
|
+
const streamHandlerCallback = this.byteStreamHandlers.get(streamHeader.topic);
|
|
21790
|
+
if (!streamHandlerCallback) {
|
|
21791
|
+
this.log.debug("ignoring incoming byte stream due to no handler for topic", streamHeader.topic);
|
|
21792
|
+
return;
|
|
22185
21793
|
}
|
|
22186
|
-
|
|
22187
|
-
|
|
22188
|
-
|
|
22189
|
-
|
|
22190
|
-
|
|
22191
|
-
|
|
21794
|
+
let streamController;
|
|
21795
|
+
const info = {
|
|
21796
|
+
id: streamHeader.streamId,
|
|
21797
|
+
name: (_a = streamHeader.contentHeader.value.name) !== null && _a !== void 0 ? _a : "unknown",
|
|
21798
|
+
mimeType: streamHeader.mimeType,
|
|
21799
|
+
size: streamHeader.totalLength ? Number(streamHeader.totalLength) : void 0,
|
|
21800
|
+
topic: streamHeader.topic,
|
|
21801
|
+
timestamp: bigIntToNumber(streamHeader.timestamp),
|
|
21802
|
+
attributes: streamHeader.attributes
|
|
21803
|
+
};
|
|
21804
|
+
const stream = new ReadableStream({
|
|
21805
|
+
start: (controller) => {
|
|
21806
|
+
streamController = controller;
|
|
21807
|
+
this.byteStreamControllers.set(streamHeader.streamId, {
|
|
21808
|
+
info,
|
|
21809
|
+
controller: streamController,
|
|
21810
|
+
startTime: Date.now()
|
|
21811
|
+
});
|
|
21812
|
+
}
|
|
21813
|
+
});
|
|
21814
|
+
streamHandlerCallback(new ByteStreamReader(info, stream, bigIntToNumber(streamHeader.totalLength)), {
|
|
21815
|
+
identity: participantIdentity
|
|
21816
|
+
});
|
|
21817
|
+
} else if (streamHeader.contentHeader.case === "textHeader") {
|
|
21818
|
+
const streamHandlerCallback = this.textStreamHandlers.get(streamHeader.topic);
|
|
21819
|
+
if (!streamHandlerCallback) {
|
|
21820
|
+
this.log.debug("ignoring incoming text stream due to no handler for topic", streamHeader.topic);
|
|
21821
|
+
return;
|
|
22192
21822
|
}
|
|
21823
|
+
let streamController;
|
|
21824
|
+
const info = {
|
|
21825
|
+
id: streamHeader.streamId,
|
|
21826
|
+
mimeType: streamHeader.mimeType,
|
|
21827
|
+
size: streamHeader.totalLength ? Number(streamHeader.totalLength) : void 0,
|
|
21828
|
+
topic: streamHeader.topic,
|
|
21829
|
+
timestamp: Number(streamHeader.timestamp),
|
|
21830
|
+
attributes: streamHeader.attributes
|
|
21831
|
+
};
|
|
21832
|
+
const stream = new ReadableStream({
|
|
21833
|
+
start: (controller) => {
|
|
21834
|
+
streamController = controller;
|
|
21835
|
+
this.textStreamControllers.set(streamHeader.streamId, {
|
|
21836
|
+
info,
|
|
21837
|
+
controller: streamController,
|
|
21838
|
+
startTime: Date.now()
|
|
21839
|
+
});
|
|
21840
|
+
}
|
|
21841
|
+
});
|
|
21842
|
+
streamHandlerCallback(new TextStreamReader(info, stream, bigIntToNumber(streamHeader.totalLength)), {
|
|
21843
|
+
identity: participantIdentity
|
|
21844
|
+
});
|
|
22193
21845
|
}
|
|
22194
|
-
yield this.engine.publishRpcResponse(callerIdentity, requestId, responsePayload, responseError);
|
|
22195
21846
|
});
|
|
22196
21847
|
}
|
|
21848
|
+
handleStreamChunk(chunk) {
|
|
21849
|
+
const fileBuffer = this.byteStreamControllers.get(chunk.streamId);
|
|
21850
|
+
if (fileBuffer) {
|
|
21851
|
+
if (chunk.content.length > 0) {
|
|
21852
|
+
fileBuffer.controller.enqueue(chunk);
|
|
21853
|
+
}
|
|
21854
|
+
}
|
|
21855
|
+
const textBuffer = this.textStreamControllers.get(chunk.streamId);
|
|
21856
|
+
if (textBuffer) {
|
|
21857
|
+
if (chunk.content.length > 0) {
|
|
21858
|
+
textBuffer.controller.enqueue(chunk);
|
|
21859
|
+
}
|
|
21860
|
+
}
|
|
21861
|
+
}
|
|
21862
|
+
handleStreamTrailer(trailer) {
|
|
21863
|
+
const textBuffer = this.textStreamControllers.get(trailer.streamId);
|
|
21864
|
+
if (textBuffer) {
|
|
21865
|
+
textBuffer.info.attributes = Object.assign(Object.assign({}, textBuffer.info.attributes), trailer.attributes);
|
|
21866
|
+
textBuffer.controller.close();
|
|
21867
|
+
this.textStreamControllers.delete(trailer.streamId);
|
|
21868
|
+
}
|
|
21869
|
+
const fileBuffer = this.byteStreamControllers.get(trailer.streamId);
|
|
21870
|
+
if (fileBuffer) {
|
|
21871
|
+
{
|
|
21872
|
+
fileBuffer.info.attributes = Object.assign(Object.assign({}, fileBuffer.info.attributes), trailer.attributes);
|
|
21873
|
+
fileBuffer.controller.close();
|
|
21874
|
+
this.byteStreamControllers.delete(trailer.streamId);
|
|
21875
|
+
}
|
|
21876
|
+
}
|
|
21877
|
+
}
|
|
22197
21878
|
/**
|
|
22198
21879
|
* attempt to select the default devices if the previously selected devices are no longer available after a device change event
|
|
22199
21880
|
*/
|
|
@@ -24313,7 +23994,7 @@ var require_core = __commonJS({
|
|
|
24313
23994
|
root4.CryptoJS = factory();
|
|
24314
23995
|
}
|
|
24315
23996
|
})(exports, function() {
|
|
24316
|
-
var CryptoJS = CryptoJS ||
|
|
23997
|
+
var CryptoJS = CryptoJS || function(Math2, undefined2) {
|
|
24317
23998
|
var crypto2;
|
|
24318
23999
|
if (typeof window !== "undefined" && window.crypto) {
|
|
24319
24000
|
crypto2 = window.crypto;
|
|
@@ -24353,7 +24034,7 @@ var require_core = __commonJS({
|
|
|
24353
24034
|
}
|
|
24354
24035
|
throw new Error("Native crypto module could not be used to get secure random number.");
|
|
24355
24036
|
};
|
|
24356
|
-
var create2 = Object.create || /* @__PURE__ */
|
|
24037
|
+
var create2 = Object.create || /* @__PURE__ */ function() {
|
|
24357
24038
|
function F2() {
|
|
24358
24039
|
}
|
|
24359
24040
|
return function(obj) {
|
|
@@ -24363,10 +24044,10 @@ var require_core = __commonJS({
|
|
|
24363
24044
|
F2.prototype = null;
|
|
24364
24045
|
return subtype;
|
|
24365
24046
|
};
|
|
24366
|
-
}
|
|
24047
|
+
}();
|
|
24367
24048
|
var C = {};
|
|
24368
24049
|
var C_lib = C.lib = {};
|
|
24369
|
-
var Base = C_lib.Base = /* @__PURE__ */
|
|
24050
|
+
var Base = C_lib.Base = /* @__PURE__ */ function() {
|
|
24370
24051
|
return {
|
|
24371
24052
|
/**
|
|
24372
24053
|
* Creates a new object that inherits from this object.
|
|
@@ -24465,7 +24146,7 @@ var require_core = __commonJS({
|
|
|
24465
24146
|
return this.init.prototype.extend(this);
|
|
24466
24147
|
}
|
|
24467
24148
|
};
|
|
24468
|
-
}
|
|
24149
|
+
}();
|
|
24469
24150
|
var WordArray = C_lib.WordArray = Base.extend({
|
|
24470
24151
|
/**
|
|
24471
24152
|
* Initializes a newly created word array.
|
|
@@ -24903,7 +24584,7 @@ var require_core = __commonJS({
|
|
|
24903
24584
|
});
|
|
24904
24585
|
var C_algo = C.algo = {};
|
|
24905
24586
|
return C;
|
|
24906
|
-
}
|
|
24587
|
+
}(Math);
|
|
24907
24588
|
return CryptoJS;
|
|
24908
24589
|
});
|
|
24909
24590
|
}
|
|
@@ -25184,6 +24865,45 @@ var initWebRTC = (apiKey) => {
|
|
|
25184
24865
|
return initWebRTCWithDeployedBackend(apiKey);
|
|
25185
24866
|
};
|
|
25186
24867
|
|
|
24868
|
+
// src/utils/colors.ts
|
|
24869
|
+
function hexToHSL(hex) {
|
|
24870
|
+
hex = hex.replace(/^#/, "");
|
|
24871
|
+
if (hex.length === 3) {
|
|
24872
|
+
hex = hex.split("").map((char) => char + char).join("");
|
|
24873
|
+
}
|
|
24874
|
+
if (hex.length !== 6) return null;
|
|
24875
|
+
const r3 = parseInt(hex.substring(0, 2), 16) / 255;
|
|
24876
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
24877
|
+
const b2 = parseInt(hex.substring(4, 6), 16) / 255;
|
|
24878
|
+
const max = Math.max(r3, g, b2), min = Math.min(r3, g, b2);
|
|
24879
|
+
let h2 = 0, s = 0, l = (max + min) / 2;
|
|
24880
|
+
if (max !== min) {
|
|
24881
|
+
const d = max - min;
|
|
24882
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
24883
|
+
switch (max) {
|
|
24884
|
+
case r3:
|
|
24885
|
+
h2 = (g - b2) / d + (g < b2 ? 6 : 0);
|
|
24886
|
+
break;
|
|
24887
|
+
case g:
|
|
24888
|
+
h2 = (b2 - r3) / d + 2;
|
|
24889
|
+
break;
|
|
24890
|
+
case b2:
|
|
24891
|
+
h2 = (r3 - g) / d + 4;
|
|
24892
|
+
break;
|
|
24893
|
+
}
|
|
24894
|
+
h2 /= 6;
|
|
24895
|
+
}
|
|
24896
|
+
const res = {
|
|
24897
|
+
h: Math.round(h2 * 360),
|
|
24898
|
+
s: Math.round(s * 100),
|
|
24899
|
+
l: Math.round(l * 100)
|
|
24900
|
+
};
|
|
24901
|
+
return {
|
|
24902
|
+
...res,
|
|
24903
|
+
toString: () => `${res.h} ${res.s}% ${res.l}%`
|
|
24904
|
+
};
|
|
24905
|
+
}
|
|
24906
|
+
|
|
25187
24907
|
// src/providers/ansyr-provider.tsx
|
|
25188
24908
|
if (typeof window !== "undefined" && !globalThis.AnsyrStore) {
|
|
25189
24909
|
globalThis.AnsyrStore = {
|
|
@@ -25233,9 +24953,52 @@ var AnsyrProvider = ({
|
|
|
25233
24953
|
title = "ansyr.ai",
|
|
25234
24954
|
showLogo = true,
|
|
25235
24955
|
showAIIcon = true,
|
|
25236
|
-
showUserIcon = true
|
|
24956
|
+
showUserIcon = true,
|
|
24957
|
+
theme,
|
|
24958
|
+
emptyStateMessage
|
|
25237
24959
|
}) => {
|
|
25238
24960
|
const [internalDeviceId, setInternalDeviceId] = (0, import_react.useState)(deviceId);
|
|
24961
|
+
const generateThemeStyles2 = (theme2) => {
|
|
24962
|
+
if (!theme2) return {};
|
|
24963
|
+
const mapColorsToVars = (colors) => {
|
|
24964
|
+
const mapping = {
|
|
24965
|
+
primary: "--voice-accent",
|
|
24966
|
+
background: "--voice-bg",
|
|
24967
|
+
surface: "--voice-surface",
|
|
24968
|
+
border: "--voice-border",
|
|
24969
|
+
text: "--voice-text",
|
|
24970
|
+
textMuted: "--voice-text-muted",
|
|
24971
|
+
userBubble: "--voice-user-bubble",
|
|
24972
|
+
userText: "--voice-user-text",
|
|
24973
|
+
aiBubble: "--voice-ai-bubble",
|
|
24974
|
+
aiText: "--voice-ai-text"
|
|
24975
|
+
};
|
|
24976
|
+
const styles2 = {};
|
|
24977
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
24978
|
+
const varName = mapping[key];
|
|
24979
|
+
if (varName && value) {
|
|
24980
|
+
const hsl = hexToHSL(value);
|
|
24981
|
+
if (hsl) {
|
|
24982
|
+
styles2[varName] = hsl.toString();
|
|
24983
|
+
if (key === "primary") {
|
|
24984
|
+
styles2["--indicator-bg"] = hsl.toString();
|
|
24985
|
+
styles2["--voice-accent-light"] = `${hsl.h} ${hsl.s}% 96%`;
|
|
24986
|
+
}
|
|
24987
|
+
}
|
|
24988
|
+
}
|
|
24989
|
+
});
|
|
24990
|
+
return styles2;
|
|
24991
|
+
};
|
|
24992
|
+
const styles = {};
|
|
24993
|
+
if (theme2.light) {
|
|
24994
|
+
const lightStyles = mapColorsToVars(theme2.light);
|
|
24995
|
+
Object.entries(lightStyles).forEach(([key, value]) => {
|
|
24996
|
+
styles[key] = value;
|
|
24997
|
+
});
|
|
24998
|
+
}
|
|
24999
|
+
return styles;
|
|
25000
|
+
};
|
|
25001
|
+
const themeStyles = generateThemeStyles2(theme);
|
|
25239
25002
|
(0, import_react.useEffect)(() => {
|
|
25240
25003
|
InitCuekit({ apiKey, appId });
|
|
25241
25004
|
}, [apiKey, appId]);
|
|
@@ -25342,10 +25105,12 @@ var AnsyrProvider = ({
|
|
|
25342
25105
|
title,
|
|
25343
25106
|
showLogo,
|
|
25344
25107
|
showAIIcon,
|
|
25345
|
-
showUserIcon
|
|
25108
|
+
showUserIcon,
|
|
25109
|
+
theme,
|
|
25110
|
+
emptyStateMessage
|
|
25346
25111
|
}
|
|
25347
25112
|
},
|
|
25348
|
-
children
|
|
25113
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: themeStyles }, children)
|
|
25349
25114
|
);
|
|
25350
25115
|
};
|
|
25351
25116
|
|
|
@@ -33355,7 +33120,7 @@ var convert = (
|
|
|
33355
33120
|
* @param {Test} [test]
|
|
33356
33121
|
* @returns {Check}
|
|
33357
33122
|
*/
|
|
33358
|
-
|
|
33123
|
+
function(test) {
|
|
33359
33124
|
if (test === null || test === void 0) {
|
|
33360
33125
|
return ok2;
|
|
33361
33126
|
}
|
|
@@ -33369,7 +33134,7 @@ var convert = (
|
|
|
33369
33134
|
return typeFactory(test);
|
|
33370
33135
|
}
|
|
33371
33136
|
throw new Error("Expected function, string, or object as test");
|
|
33372
|
-
}
|
|
33137
|
+
}
|
|
33373
33138
|
);
|
|
33374
33139
|
function anyFactory(tests) {
|
|
33375
33140
|
const checks2 = [];
|
|
@@ -34549,7 +34314,7 @@ var CallableInstance = (
|
|
|
34549
34314
|
* @param {string | symbol} property
|
|
34550
34315
|
* @returns {(...parameters: Array<unknown>) => unknown}
|
|
34551
34316
|
*/
|
|
34552
|
-
|
|
34317
|
+
function(property) {
|
|
34553
34318
|
const self2 = this;
|
|
34554
34319
|
const constr = self2.constructor;
|
|
34555
34320
|
const proto = (
|
|
@@ -34564,7 +34329,7 @@ var CallableInstance = (
|
|
|
34564
34329
|
};
|
|
34565
34330
|
Object.setPrototypeOf(apply, proto);
|
|
34566
34331
|
return apply;
|
|
34567
|
-
}
|
|
34332
|
+
}
|
|
34568
34333
|
);
|
|
34569
34334
|
|
|
34570
34335
|
// node_modules/unified/lib/index.js
|
|
@@ -39156,6 +38921,38 @@ var useDraggableResizableContainer = (storageKey) => {
|
|
|
39156
38921
|
};
|
|
39157
38922
|
|
|
39158
38923
|
// src/components/chat-popup.tsx
|
|
38924
|
+
var generateThemeStyles = (theme, currentTheme = "dark") => {
|
|
38925
|
+
if (!theme) return {};
|
|
38926
|
+
const colors = currentTheme === "light" ? theme.light : theme.dark;
|
|
38927
|
+
if (!colors) return {};
|
|
38928
|
+
const mapping = {
|
|
38929
|
+
primary: "--voice-accent",
|
|
38930
|
+
background: "--voice-bg",
|
|
38931
|
+
surface: "--voice-surface",
|
|
38932
|
+
border: "--voice-border",
|
|
38933
|
+
text: "--voice-text",
|
|
38934
|
+
textMuted: "--voice-text-muted",
|
|
38935
|
+
userBubble: "--voice-user-bubble",
|
|
38936
|
+
userText: "--voice-user-text",
|
|
38937
|
+
aiBubble: "--voice-ai-bubble",
|
|
38938
|
+
aiText: "--voice-ai-text"
|
|
38939
|
+
};
|
|
38940
|
+
const styles = {};
|
|
38941
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
38942
|
+
const varName = mapping[key];
|
|
38943
|
+
if (varName && value) {
|
|
38944
|
+
const hsl = hexToHSL(value);
|
|
38945
|
+
if (hsl) {
|
|
38946
|
+
styles[varName] = hsl.toString();
|
|
38947
|
+
if (key === "primary") {
|
|
38948
|
+
styles["--indicator-bg"] = hsl.toString();
|
|
38949
|
+
styles["--voice-accent-light"] = currentTheme === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
|
|
38950
|
+
}
|
|
38951
|
+
}
|
|
38952
|
+
}
|
|
38953
|
+
});
|
|
38954
|
+
return styles;
|
|
38955
|
+
};
|
|
39159
38956
|
var ChatPopup = ({
|
|
39160
38957
|
isOpen,
|
|
39161
38958
|
isMinimized,
|
|
@@ -39183,9 +38980,20 @@ var ChatPopup = ({
|
|
|
39183
38980
|
onSizeChange,
|
|
39184
38981
|
persistPosition = true,
|
|
39185
38982
|
persistSize = true,
|
|
39186
|
-
storageKey = "chat-popup"
|
|
38983
|
+
storageKey = "chat-popup",
|
|
38984
|
+
theme: localTheme,
|
|
38985
|
+
emptyStateMessage: localEmptyStateMessage
|
|
39187
38986
|
}) => {
|
|
39188
|
-
const {
|
|
38987
|
+
const {
|
|
38988
|
+
title,
|
|
38989
|
+
showLogo,
|
|
38990
|
+
showAIIcon,
|
|
38991
|
+
showUserIcon,
|
|
38992
|
+
theme: contextTheme,
|
|
38993
|
+
emptyStateMessage: contextEmptyStateMessage
|
|
38994
|
+
} = useAnsyrContext();
|
|
38995
|
+
const theme = localTheme || contextTheme;
|
|
38996
|
+
const emptyStateMessage = localEmptyStateMessage || contextEmptyStateMessage;
|
|
39189
38997
|
const [inputText, setInputText] = (0, import_react14.useState)("");
|
|
39190
38998
|
const [isSending, setIsSending] = (0, import_react14.useState)(false);
|
|
39191
38999
|
const messagesEndRef = (0, import_react14.useRef)(null);
|
|
@@ -39280,7 +39088,8 @@ var ChatPopup = ({
|
|
|
39280
39088
|
animation: "scaleIn 0.3s ease-out",
|
|
39281
39089
|
flexDirection: "column",
|
|
39282
39090
|
fontFamily: "Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",
|
|
39283
|
-
overflow: "hidden"
|
|
39091
|
+
overflow: "hidden",
|
|
39092
|
+
...generateThemeStyles(theme, currentTheme)
|
|
39284
39093
|
}
|
|
39285
39094
|
},
|
|
39286
39095
|
/* @__PURE__ */ import_react14.default.createElement(
|
|
@@ -39475,7 +39284,7 @@ var ChatPopup = ({
|
|
|
39475
39284
|
fontSize: "14px"
|
|
39476
39285
|
}
|
|
39477
39286
|
},
|
|
39478
|
-
"Start a conversation with CueKit AI"
|
|
39287
|
+
emptyStateMessage || "Start a conversation with CueKit AI"
|
|
39479
39288
|
) : messages.map((message, index2) => /* @__PURE__ */ import_react14.default.createElement(
|
|
39480
39289
|
"div",
|
|
39481
39290
|
{
|
|
@@ -39779,8 +39588,9 @@ var ChatPopup = ({
|
|
|
39779
39588
|
style: {
|
|
39780
39589
|
padding: "10px 12px",
|
|
39781
39590
|
borderRadius: 8,
|
|
39782
|
-
border:
|
|
39783
|
-
background: "
|
|
39591
|
+
border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`,
|
|
39592
|
+
background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
|
|
39593
|
+
color: "#fff",
|
|
39784
39594
|
fontSize: 12,
|
|
39785
39595
|
fontWeight: 700,
|
|
39786
39596
|
display: "flex",
|
|
@@ -39792,25 +39602,7 @@ var ChatPopup = ({
|
|
|
39792
39602
|
"aria-label": muteState.isMuted ? "Unmute microphone" : "Mute microphone",
|
|
39793
39603
|
title: muteState.isMuted ? "Unmute microphone" : "Mute microphone"
|
|
39794
39604
|
},
|
|
39795
|
-
muteState.isMuted ? /* @__PURE__ */ import_react14.default.createElement(
|
|
39796
|
-
mic_off_default,
|
|
39797
|
-
{
|
|
39798
|
-
style: {
|
|
39799
|
-
width: 16,
|
|
39800
|
-
height: 16,
|
|
39801
|
-
color: "hsl(var(--voice-user-text))"
|
|
39802
|
-
}
|
|
39803
|
-
}
|
|
39804
|
-
) : /* @__PURE__ */ import_react14.default.createElement(
|
|
39805
|
-
mic_default,
|
|
39806
|
-
{
|
|
39807
|
-
style: {
|
|
39808
|
-
width: 16,
|
|
39809
|
-
height: 16,
|
|
39810
|
-
color: "hsl(var(--voice-user-text))"
|
|
39811
|
-
}
|
|
39812
|
-
}
|
|
39813
|
-
)
|
|
39605
|
+
muteState.isMuted ? /* @__PURE__ */ import_react14.default.createElement(mic_off_default, { style: { width: 16, height: 16, color: "#fff" } }) : /* @__PURE__ */ import_react14.default.createElement(mic_default, { style: { width: 16, height: 16, color: "#fff" } })
|
|
39814
39606
|
),
|
|
39815
39607
|
isConnected2 && onEndCall && /* @__PURE__ */ import_react14.default.createElement(
|
|
39816
39608
|
"button",
|
|
@@ -39820,9 +39612,9 @@ var ChatPopup = ({
|
|
|
39820
39612
|
style: {
|
|
39821
39613
|
padding: "10px 12px",
|
|
39822
39614
|
borderRadius: 8,
|
|
39823
|
-
border:
|
|
39824
|
-
background: "
|
|
39825
|
-
color: "
|
|
39615
|
+
border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`,
|
|
39616
|
+
background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
|
|
39617
|
+
color: "#fff",
|
|
39826
39618
|
fontSize: 12,
|
|
39827
39619
|
fontWeight: 700,
|
|
39828
39620
|
display: "flex",
|
|
@@ -39831,7 +39623,7 @@ var ChatPopup = ({
|
|
|
39831
39623
|
cursor: "pointer"
|
|
39832
39624
|
}
|
|
39833
39625
|
},
|
|
39834
|
-
/* @__PURE__ */ import_react14.default.createElement(phone_off_default, { style: { width: 16, height: 16 } })
|
|
39626
|
+
/* @__PURE__ */ import_react14.default.createElement(phone_off_default, { style: { width: 16, height: 16, color: "#fff" } })
|
|
39835
39627
|
)
|
|
39836
39628
|
)
|
|
39837
39629
|
)
|
|
@@ -39996,7 +39788,7 @@ var Me = { exports: {} };
|
|
|
39996
39788
|
var Or = Me.exports;
|
|
39997
39789
|
var kt;
|
|
39998
39790
|
function kr() {
|
|
39999
|
-
return kt || (kt = 1,
|
|
39791
|
+
return kt || (kt = 1, function(e3) {
|
|
40000
39792
|
(function(t, n) {
|
|
40001
39793
|
e3.exports ? e3.exports = n() : t.log = n();
|
|
40002
39794
|
})(Or, function() {
|
|
@@ -40140,7 +39932,7 @@ function kr() {
|
|
|
40140
39932
|
return o2;
|
|
40141
39933
|
}, s.default = s, s;
|
|
40142
39934
|
});
|
|
40143
|
-
}
|
|
39935
|
+
}(Me)), Me.exports;
|
|
40144
39936
|
}
|
|
40145
39937
|
var _r = kr();
|
|
40146
39938
|
var Lr = /* @__PURE__ */ Ar(_r);
|
|
@@ -40363,7 +40155,7 @@ function Ue(e3, t) {
|
|
|
40363
40155
|
0 <= n && e3.splice(n, 1);
|
|
40364
40156
|
}
|
|
40365
40157
|
}
|
|
40366
|
-
var Oe =
|
|
40158
|
+
var Oe = function() {
|
|
40367
40159
|
function e3(t) {
|
|
40368
40160
|
this.initialTeardown = t, this.closed = false, this._parentage = null, this._finalizers = null;
|
|
40369
40161
|
}
|
|
@@ -40447,11 +40239,11 @@ var Oe = (function() {
|
|
|
40447
40239
|
}, e3.prototype.remove = function(t) {
|
|
40448
40240
|
var n = this._finalizers;
|
|
40449
40241
|
n && Ue(n, t), t instanceof e3 && t._removeParent(this);
|
|
40450
|
-
}, e3.EMPTY =
|
|
40242
|
+
}, e3.EMPTY = function() {
|
|
40451
40243
|
var t = new e3();
|
|
40452
40244
|
return t.closed = true, t;
|
|
40453
|
-
}
|
|
40454
|
-
}
|
|
40245
|
+
}(), e3;
|
|
40246
|
+
}();
|
|
40455
40247
|
var an = Oe.EMPTY;
|
|
40456
40248
|
function cn(e3) {
|
|
40457
40249
|
return e3 instanceof Oe || e3 && "closed" in e3 && P(e3.remove) && P(e3.add) && P(e3.unsubscribe);
|
|
@@ -40483,7 +40275,7 @@ function je() {
|
|
|
40483
40275
|
function Re(e3) {
|
|
40484
40276
|
e3();
|
|
40485
40277
|
}
|
|
40486
|
-
var gt =
|
|
40278
|
+
var gt = function(e3) {
|
|
40487
40279
|
te(t, e3);
|
|
40488
40280
|
function t(n) {
|
|
40489
40281
|
var r3 = e3.call(this) || this;
|
|
@@ -40514,8 +40306,8 @@ var gt = (function(e3) {
|
|
|
40514
40306
|
this.unsubscribe();
|
|
40515
40307
|
}
|
|
40516
40308
|
}, t;
|
|
40517
|
-
}
|
|
40518
|
-
var Nr =
|
|
40309
|
+
}(Oe);
|
|
40310
|
+
var Nr = function() {
|
|
40519
40311
|
function e3(t) {
|
|
40520
40312
|
this.partialObserver = t;
|
|
40521
40313
|
}
|
|
@@ -40546,8 +40338,8 @@ var Nr = (function() {
|
|
|
40546
40338
|
Le(n);
|
|
40547
40339
|
}
|
|
40548
40340
|
}, e3;
|
|
40549
|
-
}
|
|
40550
|
-
var Ce =
|
|
40341
|
+
}();
|
|
40342
|
+
var Ce = function(e3) {
|
|
40551
40343
|
te(t, e3);
|
|
40552
40344
|
function t(n, r3, i2) {
|
|
40553
40345
|
var o2 = e3.call(this) || this, s;
|
|
@@ -40558,7 +40350,7 @@ var Ce = (function(e3) {
|
|
|
40558
40350
|
} : s = n, o2.destination = new Nr(s), o2;
|
|
40559
40351
|
}
|
|
40560
40352
|
return t;
|
|
40561
|
-
}
|
|
40353
|
+
}(gt);
|
|
40562
40354
|
function Le(e3) {
|
|
40563
40355
|
un(e3);
|
|
40564
40356
|
}
|
|
@@ -40571,9 +40363,9 @@ var Ur = {
|
|
|
40571
40363
|
error: Fr,
|
|
40572
40364
|
complete: je
|
|
40573
40365
|
};
|
|
40574
|
-
var bt =
|
|
40366
|
+
var bt = function() {
|
|
40575
40367
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
40576
|
-
}
|
|
40368
|
+
}();
|
|
40577
40369
|
function Ge(e3) {
|
|
40578
40370
|
return e3;
|
|
40579
40371
|
}
|
|
@@ -40584,7 +40376,7 @@ function jr(e3) {
|
|
|
40584
40376
|
}, n);
|
|
40585
40377
|
};
|
|
40586
40378
|
}
|
|
40587
|
-
var k =
|
|
40379
|
+
var k = function() {
|
|
40588
40380
|
function e3(t) {
|
|
40589
40381
|
t && (this._subscribe = t);
|
|
40590
40382
|
}
|
|
@@ -40643,7 +40435,7 @@ var k = (function() {
|
|
|
40643
40435
|
}, e3.create = function(t) {
|
|
40644
40436
|
return new e3(t);
|
|
40645
40437
|
}, e3;
|
|
40646
|
-
}
|
|
40438
|
+
}();
|
|
40647
40439
|
function Lt(e3) {
|
|
40648
40440
|
var t;
|
|
40649
40441
|
return (t = e3 ?? Dr.Promise) !== null && t !== void 0 ? t : Promise;
|
|
@@ -40673,7 +40465,7 @@ function j(e3) {
|
|
|
40673
40465
|
function F(e3, t, n, r3, i2) {
|
|
40674
40466
|
return new Hr(e3, t, n, r3, i2);
|
|
40675
40467
|
}
|
|
40676
|
-
var Hr =
|
|
40468
|
+
var Hr = function(e3) {
|
|
40677
40469
|
te(t, e3);
|
|
40678
40470
|
function t(n, r3, i2, o2, s, a) {
|
|
40679
40471
|
var c = e3.call(this, n) || this;
|
|
@@ -40708,13 +40500,13 @@ var Hr = (function(e3) {
|
|
|
40708
40500
|
e3.prototype.unsubscribe.call(this), !r3 && ((n = this.onFinalize) === null || n === void 0 || n.call(this));
|
|
40709
40501
|
}
|
|
40710
40502
|
}, t;
|
|
40711
|
-
}
|
|
40503
|
+
}(gt);
|
|
40712
40504
|
var zr = mt(function(e3) {
|
|
40713
40505
|
return function() {
|
|
40714
40506
|
e3(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
40715
40507
|
};
|
|
40716
40508
|
});
|
|
40717
|
-
var ee =
|
|
40509
|
+
var ee = function(e3) {
|
|
40718
40510
|
te(t, e3);
|
|
40719
40511
|
function t() {
|
|
40720
40512
|
var n = e3.call(this) || this;
|
|
@@ -40793,8 +40585,8 @@ var ee = (function(e3) {
|
|
|
40793
40585
|
}, t.create = function(n, r3) {
|
|
40794
40586
|
return new It(n, r3);
|
|
40795
40587
|
}, t;
|
|
40796
|
-
}
|
|
40797
|
-
var It =
|
|
40588
|
+
}(k);
|
|
40589
|
+
var It = function(e3) {
|
|
40798
40590
|
te(t, e3);
|
|
40799
40591
|
function t(n, r3) {
|
|
40800
40592
|
var i2 = e3.call(this) || this;
|
|
@@ -40813,8 +40605,8 @@ var It = (function(e3) {
|
|
|
40813
40605
|
var r3, i2;
|
|
40814
40606
|
return (i2 = (r3 = this.source) === null || r3 === void 0 ? void 0 : r3.subscribe(n)) !== null && i2 !== void 0 ? i2 : an;
|
|
40815
40607
|
}, t;
|
|
40816
|
-
}
|
|
40817
|
-
var ln =
|
|
40608
|
+
}(ee);
|
|
40609
|
+
var ln = function(e3) {
|
|
40818
40610
|
te(t, e3);
|
|
40819
40611
|
function t(n) {
|
|
40820
40612
|
var r3 = e3.call(this) || this;
|
|
@@ -40837,13 +40629,13 @@ var ln = (function(e3) {
|
|
|
40837
40629
|
}, t.prototype.next = function(n) {
|
|
40838
40630
|
e3.prototype.next.call(this, this._value = n);
|
|
40839
40631
|
}, t;
|
|
40840
|
-
}
|
|
40632
|
+
}(ee);
|
|
40841
40633
|
var Yr = {
|
|
40842
40634
|
now: function() {
|
|
40843
40635
|
return Date.now();
|
|
40844
40636
|
}
|
|
40845
40637
|
};
|
|
40846
|
-
var qr =
|
|
40638
|
+
var qr = function(e3) {
|
|
40847
40639
|
te(t, e3);
|
|
40848
40640
|
function t(n, r3) {
|
|
40849
40641
|
return e3.call(this) || this;
|
|
@@ -40851,7 +40643,7 @@ var qr = (function(e3) {
|
|
|
40851
40643
|
return t.prototype.schedule = function(n, r3) {
|
|
40852
40644
|
return this;
|
|
40853
40645
|
}, t;
|
|
40854
|
-
}
|
|
40646
|
+
}(Oe);
|
|
40855
40647
|
var Mt = {
|
|
40856
40648
|
setInterval: function(e3, t) {
|
|
40857
40649
|
for (var n = [], r3 = 2; r3 < arguments.length; r3++)
|
|
@@ -40863,7 +40655,7 @@ var Mt = {
|
|
|
40863
40655
|
},
|
|
40864
40656
|
delegate: void 0
|
|
40865
40657
|
};
|
|
40866
|
-
var Kr =
|
|
40658
|
+
var Kr = function(e3) {
|
|
40867
40659
|
te(t, e3);
|
|
40868
40660
|
function t(n, r3) {
|
|
40869
40661
|
var i2 = e3.call(this, n, r3) || this;
|
|
@@ -40905,16 +40697,16 @@ var Kr = (function(e3) {
|
|
|
40905
40697
|
this.work = this.state = this.scheduler = null, this.pending = false, Ue(o2, this), r3 != null && (this.id = this.recycleAsyncId(i2, r3, null)), this.delay = null, e3.prototype.unsubscribe.call(this);
|
|
40906
40698
|
}
|
|
40907
40699
|
}, t;
|
|
40908
|
-
}
|
|
40909
|
-
var Rt =
|
|
40700
|
+
}(qr);
|
|
40701
|
+
var Rt = function() {
|
|
40910
40702
|
function e3(t, n) {
|
|
40911
40703
|
n === void 0 && (n = e3.now), this.schedulerActionCtor = t, this.now = n;
|
|
40912
40704
|
}
|
|
40913
40705
|
return e3.prototype.schedule = function(t, n, r3) {
|
|
40914
40706
|
return n === void 0 && (n = 0), new this.schedulerActionCtor(this, t).schedule(r3, n);
|
|
40915
40707
|
}, e3.now = Yr.now, e3;
|
|
40916
|
-
}
|
|
40917
|
-
var Gr =
|
|
40708
|
+
}();
|
|
40709
|
+
var Gr = function(e3) {
|
|
40918
40710
|
te(t, e3);
|
|
40919
40711
|
function t(n, r3) {
|
|
40920
40712
|
r3 === void 0 && (r3 = Rt.now);
|
|
@@ -40939,7 +40731,7 @@ var Gr = (function(e3) {
|
|
|
40939
40731
|
throw i2;
|
|
40940
40732
|
}
|
|
40941
40733
|
}, t;
|
|
40942
|
-
}
|
|
40734
|
+
}(Rt);
|
|
40943
40735
|
var Qr = new Gr(Kr);
|
|
40944
40736
|
function Jr(e3) {
|
|
40945
40737
|
return e3 && P(e3.schedule);
|
|
@@ -42068,7 +41860,7 @@ var MicButton = ({
|
|
|
42068
41860
|
onLanguageChange,
|
|
42069
41861
|
showLanguageDropdown = true
|
|
42070
41862
|
}) => {
|
|
42071
|
-
const { apiKey, appId } = useAnsyrContext();
|
|
41863
|
+
const { apiKey, appId, theme, emptyStateMessage } = useAnsyrContext();
|
|
42072
41864
|
const [showBodyGlow, setShowBodyGlow] = (0, import_react20.useState)(false);
|
|
42073
41865
|
const [currentTheme, setCurrentTheme] = (0, import_react20.useState)("dark");
|
|
42074
41866
|
const [showLanguageSelector, setShowLanguageSelector] = (0, import_react20.useState)(false);
|
|
@@ -42357,6 +42149,50 @@ var MicButton = ({
|
|
|
42357
42149
|
};
|
|
42358
42150
|
}
|
|
42359
42151
|
};
|
|
42152
|
+
const generateMicButtonGradient = () => {
|
|
42153
|
+
const colors = currentTheme === "light" ? theme?.light : theme?.dark;
|
|
42154
|
+
if (colors?.primary) {
|
|
42155
|
+
const hsl = hexToHSL(colors.primary);
|
|
42156
|
+
if (hsl) {
|
|
42157
|
+
const lightHsl = `${hsl.h} ${hsl.s}% ${Math.min(hsl.l + 10, 100)}%`;
|
|
42158
|
+
return `radial-gradient(circle at 50% 0%, hsl(${lightHsl}), hsl(${hsl.toString()}))`;
|
|
42159
|
+
}
|
|
42160
|
+
}
|
|
42161
|
+
return currentTheme === "dark" ? "radial-gradient(circle at 50% 0%, #9a92f6, #5447cd)" : "radial-gradient(circle at 50% 0%, #9a92f6, #6257d9)";
|
|
42162
|
+
};
|
|
42163
|
+
const generateThemeStyles2 = (theme2, currentTheme2 = "dark") => {
|
|
42164
|
+
if (!theme2) return {};
|
|
42165
|
+
const colors = currentTheme2 === "light" ? theme2.light : theme2.dark;
|
|
42166
|
+
if (!colors) return {};
|
|
42167
|
+
const mapping = {
|
|
42168
|
+
primary: "--voice-accent",
|
|
42169
|
+
background: "--voice-bg",
|
|
42170
|
+
surface: "--voice-surface",
|
|
42171
|
+
border: "--voice-border",
|
|
42172
|
+
text: "--voice-text",
|
|
42173
|
+
textMuted: "--voice-text-muted",
|
|
42174
|
+
userBubble: "--voice-user-bubble",
|
|
42175
|
+
userText: "--voice-user-text",
|
|
42176
|
+
aiBubble: "--voice-ai-bubble",
|
|
42177
|
+
aiText: "--voice-ai-text"
|
|
42178
|
+
};
|
|
42179
|
+
const styles = {};
|
|
42180
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
42181
|
+
const varName = mapping[key];
|
|
42182
|
+
if (varName && value) {
|
|
42183
|
+
const hsl = hexToHSL(value);
|
|
42184
|
+
if (hsl) {
|
|
42185
|
+
styles[varName] = hsl.toString();
|
|
42186
|
+
if (key === "primary") {
|
|
42187
|
+
styles["--indicator-bg"] = hsl.toString();
|
|
42188
|
+
styles["--voice-accent-light"] = currentTheme2 === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
|
|
42189
|
+
}
|
|
42190
|
+
}
|
|
42191
|
+
}
|
|
42192
|
+
});
|
|
42193
|
+
return styles;
|
|
42194
|
+
};
|
|
42195
|
+
const micButtonGradient = generateMicButtonGradient();
|
|
42360
42196
|
const buttonStyles = {
|
|
42361
42197
|
container: {
|
|
42362
42198
|
position: "relative",
|
|
@@ -42372,7 +42208,7 @@ var MicButton = ({
|
|
|
42372
42208
|
width: `${buttonSize}px`,
|
|
42373
42209
|
height: `${buttonSize}px`,
|
|
42374
42210
|
borderRadius: "50%",
|
|
42375
|
-
background:
|
|
42211
|
+
background: micButtonGradient,
|
|
42376
42212
|
transition: "all 0.5s",
|
|
42377
42213
|
border: "none",
|
|
42378
42214
|
boxShadow: "0 25px 50px -12px rgba(0, 0, 0, 0.25)",
|
|
@@ -42412,7 +42248,11 @@ var MicButton = ({
|
|
|
42412
42248
|
{
|
|
42413
42249
|
"data-cuekit-ignore": true,
|
|
42414
42250
|
className: `cuekit-voice-popup ${currentTheme === "dark" ? "cuekit-dark" : ""}`,
|
|
42415
|
-
style: {
|
|
42251
|
+
style: {
|
|
42252
|
+
...buttonStyles.container,
|
|
42253
|
+
...getPositionStyle(),
|
|
42254
|
+
...generateThemeStyles2(theme, currentTheme)
|
|
42255
|
+
}
|
|
42416
42256
|
},
|
|
42417
42257
|
showLanguageSelector && showLanguageDropdown ? /* @__PURE__ */ import_react20.default.createElement("div", { className: "voice-chat-language-selection" }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "voice-chat-language-header" }, /* @__PURE__ */ import_react20.default.createElement("div", { className: "voice-chat-language-icon" }, /* @__PURE__ */ import_react20.default.createElement(mic_default, { width: 20, height: 20 })), /* @__PURE__ */ import_react20.default.createElement("span", { className: "voice-chat-language-title" }, "Select Language")), /* @__PURE__ */ import_react20.default.createElement(
|
|
42418
42258
|
LanguageSelector,
|
|
@@ -42427,10 +42267,27 @@ var MicButton = ({
|
|
|
42427
42267
|
"button",
|
|
42428
42268
|
{
|
|
42429
42269
|
className: "voice-chat-cancel-button",
|
|
42430
|
-
onClick: () => setShowLanguageSelector(false)
|
|
42270
|
+
onClick: () => setShowLanguageSelector(false),
|
|
42271
|
+
style: {
|
|
42272
|
+
background: currentTheme === "dark" ? "hsl(248 32% 17.5%)" : "#f6f5ff",
|
|
42273
|
+
color: currentTheme === "dark" ? "hsl(252 20% 65%)" : "#6257d9",
|
|
42274
|
+
border: `1px solid ${currentTheme === "dark" ? "hsl(248 32% 22%)" : "#c0bbfb"}`
|
|
42275
|
+
}
|
|
42431
42276
|
},
|
|
42432
42277
|
"Cancel"
|
|
42433
|
-
), /* @__PURE__ */ import_react20.default.createElement(
|
|
42278
|
+
), /* @__PURE__ */ import_react20.default.createElement(
|
|
42279
|
+
"button",
|
|
42280
|
+
{
|
|
42281
|
+
className: "voice-chat-confirm-button",
|
|
42282
|
+
onClick: handleLanguageConfirm,
|
|
42283
|
+
style: {
|
|
42284
|
+
background: currentTheme === "dark" ? "#8177ed" : "#6257d9",
|
|
42285
|
+
color: "#fff",
|
|
42286
|
+
border: `1px solid ${currentTheme === "dark" ? "#8177ed" : "#6257d9"}`
|
|
42287
|
+
}
|
|
42288
|
+
},
|
|
42289
|
+
"Start Voice Chat"
|
|
42290
|
+
))) : /* @__PURE__ */ import_react20.default.createElement("div", { className: "voice-chat-main-button" }, showLanguageDropdown && /* @__PURE__ */ import_react20.default.createElement(
|
|
42434
42291
|
LanguageSelector,
|
|
42435
42292
|
{
|
|
42436
42293
|
selectedLanguage,
|
|
@@ -42516,7 +42373,9 @@ var MicButton = ({
|
|
|
42516
42373
|
resizable: true,
|
|
42517
42374
|
persistPosition: true,
|
|
42518
42375
|
persistSize: true,
|
|
42519
|
-
storageKey: "cuekit-chat-popup"
|
|
42376
|
+
storageKey: "cuekit-chat-popup",
|
|
42377
|
+
theme,
|
|
42378
|
+
emptyStateMessage
|
|
42520
42379
|
}
|
|
42521
42380
|
), isChatOpen && isChatMinimized && /* @__PURE__ */ import_react20.default.createElement(
|
|
42522
42381
|
"button",
|