@ikonai/sdk 1.0.27 → 1.0.28
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-Cj8zX_U0.js → protocol-worker-Dx4ECerb.js} +205 -182
- package/channel/channel-manager.d.ts +10 -0
- package/client/endpoint-selector.d.ts +5 -0
- package/client/ikon-client-config.d.ts +12 -0
- package/client/ikon-client.d.ts +1 -0
- package/connection/urls.d.ts +0 -10
- package/index.d.ts +1 -0
- package/index.js +1569 -1492
- package/package.json +1 -1
- package/transport/web-socket-transport.d.ts +1 -0
- package/transport/web-transport-transport.d.ts +1 -0
- package/utils/debug-mode.d.ts +2 -2
- package/utils/query-params.d.ts +35 -0
|
@@ -10,17 +10,17 @@ 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),
|
|
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), f = 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
16
|
const T = [];
|
|
17
|
-
let
|
|
18
|
-
for (let
|
|
19
|
-
T.push(r.getUint32(
|
|
17
|
+
let O = 27;
|
|
18
|
+
for (let b = 0; b < l; b++)
|
|
19
|
+
T.push(r.getUint32(O, !0)), O += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: s,
|
|
22
|
-
opcode:
|
|
23
|
-
senderId:
|
|
22
|
+
opcode: i,
|
|
23
|
+
senderId: n,
|
|
24
24
|
trackId: a,
|
|
25
25
|
sequenceId: o,
|
|
26
26
|
targetIds: T,
|
|
@@ -29,20 +29,20 @@ function X(t) {
|
|
|
29
29
|
flags: _
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const l = [], f = 27 + l.length * 4, _ = f + e.length,
|
|
32
|
+
function it(t, e, r, s, i) {
|
|
33
|
+
const l = [], f = 27 + l.length * 4, _ = f + e.length, d = new Uint8Array(_), T = new DataView(d.buffer);
|
|
34
34
|
T.setUint32(0, _, !0), T.setUint32(4, t >>> 0, !0), T.setUint32(8, s >>> 0, !0), T.setUint32(12, 0, !0), T.setUint32(16, 0, !0), T.setUint32(20, l.length >>> 0, !0), T.setUint8(24, r & 255), T.setUint8(25, 8), T.setUint8(26, 0);
|
|
35
|
-
let
|
|
36
|
-
for (let
|
|
37
|
-
T.setUint32(
|
|
38
|
-
return
|
|
35
|
+
let O = 27;
|
|
36
|
+
for (let b = 0; b < l.length; b++)
|
|
37
|
+
T.setUint32(O, l[b] >>> 0, !0), O += 4;
|
|
38
|
+
return d.set(e, f), d;
|
|
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
|
|
41
|
+
const nt = 161, at = 162, p = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
43
|
class M {
|
|
44
44
|
constructor(e = 1) {
|
|
45
|
-
this.version = e, this.buffer.writeByte(
|
|
45
|
+
this.version = e, this.buffer.writeByte(nt), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
47
|
buffer = new P();
|
|
48
48
|
closed = !1;
|
|
@@ -82,21 +82,21 @@ class M {
|
|
|
82
82
|
this.writeVariableField(e, 13, r);
|
|
83
83
|
}
|
|
84
84
|
writeObjectField(e, r, s) {
|
|
85
|
-
const
|
|
86
|
-
s(
|
|
87
|
-
const
|
|
88
|
-
this.writeVariableField(e, 11,
|
|
85
|
+
const i = new M(r);
|
|
86
|
+
s(i);
|
|
87
|
+
const n = i.finish();
|
|
88
|
+
this.writeVariableField(e, 11, n);
|
|
89
89
|
}
|
|
90
90
|
writeArrayField(e, r, s) {
|
|
91
|
-
const
|
|
92
|
-
s(
|
|
93
|
-
const
|
|
94
|
-
this.writeVariableField(e, 9,
|
|
95
|
-
}
|
|
96
|
-
writeDictionaryField(e, r, s,
|
|
97
|
-
const
|
|
98
|
-
n
|
|
99
|
-
const a =
|
|
91
|
+
const i = new K(r);
|
|
92
|
+
s(i);
|
|
93
|
+
const n = i.finish();
|
|
94
|
+
this.writeVariableField(e, 9, n);
|
|
95
|
+
}
|
|
96
|
+
writeDictionaryField(e, r, s, i) {
|
|
97
|
+
const n = new Q(r, s);
|
|
98
|
+
i(n);
|
|
99
|
+
const a = n.finish();
|
|
100
100
|
this.writeVariableField(e, 10, a);
|
|
101
101
|
}
|
|
102
102
|
finish() {
|
|
@@ -191,8 +191,8 @@ class K {
|
|
|
191
191
|
), this.count++;
|
|
192
192
|
const s = new M(e);
|
|
193
193
|
r(s);
|
|
194
|
-
const
|
|
195
|
-
this.payload.writeVarUInt(
|
|
194
|
+
const i = s.finish();
|
|
195
|
+
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i);
|
|
196
196
|
}
|
|
197
197
|
writeArray(e, r) {
|
|
198
198
|
this.ensureElementType(
|
|
@@ -201,18 +201,18 @@ class K {
|
|
|
201
201
|
), this.count++;
|
|
202
202
|
const s = new K(e);
|
|
203
203
|
r(s);
|
|
204
|
-
const
|
|
205
|
-
this.payload.writeBytes(
|
|
204
|
+
const i = s.finish();
|
|
205
|
+
this.payload.writeBytes(i);
|
|
206
206
|
}
|
|
207
207
|
writeDictionary(e, r, s) {
|
|
208
208
|
this.ensureElementType(
|
|
209
209
|
10
|
|
210
210
|
/* Dict */
|
|
211
211
|
), this.count++;
|
|
212
|
-
const
|
|
213
|
-
s(
|
|
214
|
-
const
|
|
215
|
-
this.payload.writeBytes(
|
|
212
|
+
const i = new Q(e, r);
|
|
213
|
+
s(i);
|
|
214
|
+
const n = i.finish();
|
|
215
|
+
this.payload.writeBytes(n);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
218
|
const e = new P();
|
|
@@ -245,8 +245,8 @@ class Q {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
class ot {
|
|
248
|
-
constructor(e, r, s,
|
|
249
|
-
this.keyType = e, this.valueType = r, this.payload = s, this.onComplete =
|
|
248
|
+
constructor(e, r, s, i) {
|
|
249
|
+
this.keyType = e, this.valueType = r, this.payload = s, this.onComplete = i;
|
|
250
250
|
}
|
|
251
251
|
keyWritten = !1;
|
|
252
252
|
valueWritten = !1;
|
|
@@ -396,8 +396,8 @@ class ot {
|
|
|
396
396
|
);
|
|
397
397
|
const s = new M(e);
|
|
398
398
|
r(s);
|
|
399
|
-
const
|
|
400
|
-
this.payload.writeVarUInt(
|
|
399
|
+
const i = s.finish();
|
|
400
|
+
this.payload.writeVarUInt(i.length), this.payload.writeBytes(i), this.valueWritten = !0;
|
|
401
401
|
}
|
|
402
402
|
writeValueArray(e, r) {
|
|
403
403
|
this.ensureValueType(
|
|
@@ -406,18 +406,18 @@ class ot {
|
|
|
406
406
|
);
|
|
407
407
|
const s = new K(e);
|
|
408
408
|
r(s);
|
|
409
|
-
const
|
|
410
|
-
this.payload.writeBytes(
|
|
409
|
+
const i = s.finish();
|
|
410
|
+
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
411
411
|
}
|
|
412
412
|
writeValueDictionary(e, r, s) {
|
|
413
413
|
this.ensureValueType(
|
|
414
414
|
10
|
|
415
415
|
/* Dict */
|
|
416
416
|
);
|
|
417
|
-
const
|
|
418
|
-
s(
|
|
419
|
-
const
|
|
420
|
-
this.payload.writeBytes(
|
|
417
|
+
const i = new Q(e, r);
|
|
418
|
+
s(i);
|
|
419
|
+
const n = i.finish();
|
|
420
|
+
this.payload.writeBytes(n), this.valueWritten = !0;
|
|
421
421
|
}
|
|
422
422
|
complete() {
|
|
423
423
|
if (!this.completed) {
|
|
@@ -445,8 +445,8 @@ class E {
|
|
|
445
445
|
const r = e.replace(/-/g, "");
|
|
446
446
|
if (r.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const s = new Uint8Array(16),
|
|
449
|
-
E.writeUInt32LE(s, 0,
|
|
448
|
+
const s = new Uint8Array(16), i = E.parseHexSlice(r, 0, 8), n = E.parseHexSlice(r, 8, 4), a = E.parseHexSlice(r, 12, 4);
|
|
449
|
+
E.writeUInt32LE(s, 0, i), E.writeUInt16LE(s, 4, n), E.writeUInt16LE(s, 6, a);
|
|
450
450
|
for (let o = 0; o < 8; o++)
|
|
451
451
|
s[8 + o] = E.parseHexSlice(r, 16 + o * 2, 2);
|
|
452
452
|
return new E(s);
|
|
@@ -482,18 +482,18 @@ class E {
|
|
|
482
482
|
return this.bytes.slice();
|
|
483
483
|
}
|
|
484
484
|
static parseHexSlice(e, r, s) {
|
|
485
|
-
const
|
|
486
|
-
if (Number.isNaN(
|
|
485
|
+
const i = e.substr(r, s), n = Number.parseInt(i, 16);
|
|
486
|
+
if (Number.isNaN(n))
|
|
487
487
|
throw new Error("Guid string contains invalid characters");
|
|
488
|
-
return
|
|
488
|
+
return n >>> 0;
|
|
489
489
|
}
|
|
490
490
|
static writeUInt32LE(e, r, s) {
|
|
491
|
-
const
|
|
492
|
-
e[r] =
|
|
491
|
+
const i = s >>> 0;
|
|
492
|
+
e[r] = i & 255, e[r + 1] = i >>> 8 & 255, e[r + 2] = i >>> 16 & 255, e[r + 3] = i >>> 24 & 255;
|
|
493
493
|
}
|
|
494
494
|
static writeUInt16LE(e, r, s) {
|
|
495
|
-
const
|
|
496
|
-
e[r] =
|
|
495
|
+
const i = s & 65535;
|
|
496
|
+
e[r] = i & 255, e[r + 1] = i >>> 8 & 255;
|
|
497
497
|
}
|
|
498
498
|
static readUInt32LE(e, r) {
|
|
499
499
|
return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
|
|
@@ -520,8 +520,8 @@ class P {
|
|
|
520
520
|
let s = this.buffer.length;
|
|
521
521
|
for (; s < r; )
|
|
522
522
|
s *= 2;
|
|
523
|
-
const
|
|
524
|
-
|
|
523
|
+
const i = new Uint8Array(s);
|
|
524
|
+
i.set(this.buffer.subarray(0, this.length)), this.buffer = i, this.dataView = new DataView(this.buffer.buffer);
|
|
525
525
|
}
|
|
526
526
|
writeByte(e) {
|
|
527
527
|
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
@@ -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 y = /* @__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))(y || {}), 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 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 || {});
|
|
579
579
|
const J = 1, _t = 131074;
|
|
580
580
|
function Z(t) {
|
|
581
581
|
return {};
|
|
@@ -585,7 +585,7 @@ function Tt(t) {
|
|
|
585
585
|
}
|
|
586
586
|
function tt(t, e, r) {
|
|
587
587
|
const s = Tt();
|
|
588
|
-
return
|
|
588
|
+
return it(_t, s, J, e);
|
|
589
589
|
}
|
|
590
590
|
class et extends Error {
|
|
591
591
|
constructor(e, r) {
|
|
@@ -609,34 +609,34 @@ class It extends et {
|
|
|
609
609
|
}
|
|
610
610
|
function ct(t, e) {
|
|
611
611
|
return new Promise((r, s) => {
|
|
612
|
-
const
|
|
613
|
-
clearTimeout(
|
|
614
|
-
},
|
|
615
|
-
e?.removeEventListener("abort",
|
|
612
|
+
const i = () => {
|
|
613
|
+
clearTimeout(n), s(new Error("Aborted"));
|
|
614
|
+
}, n = setTimeout(() => {
|
|
615
|
+
e?.removeEventListener("abort", i), r();
|
|
616
616
|
}, t);
|
|
617
617
|
if (e?.aborted) {
|
|
618
|
-
clearTimeout(
|
|
618
|
+
clearTimeout(n), s(new Error("Aborted"));
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
|
-
e?.addEventListener("abort",
|
|
621
|
+
e?.addEventListener("abort", i, { once: !0 });
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
624
|
let ut = 1;
|
|
625
|
-
const At = /* @__PURE__ */ new Map(),
|
|
625
|
+
const At = /* @__PURE__ */ new Map(), Ct = {
|
|
626
626
|
0: "DEBUG",
|
|
627
627
|
1: "INFO",
|
|
628
628
|
2: "WARN",
|
|
629
629
|
3: "ERROR",
|
|
630
630
|
4: "NONE"
|
|
631
631
|
};
|
|
632
|
-
function
|
|
632
|
+
function Nt(t, e) {
|
|
633
633
|
return `[${t}] ${e}`;
|
|
634
634
|
}
|
|
635
635
|
function G(t, e, r, s) {
|
|
636
|
-
const
|
|
637
|
-
timestamp:
|
|
636
|
+
const i = (/* @__PURE__ */ new Date()).toISOString(), n = Ct[t], a = {
|
|
637
|
+
timestamp: i,
|
|
638
638
|
level: t,
|
|
639
|
-
levelName:
|
|
639
|
+
levelName: n,
|
|
640
640
|
component: e,
|
|
641
641
|
message: r,
|
|
642
642
|
args: s
|
|
@@ -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 = Nt(e, r);
|
|
654
654
|
switch (t) {
|
|
655
655
|
case 0:
|
|
656
656
|
console.debug(o, ...s);
|
|
@@ -687,6 +687,7 @@ const V = F("WebSocketTransport"), ft = 1e4;
|
|
|
687
687
|
class Rt {
|
|
688
688
|
ws = null;
|
|
689
689
|
keepaliveTimeout = null;
|
|
690
|
+
isClosed = !1;
|
|
690
691
|
// Pre-allocated keepalive response message to avoid allocation per keepalive
|
|
691
692
|
keepaliveResponseMessage = null;
|
|
692
693
|
keepaliveTimeoutMs;
|
|
@@ -699,30 +700,32 @@ class Rt {
|
|
|
699
700
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
700
701
|
}
|
|
701
702
|
async connect(e, r) {
|
|
702
|
-
return new Promise((s,
|
|
703
|
+
return this.isClosed = !1, new Promise((s, i) => {
|
|
703
704
|
try {
|
|
704
705
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
705
706
|
} catch (h) {
|
|
706
|
-
|
|
707
|
+
i(new L(`Failed to create WebSocket: ${h}`, h instanceof Error ? h : void 0));
|
|
707
708
|
return;
|
|
708
709
|
}
|
|
709
|
-
let
|
|
710
|
+
let n = !1, a = !1;
|
|
710
711
|
const o = () => {
|
|
711
712
|
clearTimeout(l), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
712
713
|
}, l = setTimeout(() => {
|
|
713
|
-
a || (a = !0, o(), this.ws?.close(),
|
|
714
|
+
a || (a = !0, o(), this.ws?.close(), i(new L("WebSocket connection timeout")));
|
|
714
715
|
}, ft);
|
|
715
716
|
this.ws.onopen = () => {
|
|
716
|
-
|
|
717
|
+
n = !0, clearTimeout(l), this.ws.send(r), this.resetKeepaliveTimeout(), a || (a = !0, s());
|
|
717
718
|
}, this.ws.onerror = () => {
|
|
718
|
-
clearTimeout(l), V.error("WebSocket error"), a || (a = !0, o(),
|
|
719
|
+
clearTimeout(l), V.error("WebSocket error"), a || (a = !0, o(), i(new L("WebSocket connection failed")));
|
|
719
720
|
}, this.ws.onclose = (h) => {
|
|
720
|
-
if (this.clearKeepaliveTimeout(), !
|
|
721
|
-
a = !0, o(),
|
|
721
|
+
if (this.clearKeepaliveTimeout(), !n && !a) {
|
|
722
|
+
a = !0, o(), i(new L("WebSocket connection closed before opening"));
|
|
722
723
|
return;
|
|
723
724
|
}
|
|
724
|
-
|
|
725
|
-
|
|
725
|
+
if (this.isClosed)
|
|
726
|
+
return;
|
|
727
|
+
const f = h.wasClean && (h.code === 1e3 || h.code === 1001), _ = h.code === 1e3 || h.code === 1001, d = h.reason || `code=${h.code}`;
|
|
728
|
+
this.callbacks.onClose(d, f, _);
|
|
726
729
|
}, this.ws.onmessage = (h) => {
|
|
727
730
|
this.handleProtocolMessage(new Uint8Array(h.data));
|
|
728
731
|
};
|
|
@@ -732,7 +735,7 @@ class Rt {
|
|
|
732
735
|
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : V.warn("Cannot send: WebSocket not connected");
|
|
733
736
|
}
|
|
734
737
|
close() {
|
|
735
|
-
this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
738
|
+
this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
736
739
|
}
|
|
737
740
|
/**
|
|
738
741
|
* Get or create a cached keepalive response message.
|
|
@@ -760,19 +763,20 @@ class Rt {
|
|
|
760
763
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
761
764
|
}
|
|
762
765
|
}
|
|
763
|
-
const R = F("WebTransportTransport"), q = 4,
|
|
766
|
+
const R = F("WebTransportTransport"), q = 4, yt = 65536;
|
|
764
767
|
function rt() {
|
|
765
768
|
return typeof WebTransport < "u";
|
|
766
769
|
}
|
|
767
|
-
class
|
|
770
|
+
class Ut {
|
|
768
771
|
transport = null;
|
|
769
772
|
stream = null;
|
|
770
773
|
reader = null;
|
|
771
774
|
writer = null;
|
|
772
775
|
keepaliveTimeout = null;
|
|
773
776
|
readLoopActive = !1;
|
|
777
|
+
isClosed = !1;
|
|
774
778
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
775
|
-
receiveBuffer = new Uint8Array(
|
|
779
|
+
receiveBuffer = new Uint8Array(yt);
|
|
776
780
|
receiveBufferOffset = 0;
|
|
777
781
|
receiveBufferLength = 0;
|
|
778
782
|
// Cached DataView to avoid allocation per message
|
|
@@ -792,6 +796,7 @@ class yt {
|
|
|
792
796
|
async connect(e, r) {
|
|
793
797
|
if (!rt())
|
|
794
798
|
throw new L("WebTransport is not supported in this browser");
|
|
799
|
+
this.isClosed = !1;
|
|
795
800
|
try {
|
|
796
801
|
this.transport = new WebTransport(e), await this.transport.ready, R.debug(`Connected to WebTransport entrypoint: ${e}`), this.transport.closed.then(() => {
|
|
797
802
|
this.handleClose("Connection closed", !0);
|
|
@@ -812,7 +817,7 @@ class yt {
|
|
|
812
817
|
});
|
|
813
818
|
}
|
|
814
819
|
close() {
|
|
815
|
-
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup();
|
|
820
|
+
this.isClosed = !0, this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup();
|
|
816
821
|
}
|
|
817
822
|
/**
|
|
818
823
|
* Start the read loop to receive messages.
|
|
@@ -827,6 +832,7 @@ class yt {
|
|
|
827
832
|
break;
|
|
828
833
|
e && (this.appendToBuffer(e), this.processBufferedMessages());
|
|
829
834
|
}
|
|
835
|
+
this.readLoopActive && this.handleClose("Stream ended", !1);
|
|
830
836
|
} catch (e) {
|
|
831
837
|
this.readLoopActive && (R.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : new Error(String(e))));
|
|
832
838
|
}
|
|
@@ -840,8 +846,8 @@ class yt {
|
|
|
840
846
|
const r = this.receiveBufferLength + e.length, s = this.receiveBufferOffset + this.receiveBufferLength;
|
|
841
847
|
if (s + e.length > this.receiveBuffer.length)
|
|
842
848
|
if (r > this.receiveBuffer.length) {
|
|
843
|
-
const
|
|
844
|
-
|
|
849
|
+
const i = Math.max(r, this.receiveBuffer.length * 2), n = new Uint8Array(i);
|
|
850
|
+
n.set(this.receiveBuffer.subarray(this.receiveBufferOffset, s)), this.receiveBuffer = n, this.receiveBufferOffset = 0, this.receiveDataViewBuffer = null;
|
|
845
851
|
} else
|
|
846
852
|
this.receiveBuffer.copyWithin(0, this.receiveBufferOffset, s), this.receiveBufferOffset = 0;
|
|
847
853
|
this.receiveBuffer.set(e, this.receiveBufferOffset + this.receiveBufferLength), this.receiveBufferLength += e.length;
|
|
@@ -897,7 +903,7 @@ class yt {
|
|
|
897
903
|
* Handle connection close.
|
|
898
904
|
*/
|
|
899
905
|
handleClose(e, r) {
|
|
900
|
-
this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e, r, !1);
|
|
906
|
+
this.isClosed || (this.isClosed = !0, this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e, r, !1));
|
|
901
907
|
}
|
|
902
908
|
/**
|
|
903
909
|
* Reset the keepalive timeout.
|
|
@@ -927,7 +933,7 @@ class yt {
|
|
|
927
933
|
}
|
|
928
934
|
}
|
|
929
935
|
const D = F("Channel");
|
|
930
|
-
class
|
|
936
|
+
class St {
|
|
931
937
|
state = "disconnected";
|
|
932
938
|
transport = null;
|
|
933
939
|
config;
|
|
@@ -997,23 +1003,23 @@ class wt {
|
|
|
997
1003
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
998
1004
|
callbacks: {
|
|
999
1005
|
onProtocolMessage: (s) => this.handleProtocolMessage(s),
|
|
1000
|
-
onClose: (s,
|
|
1006
|
+
onClose: (s, i, n) => this.handleClose(s, i, n),
|
|
1001
1007
|
onError: (s) => this.handleError(s)
|
|
1002
1008
|
}
|
|
1003
1009
|
};
|
|
1004
1010
|
switch (e.Type) {
|
|
1005
|
-
case
|
|
1006
|
-
case
|
|
1011
|
+
case U.WebSocket:
|
|
1012
|
+
case U.WebSocketProxy:
|
|
1007
1013
|
this.transport = new Rt(r);
|
|
1008
1014
|
break;
|
|
1009
|
-
case
|
|
1010
|
-
case
|
|
1015
|
+
case U.WebTransport:
|
|
1016
|
+
case U.WebTransportProxy:
|
|
1011
1017
|
if (!rt())
|
|
1012
1018
|
throw new Error("WebTransport is not supported in this browser");
|
|
1013
|
-
this.transport = new
|
|
1019
|
+
this.transport = new Ut(r);
|
|
1014
1020
|
break;
|
|
1015
1021
|
default:
|
|
1016
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1022
|
+
throw new Error(`Unsupported entrypoint type: ${U[e.Type]}`);
|
|
1017
1023
|
}
|
|
1018
1024
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
1019
1025
|
}
|
|
@@ -1052,12 +1058,13 @@ class wt {
|
|
|
1052
1058
|
}
|
|
1053
1059
|
}
|
|
1054
1060
|
const I = F("ChannelManager");
|
|
1055
|
-
class
|
|
1061
|
+
class wt {
|
|
1056
1062
|
channels = /* @__PURE__ */ new Map();
|
|
1057
1063
|
// keyed by opcode group
|
|
1058
1064
|
activeType = null;
|
|
1059
1065
|
state = "idle";
|
|
1060
1066
|
reconnectAttempts = 0;
|
|
1067
|
+
stabilityTimer = null;
|
|
1061
1068
|
shouldReconnect = !0;
|
|
1062
1069
|
entrypoints = [];
|
|
1063
1070
|
abortController = null;
|
|
@@ -1089,7 +1096,7 @@ class St {
|
|
|
1089
1096
|
* Disconnect all channels.
|
|
1090
1097
|
*/
|
|
1091
1098
|
disconnect() {
|
|
1092
|
-
this.shouldReconnect = !1, this.abortController?.abort(), this.abortController = null, this.disconnectAll(), this.setState("idle");
|
|
1099
|
+
this.shouldReconnect = !1, this.clearStabilityTimer(), this.abortController?.abort(), this.abortController = null, this.disconnectAll(), this.setState("idle");
|
|
1093
1100
|
}
|
|
1094
1101
|
/**
|
|
1095
1102
|
* Send a protocol message to the appropriate channel.
|
|
@@ -1097,9 +1104,9 @@ class St {
|
|
|
1097
1104
|
*/
|
|
1098
1105
|
sendProtocolMessage(e) {
|
|
1099
1106
|
const r = W(e);
|
|
1100
|
-
for (const [s,
|
|
1107
|
+
for (const [s, i] of this.channels)
|
|
1101
1108
|
if (s & r) {
|
|
1102
|
-
|
|
1109
|
+
i.send(e);
|
|
1103
1110
|
return;
|
|
1104
1111
|
}
|
|
1105
1112
|
I.warn("No channel found for message");
|
|
@@ -1122,31 +1129,31 @@ class St {
|
|
|
1122
1129
|
I.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1123
1130
|
for (const a of this.entrypoints)
|
|
1124
1131
|
I.debug(` Entrypoint: type=${a.Type} fromServer=0x${a.OpcodeGroupsFromServer.toString(16)} toServer=0x${a.OpcodeGroupsToServer.toString(16)} uri=${a.Uri}`);
|
|
1125
|
-
const
|
|
1132
|
+
const n = m.GROUP_AUDIO | m.GROUP_VIDEO;
|
|
1126
1133
|
r = this.entrypoints.filter((a) => {
|
|
1127
|
-
if (a.Type ===
|
|
1134
|
+
if (a.Type === U.WebRTC)
|
|
1128
1135
|
return I.debug(` Filtered out WebRTC entrypoint (type=${a.Type})`), !1;
|
|
1129
1136
|
const o = a.OpcodeGroupsFromServer | a.OpcodeGroupsToServer;
|
|
1130
|
-
return (o & ~
|
|
1137
|
+
return (o & ~n) === 0 ? (I.debug(` Filtered out audio/video-only entrypoint (type=${a.Type}, groups=0x${o.toString(16)})`), !1) : !0;
|
|
1131
1138
|
}), I.debug(`After filtering: ${r.length} entrypoints remain for WS/WT channels`);
|
|
1132
1139
|
}
|
|
1133
1140
|
const s = this.groupByType(r);
|
|
1134
1141
|
if (s.size === 0)
|
|
1135
1142
|
throw this.setState("offline"), new Error("No entrypoints available");
|
|
1136
|
-
let
|
|
1143
|
+
let i;
|
|
1137
1144
|
if (this.config.orderedEndpointTypes && this.config.orderedEndpointTypes.length > 0) {
|
|
1138
|
-
const
|
|
1139
|
-
|
|
1140
|
-
} else this.config.endpointSelector ?
|
|
1141
|
-
for (const
|
|
1145
|
+
const n = new Set(s.keys());
|
|
1146
|
+
i = this.config.orderedEndpointTypes.filter((a) => n.has(a));
|
|
1147
|
+
} else this.config.endpointSelector ? i = this.config.endpointSelector.getOrderedTypes(s) : i = Array.from(s.keys());
|
|
1148
|
+
for (const n of i) {
|
|
1142
1149
|
if (!this.shouldReconnect)
|
|
1143
1150
|
return;
|
|
1144
|
-
const a = s.get(
|
|
1151
|
+
const a = s.get(n);
|
|
1145
1152
|
try {
|
|
1146
|
-
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(
|
|
1153
|
+
await this.connectAllChannels(a), this.config.endpointSelector?.rememberWorkingType(n), this.config.onRememberWorkingType?.(n), this.activeType = n, this.startStabilityTimer(), this.setState("connected");
|
|
1147
1154
|
return;
|
|
1148
1155
|
} catch (o) {
|
|
1149
|
-
I.warn(`Failed to connect using ${
|
|
1156
|
+
I.warn(`Failed to connect using ${U[n]}: ${o}`), this.disconnectAll();
|
|
1150
1157
|
}
|
|
1151
1158
|
}
|
|
1152
1159
|
throw I.error("All endpoint types failed"), e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
@@ -1157,17 +1164,17 @@ class St {
|
|
|
1157
1164
|
async connectAllChannels(e) {
|
|
1158
1165
|
if (e.length === 0)
|
|
1159
1166
|
throw new Error("No entrypoints to connect");
|
|
1160
|
-
const s = (await Promise.allSettled(e.map((
|
|
1167
|
+
const s = (await Promise.allSettled(e.map((i) => this.connectChannel(i)))).filter((i) => i.status === "rejected");
|
|
1161
1168
|
if (s.length > 0) {
|
|
1162
|
-
const
|
|
1163
|
-
throw new Error(`${s.length} channel(s) failed: ${
|
|
1169
|
+
const i = s.map((n) => n.reason);
|
|
1170
|
+
throw new Error(`${s.length} channel(s) failed: ${i.join(", ")}`);
|
|
1164
1171
|
}
|
|
1165
1172
|
}
|
|
1166
1173
|
/**
|
|
1167
1174
|
* Connect a single channel.
|
|
1168
1175
|
*/
|
|
1169
1176
|
async connectChannel(e) {
|
|
1170
|
-
const r = new
|
|
1177
|
+
const r = new St({
|
|
1171
1178
|
entrypoint: e,
|
|
1172
1179
|
sessionId: this.config.sessionId,
|
|
1173
1180
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1177,8 +1184,8 @@ class St {
|
|
|
1177
1184
|
onStateChange: (s) => {
|
|
1178
1185
|
this.handleChannelStateChange(e.OpcodeGroupsFromServer, s);
|
|
1179
1186
|
},
|
|
1180
|
-
onClose: (s,
|
|
1181
|
-
this.handleChannelClose(e.OpcodeGroupsFromServer, s,
|
|
1187
|
+
onClose: (s, i, n) => {
|
|
1188
|
+
this.handleChannelClose(e.OpcodeGroupsFromServer, s, i, n);
|
|
1182
1189
|
},
|
|
1183
1190
|
onError: (s) => {
|
|
1184
1191
|
this.config.onError?.(s);
|
|
@@ -1192,8 +1199,8 @@ class St {
|
|
|
1192
1199
|
groupByType(e) {
|
|
1193
1200
|
const r = /* @__PURE__ */ new Map();
|
|
1194
1201
|
for (const s of e) {
|
|
1195
|
-
const
|
|
1196
|
-
|
|
1202
|
+
const i = r.get(s.Type) ?? [];
|
|
1203
|
+
i.push(s), r.set(s.Type, i);
|
|
1197
1204
|
}
|
|
1198
1205
|
return r;
|
|
1199
1206
|
}
|
|
@@ -1206,9 +1213,9 @@ class St {
|
|
|
1206
1213
|
/**
|
|
1207
1214
|
* Handle channel close.
|
|
1208
1215
|
*/
|
|
1209
|
-
handleChannelClose(e, r, s,
|
|
1210
|
-
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline")) {
|
|
1211
|
-
if (
|
|
1216
|
+
handleChannelClose(e, r, s, i) {
|
|
1217
|
+
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline") && this.channels.has(e)) {
|
|
1218
|
+
if (i) {
|
|
1212
1219
|
I.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1213
1220
|
return;
|
|
1214
1221
|
}
|
|
@@ -1238,10 +1245,26 @@ class St {
|
|
|
1238
1245
|
* Disconnect all channels.
|
|
1239
1246
|
*/
|
|
1240
1247
|
disconnectAll() {
|
|
1248
|
+
this.clearStabilityTimer();
|
|
1241
1249
|
for (const e of this.channels.values())
|
|
1242
1250
|
e.disconnect();
|
|
1243
1251
|
this.channels.clear(), this.activeType = null;
|
|
1244
1252
|
}
|
|
1253
|
+
/**
|
|
1254
|
+
* Start stability timer that resets reconnect attempts after the connection
|
|
1255
|
+
* survives one keepalive timeout period without dying.
|
|
1256
|
+
*/
|
|
1257
|
+
startStabilityTimer() {
|
|
1258
|
+
this.clearStabilityTimer(), this.stabilityTimer = setTimeout(() => {
|
|
1259
|
+
this.stabilityTimer = null, this.reconnectAttempts = 0;
|
|
1260
|
+
}, this.config.keepaliveTimeoutMs);
|
|
1261
|
+
}
|
|
1262
|
+
/**
|
|
1263
|
+
* Clear the stability timer.
|
|
1264
|
+
*/
|
|
1265
|
+
clearStabilityTimer() {
|
|
1266
|
+
this.stabilityTimer && (clearTimeout(this.stabilityTimer), this.stabilityTimer = null);
|
|
1267
|
+
}
|
|
1245
1268
|
/**
|
|
1246
1269
|
* Update and notify state change.
|
|
1247
1270
|
*/
|
|
@@ -1249,34 +1272,34 @@ class St {
|
|
|
1249
1272
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1250
1273
|
}
|
|
1251
1274
|
}
|
|
1252
|
-
const st = F("ProtocolWorker"),
|
|
1275
|
+
const st = F("ProtocolWorker"), w = (t, e) => {
|
|
1253
1276
|
self.postMessage(t, e ?? []);
|
|
1254
1277
|
};
|
|
1255
|
-
let
|
|
1256
|
-
const
|
|
1278
|
+
let N = null, H, u = null;
|
|
1279
|
+
const S = [], A = [], v = /* @__PURE__ */ new Map(), C = [], c = [], y = /* @__PURE__ */ new Map(), x = [];
|
|
1257
1280
|
function Y() {
|
|
1258
1281
|
try {
|
|
1259
|
-
|
|
1282
|
+
N?.disconnect();
|
|
1260
1283
|
} catch (t) {
|
|
1261
1284
|
st.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1262
1285
|
}
|
|
1263
|
-
|
|
1286
|
+
N = null;
|
|
1264
1287
|
for (let t = 0; t < A.length; t++)
|
|
1265
1288
|
try {
|
|
1266
1289
|
A[t].port.close();
|
|
1267
1290
|
} catch {
|
|
1268
1291
|
}
|
|
1269
|
-
|
|
1292
|
+
S.length = 0, A.length = 0, v.clear();
|
|
1270
1293
|
for (let t = 0; t < c.length; t++)
|
|
1271
1294
|
try {
|
|
1272
1295
|
c[t].port.close();
|
|
1273
1296
|
} catch {
|
|
1274
1297
|
}
|
|
1275
|
-
|
|
1298
|
+
C.length = 0, c.length = 0, y.clear();
|
|
1276
1299
|
}
|
|
1277
1300
|
function B(t) {
|
|
1278
1301
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1279
|
-
|
|
1302
|
+
w({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1280
1303
|
}
|
|
1281
1304
|
function gt() {
|
|
1282
1305
|
let t = 0;
|
|
@@ -1304,8 +1327,8 @@ function Pt(t) {
|
|
|
1304
1327
|
function mt(t, e) {
|
|
1305
1328
|
return (W(t) & e) !== 0;
|
|
1306
1329
|
}
|
|
1307
|
-
function
|
|
1308
|
-
if (!
|
|
1330
|
+
function dt(t, e) {
|
|
1331
|
+
if (!N || !e || typeof e != "object")
|
|
1309
1332
|
return;
|
|
1310
1333
|
const r = e;
|
|
1311
1334
|
if (!(r.type !== "send" || !(r.message instanceof ArrayBuffer)))
|
|
@@ -1313,13 +1336,13 @@ function Ot(t, e) {
|
|
|
1313
1336
|
const s = new Uint8Array(r.message);
|
|
1314
1337
|
if (!mt(s, t))
|
|
1315
1338
|
return;
|
|
1316
|
-
|
|
1339
|
+
N.sendProtocolMessage(s), u && u.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1317
1340
|
} catch (s) {
|
|
1318
1341
|
B(s);
|
|
1319
1342
|
}
|
|
1320
1343
|
}
|
|
1321
|
-
async function
|
|
1322
|
-
Y(),
|
|
1344
|
+
async function bt(t) {
|
|
1345
|
+
Y(), N = new wt({
|
|
1323
1346
|
sessionId: t.sessionId,
|
|
1324
1347
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1325
1348
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
@@ -1327,74 +1350,74 @@ async function dt(t) {
|
|
|
1327
1350
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1328
1351
|
webRtcEnabled: t.webRtcEnabled,
|
|
1329
1352
|
onStateChange: (e) => {
|
|
1330
|
-
|
|
1353
|
+
w({ type: "state", state: e, activeType: N?.activeEndpointType ?? void 0 });
|
|
1331
1354
|
},
|
|
1332
1355
|
onRememberWorkingType: () => {
|
|
1333
|
-
|
|
1356
|
+
w({ type: "state", state: N?.managerState ?? "idle", activeType: N?.activeEndpointType ?? void 0 });
|
|
1334
1357
|
},
|
|
1335
1358
|
onError: (e) => {
|
|
1336
1359
|
B(e);
|
|
1337
1360
|
},
|
|
1338
1361
|
onProtocolMessage: (e) => {
|
|
1339
1362
|
u && (u.postMessage({ direction: "received", message: Array.from(e) }), $(e) === m.ANALYTICS_LOGS && u.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1340
|
-
const r = W(e), s = Lt(e),
|
|
1341
|
-
if (!(!s &&
|
|
1363
|
+
const r = W(e), s = Lt(e), i = Pt(r);
|
|
1364
|
+
if (!(!s && i.length === 0))
|
|
1342
1365
|
try {
|
|
1343
|
-
const
|
|
1344
|
-
if (o && !s &&
|
|
1366
|
+
const n = X(e), a = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, o = i.length > 0;
|
|
1367
|
+
if (o && !s && i.length === 1 && a) {
|
|
1345
1368
|
const l = e.buffer;
|
|
1346
|
-
|
|
1369
|
+
i[0].postMessage({ type: "protocol", message: l, headers: n }, [l]);
|
|
1347
1370
|
return;
|
|
1348
1371
|
}
|
|
1349
1372
|
if (!o && s && a) {
|
|
1350
1373
|
const l = e.buffer;
|
|
1351
|
-
|
|
1374
|
+
w({ type: "protocol", message: l, headers: n }, [l]);
|
|
1352
1375
|
return;
|
|
1353
1376
|
}
|
|
1354
1377
|
if (o && a) {
|
|
1355
1378
|
const l = [];
|
|
1356
|
-
for (let _ = 1; _ <
|
|
1379
|
+
for (let _ = 1; _ < i.length; _++)
|
|
1357
1380
|
l.push(e.slice().buffer);
|
|
1358
1381
|
const h = s ? e.slice().buffer : null, f = e.buffer;
|
|
1359
|
-
|
|
1360
|
-
for (let _ = 1; _ <
|
|
1361
|
-
|
|
1362
|
-
h &&
|
|
1382
|
+
i[0].postMessage({ type: "protocol", message: f, headers: n }, [f]);
|
|
1383
|
+
for (let _ = 1; _ < i.length; _++)
|
|
1384
|
+
i[_].postMessage({ type: "protocol", message: l[_ - 1], headers: n }, [l[_ - 1]]);
|
|
1385
|
+
h && w({ type: "protocol", message: h, headers: n }, [h]);
|
|
1363
1386
|
return;
|
|
1364
1387
|
}
|
|
1365
1388
|
if (o)
|
|
1366
|
-
for (const l of
|
|
1389
|
+
for (const l of i) {
|
|
1367
1390
|
const h = e.slice().buffer;
|
|
1368
|
-
l.postMessage({ type: "protocol", message: h, headers:
|
|
1391
|
+
l.postMessage({ type: "protocol", message: h, headers: n }, [h]);
|
|
1369
1392
|
}
|
|
1370
1393
|
if (s) {
|
|
1371
1394
|
const l = e.slice().buffer;
|
|
1372
|
-
|
|
1395
|
+
w({ type: "protocol", message: l, headers: n }, [l]);
|
|
1373
1396
|
}
|
|
1374
|
-
} catch (
|
|
1375
|
-
B(
|
|
1397
|
+
} catch (n) {
|
|
1398
|
+
B(n);
|
|
1376
1399
|
}
|
|
1377
1400
|
}
|
|
1378
|
-
}), await
|
|
1401
|
+
}), await N.connect(t.entrypoints);
|
|
1379
1402
|
}
|
|
1380
1403
|
self.addEventListener("message", (t) => {
|
|
1381
1404
|
const e = t.data;
|
|
1382
1405
|
if (e.type === "connect") {
|
|
1383
|
-
|
|
1406
|
+
bt(e).catch((r) => {
|
|
1384
1407
|
st.error(`Failed to connect: ${r}`), B(r), Y();
|
|
1385
1408
|
});
|
|
1386
1409
|
return;
|
|
1387
1410
|
}
|
|
1388
1411
|
if (e.type === "disconnect") {
|
|
1389
|
-
Y(),
|
|
1412
|
+
Y(), w({ type: "state", state: "idle" });
|
|
1390
1413
|
return;
|
|
1391
1414
|
}
|
|
1392
1415
|
if (e.type === "send") {
|
|
1393
|
-
if (!
|
|
1416
|
+
if (!N)
|
|
1394
1417
|
return;
|
|
1395
1418
|
try {
|
|
1396
1419
|
const r = new Uint8Array(e.message);
|
|
1397
|
-
|
|
1420
|
+
N.sendProtocolMessage(r), u && u.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1398
1421
|
} catch (r) {
|
|
1399
1422
|
B(r);
|
|
1400
1423
|
}
|
|
@@ -1413,8 +1436,8 @@ self.addEventListener("message", (t) => {
|
|
|
1413
1436
|
e.port.start?.();
|
|
1414
1437
|
} catch {
|
|
1415
1438
|
}
|
|
1416
|
-
const r =
|
|
1417
|
-
|
|
1439
|
+
const r = S.length;
|
|
1440
|
+
S.push(e.portId), A.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), v.set(e.portId, r);
|
|
1418
1441
|
return;
|
|
1419
1442
|
}
|
|
1420
1443
|
if (e.type === "detachPort") {
|
|
@@ -1425,55 +1448,55 @@ self.addEventListener("message", (t) => {
|
|
|
1425
1448
|
s.port.close();
|
|
1426
1449
|
} catch {
|
|
1427
1450
|
}
|
|
1428
|
-
const
|
|
1429
|
-
if (r !==
|
|
1430
|
-
const
|
|
1431
|
-
|
|
1451
|
+
const i = S.length - 1;
|
|
1452
|
+
if (r !== i) {
|
|
1453
|
+
const n = S[i];
|
|
1454
|
+
S[r] = n, A[r] = A[i], v.set(n, r);
|
|
1432
1455
|
}
|
|
1433
|
-
|
|
1456
|
+
S.length--, A.length--, v.delete(e.portId);
|
|
1434
1457
|
}
|
|
1435
1458
|
return;
|
|
1436
1459
|
}
|
|
1437
1460
|
if (e.type === "attachSendPort") {
|
|
1438
|
-
const r =
|
|
1461
|
+
const r = y.get(e.portId);
|
|
1439
1462
|
if (r !== void 0) {
|
|
1440
|
-
const
|
|
1463
|
+
const n = c[r];
|
|
1441
1464
|
try {
|
|
1442
|
-
|
|
1465
|
+
n.port.close();
|
|
1443
1466
|
} catch {
|
|
1444
1467
|
}
|
|
1445
|
-
const a =
|
|
1468
|
+
const a = C.length - 1;
|
|
1446
1469
|
if (r !== a) {
|
|
1447
|
-
const o =
|
|
1448
|
-
|
|
1470
|
+
const o = C[a];
|
|
1471
|
+
C[r] = o, c[r] = c[a], y.set(o, r);
|
|
1449
1472
|
}
|
|
1450
|
-
|
|
1473
|
+
C.length--, c.length--, y.delete(e.portId);
|
|
1451
1474
|
}
|
|
1452
|
-
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask },
|
|
1453
|
-
|
|
1475
|
+
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, i = C.length;
|
|
1476
|
+
C.push(e.portId), c.push(s), y.set(e.portId, i);
|
|
1454
1477
|
try {
|
|
1455
1478
|
s.port.start?.();
|
|
1456
1479
|
} catch {
|
|
1457
1480
|
}
|
|
1458
|
-
s.port.addEventListener("message", (
|
|
1459
|
-
|
|
1481
|
+
s.port.addEventListener("message", (n) => {
|
|
1482
|
+
dt(s.opcodeGroupsMask, n.data);
|
|
1460
1483
|
});
|
|
1461
1484
|
return;
|
|
1462
1485
|
}
|
|
1463
1486
|
if (e.type === "detachSendPort") {
|
|
1464
|
-
const r =
|
|
1487
|
+
const r = y.get(e.portId);
|
|
1465
1488
|
if (r !== void 0) {
|
|
1466
1489
|
const s = c[r];
|
|
1467
1490
|
try {
|
|
1468
1491
|
s.port.close();
|
|
1469
1492
|
} catch {
|
|
1470
1493
|
}
|
|
1471
|
-
const
|
|
1472
|
-
if (r !==
|
|
1473
|
-
const
|
|
1474
|
-
|
|
1494
|
+
const i = C.length - 1;
|
|
1495
|
+
if (r !== i) {
|
|
1496
|
+
const n = C[i];
|
|
1497
|
+
C[r] = n, c[r] = c[i], y.set(n, r);
|
|
1475
1498
|
}
|
|
1476
|
-
|
|
1499
|
+
C.length--, c.length--, y.delete(e.portId);
|
|
1477
1500
|
}
|
|
1478
1501
|
return;
|
|
1479
1502
|
}
|