@ikonai/sdk 1.0.28 → 1.0.30
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/assets/{protocol-worker-Dx4ECerb.js → protocol-worker-BNeN5rOx.js} +174 -143
- package/channel/channel-manager.d.ts +14 -2
- package/channel/channel.d.ts +5 -0
- package/client/ikon-client-config.d.ts +9 -8
- package/client/ikon-client.d.ts +16 -0
- package/index.d.ts +1 -1
- package/index.js +955 -862
- package/package.json +1 -1
- package/utils/query-params.d.ts +9 -0
|
@@ -10,41 +10,41 @@ function X(t) {
|
|
|
10
10
|
const e = Et(t), r = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
11
11
|
if (e.length < 27)
|
|
12
12
|
throw new Error("Protocol payload too short");
|
|
13
|
-
const s = r.getUint32(0, !0), i = r.getUint32(4, !0), n = r.getUint32(8, !0), a = r.getUint32(12, !0), o = r.getUint32(16, !0), l = r.getUint32(20, !0), h = r.getUint8(24),
|
|
13
|
+
const s = r.getUint32(0, !0), i = r.getUint32(4, !0), n = r.getUint32(8, !0), a = r.getUint32(12, !0), o = r.getUint32(16, !0), l = r.getUint32(20, !0), h = r.getUint8(24), N = r.getUint8(25), _ = r.getUint8(26);
|
|
14
14
|
if (27 + l * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
|
-
const
|
|
16
|
+
const c = [];
|
|
17
17
|
let O = 27;
|
|
18
18
|
for (let b = 0; b < l; b++)
|
|
19
|
-
|
|
19
|
+
c.push(r.getUint32(O, !0)), O += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: s,
|
|
22
22
|
opcode: i,
|
|
23
23
|
senderId: n,
|
|
24
24
|
trackId: a,
|
|
25
25
|
sequenceId: o,
|
|
26
|
-
targetIds:
|
|
26
|
+
targetIds: c,
|
|
27
27
|
payloadVersion: h,
|
|
28
|
-
payloadType:
|
|
28
|
+
payloadType: N,
|
|
29
29
|
flags: _
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
function it(t, e, r, s, i) {
|
|
33
|
-
const l = [],
|
|
34
|
-
|
|
33
|
+
const l = [], N = 27 + l.length * 4, _ = N + e.length, P = new Uint8Array(_), c = new DataView(P.buffer);
|
|
34
|
+
c.setUint32(0, _, !0), c.setUint32(4, t >>> 0, !0), c.setUint32(8, s >>> 0, !0), c.setUint32(12, 0, !0), c.setUint32(16, 0, !0), c.setUint32(20, l.length >>> 0, !0), c.setUint8(24, r & 255), c.setUint8(25, 8), c.setUint8(26, 0);
|
|
35
35
|
let O = 27;
|
|
36
36
|
for (let b = 0; b < l.length; b++)
|
|
37
|
-
|
|
38
|
-
return
|
|
37
|
+
c.setUint32(O, l[b] >>> 0, !0), O += 4;
|
|
38
|
+
return P.set(e, N), P;
|
|
39
39
|
}
|
|
40
40
|
var g = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(g || {});
|
|
41
|
-
const nt = 161, at = 162,
|
|
41
|
+
const nt = 161, at = 162, V = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
43
|
class M {
|
|
44
44
|
constructor(e = 1) {
|
|
45
45
|
this.version = e, this.buffer.writeByte(nt), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
|
-
buffer = new
|
|
47
|
+
buffer = new m();
|
|
48
48
|
closed = !1;
|
|
49
49
|
cached;
|
|
50
50
|
writeInt32Field(e, r) {
|
|
@@ -75,7 +75,7 @@ class M {
|
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(s));
|
|
76
76
|
}
|
|
77
77
|
writeStringField(e, r) {
|
|
78
|
-
const s =
|
|
78
|
+
const s = V.encode(r ?? "");
|
|
79
79
|
this.writeVariableField(e, 12, s);
|
|
80
80
|
}
|
|
81
81
|
writeBinaryField(e, r) {
|
|
@@ -116,7 +116,7 @@ class K {
|
|
|
116
116
|
constructor(e) {
|
|
117
117
|
this.elementType = e;
|
|
118
118
|
}
|
|
119
|
-
payload = new
|
|
119
|
+
payload = new m();
|
|
120
120
|
count = 0;
|
|
121
121
|
writeInt32(e) {
|
|
122
122
|
this.ensureElementType(
|
|
@@ -175,7 +175,7 @@ class K {
|
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const r =
|
|
178
|
+
const r = V.encode(e ?? "");
|
|
179
179
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
@@ -215,7 +215,7 @@ class K {
|
|
|
215
215
|
this.payload.writeBytes(n);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
|
-
const e = new
|
|
218
|
+
const e = new m();
|
|
219
219
|
return e.writeByte(k(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
220
220
|
}
|
|
221
221
|
ensureElementType(e) {
|
|
@@ -227,7 +227,7 @@ class Q {
|
|
|
227
227
|
constructor(e, r) {
|
|
228
228
|
this.keyType = e, this.valueType = r, ht(e);
|
|
229
229
|
}
|
|
230
|
-
payload = new
|
|
230
|
+
payload = new m();
|
|
231
231
|
count = 0;
|
|
232
232
|
entryOpen = !1;
|
|
233
233
|
beginEntry() {
|
|
@@ -240,7 +240,7 @@ class Q {
|
|
|
240
240
|
finish() {
|
|
241
241
|
if (this.entryOpen)
|
|
242
242
|
throw new Error("Dictionary entry not completed");
|
|
243
|
-
const e = new
|
|
243
|
+
const e = new m();
|
|
244
244
|
return e.writeByte(k(this.keyType)), e.writeByte(k(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
@@ -308,7 +308,7 @@ class ot {
|
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const r =
|
|
311
|
+
const r = V.encode(e ?? "");
|
|
312
312
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
@@ -386,7 +386,7 @@ class ot {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const r =
|
|
389
|
+
const r = V.encode(e ?? "");
|
|
390
390
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.valueWritten = !0;
|
|
391
391
|
}
|
|
392
392
|
writeValueObject(e, r) {
|
|
@@ -505,13 +505,13 @@ class E {
|
|
|
505
505
|
return (e >>> 0).toString(16).padStart(r, "0");
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
class
|
|
508
|
+
class m {
|
|
509
509
|
static INITIAL_CAPACITY = 256;
|
|
510
510
|
buffer;
|
|
511
511
|
dataView;
|
|
512
512
|
length = 0;
|
|
513
513
|
constructor() {
|
|
514
|
-
this.buffer = new Uint8Array(
|
|
514
|
+
this.buffer = new Uint8Array(m.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
515
515
|
}
|
|
516
516
|
ensureCapacity(e) {
|
|
517
517
|
const r = this.length + e;
|
|
@@ -575,7 +575,7 @@ function j(t) {
|
|
|
575
575
|
function Et(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
578
|
-
var U = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t[t.WebRTC = 128] = "WebRTC", t[t.TcpTls = 256] = "TcpTls", t))(U || {}), m = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(m || {});
|
|
578
|
+
var R = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t[t.WebRTC = 128] = "WebRTC", t[t.TcpTls = 256] = "TcpTls", t))(R || {}), d = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(d || {});
|
|
579
579
|
const J = 1, _t = 131074;
|
|
580
580
|
function Z(t) {
|
|
581
581
|
return {};
|
|
@@ -602,12 +602,12 @@ class z extends L {
|
|
|
602
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class
|
|
605
|
+
class ct extends et {
|
|
606
606
|
constructor(e) {
|
|
607
607
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function It(t, e) {
|
|
611
611
|
return new Promise((r, s) => {
|
|
612
612
|
const i = () => {
|
|
613
613
|
clearTimeout(n), s(new Error("Aborted"));
|
|
@@ -629,10 +629,10 @@ const At = /* @__PURE__ */ new Map(), Ct = {
|
|
|
629
629
|
3: "ERROR",
|
|
630
630
|
4: "NONE"
|
|
631
631
|
};
|
|
632
|
-
function
|
|
632
|
+
function ft(t, e) {
|
|
633
633
|
return `[${t}] ${e}`;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
635
|
+
function p(t, e, r, s) {
|
|
636
636
|
const i = (/* @__PURE__ */ new Date()).toISOString(), n = Ct[t], a = {
|
|
637
637
|
timestamp: i,
|
|
638
638
|
level: t,
|
|
@@ -650,7 +650,7 @@ function G(t, e, r, s) {
|
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
652
|
if (ut <= t) {
|
|
653
|
-
const o =
|
|
653
|
+
const o = ft(e, r);
|
|
654
654
|
switch (t) {
|
|
655
655
|
case 0:
|
|
656
656
|
console.debug(o, ...s);
|
|
@@ -670,20 +670,20 @@ function G(t, e, r, s) {
|
|
|
670
670
|
function F(t) {
|
|
671
671
|
return {
|
|
672
672
|
debug(e, ...r) {
|
|
673
|
-
|
|
673
|
+
p(0, t, e, r);
|
|
674
674
|
},
|
|
675
675
|
info(e, ...r) {
|
|
676
|
-
|
|
676
|
+
p(1, t, e, r);
|
|
677
677
|
},
|
|
678
678
|
warn(e, ...r) {
|
|
679
|
-
|
|
679
|
+
p(2, t, e, r);
|
|
680
680
|
},
|
|
681
681
|
error(e, ...r) {
|
|
682
|
-
|
|
682
|
+
p(3, t, e, r);
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
const
|
|
686
|
+
const G = F("WebSocketTransport"), Nt = 1e4;
|
|
687
687
|
class Rt {
|
|
688
688
|
ws = null;
|
|
689
689
|
keepaliveTimeout = null;
|
|
@@ -712,11 +712,11 @@ class Rt {
|
|
|
712
712
|
clearTimeout(l), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
713
713
|
}, l = setTimeout(() => {
|
|
714
714
|
a || (a = !0, o(), this.ws?.close(), i(new L("WebSocket connection timeout")));
|
|
715
|
-
},
|
|
715
|
+
}, Nt);
|
|
716
716
|
this.ws.onopen = () => {
|
|
717
717
|
n = !0, clearTimeout(l), this.ws.send(r), this.resetKeepaliveTimeout(), a || (a = !0, s());
|
|
718
718
|
}, this.ws.onerror = () => {
|
|
719
|
-
clearTimeout(l),
|
|
719
|
+
clearTimeout(l), G.error("WebSocket error"), a || (a = !0, o(), i(new L("WebSocket connection failed")));
|
|
720
720
|
}, this.ws.onclose = (h) => {
|
|
721
721
|
if (this.clearKeepaliveTimeout(), !n && !a) {
|
|
722
722
|
a = !0, o(), i(new L("WebSocket connection closed before opening"));
|
|
@@ -724,15 +724,15 @@ class Rt {
|
|
|
724
724
|
}
|
|
725
725
|
if (this.isClosed)
|
|
726
726
|
return;
|
|
727
|
-
const
|
|
728
|
-
this.callbacks.onClose(
|
|
727
|
+
const N = h.wasClean && (h.code === 1e3 || h.code === 1001), _ = h.code === 1e3 || h.code === 1001, P = h.reason || `code=${h.code}`;
|
|
728
|
+
this.callbacks.onClose(P, N, _);
|
|
729
729
|
}, this.ws.onmessage = (h) => {
|
|
730
730
|
this.handleProtocolMessage(new Uint8Array(h.data));
|
|
731
731
|
};
|
|
732
732
|
});
|
|
733
733
|
}
|
|
734
734
|
send(e) {
|
|
735
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) :
|
|
735
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : G.warn("Cannot send: WebSocket not connected");
|
|
736
736
|
}
|
|
737
737
|
close() {
|
|
738
738
|
this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -745,29 +745,29 @@ class Rt {
|
|
|
745
745
|
}
|
|
746
746
|
handleProtocolMessage(e) {
|
|
747
747
|
try {
|
|
748
|
-
if (X(e).opcode ===
|
|
748
|
+
if (X(e).opcode === d.KEEPALIVE_REQUEST) {
|
|
749
749
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
750
750
|
return;
|
|
751
751
|
}
|
|
752
752
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
753
753
|
} catch (r) {
|
|
754
|
-
|
|
754
|
+
G.error("Failed to process protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
resetKeepaliveTimeout() {
|
|
758
758
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
759
|
-
|
|
759
|
+
G.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new z(this.keepaliveTimeoutMs)), this.close();
|
|
760
760
|
}, this.keepaliveTimeoutMs);
|
|
761
761
|
}
|
|
762
762
|
clearKeepaliveTimeout() {
|
|
763
763
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
764
764
|
}
|
|
765
765
|
}
|
|
766
|
-
const
|
|
766
|
+
const y = F("WebTransportTransport"), q = 4, yt = 65536;
|
|
767
767
|
function rt() {
|
|
768
768
|
return typeof WebTransport < "u";
|
|
769
769
|
}
|
|
770
|
-
class
|
|
770
|
+
class St {
|
|
771
771
|
transport = null;
|
|
772
772
|
stream = null;
|
|
773
773
|
reader = null;
|
|
@@ -798,10 +798,10 @@ class Ut {
|
|
|
798
798
|
throw new L("WebTransport is not supported in this browser");
|
|
799
799
|
this.isClosed = !1;
|
|
800
800
|
try {
|
|
801
|
-
this.transport = new WebTransport(e), await this.transport.ready,
|
|
801
|
+
this.transport = new WebTransport(e), await this.transport.ready, y.debug(`Connected to WebTransport entrypoint: ${e}`), this.transport.closed.then(() => {
|
|
802
802
|
this.handleClose("Connection closed", !0);
|
|
803
803
|
}).catch((s) => {
|
|
804
|
-
|
|
804
|
+
y.error("WebTransport connection closed with error:", s), this.handleClose(s.message || "Connection error", !1);
|
|
805
805
|
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(r), this.resetKeepaliveTimeout(), this.startReadLoop();
|
|
806
806
|
} catch (s) {
|
|
807
807
|
throw this.cleanup(), new L(`Failed to connect WebTransport: ${s}`, s instanceof Error ? s : void 0);
|
|
@@ -809,11 +809,11 @@ class Ut {
|
|
|
809
809
|
}
|
|
810
810
|
send(e) {
|
|
811
811
|
if (!this.writer) {
|
|
812
|
-
|
|
812
|
+
y.warn("Cannot send: WebTransport not connected");
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
815
|
this.writer.write(e).catch((r) => {
|
|
816
|
-
|
|
816
|
+
y.error("Failed to send protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
817
817
|
});
|
|
818
818
|
}
|
|
819
819
|
close() {
|
|
@@ -834,7 +834,7 @@ class Ut {
|
|
|
834
834
|
}
|
|
835
835
|
this.readLoopActive && this.handleClose("Stream ended", !1);
|
|
836
836
|
} catch (e) {
|
|
837
|
-
this.readLoopActive && (
|
|
837
|
+
this.readLoopActive && (y.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : new Error(String(e))));
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
840
|
}
|
|
@@ -875,7 +875,7 @@ class Ut {
|
|
|
875
875
|
for (; this.receiveBufferLength >= q; ) {
|
|
876
876
|
const r = e.getUint32(this.receiveBufferOffset, !0);
|
|
877
877
|
if (r < q) {
|
|
878
|
-
|
|
878
|
+
y.error(`Invalid message length: ${r}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${r}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
879
879
|
return;
|
|
880
880
|
}
|
|
881
881
|
if (this.receiveBufferLength < r)
|
|
@@ -890,13 +890,13 @@ class Ut {
|
|
|
890
890
|
*/
|
|
891
891
|
handleProtocolMessage(e) {
|
|
892
892
|
try {
|
|
893
|
-
if (X(e).opcode ===
|
|
893
|
+
if (X(e).opcode === d.KEEPALIVE_REQUEST) {
|
|
894
894
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
895
895
|
return;
|
|
896
896
|
}
|
|
897
897
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
898
898
|
} catch (r) {
|
|
899
|
-
|
|
899
|
+
y.error("Failed to process protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
900
900
|
}
|
|
901
901
|
}
|
|
902
902
|
/**
|
|
@@ -910,7 +910,7 @@ class Ut {
|
|
|
910
910
|
*/
|
|
911
911
|
resetKeepaliveTimeout() {
|
|
912
912
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
913
|
-
|
|
913
|
+
y.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new z(this.keepaliveTimeoutMs)), this.close();
|
|
914
914
|
}, this.keepaliveTimeoutMs);
|
|
915
915
|
}
|
|
916
916
|
/**
|
|
@@ -933,7 +933,7 @@ class Ut {
|
|
|
933
933
|
}
|
|
934
934
|
}
|
|
935
935
|
const D = F("Channel");
|
|
936
|
-
class
|
|
936
|
+
class Ut {
|
|
937
937
|
state = "disconnected";
|
|
938
938
|
transport = null;
|
|
939
939
|
config;
|
|
@@ -984,6 +984,13 @@ class St {
|
|
|
984
984
|
disconnect() {
|
|
985
985
|
this.transport && (this.transport.close(), this.transport = null), this.setState("disconnected");
|
|
986
986
|
}
|
|
987
|
+
/**
|
|
988
|
+
* Check transport health and trigger close if the connection is dead.
|
|
989
|
+
* Used after tab resume to detect WebSockets closed by the OS while suspended.
|
|
990
|
+
*/
|
|
991
|
+
checkHealth() {
|
|
992
|
+
this.state === "connected" && this.transport && !this.transport.isConnected && this.handleClose("Transport dead after tab resume", !1);
|
|
993
|
+
}
|
|
987
994
|
/**
|
|
988
995
|
* Send a protocol message through the channel.
|
|
989
996
|
*/
|
|
@@ -1008,18 +1015,18 @@ class St {
|
|
|
1008
1015
|
}
|
|
1009
1016
|
};
|
|
1010
1017
|
switch (e.Type) {
|
|
1011
|
-
case
|
|
1012
|
-
case
|
|
1018
|
+
case R.WebSocket:
|
|
1019
|
+
case R.WebSocketProxy:
|
|
1013
1020
|
this.transport = new Rt(r);
|
|
1014
1021
|
break;
|
|
1015
|
-
case
|
|
1016
|
-
case
|
|
1022
|
+
case R.WebTransport:
|
|
1023
|
+
case R.WebTransportProxy:
|
|
1017
1024
|
if (!rt())
|
|
1018
1025
|
throw new Error("WebTransport is not supported in this browser");
|
|
1019
|
-
this.transport = new
|
|
1026
|
+
this.transport = new St(r);
|
|
1020
1027
|
break;
|
|
1021
1028
|
default:
|
|
1022
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1029
|
+
throw new Error(`Unsupported entrypoint type: ${R[e.Type]}`);
|
|
1023
1030
|
}
|
|
1024
1031
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
1025
1032
|
}
|
|
@@ -1029,7 +1036,7 @@ class St {
|
|
|
1029
1036
|
handleProtocolMessage(e) {
|
|
1030
1037
|
try {
|
|
1031
1038
|
const r = e;
|
|
1032
|
-
if ($(r) ===
|
|
1039
|
+
if ($(r) === d.CORE_ON_SERVER_STOPPING) {
|
|
1033
1040
|
D.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
1034
1041
|
return;
|
|
1035
1042
|
}
|
|
@@ -1057,7 +1064,7 @@ class St {
|
|
|
1057
1064
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1058
1065
|
}
|
|
1059
1066
|
}
|
|
1060
|
-
const
|
|
1067
|
+
const T = F("ChannelManager");
|
|
1061
1068
|
class wt {
|
|
1062
1069
|
channels = /* @__PURE__ */ new Map();
|
|
1063
1070
|
// keyed by opcode group
|
|
@@ -1068,6 +1075,8 @@ class wt {
|
|
|
1068
1075
|
shouldReconnect = !0;
|
|
1069
1076
|
entrypoints = [];
|
|
1070
1077
|
abortController = null;
|
|
1078
|
+
demotedTypes = /* @__PURE__ */ new Set();
|
|
1079
|
+
connectionStable = !1;
|
|
1071
1080
|
config;
|
|
1072
1081
|
constructor(e) {
|
|
1073
1082
|
this.config = e;
|
|
@@ -1087,10 +1096,14 @@ class wt {
|
|
|
1087
1096
|
/**
|
|
1088
1097
|
* Connect to the server using the provided entrypoints.
|
|
1089
1098
|
*/
|
|
1090
|
-
async connect(e) {
|
|
1099
|
+
async connect(e, r) {
|
|
1091
1100
|
if (this.state !== "idle" && this.state !== "offline")
|
|
1092
1101
|
throw new Error(`Cannot connect: already in state ${this.state}`);
|
|
1093
|
-
this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.abortController = new AbortController(),
|
|
1102
|
+
if (this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.demotedTypes.clear(), this.connectionStable = !1, this.abortController = new AbortController(), r?.retry) {
|
|
1103
|
+
this.attemptReconnect();
|
|
1104
|
+
return;
|
|
1105
|
+
}
|
|
1106
|
+
await this.connectInternal();
|
|
1094
1107
|
}
|
|
1095
1108
|
/**
|
|
1096
1109
|
* Disconnect all channels.
|
|
@@ -1109,7 +1122,7 @@ class wt {
|
|
|
1109
1122
|
i.send(e);
|
|
1110
1123
|
return;
|
|
1111
1124
|
}
|
|
1112
|
-
|
|
1125
|
+
T.warn("No channel found for message");
|
|
1113
1126
|
}
|
|
1114
1127
|
/**
|
|
1115
1128
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -1118,6 +1131,17 @@ class wt {
|
|
|
1118
1131
|
for (const r of this.channels.values())
|
|
1119
1132
|
r.send(e);
|
|
1120
1133
|
}
|
|
1134
|
+
/**
|
|
1135
|
+
* Check health of all channels.
|
|
1136
|
+
* Used after tab resume to detect WebSockets closed by the OS while suspended.
|
|
1137
|
+
* Only checks when connected — non-sudden disconnects (SDK-initiated or server
|
|
1138
|
+
* stopping) clear the channels and transition to idle/stopped before this runs.
|
|
1139
|
+
*/
|
|
1140
|
+
checkHealth() {
|
|
1141
|
+
if (this.state === "connected")
|
|
1142
|
+
for (const e of this.channels.values())
|
|
1143
|
+
e.checkHealth();
|
|
1144
|
+
}
|
|
1121
1145
|
/**
|
|
1122
1146
|
* Internal connect implementation.
|
|
1123
1147
|
* @param isReconnect - If true, don't set offline state on failure (let attemptReconnect handle it)
|
|
@@ -1126,16 +1150,16 @@ class wt {
|
|
|
1126
1150
|
this.setState("connecting");
|
|
1127
1151
|
let r = this.entrypoints;
|
|
1128
1152
|
if (this.config.webRtcEnabled) {
|
|
1129
|
-
|
|
1153
|
+
T.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1130
1154
|
for (const a of this.entrypoints)
|
|
1131
|
-
|
|
1132
|
-
const n =
|
|
1155
|
+
T.debug(` Entrypoint: type=${a.Type} fromServer=0x${a.OpcodeGroupsFromServer.toString(16)} toServer=0x${a.OpcodeGroupsToServer.toString(16)} uri=${a.Uri}`);
|
|
1156
|
+
const n = d.GROUP_AUDIO | d.GROUP_VIDEO;
|
|
1133
1157
|
r = this.entrypoints.filter((a) => {
|
|
1134
|
-
if (a.Type ===
|
|
1135
|
-
return
|
|
1158
|
+
if (a.Type === R.WebRTC)
|
|
1159
|
+
return T.debug(` Filtered out WebRTC entrypoint (type=${a.Type})`), !1;
|
|
1136
1160
|
const o = a.OpcodeGroupsFromServer | a.OpcodeGroupsToServer;
|
|
1137
|
-
return (o & ~n) === 0 ? (
|
|
1138
|
-
}),
|
|
1161
|
+
return (o & ~n) === 0 ? (T.debug(` Filtered out audio/video-only entrypoint (type=${a.Type}, groups=0x${o.toString(16)})`), !1) : !0;
|
|
1162
|
+
}), T.debug(`After filtering: ${r.length} entrypoints remain for WS/WT channels`);
|
|
1139
1163
|
}
|
|
1140
1164
|
const s = this.groupByType(r);
|
|
1141
1165
|
if (s.size === 0)
|
|
@@ -1145,6 +1169,10 @@ class wt {
|
|
|
1145
1169
|
const n = new Set(s.keys());
|
|
1146
1170
|
i = this.config.orderedEndpointTypes.filter((a) => n.has(a));
|
|
1147
1171
|
} else this.config.endpointSelector ? i = this.config.endpointSelector.getOrderedTypes(s) : i = Array.from(s.keys());
|
|
1172
|
+
if (this.demotedTypes.size > 0) {
|
|
1173
|
+
const n = i.filter((o) => !this.demotedTypes.has(o)), a = i.filter((o) => this.demotedTypes.has(o));
|
|
1174
|
+
i = [...n, ...a];
|
|
1175
|
+
}
|
|
1148
1176
|
for (const n of i) {
|
|
1149
1177
|
if (!this.shouldReconnect)
|
|
1150
1178
|
return;
|
|
@@ -1153,10 +1181,10 @@ class wt {
|
|
|
1153
1181
|
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(n), this.config.onRememberWorkingType?.(n), this.activeType = n, this.startStabilityTimer(), this.setState("connected");
|
|
1154
1182
|
return;
|
|
1155
1183
|
} catch (o) {
|
|
1156
|
-
|
|
1184
|
+
T.warn(`Failed to connect using ${R[n]}: ${o}`), this.disconnectAll();
|
|
1157
1185
|
}
|
|
1158
1186
|
}
|
|
1159
|
-
throw
|
|
1187
|
+
throw T.error("All endpoint types failed"), e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
1160
1188
|
}
|
|
1161
1189
|
/**
|
|
1162
1190
|
* Connect all channels for a given endpoint type in parallel.
|
|
@@ -1174,7 +1202,7 @@ class wt {
|
|
|
1174
1202
|
* Connect a single channel.
|
|
1175
1203
|
*/
|
|
1176
1204
|
async connectChannel(e) {
|
|
1177
|
-
const r = new
|
|
1205
|
+
const r = new Ut({
|
|
1178
1206
|
entrypoint: e,
|
|
1179
1207
|
sessionId: this.config.sessionId,
|
|
1180
1208
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1216,30 +1244,29 @@ class wt {
|
|
|
1216
1244
|
handleChannelClose(e, r, s, i) {
|
|
1217
1245
|
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline") && this.channels.has(e)) {
|
|
1218
1246
|
if (i) {
|
|
1219
|
-
|
|
1247
|
+
T.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1220
1248
|
return;
|
|
1221
1249
|
}
|
|
1222
|
-
this.state === "connected" && (
|
|
1250
|
+
this.state === "connected" && (!this.connectionStable && this.activeType !== null && (T.warn(`Connection unstable with ${R[this.activeType]}, demoting`), this.demotedTypes.add(this.activeType)), T.error("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1223
1251
|
}
|
|
1224
1252
|
}
|
|
1225
1253
|
/**
|
|
1226
|
-
* Attempt to reconnect with
|
|
1254
|
+
* Attempt to reconnect with fixed-interval retry.
|
|
1255
|
+
* First attempt is immediate, subsequent attempts wait reconnectBackoffMs.
|
|
1227
1256
|
*/
|
|
1228
1257
|
async attemptReconnect() {
|
|
1229
|
-
if (
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
return;
|
|
1234
|
-
}
|
|
1235
|
-
this.setState("reconnecting"), this.reconnectAttempts++;
|
|
1236
|
-
const e = this.config.reconnectBackoffMs * Math.pow(2, this.reconnectAttempts - 1);
|
|
1237
|
-
if (I.info(`Reconnecting in ${e}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await ct(e, this.abortController?.signal), !!this.shouldReconnect)
|
|
1238
|
-
try {
|
|
1239
|
-
await this.connectInternal(!0);
|
|
1240
|
-
} catch (r) {
|
|
1241
|
-
I.error("Reconnect failed:", r), await this.attemptReconnect();
|
|
1258
|
+
if (this.shouldReconnect) {
|
|
1259
|
+
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1260
|
+
T.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new ct(this.config.maxReconnectAttempts));
|
|
1261
|
+
return;
|
|
1242
1262
|
}
|
|
1263
|
+
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (T.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await It(this.config.reconnectBackoffMs, this.abortController?.signal)) : T.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), !!this.shouldReconnect)
|
|
1264
|
+
try {
|
|
1265
|
+
await this.connectInternal(!0);
|
|
1266
|
+
} catch (e) {
|
|
1267
|
+
T.error("Reconnect failed:", e), await this.attemptReconnect();
|
|
1268
|
+
}
|
|
1269
|
+
}
|
|
1243
1270
|
}
|
|
1244
1271
|
/**
|
|
1245
1272
|
* Disconnect all channels.
|
|
@@ -1255,8 +1282,8 @@ class wt {
|
|
|
1255
1282
|
* survives one keepalive timeout period without dying.
|
|
1256
1283
|
*/
|
|
1257
1284
|
startStabilityTimer() {
|
|
1258
|
-
this.clearStabilityTimer(), this.stabilityTimer = setTimeout(() => {
|
|
1259
|
-
this.stabilityTimer = null, this.reconnectAttempts = 0;
|
|
1285
|
+
this.clearStabilityTimer(), this.connectionStable = !1, this.stabilityTimer = setTimeout(() => {
|
|
1286
|
+
this.stabilityTimer = null, this.reconnectAttempts = 0, this.connectionStable = !0, this.demotedTypes.clear();
|
|
1260
1287
|
}, this.config.keepaliveTimeoutMs);
|
|
1261
1288
|
}
|
|
1262
1289
|
/**
|
|
@@ -1275,27 +1302,27 @@ class wt {
|
|
|
1275
1302
|
const st = F("ProtocolWorker"), w = (t, e) => {
|
|
1276
1303
|
self.postMessage(t, e ?? []);
|
|
1277
1304
|
};
|
|
1278
|
-
let
|
|
1279
|
-
const
|
|
1305
|
+
let A = null, H, u = null;
|
|
1306
|
+
const U = [], C = [], v = /* @__PURE__ */ new Map(), f = [], I = [], S = /* @__PURE__ */ new Map(), x = [];
|
|
1280
1307
|
function Y() {
|
|
1281
1308
|
try {
|
|
1282
|
-
|
|
1309
|
+
A?.disconnect();
|
|
1283
1310
|
} catch (t) {
|
|
1284
1311
|
st.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1285
1312
|
}
|
|
1286
|
-
|
|
1287
|
-
for (let t = 0; t <
|
|
1313
|
+
A = null;
|
|
1314
|
+
for (let t = 0; t < C.length; t++)
|
|
1288
1315
|
try {
|
|
1289
|
-
|
|
1316
|
+
C[t].port.close();
|
|
1290
1317
|
} catch {
|
|
1291
1318
|
}
|
|
1292
|
-
|
|
1293
|
-
for (let t = 0; t <
|
|
1319
|
+
U.length = 0, C.length = 0, v.clear();
|
|
1320
|
+
for (let t = 0; t < I.length; t++)
|
|
1294
1321
|
try {
|
|
1295
|
-
|
|
1322
|
+
I[t].port.close();
|
|
1296
1323
|
} catch {
|
|
1297
1324
|
}
|
|
1298
|
-
|
|
1325
|
+
f.length = 0, I.length = 0, S.clear();
|
|
1299
1326
|
}
|
|
1300
1327
|
function B(t) {
|
|
1301
1328
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
@@ -1303,8 +1330,8 @@ function B(t) {
|
|
|
1303
1330
|
}
|
|
1304
1331
|
function gt() {
|
|
1305
1332
|
let t = 0;
|
|
1306
|
-
for (let e = 0; e <
|
|
1307
|
-
t |=
|
|
1333
|
+
for (let e = 0; e < C.length; e++)
|
|
1334
|
+
t |= C[e].opcodeGroupsMask;
|
|
1308
1335
|
return t;
|
|
1309
1336
|
}
|
|
1310
1337
|
function Lt(t) {
|
|
@@ -1316,33 +1343,33 @@ function Lt(t) {
|
|
|
1316
1343
|
const r = gt();
|
|
1317
1344
|
return (e & r) !== 0;
|
|
1318
1345
|
}
|
|
1319
|
-
function
|
|
1346
|
+
function mt(t) {
|
|
1320
1347
|
x.length = 0;
|
|
1321
|
-
for (let e = 0; e <
|
|
1322
|
-
const r =
|
|
1348
|
+
for (let e = 0; e < C.length; e++) {
|
|
1349
|
+
const r = C[e];
|
|
1323
1350
|
(r.opcodeGroupsMask & t) !== 0 && x.push(r.port);
|
|
1324
1351
|
}
|
|
1325
1352
|
return x;
|
|
1326
1353
|
}
|
|
1327
|
-
function
|
|
1354
|
+
function dt(t, e) {
|
|
1328
1355
|
return (W(t) & e) !== 0;
|
|
1329
1356
|
}
|
|
1330
|
-
function
|
|
1331
|
-
if (!
|
|
1357
|
+
function Pt(t, e) {
|
|
1358
|
+
if (!A || !e || typeof e != "object")
|
|
1332
1359
|
return;
|
|
1333
1360
|
const r = e;
|
|
1334
1361
|
if (!(r.type !== "send" || !(r.message instanceof ArrayBuffer)))
|
|
1335
1362
|
try {
|
|
1336
1363
|
const s = new Uint8Array(r.message);
|
|
1337
|
-
if (!
|
|
1364
|
+
if (!dt(s, t))
|
|
1338
1365
|
return;
|
|
1339
|
-
|
|
1366
|
+
A.sendProtocolMessage(s), u && u.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1340
1367
|
} catch (s) {
|
|
1341
1368
|
B(s);
|
|
1342
1369
|
}
|
|
1343
1370
|
}
|
|
1344
1371
|
async function bt(t) {
|
|
1345
|
-
Y(),
|
|
1372
|
+
Y(), A = new wt({
|
|
1346
1373
|
sessionId: t.sessionId,
|
|
1347
1374
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1348
1375
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
@@ -1350,17 +1377,17 @@ async function bt(t) {
|
|
|
1350
1377
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1351
1378
|
webRtcEnabled: t.webRtcEnabled,
|
|
1352
1379
|
onStateChange: (e) => {
|
|
1353
|
-
w({ type: "state", state: e, activeType:
|
|
1380
|
+
w({ type: "state", state: e, activeType: A?.activeEndpointType ?? void 0 });
|
|
1354
1381
|
},
|
|
1355
1382
|
onRememberWorkingType: () => {
|
|
1356
|
-
w({ type: "state", state:
|
|
1383
|
+
w({ type: "state", state: A?.managerState ?? "idle", activeType: A?.activeEndpointType ?? void 0 });
|
|
1357
1384
|
},
|
|
1358
1385
|
onError: (e) => {
|
|
1359
1386
|
B(e);
|
|
1360
1387
|
},
|
|
1361
1388
|
onProtocolMessage: (e) => {
|
|
1362
|
-
u && (u.postMessage({ direction: "received", message: Array.from(e) }), $(e) ===
|
|
1363
|
-
const r = W(e), s = Lt(e), i =
|
|
1389
|
+
u && (u.postMessage({ direction: "received", message: Array.from(e) }), $(e) === d.ANALYTICS_LOGS && u.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1390
|
+
const r = W(e), s = Lt(e), i = mt(r);
|
|
1364
1391
|
if (!(!s && i.length === 0))
|
|
1365
1392
|
try {
|
|
1366
1393
|
const n = X(e), a = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, o = i.length > 0;
|
|
@@ -1378,8 +1405,8 @@ async function bt(t) {
|
|
|
1378
1405
|
const l = [];
|
|
1379
1406
|
for (let _ = 1; _ < i.length; _++)
|
|
1380
1407
|
l.push(e.slice().buffer);
|
|
1381
|
-
const h = s ? e.slice().buffer : null,
|
|
1382
|
-
i[0].postMessage({ type: "protocol", message:
|
|
1408
|
+
const h = s ? e.slice().buffer : null, N = e.buffer;
|
|
1409
|
+
i[0].postMessage({ type: "protocol", message: N, headers: n }, [N]);
|
|
1383
1410
|
for (let _ = 1; _ < i.length; _++)
|
|
1384
1411
|
i[_].postMessage({ type: "protocol", message: l[_ - 1], headers: n }, [l[_ - 1]]);
|
|
1385
1412
|
h && w({ type: "protocol", message: h, headers: n }, [h]);
|
|
@@ -1398,7 +1425,7 @@ async function bt(t) {
|
|
|
1398
1425
|
B(n);
|
|
1399
1426
|
}
|
|
1400
1427
|
}
|
|
1401
|
-
}), await
|
|
1428
|
+
}), await A.connect(t.entrypoints, { retry: t.retry });
|
|
1402
1429
|
}
|
|
1403
1430
|
self.addEventListener("message", (t) => {
|
|
1404
1431
|
const e = t.data;
|
|
@@ -1413,11 +1440,11 @@ self.addEventListener("message", (t) => {
|
|
|
1413
1440
|
return;
|
|
1414
1441
|
}
|
|
1415
1442
|
if (e.type === "send") {
|
|
1416
|
-
if (!
|
|
1443
|
+
if (!A)
|
|
1417
1444
|
return;
|
|
1418
1445
|
try {
|
|
1419
1446
|
const r = new Uint8Array(e.message);
|
|
1420
|
-
|
|
1447
|
+
A.sendProtocolMessage(r), u && u.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1421
1448
|
} catch (r) {
|
|
1422
1449
|
B(r);
|
|
1423
1450
|
}
|
|
@@ -1431,72 +1458,76 @@ self.addEventListener("message", (t) => {
|
|
|
1431
1458
|
e.enabled && !u ? u = new BroadcastChannel("ikon:devtools") : !e.enabled && u && (u.close(), u = null);
|
|
1432
1459
|
return;
|
|
1433
1460
|
}
|
|
1461
|
+
if (e.type === "checkHealth") {
|
|
1462
|
+
A?.checkHealth();
|
|
1463
|
+
return;
|
|
1464
|
+
}
|
|
1434
1465
|
if (e.type === "attachPort") {
|
|
1435
1466
|
try {
|
|
1436
1467
|
e.port.start?.();
|
|
1437
1468
|
} catch {
|
|
1438
1469
|
}
|
|
1439
|
-
const r =
|
|
1440
|
-
|
|
1470
|
+
const r = U.length;
|
|
1471
|
+
U.push(e.portId), C.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), v.set(e.portId, r);
|
|
1441
1472
|
return;
|
|
1442
1473
|
}
|
|
1443
1474
|
if (e.type === "detachPort") {
|
|
1444
1475
|
const r = v.get(e.portId);
|
|
1445
1476
|
if (r !== void 0) {
|
|
1446
|
-
const s =
|
|
1477
|
+
const s = C[r];
|
|
1447
1478
|
try {
|
|
1448
1479
|
s.port.close();
|
|
1449
1480
|
} catch {
|
|
1450
1481
|
}
|
|
1451
|
-
const i =
|
|
1482
|
+
const i = U.length - 1;
|
|
1452
1483
|
if (r !== i) {
|
|
1453
|
-
const n =
|
|
1454
|
-
|
|
1484
|
+
const n = U[i];
|
|
1485
|
+
U[r] = n, C[r] = C[i], v.set(n, r);
|
|
1455
1486
|
}
|
|
1456
|
-
|
|
1487
|
+
U.length--, C.length--, v.delete(e.portId);
|
|
1457
1488
|
}
|
|
1458
1489
|
return;
|
|
1459
1490
|
}
|
|
1460
1491
|
if (e.type === "attachSendPort") {
|
|
1461
|
-
const r =
|
|
1492
|
+
const r = S.get(e.portId);
|
|
1462
1493
|
if (r !== void 0) {
|
|
1463
|
-
const n =
|
|
1494
|
+
const n = I[r];
|
|
1464
1495
|
try {
|
|
1465
1496
|
n.port.close();
|
|
1466
1497
|
} catch {
|
|
1467
1498
|
}
|
|
1468
|
-
const a =
|
|
1499
|
+
const a = f.length - 1;
|
|
1469
1500
|
if (r !== a) {
|
|
1470
|
-
const o =
|
|
1471
|
-
|
|
1501
|
+
const o = f[a];
|
|
1502
|
+
f[r] = o, I[r] = I[a], S.set(o, r);
|
|
1472
1503
|
}
|
|
1473
|
-
|
|
1504
|
+
f.length--, I.length--, S.delete(e.portId);
|
|
1474
1505
|
}
|
|
1475
|
-
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, i =
|
|
1476
|
-
|
|
1506
|
+
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, i = f.length;
|
|
1507
|
+
f.push(e.portId), I.push(s), S.set(e.portId, i);
|
|
1477
1508
|
try {
|
|
1478
1509
|
s.port.start?.();
|
|
1479
1510
|
} catch {
|
|
1480
1511
|
}
|
|
1481
1512
|
s.port.addEventListener("message", (n) => {
|
|
1482
|
-
|
|
1513
|
+
Pt(s.opcodeGroupsMask, n.data);
|
|
1483
1514
|
});
|
|
1484
1515
|
return;
|
|
1485
1516
|
}
|
|
1486
1517
|
if (e.type === "detachSendPort") {
|
|
1487
|
-
const r =
|
|
1518
|
+
const r = S.get(e.portId);
|
|
1488
1519
|
if (r !== void 0) {
|
|
1489
|
-
const s =
|
|
1520
|
+
const s = I[r];
|
|
1490
1521
|
try {
|
|
1491
1522
|
s.port.close();
|
|
1492
1523
|
} catch {
|
|
1493
1524
|
}
|
|
1494
|
-
const i =
|
|
1525
|
+
const i = f.length - 1;
|
|
1495
1526
|
if (r !== i) {
|
|
1496
|
-
const n =
|
|
1497
|
-
|
|
1527
|
+
const n = f[i];
|
|
1528
|
+
f[r] = n, I[r] = I[i], S.set(n, r);
|
|
1498
1529
|
}
|
|
1499
|
-
|
|
1530
|
+
f.length--, I.length--, S.delete(e.portId);
|
|
1500
1531
|
}
|
|
1501
1532
|
return;
|
|
1502
1533
|
}
|