@cuekit-ai/react 1.6.7 → 1.6.9
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/cuekit.css +38 -29
- package/dist/index.d.mts +37 -10
- package/dist/index.d.ts +37 -10
- package/dist/index.js +746 -958
- package/dist/index.mjs +196 -89
- 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
|
}
|
|
@@ -25139,6 +24820,94 @@ function InitCuekit(config) {
|
|
|
25139
24820
|
setWebRTCConfig(webRTCConfig);
|
|
25140
24821
|
}
|
|
25141
24822
|
|
|
24823
|
+
// src/utils/colors.ts
|
|
24824
|
+
function hexToHSL(hex) {
|
|
24825
|
+
hex = hex.replace(/^#/, "");
|
|
24826
|
+
if (hex.length === 3) {
|
|
24827
|
+
hex = hex.split("").map((char) => char + char).join("");
|
|
24828
|
+
}
|
|
24829
|
+
if (hex.length !== 6) return null;
|
|
24830
|
+
const r3 = parseInt(hex.substring(0, 2), 16) / 255;
|
|
24831
|
+
const g = parseInt(hex.substring(2, 4), 16) / 255;
|
|
24832
|
+
const b2 = parseInt(hex.substring(4, 6), 16) / 255;
|
|
24833
|
+
const max = Math.max(r3, g, b2), min = Math.min(r3, g, b2);
|
|
24834
|
+
let h2 = 0, s = 0, l = (max + min) / 2;
|
|
24835
|
+
if (max !== min) {
|
|
24836
|
+
const d = max - min;
|
|
24837
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
24838
|
+
switch (max) {
|
|
24839
|
+
case r3:
|
|
24840
|
+
h2 = (g - b2) / d + (g < b2 ? 6 : 0);
|
|
24841
|
+
break;
|
|
24842
|
+
case g:
|
|
24843
|
+
h2 = (b2 - r3) / d + 2;
|
|
24844
|
+
break;
|
|
24845
|
+
case b2:
|
|
24846
|
+
h2 = (r3 - g) / d + 4;
|
|
24847
|
+
break;
|
|
24848
|
+
}
|
|
24849
|
+
h2 /= 6;
|
|
24850
|
+
}
|
|
24851
|
+
const res = {
|
|
24852
|
+
h: Math.round(h2 * 360),
|
|
24853
|
+
s: Math.round(s * 100),
|
|
24854
|
+
l: Math.round(l * 100)
|
|
24855
|
+
};
|
|
24856
|
+
return {
|
|
24857
|
+
...res,
|
|
24858
|
+
toString: () => `${res.h} ${res.s}% ${res.l}%`
|
|
24859
|
+
};
|
|
24860
|
+
}
|
|
24861
|
+
|
|
24862
|
+
// src/utils/theme.ts
|
|
24863
|
+
var generateThemeStyles = (theme, currentTheme = "dark") => {
|
|
24864
|
+
if (!theme) return {};
|
|
24865
|
+
const colors = currentTheme === "light" ? theme.light : theme.dark;
|
|
24866
|
+
if (!colors) return {};
|
|
24867
|
+
const mapping = {
|
|
24868
|
+
primary: "--voice-accent",
|
|
24869
|
+
statusBg: "--voice-status-bg",
|
|
24870
|
+
statusText: "--voice-status-text",
|
|
24871
|
+
background: "--voice-bg",
|
|
24872
|
+
surface: "--voice-surface",
|
|
24873
|
+
border: "--voice-border",
|
|
24874
|
+
text: "--voice-text",
|
|
24875
|
+
textMuted: "--voice-text-muted",
|
|
24876
|
+
userBubble: "--voice-user-bubble",
|
|
24877
|
+
userText: "--voice-user-text",
|
|
24878
|
+
aiBubble: "--voice-ai-bubble",
|
|
24879
|
+
aiText: "--voice-ai-text"
|
|
24880
|
+
};
|
|
24881
|
+
const styles = {};
|
|
24882
|
+
Object.entries(colors).forEach(([key, value]) => {
|
|
24883
|
+
const varName = mapping[key];
|
|
24884
|
+
if (varName && value) {
|
|
24885
|
+
const hsl = hexToHSL(value);
|
|
24886
|
+
if (hsl) {
|
|
24887
|
+
styles[varName] = hsl.toString();
|
|
24888
|
+
if (key === "primary") {
|
|
24889
|
+
const indicatorHsl = colors.indicator ? hexToHSL(colors.indicator) : hsl;
|
|
24890
|
+
styles["--indicator-bg"] = indicatorHsl ? indicatorHsl.toString() : hsl.toString();
|
|
24891
|
+
const vibrantHsl = colors.primaryVibrant ? hexToHSL(colors.primaryVibrant) : null;
|
|
24892
|
+
const lVibrant = vibrantHsl ? vibrantHsl.l : Math.min(hsl.l + 7, 100);
|
|
24893
|
+
styles["--voice-accent-vibrant"] = vibrantHsl ? vibrantHsl.toString() : `${hsl.h} ${hsl.s}% ${lVibrant}%`;
|
|
24894
|
+
const darkHsl = colors.primaryDark ? hexToHSL(colors.primaryDark) : null;
|
|
24895
|
+
const lDark = darkHsl ? darkHsl.l : Math.max(hsl.l - 10, 0);
|
|
24896
|
+
styles["--voice-accent-dark"] = darkHsl ? darkHsl.toString() : `${hsl.h} ${hsl.s}% ${lDark}%`;
|
|
24897
|
+
styles["--voice-accent-light"] = currentTheme === "light" ? `${hsl.h} ${hsl.s}% 96%` : `${hsl.h} ${hsl.s}% 25%`;
|
|
24898
|
+
const finalVibrant = vibrantHsl ? `hsl(${vibrantHsl.toString()})` : `hsl(${hsl.h} ${hsl.s}% ${lVibrant}%)`;
|
|
24899
|
+
const finalDark = darkHsl ? `hsl(${darkHsl.toString()})` : `hsl(${hsl.h} ${hsl.s}% ${lDark}%)`;
|
|
24900
|
+
styles["--gradient-primary"] = `linear-gradient(135deg, hsl(${hsl.toString()}), ${finalVibrant})`;
|
|
24901
|
+
styles["--gradient-mic-button"] = `radial-gradient(circle at 50% 0%, ${finalVibrant}, ${finalDark})`;
|
|
24902
|
+
const shadowColor = currentTheme === "light" ? `hsl(${hsl.toString()} / 0.1)` : `hsl(${hsl.toString()} / 0.2)`;
|
|
24903
|
+
styles["--shadow-soft"] = `0 4px 20px -2px ${shadowColor}`;
|
|
24904
|
+
}
|
|
24905
|
+
}
|
|
24906
|
+
}
|
|
24907
|
+
});
|
|
24908
|
+
return styles;
|
|
24909
|
+
};
|
|
24910
|
+
|
|
25142
24911
|
// src/providers/ansyr-provider.tsx
|
|
25143
24912
|
init_navigation();
|
|
25144
24913
|
init_intent_store();
|
|
@@ -25233,9 +25002,12 @@ var AnsyrProvider = ({
|
|
|
25233
25002
|
title = "ansyr.ai",
|
|
25234
25003
|
showLogo = true,
|
|
25235
25004
|
showAIIcon = true,
|
|
25236
|
-
showUserIcon = true
|
|
25005
|
+
showUserIcon = true,
|
|
25006
|
+
theme,
|
|
25007
|
+
emptyStateMessage
|
|
25237
25008
|
}) => {
|
|
25238
25009
|
const [internalDeviceId, setInternalDeviceId] = (0, import_react.useState)(deviceId);
|
|
25010
|
+
const themeStyles = generateThemeStyles(theme, "dark");
|
|
25239
25011
|
(0, import_react.useEffect)(() => {
|
|
25240
25012
|
InitCuekit({ apiKey, appId });
|
|
25241
25013
|
}, [apiKey, appId]);
|
|
@@ -25342,10 +25114,12 @@ var AnsyrProvider = ({
|
|
|
25342
25114
|
title,
|
|
25343
25115
|
showLogo,
|
|
25344
25116
|
showAIIcon,
|
|
25345
|
-
showUserIcon
|
|
25117
|
+
showUserIcon,
|
|
25118
|
+
theme,
|
|
25119
|
+
emptyStateMessage
|
|
25346
25120
|
}
|
|
25347
25121
|
},
|
|
25348
|
-
children
|
|
25122
|
+
/* @__PURE__ */ import_react.default.createElement("div", { style: themeStyles }, children)
|
|
25349
25123
|
);
|
|
25350
25124
|
};
|
|
25351
25125
|
|
|
@@ -33355,7 +33129,7 @@ var convert = (
|
|
|
33355
33129
|
* @param {Test} [test]
|
|
33356
33130
|
* @returns {Check}
|
|
33357
33131
|
*/
|
|
33358
|
-
|
|
33132
|
+
function(test) {
|
|
33359
33133
|
if (test === null || test === void 0) {
|
|
33360
33134
|
return ok2;
|
|
33361
33135
|
}
|
|
@@ -33369,7 +33143,7 @@ var convert = (
|
|
|
33369
33143
|
return typeFactory(test);
|
|
33370
33144
|
}
|
|
33371
33145
|
throw new Error("Expected function, string, or object as test");
|
|
33372
|
-
}
|
|
33146
|
+
}
|
|
33373
33147
|
);
|
|
33374
33148
|
function anyFactory(tests) {
|
|
33375
33149
|
const checks2 = [];
|
|
@@ -34549,7 +34323,7 @@ var CallableInstance = (
|
|
|
34549
34323
|
* @param {string | symbol} property
|
|
34550
34324
|
* @returns {(...parameters: Array<unknown>) => unknown}
|
|
34551
34325
|
*/
|
|
34552
|
-
|
|
34326
|
+
function(property) {
|
|
34553
34327
|
const self2 = this;
|
|
34554
34328
|
const constr = self2.constructor;
|
|
34555
34329
|
const proto = (
|
|
@@ -34564,7 +34338,7 @@ var CallableInstance = (
|
|
|
34564
34338
|
};
|
|
34565
34339
|
Object.setPrototypeOf(apply, proto);
|
|
34566
34340
|
return apply;
|
|
34567
|
-
}
|
|
34341
|
+
}
|
|
34568
34342
|
);
|
|
34569
34343
|
|
|
34570
34344
|
// node_modules/unified/lib/index.js
|
|
@@ -39183,9 +38957,20 @@ var ChatPopup = ({
|
|
|
39183
38957
|
onSizeChange,
|
|
39184
38958
|
persistPosition = true,
|
|
39185
38959
|
persistSize = true,
|
|
39186
|
-
storageKey = "chat-popup"
|
|
38960
|
+
storageKey = "chat-popup",
|
|
38961
|
+
theme: localTheme,
|
|
38962
|
+
emptyStateMessage: localEmptyStateMessage
|
|
39187
38963
|
}) => {
|
|
39188
|
-
const {
|
|
38964
|
+
const {
|
|
38965
|
+
title,
|
|
38966
|
+
showLogo,
|
|
38967
|
+
showAIIcon,
|
|
38968
|
+
showUserIcon,
|
|
38969
|
+
theme: contextTheme,
|
|
38970
|
+
emptyStateMessage: contextEmptyStateMessage
|
|
38971
|
+
} = useAnsyrContext();
|
|
38972
|
+
const theme = localTheme || contextTheme;
|
|
38973
|
+
const emptyStateMessage = localEmptyStateMessage || contextEmptyStateMessage;
|
|
39189
38974
|
const [inputText, setInputText] = (0, import_react14.useState)("");
|
|
39190
38975
|
const [isSending, setIsSending] = (0, import_react14.useState)(false);
|
|
39191
38976
|
const messagesEndRef = (0, import_react14.useRef)(null);
|
|
@@ -39280,7 +39065,8 @@ var ChatPopup = ({
|
|
|
39280
39065
|
animation: "scaleIn 0.3s ease-out",
|
|
39281
39066
|
flexDirection: "column",
|
|
39282
39067
|
fontFamily: "Inter, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif",
|
|
39283
|
-
overflow: "hidden"
|
|
39068
|
+
overflow: "hidden",
|
|
39069
|
+
...generateThemeStyles(theme, currentTheme)
|
|
39284
39070
|
}
|
|
39285
39071
|
},
|
|
39286
39072
|
/* @__PURE__ */ import_react14.default.createElement(
|
|
@@ -39334,8 +39120,8 @@ var ChatPopup = ({
|
|
|
39334
39120
|
"div",
|
|
39335
39121
|
{
|
|
39336
39122
|
style: {
|
|
39337
|
-
background: "hsl(var(--voice-
|
|
39338
|
-
color: "hsl(var(--voice-
|
|
39123
|
+
background: "hsl(var(--voice-status-bg))",
|
|
39124
|
+
color: "hsl(var(--voice-status-text))",
|
|
39339
39125
|
minHeight: "16px",
|
|
39340
39126
|
display: "flex",
|
|
39341
39127
|
alignItems: "center",
|
|
@@ -39475,7 +39261,7 @@ var ChatPopup = ({
|
|
|
39475
39261
|
fontSize: "14px"
|
|
39476
39262
|
}
|
|
39477
39263
|
},
|
|
39478
|
-
"Start a conversation with CueKit AI"
|
|
39264
|
+
emptyStateMessage || "Start a conversation with CueKit AI"
|
|
39479
39265
|
) : messages.map((message, index2) => /* @__PURE__ */ import_react14.default.createElement(
|
|
39480
39266
|
"div",
|
|
39481
39267
|
{
|
|
@@ -39779,8 +39565,8 @@ var ChatPopup = ({
|
|
|
39779
39565
|
style: {
|
|
39780
39566
|
padding: "10px 12px",
|
|
39781
39567
|
borderRadius: 8,
|
|
39782
|
-
border:
|
|
39783
|
-
background:
|
|
39568
|
+
border: "1px solid hsl(var(--voice-accent))",
|
|
39569
|
+
background: "hsl(var(--voice-accent))",
|
|
39784
39570
|
color: "#fff",
|
|
39785
39571
|
fontSize: 12,
|
|
39786
39572
|
fontWeight: 700,
|
|
@@ -39803,8 +39589,8 @@ var ChatPopup = ({
|
|
|
39803
39589
|
style: {
|
|
39804
39590
|
padding: "10px 12px",
|
|
39805
39591
|
borderRadius: 8,
|
|
39806
|
-
border:
|
|
39807
|
-
background:
|
|
39592
|
+
border: "1px solid hsl(var(--voice-accent))",
|
|
39593
|
+
background: "hsl(var(--voice-accent))",
|
|
39808
39594
|
color: "#fff",
|
|
39809
39595
|
fontSize: 12,
|
|
39810
39596
|
fontWeight: 700,
|
|
@@ -39842,17 +39628,14 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39842
39628
|
right: 0,
|
|
39843
39629
|
bottom: 0,
|
|
39844
39630
|
width: "4px",
|
|
39845
|
-
background: "linear-gradient(to bottom,
|
|
39631
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
|
|
39846
39632
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39847
39633
|
opacity: 0.8
|
|
39848
39634
|
},
|
|
39849
39635
|
rightBorder2: {
|
|
39850
39636
|
position: "absolute",
|
|
39851
39637
|
top: 0,
|
|
39852
|
-
|
|
39853
|
-
bottom: 0,
|
|
39854
|
-
width: "8px",
|
|
39855
|
-
background: "linear-gradient(to bottom, #c0bbfb, #8177ed, #8177ed)",
|
|
39638
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent)))",
|
|
39856
39639
|
filter: "blur(4px)",
|
|
39857
39640
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39858
39641
|
opacity: 0.6
|
|
@@ -39861,9 +39644,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39861
39644
|
position: "absolute",
|
|
39862
39645
|
top: 0,
|
|
39863
39646
|
right: 0,
|
|
39864
|
-
|
|
39865
|
-
width: "16px",
|
|
39866
|
-
background: "linear-gradient(to bottom, #dad7fe, #8177ed, #9a92f6)",
|
|
39647
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
|
|
39867
39648
|
filter: "blur(12px)",
|
|
39868
39649
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39869
39650
|
opacity: 0.4
|
|
@@ -39874,7 +39655,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39874
39655
|
left: 0,
|
|
39875
39656
|
bottom: 0,
|
|
39876
39657
|
width: "4px",
|
|
39877
|
-
background: "linear-gradient(to bottom,
|
|
39658
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
|
|
39878
39659
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39879
39660
|
opacity: 0.8
|
|
39880
39661
|
},
|
|
@@ -39883,8 +39664,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39883
39664
|
top: 0,
|
|
39884
39665
|
left: 0,
|
|
39885
39666
|
bottom: 0,
|
|
39886
|
-
|
|
39887
|
-
background: "linear-gradient(to bottom, #c0bbfb, #8177ed, #8177ed)",
|
|
39667
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent)))",
|
|
39888
39668
|
filter: "blur(4px)",
|
|
39889
39669
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39890
39670
|
opacity: 0.6
|
|
@@ -39894,8 +39674,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39894
39674
|
top: 0,
|
|
39895
39675
|
left: 0,
|
|
39896
39676
|
bottom: 0,
|
|
39897
|
-
|
|
39898
|
-
background: "linear-gradient(to bottom, #dad7fe, #8177ed, #9a92f6)",
|
|
39677
|
+
background: "linear-gradient(to bottom, hsl(var(--voice-accent-light)), hsl(var(--voice-accent)), hsl(var(--voice-accent-light)))",
|
|
39899
39678
|
filter: "blur(12px)",
|
|
39900
39679
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
39901
39680
|
opacity: 0.4
|
|
@@ -39906,7 +39685,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39906
39685
|
left: 0,
|
|
39907
39686
|
width: "32px",
|
|
39908
39687
|
height: "32px",
|
|
39909
|
-
background: "
|
|
39688
|
+
background: "hsl(var(--voice-accent))",
|
|
39910
39689
|
borderBottomRightRadius: "50%",
|
|
39911
39690
|
filter: "blur(16px)",
|
|
39912
39691
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
@@ -39918,7 +39697,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39918
39697
|
right: 0,
|
|
39919
39698
|
width: "32px",
|
|
39920
39699
|
height: "32px",
|
|
39921
|
-
background: "
|
|
39700
|
+
background: "hsl(var(--voice-accent))",
|
|
39922
39701
|
borderBottomLeftRadius: "50%",
|
|
39923
39702
|
filter: "blur(16px)",
|
|
39924
39703
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
@@ -39930,7 +39709,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39930
39709
|
right: 0,
|
|
39931
39710
|
width: "32px",
|
|
39932
39711
|
height: "32px",
|
|
39933
|
-
background: "
|
|
39712
|
+
background: "hsl(var(--voice-accent))",
|
|
39934
39713
|
borderTopLeftRadius: "50%",
|
|
39935
39714
|
filter: "blur(16px)",
|
|
39936
39715
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
@@ -39942,7 +39721,7 @@ var BorderGlow = ({ isActive }) => {
|
|
|
39942
39721
|
left: 0,
|
|
39943
39722
|
width: "32px",
|
|
39944
39723
|
height: "32px",
|
|
39945
|
-
background: "
|
|
39724
|
+
background: "hsl(var(--voice-accent))",
|
|
39946
39725
|
borderTopRightRadius: "50%",
|
|
39947
39726
|
filter: "blur(16px)",
|
|
39948
39727
|
animation: "borderPulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite",
|
|
@@ -39979,7 +39758,7 @@ var Me = { exports: {} };
|
|
|
39979
39758
|
var Or = Me.exports;
|
|
39980
39759
|
var kt;
|
|
39981
39760
|
function kr() {
|
|
39982
|
-
return kt || (kt = 1,
|
|
39761
|
+
return kt || (kt = 1, function(e3) {
|
|
39983
39762
|
(function(t, n) {
|
|
39984
39763
|
e3.exports ? e3.exports = n() : t.log = n();
|
|
39985
39764
|
})(Or, function() {
|
|
@@ -40123,7 +39902,7 @@ function kr() {
|
|
|
40123
39902
|
return o2;
|
|
40124
39903
|
}, s.default = s, s;
|
|
40125
39904
|
});
|
|
40126
|
-
}
|
|
39905
|
+
}(Me)), Me.exports;
|
|
40127
39906
|
}
|
|
40128
39907
|
var _r = kr();
|
|
40129
39908
|
var Lr = /* @__PURE__ */ Ar(_r);
|
|
@@ -40346,7 +40125,7 @@ function Ue(e3, t) {
|
|
|
40346
40125
|
0 <= n && e3.splice(n, 1);
|
|
40347
40126
|
}
|
|
40348
40127
|
}
|
|
40349
|
-
var Oe =
|
|
40128
|
+
var Oe = function() {
|
|
40350
40129
|
function e3(t) {
|
|
40351
40130
|
this.initialTeardown = t, this.closed = false, this._parentage = null, this._finalizers = null;
|
|
40352
40131
|
}
|
|
@@ -40430,11 +40209,11 @@ var Oe = (function() {
|
|
|
40430
40209
|
}, e3.prototype.remove = function(t) {
|
|
40431
40210
|
var n = this._finalizers;
|
|
40432
40211
|
n && Ue(n, t), t instanceof e3 && t._removeParent(this);
|
|
40433
|
-
}, e3.EMPTY =
|
|
40212
|
+
}, e3.EMPTY = function() {
|
|
40434
40213
|
var t = new e3();
|
|
40435
40214
|
return t.closed = true, t;
|
|
40436
|
-
}
|
|
40437
|
-
}
|
|
40215
|
+
}(), e3;
|
|
40216
|
+
}();
|
|
40438
40217
|
var an = Oe.EMPTY;
|
|
40439
40218
|
function cn(e3) {
|
|
40440
40219
|
return e3 instanceof Oe || e3 && "closed" in e3 && P(e3.remove) && P(e3.add) && P(e3.unsubscribe);
|
|
@@ -40466,7 +40245,7 @@ function je() {
|
|
|
40466
40245
|
function Re(e3) {
|
|
40467
40246
|
e3();
|
|
40468
40247
|
}
|
|
40469
|
-
var gt =
|
|
40248
|
+
var gt = function(e3) {
|
|
40470
40249
|
te(t, e3);
|
|
40471
40250
|
function t(n) {
|
|
40472
40251
|
var r3 = e3.call(this) || this;
|
|
@@ -40497,8 +40276,8 @@ var gt = (function(e3) {
|
|
|
40497
40276
|
this.unsubscribe();
|
|
40498
40277
|
}
|
|
40499
40278
|
}, t;
|
|
40500
|
-
}
|
|
40501
|
-
var Nr =
|
|
40279
|
+
}(Oe);
|
|
40280
|
+
var Nr = function() {
|
|
40502
40281
|
function e3(t) {
|
|
40503
40282
|
this.partialObserver = t;
|
|
40504
40283
|
}
|
|
@@ -40529,8 +40308,8 @@ var Nr = (function() {
|
|
|
40529
40308
|
Le(n);
|
|
40530
40309
|
}
|
|
40531
40310
|
}, e3;
|
|
40532
|
-
}
|
|
40533
|
-
var Ce =
|
|
40311
|
+
}();
|
|
40312
|
+
var Ce = function(e3) {
|
|
40534
40313
|
te(t, e3);
|
|
40535
40314
|
function t(n, r3, i2) {
|
|
40536
40315
|
var o2 = e3.call(this) || this, s;
|
|
@@ -40541,7 +40320,7 @@ var Ce = (function(e3) {
|
|
|
40541
40320
|
} : s = n, o2.destination = new Nr(s), o2;
|
|
40542
40321
|
}
|
|
40543
40322
|
return t;
|
|
40544
|
-
}
|
|
40323
|
+
}(gt);
|
|
40545
40324
|
function Le(e3) {
|
|
40546
40325
|
un(e3);
|
|
40547
40326
|
}
|
|
@@ -40554,9 +40333,9 @@ var Ur = {
|
|
|
40554
40333
|
error: Fr,
|
|
40555
40334
|
complete: je
|
|
40556
40335
|
};
|
|
40557
|
-
var bt =
|
|
40336
|
+
var bt = function() {
|
|
40558
40337
|
return typeof Symbol == "function" && Symbol.observable || "@@observable";
|
|
40559
|
-
}
|
|
40338
|
+
}();
|
|
40560
40339
|
function Ge(e3) {
|
|
40561
40340
|
return e3;
|
|
40562
40341
|
}
|
|
@@ -40567,7 +40346,7 @@ function jr(e3) {
|
|
|
40567
40346
|
}, n);
|
|
40568
40347
|
};
|
|
40569
40348
|
}
|
|
40570
|
-
var k =
|
|
40349
|
+
var k = function() {
|
|
40571
40350
|
function e3(t) {
|
|
40572
40351
|
t && (this._subscribe = t);
|
|
40573
40352
|
}
|
|
@@ -40626,7 +40405,7 @@ var k = (function() {
|
|
|
40626
40405
|
}, e3.create = function(t) {
|
|
40627
40406
|
return new e3(t);
|
|
40628
40407
|
}, e3;
|
|
40629
|
-
}
|
|
40408
|
+
}();
|
|
40630
40409
|
function Lt(e3) {
|
|
40631
40410
|
var t;
|
|
40632
40411
|
return (t = e3 ?? Dr.Promise) !== null && t !== void 0 ? t : Promise;
|
|
@@ -40656,7 +40435,7 @@ function j(e3) {
|
|
|
40656
40435
|
function F(e3, t, n, r3, i2) {
|
|
40657
40436
|
return new Hr(e3, t, n, r3, i2);
|
|
40658
40437
|
}
|
|
40659
|
-
var Hr =
|
|
40438
|
+
var Hr = function(e3) {
|
|
40660
40439
|
te(t, e3);
|
|
40661
40440
|
function t(n, r3, i2, o2, s, a) {
|
|
40662
40441
|
var c = e3.call(this, n) || this;
|
|
@@ -40691,13 +40470,13 @@ var Hr = (function(e3) {
|
|
|
40691
40470
|
e3.prototype.unsubscribe.call(this), !r3 && ((n = this.onFinalize) === null || n === void 0 || n.call(this));
|
|
40692
40471
|
}
|
|
40693
40472
|
}, t;
|
|
40694
|
-
}
|
|
40473
|
+
}(gt);
|
|
40695
40474
|
var zr = mt(function(e3) {
|
|
40696
40475
|
return function() {
|
|
40697
40476
|
e3(this), this.name = "ObjectUnsubscribedError", this.message = "object unsubscribed";
|
|
40698
40477
|
};
|
|
40699
40478
|
});
|
|
40700
|
-
var ee =
|
|
40479
|
+
var ee = function(e3) {
|
|
40701
40480
|
te(t, e3);
|
|
40702
40481
|
function t() {
|
|
40703
40482
|
var n = e3.call(this) || this;
|
|
@@ -40776,8 +40555,8 @@ var ee = (function(e3) {
|
|
|
40776
40555
|
}, t.create = function(n, r3) {
|
|
40777
40556
|
return new It(n, r3);
|
|
40778
40557
|
}, t;
|
|
40779
|
-
}
|
|
40780
|
-
var It =
|
|
40558
|
+
}(k);
|
|
40559
|
+
var It = function(e3) {
|
|
40781
40560
|
te(t, e3);
|
|
40782
40561
|
function t(n, r3) {
|
|
40783
40562
|
var i2 = e3.call(this) || this;
|
|
@@ -40796,8 +40575,8 @@ var It = (function(e3) {
|
|
|
40796
40575
|
var r3, i2;
|
|
40797
40576
|
return (i2 = (r3 = this.source) === null || r3 === void 0 ? void 0 : r3.subscribe(n)) !== null && i2 !== void 0 ? i2 : an;
|
|
40798
40577
|
}, t;
|
|
40799
|
-
}
|
|
40800
|
-
var ln =
|
|
40578
|
+
}(ee);
|
|
40579
|
+
var ln = function(e3) {
|
|
40801
40580
|
te(t, e3);
|
|
40802
40581
|
function t(n) {
|
|
40803
40582
|
var r3 = e3.call(this) || this;
|
|
@@ -40820,13 +40599,13 @@ var ln = (function(e3) {
|
|
|
40820
40599
|
}, t.prototype.next = function(n) {
|
|
40821
40600
|
e3.prototype.next.call(this, this._value = n);
|
|
40822
40601
|
}, t;
|
|
40823
|
-
}
|
|
40602
|
+
}(ee);
|
|
40824
40603
|
var Yr = {
|
|
40825
40604
|
now: function() {
|
|
40826
40605
|
return Date.now();
|
|
40827
40606
|
}
|
|
40828
40607
|
};
|
|
40829
|
-
var qr =
|
|
40608
|
+
var qr = function(e3) {
|
|
40830
40609
|
te(t, e3);
|
|
40831
40610
|
function t(n, r3) {
|
|
40832
40611
|
return e3.call(this) || this;
|
|
@@ -40834,7 +40613,7 @@ var qr = (function(e3) {
|
|
|
40834
40613
|
return t.prototype.schedule = function(n, r3) {
|
|
40835
40614
|
return this;
|
|
40836
40615
|
}, t;
|
|
40837
|
-
}
|
|
40616
|
+
}(Oe);
|
|
40838
40617
|
var Mt = {
|
|
40839
40618
|
setInterval: function(e3, t) {
|
|
40840
40619
|
for (var n = [], r3 = 2; r3 < arguments.length; r3++)
|
|
@@ -40846,7 +40625,7 @@ var Mt = {
|
|
|
40846
40625
|
},
|
|
40847
40626
|
delegate: void 0
|
|
40848
40627
|
};
|
|
40849
|
-
var Kr =
|
|
40628
|
+
var Kr = function(e3) {
|
|
40850
40629
|
te(t, e3);
|
|
40851
40630
|
function t(n, r3) {
|
|
40852
40631
|
var i2 = e3.call(this, n, r3) || this;
|
|
@@ -40888,16 +40667,16 @@ var Kr = (function(e3) {
|
|
|
40888
40667
|
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);
|
|
40889
40668
|
}
|
|
40890
40669
|
}, t;
|
|
40891
|
-
}
|
|
40892
|
-
var Rt =
|
|
40670
|
+
}(qr);
|
|
40671
|
+
var Rt = function() {
|
|
40893
40672
|
function e3(t, n) {
|
|
40894
40673
|
n === void 0 && (n = e3.now), this.schedulerActionCtor = t, this.now = n;
|
|
40895
40674
|
}
|
|
40896
40675
|
return e3.prototype.schedule = function(t, n, r3) {
|
|
40897
40676
|
return n === void 0 && (n = 0), new this.schedulerActionCtor(this, t).schedule(r3, n);
|
|
40898
40677
|
}, e3.now = Yr.now, e3;
|
|
40899
|
-
}
|
|
40900
|
-
var Gr =
|
|
40678
|
+
}();
|
|
40679
|
+
var Gr = function(e3) {
|
|
40901
40680
|
te(t, e3);
|
|
40902
40681
|
function t(n, r3) {
|
|
40903
40682
|
r3 === void 0 && (r3 = Rt.now);
|
|
@@ -40922,7 +40701,7 @@ var Gr = (function(e3) {
|
|
|
40922
40701
|
throw i2;
|
|
40923
40702
|
}
|
|
40924
40703
|
}, t;
|
|
40925
|
-
}
|
|
40704
|
+
}(Rt);
|
|
40926
40705
|
var Qr = new Gr(Kr);
|
|
40927
40706
|
function Jr(e3) {
|
|
40928
40707
|
return e3 && P(e3.schedule);
|
|
@@ -42051,7 +41830,7 @@ var MicButton = ({
|
|
|
42051
41830
|
onLanguageChange,
|
|
42052
41831
|
showLanguageDropdown = true
|
|
42053
41832
|
}) => {
|
|
42054
|
-
const { apiKey, appId } = useAnsyrContext();
|
|
41833
|
+
const { apiKey, appId, theme, emptyStateMessage } = useAnsyrContext();
|
|
42055
41834
|
const [showBodyGlow, setShowBodyGlow] = (0, import_react20.useState)(false);
|
|
42056
41835
|
const [currentTheme, setCurrentTheme] = (0, import_react20.useState)("dark");
|
|
42057
41836
|
const [showLanguageSelector, setShowLanguageSelector] = (0, import_react20.useState)(false);
|
|
@@ -42340,7 +42119,10 @@ var MicButton = ({
|
|
|
42340
42119
|
};
|
|
42341
42120
|
}
|
|
42342
42121
|
};
|
|
42343
|
-
const
|
|
42122
|
+
const generateMicButtonGradient = () => {
|
|
42123
|
+
return "radial-gradient(circle at 50% 0%, hsl(var(--voice-accent-vibrant)), hsl(var(--voice-accent-dark)))";
|
|
42124
|
+
};
|
|
42125
|
+
const micButtonGradient = generateMicButtonGradient();
|
|
42344
42126
|
const buttonStyles = {
|
|
42345
42127
|
container: {
|
|
42346
42128
|
position: "relative",
|
|
@@ -42375,18 +42157,18 @@ var MicButton = ({
|
|
|
42375
42157
|
switch (micState) {
|
|
42376
42158
|
case "listening":
|
|
42377
42159
|
baseStyle.transform = "scale(1.05)";
|
|
42378
|
-
baseStyle.boxShadow = "0 25px 50px -12px
|
|
42160
|
+
baseStyle.boxShadow = "0 25px 50px -12px hsla(var(--voice-accent) / 0.6)";
|
|
42379
42161
|
break;
|
|
42380
42162
|
case "thinking":
|
|
42381
42163
|
baseStyle.transform = "scale(1.02)";
|
|
42382
|
-
baseStyle.boxShadow = "0 20px 25px -5px
|
|
42164
|
+
baseStyle.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
|
|
42383
42165
|
break;
|
|
42384
42166
|
case "replying":
|
|
42385
42167
|
baseStyle.transform = "scale(1.02)";
|
|
42386
|
-
baseStyle.boxShadow = "0 20px 25px -5px
|
|
42168
|
+
baseStyle.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
|
|
42387
42169
|
break;
|
|
42388
42170
|
default:
|
|
42389
|
-
baseStyle.boxShadow = "0 10px 15px -3px
|
|
42171
|
+
baseStyle.boxShadow = "0 10px 15px -3px hsla(var(--voice-accent) / 0.3)";
|
|
42390
42172
|
break;
|
|
42391
42173
|
}
|
|
42392
42174
|
return baseStyle;
|
|
@@ -42396,7 +42178,11 @@ var MicButton = ({
|
|
|
42396
42178
|
{
|
|
42397
42179
|
"data-cuekit-ignore": true,
|
|
42398
42180
|
className: `cuekit-voice-popup ${currentTheme === "dark" ? "cuekit-dark" : ""}`,
|
|
42399
|
-
style: {
|
|
42181
|
+
style: {
|
|
42182
|
+
...buttonStyles.container,
|
|
42183
|
+
...getPositionStyle(),
|
|
42184
|
+
...generateThemeStyles(theme, currentTheme)
|
|
42185
|
+
}
|
|
42400
42186
|
},
|
|
42401
42187
|
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(
|
|
42402
42188
|
LanguageSelector,
|
|
@@ -42413,9 +42199,9 @@ var MicButton = ({
|
|
|
42413
42199
|
className: "voice-chat-cancel-button",
|
|
42414
42200
|
onClick: () => setShowLanguageSelector(false),
|
|
42415
42201
|
style: {
|
|
42416
|
-
background: currentTheme === "dark" ? "hsl(
|
|
42417
|
-
color: currentTheme === "dark" ? "hsl(
|
|
42418
|
-
border:
|
|
42202
|
+
background: currentTheme === "dark" ? "hsl(var(--voice-surface))" : "hsl(var(--voice-accent-light))",
|
|
42203
|
+
color: currentTheme === "dark" ? "hsl(var(--voice-text-muted))" : "hsl(var(--voice-accent))",
|
|
42204
|
+
border: "1px solid hsl(var(--voice-border))"
|
|
42419
42205
|
}
|
|
42420
42206
|
},
|
|
42421
42207
|
"Cancel"
|
|
@@ -42425,9 +42211,9 @@ var MicButton = ({
|
|
|
42425
42211
|
className: "voice-chat-confirm-button",
|
|
42426
42212
|
onClick: handleLanguageConfirm,
|
|
42427
42213
|
style: {
|
|
42428
|
-
background:
|
|
42214
|
+
background: "hsl(var(--voice-accent))",
|
|
42429
42215
|
color: "#fff",
|
|
42430
|
-
border:
|
|
42216
|
+
border: "1px solid hsl(var(--voice-accent))"
|
|
42431
42217
|
}
|
|
42432
42218
|
},
|
|
42433
42219
|
"Start Voice Chat"
|
|
@@ -42452,13 +42238,13 @@ var MicButton = ({
|
|
|
42452
42238
|
onMouseEnter: (e3) => {
|
|
42453
42239
|
if (micState === "idle") {
|
|
42454
42240
|
e3.currentTarget.style.transform = "scale(1.05)";
|
|
42455
|
-
e3.currentTarget.style.boxShadow = "0 20px 25px -5px
|
|
42241
|
+
e3.currentTarget.style.boxShadow = "0 20px 25px -5px hsla(var(--voice-accent) / 0.4)";
|
|
42456
42242
|
}
|
|
42457
42243
|
},
|
|
42458
42244
|
onMouseLeave: (e3) => {
|
|
42459
42245
|
if (micState === "idle") {
|
|
42460
42246
|
e3.currentTarget.style.transform = "scale(1)";
|
|
42461
|
-
e3.currentTarget.style.boxShadow = "0 10px 15px -3px
|
|
42247
|
+
e3.currentTarget.style.boxShadow = "0 10px 15px -3px hsla(var(--voice-accent) / 0.3)";
|
|
42462
42248
|
}
|
|
42463
42249
|
},
|
|
42464
42250
|
"aria-label": micState === "thinking" ? "Processing..." : micState === "replying" ? "AI is responding..." : isListening ? "Stop listening" : "Start listening"
|
|
@@ -42517,7 +42303,9 @@ var MicButton = ({
|
|
|
42517
42303
|
resizable: true,
|
|
42518
42304
|
persistPosition: true,
|
|
42519
42305
|
persistSize: true,
|
|
42520
|
-
storageKey: "cuekit-chat-popup"
|
|
42306
|
+
storageKey: "cuekit-chat-popup",
|
|
42307
|
+
theme,
|
|
42308
|
+
emptyStateMessage
|
|
42521
42309
|
}
|
|
42522
42310
|
), isChatOpen && isChatMinimized && /* @__PURE__ */ import_react20.default.createElement(
|
|
42523
42311
|
"button",
|