@ikonai/sdk 1.0.44 → 1.0.45
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-capture-worker-Dmgg-yWd.js → audio-capture-worker-BnmgtUMV.js} +1 -1
- package/assets/{audio-playback-worker-MsPNs6k4.js → audio-playback-worker-os3j8TEw.js} +102 -102
- package/assets/{index-Cns_7uAI.js → index-Ca9sTcGt.js} +1 -1
- package/assets/{index-D2GAzJKe.js → index-D_vz6N3U.js} +165 -29
- package/assets/{libopus-BEPFPIM_.js → libopus-ChbDZJKA.js} +3 -3
- package/assets/{protocol-worker-4bSKGT40.js → protocol-worker-CMTcdGdm.js} +307 -262
- package/assets/{video-capture-worker-Bitll1TI.js → video-capture-worker-CUqzL0P7.js} +181 -181
- package/assets/{video-playback-worker-BQSKswID.js → video-playback-worker-BoE6foO2.js} +188 -188
- package/channel/channel-manager.d.ts +15 -0
- package/client/endpoint-selector.d.ts +7 -0
- package/client/ikon-client-config.d.ts +2 -2
- package/client/ikon-client.d.ts +6 -3
- package/connection/urls.d.ts +5 -3
- package/functions/function-registry.d.ts +16 -1
- package/functions/index.d.ts +1 -1
- package/functions/types.d.ts +2 -1
- package/index.d.ts +4 -2
- package/index.js +2162 -1939
- package/login/index.d.ts +4 -0
- package/login/login-error-interceptor.d.ts +13 -0
- package/login/login-store.d.ts +17 -0
- package/login/reprovision.d.ts +22 -0
- package/package.json +1 -1
- package/utils/query-params.d.ts +6 -0
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
function
|
|
1
|
+
function Q(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 F(t) {
|
|
7
|
+
return Q(t) & 4294901760;
|
|
8
8
|
}
|
|
9
|
-
function
|
|
10
|
-
const e =
|
|
9
|
+
function H(t) {
|
|
10
|
+
const e = It(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), o = s.getUint32(12, !0), a = s.getUint32(16, !0), l = s.getUint32(20, !0),
|
|
13
|
+
const r = s.getUint32(0, !0), n = s.getUint32(4, !0), i = s.getUint32(8, !0), o = s.getUint32(12, !0), a = s.getUint32(16, !0), l = s.getUint32(20, !0), c = s.getUint8(24), h = s.getUint8(25), I = s.getUint8(26);
|
|
14
14
|
if (27 + l * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
|
-
const
|
|
17
|
-
let
|
|
16
|
+
const _ = [];
|
|
17
|
+
let g = 27;
|
|
18
18
|
for (let O = 0; O < l; O++)
|
|
19
|
-
|
|
19
|
+
_.push(s.getUint32(g, !0)), g += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: r,
|
|
22
22
|
opcode: n,
|
|
23
23
|
senderId: i,
|
|
24
24
|
trackId: o,
|
|
25
25
|
sequenceId: a,
|
|
26
|
-
targetIds:
|
|
27
|
-
payloadVersion:
|
|
28
|
-
payloadType:
|
|
29
|
-
flags:
|
|
26
|
+
targetIds: _,
|
|
27
|
+
payloadVersion: c,
|
|
28
|
+
payloadType: h,
|
|
29
|
+
flags: I
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const l = [],
|
|
34
|
-
|
|
35
|
-
let
|
|
32
|
+
function lt(t, e, s, r, n) {
|
|
33
|
+
const l = [], h = 27 + l.length * 4, I = h + e.length, S = new Uint8Array(I), _ = new DataView(S.buffer);
|
|
34
|
+
_.setUint32(0, I, !0), _.setUint32(4, t >>> 0, !0), _.setUint32(8, r >>> 0, !0), _.setUint32(12, 0, !0), _.setUint32(16, 0, !0), _.setUint32(20, l.length >>> 0, !0), _.setUint8(24, s & 255), _.setUint8(25, 8), _.setUint8(26, 0);
|
|
35
|
+
let g = 27;
|
|
36
36
|
for (let O = 0; O < l.length; O++)
|
|
37
|
-
|
|
38
|
-
return
|
|
37
|
+
_.setUint32(g, l[O] >>> 0, !0), g += 4;
|
|
38
|
+
return S.set(e, h), S;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const
|
|
40
|
+
var P = /* @__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))(P || {});
|
|
41
|
+
const ht = 161, Et = 162, W = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
|
-
class
|
|
43
|
+
class G {
|
|
44
44
|
constructor(e = 1) {
|
|
45
|
-
this.version = e, this.buffer.writeByte(
|
|
45
|
+
this.version = e, this.buffer.writeByte(ht), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
|
-
buffer = new
|
|
47
|
+
buffer = new D();
|
|
48
48
|
closed = !1;
|
|
49
49
|
cached;
|
|
50
50
|
writeInt32Field(e, s) {
|
|
@@ -69,38 +69,38 @@ class B {
|
|
|
69
69
|
this.writeFixedField(e, 2, () => this.buffer.writeByte(s ? 1 : 0));
|
|
70
70
|
}
|
|
71
71
|
writeGuidField(e, s) {
|
|
72
|
-
const r = s instanceof
|
|
72
|
+
const r = s instanceof E ? s.asBytes() : s;
|
|
73
73
|
if (r.length !== 16)
|
|
74
74
|
throw new Error("Guid payload must be 16 bytes");
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(r));
|
|
76
76
|
}
|
|
77
77
|
writeStringField(e, s) {
|
|
78
|
-
const r =
|
|
78
|
+
const r = W.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 G(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 Y(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 j(s, r);
|
|
98
98
|
n(i);
|
|
99
99
|
const o = i.finish();
|
|
100
100
|
this.writeVariableField(e, 10, o);
|
|
101
101
|
}
|
|
102
102
|
finish() {
|
|
103
|
-
return this.closed || (this.buffer.writeByte(
|
|
103
|
+
return this.closed || (this.buffer.writeByte(Et), 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,14 +109,14 @@ class B {
|
|
|
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(K(s)), Tt(s) && this.buffer.writeVarUInt(r >>> 0);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class Y {
|
|
116
116
|
constructor(e) {
|
|
117
117
|
this.elementType = e;
|
|
118
118
|
}
|
|
119
|
-
payload = new
|
|
119
|
+
payload = new D();
|
|
120
120
|
count = 0;
|
|
121
121
|
writeInt32(e) {
|
|
122
122
|
this.ensureElementType(
|
|
@@ -165,7 +165,7 @@ class K {
|
|
|
165
165
|
14
|
|
166
166
|
/* Guid */
|
|
167
167
|
), this.count++;
|
|
168
|
-
const s = e instanceof
|
|
168
|
+
const s = e instanceof E ? e.asBytes() : e;
|
|
169
169
|
if (s.length !== 16)
|
|
170
170
|
throw new Error("Guid payload must be 16 bytes");
|
|
171
171
|
this.payload.writeBytes(s);
|
|
@@ -175,7 +175,7 @@ class K {
|
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const s =
|
|
178
|
+
const s = W.encode(e ?? "");
|
|
179
179
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
@@ -189,7 +189,7 @@ class K {
|
|
|
189
189
|
11
|
|
190
190
|
/* Object */
|
|
191
191
|
), this.count++;
|
|
192
|
-
const r = new
|
|
192
|
+
const r = new G(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 K {
|
|
|
199
199
|
9
|
|
200
200
|
/* Array */
|
|
201
201
|
), this.count++;
|
|
202
|
-
const r = new
|
|
202
|
+
const r = new Y(e);
|
|
203
203
|
s(r);
|
|
204
204
|
const n = r.finish();
|
|
205
205
|
this.payload.writeBytes(n);
|
|
@@ -209,42 +209,42 @@ class K {
|
|
|
209
209
|
10
|
|
210
210
|
/* Dict */
|
|
211
211
|
), this.count++;
|
|
212
|
-
const n = new
|
|
212
|
+
const n = new j(e, s);
|
|
213
213
|
r(n);
|
|
214
214
|
const i = n.finish();
|
|
215
215
|
this.payload.writeBytes(i);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
|
-
const e = new
|
|
219
|
-
return e.writeByte(
|
|
218
|
+
const e = new D();
|
|
219
|
+
return e.writeByte(K(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 ${P[this.elementType]}, expected ${P[e]}`);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
226
|
+
class j {
|
|
227
227
|
constructor(e, s) {
|
|
228
|
-
this.keyType = e, this.valueType = s,
|
|
228
|
+
this.keyType = e, this.valueType = s, ct(e);
|
|
229
229
|
}
|
|
230
|
-
payload = new
|
|
230
|
+
payload = new D();
|
|
231
231
|
count = 0;
|
|
232
232
|
entryOpen = !1;
|
|
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 _t(this.keyType, this.valueType, this.payload, () => {
|
|
237
237
|
this.entryOpen = !1;
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
finish() {
|
|
241
241
|
if (this.entryOpen)
|
|
242
242
|
throw new Error("Dictionary entry not completed");
|
|
243
|
-
const e = new
|
|
244
|
-
return e.writeByte(
|
|
243
|
+
const e = new D();
|
|
244
|
+
return e.writeByte(K(this.keyType)), e.writeByte(K(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
|
-
class
|
|
247
|
+
class _t {
|
|
248
248
|
constructor(e, s, r, n) {
|
|
249
249
|
this.keyType = e, this.valueType = s, this.payload = r, this.onComplete = n;
|
|
250
250
|
}
|
|
@@ -298,7 +298,7 @@ class lt {
|
|
|
298
298
|
14
|
|
299
299
|
/* Guid */
|
|
300
300
|
);
|
|
301
|
-
const s = e instanceof
|
|
301
|
+
const s = e instanceof E ? e.asBytes() : e;
|
|
302
302
|
if (s.length !== 16)
|
|
303
303
|
throw new Error("Guid payload must be 16 bytes");
|
|
304
304
|
this.payload.writeBytes(s), this.keyWritten = !0;
|
|
@@ -308,7 +308,7 @@ class lt {
|
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const s =
|
|
311
|
+
const s = W.encode(e ?? "");
|
|
312
312
|
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
@@ -364,7 +364,7 @@ class lt {
|
|
|
364
364
|
14
|
|
365
365
|
/* Guid */
|
|
366
366
|
);
|
|
367
|
-
const s = e instanceof
|
|
367
|
+
const s = e instanceof E ? e.asBytes() : e;
|
|
368
368
|
if (s.length !== 16)
|
|
369
369
|
throw new Error("Guid payload must be 16 bytes");
|
|
370
370
|
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
@@ -386,7 +386,7 @@ class lt {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const s =
|
|
389
|
+
const s = W.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 lt {
|
|
|
394
394
|
11
|
|
395
395
|
/* Object */
|
|
396
396
|
);
|
|
397
|
-
const r = new
|
|
397
|
+
const r = new G(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 lt {
|
|
|
404
404
|
9
|
|
405
405
|
/* Array */
|
|
406
406
|
);
|
|
407
|
-
const r = new
|
|
407
|
+
const r = new Y(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 lt {
|
|
|
414
414
|
10
|
|
415
415
|
/* Dict */
|
|
416
416
|
);
|
|
417
|
-
const n = new
|
|
417
|
+
const n = new j(e, s);
|
|
418
418
|
r(n);
|
|
419
419
|
const i = n.finish();
|
|
420
420
|
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
@@ -428,14 +428,14 @@ class lt {
|
|
|
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 ${P[this.keyType]}, expected ${P[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 ${P[this.valueType]}, expected ${P[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
class
|
|
438
|
+
class E {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
this.bytes = e;
|
|
441
441
|
}
|
|
@@ -445,19 +445,19 @@ class h {
|
|
|
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 =
|
|
449
|
-
|
|
448
|
+
const r = new Uint8Array(16), n = E.parseHexSlice(s, 0, 8), i = E.parseHexSlice(s, 8, 4), o = E.parseHexSlice(s, 12, 4);
|
|
449
|
+
E.writeUInt32LE(r, 0, n), E.writeUInt16LE(r, 4, i), E.writeUInt16LE(r, 6, o);
|
|
450
450
|
for (let a = 0; a < 8; a++)
|
|
451
|
-
r[8 + a] =
|
|
452
|
-
return new
|
|
451
|
+
r[8 + a] = E.parseHexSlice(s, 16 + a * 2, 2);
|
|
452
|
+
return new E(r);
|
|
453
453
|
}
|
|
454
454
|
static fromBytes(e) {
|
|
455
455
|
if (e.length !== 16)
|
|
456
456
|
throw new Error("Guid byte array must be 16 bytes");
|
|
457
|
-
return new
|
|
457
|
+
return new E(Uint8Array.from(e));
|
|
458
458
|
}
|
|
459
459
|
static createZero() {
|
|
460
|
-
return new
|
|
460
|
+
return new E(new Uint8Array(16));
|
|
461
461
|
}
|
|
462
462
|
static createRandom() {
|
|
463
463
|
const e = new Uint8Array(16), s = globalThis.crypto;
|
|
@@ -466,16 +466,16 @@ class h {
|
|
|
466
466
|
else
|
|
467
467
|
for (let r = 0; r < e.length; r++)
|
|
468
468
|
e[r] = Math.floor(Math.random() * 256);
|
|
469
|
-
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new
|
|
469
|
+
return e[6] = e[6] & 15 | 64, e[8] = e[8] & 63 | 128, new E(e);
|
|
470
470
|
}
|
|
471
471
|
toString() {
|
|
472
472
|
const e = this.bytes;
|
|
473
473
|
return [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
474
|
+
E.toHex(E.readUInt32LE(e, 0), 8),
|
|
475
|
+
E.toHex(E.readUInt16LE(e, 4), 4),
|
|
476
|
+
E.toHex(E.readUInt16LE(e, 6), 4),
|
|
477
|
+
J(e.subarray(8, 10)),
|
|
478
|
+
J(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
480
480
|
}
|
|
481
481
|
asBytes() {
|
|
@@ -505,13 +505,13 @@ class h {
|
|
|
505
505
|
return (e >>> 0).toString(16).padStart(s, "0");
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
class
|
|
508
|
+
class D {
|
|
509
509
|
static INITIAL_CAPACITY = 256;
|
|
510
510
|
buffer;
|
|
511
511
|
dataView;
|
|
512
512
|
length = 0;
|
|
513
513
|
constructor() {
|
|
514
|
-
this.buffer = new Uint8Array(
|
|
514
|
+
this.buffer = new Uint8Array(D.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
515
515
|
}
|
|
516
516
|
ensureCapacity(e) {
|
|
517
517
|
const s = this.length + e;
|
|
@@ -557,57 +557,57 @@ class m {
|
|
|
557
557
|
return this.buffer.slice(0, this.length);
|
|
558
558
|
}
|
|
559
559
|
}
|
|
560
|
-
function
|
|
560
|
+
function K(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 Tt(t) {
|
|
566
566
|
return t === 12 || t === 13 || t === 9 || t === 11 || t === 10;
|
|
567
567
|
}
|
|
568
|
-
function
|
|
568
|
+
function ct(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 J(t) {
|
|
573
573
|
return Array.from(t).map((e) => e.toString(16).padStart(2, "0")).join("");
|
|
574
574
|
}
|
|
575
|
-
function
|
|
575
|
+
function It(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
578
|
-
var C = /* @__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))(C || {}), F = /* @__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_RELAY_AGENT_HELLO = 65576] = "CORE_RELAY_AGENT_HELLO", t[t.CORE_RELAY_HELLO = 65577] = "CORE_RELAY_HELLO", 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.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.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.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.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(F || {});
|
|
579
|
-
const
|
|
580
|
-
function
|
|
578
|
+
var A = /* @__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))(A || {}), p = /* @__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_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.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))(p || {});
|
|
579
|
+
const et = 1, At = 131074;
|
|
580
|
+
function st(t) {
|
|
581
581
|
return {};
|
|
582
582
|
}
|
|
583
|
-
function
|
|
584
|
-
return new
|
|
583
|
+
function ut(t) {
|
|
584
|
+
return new G(et).finish();
|
|
585
585
|
}
|
|
586
|
-
function
|
|
587
|
-
const r =
|
|
588
|
-
return
|
|
586
|
+
function rt(t, e, s) {
|
|
587
|
+
const r = ut();
|
|
588
|
+
return lt(At, r, et, e);
|
|
589
589
|
}
|
|
590
|
-
class
|
|
590
|
+
class nt 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 U extends nt {
|
|
596
596
|
constructor(e, s) {
|
|
597
597
|
super(e, s), this.name = "TransportError";
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
class
|
|
600
|
+
class q extends U {
|
|
601
601
|
constructor(e) {
|
|
602
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class
|
|
605
|
+
class Z extends nt {
|
|
606
606
|
constructor(e) {
|
|
607
607
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
|
-
function
|
|
610
|
+
function Ct(t, e) {
|
|
611
611
|
return new Promise((s, r) => {
|
|
612
612
|
const n = () => {
|
|
613
613
|
clearTimeout(i), r(new Error("Aborted"));
|
|
@@ -621,19 +621,19 @@ function At(t, e) {
|
|
|
621
621
|
e?.addEventListener("abort", n, { once: !0 });
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
|
-
let
|
|
625
|
-
const
|
|
624
|
+
let ft = 1;
|
|
625
|
+
const Nt = /* @__PURE__ */ new Map(), Rt = {
|
|
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 yt(t, e) {
|
|
633
633
|
return `[${t}] ${e}`;
|
|
634
634
|
}
|
|
635
|
-
function
|
|
636
|
-
const n = (/* @__PURE__ */ new Date()).toISOString(), i =
|
|
635
|
+
function k(t, e, s, r) {
|
|
636
|
+
const n = (/* @__PURE__ */ new Date()).toISOString(), i = Rt[t], o = {
|
|
637
637
|
timestamp: n,
|
|
638
638
|
level: t,
|
|
639
639
|
levelName: i,
|
|
@@ -641,16 +641,16 @@ function V(t, e, s, r) {
|
|
|
641
641
|
message: s,
|
|
642
642
|
args: r
|
|
643
643
|
};
|
|
644
|
-
for (const [a, l] of
|
|
645
|
-
const
|
|
646
|
-
if (t >=
|
|
644
|
+
for (const [a, l] of Nt) {
|
|
645
|
+
const c = l?.minLevel ?? 2;
|
|
646
|
+
if (t >= c)
|
|
647
647
|
try {
|
|
648
648
|
a(o);
|
|
649
649
|
} catch {
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
if (
|
|
653
|
-
const a =
|
|
652
|
+
if (ft <= t) {
|
|
653
|
+
const a = yt(e, s);
|
|
654
654
|
switch (t) {
|
|
655
655
|
case 0:
|
|
656
656
|
console.debug(a, ...r);
|
|
@@ -667,24 +667,41 @@ function V(t, e, s, r) {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function V(t) {
|
|
671
671
|
return {
|
|
672
672
|
debug(e, ...s) {
|
|
673
|
-
|
|
673
|
+
k(0, t, e, s);
|
|
674
674
|
},
|
|
675
675
|
info(e, ...s) {
|
|
676
|
-
|
|
676
|
+
k(1, t, e, s);
|
|
677
677
|
},
|
|
678
678
|
warn(e, ...s) {
|
|
679
|
-
|
|
679
|
+
k(2, t, e, s);
|
|
680
680
|
},
|
|
681
681
|
error(e, ...s) {
|
|
682
|
-
|
|
682
|
+
k(3, t, e, s);
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
const
|
|
687
|
-
|
|
686
|
+
const Ut = "ikon-retry";
|
|
687
|
+
function St(t, e) {
|
|
688
|
+
if (typeof window > "u")
|
|
689
|
+
return null;
|
|
690
|
+
const s = new URLSearchParams(window.location.search), r = s.get(t);
|
|
691
|
+
if (r !== null)
|
|
692
|
+
return r;
|
|
693
|
+
const n = s.get(t.replace(/-/g, "_"));
|
|
694
|
+
return n !== null ? n : null;
|
|
695
|
+
}
|
|
696
|
+
function wt(t, e) {
|
|
697
|
+
const s = St(t);
|
|
698
|
+
return s === "true" ? !0 : s === "false" ? !1 : null;
|
|
699
|
+
}
|
|
700
|
+
function Lt() {
|
|
701
|
+
return wt(Ut) !== !1;
|
|
702
|
+
}
|
|
703
|
+
const b = V("WebSocketTransport"), gt = 1e4;
|
|
704
|
+
class mt {
|
|
688
705
|
ws = null;
|
|
689
706
|
keepaliveTimeout = null;
|
|
690
707
|
isClosed = !1;
|
|
@@ -695,7 +712,7 @@ class Ut {
|
|
|
695
712
|
callbacks;
|
|
696
713
|
sessionId;
|
|
697
714
|
constructor(e) {
|
|
698
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ??
|
|
715
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? gt;
|
|
699
716
|
}
|
|
700
717
|
get isConnected() {
|
|
701
718
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
@@ -706,36 +723,36 @@ class Ut {
|
|
|
706
723
|
return new Promise((n, i) => {
|
|
707
724
|
try {
|
|
708
725
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
709
|
-
} catch (
|
|
710
|
-
i(new
|
|
726
|
+
} catch (h) {
|
|
727
|
+
i(new U(`Failed to create WebSocket: ${h}`, h instanceof Error ? h : void 0));
|
|
711
728
|
return;
|
|
712
729
|
}
|
|
713
730
|
let o = !1, a = !1;
|
|
714
731
|
const l = () => {
|
|
715
|
-
clearTimeout(
|
|
716
|
-
},
|
|
717
|
-
a || (a = !0, l(), this.ws?.close(),
|
|
732
|
+
clearTimeout(c), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
733
|
+
}, c = setTimeout(() => {
|
|
734
|
+
a || (a = !0, l(), this.ws?.close(), b.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), i(new U("WebSocket connection timeout")));
|
|
718
735
|
}, this.connectionTimeoutMs);
|
|
719
736
|
this.ws.onopen = () => {
|
|
720
|
-
o = !0, clearTimeout(
|
|
737
|
+
o = !0, clearTimeout(c), this.ws.send(s), this.resetKeepaliveTimeout(), a || (a = !0, b.info(`WebSocket connected in ${Date.now() - r}ms`), n());
|
|
721
738
|
}, this.ws.onerror = () => {
|
|
722
|
-
clearTimeout(
|
|
723
|
-
}, this.ws.onclose = (
|
|
739
|
+
clearTimeout(c), a || (a = !0, l(), b.warn(`WebSocket connection failed after ${Date.now() - r}ms`), i(new U("WebSocket connection failed")));
|
|
740
|
+
}, this.ws.onclose = (h) => {
|
|
724
741
|
if (this.clearKeepaliveTimeout(), !o && !a) {
|
|
725
|
-
a = !0, l(), i(new
|
|
742
|
+
a = !0, l(), i(new U("WebSocket connection closed before opening"));
|
|
726
743
|
return;
|
|
727
744
|
}
|
|
728
745
|
if (this.isClosed)
|
|
729
746
|
return;
|
|
730
|
-
const
|
|
731
|
-
this.callbacks.onClose(
|
|
732
|
-
}, this.ws.onmessage = (
|
|
733
|
-
this.handleProtocolMessage(new Uint8Array(
|
|
747
|
+
const I = h.wasClean && (h.code === 1e3 || h.code === 1001), S = h.code === 1e3 || h.code === 1001, _ = h.reason || `code=${h.code}`;
|
|
748
|
+
this.callbacks.onClose(_, I, S);
|
|
749
|
+
}, this.ws.onmessage = (h) => {
|
|
750
|
+
this.handleProtocolMessage(new Uint8Array(h.data));
|
|
734
751
|
};
|
|
735
752
|
});
|
|
736
753
|
}
|
|
737
754
|
send(e) {
|
|
738
|
-
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) :
|
|
755
|
+
this.ws?.readyState === WebSocket.OPEN ? this.ws.send(e) : b.warn("Cannot send: WebSocket not connected");
|
|
739
756
|
}
|
|
740
757
|
close() {
|
|
741
758
|
this.isClosed = !0, this.clearKeepaliveTimeout(), this.ws && (this.ws.close(1e3, "Client closing"), this.ws = null);
|
|
@@ -744,33 +761,33 @@ class Ut {
|
|
|
744
761
|
* Get or create a cached keepalive response message.
|
|
745
762
|
*/
|
|
746
763
|
getKeepaliveResponse() {
|
|
747
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage =
|
|
764
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(st(), this.sessionId)), this.keepaliveResponseMessage;
|
|
748
765
|
}
|
|
749
766
|
handleProtocolMessage(e) {
|
|
750
767
|
try {
|
|
751
|
-
if (
|
|
768
|
+
if (H(e).opcode === p.KEEPALIVE_REQUEST) {
|
|
752
769
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
753
770
|
return;
|
|
754
771
|
}
|
|
755
772
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
756
773
|
} catch (s) {
|
|
757
|
-
|
|
774
|
+
b.error("Failed to process protocol message:", s), this.callbacks.onError(s instanceof Error ? s : new Error(String(s)));
|
|
758
775
|
}
|
|
759
776
|
}
|
|
760
777
|
resetKeepaliveTimeout() {
|
|
761
778
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
762
|
-
|
|
779
|
+
b.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new q(this.keepaliveTimeoutMs)), this.close();
|
|
763
780
|
}, this.keepaliveTimeoutMs);
|
|
764
781
|
}
|
|
765
782
|
clearKeepaliveTimeout() {
|
|
766
783
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
767
784
|
}
|
|
768
785
|
}
|
|
769
|
-
const
|
|
770
|
-
function
|
|
786
|
+
const y = V("WebTransportTransport"), Pt = 1e4, tt = 4, Dt = 65536;
|
|
787
|
+
function it() {
|
|
771
788
|
return typeof WebTransport < "u";
|
|
772
789
|
}
|
|
773
|
-
class
|
|
790
|
+
class Ot {
|
|
774
791
|
transport = null;
|
|
775
792
|
stream = null;
|
|
776
793
|
reader = null;
|
|
@@ -779,7 +796,7 @@ class wt {
|
|
|
779
796
|
readLoopActive = !1;
|
|
780
797
|
isClosed = !1;
|
|
781
798
|
// Grow-only receive buffer with offset/length tracking to minimize allocations
|
|
782
|
-
receiveBuffer = new Uint8Array(
|
|
799
|
+
receiveBuffer = new Uint8Array(Dt);
|
|
783
800
|
receiveBufferOffset = 0;
|
|
784
801
|
receiveBufferLength = 0;
|
|
785
802
|
// Cached DataView to avoid allocation per message
|
|
@@ -792,14 +809,14 @@ class wt {
|
|
|
792
809
|
callbacks;
|
|
793
810
|
sessionId;
|
|
794
811
|
constructor(e) {
|
|
795
|
-
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ??
|
|
812
|
+
this.callbacks = e.callbacks, this.sessionId = e.sessionId, this.keepaliveTimeoutMs = e.keepaliveTimeoutMs, this.connectionTimeoutMs = e.connectionTimeoutMs ?? Pt;
|
|
796
813
|
}
|
|
797
814
|
get isConnected() {
|
|
798
815
|
return this.transport !== null && this.writer !== null;
|
|
799
816
|
}
|
|
800
817
|
async connect(e, s) {
|
|
801
|
-
if (!
|
|
802
|
-
throw new
|
|
818
|
+
if (!it())
|
|
819
|
+
throw new U("WebTransport is not supported in this browser");
|
|
803
820
|
this.isClosed = !1;
|
|
804
821
|
const r = Date.now();
|
|
805
822
|
try {
|
|
@@ -807,33 +824,33 @@ class wt {
|
|
|
807
824
|
let n;
|
|
808
825
|
const i = new Promise((o, a) => {
|
|
809
826
|
n = setTimeout(
|
|
810
|
-
() => a(new
|
|
827
|
+
() => a(new U("WebTransport connection timeout")),
|
|
811
828
|
this.connectionTimeoutMs
|
|
812
829
|
);
|
|
813
830
|
});
|
|
814
831
|
try {
|
|
815
832
|
await Promise.race([this.transport.ready, i]), clearTimeout(n);
|
|
816
833
|
} catch (o) {
|
|
817
|
-
throw clearTimeout(n), o instanceof
|
|
834
|
+
throw clearTimeout(n), o instanceof U && y.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), o;
|
|
818
835
|
}
|
|
819
|
-
|
|
836
|
+
y.info(`WebTransport connected in ${Date.now() - r}ms`), this.transport.closed.then(() => {
|
|
820
837
|
this.handleClose("Connection closed", !0);
|
|
821
838
|
}).catch((o) => {
|
|
822
|
-
|
|
839
|
+
y.error("WebTransport connection closed with error:", o), this.handleClose(o.message || "Connection error", !1);
|
|
823
840
|
}), 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();
|
|
824
841
|
} catch (n) {
|
|
825
842
|
this.cleanup();
|
|
826
843
|
const i = Date.now() - r;
|
|
827
|
-
throw
|
|
844
|
+
throw y.warn(`WebTransport connection failed after ${i}ms: ${n}`), new U(`Failed to connect WebTransport: ${n}`, n instanceof Error ? n : void 0);
|
|
828
845
|
}
|
|
829
846
|
}
|
|
830
847
|
send(e) {
|
|
831
848
|
if (!this.writer) {
|
|
832
|
-
|
|
849
|
+
y.warn("Cannot send: WebTransport not connected");
|
|
833
850
|
return;
|
|
834
851
|
}
|
|
835
852
|
this.writer.write(e).catch((s) => {
|
|
836
|
-
|
|
853
|
+
y.error("Failed to send protocol message:", s), this.callbacks.onError(s instanceof Error ? s : new Error(String(s)));
|
|
837
854
|
});
|
|
838
855
|
}
|
|
839
856
|
close() {
|
|
@@ -854,7 +871,7 @@ class wt {
|
|
|
854
871
|
}
|
|
855
872
|
this.readLoopActive && this.handleClose("Stream ended", !1);
|
|
856
873
|
} catch (e) {
|
|
857
|
-
this.readLoopActive && (
|
|
874
|
+
this.readLoopActive && (y.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : new Error(String(e))));
|
|
858
875
|
}
|
|
859
876
|
}
|
|
860
877
|
}
|
|
@@ -883,7 +900,7 @@ class wt {
|
|
|
883
900
|
* Get or create a cached keepalive response message.
|
|
884
901
|
*/
|
|
885
902
|
getKeepaliveResponse() {
|
|
886
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage =
|
|
903
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(st(), this.sessionId)), this.keepaliveResponseMessage;
|
|
887
904
|
}
|
|
888
905
|
/**
|
|
889
906
|
* Process complete messages from the receive buffer.
|
|
@@ -892,10 +909,10 @@ class wt {
|
|
|
892
909
|
*/
|
|
893
910
|
processBufferedMessages() {
|
|
894
911
|
const e = this.getReceiveDataView();
|
|
895
|
-
for (; this.receiveBufferLength >=
|
|
912
|
+
for (; this.receiveBufferLength >= tt; ) {
|
|
896
913
|
const s = e.getUint32(this.receiveBufferOffset, !0);
|
|
897
|
-
if (s <
|
|
898
|
-
|
|
914
|
+
if (s < tt) {
|
|
915
|
+
y.error(`Invalid message length: ${s}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${s}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
899
916
|
return;
|
|
900
917
|
}
|
|
901
918
|
if (this.receiveBufferLength < s)
|
|
@@ -910,13 +927,13 @@ class wt {
|
|
|
910
927
|
*/
|
|
911
928
|
handleProtocolMessage(e) {
|
|
912
929
|
try {
|
|
913
|
-
if (
|
|
930
|
+
if (H(e).opcode === p.KEEPALIVE_REQUEST) {
|
|
914
931
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
915
932
|
return;
|
|
916
933
|
}
|
|
917
934
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
918
935
|
} catch (s) {
|
|
919
|
-
|
|
936
|
+
y.error("Failed to process protocol message:", s), this.callbacks.onError(s instanceof Error ? s : new Error(String(s)));
|
|
920
937
|
}
|
|
921
938
|
}
|
|
922
939
|
/**
|
|
@@ -930,7 +947,7 @@ class wt {
|
|
|
930
947
|
*/
|
|
931
948
|
resetKeepaliveTimeout() {
|
|
932
949
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
933
|
-
|
|
950
|
+
y.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new q(this.keepaliveTimeoutMs)), this.close();
|
|
934
951
|
}, this.keepaliveTimeoutMs);
|
|
935
952
|
}
|
|
936
953
|
/**
|
|
@@ -952,8 +969,8 @@ class wt {
|
|
|
952
969
|
}
|
|
953
970
|
}
|
|
954
971
|
}
|
|
955
|
-
const
|
|
956
|
-
class
|
|
972
|
+
const x = V("Channel");
|
|
973
|
+
class bt {
|
|
957
974
|
state = "disconnected";
|
|
958
975
|
transport = null;
|
|
959
976
|
config;
|
|
@@ -1016,7 +1033,7 @@ class Lt {
|
|
|
1016
1033
|
*/
|
|
1017
1034
|
send(e) {
|
|
1018
1035
|
if (!this.transport?.isConnected) {
|
|
1019
|
-
|
|
1036
|
+
x.warn("Cannot send: channel not connected");
|
|
1020
1037
|
return;
|
|
1021
1038
|
}
|
|
1022
1039
|
this.transport.send(e);
|
|
@@ -1036,18 +1053,18 @@ class Lt {
|
|
|
1036
1053
|
}
|
|
1037
1054
|
};
|
|
1038
1055
|
switch (e.Type) {
|
|
1039
|
-
case
|
|
1040
|
-
case
|
|
1041
|
-
this.transport = new
|
|
1056
|
+
case A.WebSocket:
|
|
1057
|
+
case A.WebSocketProxy:
|
|
1058
|
+
this.transport = new mt(s);
|
|
1042
1059
|
break;
|
|
1043
|
-
case
|
|
1044
|
-
case
|
|
1045
|
-
if (!
|
|
1060
|
+
case A.WebTransport:
|
|
1061
|
+
case A.WebTransportProxy:
|
|
1062
|
+
if (!it())
|
|
1046
1063
|
throw new Error("WebTransport is not supported in this browser");
|
|
1047
|
-
this.transport = new
|
|
1064
|
+
this.transport = new Ot(s);
|
|
1048
1065
|
break;
|
|
1049
1066
|
default:
|
|
1050
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1067
|
+
throw new Error(`Unsupported entrypoint type: ${A[e.Type]}`);
|
|
1051
1068
|
}
|
|
1052
1069
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
1053
1070
|
}
|
|
@@ -1057,13 +1074,13 @@ class Lt {
|
|
|
1057
1074
|
handleProtocolMessage(e) {
|
|
1058
1075
|
try {
|
|
1059
1076
|
const s = e;
|
|
1060
|
-
if (
|
|
1061
|
-
|
|
1077
|
+
if (Q(s) === p.CORE_ON_SERVER_STOPPING) {
|
|
1078
|
+
x.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
1062
1079
|
return;
|
|
1063
1080
|
}
|
|
1064
1081
|
this.config.onProtocolMessage?.(s);
|
|
1065
1082
|
} catch (s) {
|
|
1066
|
-
|
|
1083
|
+
x.error("Failed to handle protocol message:", s), this.config.onError?.(s instanceof Error ? s : new Error(String(s)));
|
|
1067
1084
|
}
|
|
1068
1085
|
}
|
|
1069
1086
|
/**
|
|
@@ -1076,7 +1093,7 @@ class Lt {
|
|
|
1076
1093
|
* Handle transport error.
|
|
1077
1094
|
*/
|
|
1078
1095
|
handleError(e) {
|
|
1079
|
-
this.config.onError?.(e), e instanceof
|
|
1096
|
+
this.config.onError?.(e), e instanceof q && this.handleClose("Keepalive timeout", !1);
|
|
1080
1097
|
}
|
|
1081
1098
|
/**
|
|
1082
1099
|
* Update and notify state change.
|
|
@@ -1085,8 +1102,8 @@ class Lt {
|
|
|
1085
1102
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1086
1103
|
}
|
|
1087
1104
|
}
|
|
1088
|
-
const
|
|
1089
|
-
class
|
|
1105
|
+
const T = V("ChannelManager");
|
|
1106
|
+
class dt {
|
|
1090
1107
|
channels = /* @__PURE__ */ new Map();
|
|
1091
1108
|
// keyed by opcode group
|
|
1092
1109
|
activeType = null;
|
|
@@ -1138,13 +1155,13 @@ class gt {
|
|
|
1138
1155
|
* The opcode group is extracted from the message automatically.
|
|
1139
1156
|
*/
|
|
1140
1157
|
sendProtocolMessage(e) {
|
|
1141
|
-
const s =
|
|
1158
|
+
const s = F(e);
|
|
1142
1159
|
for (const [r, n] of this.channels)
|
|
1143
1160
|
if (r & s) {
|
|
1144
1161
|
n.send(e);
|
|
1145
1162
|
return;
|
|
1146
1163
|
}
|
|
1147
|
-
this.state === "connected" &&
|
|
1164
|
+
this.state === "connected" && T.warn("No channel found for message");
|
|
1148
1165
|
}
|
|
1149
1166
|
/**
|
|
1150
1167
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -1172,10 +1189,10 @@ class gt {
|
|
|
1172
1189
|
this.setState("connecting");
|
|
1173
1190
|
let s = this.entrypoints;
|
|
1174
1191
|
if (this.config.webRtcEnabled) {
|
|
1175
|
-
|
|
1192
|
+
T.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1176
1193
|
for (const i of this.entrypoints)
|
|
1177
|
-
|
|
1178
|
-
s = this.entrypoints.filter((i) => i.Type ===
|
|
1194
|
+
T.debug(` Entrypoint: type=${i.Type} fromServer=0x${i.OpcodeGroupsFromServer.toString(16)} toServer=0x${i.OpcodeGroupsToServer.toString(16)} uri=${i.Uri}`);
|
|
1195
|
+
s = this.entrypoints.filter((i) => i.Type === A.WebRTC ? (T.debug(` Filtered out WebRTC entrypoint (type=${i.Type})`), !1) : !0), T.debug(`After filtering: ${s.length} entrypoints remain for WS/WT channels`);
|
|
1179
1196
|
}
|
|
1180
1197
|
const r = this.groupByType(s);
|
|
1181
1198
|
if (r.size === 0)
|
|
@@ -1189,17 +1206,29 @@ class gt {
|
|
|
1189
1206
|
const i = n.filter((a) => !this.demotedTypes.has(a)), o = n.filter((a) => this.demotedTypes.has(a));
|
|
1190
1207
|
n = [...i, ...o];
|
|
1191
1208
|
}
|
|
1192
|
-
this.connectionTimeoutMs = n.length > 1 ? 5e3 : 1e4,
|
|
1209
|
+
this.connectionTimeoutMs = n.length > 1 ? 5e3 : 1e4, T.info(`Endpoint types to try: [${n.map((i) => A[i]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
|
|
1193
1210
|
for (const i of n) {
|
|
1194
1211
|
if (!this.shouldReconnect)
|
|
1195
1212
|
return;
|
|
1196
1213
|
const o = r.get(i), a = Date.now();
|
|
1197
|
-
|
|
1214
|
+
T.info(`Trying ${A[i]} (${o.length} channel(s))`);
|
|
1198
1215
|
try {
|
|
1199
|
-
await this.connectAllChannels(o), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, this.startStabilityTimer(),
|
|
1216
|
+
await this.connectAllChannels(o), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, this.startStabilityTimer(), T.info(`Connected via ${A[i]} in ${Date.now() - a}ms`), this.setState("connected");
|
|
1200
1217
|
return;
|
|
1201
1218
|
} catch (l) {
|
|
1202
|
-
|
|
1219
|
+
T.warn(`Failed to connect using ${A[i]} after ${Date.now() - a}ms: ${l instanceof Error ? l.message : l}`);
|
|
1220
|
+
const c = this.channels.size > 0;
|
|
1221
|
+
if (this.disconnectAll(), c && this.config.onRefreshEntrypoints)
|
|
1222
|
+
try {
|
|
1223
|
+
T.info("Partial connection detected, refreshing entrypoints");
|
|
1224
|
+
const h = await this.config.onRefreshEntrypoints();
|
|
1225
|
+
this.entrypoints = h.entrypoints, this.config.sessionId = h.sessionId;
|
|
1226
|
+
const I = this.config.webRtcEnabled ? h.entrypoints.filter((_) => _.Type !== A.WebRTC) : h.entrypoints, S = this.groupByType(I);
|
|
1227
|
+
for (const [_, g] of S)
|
|
1228
|
+
r.set(_, g);
|
|
1229
|
+
} catch (h) {
|
|
1230
|
+
T.warn(`Failed to refresh entrypoints: ${h}`);
|
|
1231
|
+
}
|
|
1203
1232
|
}
|
|
1204
1233
|
}
|
|
1205
1234
|
throw e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
@@ -1223,7 +1252,7 @@ class gt {
|
|
|
1223
1252
|
* Connect a single channel.
|
|
1224
1253
|
*/
|
|
1225
1254
|
async connectChannel(e) {
|
|
1226
|
-
const s = new
|
|
1255
|
+
const s = new bt({
|
|
1227
1256
|
entrypoint: e,
|
|
1228
1257
|
sessionId: this.config.sessionId,
|
|
1229
1258
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1266,10 +1295,10 @@ class gt {
|
|
|
1266
1295
|
handleChannelClose(e, s, r, n) {
|
|
1267
1296
|
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline") && this.channels.has(e)) {
|
|
1268
1297
|
if (n) {
|
|
1269
|
-
|
|
1298
|
+
T.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1270
1299
|
return;
|
|
1271
1300
|
}
|
|
1272
|
-
this.state === "connected" && (!this.connectionStable && this.activeType !== null && (
|
|
1301
|
+
this.state === "connected" && (!this.connectionStable && this.activeType !== null && !this.config.hasTransportConstraint && (T.warn(`Demoting unstable type ${A[this.activeType]}`), this.demotedTypes.add(this.activeType)), T.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1273
1302
|
}
|
|
1274
1303
|
}
|
|
1275
1304
|
/**
|
|
@@ -1278,11 +1307,15 @@ class gt {
|
|
|
1278
1307
|
*/
|
|
1279
1308
|
async attemptReconnect() {
|
|
1280
1309
|
if (this.shouldReconnect) {
|
|
1310
|
+
if (!Lt()) {
|
|
1311
|
+
T.warn("Retry disabled via ikon-retry=false, skipping reconnect"), this.setState("offline"), this.config.onError?.(new Z(0));
|
|
1312
|
+
return;
|
|
1313
|
+
}
|
|
1281
1314
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1282
|
-
|
|
1315
|
+
T.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Z(this.config.maxReconnectAttempts));
|
|
1283
1316
|
return;
|
|
1284
1317
|
}
|
|
1285
|
-
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (
|
|
1318
|
+
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (T.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await Ct(this.config.reconnectBackoffMs, this.abortController?.signal)) : T.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), !!this.shouldReconnect)
|
|
1286
1319
|
try {
|
|
1287
1320
|
await this.connectInternal(!0);
|
|
1288
1321
|
} catch {
|
|
@@ -1321,98 +1354,102 @@ class gt {
|
|
|
1321
1354
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1322
1355
|
}
|
|
1323
1356
|
}
|
|
1324
|
-
const
|
|
1357
|
+
const at = V("ProtocolWorker"), L = (t, e) => {
|
|
1325
1358
|
self.postMessage(t, e ?? []);
|
|
1326
1359
|
};
|
|
1327
|
-
let
|
|
1328
|
-
const
|
|
1329
|
-
function
|
|
1360
|
+
let f = null, M = null, v = null, X, C = null;
|
|
1361
|
+
const m = [], N = [], B = /* @__PURE__ */ new Map(), R = [], u = [], w = /* @__PURE__ */ new Map(), $ = [];
|
|
1362
|
+
function z() {
|
|
1330
1363
|
try {
|
|
1331
|
-
|
|
1364
|
+
f?.disconnect();
|
|
1332
1365
|
} catch (t) {
|
|
1333
|
-
|
|
1366
|
+
at.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1334
1367
|
}
|
|
1335
|
-
|
|
1336
|
-
for (let t = 0; t <
|
|
1368
|
+
f = null;
|
|
1369
|
+
for (let t = 0; t < N.length; t++)
|
|
1337
1370
|
try {
|
|
1338
|
-
|
|
1371
|
+
N[t].port.close();
|
|
1339
1372
|
} catch {
|
|
1340
1373
|
}
|
|
1341
|
-
|
|
1342
|
-
for (let t = 0; t <
|
|
1374
|
+
m.length = 0, N.length = 0, B.clear();
|
|
1375
|
+
for (let t = 0; t < u.length; t++)
|
|
1343
1376
|
try {
|
|
1344
|
-
|
|
1377
|
+
u[t].port.close();
|
|
1345
1378
|
} catch {
|
|
1346
1379
|
}
|
|
1347
|
-
R.length = 0,
|
|
1380
|
+
R.length = 0, u.length = 0, w.clear();
|
|
1348
1381
|
}
|
|
1349
|
-
function
|
|
1382
|
+
function d(t) {
|
|
1350
1383
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1351
1384
|
L({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1352
1385
|
}
|
|
1353
|
-
function
|
|
1386
|
+
function Mt() {
|
|
1354
1387
|
let t = 0;
|
|
1355
|
-
for (let e = 0; e <
|
|
1356
|
-
t |=
|
|
1388
|
+
for (let e = 0; e < N.length; e++)
|
|
1389
|
+
t |= N[e].opcodeGroupsMask;
|
|
1357
1390
|
return t;
|
|
1358
1391
|
}
|
|
1359
|
-
function
|
|
1360
|
-
if (
|
|
1392
|
+
function vt(t) {
|
|
1393
|
+
if (X === void 0)
|
|
1361
1394
|
return !0;
|
|
1362
|
-
const e =
|
|
1363
|
-
if ((e &
|
|
1395
|
+
const e = F(t);
|
|
1396
|
+
if ((e & X) !== 0)
|
|
1364
1397
|
return !0;
|
|
1365
|
-
const s =
|
|
1398
|
+
const s = Mt();
|
|
1366
1399
|
return (e & s) !== 0;
|
|
1367
1400
|
}
|
|
1368
|
-
function
|
|
1369
|
-
|
|
1370
|
-
for (let e = 0; e <
|
|
1371
|
-
const s =
|
|
1372
|
-
(s.opcodeGroupsMask & t) !== 0 &&
|
|
1401
|
+
function ot(t) {
|
|
1402
|
+
$.length = 0;
|
|
1403
|
+
for (let e = 0; e < N.length; e++) {
|
|
1404
|
+
const s = N[e];
|
|
1405
|
+
(s.opcodeGroupsMask & t) !== 0 && $.push(s.port);
|
|
1373
1406
|
}
|
|
1374
|
-
return
|
|
1407
|
+
return $;
|
|
1375
1408
|
}
|
|
1376
|
-
function
|
|
1377
|
-
return (
|
|
1409
|
+
function Bt(t, e) {
|
|
1410
|
+
return (F(t) & e) !== 0;
|
|
1378
1411
|
}
|
|
1379
|
-
function
|
|
1380
|
-
if (!
|
|
1412
|
+
function Ft(t, e) {
|
|
1413
|
+
if (!f || !e || typeof e != "object")
|
|
1381
1414
|
return;
|
|
1382
1415
|
const s = e;
|
|
1383
1416
|
if (!(s.type !== "send" || !(s.message instanceof ArrayBuffer)))
|
|
1384
1417
|
try {
|
|
1385
1418
|
const r = new Uint8Array(s.message);
|
|
1386
|
-
if (!
|
|
1419
|
+
if (!Bt(r, t))
|
|
1387
1420
|
return;
|
|
1388
|
-
|
|
1421
|
+
f.sendProtocolMessage(r), C && C.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1389
1422
|
} catch (r) {
|
|
1390
|
-
|
|
1423
|
+
d(r);
|
|
1391
1424
|
}
|
|
1392
1425
|
}
|
|
1393
|
-
async function
|
|
1394
|
-
|
|
1426
|
+
async function Gt(t) {
|
|
1427
|
+
z(), f = new dt({
|
|
1395
1428
|
sessionId: t.sessionId,
|
|
1396
1429
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1397
1430
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
1398
1431
|
maxReconnectAttempts: t.maxReconnectAttempts,
|
|
1399
1432
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1433
|
+
hasTransportConstraint: t.hasTransportConstraint,
|
|
1400
1434
|
webRtcEnabled: t.webRtcEnabled,
|
|
1401
1435
|
onStateChange: (e) => {
|
|
1402
|
-
L({ type: "state", state: e, activeType:
|
|
1436
|
+
L({ type: "state", state: e, activeType: f?.activeEndpointType ?? void 0 });
|
|
1403
1437
|
},
|
|
1404
1438
|
onRememberWorkingType: () => {
|
|
1405
|
-
L({ type: "state", state:
|
|
1439
|
+
L({ type: "state", state: f?.managerState ?? "idle", activeType: f?.activeEndpointType ?? void 0 });
|
|
1406
1440
|
},
|
|
1407
1441
|
onError: (e) => {
|
|
1408
|
-
|
|
1442
|
+
d(e);
|
|
1409
1443
|
},
|
|
1444
|
+
onRefreshEntrypoints: () => new Promise((e, s) => {
|
|
1445
|
+
M = e, v = s, L({ type: "refreshEntrypoints" });
|
|
1446
|
+
}),
|
|
1410
1447
|
onProtocolMessage: (e) => {
|
|
1411
|
-
|
|
1412
|
-
const s =
|
|
1448
|
+
C && (C.postMessage({ direction: "received", message: Array.from(e) }), Q(e) === p.ANALYTICS_LOGS && C.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1449
|
+
const s = F(e), r = vt(e), n = ot(s);
|
|
1413
1450
|
if (!(!r && n.length === 0))
|
|
1414
1451
|
try {
|
|
1415
|
-
const i =
|
|
1452
|
+
const i = H(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, a = n.length > 0;
|
|
1416
1453
|
if (a && !r && n.length === 1 && o) {
|
|
1417
1454
|
const l = e.buffer;
|
|
1418
1455
|
n[0].postMessage({ type: "protocol", message: l, headers: i }, [l]);
|
|
@@ -1425,77 +1462,85 @@ async function bt(t) {
|
|
|
1425
1462
|
}
|
|
1426
1463
|
if (a && o) {
|
|
1427
1464
|
const l = [];
|
|
1428
|
-
for (let
|
|
1465
|
+
for (let I = 1; I < n.length; I++)
|
|
1429
1466
|
l.push(e.slice().buffer);
|
|
1430
|
-
const
|
|
1431
|
-
n[0].postMessage({ type: "protocol", message:
|
|
1432
|
-
for (let
|
|
1433
|
-
n[
|
|
1434
|
-
|
|
1467
|
+
const c = r ? e.slice().buffer : null, h = e.buffer;
|
|
1468
|
+
n[0].postMessage({ type: "protocol", message: h, headers: i }, [h]);
|
|
1469
|
+
for (let I = 1; I < n.length; I++)
|
|
1470
|
+
n[I].postMessage({ type: "protocol", message: l[I - 1], headers: i }, [l[I - 1]]);
|
|
1471
|
+
c && L({ type: "protocol", message: c, headers: i }, [c]);
|
|
1435
1472
|
return;
|
|
1436
1473
|
}
|
|
1437
1474
|
if (a)
|
|
1438
1475
|
for (const l of n) {
|
|
1439
|
-
const
|
|
1440
|
-
l.postMessage({ type: "protocol", message:
|
|
1476
|
+
const c = e.slice().buffer;
|
|
1477
|
+
l.postMessage({ type: "protocol", message: c, headers: i }, [c]);
|
|
1441
1478
|
}
|
|
1442
1479
|
if (r) {
|
|
1443
1480
|
const l = e.slice().buffer;
|
|
1444
1481
|
L({ type: "protocol", message: l, headers: i }, [l]);
|
|
1445
1482
|
}
|
|
1446
1483
|
} catch (i) {
|
|
1447
|
-
|
|
1484
|
+
d(i);
|
|
1448
1485
|
}
|
|
1449
1486
|
}
|
|
1450
|
-
}), await
|
|
1487
|
+
}), await f.connect(t.entrypoints, { retry: t.retry });
|
|
1451
1488
|
}
|
|
1452
1489
|
self.addEventListener("message", (t) => {
|
|
1453
1490
|
const e = t.data;
|
|
1454
1491
|
if (e.type === "connect") {
|
|
1455
|
-
|
|
1456
|
-
|
|
1492
|
+
Gt(e).catch((s) => {
|
|
1493
|
+
at.error(`Failed to connect: ${s}`), d(s), z();
|
|
1457
1494
|
});
|
|
1458
1495
|
return;
|
|
1459
1496
|
}
|
|
1460
1497
|
if (e.type === "disconnect") {
|
|
1461
|
-
|
|
1498
|
+
z(), L({ type: "state", state: "idle" });
|
|
1462
1499
|
return;
|
|
1463
1500
|
}
|
|
1464
1501
|
if (e.type === "send") {
|
|
1465
|
-
if (!
|
|
1502
|
+
if (!f)
|
|
1466
1503
|
return;
|
|
1467
1504
|
try {
|
|
1468
1505
|
const s = new Uint8Array(e.message);
|
|
1469
|
-
|
|
1506
|
+
f.sendProtocolMessage(s), C && C.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1470
1507
|
} catch (s) {
|
|
1471
|
-
|
|
1508
|
+
d(s);
|
|
1472
1509
|
}
|
|
1473
1510
|
return;
|
|
1474
1511
|
}
|
|
1475
1512
|
if (e.type === "setInterest") {
|
|
1476
|
-
|
|
1513
|
+
X = e.opcodeGroupsMask;
|
|
1477
1514
|
return;
|
|
1478
1515
|
}
|
|
1479
1516
|
if (e.type === "enableDevtools") {
|
|
1480
|
-
e.enabled && !
|
|
1517
|
+
e.enabled && !C ? C = new BroadcastChannel("ikon:devtools") : !e.enabled && C && (C.close(), C = null);
|
|
1481
1518
|
return;
|
|
1482
1519
|
}
|
|
1483
1520
|
if (e.type === "checkHealth") {
|
|
1484
|
-
|
|
1521
|
+
f?.checkHealth();
|
|
1522
|
+
return;
|
|
1523
|
+
}
|
|
1524
|
+
if (e.type === "refreshedEntrypoints") {
|
|
1525
|
+
M && (M({ entrypoints: e.entrypoints, sessionId: e.sessionId }), M = null, v = null);
|
|
1526
|
+
return;
|
|
1527
|
+
}
|
|
1528
|
+
if (e.type === "refreshEntrypointsFailed") {
|
|
1529
|
+
v && (v(new Error("Failed to refresh entrypoints")), M = null, v = null);
|
|
1485
1530
|
return;
|
|
1486
1531
|
}
|
|
1487
1532
|
if (e.type === "forwardToPorts") {
|
|
1488
1533
|
try {
|
|
1489
|
-
const s = new Uint8Array(e.message), r =
|
|
1534
|
+
const s = new Uint8Array(e.message), r = F(s), n = ot(r);
|
|
1490
1535
|
if (n.length > 0) {
|
|
1491
|
-
const i =
|
|
1536
|
+
const i = H(s);
|
|
1492
1537
|
for (const o of n) {
|
|
1493
1538
|
const a = s.slice().buffer;
|
|
1494
1539
|
o.postMessage({ type: "protocol", message: a, headers: i }, [a]);
|
|
1495
1540
|
}
|
|
1496
1541
|
}
|
|
1497
1542
|
} catch (s) {
|
|
1498
|
-
|
|
1543
|
+
d(s);
|
|
1499
1544
|
}
|
|
1500
1545
|
return;
|
|
1501
1546
|
}
|
|
@@ -1504,31 +1549,31 @@ self.addEventListener("message", (t) => {
|
|
|
1504
1549
|
e.port.start?.();
|
|
1505
1550
|
} catch {
|
|
1506
1551
|
}
|
|
1507
|
-
const s =
|
|
1508
|
-
|
|
1552
|
+
const s = m.length;
|
|
1553
|
+
m.push(e.portId), N.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), B.set(e.portId, s);
|
|
1509
1554
|
return;
|
|
1510
1555
|
}
|
|
1511
1556
|
if (e.type === "detachPort") {
|
|
1512
|
-
const s =
|
|
1557
|
+
const s = B.get(e.portId);
|
|
1513
1558
|
if (s !== void 0) {
|
|
1514
|
-
const r =
|
|
1559
|
+
const r = N[s];
|
|
1515
1560
|
try {
|
|
1516
1561
|
r.port.close();
|
|
1517
1562
|
} catch {
|
|
1518
1563
|
}
|
|
1519
|
-
const n =
|
|
1564
|
+
const n = m.length - 1;
|
|
1520
1565
|
if (s !== n) {
|
|
1521
|
-
const i =
|
|
1522
|
-
|
|
1566
|
+
const i = m[n];
|
|
1567
|
+
m[s] = i, N[s] = N[n], B.set(i, s);
|
|
1523
1568
|
}
|
|
1524
|
-
|
|
1569
|
+
m.length--, N.length--, B.delete(e.portId);
|
|
1525
1570
|
}
|
|
1526
1571
|
return;
|
|
1527
1572
|
}
|
|
1528
1573
|
if (e.type === "attachSendPort") {
|
|
1529
|
-
const s =
|
|
1574
|
+
const s = w.get(e.portId);
|
|
1530
1575
|
if (s !== void 0) {
|
|
1531
|
-
const i =
|
|
1576
|
+
const i = u[s];
|
|
1532
1577
|
try {
|
|
1533
1578
|
i.port.close();
|
|
1534
1579
|
} catch {
|
|
@@ -1536,25 +1581,25 @@ self.addEventListener("message", (t) => {
|
|
|
1536
1581
|
const o = R.length - 1;
|
|
1537
1582
|
if (s !== o) {
|
|
1538
1583
|
const a = R[o];
|
|
1539
|
-
R[s] = a,
|
|
1584
|
+
R[s] = a, u[s] = u[o], w.set(a, s);
|
|
1540
1585
|
}
|
|
1541
|
-
R.length--,
|
|
1586
|
+
R.length--, u.length--, w.delete(e.portId);
|
|
1542
1587
|
}
|
|
1543
1588
|
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n = R.length;
|
|
1544
|
-
R.push(e.portId),
|
|
1589
|
+
R.push(e.portId), u.push(r), w.set(e.portId, n);
|
|
1545
1590
|
try {
|
|
1546
1591
|
r.port.start?.();
|
|
1547
1592
|
} catch {
|
|
1548
1593
|
}
|
|
1549
1594
|
r.port.addEventListener("message", (i) => {
|
|
1550
|
-
|
|
1595
|
+
Ft(r.opcodeGroupsMask, i.data);
|
|
1551
1596
|
});
|
|
1552
1597
|
return;
|
|
1553
1598
|
}
|
|
1554
1599
|
if (e.type === "detachSendPort") {
|
|
1555
|
-
const s =
|
|
1600
|
+
const s = w.get(e.portId);
|
|
1556
1601
|
if (s !== void 0) {
|
|
1557
|
-
const r =
|
|
1602
|
+
const r = u[s];
|
|
1558
1603
|
try {
|
|
1559
1604
|
r.port.close();
|
|
1560
1605
|
} catch {
|
|
@@ -1562,9 +1607,9 @@ self.addEventListener("message", (t) => {
|
|
|
1562
1607
|
const n = R.length - 1;
|
|
1563
1608
|
if (s !== n) {
|
|
1564
1609
|
const i = R[n];
|
|
1565
|
-
R[s] = i,
|
|
1610
|
+
R[s] = i, u[s] = u[n], w.set(i, s);
|
|
1566
1611
|
}
|
|
1567
|
-
R.length--,
|
|
1612
|
+
R.length--, u.length--, w.delete(e.portId);
|
|
1568
1613
|
}
|
|
1569
1614
|
return;
|
|
1570
1615
|
}
|