@ikonai/sdk 0.0.42 → 0.0.43
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-kpORDYGU.js +1138 -0
- package/assets/{audio-playback-worker-CYoIqiGJ.js → audio-playback-worker-Cwm3GaAx.js} +321 -212
- package/assets/{protocol-worker-E7o-6_bZ.js → protocol-worker-DKSTqFKg.js} +228 -207
- package/assets/video-capture-worker-BBs_62Fq.js +963 -0
- package/assets/video-playback-worker-Bfm3r5xW.js +924 -0
- package/client/ikon-client-config.d.ts +6 -10
- package/client/ikon-client.d.ts +4 -5
- package/index.js +1532 -1311
- package/media/audio-constants.d.ts +5 -0
- package/media/ikon-audio-playback.d.ts +53 -0
- package/media/ikon-video-capture.d.ts +0 -1
- package/media/ikon-video-playback.d.ts +0 -2
- package/media/video-constants.d.ts +42 -0
- package/package.json +1 -1
- package/worker/audio-playback-worker.d.ts +3 -0
- package/worker/video-capture-worker.d.ts +3 -1
- package/worker/video-playback-worker.d.ts +3 -0
- package/assets/audio-capture-worker-zx_Os6ad.js +0 -1112
- package/assets/video-capture-worker-CTRX9PKp.js +0 -843
- package/assets/video-playback-worker-CIuL9Crw.js +0 -875
|
@@ -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
6
|
function k(t) {
|
|
7
|
-
return
|
|
7
|
+
return q(t) & 4294901760;
|
|
8
8
|
}
|
|
9
9
|
function $(t) {
|
|
10
10
|
const e = Et(t), r = new DataView(e.buffer, e.byteOffset, e.byteLength);
|
|
11
11
|
if (e.length < 27)
|
|
12
12
|
throw new Error("Protocol payload too short");
|
|
13
|
-
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), i = r.getUint32(8, !0), o = r.getUint32(12, !0), E = r.getUint32(16, !0),
|
|
14
|
-
if (27 +
|
|
13
|
+
const s = r.getUint32(0, !0), n = r.getUint32(4, !0), i = r.getUint32(8, !0), o = r.getUint32(12, !0), E = r.getUint32(16, !0), a = r.getUint32(20, !0), h = r.getUint8(24), f = r.getUint8(25), _ = r.getUint8(26);
|
|
14
|
+
if (27 + a * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
for (let
|
|
19
|
-
|
|
16
|
+
const I = [];
|
|
17
|
+
let O = 27;
|
|
18
|
+
for (let d = 0; d < a; d++)
|
|
19
|
+
I.push(r.getUint32(O, !0)), O += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: s,
|
|
22
22
|
opcode: n,
|
|
23
23
|
senderId: i,
|
|
24
24
|
trackId: o,
|
|
25
25
|
sequenceId: E,
|
|
26
|
-
targetIds:
|
|
27
|
-
payloadVersion:
|
|
28
|
-
payloadType:
|
|
29
|
-
flags:
|
|
26
|
+
targetIds: I,
|
|
27
|
+
payloadVersion: h,
|
|
28
|
+
payloadType: f,
|
|
29
|
+
flags: _
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
function nt(t, e, r, s, n) {
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
let
|
|
36
|
-
for (let
|
|
37
|
-
|
|
38
|
-
return
|
|
33
|
+
const a = [], f = 27 + a.length * 4, _ = f + e.length, m = new Uint8Array(_), I = new DataView(m.buffer);
|
|
34
|
+
I.setUint32(0, _, !0), I.setUint32(4, t >>> 0, !0), I.setUint32(8, s >>> 0, !0), I.setUint32(12, 0, !0), I.setUint32(16, 0, !0), I.setUint32(20, a.length >>> 0, !0), I.setUint8(24, r & 255), I.setUint8(25, 8), I.setUint8(26, 0);
|
|
35
|
+
let O = 27;
|
|
36
|
+
for (let d = 0; d < a.length; d++)
|
|
37
|
+
I.setUint32(O, a[d] >>> 0, !0), O += 4;
|
|
38
|
+
return m.set(e, f), m;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const it = 161, at = 162,
|
|
40
|
+
var g = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(g || {});
|
|
41
|
+
const it = 161, at = 162, G = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
|
-
class
|
|
43
|
+
class M {
|
|
44
44
|
constructor(e = 1) {
|
|
45
45
|
this.version = e, this.buffer.writeByte(it), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
|
-
buffer = new
|
|
47
|
+
buffer = new P();
|
|
48
48
|
closed = !1;
|
|
49
49
|
cached;
|
|
50
50
|
writeInt32Field(e, r) {
|
|
@@ -69,20 +69,20 @@ class B {
|
|
|
69
69
|
this.writeFixedField(e, 2, () => this.buffer.writeByte(r ? 1 : 0));
|
|
70
70
|
}
|
|
71
71
|
writeGuidField(e, r) {
|
|
72
|
-
const s = r instanceof
|
|
72
|
+
const s = r instanceof l ? r.asBytes() : r;
|
|
73
73
|
if (s.length !== 16)
|
|
74
74
|
throw new Error("Guid payload must be 16 bytes");
|
|
75
75
|
this.writeFixedField(e, 14, () => this.buffer.writeBytes(s));
|
|
76
76
|
}
|
|
77
77
|
writeStringField(e, r) {
|
|
78
|
-
const s =
|
|
78
|
+
const s = G.encode(r ?? "");
|
|
79
79
|
this.writeVariableField(e, 12, s);
|
|
80
80
|
}
|
|
81
81
|
writeBinaryField(e, r) {
|
|
82
82
|
this.writeVariableField(e, 13, r);
|
|
83
83
|
}
|
|
84
84
|
writeObjectField(e, r, s) {
|
|
85
|
-
const n = new
|
|
85
|
+
const n = new M(r);
|
|
86
86
|
s(n);
|
|
87
87
|
const i = n.finish();
|
|
88
88
|
this.writeVariableField(e, 11, i);
|
|
@@ -109,14 +109,14 @@ class B {
|
|
|
109
109
|
this.writeFieldHeader(e, r, s.length), this.buffer.writeBytes(s);
|
|
110
110
|
}
|
|
111
111
|
writeFieldHeader(e, r, s) {
|
|
112
|
-
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(
|
|
112
|
+
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(p(r)), ht(r) && this.buffer.writeVarUInt(s >>> 0);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
class K {
|
|
116
116
|
constructor(e) {
|
|
117
117
|
this.elementType = e;
|
|
118
118
|
}
|
|
119
|
-
payload = new
|
|
119
|
+
payload = new P();
|
|
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 r = e instanceof
|
|
168
|
+
const r = e instanceof l ? e.asBytes() : e;
|
|
169
169
|
if (r.length !== 16)
|
|
170
170
|
throw new Error("Guid payload must be 16 bytes");
|
|
171
171
|
this.payload.writeBytes(r);
|
|
@@ -175,7 +175,7 @@ class K {
|
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const r =
|
|
178
|
+
const r = G.encode(e ?? "");
|
|
179
179
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
@@ -189,7 +189,7 @@ class K {
|
|
|
189
189
|
11
|
|
190
190
|
/* Object */
|
|
191
191
|
), this.count++;
|
|
192
|
-
const s = new
|
|
192
|
+
const s = new M(e);
|
|
193
193
|
r(s);
|
|
194
194
|
const n = s.finish();
|
|
195
195
|
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n);
|
|
@@ -215,19 +215,19 @@ class K {
|
|
|
215
215
|
this.payload.writeBytes(i);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
218
|
-
const e = new
|
|
219
|
-
return e.writeByte(
|
|
218
|
+
const e = new P();
|
|
219
|
+
return e.writeByte(p(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 ${g[this.elementType]}, expected ${g[e]}`);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
226
|
class X {
|
|
227
227
|
constructor(e, r) {
|
|
228
|
-
this.keyType = e, this.valueType = r,
|
|
228
|
+
this.keyType = e, this.valueType = r, lt(e);
|
|
229
229
|
}
|
|
230
|
-
payload = new
|
|
230
|
+
payload = new P();
|
|
231
231
|
count = 0;
|
|
232
232
|
entryOpen = !1;
|
|
233
233
|
beginEntry() {
|
|
@@ -240,8 +240,8 @@ class X {
|
|
|
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 P();
|
|
244
|
+
return e.writeByte(p(this.keyType)), e.writeByte(p(this.valueType)), e.writeVarUInt(this.count), e.writeBytes(this.payload.toUint8Array()), e.toUint8Array();
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
class ot {
|
|
@@ -298,7 +298,7 @@ class ot {
|
|
|
298
298
|
14
|
|
299
299
|
/* Guid */
|
|
300
300
|
);
|
|
301
|
-
const r = e instanceof
|
|
301
|
+
const r = e instanceof l ? e.asBytes() : e;
|
|
302
302
|
if (r.length !== 16)
|
|
303
303
|
throw new Error("Guid payload must be 16 bytes");
|
|
304
304
|
this.payload.writeBytes(r), this.keyWritten = !0;
|
|
@@ -308,7 +308,7 @@ class ot {
|
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const r =
|
|
311
|
+
const r = G.encode(e ?? "");
|
|
312
312
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
@@ -364,7 +364,7 @@ class ot {
|
|
|
364
364
|
14
|
|
365
365
|
/* Guid */
|
|
366
366
|
);
|
|
367
|
-
const r = e instanceof
|
|
367
|
+
const r = e instanceof l ? e.asBytes() : e;
|
|
368
368
|
if (r.length !== 16)
|
|
369
369
|
throw new Error("Guid payload must be 16 bytes");
|
|
370
370
|
this.payload.writeBytes(r), this.valueWritten = !0;
|
|
@@ -386,7 +386,7 @@ class ot {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const r =
|
|
389
|
+
const r = G.encode(e ?? "");
|
|
390
390
|
this.payload.writeVarUInt(r.length), this.payload.writeBytes(r), this.valueWritten = !0;
|
|
391
391
|
}
|
|
392
392
|
writeValueObject(e, r) {
|
|
@@ -394,7 +394,7 @@ class ot {
|
|
|
394
394
|
11
|
|
395
395
|
/* Object */
|
|
396
396
|
);
|
|
397
|
-
const s = new
|
|
397
|
+
const s = new M(e);
|
|
398
398
|
r(s);
|
|
399
399
|
const n = s.finish();
|
|
400
400
|
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n), this.valueWritten = !0;
|
|
@@ -428,14 +428,14 @@ class ot {
|
|
|
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 ${g[this.keyType]}, expected ${g[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 ${g[this.valueType]}, expected ${g[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
class
|
|
438
|
+
class l {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
this.bytes = e;
|
|
441
441
|
}
|
|
@@ -445,19 +445,19 @@ class h {
|
|
|
445
445
|
const r = e.replace(/-/g, "");
|
|
446
446
|
if (r.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const s = new Uint8Array(16), n =
|
|
449
|
-
|
|
448
|
+
const s = new Uint8Array(16), n = l.parseHexSlice(r, 0, 8), i = l.parseHexSlice(r, 8, 4), o = l.parseHexSlice(r, 12, 4);
|
|
449
|
+
l.writeUInt32LE(s, 0, n), l.writeUInt16LE(s, 4, i), l.writeUInt16LE(s, 6, o);
|
|
450
450
|
for (let E = 0; E < 8; E++)
|
|
451
|
-
s[8 + E] =
|
|
452
|
-
return new
|
|
451
|
+
s[8 + E] = l.parseHexSlice(r, 16 + E * 2, 2);
|
|
452
|
+
return new l(s);
|
|
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 l(Uint8Array.from(e));
|
|
458
458
|
}
|
|
459
459
|
static createZero() {
|
|
460
|
-
return new
|
|
460
|
+
return new l(new Uint8Array(16));
|
|
461
461
|
}
|
|
462
462
|
static createRandom() {
|
|
463
463
|
const e = new Uint8Array(16), r = globalThis.crypto;
|
|
@@ -466,14 +466,14 @@ class h {
|
|
|
466
466
|
else
|
|
467
467
|
for (let s = 0; s < e.length; s++)
|
|
468
468
|
e[s] = 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 l(e);
|
|
470
470
|
}
|
|
471
471
|
toString() {
|
|
472
472
|
const e = this.bytes;
|
|
473
473
|
return [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
l.toHex(l.readUInt32LE(e, 0), 8),
|
|
475
|
+
l.toHex(l.readUInt16LE(e, 4), 4),
|
|
476
|
+
l.toHex(l.readUInt16LE(e, 6), 4),
|
|
477
477
|
z(e.subarray(8, 10)),
|
|
478
478
|
z(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
@@ -505,56 +505,67 @@ class h {
|
|
|
505
505
|
return (e >>> 0).toString(16).padStart(r, "0");
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
|
-
class
|
|
509
|
-
|
|
508
|
+
class P {
|
|
509
|
+
static INITIAL_CAPACITY = 256;
|
|
510
|
+
buffer;
|
|
511
|
+
dataView;
|
|
512
|
+
length = 0;
|
|
513
|
+
constructor() {
|
|
514
|
+
this.buffer = new Uint8Array(P.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
515
|
+
}
|
|
516
|
+
ensureCapacity(e) {
|
|
517
|
+
const r = this.length + e;
|
|
518
|
+
if (r <= this.buffer.length)
|
|
519
|
+
return;
|
|
520
|
+
let s = this.buffer.length;
|
|
521
|
+
for (; s < r; )
|
|
522
|
+
s *= 2;
|
|
523
|
+
const n = new Uint8Array(s);
|
|
524
|
+
n.set(this.buffer.subarray(0, this.length)), this.buffer = n, this.dataView = new DataView(this.buffer.buffer);
|
|
525
|
+
}
|
|
510
526
|
writeByte(e) {
|
|
511
|
-
this.
|
|
527
|
+
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
512
528
|
}
|
|
513
529
|
writeBytes(e) {
|
|
514
|
-
|
|
515
|
-
this.bytes.push(e[r]);
|
|
530
|
+
this.ensureCapacity(e.length), this.buffer.set(e, this.length), this.length += e.length;
|
|
516
531
|
}
|
|
517
532
|
writeUInt32(e) {
|
|
518
|
-
this.
|
|
533
|
+
this.ensureCapacity(4), this.dataView.setUint32(this.length, e >>> 0, !0), this.length += 4;
|
|
519
534
|
}
|
|
520
535
|
writeInt32(e) {
|
|
521
|
-
this.
|
|
536
|
+
this.ensureCapacity(4), this.dataView.setInt32(this.length, e | 0, !0), this.length += 4;
|
|
522
537
|
}
|
|
523
538
|
writeFloat32(e) {
|
|
524
|
-
|
|
525
|
-
r.setFloat32(0, e, !0), this.writeBytes(new Uint8Array(r.buffer));
|
|
539
|
+
this.ensureCapacity(4), this.dataView.setFloat32(this.length, e, !0), this.length += 4;
|
|
526
540
|
}
|
|
527
541
|
writeFloat64(e) {
|
|
528
|
-
|
|
529
|
-
r.setFloat64(0, e, !0), this.writeBytes(new Uint8Array(r.buffer));
|
|
542
|
+
this.ensureCapacity(8), this.dataView.setFloat64(this.length, e, !0), this.length += 8;
|
|
530
543
|
}
|
|
531
544
|
writeBigInt64(e) {
|
|
532
|
-
|
|
533
|
-
r.setBigInt64(0, e, !0), this.writeBytes(new Uint8Array(r.buffer));
|
|
545
|
+
this.ensureCapacity(8), this.dataView.setBigInt64(this.length, e, !0), this.length += 8;
|
|
534
546
|
}
|
|
535
547
|
writeBigUInt64(e) {
|
|
536
|
-
|
|
537
|
-
r.setBigUint64(0, e, !0), this.writeBytes(new Uint8Array(r.buffer));
|
|
548
|
+
this.ensureCapacity(8), this.dataView.setBigUint64(this.length, e, !0), this.length += 8;
|
|
538
549
|
}
|
|
539
550
|
writeVarUInt(e) {
|
|
540
551
|
let r = e >>> 0;
|
|
541
552
|
for (; r >= 128; )
|
|
542
|
-
this.
|
|
543
|
-
this.
|
|
553
|
+
this.ensureCapacity(1), this.buffer[this.length++] = r & 127 | 128, r >>>= 7;
|
|
554
|
+
this.ensureCapacity(1), this.buffer[this.length++] = r & 127;
|
|
544
555
|
}
|
|
545
556
|
toUint8Array() {
|
|
546
|
-
return
|
|
557
|
+
return this.buffer.slice(0, this.length);
|
|
547
558
|
}
|
|
548
559
|
}
|
|
549
|
-
function
|
|
560
|
+
function p(t, e = 0) {
|
|
550
561
|
if ((e & 240) !== 0)
|
|
551
562
|
throw new Error("Teleport flags must fit into 4 bits");
|
|
552
563
|
return (t & 15) << 4 | e & 15;
|
|
553
564
|
}
|
|
554
|
-
function
|
|
565
|
+
function ht(t) {
|
|
555
566
|
return t === 12 || t === 13 || t === 9 || t === 11 || t === 10;
|
|
556
567
|
}
|
|
557
|
-
function
|
|
568
|
+
function lt(t) {
|
|
558
569
|
if (t === 9 || t === 11 || t === 10 || t === 1)
|
|
559
570
|
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
560
571
|
}
|
|
@@ -564,29 +575,29 @@ function z(t) {
|
|
|
564
575
|
function Et(t) {
|
|
565
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
566
577
|
}
|
|
567
|
-
var R = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t))(R || {}), W = /* @__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.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.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.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(W || {});
|
|
568
|
-
const
|
|
569
|
-
function
|
|
578
|
+
var U = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t))(U || {}), W = /* @__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.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(W || {});
|
|
579
|
+
const J = 1, _t = 131074;
|
|
580
|
+
function Z(t) {
|
|
570
581
|
return {};
|
|
571
582
|
}
|
|
572
583
|
function It(t) {
|
|
573
|
-
return new
|
|
584
|
+
return new M(J).finish();
|
|
574
585
|
}
|
|
575
586
|
function tt(t, e, r) {
|
|
576
587
|
const s = It();
|
|
577
|
-
return nt(_t, s,
|
|
588
|
+
return nt(_t, s, J, e);
|
|
578
589
|
}
|
|
579
590
|
class et extends Error {
|
|
580
591
|
constructor(e, r) {
|
|
581
592
|
super(e), this.cause = r, this.name = "ConnectionError";
|
|
582
593
|
}
|
|
583
594
|
}
|
|
584
|
-
class
|
|
595
|
+
class L extends et {
|
|
585
596
|
constructor(e, r) {
|
|
586
597
|
super(e, r), this.name = "TransportError";
|
|
587
598
|
}
|
|
588
599
|
}
|
|
589
|
-
class Q extends
|
|
600
|
+
class Q extends L {
|
|
590
601
|
constructor(e) {
|
|
591
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
592
603
|
}
|
|
@@ -633,7 +644,7 @@ function F(t, e, r, s) {
|
|
|
633
644
|
}
|
|
634
645
|
}
|
|
635
646
|
}
|
|
636
|
-
function
|
|
647
|
+
function B(t) {
|
|
637
648
|
return {
|
|
638
649
|
debug(e, ...r) {
|
|
639
650
|
F(0, t, e, r);
|
|
@@ -649,7 +660,7 @@ function M(t) {
|
|
|
649
660
|
}
|
|
650
661
|
};
|
|
651
662
|
}
|
|
652
|
-
const V =
|
|
663
|
+
const V = B("WebSocketTransport"), Nt = 1e4;
|
|
653
664
|
class ft {
|
|
654
665
|
ws = null;
|
|
655
666
|
keepaliveTimeout = null;
|
|
@@ -668,29 +679,29 @@ class ft {
|
|
|
668
679
|
return new Promise((s, n) => {
|
|
669
680
|
try {
|
|
670
681
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
671
|
-
} catch (
|
|
672
|
-
n(new
|
|
682
|
+
} catch (h) {
|
|
683
|
+
n(new L(`Failed to create WebSocket: ${h}`, h instanceof Error ? h : void 0));
|
|
673
684
|
return;
|
|
674
685
|
}
|
|
675
686
|
let i = !1, o = !1;
|
|
676
687
|
const E = () => {
|
|
677
|
-
clearTimeout(
|
|
678
|
-
},
|
|
679
|
-
o || (o = !0, E(), this.ws?.close(), n(new
|
|
688
|
+
clearTimeout(a), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
689
|
+
}, a = setTimeout(() => {
|
|
690
|
+
o || (o = !0, E(), this.ws?.close(), n(new L("WebSocket connection timeout")));
|
|
680
691
|
}, Nt);
|
|
681
692
|
this.ws.onopen = () => {
|
|
682
|
-
i = !0, clearTimeout(
|
|
693
|
+
i = !0, clearTimeout(a), this.ws.send(r), this.resetKeepaliveTimeout(), o || (o = !0, s());
|
|
683
694
|
}, this.ws.onerror = () => {
|
|
684
|
-
clearTimeout(
|
|
685
|
-
}, this.ws.onclose = (
|
|
695
|
+
clearTimeout(a), V.error("WebSocket error"), o || (o = !0, E(), n(new L("WebSocket connection failed")));
|
|
696
|
+
}, this.ws.onclose = (h) => {
|
|
686
697
|
if (this.clearKeepaliveTimeout(), !i && !o) {
|
|
687
|
-
o = !0, E(), n(new
|
|
698
|
+
o = !0, E(), n(new L("WebSocket connection closed before opening"));
|
|
688
699
|
return;
|
|
689
700
|
}
|
|
690
|
-
const
|
|
691
|
-
this.callbacks.onClose(
|
|
692
|
-
}, this.ws.onmessage = (
|
|
693
|
-
this.handleProtocolMessage(new Uint8Array(
|
|
701
|
+
const f = h.wasClean && (h.code === 1e3 || h.code === 1001), _ = h.code === 1e3 || h.code === 1001, m = h.reason || `code=${h.code}`;
|
|
702
|
+
this.callbacks.onClose(m, f, _);
|
|
703
|
+
}, this.ws.onmessage = (h) => {
|
|
704
|
+
this.handleProtocolMessage(new Uint8Array(h.data));
|
|
694
705
|
};
|
|
695
706
|
});
|
|
696
707
|
}
|
|
@@ -704,7 +715,7 @@ class ft {
|
|
|
704
715
|
* Get or create a cached keepalive response message.
|
|
705
716
|
*/
|
|
706
717
|
getKeepaliveResponse() {
|
|
707
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = tt(
|
|
718
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = tt(Z(), this.sessionId)), this.keepaliveResponseMessage;
|
|
708
719
|
}
|
|
709
720
|
handleProtocolMessage(e) {
|
|
710
721
|
try {
|
|
@@ -726,11 +737,11 @@ class ft {
|
|
|
726
737
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
727
738
|
}
|
|
728
739
|
}
|
|
729
|
-
const
|
|
740
|
+
const C = B("WebTransportTransport"), j = 4, Ct = 65536;
|
|
730
741
|
function rt() {
|
|
731
742
|
return typeof WebTransport < "u";
|
|
732
743
|
}
|
|
733
|
-
class
|
|
744
|
+
class Rt {
|
|
734
745
|
transport = null;
|
|
735
746
|
stream = null;
|
|
736
747
|
reader = null;
|
|
@@ -757,24 +768,24 @@ class yt {
|
|
|
757
768
|
}
|
|
758
769
|
async connect(e, r) {
|
|
759
770
|
if (!rt())
|
|
760
|
-
throw new
|
|
771
|
+
throw new L("WebTransport is not supported in this browser");
|
|
761
772
|
try {
|
|
762
|
-
this.transport = new WebTransport(e), await this.transport.ready,
|
|
773
|
+
this.transport = new WebTransport(e), await this.transport.ready, C.debug(`Connected to WebTransport entrypoint: ${e}`), this.transport.closed.then(() => {
|
|
763
774
|
this.handleClose("Connection closed", !0);
|
|
764
775
|
}).catch((s) => {
|
|
765
|
-
|
|
776
|
+
C.error("WebTransport connection closed with error:", s), this.handleClose(s.message || "Connection error", !1);
|
|
766
777
|
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(r), this.resetKeepaliveTimeout(), this.startReadLoop();
|
|
767
778
|
} catch (s) {
|
|
768
|
-
throw this.cleanup(), new
|
|
779
|
+
throw this.cleanup(), new L(`Failed to connect WebTransport: ${s}`, s instanceof Error ? s : void 0);
|
|
769
780
|
}
|
|
770
781
|
}
|
|
771
782
|
send(e) {
|
|
772
783
|
if (!this.writer) {
|
|
773
|
-
|
|
784
|
+
C.warn("Cannot send: WebTransport not connected");
|
|
774
785
|
return;
|
|
775
786
|
}
|
|
776
787
|
this.writer.write(e).catch((r) => {
|
|
777
|
-
|
|
788
|
+
C.error("Failed to send protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
778
789
|
});
|
|
779
790
|
}
|
|
780
791
|
close() {
|
|
@@ -794,7 +805,7 @@ class yt {
|
|
|
794
805
|
e && (this.appendToBuffer(e), this.processBufferedMessages());
|
|
795
806
|
}
|
|
796
807
|
} catch (e) {
|
|
797
|
-
this.readLoopActive && (
|
|
808
|
+
this.readLoopActive && (C.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : new Error(String(e))));
|
|
798
809
|
}
|
|
799
810
|
}
|
|
800
811
|
}
|
|
@@ -823,7 +834,7 @@ class yt {
|
|
|
823
834
|
* Get or create a cached keepalive response message.
|
|
824
835
|
*/
|
|
825
836
|
getKeepaliveResponse() {
|
|
826
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = tt(
|
|
837
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = tt(Z(), this.sessionId)), this.keepaliveResponseMessage;
|
|
827
838
|
}
|
|
828
839
|
/**
|
|
829
840
|
* Process complete messages from the receive buffer.
|
|
@@ -835,7 +846,7 @@ class yt {
|
|
|
835
846
|
for (; this.receiveBufferLength >= j; ) {
|
|
836
847
|
const r = e.getUint32(this.receiveBufferOffset, !0);
|
|
837
848
|
if (r < j) {
|
|
838
|
-
|
|
849
|
+
C.error(`Invalid message length: ${r}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${r}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
839
850
|
return;
|
|
840
851
|
}
|
|
841
852
|
if (this.receiveBufferLength < r)
|
|
@@ -856,7 +867,7 @@ class yt {
|
|
|
856
867
|
}
|
|
857
868
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
858
869
|
} catch (r) {
|
|
859
|
-
|
|
870
|
+
C.error("Failed to process protocol message:", r), this.callbacks.onError(r instanceof Error ? r : new Error(String(r)));
|
|
860
871
|
}
|
|
861
872
|
}
|
|
862
873
|
/**
|
|
@@ -870,7 +881,7 @@ class yt {
|
|
|
870
881
|
*/
|
|
871
882
|
resetKeepaliveTimeout() {
|
|
872
883
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
873
|
-
|
|
884
|
+
C.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new Q(this.keepaliveTimeoutMs)), this.close();
|
|
874
885
|
}, this.keepaliveTimeoutMs);
|
|
875
886
|
}
|
|
876
887
|
/**
|
|
@@ -892,8 +903,8 @@ class yt {
|
|
|
892
903
|
}
|
|
893
904
|
}
|
|
894
905
|
}
|
|
895
|
-
const
|
|
896
|
-
class
|
|
906
|
+
const b = B("Channel");
|
|
907
|
+
class yt {
|
|
897
908
|
state = "disconnected";
|
|
898
909
|
transport = null;
|
|
899
910
|
config;
|
|
@@ -935,7 +946,7 @@ class wt {
|
|
|
935
946
|
try {
|
|
936
947
|
await this.connectTransport(), this.setState("connected");
|
|
937
948
|
} catch (e) {
|
|
938
|
-
throw
|
|
949
|
+
throw b.error("Channel connection failed:", e), this.setState("disconnected"), e;
|
|
939
950
|
}
|
|
940
951
|
}
|
|
941
952
|
/**
|
|
@@ -949,7 +960,7 @@ class wt {
|
|
|
949
960
|
*/
|
|
950
961
|
send(e) {
|
|
951
962
|
if (!this.transport?.isConnected) {
|
|
952
|
-
|
|
963
|
+
b.warn("Cannot send: channel not connected");
|
|
953
964
|
return;
|
|
954
965
|
}
|
|
955
966
|
this.transport.send(e);
|
|
@@ -968,18 +979,18 @@ class wt {
|
|
|
968
979
|
}
|
|
969
980
|
};
|
|
970
981
|
switch (e.Type) {
|
|
971
|
-
case
|
|
972
|
-
case
|
|
982
|
+
case U.WebSocket:
|
|
983
|
+
case U.WebSocketProxy:
|
|
973
984
|
this.transport = new ft(r);
|
|
974
985
|
break;
|
|
975
|
-
case
|
|
976
|
-
case
|
|
986
|
+
case U.WebTransport:
|
|
987
|
+
case U.WebTransportProxy:
|
|
977
988
|
if (!rt())
|
|
978
989
|
throw new Error("WebTransport is not supported in this browser");
|
|
979
|
-
this.transport = new
|
|
990
|
+
this.transport = new Rt(r);
|
|
980
991
|
break;
|
|
981
992
|
default:
|
|
982
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
993
|
+
throw new Error(`Unsupported entrypoint type: ${U[e.Type]}`);
|
|
983
994
|
}
|
|
984
995
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
985
996
|
}
|
|
@@ -989,13 +1000,13 @@ class wt {
|
|
|
989
1000
|
handleProtocolMessage(e) {
|
|
990
1001
|
try {
|
|
991
1002
|
const r = e;
|
|
992
|
-
if (
|
|
993
|
-
|
|
1003
|
+
if (q(r) === W.CORE_ON_SERVER_STOPPING) {
|
|
1004
|
+
b.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
994
1005
|
return;
|
|
995
1006
|
}
|
|
996
1007
|
this.config.onProtocolMessage?.(r);
|
|
997
1008
|
} catch (r) {
|
|
998
|
-
|
|
1009
|
+
b.error("Failed to handle protocol message:", r), this.config.onError?.(r instanceof Error ? r : new Error(String(r)));
|
|
999
1010
|
}
|
|
1000
1011
|
}
|
|
1001
1012
|
/**
|
|
@@ -1008,7 +1019,7 @@ class wt {
|
|
|
1008
1019
|
* Handle transport error.
|
|
1009
1020
|
*/
|
|
1010
1021
|
handleError(e) {
|
|
1011
|
-
|
|
1022
|
+
b.error("Channel error:", e), this.config.onError?.(e), e instanceof Q && this.handleClose("Keepalive timeout", !1);
|
|
1012
1023
|
}
|
|
1013
1024
|
/**
|
|
1014
1025
|
* Update and notify state change.
|
|
@@ -1017,8 +1028,8 @@ class wt {
|
|
|
1017
1028
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1018
1029
|
}
|
|
1019
1030
|
}
|
|
1020
|
-
const
|
|
1021
|
-
class
|
|
1031
|
+
const R = B("ChannelManager");
|
|
1032
|
+
class wt {
|
|
1022
1033
|
channels = /* @__PURE__ */ new Map();
|
|
1023
1034
|
// keyed by opcode group
|
|
1024
1035
|
activeType = null;
|
|
@@ -1068,7 +1079,7 @@ class Rt {
|
|
|
1068
1079
|
n.send(e);
|
|
1069
1080
|
return;
|
|
1070
1081
|
}
|
|
1071
|
-
|
|
1082
|
+
R.warn("No channel found for message");
|
|
1072
1083
|
}
|
|
1073
1084
|
/**
|
|
1074
1085
|
* Send a protocol message to all channels (for broadcast messages).
|
|
@@ -1099,10 +1110,10 @@ class Rt {
|
|
|
1099
1110
|
await this.connectAllChannels(i), this.config.endpointSelector?.rememberWorkingType(n), this.config.onRememberWorkingType?.(n), this.activeType = n, this.reconnectAttempts = 0, this.setState("connected");
|
|
1100
1111
|
return;
|
|
1101
1112
|
} catch (o) {
|
|
1102
|
-
|
|
1113
|
+
R.warn(`Failed to connect using ${U[n]}: ${o}`), this.disconnectAll();
|
|
1103
1114
|
}
|
|
1104
1115
|
}
|
|
1105
|
-
throw
|
|
1116
|
+
throw R.error("All endpoint types failed"), e || this.setState("offline"), new Error("Failed to connect using any endpoint type");
|
|
1106
1117
|
}
|
|
1107
1118
|
/**
|
|
1108
1119
|
* Connect all channels for a given endpoint type in parallel.
|
|
@@ -1120,7 +1131,7 @@ class Rt {
|
|
|
1120
1131
|
* Connect a single channel.
|
|
1121
1132
|
*/
|
|
1122
1133
|
async connectChannel(e) {
|
|
1123
|
-
const r = new
|
|
1134
|
+
const r = new yt({
|
|
1124
1135
|
entrypoint: e,
|
|
1125
1136
|
sessionId: this.config.sessionId,
|
|
1126
1137
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1162,10 +1173,10 @@ class Rt {
|
|
|
1162
1173
|
handleChannelClose(e, r, s, n) {
|
|
1163
1174
|
if (!(this.state === "idle" || this.state === "stopped" || this.state === "offline")) {
|
|
1164
1175
|
if (s || n) {
|
|
1165
|
-
|
|
1176
|
+
R.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1166
1177
|
return;
|
|
1167
1178
|
}
|
|
1168
|
-
this.state === "connected" && (
|
|
1179
|
+
this.state === "connected" && (R.error("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1169
1180
|
}
|
|
1170
1181
|
}
|
|
1171
1182
|
/**
|
|
@@ -1175,16 +1186,16 @@ class Rt {
|
|
|
1175
1186
|
if (!this.shouldReconnect)
|
|
1176
1187
|
return;
|
|
1177
1188
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1178
|
-
|
|
1189
|
+
R.error(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Tt(this.config.maxReconnectAttempts));
|
|
1179
1190
|
return;
|
|
1180
1191
|
}
|
|
1181
1192
|
this.setState("reconnecting"), this.reconnectAttempts++;
|
|
1182
1193
|
const e = this.config.reconnectBackoffMs * Math.pow(2, this.reconnectAttempts - 1);
|
|
1183
|
-
if (
|
|
1194
|
+
if (R.info(`Reconnecting in ${e}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await ct(e, this.abortController?.signal), !!this.shouldReconnect)
|
|
1184
1195
|
try {
|
|
1185
1196
|
await this.connectInternal(!0);
|
|
1186
1197
|
} catch (r) {
|
|
1187
|
-
|
|
1198
|
+
R.error("Reconnect failed:", r), await this.attemptReconnect();
|
|
1188
1199
|
}
|
|
1189
1200
|
}
|
|
1190
1201
|
/**
|
|
@@ -1202,141 +1213,151 @@ class Rt {
|
|
|
1202
1213
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1203
1214
|
}
|
|
1204
1215
|
}
|
|
1205
|
-
const st =
|
|
1216
|
+
const st = B("ProtocolWorker"), S = (t, e) => {
|
|
1206
1217
|
self.postMessage(t, e ?? []);
|
|
1207
1218
|
};
|
|
1208
|
-
let
|
|
1209
|
-
const w = [],
|
|
1219
|
+
let N = null, H, A = null;
|
|
1220
|
+
const w = [], c = [], D = /* @__PURE__ */ new Map(), u = [], T = [], y = /* @__PURE__ */ new Map(), x = [];
|
|
1210
1221
|
function Y() {
|
|
1211
1222
|
try {
|
|
1212
|
-
|
|
1223
|
+
N?.disconnect();
|
|
1213
1224
|
} catch (t) {
|
|
1214
1225
|
st.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1215
1226
|
}
|
|
1216
|
-
|
|
1217
|
-
for (let t = 0; t <
|
|
1227
|
+
N = null;
|
|
1228
|
+
for (let t = 0; t < c.length; t++)
|
|
1218
1229
|
try {
|
|
1219
|
-
|
|
1230
|
+
c[t].port.close();
|
|
1220
1231
|
} catch {
|
|
1221
1232
|
}
|
|
1222
|
-
w.length = 0,
|
|
1223
|
-
for (let t = 0; t <
|
|
1233
|
+
w.length = 0, c.length = 0, D.clear();
|
|
1234
|
+
for (let t = 0; t < T.length; t++)
|
|
1224
1235
|
try {
|
|
1225
|
-
|
|
1236
|
+
T[t].port.close();
|
|
1226
1237
|
} catch {
|
|
1227
1238
|
}
|
|
1228
|
-
|
|
1239
|
+
u.length = 0, T.length = 0, y.clear();
|
|
1229
1240
|
}
|
|
1230
1241
|
function v(t) {
|
|
1231
1242
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1232
|
-
|
|
1243
|
+
S({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1233
1244
|
}
|
|
1234
|
-
function Ut(
|
|
1235
|
-
|
|
1245
|
+
function Ut() {
|
|
1246
|
+
let t = 0;
|
|
1247
|
+
for (let e = 0; e < c.length; e++)
|
|
1248
|
+
t |= c[e].opcodeGroupsMask;
|
|
1249
|
+
return t;
|
|
1236
1250
|
}
|
|
1237
1251
|
function St(t) {
|
|
1252
|
+
if (H === void 0)
|
|
1253
|
+
return !0;
|
|
1254
|
+
const e = k(t);
|
|
1255
|
+
if ((e & H) !== 0)
|
|
1256
|
+
return !0;
|
|
1257
|
+
const r = Ut();
|
|
1258
|
+
return (e & r) !== 0;
|
|
1259
|
+
}
|
|
1260
|
+
function gt(t) {
|
|
1238
1261
|
x.length = 0;
|
|
1239
|
-
for (let e = 0; e <
|
|
1240
|
-
const r =
|
|
1262
|
+
for (let e = 0; e < c.length; e++) {
|
|
1263
|
+
const r = c[e];
|
|
1241
1264
|
(r.opcodeGroupsMask & t) !== 0 && x.push(r.port);
|
|
1242
1265
|
}
|
|
1243
1266
|
return x;
|
|
1244
1267
|
}
|
|
1245
|
-
function
|
|
1268
|
+
function Lt(t, e) {
|
|
1246
1269
|
return (k(t) & e) !== 0;
|
|
1247
1270
|
}
|
|
1248
|
-
function
|
|
1249
|
-
if (!
|
|
1271
|
+
function Pt(t, e) {
|
|
1272
|
+
if (!N || !e || typeof e != "object")
|
|
1250
1273
|
return;
|
|
1251
1274
|
const r = e;
|
|
1252
1275
|
if (!(r.type !== "send" || !(r.message instanceof ArrayBuffer)))
|
|
1253
1276
|
try {
|
|
1254
1277
|
const s = new Uint8Array(r.message);
|
|
1255
|
-
if (!
|
|
1278
|
+
if (!Lt(s, t))
|
|
1256
1279
|
return;
|
|
1257
|
-
|
|
1280
|
+
N.sendProtocolMessage(s), A && A.postMessage({ direction: "sent", message: Array.from(s) });
|
|
1258
1281
|
} catch (s) {
|
|
1259
1282
|
v(s);
|
|
1260
1283
|
}
|
|
1261
1284
|
}
|
|
1262
|
-
async function
|
|
1263
|
-
Y(),
|
|
1285
|
+
async function mt(t) {
|
|
1286
|
+
Y(), N = new wt({
|
|
1264
1287
|
sessionId: t.sessionId,
|
|
1265
1288
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1266
1289
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
1267
1290
|
maxReconnectAttempts: t.maxReconnectAttempts,
|
|
1268
1291
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1269
1292
|
onStateChange: (e) => {
|
|
1270
|
-
|
|
1293
|
+
S({ type: "state", state: e, activeType: N?.activeEndpointType ?? void 0 });
|
|
1271
1294
|
},
|
|
1272
1295
|
onRememberWorkingType: () => {
|
|
1273
|
-
|
|
1296
|
+
S({ type: "state", state: N?.managerState ?? "idle", activeType: N?.activeEndpointType ?? void 0 });
|
|
1274
1297
|
},
|
|
1275
1298
|
onError: (e) => {
|
|
1276
1299
|
v(e);
|
|
1277
1300
|
},
|
|
1278
1301
|
onProtocolMessage: (e) => {
|
|
1279
|
-
|
|
1280
|
-
const r = k(e), s =
|
|
1302
|
+
A && A.postMessage({ direction: "received", message: Array.from(e) });
|
|
1303
|
+
const r = k(e), s = St(e), n = gt(r);
|
|
1281
1304
|
if (!(!s && n.length === 0))
|
|
1282
1305
|
try {
|
|
1283
1306
|
const i = $(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, E = n.length > 0;
|
|
1284
1307
|
if (E && !s && n.length === 1 && o) {
|
|
1285
|
-
const
|
|
1286
|
-
n[0].postMessage({ type: "protocol", message:
|
|
1308
|
+
const a = e.buffer;
|
|
1309
|
+
n[0].postMessage({ type: "protocol", message: a, headers: i }, [a]);
|
|
1287
1310
|
return;
|
|
1288
1311
|
}
|
|
1289
1312
|
if (!E && s && o) {
|
|
1290
|
-
const
|
|
1291
|
-
|
|
1313
|
+
const a = e.buffer;
|
|
1314
|
+
S({ type: "protocol", message: a, headers: i }, [a]);
|
|
1292
1315
|
return;
|
|
1293
1316
|
}
|
|
1294
1317
|
if (E && o) {
|
|
1295
|
-
const
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
U({ type: "protocol", message: a, headers: i }, [a]);
|
|
1304
|
-
}
|
|
1318
|
+
const a = [];
|
|
1319
|
+
for (let _ = 1; _ < n.length; _++)
|
|
1320
|
+
a.push(e.slice().buffer);
|
|
1321
|
+
const h = s ? e.slice().buffer : null, f = e.buffer;
|
|
1322
|
+
n[0].postMessage({ type: "protocol", message: f, headers: i }, [f]);
|
|
1323
|
+
for (let _ = 1; _ < n.length; _++)
|
|
1324
|
+
n[_].postMessage({ type: "protocol", message: a[_ - 1], headers: i }, [a[_ - 1]]);
|
|
1325
|
+
h && S({ type: "protocol", message: h, headers: i }, [h]);
|
|
1305
1326
|
return;
|
|
1306
1327
|
}
|
|
1307
1328
|
if (E)
|
|
1308
|
-
for (const
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1329
|
+
for (const a of n) {
|
|
1330
|
+
const h = e.slice().buffer;
|
|
1331
|
+
a.postMessage({ type: "protocol", message: h, headers: i }, [h]);
|
|
1311
1332
|
}
|
|
1312
1333
|
if (s) {
|
|
1313
|
-
const
|
|
1314
|
-
|
|
1334
|
+
const a = e.slice().buffer;
|
|
1335
|
+
S({ type: "protocol", message: a, headers: i }, [a]);
|
|
1315
1336
|
}
|
|
1316
1337
|
} catch (i) {
|
|
1317
1338
|
v(i);
|
|
1318
1339
|
}
|
|
1319
1340
|
}
|
|
1320
|
-
}), await
|
|
1341
|
+
}), await N.connect(t.entrypoints);
|
|
1321
1342
|
}
|
|
1322
1343
|
self.addEventListener("message", (t) => {
|
|
1323
1344
|
const e = t.data;
|
|
1324
1345
|
if (e.type === "connect") {
|
|
1325
|
-
|
|
1346
|
+
mt(e).catch((r) => {
|
|
1326
1347
|
st.error(`Failed to connect: ${r}`), v(r), Y();
|
|
1327
1348
|
});
|
|
1328
1349
|
return;
|
|
1329
1350
|
}
|
|
1330
1351
|
if (e.type === "disconnect") {
|
|
1331
|
-
Y(),
|
|
1352
|
+
Y(), S({ type: "state", state: "idle" });
|
|
1332
1353
|
return;
|
|
1333
1354
|
}
|
|
1334
1355
|
if (e.type === "send") {
|
|
1335
|
-
if (!
|
|
1356
|
+
if (!N)
|
|
1336
1357
|
return;
|
|
1337
1358
|
try {
|
|
1338
1359
|
const r = new Uint8Array(e.message);
|
|
1339
|
-
|
|
1360
|
+
N.sendProtocolMessage(r), A && A.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1340
1361
|
} catch (r) {
|
|
1341
1362
|
v(r);
|
|
1342
1363
|
}
|
|
@@ -1347,7 +1368,7 @@ self.addEventListener("message", (t) => {
|
|
|
1347
1368
|
return;
|
|
1348
1369
|
}
|
|
1349
1370
|
if (e.type === "enableDevtools") {
|
|
1350
|
-
e.enabled && !
|
|
1371
|
+
e.enabled && !A ? A = new BroadcastChannel("ikon:devtools") : !e.enabled && A && (A.close(), A = null);
|
|
1351
1372
|
return;
|
|
1352
1373
|
}
|
|
1353
1374
|
if (e.type === "attachPort") {
|
|
@@ -1356,13 +1377,13 @@ self.addEventListener("message", (t) => {
|
|
|
1356
1377
|
} catch {
|
|
1357
1378
|
}
|
|
1358
1379
|
const r = w.length;
|
|
1359
|
-
w.push(e.portId),
|
|
1380
|
+
w.push(e.portId), c.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), D.set(e.portId, r);
|
|
1360
1381
|
return;
|
|
1361
1382
|
}
|
|
1362
1383
|
if (e.type === "detachPort") {
|
|
1363
|
-
const r =
|
|
1384
|
+
const r = D.get(e.portId);
|
|
1364
1385
|
if (r !== void 0) {
|
|
1365
|
-
const s =
|
|
1386
|
+
const s = c[r];
|
|
1366
1387
|
try {
|
|
1367
1388
|
s.port.close();
|
|
1368
1389
|
} catch {
|
|
@@ -1370,52 +1391,52 @@ self.addEventListener("message", (t) => {
|
|
|
1370
1391
|
const n = w.length - 1;
|
|
1371
1392
|
if (r !== n) {
|
|
1372
1393
|
const i = w[n];
|
|
1373
|
-
w[r] = i,
|
|
1394
|
+
w[r] = i, c[r] = c[n], D.set(i, r);
|
|
1374
1395
|
}
|
|
1375
|
-
w.length--,
|
|
1396
|
+
w.length--, c.length--, D.delete(e.portId);
|
|
1376
1397
|
}
|
|
1377
1398
|
return;
|
|
1378
1399
|
}
|
|
1379
1400
|
if (e.type === "attachSendPort") {
|
|
1380
1401
|
const r = y.get(e.portId);
|
|
1381
1402
|
if (r !== void 0) {
|
|
1382
|
-
const i =
|
|
1403
|
+
const i = T[r];
|
|
1383
1404
|
try {
|
|
1384
1405
|
i.port.close();
|
|
1385
1406
|
} catch {
|
|
1386
1407
|
}
|
|
1387
|
-
const o =
|
|
1408
|
+
const o = u.length - 1;
|
|
1388
1409
|
if (r !== o) {
|
|
1389
|
-
const E =
|
|
1390
|
-
|
|
1410
|
+
const E = u[o];
|
|
1411
|
+
u[r] = E, T[r] = T[o], y.set(E, r);
|
|
1391
1412
|
}
|
|
1392
|
-
|
|
1413
|
+
u.length--, T.length--, y.delete(e.portId);
|
|
1393
1414
|
}
|
|
1394
|
-
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n =
|
|
1395
|
-
|
|
1415
|
+
const s = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, n = u.length;
|
|
1416
|
+
u.push(e.portId), T.push(s), y.set(e.portId, n);
|
|
1396
1417
|
try {
|
|
1397
1418
|
s.port.start?.();
|
|
1398
1419
|
} catch {
|
|
1399
1420
|
}
|
|
1400
1421
|
s.port.addEventListener("message", (i) => {
|
|
1401
|
-
|
|
1422
|
+
Pt(s.opcodeGroupsMask, i.data);
|
|
1402
1423
|
});
|
|
1403
1424
|
return;
|
|
1404
1425
|
}
|
|
1405
1426
|
if (e.type === "detachSendPort") {
|
|
1406
1427
|
const r = y.get(e.portId);
|
|
1407
1428
|
if (r !== void 0) {
|
|
1408
|
-
const s =
|
|
1429
|
+
const s = T[r];
|
|
1409
1430
|
try {
|
|
1410
1431
|
s.port.close();
|
|
1411
1432
|
} catch {
|
|
1412
1433
|
}
|
|
1413
|
-
const n =
|
|
1434
|
+
const n = u.length - 1;
|
|
1414
1435
|
if (r !== n) {
|
|
1415
|
-
const i =
|
|
1416
|
-
|
|
1436
|
+
const i = u[n];
|
|
1437
|
+
u[r] = i, T[r] = T[n], y.set(i, r);
|
|
1417
1438
|
}
|
|
1418
|
-
|
|
1439
|
+
u.length--, T.length--, y.delete(e.portId);
|
|
1419
1440
|
}
|
|
1420
1441
|
return;
|
|
1421
1442
|
}
|