@ikonai/sdk 1.0.53 → 1.0.55
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/{audio-playback-worker-CyEW91Py.js → audio-playback-worker-DQyx1JwZ.js} +54 -54
- package/assets/{protocol-worker-BXw02zNx.js → protocol-worker-BuKXaXdD.js} +275 -275
- package/assets/{video-capture-worker-_LRzpUOA.js → video-capture-worker-CmIFJfiB.js} +55 -55
- package/assets/{video-playback-worker-Dlf8ieLP.js → video-playback-worker-DVJEnC1l.js} +77 -77
- package/client/ikon-client.d.ts +8 -0
- package/connection/urls.d.ts +14 -7
- package/errors/index.d.ts +10 -0
- package/index.d.ts +1 -1
- package/index.js +1810 -1740
- package/package.json +1 -1
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
function
|
|
1
|
+
function z(t) {
|
|
2
2
|
if (t.length < 8)
|
|
3
3
|
throw new Error("Protocol message too short");
|
|
4
4
|
return (t[4] | t[5] << 8 | t[6] << 16 | t[7] << 24) >>> 0;
|
|
5
5
|
}
|
|
6
|
-
function
|
|
7
|
-
return
|
|
6
|
+
function G(t) {
|
|
7
|
+
return z(t) & 4294901760;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
9
|
+
function Y(t) {
|
|
10
10
|
const e = ut(t), s = 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 r = s.getUint32(0, !0), n = s.getUint32(4, !0), i = s.getUint32(8, !0),
|
|
14
|
-
if (27 +
|
|
13
|
+
const r = s.getUint32(0, !0), n = s.getUint32(4, !0), i = s.getUint32(8, !0), l = s.getUint32(12, !0), a = s.getUint32(16, !0), o = s.getUint32(20, !0), I = s.getUint8(24), E = s.getUint8(25), h = s.getUint8(26);
|
|
14
|
+
if (27 + o * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
16
|
const c = [];
|
|
17
17
|
let w = 27;
|
|
18
|
-
for (let
|
|
18
|
+
for (let D = 0; D < o; D++)
|
|
19
19
|
c.push(s.getUint32(w, !0)), w += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: r,
|
|
22
22
|
opcode: n,
|
|
23
23
|
senderId: i,
|
|
24
|
-
trackId:
|
|
25
|
-
sequenceId:
|
|
24
|
+
trackId: l,
|
|
25
|
+
sequenceId: a,
|
|
26
26
|
targetIds: c,
|
|
27
27
|
payloadVersion: I,
|
|
28
28
|
payloadType: E,
|
|
29
29
|
flags: h
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
c.setUint32(0, h, !0), c.setUint32(4, t >>> 0, !0), c.setUint32(8, r >>> 0, !0), c.setUint32(12, 0, !0), c.setUint32(16, 0, !0), c.setUint32(20,
|
|
32
|
+
function ht(t, e, s, r, n) {
|
|
33
|
+
const o = [], E = 27 + o.length * 4, h = E + e.length, T = new Uint8Array(h), c = new DataView(T.buffer);
|
|
34
|
+
c.setUint32(0, h, !0), c.setUint32(4, t >>> 0, !0), c.setUint32(8, r >>> 0, !0), c.setUint32(12, 0, !0), c.setUint32(16, 0, !0), c.setUint32(20, o.length >>> 0, !0), c.setUint8(24, s & 255), c.setUint8(25, 8), c.setUint8(26, 0);
|
|
35
35
|
let w = 27;
|
|
36
|
-
for (let
|
|
37
|
-
c.setUint32(w,
|
|
36
|
+
for (let D = 0; D < o.length; D++)
|
|
37
|
+
c.setUint32(w, o[D] >>> 0, !0), w += 4;
|
|
38
38
|
return T.set(e, E), T;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const
|
|
40
|
+
var m = /* @__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))(m || {});
|
|
41
|
+
const _t = 161, Tt = 162, K = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
|
-
class
|
|
43
|
+
class V {
|
|
44
44
|
constructor(e = 1) {
|
|
45
|
-
this.version = e, this.buffer.writeByte(
|
|
45
|
+
this.version = e, this.buffer.writeByte(_t), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
47
|
buffer = new O();
|
|
48
48
|
closed = !1;
|
|
@@ -75,32 +75,32 @@ class G {
|
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(r));
|
|
76
76
|
}
|
|
77
77
|
writeStringField(e, s) {
|
|
78
|
-
const r =
|
|
78
|
+
const r = K.encode(s ?? "");
|
|
79
79
|
this.writeVariableField(e, 12, r);
|
|
80
80
|
}
|
|
81
81
|
writeBinaryField(e, s) {
|
|
82
82
|
this.writeVariableField(e, 13, s);
|
|
83
83
|
}
|
|
84
84
|
writeObjectField(e, s, r) {
|
|
85
|
-
const n = new
|
|
85
|
+
const n = new V(s);
|
|
86
86
|
r(n);
|
|
87
87
|
const i = n.finish();
|
|
88
88
|
this.writeVariableField(e, 11, i);
|
|
89
89
|
}
|
|
90
90
|
writeArrayField(e, s, r) {
|
|
91
|
-
const n = new
|
|
91
|
+
const n = new x(s);
|
|
92
92
|
r(n);
|
|
93
93
|
const i = n.finish();
|
|
94
94
|
this.writeVariableField(e, 9, i);
|
|
95
95
|
}
|
|
96
96
|
writeDictionaryField(e, s, r, n) {
|
|
97
|
-
const i = new
|
|
97
|
+
const i = new q(s, r);
|
|
98
98
|
n(i);
|
|
99
|
-
const
|
|
100
|
-
this.writeVariableField(e, 10,
|
|
99
|
+
const l = i.finish();
|
|
100
|
+
this.writeVariableField(e, 10, l);
|
|
101
101
|
}
|
|
102
102
|
finish() {
|
|
103
|
-
return this.closed || (this.buffer.writeByte(
|
|
103
|
+
return this.closed || (this.buffer.writeByte(Tt), this.closed = !0, this.cached = this.buffer.toUint8Array()), this.cached;
|
|
104
104
|
}
|
|
105
105
|
writeFixedField(e, s, r) {
|
|
106
106
|
this.writeFieldHeader(e, s, 0), r();
|
|
@@ -109,10 +109,10 @@ class G {
|
|
|
109
109
|
this.writeFieldHeader(e, s, r.length), this.buffer.writeBytes(r);
|
|
110
110
|
}
|
|
111
111
|
writeFieldHeader(e, s, r) {
|
|
112
|
-
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(
|
|
112
|
+
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(H(s)), It(s) && this.buffer.writeVarUInt(r >>> 0);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class x {
|
|
116
116
|
constructor(e) {
|
|
117
117
|
this.elementType = e;
|
|
118
118
|
}
|
|
@@ -175,7 +175,7 @@ class Y {
|
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const s =
|
|
178
|
+
const s = K.encode(e ?? "");
|
|
179
179
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
@@ -189,7 +189,7 @@ class Y {
|
|
|
189
189
|
11
|
|
190
190
|
/* Object */
|
|
191
191
|
), this.count++;
|
|
192
|
-
const r = new
|
|
192
|
+
const r = new V(e);
|
|
193
193
|
s(r);
|
|
194
194
|
const n = r.finish();
|
|
195
195
|
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n);
|
|
@@ -199,7 +199,7 @@ class Y {
|
|
|
199
199
|
9
|
|
200
200
|
/* Array */
|
|
201
201
|
), this.count++;
|
|
202
|
-
const r = new
|
|
202
|
+
const r = new x(e);
|
|
203
203
|
s(r);
|
|
204
204
|
const n = r.finish();
|
|
205
205
|
this.payload.writeBytes(n);
|
|
@@ -209,23 +209,23 @@ class Y {
|
|
|
209
209
|
10
|
|
210
210
|
/* Dict */
|
|
211
211
|
), this.count++;
|
|
212
|
-
const n = new
|
|
212
|
+
const n = new q(e, s);
|
|
213
213
|
r(n);
|
|
214
214
|
const i = n.finish();
|
|
215
215
|
this.payload.writeBytes(i);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
218
|
const e = new O();
|
|
219
|
-
return e.writeByte(
|
|
219
|
+
return e.writeByte(H(this.elementType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
220
220
|
}
|
|
221
221
|
ensureElementType(e) {
|
|
222
222
|
if (this.elementType !== e)
|
|
223
|
-
throw new Error(`Array element type is ${
|
|
223
|
+
throw new Error(`Array element type is ${m[this.elementType]}, expected ${m[e]}`);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class q {
|
|
227
227
|
constructor(e, s) {
|
|
228
|
-
this.keyType = e, this.valueType = s,
|
|
228
|
+
this.keyType = e, this.valueType = s, At(e);
|
|
229
229
|
}
|
|
230
230
|
payload = new O();
|
|
231
231
|
count = 0;
|
|
@@ -233,7 +233,7 @@ class z {
|
|
|
233
233
|
beginEntry() {
|
|
234
234
|
if (this.entryOpen)
|
|
235
235
|
throw new Error("Previous dictionary entry not completed");
|
|
236
|
-
return this.count++, this.entryOpen = !0, new
|
|
236
|
+
return this.count++, this.entryOpen = !0, new ct(this.keyType, this.valueType, this.payload, () => {
|
|
237
237
|
this.entryOpen = !1;
|
|
238
238
|
});
|
|
239
239
|
}
|
|
@@ -241,10 +241,10 @@ class z {
|
|
|
241
241
|
if (this.entryOpen)
|
|
242
242
|
throw new Error("Dictionary entry not completed");
|
|
243
243
|
const e = new O();
|
|
244
|
-
return e.writeByte(
|
|
244
|
+
return e.writeByte(H(this.keyType)), e.writeByte(H(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
class
|
|
247
|
+
class ct {
|
|
248
248
|
constructor(e, s, r, n) {
|
|
249
249
|
this.keyType = e, this.valueType = s, this.payload = r, this.onComplete = n;
|
|
250
250
|
}
|
|
@@ -308,7 +308,7 @@ class Tt {
|
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const s =
|
|
311
|
+
const s = K.encode(e ?? "");
|
|
312
312
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
@@ -386,7 +386,7 @@ class Tt {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const s =
|
|
389
|
+
const s = K.encode(e ?? "");
|
|
390
390
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.valueWritten = !0;
|
|
391
391
|
}
|
|
392
392
|
writeValueObject(e, s) {
|
|
@@ -394,7 +394,7 @@ class Tt {
|
|
|
394
394
|
11
|
|
395
395
|
/* Object */
|
|
396
396
|
);
|
|
397
|
-
const r = new
|
|
397
|
+
const r = new V(e);
|
|
398
398
|
s(r);
|
|
399
399
|
const n = r.finish();
|
|
400
400
|
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n), this.valueWritten = !0;
|
|
@@ -404,7 +404,7 @@ class Tt {
|
|
|
404
404
|
9
|
|
405
405
|
/* Array */
|
|
406
406
|
);
|
|
407
|
-
const r = new
|
|
407
|
+
const r = new x(e);
|
|
408
408
|
s(r);
|
|
409
409
|
const n = r.finish();
|
|
410
410
|
this.payload.writeBytes(n), this.valueWritten = !0;
|
|
@@ -414,7 +414,7 @@ class Tt {
|
|
|
414
414
|
10
|
|
415
415
|
/* Dict */
|
|
416
416
|
);
|
|
417
|
-
const n = new
|
|
417
|
+
const n = new q(e, s);
|
|
418
418
|
r(n);
|
|
419
419
|
const i = n.finish();
|
|
420
420
|
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
@@ -428,11 +428,11 @@ class Tt {
|
|
|
428
428
|
}
|
|
429
429
|
ensureKeyType(e) {
|
|
430
430
|
if (this.keyType !== e)
|
|
431
|
-
throw new Error(`Dictionary key type is ${
|
|
431
|
+
throw new Error(`Dictionary key type is ${m[this.keyType]}, expected ${m[e]}`);
|
|
432
432
|
}
|
|
433
433
|
ensureValueType(e) {
|
|
434
434
|
if (this.valueType !== e)
|
|
435
|
-
throw new Error(`Dictionary value type is ${
|
|
435
|
+
throw new Error(`Dictionary value type is ${m[this.valueType]}, expected ${m[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
438
|
class _ {
|
|
@@ -445,10 +445,10 @@ class _ {
|
|
|
445
445
|
const s = e.replace(/-/g, "");
|
|
446
446
|
if (s.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const r = new Uint8Array(16), n = _.parseHexSlice(s, 0, 8), i = _.parseHexSlice(s, 8, 4),
|
|
449
|
-
_.writeUInt32LE(r, 0, n), _.writeUInt16LE(r, 4, i), _.writeUInt16LE(r, 6,
|
|
450
|
-
for (let
|
|
451
|
-
r[8 +
|
|
448
|
+
const r = new Uint8Array(16), n = _.parseHexSlice(s, 0, 8), i = _.parseHexSlice(s, 8, 4), l = _.parseHexSlice(s, 12, 4);
|
|
449
|
+
_.writeUInt32LE(r, 0, n), _.writeUInt16LE(r, 4, i), _.writeUInt16LE(r, 6, l);
|
|
450
|
+
for (let a = 0; a < 8; a++)
|
|
451
|
+
r[8 + a] = _.parseHexSlice(s, 16 + a * 2, 2);
|
|
452
452
|
return new _(r);
|
|
453
453
|
}
|
|
454
454
|
static fromBytes(e) {
|
|
@@ -474,8 +474,8 @@ class _ {
|
|
|
474
474
|
_.toHex(_.readUInt32LE(e, 0), 8),
|
|
475
475
|
_.toHex(_.readUInt16LE(e, 4), 4),
|
|
476
476
|
_.toHex(_.readUInt16LE(e, 6), 4),
|
|
477
|
-
|
|
478
|
-
|
|
477
|
+
Z(e.subarray(8, 10)),
|
|
478
|
+
Z(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
480
480
|
}
|
|
481
481
|
asBytes() {
|
|
@@ -557,57 +557,62 @@ class O {
|
|
|
557
557
|
return this.buffer.slice(0, this.length);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function H(t, e = 0) {
|
|
561
561
|
if ((e & 240) !== 0)
|
|
562
562
|
throw new Error("Teleport flags must fit into 4 bits");
|
|
563
563
|
return (t & 15) << 4 | e & 15;
|
|
564
564
|
}
|
|
565
|
-
function
|
|
565
|
+
function It(t) {
|
|
566
566
|
return t === 12 || t === 13 || t === 9 || t === 11 || t === 10;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function At(t) {
|
|
569
569
|
if (t === 9 || t === 11 || t === 10 || t === 1)
|
|
570
570
|
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
571
571
|
}
|
|
572
|
-
function
|
|
572
|
+
function Z(t) {
|
|
573
573
|
return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
574
574
|
}
|
|
575
575
|
function ut(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
578
|
-
var N = /* @__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[t.Udp = 512] = "Udp", t[t.UdpDtls = 1024] = "UdpDtls", t))(N || {}), V = /* @__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.CORE_WEBRTC_VIDEO_CAPTURE = 65572] = "CORE_WEBRTC_VIDEO_CAPTURE", t[t.CORE_RELAY_AGENT_AUTH = 65576] = "CORE_RELAY_AGENT_AUTH", t[t.CORE_RELAY_AGENT_AUTH_RESULT = 65577] = "CORE_RELAY_AGENT_AUTH_RESULT", t[t.CORE_RELAY_HEARTBEAT = 65578] = "CORE_RELAY_HEARTBEAT", t[t.CORE_RELAY_TCP_CONNECTION_OPENED = 65579] = "CORE_RELAY_TCP_CONNECTION_OPENED", t[t.CORE_RELAY_TCP_CONNECTION_CLOSED = 65580] = "CORE_RELAY_TCP_CONNECTION_CLOSED", t[t.CORE_RELAY_TCP_DATA = 65581] = "CORE_RELAY_TCP_DATA", t[t.CORE_RELAY_UDP_DATA = 65582] = "CORE_RELAY_UDP_DATA", t[t.CORE_RELAY_ADD_TUNNEL = 65583] = "CORE_RELAY_ADD_TUNNEL", t[t.CORE_RELAY_TUNNEL_ADDED = 65584] = "CORE_RELAY_TUNNEL_ADDED", t[t.CORE_RELAY_REMOVE_TUNNEL = 65585] = "CORE_RELAY_REMOVE_TUNNEL", 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.ANALYTICS_IKON_RELAY_SERVER_STATS = 524297] = "ANALYTICS_IKON_RELAY_SERVER_STATS", t[t.ANALYTICS_IKON_TURN_SERVER_STATS = 524298] = "ANALYTICS_IKON_TURN_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_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.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", t[t.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", t[t.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", t[t.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", t[t.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", t[t.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", t[t.ACTION_FUNCTION_ENUMERATION_ITEM_BATCH = 1048651] = "ACTION_FUNCTION_ENUMERATION_ITEM_BATCH", t[t.ACTION_CALL_ACK = 1048652] = "ACTION_CALL_ACK", 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.AUDIO_SHAPE_FRAME = 4194310] = "AUDIO_SHAPE_FRAME", 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.GROUP_APP_LOCAL = 1073741824] = "GROUP_APP_LOCAL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(V || {});
|
|
579
|
-
const
|
|
580
|
-
function
|
|
578
|
+
var N = /* @__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[t.Udp = 512] = "Udp", t[t.UdpDtls = 1024] = "UdpDtls", t))(N || {}), k = /* @__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_ON_CLIENT_LEFT_AFTER_GRACE_PERIOD = 65560] = "CORE_ON_CLIENT_LEFT_AFTER_GRACE_PERIOD", 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.CORE_WEBRTC_VIDEO_CAPTURE = 65572] = "CORE_WEBRTC_VIDEO_CAPTURE", t[t.CORE_RELAY_AGENT_AUTH = 65576] = "CORE_RELAY_AGENT_AUTH", t[t.CORE_RELAY_AGENT_AUTH_RESULT = 65577] = "CORE_RELAY_AGENT_AUTH_RESULT", t[t.CORE_RELAY_HEARTBEAT = 65578] = "CORE_RELAY_HEARTBEAT", t[t.CORE_RELAY_TCP_CONNECTION_OPENED = 65579] = "CORE_RELAY_TCP_CONNECTION_OPENED", t[t.CORE_RELAY_TCP_CONNECTION_CLOSED = 65580] = "CORE_RELAY_TCP_CONNECTION_CLOSED", t[t.CORE_RELAY_TCP_DATA = 65581] = "CORE_RELAY_TCP_DATA", t[t.CORE_RELAY_UDP_DATA = 65582] = "CORE_RELAY_UDP_DATA", t[t.CORE_RELAY_ADD_TUNNEL = 65583] = "CORE_RELAY_ADD_TUNNEL", t[t.CORE_RELAY_TUNNEL_ADDED = 65584] = "CORE_RELAY_TUNNEL_ADDED", t[t.CORE_RELAY_REMOVE_TUNNEL = 65585] = "CORE_RELAY_REMOVE_TUNNEL", t[t.CORE_IKON_SERVER_ENDPOINT_HOST_INFO = 65586] = "CORE_IKON_SERVER_ENDPOINT_HOST_INFO", 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.ANALYTICS_IKON_RELAY_SERVER_STATS = 524297] = "ANALYTICS_IKON_RELAY_SERVER_STATS", t[t.ANALYTICS_IKON_TURN_SERVER_STATS = 524298] = "ANALYTICS_IKON_TURN_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_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.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", t[t.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", t[t.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", t[t.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", t[t.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", t[t.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", t[t.ACTION_FUNCTION_ENUMERATION_ITEM_BATCH = 1048651] = "ACTION_FUNCTION_ENUMERATION_ITEM_BATCH", t[t.ACTION_CALL_ACK = 1048652] = "ACTION_CALL_ACK", 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.AUDIO_SHAPE_FRAME = 4194310] = "AUDIO_SHAPE_FRAME", 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.GROUP_APP_LOCAL = 1073741824] = "GROUP_APP_LOCAL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(k || {});
|
|
579
|
+
const st = 1, ft = 131074;
|
|
580
|
+
function rt(t) {
|
|
581
581
|
return {};
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
return new
|
|
583
|
+
function Ct(t) {
|
|
584
|
+
return new V(st).finish();
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const r =
|
|
588
|
-
return
|
|
586
|
+
function nt(t, e, s) {
|
|
587
|
+
const r = Ct();
|
|
588
|
+
return ht(ft, r, st, e);
|
|
589
589
|
}
|
|
590
|
-
class
|
|
590
|
+
class it extends Error {
|
|
591
591
|
constructor(e, s) {
|
|
592
592
|
super(e), this.cause = s, this.name = "ConnectionError";
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
class
|
|
595
|
+
class y extends it {
|
|
596
596
|
constructor(e, s) {
|
|
597
597
|
super(e, s), this.name = "TransportError";
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
class
|
|
600
|
+
class J extends y {
|
|
601
601
|
constructor(e) {
|
|
602
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class
|
|
605
|
+
class b extends y {
|
|
606
|
+
constructor(e, s) {
|
|
607
|
+
super(e, s), this.name = "AuthRejectedError";
|
|
608
|
+
}
|
|
609
|
+
}
|
|
610
|
+
class tt extends it {
|
|
606
611
|
constructor(e) {
|
|
607
612
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
608
613
|
}
|
|
609
614
|
}
|
|
610
|
-
function
|
|
615
|
+
function Nt(t, e) {
|
|
611
616
|
return new Promise((s, r) => {
|
|
612
617
|
const n = () => {
|
|
613
618
|
clearTimeout(i), r(new DOMException("Aborted", "AbortError"));
|
|
@@ -621,10 +626,10 @@ function Ct(t, e) {
|
|
|
621
626
|
e?.addEventListener("abort", n, { once: !0 });
|
|
622
627
|
});
|
|
623
628
|
}
|
|
624
|
-
let
|
|
625
|
-
const
|
|
626
|
-
function
|
|
627
|
-
|
|
629
|
+
let at = 1;
|
|
630
|
+
const Rt = /* @__PURE__ */ new Map();
|
|
631
|
+
function Ut(t) {
|
|
632
|
+
at = t;
|
|
628
633
|
}
|
|
629
634
|
const yt = {
|
|
630
635
|
0: "DEBUG",
|
|
@@ -633,11 +638,11 @@ const yt = {
|
|
|
633
638
|
3: "ERROR",
|
|
634
639
|
4: "NONE"
|
|
635
640
|
};
|
|
636
|
-
function
|
|
641
|
+
function St(t, e) {
|
|
637
642
|
return `[${t}] ${e}`;
|
|
638
643
|
}
|
|
639
|
-
function
|
|
640
|
-
const n = (/* @__PURE__ */ new Date()).toISOString(), i = yt[t],
|
|
644
|
+
function W(t, e, s, r) {
|
|
645
|
+
const n = (/* @__PURE__ */ new Date()).toISOString(), i = yt[t], l = {
|
|
641
646
|
timestamp: n,
|
|
642
647
|
level: t,
|
|
643
648
|
levelName: i,
|
|
@@ -645,28 +650,28 @@ function k(t, e, s, r) {
|
|
|
645
650
|
message: s,
|
|
646
651
|
args: r
|
|
647
652
|
};
|
|
648
|
-
for (const [
|
|
649
|
-
const I =
|
|
653
|
+
for (const [a, o] of Rt) {
|
|
654
|
+
const I = o?.minLevel ?? 2;
|
|
650
655
|
if (t >= I)
|
|
651
656
|
try {
|
|
652
|
-
|
|
657
|
+
a(l);
|
|
653
658
|
} catch {
|
|
654
659
|
}
|
|
655
660
|
}
|
|
656
|
-
if (
|
|
657
|
-
const
|
|
661
|
+
if (at <= t) {
|
|
662
|
+
const a = St(e, s);
|
|
658
663
|
switch (t) {
|
|
659
664
|
case 0:
|
|
660
|
-
console.debug(
|
|
665
|
+
console.debug(a, ...r);
|
|
661
666
|
break;
|
|
662
667
|
case 1:
|
|
663
|
-
console.info(
|
|
668
|
+
console.info(a, ...r);
|
|
664
669
|
break;
|
|
665
670
|
case 2:
|
|
666
|
-
console.warn(
|
|
671
|
+
console.warn(a, ...r);
|
|
667
672
|
break;
|
|
668
673
|
case 3:
|
|
669
|
-
console.error(
|
|
674
|
+
console.error(a, ...r);
|
|
670
675
|
break;
|
|
671
676
|
}
|
|
672
677
|
}
|
|
@@ -674,21 +679,21 @@ function k(t, e, s, r) {
|
|
|
674
679
|
function p(t) {
|
|
675
680
|
return {
|
|
676
681
|
debug(e, ...s) {
|
|
677
|
-
|
|
682
|
+
W(0, t, e, s);
|
|
678
683
|
},
|
|
679
684
|
info(e, ...s) {
|
|
680
|
-
|
|
685
|
+
W(1, t, e, s);
|
|
681
686
|
},
|
|
682
687
|
warn(e, ...s) {
|
|
683
|
-
|
|
688
|
+
W(2, t, e, s);
|
|
684
689
|
},
|
|
685
690
|
error(e, ...s) {
|
|
686
|
-
|
|
691
|
+
W(3, t, e, s);
|
|
687
692
|
}
|
|
688
693
|
};
|
|
689
694
|
}
|
|
690
|
-
const
|
|
691
|
-
function
|
|
695
|
+
const wt = "ikon-retry";
|
|
696
|
+
function Lt(t, e) {
|
|
692
697
|
if (typeof window > "u")
|
|
693
698
|
return null;
|
|
694
699
|
const s = new URLSearchParams(window.location.search), r = s.get(t);
|
|
@@ -698,14 +703,14 @@ function wt(t, e) {
|
|
|
698
703
|
return n !== null ? n : null;
|
|
699
704
|
}
|
|
700
705
|
function gt(t, e) {
|
|
701
|
-
const s =
|
|
706
|
+
const s = Lt(t);
|
|
702
707
|
return s === "true" ? !0 : s === "false" ? !1 : null;
|
|
703
708
|
}
|
|
704
|
-
function
|
|
705
|
-
return gt(
|
|
709
|
+
function Pt() {
|
|
710
|
+
return gt(wt) !== !1;
|
|
706
711
|
}
|
|
707
|
-
const M = p("WebSocketTransport"),
|
|
708
|
-
class
|
|
712
|
+
const M = p("WebSocketTransport"), mt = 1e4;
|
|
713
|
+
class Ot {
|
|
709
714
|
ws = null;
|
|
710
715
|
keepaliveTimeout = null;
|
|
711
716
|
isClosed = !1;
|
|
@@ -719,7 +724,7 @@ class mt {
|
|
|
719
724
|
callbacks;
|
|
720
725
|
sessionId;
|
|
721
726
|
constructor(e) {
|
|
722
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ??
|
|
727
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? mt;
|
|
723
728
|
}
|
|
724
729
|
get isConnected() {
|
|
725
730
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
@@ -731,29 +736,28 @@ class mt {
|
|
|
731
736
|
try {
|
|
732
737
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
733
738
|
} catch (T) {
|
|
734
|
-
i(new
|
|
739
|
+
i(new y(`Failed to create WebSocket: ${T}`, T instanceof Error ? T : void 0));
|
|
735
740
|
return;
|
|
736
741
|
}
|
|
737
|
-
let
|
|
738
|
-
const
|
|
742
|
+
let l = !1, a = !1;
|
|
743
|
+
const o = () => {
|
|
739
744
|
clearTimeout(h), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
740
745
|
}, I = () => {
|
|
741
|
-
|
|
746
|
+
a || (a = !0, clearTimeout(h), this.firstMessageResolver = null, M.debug(`WebSocket connected in ${Date.now() - r}ms`), n());
|
|
742
747
|
}, E = (T) => {
|
|
743
|
-
|
|
748
|
+
a || (a = !0, this.firstMessageResolver = null, o(), i(T));
|
|
744
749
|
};
|
|
745
750
|
this.firstMessageResolver = I;
|
|
746
751
|
const h = setTimeout(() => {
|
|
747
|
-
this.ws?.close(), M.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), E(new
|
|
752
|
+
this.ws?.close(), M.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), E(new y("WebSocket connection timeout"));
|
|
748
753
|
}, this.connectionTimeoutMs);
|
|
749
754
|
this.ws.onopen = () => {
|
|
750
|
-
|
|
755
|
+
l = !0, this.ws.send(s), this.resetKeepaliveTimeout();
|
|
751
756
|
}, this.ws.onerror = () => {
|
|
752
|
-
M.debug(`WebSocket connection failed after ${Date.now() - r}ms`), E(new
|
|
757
|
+
M.debug(`WebSocket connection failed after ${Date.now() - r}ms`), E(new y("WebSocket connection failed"));
|
|
753
758
|
}, this.ws.onclose = (T) => {
|
|
754
|
-
if (this.clearKeepaliveTimeout(), !
|
|
755
|
-
|
|
756
|
-
E(new U(g));
|
|
759
|
+
if (this.clearKeepaliveTimeout(), !a) {
|
|
760
|
+
E(l ? new b("WebSocket closed before first server message") : new y("WebSocket connection closed before opening"));
|
|
757
761
|
return;
|
|
758
762
|
}
|
|
759
763
|
if (this.isClosed)
|
|
@@ -775,12 +779,12 @@ class mt {
|
|
|
775
779
|
* Get or create a cached keepalive response message.
|
|
776
780
|
*/
|
|
777
781
|
getKeepaliveResponse() {
|
|
778
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(
|
|
782
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = nt(rt(), this.sessionId)), this.keepaliveResponseMessage;
|
|
779
783
|
}
|
|
780
784
|
handleProtocolMessage(e) {
|
|
781
785
|
try {
|
|
782
|
-
const r =
|
|
783
|
-
if (this.firstMessageResolver && this.firstMessageResolver(), r ===
|
|
786
|
+
const r = Y(e).opcode;
|
|
787
|
+
if (this.firstMessageResolver && this.firstMessageResolver(), r === k.KEEPALIVE_REQUEST) {
|
|
784
788
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
785
789
|
return;
|
|
786
790
|
}
|
|
@@ -791,18 +795,18 @@ class mt {
|
|
|
791
795
|
}
|
|
792
796
|
resetKeepaliveTimeout() {
|
|
793
797
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
794
|
-
M.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new
|
|
798
|
+
M.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new J(this.keepaliveTimeoutMs)), this.close();
|
|
795
799
|
}, this.keepaliveTimeoutMs);
|
|
796
800
|
}
|
|
797
801
|
clearKeepaliveTimeout() {
|
|
798
802
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
799
803
|
}
|
|
800
804
|
}
|
|
801
|
-
const S = p("WebTransportTransport"), Dt = 1e4,
|
|
802
|
-
function
|
|
805
|
+
const S = p("WebTransportTransport"), Dt = 1e4, et = 4, Mt = 65536;
|
|
806
|
+
function ot() {
|
|
803
807
|
return typeof WebTransport < "u";
|
|
804
808
|
}
|
|
805
|
-
class
|
|
809
|
+
class bt {
|
|
806
810
|
transport = null;
|
|
807
811
|
stream = null;
|
|
808
812
|
reader = null;
|
|
@@ -811,7 +815,7 @@ class Mt {
|
|
|
811
815
|
readLoopActive = !1;
|
|
812
816
|
isClosed = !1;
|
|
813
817
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
814
|
-
receiveBuffer = new Uint8Array(
|
|
818
|
+
receiveBuffer = new Uint8Array(Mt);
|
|
815
819
|
receiveBufferOffset = 0;
|
|
816
820
|
receiveBufferLength = 0;
|
|
817
821
|
// Cached DataView to avoid allocation per message
|
|
@@ -834,25 +838,25 @@ class Mt {
|
|
|
834
838
|
return this.transport !== null && this.writer !== null;
|
|
835
839
|
}
|
|
836
840
|
async connect(e, s) {
|
|
837
|
-
if (!
|
|
838
|
-
throw new
|
|
841
|
+
if (!ot())
|
|
842
|
+
throw new y("WebTransport is not supported in this browser");
|
|
839
843
|
this.isClosed = !1;
|
|
840
|
-
const r = Date.now(), n = new Promise((i,
|
|
841
|
-
this.firstMessageResolver = i, this.firstMessageRejecter =
|
|
844
|
+
const r = Date.now(), n = new Promise((i, l) => {
|
|
845
|
+
this.firstMessageResolver = i, this.firstMessageRejecter = l;
|
|
842
846
|
});
|
|
843
847
|
try {
|
|
844
848
|
this.transport = new WebTransport(e);
|
|
845
849
|
let i;
|
|
846
|
-
const
|
|
850
|
+
const l = new Promise((E, h) => {
|
|
847
851
|
i = setTimeout(
|
|
848
|
-
() => h(new
|
|
852
|
+
() => h(new y("WebTransport connection timeout")),
|
|
849
853
|
this.connectionTimeoutMs
|
|
850
854
|
);
|
|
851
855
|
});
|
|
852
856
|
try {
|
|
853
|
-
await Promise.race([this.transport.ready,
|
|
857
|
+
await Promise.race([this.transport.ready, l]);
|
|
854
858
|
} catch (E) {
|
|
855
|
-
throw E instanceof
|
|
859
|
+
throw E instanceof y && S.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), E;
|
|
856
860
|
} finally {
|
|
857
861
|
clearTimeout(i);
|
|
858
862
|
}
|
|
@@ -861,24 +865,24 @@ class Mt {
|
|
|
861
865
|
}).catch((E) => {
|
|
862
866
|
S.error("WebTransport connection closed with error:", E), this.handleClose(E.message || "Connection error", !1);
|
|
863
867
|
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(s), this.resetKeepaliveTimeout(), this.startReadLoop();
|
|
864
|
-
const
|
|
865
|
-
let
|
|
868
|
+
const a = Math.max(this.connectionTimeoutMs - (Date.now() - r), 1);
|
|
869
|
+
let o;
|
|
866
870
|
const I = new Promise((E, h) => {
|
|
867
|
-
|
|
868
|
-
() => h(new
|
|
869
|
-
|
|
871
|
+
o = setTimeout(
|
|
872
|
+
() => h(new y("WebTransport closed before first server message")),
|
|
873
|
+
a
|
|
870
874
|
);
|
|
871
875
|
});
|
|
872
876
|
try {
|
|
873
877
|
await Promise.race([n, I]);
|
|
874
878
|
} finally {
|
|
875
|
-
clearTimeout(
|
|
879
|
+
clearTimeout(o);
|
|
876
880
|
}
|
|
877
881
|
this.firstMessageResolver = null, this.firstMessageRejecter = null, S.info(`WebTransport connected in ${Date.now() - r}ms`);
|
|
878
882
|
} catch (i) {
|
|
879
|
-
this.firstMessageResolver = null, this.firstMessageRejecter = null, this.cleanup();
|
|
880
|
-
const
|
|
881
|
-
throw S.warn(`WebTransport connection failed after ${
|
|
883
|
+
this.firstMessageResolver = null, this.firstMessageRejecter = null, this.isClosed = !0, this.cleanup();
|
|
884
|
+
const l = Date.now() - r;
|
|
885
|
+
throw S.warn(`WebTransport connection failed after ${l}ms: ${i}`), new y(`Failed to connect WebTransport: ${i}`, i instanceof Error ? i : void 0);
|
|
882
886
|
}
|
|
883
887
|
}
|
|
884
888
|
send(e) {
|
|
@@ -937,7 +941,7 @@ class Mt {
|
|
|
937
941
|
* Get or create a cached keepalive response message.
|
|
938
942
|
*/
|
|
939
943
|
getKeepaliveResponse() {
|
|
940
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(
|
|
944
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = nt(rt(), this.sessionId)), this.keepaliveResponseMessage;
|
|
941
945
|
}
|
|
942
946
|
/**
|
|
943
947
|
* Process complete messages from the receive buffer.
|
|
@@ -946,9 +950,9 @@ class Mt {
|
|
|
946
950
|
*/
|
|
947
951
|
processBufferedMessages() {
|
|
948
952
|
const e = this.getReceiveDataView();
|
|
949
|
-
for (; this.receiveBufferLength >=
|
|
953
|
+
for (; this.receiveBufferLength >= et; ) {
|
|
950
954
|
const s = e.getUint32(this.receiveBufferOffset, !0);
|
|
951
|
-
if (s <
|
|
955
|
+
if (s < et) {
|
|
952
956
|
S.error(`Invalid message length: ${s}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${s}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
953
957
|
return;
|
|
954
958
|
}
|
|
@@ -964,8 +968,8 @@ class Mt {
|
|
|
964
968
|
*/
|
|
965
969
|
handleProtocolMessage(e) {
|
|
966
970
|
try {
|
|
967
|
-
const r =
|
|
968
|
-
if (this.firstMessageResolver && this.firstMessageResolver(), r ===
|
|
971
|
+
const r = Y(e).opcode;
|
|
972
|
+
if (this.firstMessageResolver && this.firstMessageResolver(), r === k.KEEPALIVE_REQUEST) {
|
|
969
973
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
970
974
|
return;
|
|
971
975
|
}
|
|
@@ -980,7 +984,7 @@ class Mt {
|
|
|
980
984
|
handleClose(e, s) {
|
|
981
985
|
if (!this.isClosed) {
|
|
982
986
|
if (this.isClosed = !0, this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.firstMessageRejecter) {
|
|
983
|
-
this.firstMessageRejecter(new
|
|
987
|
+
this.firstMessageRejecter(new b(`WebTransport closed before first server message: ${e}`)), this.firstMessageResolver = null, this.firstMessageRejecter = null;
|
|
984
988
|
return;
|
|
985
989
|
}
|
|
986
990
|
this.callbacks.onClose(e, s);
|
|
@@ -991,7 +995,7 @@ class Mt {
|
|
|
991
995
|
*/
|
|
992
996
|
resetKeepaliveTimeout() {
|
|
993
997
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
994
|
-
S.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new
|
|
998
|
+
S.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new J(this.keepaliveTimeoutMs)), this.close();
|
|
995
999
|
}, this.keepaliveTimeoutMs);
|
|
996
1000
|
}
|
|
997
1001
|
/**
|
|
@@ -1013,8 +1017,8 @@ class Mt {
|
|
|
1013
1017
|
}
|
|
1014
1018
|
}
|
|
1015
1019
|
}
|
|
1016
|
-
const
|
|
1017
|
-
class
|
|
1020
|
+
const $ = p("Channel");
|
|
1021
|
+
class vt {
|
|
1018
1022
|
state = "disconnected";
|
|
1019
1023
|
transport = null;
|
|
1020
1024
|
config;
|
|
@@ -1086,7 +1090,7 @@ class bt {
|
|
|
1086
1090
|
*/
|
|
1087
1091
|
send(e) {
|
|
1088
1092
|
if (!this.transport?.isConnected) {
|
|
1089
|
-
|
|
1093
|
+
$.warn("Cannot send: channel not connected");
|
|
1090
1094
|
return;
|
|
1091
1095
|
}
|
|
1092
1096
|
this.transport.send(e);
|
|
@@ -1108,13 +1112,13 @@ class bt {
|
|
|
1108
1112
|
switch (e.Type) {
|
|
1109
1113
|
case N.WebSocket:
|
|
1110
1114
|
case N.WebSocketProxy:
|
|
1111
|
-
this.transport = new
|
|
1115
|
+
this.transport = new Ot(s);
|
|
1112
1116
|
break;
|
|
1113
1117
|
case N.WebTransport:
|
|
1114
1118
|
case N.WebTransportProxy:
|
|
1115
|
-
if (!
|
|
1119
|
+
if (!ot())
|
|
1116
1120
|
throw new Error("WebTransport is not supported in this browser");
|
|
1117
|
-
this.transport = new
|
|
1121
|
+
this.transport = new bt(s);
|
|
1118
1122
|
break;
|
|
1119
1123
|
default:
|
|
1120
1124
|
throw new Error(`Unsupported entrypoint type: ${N[e.Type]}`);
|
|
@@ -1127,13 +1131,13 @@ class bt {
|
|
|
1127
1131
|
handleProtocolMessage(e) {
|
|
1128
1132
|
try {
|
|
1129
1133
|
const s = e;
|
|
1130
|
-
if (
|
|
1131
|
-
|
|
1134
|
+
if (z(s) === k.CORE_ON_SERVER_STOPPING) {
|
|
1135
|
+
$.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
1132
1136
|
return;
|
|
1133
1137
|
}
|
|
1134
1138
|
this.config.onProtocolMessage?.(s);
|
|
1135
1139
|
} catch (s) {
|
|
1136
|
-
|
|
1140
|
+
$.error("Failed to handle protocol message:", s), this.config.onError?.(s instanceof Error ? s : new Error(String(s)));
|
|
1137
1141
|
}
|
|
1138
1142
|
}
|
|
1139
1143
|
/**
|
|
@@ -1146,7 +1150,7 @@ class bt {
|
|
|
1146
1150
|
* Handle transport error.
|
|
1147
1151
|
*/
|
|
1148
1152
|
handleError(e) {
|
|
1149
|
-
this.config.onError?.(e), e instanceof
|
|
1153
|
+
this.config.onError?.(e), e instanceof J && this.handleClose("Keepalive timeout", !1);
|
|
1150
1154
|
}
|
|
1151
1155
|
/**
|
|
1152
1156
|
* Update and notify state change.
|
|
@@ -1155,7 +1159,7 @@ class bt {
|
|
|
1155
1159
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1156
1160
|
}
|
|
1157
1161
|
}
|
|
1158
|
-
const
|
|
1162
|
+
const A = p("ChannelManager"), Bt = 5e3;
|
|
1159
1163
|
class dt {
|
|
1160
1164
|
channels = /* @__PURE__ */ new Map();
|
|
1161
1165
|
// keyed by opcode group
|
|
@@ -1206,13 +1210,13 @@ class dt {
|
|
|
1206
1210
|
* The opcode group is extracted from the message automatically.
|
|
1207
1211
|
*/
|
|
1208
1212
|
sendProtocolMessage(e) {
|
|
1209
|
-
const s =
|
|
1213
|
+
const s = G(e);
|
|
1210
1214
|
for (const [r, n] of this.channels)
|
|
1211
1215
|
if (r & s) {
|
|
1212
1216
|
n.send(e);
|
|
1213
1217
|
return;
|
|
1214
1218
|
}
|
|
1215
|
-
this.state === "connected" &&
|
|
1219
|
+
this.state === "connected" && A.warn("No channel found for message");
|
|
1216
1220
|
}
|
|
1217
1221
|
/**
|
|
1218
1222
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -1240,7 +1244,7 @@ class dt {
|
|
|
1240
1244
|
*/
|
|
1241
1245
|
triggerReconnect(e) {
|
|
1242
1246
|
if (this.state === "connected") {
|
|
1243
|
-
|
|
1247
|
+
A.debug(`Forcing reconnect: ${e}`);
|
|
1244
1248
|
for (const s of this.channels.values())
|
|
1245
1249
|
s.triggerReconnect(e);
|
|
1246
1250
|
}
|
|
@@ -1251,43 +1255,38 @@ class dt {
|
|
|
1251
1255
|
*/
|
|
1252
1256
|
async connectInternal(e = !1) {
|
|
1253
1257
|
this.setState("connecting");
|
|
1254
|
-
|
|
1255
|
-
if (this.config.webRtcEnabled) {
|
|
1256
|
-
u.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1257
|
-
for (const i of this.entrypoints)
|
|
1258
|
-
u.debug(` Entrypoint: type=${i.Type} fromServer=0x${i.OpcodeGroupsFromServer.toString(16)} toServer=0x${i.OpcodeGroupsToServer.toString(16)} uri=${i.Uri}`);
|
|
1259
|
-
s = this.entrypoints.filter((i) => i.Type === N.WebRTC ? (u.debug(` Filtered out WebRTC entrypoint (type=${i.Type})`), !1) : !0), u.debug(`After filtering: ${s.length} entrypoints remain for WS/WT channels`);
|
|
1260
|
-
}
|
|
1261
|
-
const r = this.groupByType(s);
|
|
1258
|
+
const s = this.entrypoints.filter((i) => i.Type !== N.WebRTC), r = this.groupByType(s);
|
|
1262
1259
|
if (r.size === 0)
|
|
1263
1260
|
throw this.setState("offline"), new Error("No entrypoints available");
|
|
1264
1261
|
let n;
|
|
1265
1262
|
if (this.config.orderedEndpointTypes && this.config.orderedEndpointTypes.length > 0) {
|
|
1266
1263
|
const i = new Set(r.keys());
|
|
1267
|
-
n = this.config.orderedEndpointTypes.filter((
|
|
1264
|
+
n = this.config.orderedEndpointTypes.filter((l) => i.has(l));
|
|
1268
1265
|
} else this.config.endpointSelector ? n = this.config.endpointSelector.getOrderedTypes(r) : n = Array.from(r.keys());
|
|
1269
|
-
this.connectionTimeoutMs = n.length > 1 ? 5e3 : 1e4,
|
|
1266
|
+
this.connectionTimeoutMs = n.length > 1 ? 5e3 : 1e4, A.debug(`Endpoint types to try: [${n.map((i) => N[i]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
|
|
1270
1267
|
for (const i of n) {
|
|
1271
1268
|
if (!this.shouldReconnect)
|
|
1272
1269
|
return;
|
|
1273
|
-
const
|
|
1274
|
-
|
|
1270
|
+
const l = r.get(i), a = Date.now();
|
|
1271
|
+
A.debug(`Trying ${N[i]} (${l.length} channel(s))`);
|
|
1275
1272
|
try {
|
|
1276
|
-
await this.connectAllChannels(
|
|
1273
|
+
await this.connectAllChannels(l), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, A.debug(`Connected via ${N[i]} in ${Date.now() - a}ms`), this.setState("connected"), this.startStabilityTimer();
|
|
1277
1274
|
return;
|
|
1278
|
-
} catch (
|
|
1279
|
-
|
|
1275
|
+
} catch (o) {
|
|
1276
|
+
A.warn(`Failed to connect using ${N[i]} after ${Date.now() - a}ms: ${o instanceof Error ? o.message : o}`);
|
|
1280
1277
|
const I = this.channels.size > 0;
|
|
1281
|
-
if (this.disconnectAll(),
|
|
1278
|
+
if (this.disconnectAll(), o instanceof b)
|
|
1279
|
+
throw o;
|
|
1280
|
+
if (I && this.config.onRefreshEntrypoints)
|
|
1282
1281
|
try {
|
|
1283
|
-
|
|
1282
|
+
A.info("Partial connection detected, refreshing entrypoints");
|
|
1284
1283
|
const E = await this.config.onRefreshEntrypoints();
|
|
1285
1284
|
this.entrypoints = E.entrypoints, this.config.sessionId = E.sessionId;
|
|
1286
|
-
const h =
|
|
1285
|
+
const h = E.entrypoints.filter((c) => c.Type !== N.WebRTC), T = this.groupByType(h);
|
|
1287
1286
|
for (const [c, w] of T)
|
|
1288
1287
|
r.set(c, w);
|
|
1289
1288
|
} catch (E) {
|
|
1290
|
-
|
|
1289
|
+
A.warn(`Failed to refresh entrypoints: ${E}`);
|
|
1291
1290
|
}
|
|
1292
1291
|
}
|
|
1293
1292
|
}
|
|
@@ -1301,18 +1300,15 @@ class dt {
|
|
|
1301
1300
|
throw new Error("No entrypoints to connect");
|
|
1302
1301
|
const r = (await Promise.allSettled(e.map((n) => this.connectChannel(n)))).filter((n) => n.status === "rejected");
|
|
1303
1302
|
if (r.length > 0) {
|
|
1304
|
-
const n = r.map((i) =>
|
|
1305
|
-
|
|
1306
|
-
return a instanceof Error ? a.message : String(a);
|
|
1307
|
-
});
|
|
1308
|
-
throw new Error(n.join(", "));
|
|
1303
|
+
const n = r.map((i) => i.reason instanceof Error ? i.reason.message : String(i.reason));
|
|
1304
|
+
throw r.some((i) => i.reason instanceof b) ? new b(n.join(", ")) : new Error(n.join(", "));
|
|
1309
1305
|
}
|
|
1310
1306
|
}
|
|
1311
1307
|
/**
|
|
1312
1308
|
* Connect a single channel.
|
|
1313
1309
|
*/
|
|
1314
1310
|
async connectChannel(e) {
|
|
1315
|
-
const s = new
|
|
1311
|
+
const s = new vt({
|
|
1316
1312
|
entrypoint: e,
|
|
1317
1313
|
sessionId: this.config.sessionId,
|
|
1318
1314
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1358,7 +1354,7 @@ class dt {
|
|
|
1358
1354
|
* dropped, and we reconnect.
|
|
1359
1355
|
*/
|
|
1360
1356
|
handleChannelClose(e, s, r) {
|
|
1361
|
-
this.state === "idle" || this.state === "stopped" || this.state === "offline" || this.channels.has(e) && this.state === "connected" && (
|
|
1357
|
+
this.state === "idle" || this.state === "stopped" || this.state === "offline" || this.channels.has(e) && this.state === "connected" && (A.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1362
1358
|
}
|
|
1363
1359
|
/**
|
|
1364
1360
|
* Attempt to reconnect with fixed-interval retry.
|
|
@@ -1366,18 +1362,22 @@ class dt {
|
|
|
1366
1362
|
*/
|
|
1367
1363
|
async attemptReconnect() {
|
|
1368
1364
|
if (this.shouldReconnect) {
|
|
1369
|
-
if (!
|
|
1370
|
-
|
|
1365
|
+
if (!Pt()) {
|
|
1366
|
+
A.warn("Retry disabled via ikon-retry=false, skipping reconnect"), this.setState("offline"), this.config.onError?.(new tt(0));
|
|
1371
1367
|
return;
|
|
1372
1368
|
}
|
|
1373
1369
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1374
|
-
|
|
1370
|
+
A.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new tt(this.config.maxReconnectAttempts));
|
|
1375
1371
|
return;
|
|
1376
1372
|
}
|
|
1377
|
-
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (
|
|
1373
|
+
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (A.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await Nt(this.config.reconnectBackoffMs, this.abortController?.signal)) : A.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), !!this.shouldReconnect)
|
|
1378
1374
|
try {
|
|
1379
1375
|
await this.connectInternal(!0);
|
|
1380
|
-
} catch {
|
|
1376
|
+
} catch (e) {
|
|
1377
|
+
if (e instanceof b) {
|
|
1378
|
+
A.warn("Auth rejected during reconnect, stopping retries and signaling full re-auth"), this.config.onError?.(e), this.setState("offline");
|
|
1379
|
+
return;
|
|
1380
|
+
}
|
|
1381
1381
|
await this.attemptReconnect();
|
|
1382
1382
|
}
|
|
1383
1383
|
}
|
|
@@ -1399,83 +1399,83 @@ class dt {
|
|
|
1399
1399
|
startStabilityTimer() {
|
|
1400
1400
|
this.clearStabilityTimer(), this.stabilityTimer = setTimeout(() => {
|
|
1401
1401
|
this.stabilityTimer = null, this.state === "connected" && (this.reconnectAttempts = 0);
|
|
1402
|
-
},
|
|
1402
|
+
}, Bt);
|
|
1403
1403
|
}
|
|
1404
1404
|
clearStabilityTimer() {
|
|
1405
1405
|
this.stabilityTimer && (clearTimeout(this.stabilityTimer), this.stabilityTimer = null);
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
|
-
const
|
|
1408
|
+
const lt = p("ProtocolWorker"), g = (t, e) => {
|
|
1409
1409
|
self.postMessage(t, e ?? []);
|
|
1410
1410
|
};
|
|
1411
|
-
let
|
|
1412
|
-
const
|
|
1413
|
-
function
|
|
1411
|
+
let u = null, B = null, d = null, j, C = null;
|
|
1412
|
+
const P = [], R = [], F = /* @__PURE__ */ new Map(), U = [], f = [], L = /* @__PURE__ */ new Map(), X = [];
|
|
1413
|
+
function Q() {
|
|
1414
1414
|
try {
|
|
1415
|
-
|
|
1415
|
+
u?.disconnect();
|
|
1416
1416
|
} catch (t) {
|
|
1417
|
-
|
|
1417
|
+
lt.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1418
1418
|
}
|
|
1419
|
-
|
|
1419
|
+
u = null;
|
|
1420
1420
|
for (let t = 0; t < R.length; t++)
|
|
1421
1421
|
try {
|
|
1422
1422
|
R[t].port.close();
|
|
1423
1423
|
} catch {
|
|
1424
1424
|
}
|
|
1425
|
-
|
|
1425
|
+
P.length = 0, R.length = 0, F.clear();
|
|
1426
1426
|
for (let t = 0; t < f.length; t++)
|
|
1427
1427
|
try {
|
|
1428
1428
|
f[t].port.close();
|
|
1429
1429
|
} catch {
|
|
1430
1430
|
}
|
|
1431
|
-
|
|
1431
|
+
U.length = 0, f.length = 0, L.clear();
|
|
1432
1432
|
}
|
|
1433
|
-
function
|
|
1433
|
+
function v(t) {
|
|
1434
1434
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1435
|
-
|
|
1435
|
+
g({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1436
1436
|
}
|
|
1437
|
-
function
|
|
1437
|
+
function Ft() {
|
|
1438
1438
|
let t = 0;
|
|
1439
1439
|
for (let e = 0; e < R.length; e++)
|
|
1440
1440
|
t |= R[e].opcodeGroupsMask;
|
|
1441
1441
|
return t;
|
|
1442
1442
|
}
|
|
1443
|
-
function
|
|
1444
|
-
if (
|
|
1443
|
+
function Gt(t) {
|
|
1444
|
+
if (j === void 0)
|
|
1445
1445
|
return !0;
|
|
1446
|
-
const e =
|
|
1447
|
-
if ((e &
|
|
1446
|
+
const e = G(t);
|
|
1447
|
+
if ((e & j) !== 0)
|
|
1448
1448
|
return !0;
|
|
1449
|
-
const s =
|
|
1449
|
+
const s = Ft();
|
|
1450
1450
|
return (e & s) !== 0;
|
|
1451
1451
|
}
|
|
1452
|
-
function
|
|
1453
|
-
|
|
1452
|
+
function Et(t) {
|
|
1453
|
+
X.length = 0;
|
|
1454
1454
|
for (let e = 0; e < R.length; e++) {
|
|
1455
1455
|
const s = R[e];
|
|
1456
|
-
(s.opcodeGroupsMask & t) !== 0 &&
|
|
1456
|
+
(s.opcodeGroupsMask & t) !== 0 && X.push(s.port);
|
|
1457
1457
|
}
|
|
1458
|
-
return
|
|
1459
|
-
}
|
|
1460
|
-
function Gt(t, e) {
|
|
1461
|
-
return (F(t) & e) !== 0;
|
|
1458
|
+
return X;
|
|
1462
1459
|
}
|
|
1463
1460
|
function Vt(t, e) {
|
|
1464
|
-
|
|
1461
|
+
return (G(t) & e) !== 0;
|
|
1462
|
+
}
|
|
1463
|
+
function kt(t, e) {
|
|
1464
|
+
if (!u || !e || typeof e != "object")
|
|
1465
1465
|
return;
|
|
1466
1466
|
const s = e;
|
|
1467
1467
|
if (!(s.type !== "send" || !(s.message instanceof ArrayBuffer)))
|
|
1468
1468
|
try {
|
|
1469
1469
|
const r = new Uint8Array(s.message);
|
|
1470
|
-
if (!
|
|
1470
|
+
if (!Vt(r, t))
|
|
1471
1471
|
return;
|
|
1472
|
-
|
|
1472
|
+
u.sendProtocolMessage(r), C && C.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1473
1473
|
} catch (r) {
|
|
1474
|
-
|
|
1474
|
+
v(r);
|
|
1475
1475
|
}
|
|
1476
1476
|
}
|
|
1477
1477
|
async function pt(t) {
|
|
1478
|
-
|
|
1478
|
+
Q(), u = new dt({
|
|
1479
1479
|
sessionId: t.sessionId,
|
|
1480
1480
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1481
1481
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
@@ -1483,84 +1483,84 @@ async function pt(t) {
|
|
|
1483
1483
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1484
1484
|
webRtcEnabled: t.webRtcEnabled,
|
|
1485
1485
|
onStateChange: (e) => {
|
|
1486
|
-
|
|
1486
|
+
g({ type: "state", state: e, activeType: u?.activeEndpointType ?? void 0 });
|
|
1487
1487
|
},
|
|
1488
1488
|
onRememberWorkingType: () => {
|
|
1489
|
-
|
|
1489
|
+
g({ type: "state", state: u?.managerState ?? "idle", activeType: u?.activeEndpointType ?? void 0 });
|
|
1490
1490
|
},
|
|
1491
1491
|
onError: (e) => {
|
|
1492
|
-
|
|
1492
|
+
v(e);
|
|
1493
1493
|
},
|
|
1494
1494
|
onRefreshEntrypoints: () => new Promise((e, s) => {
|
|
1495
|
-
|
|
1495
|
+
B = e, d = s, g({ type: "refreshEntrypoints" });
|
|
1496
1496
|
}),
|
|
1497
1497
|
onProtocolMessage: (e) => {
|
|
1498
|
-
C && (C.postMessage({ direction: "received", message: Array.from(e) }),
|
|
1499
|
-
const s =
|
|
1498
|
+
C && (C.postMessage({ direction: "received", message: Array.from(e) }), z(e) === k.ANALYTICS_LOGS && C.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1499
|
+
const s = G(e), r = Gt(e), n = Et(s);
|
|
1500
1500
|
if (!(!r && n.length === 0))
|
|
1501
1501
|
try {
|
|
1502
|
-
const i =
|
|
1503
|
-
if (
|
|
1504
|
-
const
|
|
1505
|
-
n[0].postMessage({ type: "protocol", message:
|
|
1502
|
+
const i = Y(e), l = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, a = n.length > 0;
|
|
1503
|
+
if (a && !r && n.length === 1 && l) {
|
|
1504
|
+
const o = e.buffer;
|
|
1505
|
+
n[0].postMessage({ type: "protocol", message: o, headers: i }, [o]);
|
|
1506
1506
|
return;
|
|
1507
1507
|
}
|
|
1508
|
-
if (!
|
|
1509
|
-
const
|
|
1510
|
-
|
|
1508
|
+
if (!a && r && l) {
|
|
1509
|
+
const o = e.buffer;
|
|
1510
|
+
g({ type: "protocol", message: o, headers: i }, [o]);
|
|
1511
1511
|
return;
|
|
1512
1512
|
}
|
|
1513
|
-
if (
|
|
1514
|
-
const
|
|
1513
|
+
if (a && l) {
|
|
1514
|
+
const o = [];
|
|
1515
1515
|
for (let h = 1; h < n.length; h++)
|
|
1516
|
-
|
|
1516
|
+
o.push(e.slice().buffer);
|
|
1517
1517
|
const I = r ? e.slice().buffer : null, E = e.buffer;
|
|
1518
1518
|
n[0].postMessage({ type: "protocol", message: E, headers: i }, [E]);
|
|
1519
1519
|
for (let h = 1; h < n.length; h++)
|
|
1520
|
-
n[h].postMessage({ type: "protocol", message:
|
|
1521
|
-
I &&
|
|
1520
|
+
n[h].postMessage({ type: "protocol", message: o[h - 1], headers: i }, [o[h - 1]]);
|
|
1521
|
+
I && g({ type: "protocol", message: I, headers: i }, [I]);
|
|
1522
1522
|
return;
|
|
1523
1523
|
}
|
|
1524
|
-
if (
|
|
1525
|
-
for (const
|
|
1524
|
+
if (a)
|
|
1525
|
+
for (const o of n) {
|
|
1526
1526
|
const I = e.slice().buffer;
|
|
1527
|
-
|
|
1527
|
+
o.postMessage({ type: "protocol", message: I, headers: i }, [I]);
|
|
1528
1528
|
}
|
|
1529
1529
|
if (r) {
|
|
1530
|
-
const
|
|
1531
|
-
|
|
1530
|
+
const o = e.slice().buffer;
|
|
1531
|
+
g({ type: "protocol", message: o, headers: i }, [o]);
|
|
1532
1532
|
}
|
|
1533
1533
|
} catch (i) {
|
|
1534
|
-
|
|
1534
|
+
v(i);
|
|
1535
1535
|
}
|
|
1536
1536
|
}
|
|
1537
|
-
}), await
|
|
1537
|
+
}), await u.connect(t.entrypoints, { retry: t.retry });
|
|
1538
1538
|
}
|
|
1539
1539
|
self.addEventListener("message", (t) => {
|
|
1540
1540
|
const e = t.data;
|
|
1541
1541
|
if (e.type === "connect") {
|
|
1542
1542
|
pt(e).catch((s) => {
|
|
1543
|
-
|
|
1543
|
+
lt.error(`Failed to connect: ${s}`), v(s), Q();
|
|
1544
1544
|
});
|
|
1545
1545
|
return;
|
|
1546
1546
|
}
|
|
1547
1547
|
if (e.type === "disconnect") {
|
|
1548
|
-
|
|
1548
|
+
Q(), g({ type: "state", state: "idle" });
|
|
1549
1549
|
return;
|
|
1550
1550
|
}
|
|
1551
1551
|
if (e.type === "send") {
|
|
1552
|
-
if (!
|
|
1552
|
+
if (!u)
|
|
1553
1553
|
return;
|
|
1554
1554
|
try {
|
|
1555
1555
|
const s = new Uint8Array(e.message);
|
|
1556
|
-
|
|
1556
|
+
u.sendProtocolMessage(s), C && C.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1557
1557
|
} catch (s) {
|
|
1558
|
-
|
|
1558
|
+
v(s);
|
|
1559
1559
|
}
|
|
1560
1560
|
return;
|
|
1561
1561
|
}
|
|
1562
1562
|
if (e.type === "setInterest") {
|
|
1563
|
-
|
|
1563
|
+
j = e.opcodeGroupsMask;
|
|
1564
1564
|
return;
|
|
1565
1565
|
}
|
|
1566
1566
|
if (e.type === "enableDevtools") {
|
|
@@ -1568,37 +1568,37 @@ self.addEventListener("message", (t) => {
|
|
|
1568
1568
|
return;
|
|
1569
1569
|
}
|
|
1570
1570
|
if (e.type === "setLogLevel") {
|
|
1571
|
-
|
|
1571
|
+
Ut(e.level);
|
|
1572
1572
|
return;
|
|
1573
1573
|
}
|
|
1574
1574
|
if (e.type === "checkHealth") {
|
|
1575
|
-
|
|
1575
|
+
u?.checkHealth();
|
|
1576
1576
|
return;
|
|
1577
1577
|
}
|
|
1578
1578
|
if (e.type === "triggerReconnect") {
|
|
1579
|
-
|
|
1579
|
+
u?.triggerReconnect(e.reason);
|
|
1580
1580
|
return;
|
|
1581
1581
|
}
|
|
1582
1582
|
if (e.type === "refreshedEntrypoints") {
|
|
1583
|
-
|
|
1583
|
+
B && (B({ entrypoints: e.entrypoints, sessionId: e.sessionId }), B = null, d = null);
|
|
1584
1584
|
return;
|
|
1585
1585
|
}
|
|
1586
1586
|
if (e.type === "refreshEntrypointsFailed") {
|
|
1587
|
-
d && (d(new Error("Failed to refresh entrypoints")),
|
|
1587
|
+
d && (d(new Error("Failed to refresh entrypoints")), B = null, d = null);
|
|
1588
1588
|
return;
|
|
1589
1589
|
}
|
|
1590
1590
|
if (e.type === "forwardToPorts") {
|
|
1591
1591
|
try {
|
|
1592
|
-
const s = new Uint8Array(e.message), r =
|
|
1592
|
+
const s = new Uint8Array(e.message), r = G(s), n = Et(r);
|
|
1593
1593
|
if (n.length > 0) {
|
|
1594
|
-
const i =
|
|
1595
|
-
for (const
|
|
1596
|
-
const
|
|
1597
|
-
|
|
1594
|
+
const i = Y(s);
|
|
1595
|
+
for (const l of n) {
|
|
1596
|
+
const a = s.slice().buffer;
|
|
1597
|
+
l.postMessage({ type: "protocol", message: a, headers: i }, [a]);
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
1600
|
} catch (s) {
|
|
1601
|
-
|
|
1601
|
+
v(s);
|
|
1602
1602
|
}
|
|
1603
1603
|
return;
|
|
1604
1604
|
}
|
|
@@ -1607,24 +1607,24 @@ self.addEventListener("message", (t) => {
|
|
|
1607
1607
|
e.port.start?.();
|
|
1608
1608
|
} catch {
|
|
1609
1609
|
}
|
|
1610
|
-
const s =
|
|
1611
|
-
|
|
1610
|
+
const s = P.length;
|
|
1611
|
+
P.push(e.portId), R.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), F.set(e.portId, s);
|
|
1612
1612
|
return;
|
|
1613
1613
|
}
|
|
1614
1614
|
if (e.type === "detachPort") {
|
|
1615
|
-
const s =
|
|
1615
|
+
const s = F.get(e.portId);
|
|
1616
1616
|
if (s !== void 0) {
|
|
1617
1617
|
const r = R[s];
|
|
1618
1618
|
try {
|
|
1619
1619
|
r.port.close();
|
|
1620
1620
|
} catch {
|
|
1621
1621
|
}
|
|
1622
|
-
const n =
|
|
1622
|
+
const n = P.length - 1;
|
|
1623
1623
|
if (s !== n) {
|
|
1624
|
-
const i =
|
|
1625
|
-
|
|
1624
|
+
const i = P[n];
|
|
1625
|
+
P[s] = i, R[s] = R[n], F.set(i, s);
|
|
1626
1626
|
}
|
|
1627
|
-
|
|
1627
|
+
P.length--, R.length--, F.delete(e.portId);
|
|
1628
1628
|
}
|
|
1629
1629
|
return;
|
|
1630
1630
|
}
|
|
@@ -1636,21 +1636,21 @@ self.addEventListener("message", (t) => {
|
|
|
1636
1636
|
i.port.close();
|
|
1637
1637
|
} catch {
|
|
1638
1638
|
}
|
|
1639
|
-
const
|
|
1640
|
-
if (s !==
|
|
1641
|
-
const
|
|
1642
|
-
|
|
1639
|
+
const l = U.length - 1;
|
|
1640
|
+
if (s !== l) {
|
|
1641
|
+
const a = U[l];
|
|
1642
|
+
U[s] = a, f[s] = f[l], L.set(a, s);
|
|
1643
1643
|
}
|
|
1644
|
-
|
|
1644
|
+
U.length--, f.length--, L.delete(e.portId);
|
|
1645
1645
|
}
|
|
1646
|
-
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n =
|
|
1647
|
-
|
|
1646
|
+
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n = U.length;
|
|
1647
|
+
U.push(e.portId), f.push(r), L.set(e.portId, n);
|
|
1648
1648
|
try {
|
|
1649
1649
|
r.port.start?.();
|
|
1650
1650
|
} catch {
|
|
1651
1651
|
}
|
|
1652
1652
|
r.port.addEventListener("message", (i) => {
|
|
1653
|
-
|
|
1653
|
+
kt(r.opcodeGroupsMask, i.data);
|
|
1654
1654
|
});
|
|
1655
1655
|
return;
|
|
1656
1656
|
}
|
|
@@ -1662,12 +1662,12 @@ self.addEventListener("message", (t) => {
|
|
|
1662
1662
|
r.port.close();
|
|
1663
1663
|
} catch {
|
|
1664
1664
|
}
|
|
1665
|
-
const n =
|
|
1665
|
+
const n = U.length - 1;
|
|
1666
1666
|
if (s !== n) {
|
|
1667
|
-
const i =
|
|
1668
|
-
|
|
1667
|
+
const i = U[n];
|
|
1668
|
+
U[s] = i, f[s] = f[n], L.set(i, s);
|
|
1669
1669
|
}
|
|
1670
|
-
|
|
1670
|
+
U.length--, f.length--, L.delete(e.portId);
|
|
1671
1671
|
}
|
|
1672
1672
|
return;
|
|
1673
1673
|
}
|