@ikonai/sdk 1.0.45 → 1.0.47
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-BnmgtUMV.js → audio-capture-worker-Brmt2Z7a.js} +156 -152
- package/assets/{audio-playback-worker-os3j8TEw.js → audio-playback-worker-CyEW91Py.js} +91 -83
- package/assets/{protocol-worker-CMTcdGdm.js → protocol-worker-9F3vWnC8.js} +456 -455
- package/assets/{video-capture-worker-CUqzL0P7.js → video-capture-worker-_LRzpUOA.js} +152 -143
- package/assets/{video-playback-worker-BoE6foO2.js → video-playback-worker-Dlf8ieLP.js} +61 -53
- package/channel/channel-manager.d.ts +12 -18
- package/channel/channel.d.ts +8 -2
- package/client/endpoint-selector.d.ts +0 -7
- package/client/ikon-client-config.d.ts +18 -3
- package/client/ikon-client.d.ts +23 -1
- package/connection/urls.d.ts +2 -2
- package/index.js +2289 -2096
- package/media/ikon-audio-capture.d.ts +15 -2
- package/media/ikon-video-capture.d.ts +7 -0
- package/package.json +1 -1
- package/transport/transport.d.ts +1 -2
- package/utils/query-params.d.ts +2 -2
- package/webrtc/webrtc-signaling.d.ts +16 -4
|
@@ -1,115 +1,115 @@
|
|
|
1
|
-
function
|
|
1
|
+
function j(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 v(t) {
|
|
7
|
+
return j(t) & 4294901760;
|
|
8
8
|
}
|
|
9
9
|
function H(t) {
|
|
10
|
-
const e = It(t),
|
|
10
|
+
const e = It(t), n = 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 =
|
|
14
|
-
if (27 +
|
|
13
|
+
const r = n.getUint32(0, !0), s = n.getUint32(4, !0), i = n.getUint32(8, !0), o = n.getUint32(12, !0), a = n.getUint32(16, !0), E = n.getUint32(20, !0), _ = n.getUint8(24), l = n.getUint8(25), T = n.getUint8(26);
|
|
14
|
+
if (27 + E * 4 > e.length)
|
|
15
15
|
throw new Error("Protocol header exceeds payload length");
|
|
16
|
-
const
|
|
16
|
+
const c = [];
|
|
17
17
|
let g = 27;
|
|
18
|
-
for (let O = 0; O <
|
|
19
|
-
|
|
18
|
+
for (let O = 0; O < E; O++)
|
|
19
|
+
c.push(n.getUint32(g, !0)), g += 4;
|
|
20
20
|
return {
|
|
21
21
|
length: r,
|
|
22
|
-
opcode:
|
|
22
|
+
opcode: s,
|
|
23
23
|
senderId: i,
|
|
24
24
|
trackId: o,
|
|
25
25
|
sequenceId: a,
|
|
26
|
-
targetIds:
|
|
27
|
-
payloadVersion:
|
|
28
|
-
payloadType:
|
|
29
|
-
flags:
|
|
26
|
+
targetIds: c,
|
|
27
|
+
payloadVersion: _,
|
|
28
|
+
payloadType: l,
|
|
29
|
+
flags: T
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
const
|
|
34
|
-
|
|
32
|
+
function Et(t, e, n, r, s) {
|
|
33
|
+
const E = [], l = 27 + E.length * 4, T = l + e.length, S = new Uint8Array(T), c = new DataView(S.buffer);
|
|
34
|
+
c.setUint32(0, T, !0), c.setUint32(4, t >>> 0, !0), c.setUint32(8, r >>> 0, !0), c.setUint32(12, 0, !0), c.setUint32(16, 0, !0), c.setUint32(20, E.length >>> 0, !0), c.setUint8(24, n & 255), c.setUint8(25, 8), c.setUint8(26, 0);
|
|
35
35
|
let g = 27;
|
|
36
|
-
for (let O = 0; O <
|
|
37
|
-
|
|
38
|
-
return S.set(e,
|
|
36
|
+
for (let O = 0; O < E.length; O++)
|
|
37
|
+
c.setUint32(g, E[O] >>> 0, !0), g += 4;
|
|
38
|
+
return S.set(e, l), S;
|
|
39
39
|
}
|
|
40
|
-
var
|
|
41
|
-
const
|
|
40
|
+
var m = /* @__PURE__ */ ((t) => (t[t.Null = 1] = "Null", t[t.Bool = 2] = "Bool", t[t.Int32 = 3] = "Int32", t[t.Int64 = 4] = "Int64", t[t.UInt32 = 5] = "UInt32", t[t.UInt64 = 6] = "UInt64", t[t.Float32 = 7] = "Float32", t[t.Float64 = 8] = "Float64", t[t.Array = 9] = "Array", t[t.Dict = 10] = "Dict", t[t.Object = 11] = "Object", t[t.String = 12] = "String", t[t.Binary = 13] = "Binary", t[t.Guid = 14] = "Guid", t))(m || {});
|
|
41
|
+
const lt = 161, ht = 162, W = new TextEncoder();
|
|
42
42
|
new TextDecoder("utf-8", { fatal: !0 });
|
|
43
43
|
class G {
|
|
44
44
|
constructor(e = 1) {
|
|
45
|
-
this.version = e, this.buffer.writeByte(
|
|
45
|
+
this.version = e, this.buffer.writeByte(lt), this.buffer.writeVarUInt(e >>> 0);
|
|
46
46
|
}
|
|
47
47
|
buffer = new D();
|
|
48
48
|
closed = !1;
|
|
49
49
|
cached;
|
|
50
|
-
writeInt32Field(e,
|
|
51
|
-
this.writeFixedField(e, 3, () => this.buffer.writeInt32(
|
|
50
|
+
writeInt32Field(e, n) {
|
|
51
|
+
this.writeFixedField(e, 3, () => this.buffer.writeInt32(n | 0));
|
|
52
52
|
}
|
|
53
|
-
writeUInt32Field(e,
|
|
54
|
-
this.writeFixedField(e, 5, () => this.buffer.writeUInt32(
|
|
53
|
+
writeUInt32Field(e, n) {
|
|
54
|
+
this.writeFixedField(e, 5, () => this.buffer.writeUInt32(n >>> 0));
|
|
55
55
|
}
|
|
56
|
-
writeInt64Field(e,
|
|
57
|
-
this.writeFixedField(e, 4, () => this.buffer.writeBigInt64(
|
|
56
|
+
writeInt64Field(e, n) {
|
|
57
|
+
this.writeFixedField(e, 4, () => this.buffer.writeBigInt64(n));
|
|
58
58
|
}
|
|
59
|
-
writeUInt64Field(e,
|
|
60
|
-
this.writeFixedField(e, 6, () => this.buffer.writeBigUInt64(
|
|
59
|
+
writeUInt64Field(e, n) {
|
|
60
|
+
this.writeFixedField(e, 6, () => this.buffer.writeBigUInt64(n));
|
|
61
61
|
}
|
|
62
|
-
writeFloat32Field(e,
|
|
63
|
-
this.writeFixedField(e, 7, () => this.buffer.writeFloat32(
|
|
62
|
+
writeFloat32Field(e, n) {
|
|
63
|
+
this.writeFixedField(e, 7, () => this.buffer.writeFloat32(n));
|
|
64
64
|
}
|
|
65
|
-
writeFloat64Field(e,
|
|
66
|
-
this.writeFixedField(e, 8, () => this.buffer.writeFloat64(
|
|
65
|
+
writeFloat64Field(e, n) {
|
|
66
|
+
this.writeFixedField(e, 8, () => this.buffer.writeFloat64(n));
|
|
67
67
|
}
|
|
68
|
-
writeBoolField(e,
|
|
69
|
-
this.writeFixedField(e, 2, () => this.buffer.writeByte(
|
|
68
|
+
writeBoolField(e, n) {
|
|
69
|
+
this.writeFixedField(e, 2, () => this.buffer.writeByte(n ? 1 : 0));
|
|
70
70
|
}
|
|
71
|
-
writeGuidField(e,
|
|
72
|
-
const r =
|
|
71
|
+
writeGuidField(e, n) {
|
|
72
|
+
const r = n instanceof h ? n.asBytes() : n;
|
|
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
|
-
writeStringField(e,
|
|
78
|
-
const r = W.encode(
|
|
77
|
+
writeStringField(e, n) {
|
|
78
|
+
const r = W.encode(n ?? "");
|
|
79
79
|
this.writeVariableField(e, 12, r);
|
|
80
80
|
}
|
|
81
|
-
writeBinaryField(e,
|
|
82
|
-
this.writeVariableField(e, 13,
|
|
81
|
+
writeBinaryField(e, n) {
|
|
82
|
+
this.writeVariableField(e, 13, n);
|
|
83
83
|
}
|
|
84
|
-
writeObjectField(e,
|
|
85
|
-
const
|
|
86
|
-
r(
|
|
87
|
-
const i =
|
|
84
|
+
writeObjectField(e, n, r) {
|
|
85
|
+
const s = new G(n);
|
|
86
|
+
r(s);
|
|
87
|
+
const i = s.finish();
|
|
88
88
|
this.writeVariableField(e, 11, i);
|
|
89
89
|
}
|
|
90
|
-
writeArrayField(e,
|
|
91
|
-
const
|
|
92
|
-
r(
|
|
93
|
-
const i =
|
|
90
|
+
writeArrayField(e, n, r) {
|
|
91
|
+
const s = new Y(n);
|
|
92
|
+
r(s);
|
|
93
|
+
const i = s.finish();
|
|
94
94
|
this.writeVariableField(e, 9, i);
|
|
95
95
|
}
|
|
96
|
-
writeDictionaryField(e,
|
|
97
|
-
const i = new
|
|
98
|
-
|
|
96
|
+
writeDictionaryField(e, n, r, s) {
|
|
97
|
+
const i = new z(n, r);
|
|
98
|
+
s(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(ht), this.closed = !0, this.cached = this.buffer.toUint8Array()), this.cached;
|
|
104
104
|
}
|
|
105
|
-
writeFixedField(e,
|
|
106
|
-
this.writeFieldHeader(e,
|
|
105
|
+
writeFixedField(e, n, r) {
|
|
106
|
+
this.writeFieldHeader(e, n, 0), r();
|
|
107
107
|
}
|
|
108
|
-
writeVariableField(e,
|
|
109
|
-
this.writeFieldHeader(e,
|
|
108
|
+
writeVariableField(e, n, r) {
|
|
109
|
+
this.writeFieldHeader(e, n, r.length), this.buffer.writeBytes(r);
|
|
110
110
|
}
|
|
111
|
-
writeFieldHeader(e,
|
|
112
|
-
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(K(
|
|
111
|
+
writeFieldHeader(e, n, r) {
|
|
112
|
+
this.buffer.writeUInt32(e >>> 0), this.buffer.writeByte(K(n)), Tt(n) && this.buffer.writeVarUInt(r >>> 0);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
115
|
class Y {
|
|
@@ -165,18 +165,18 @@ class Y {
|
|
|
165
165
|
14
|
|
166
166
|
/* Guid */
|
|
167
167
|
), this.count++;
|
|
168
|
-
const
|
|
169
|
-
if (
|
|
168
|
+
const n = e instanceof h ? e.asBytes() : e;
|
|
169
|
+
if (n.length !== 16)
|
|
170
170
|
throw new Error("Guid payload must be 16 bytes");
|
|
171
|
-
this.payload.writeBytes(
|
|
171
|
+
this.payload.writeBytes(n);
|
|
172
172
|
}
|
|
173
173
|
writeString(e) {
|
|
174
174
|
this.ensureElementType(
|
|
175
175
|
12
|
|
176
176
|
/* String */
|
|
177
177
|
), this.count++;
|
|
178
|
-
const
|
|
179
|
-
this.payload.writeVarUInt(
|
|
178
|
+
const n = W.encode(e ?? "");
|
|
179
|
+
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n);
|
|
180
180
|
}
|
|
181
181
|
writeBinary(e) {
|
|
182
182
|
this.ensureElementType(
|
|
@@ -184,34 +184,34 @@ class Y {
|
|
|
184
184
|
/* Binary */
|
|
185
185
|
), this.count++, this.payload.writeVarUInt(e.length), this.payload.writeBytes(e);
|
|
186
186
|
}
|
|
187
|
-
writeObject(e,
|
|
187
|
+
writeObject(e, n) {
|
|
188
188
|
this.ensureElementType(
|
|
189
189
|
11
|
|
190
190
|
/* Object */
|
|
191
191
|
), this.count++;
|
|
192
192
|
const r = new G(e);
|
|
193
|
-
|
|
194
|
-
const
|
|
195
|
-
this.payload.writeVarUInt(
|
|
193
|
+
n(r);
|
|
194
|
+
const s = r.finish();
|
|
195
|
+
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s);
|
|
196
196
|
}
|
|
197
|
-
writeArray(e,
|
|
197
|
+
writeArray(e, n) {
|
|
198
198
|
this.ensureElementType(
|
|
199
199
|
9
|
|
200
200
|
/* Array */
|
|
201
201
|
), this.count++;
|
|
202
202
|
const r = new Y(e);
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
this.payload.writeBytes(
|
|
203
|
+
n(r);
|
|
204
|
+
const s = r.finish();
|
|
205
|
+
this.payload.writeBytes(s);
|
|
206
206
|
}
|
|
207
|
-
writeDictionary(e,
|
|
207
|
+
writeDictionary(e, n, r) {
|
|
208
208
|
this.ensureElementType(
|
|
209
209
|
10
|
|
210
210
|
/* Dict */
|
|
211
211
|
), this.count++;
|
|
212
|
-
const
|
|
213
|
-
r(
|
|
214
|
-
const i =
|
|
212
|
+
const s = new z(e, n);
|
|
213
|
+
r(s);
|
|
214
|
+
const i = s.finish();
|
|
215
215
|
this.payload.writeBytes(i);
|
|
216
216
|
}
|
|
217
217
|
finish() {
|
|
@@ -220,12 +220,12 @@ class Y {
|
|
|
220
220
|
}
|
|
221
221
|
ensureElementType(e) {
|
|
222
222
|
if (this.elementType !== e)
|
|
223
|
-
throw new Error(`Array element type is ${
|
|
223
|
+
throw new Error(`Array element type is ${m[this.elementType]}, expected ${m[e]}`);
|
|
224
224
|
}
|
|
225
225
|
}
|
|
226
|
-
class
|
|
227
|
-
constructor(e,
|
|
228
|
-
this.keyType = e, this.valueType =
|
|
226
|
+
class z {
|
|
227
|
+
constructor(e, n) {
|
|
228
|
+
this.keyType = e, this.valueType = n, ct(e);
|
|
229
229
|
}
|
|
230
230
|
payload = new D();
|
|
231
231
|
count = 0;
|
|
@@ -245,8 +245,8 @@ class j {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
class _t {
|
|
248
|
-
constructor(e,
|
|
249
|
-
this.keyType = e, this.valueType =
|
|
248
|
+
constructor(e, n, r, s) {
|
|
249
|
+
this.keyType = e, this.valueType = n, this.payload = r, this.onComplete = s;
|
|
250
250
|
}
|
|
251
251
|
keyWritten = !1;
|
|
252
252
|
valueWritten = !1;
|
|
@@ -298,18 +298,18 @@ class _t {
|
|
|
298
298
|
14
|
|
299
299
|
/* Guid */
|
|
300
300
|
);
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
301
|
+
const n = e instanceof h ? e.asBytes() : e;
|
|
302
|
+
if (n.length !== 16)
|
|
303
303
|
throw new Error("Guid payload must be 16 bytes");
|
|
304
|
-
this.payload.writeBytes(
|
|
304
|
+
this.payload.writeBytes(n), this.keyWritten = !0;
|
|
305
305
|
}
|
|
306
306
|
writeKeyString(e) {
|
|
307
307
|
this.ensureKeyType(
|
|
308
308
|
12
|
|
309
309
|
/* String */
|
|
310
310
|
);
|
|
311
|
-
const
|
|
312
|
-
this.payload.writeVarUInt(
|
|
311
|
+
const n = W.encode(e ?? "");
|
|
312
|
+
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n), this.keyWritten = !0;
|
|
313
313
|
}
|
|
314
314
|
writeKeyBinary(e) {
|
|
315
315
|
this.ensureKeyType(
|
|
@@ -364,10 +364,10 @@ class _t {
|
|
|
364
364
|
14
|
|
365
365
|
/* Guid */
|
|
366
366
|
);
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
367
|
+
const n = e instanceof h ? e.asBytes() : e;
|
|
368
|
+
if (n.length !== 16)
|
|
369
369
|
throw new Error("Guid payload must be 16 bytes");
|
|
370
|
-
this.payload.writeBytes(
|
|
370
|
+
this.payload.writeBytes(n), this.valueWritten = !0;
|
|
371
371
|
}
|
|
372
372
|
writeNullValue() {
|
|
373
373
|
this.ensureValueType(
|
|
@@ -386,37 +386,37 @@ class _t {
|
|
|
386
386
|
12
|
|
387
387
|
/* String */
|
|
388
388
|
);
|
|
389
|
-
const
|
|
390
|
-
this.payload.writeVarUInt(
|
|
389
|
+
const n = W.encode(e ?? "");
|
|
390
|
+
this.payload.writeVarUInt(n.length), this.payload.writeBytes(n), this.valueWritten = !0;
|
|
391
391
|
}
|
|
392
|
-
writeValueObject(e,
|
|
392
|
+
writeValueObject(e, n) {
|
|
393
393
|
this.ensureValueType(
|
|
394
394
|
11
|
|
395
395
|
/* Object */
|
|
396
396
|
);
|
|
397
397
|
const r = new G(e);
|
|
398
|
-
|
|
399
|
-
const
|
|
400
|
-
this.payload.writeVarUInt(
|
|
398
|
+
n(r);
|
|
399
|
+
const s = r.finish();
|
|
400
|
+
this.payload.writeVarUInt(s.length), this.payload.writeBytes(s), this.valueWritten = !0;
|
|
401
401
|
}
|
|
402
|
-
writeValueArray(e,
|
|
402
|
+
writeValueArray(e, n) {
|
|
403
403
|
this.ensureValueType(
|
|
404
404
|
9
|
|
405
405
|
/* Array */
|
|
406
406
|
);
|
|
407
407
|
const r = new Y(e);
|
|
408
|
-
|
|
409
|
-
const
|
|
410
|
-
this.payload.writeBytes(
|
|
408
|
+
n(r);
|
|
409
|
+
const s = r.finish();
|
|
410
|
+
this.payload.writeBytes(s), this.valueWritten = !0;
|
|
411
411
|
}
|
|
412
|
-
writeValueDictionary(e,
|
|
412
|
+
writeValueDictionary(e, n, r) {
|
|
413
413
|
this.ensureValueType(
|
|
414
414
|
10
|
|
415
415
|
/* Dict */
|
|
416
416
|
);
|
|
417
|
-
const
|
|
418
|
-
r(
|
|
419
|
-
const i =
|
|
417
|
+
const s = new z(e, n);
|
|
418
|
+
r(s);
|
|
419
|
+
const i = s.finish();
|
|
420
420
|
this.payload.writeBytes(i), this.valueWritten = !0;
|
|
421
421
|
}
|
|
422
422
|
complete() {
|
|
@@ -428,52 +428,52 @@ class _t {
|
|
|
428
428
|
}
|
|
429
429
|
ensureKeyType(e) {
|
|
430
430
|
if (this.keyType !== e)
|
|
431
|
-
throw new Error(`Dictionary key type is ${
|
|
431
|
+
throw new Error(`Dictionary key type is ${m[this.keyType]}, expected ${m[e]}`);
|
|
432
432
|
}
|
|
433
433
|
ensureValueType(e) {
|
|
434
434
|
if (this.valueType !== e)
|
|
435
|
-
throw new Error(`Dictionary value type is ${
|
|
435
|
+
throw new Error(`Dictionary value type is ${m[this.valueType]}, expected ${m[e]}`);
|
|
436
436
|
}
|
|
437
437
|
}
|
|
438
|
-
class
|
|
438
|
+
class h {
|
|
439
439
|
constructor(e) {
|
|
440
440
|
this.bytes = e;
|
|
441
441
|
}
|
|
442
442
|
static fromString(e) {
|
|
443
443
|
if (!e)
|
|
444
444
|
throw new Error("Guid string is empty");
|
|
445
|
-
const
|
|
446
|
-
if (
|
|
445
|
+
const n = e.replace(/-/g, "");
|
|
446
|
+
if (n.length !== 32)
|
|
447
447
|
throw new Error("Guid string must be 32 hex characters");
|
|
448
|
-
const r = new Uint8Array(16),
|
|
449
|
-
|
|
448
|
+
const r = new Uint8Array(16), s = h.parseHexSlice(n, 0, 8), i = h.parseHexSlice(n, 8, 4), o = h.parseHexSlice(n, 12, 4);
|
|
449
|
+
h.writeUInt32LE(r, 0, s), h.writeUInt16LE(r, 4, i), h.writeUInt16LE(r, 6, o);
|
|
450
450
|
for (let a = 0; a < 8; a++)
|
|
451
|
-
r[8 + a] =
|
|
452
|
-
return new
|
|
451
|
+
r[8 + a] = h.parseHexSlice(n, 16 + a * 2, 2);
|
|
452
|
+
return new h(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 h(Uint8Array.from(e));
|
|
458
458
|
}
|
|
459
459
|
static createZero() {
|
|
460
|
-
return new
|
|
460
|
+
return new h(new Uint8Array(16));
|
|
461
461
|
}
|
|
462
462
|
static createRandom() {
|
|
463
|
-
const e = new Uint8Array(16),
|
|
464
|
-
if (
|
|
465
|
-
|
|
463
|
+
const e = new Uint8Array(16), n = globalThis.crypto;
|
|
464
|
+
if (n?.getRandomValues)
|
|
465
|
+
n.getRandomValues(e);
|
|
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 h(e);
|
|
470
470
|
}
|
|
471
471
|
toString() {
|
|
472
472
|
const e = this.bytes;
|
|
473
473
|
return [
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
474
|
+
h.toHex(h.readUInt32LE(e, 0), 8),
|
|
475
|
+
h.toHex(h.readUInt16LE(e, 4), 4),
|
|
476
|
+
h.toHex(h.readUInt16LE(e, 6), 4),
|
|
477
477
|
J(e.subarray(8, 10)),
|
|
478
478
|
J(e.subarray(10, 16))
|
|
479
479
|
].join("-");
|
|
@@ -481,28 +481,28 @@ class E {
|
|
|
481
481
|
asBytes() {
|
|
482
482
|
return this.bytes.slice();
|
|
483
483
|
}
|
|
484
|
-
static parseHexSlice(e,
|
|
485
|
-
const
|
|
484
|
+
static parseHexSlice(e, n, r) {
|
|
485
|
+
const s = e.substr(n, r), i = Number.parseInt(s, 16);
|
|
486
486
|
if (Number.isNaN(i))
|
|
487
487
|
throw new Error("Guid string contains invalid characters");
|
|
488
488
|
return i >>> 0;
|
|
489
489
|
}
|
|
490
|
-
static writeUInt32LE(e,
|
|
491
|
-
const
|
|
492
|
-
e[
|
|
490
|
+
static writeUInt32LE(e, n, r) {
|
|
491
|
+
const s = r >>> 0;
|
|
492
|
+
e[n] = s & 255, e[n + 1] = s >>> 8 & 255, e[n + 2] = s >>> 16 & 255, e[n + 3] = s >>> 24 & 255;
|
|
493
493
|
}
|
|
494
|
-
static writeUInt16LE(e,
|
|
495
|
-
const
|
|
496
|
-
e[
|
|
494
|
+
static writeUInt16LE(e, n, r) {
|
|
495
|
+
const s = r & 65535;
|
|
496
|
+
e[n] = s & 255, e[n + 1] = s >>> 8 & 255;
|
|
497
497
|
}
|
|
498
|
-
static readUInt32LE(e,
|
|
499
|
-
return (e[
|
|
498
|
+
static readUInt32LE(e, n) {
|
|
499
|
+
return (e[n] | e[n + 1] << 8 | e[n + 2] << 16 | e[n + 3] << 24) >>> 0;
|
|
500
500
|
}
|
|
501
|
-
static readUInt16LE(e,
|
|
502
|
-
return (e[
|
|
501
|
+
static readUInt16LE(e, n) {
|
|
502
|
+
return (e[n] | e[n + 1] << 8) & 65535;
|
|
503
503
|
}
|
|
504
|
-
static toHex(e,
|
|
505
|
-
return (e >>> 0).toString(16).padStart(
|
|
504
|
+
static toHex(e, n) {
|
|
505
|
+
return (e >>> 0).toString(16).padStart(n, "0");
|
|
506
506
|
}
|
|
507
507
|
}
|
|
508
508
|
class D {
|
|
@@ -514,14 +514,14 @@ class D {
|
|
|
514
514
|
this.buffer = new Uint8Array(D.INITIAL_CAPACITY), this.dataView = new DataView(this.buffer.buffer);
|
|
515
515
|
}
|
|
516
516
|
ensureCapacity(e) {
|
|
517
|
-
const
|
|
518
|
-
if (
|
|
517
|
+
const n = this.length + e;
|
|
518
|
+
if (n <= this.buffer.length)
|
|
519
519
|
return;
|
|
520
520
|
let r = this.buffer.length;
|
|
521
|
-
for (; r <
|
|
521
|
+
for (; r < n; )
|
|
522
522
|
r *= 2;
|
|
523
|
-
const
|
|
524
|
-
|
|
523
|
+
const s = new Uint8Array(r);
|
|
524
|
+
s.set(this.buffer.subarray(0, this.length)), this.buffer = s, this.dataView = new DataView(this.buffer.buffer);
|
|
525
525
|
}
|
|
526
526
|
writeByte(e) {
|
|
527
527
|
this.ensureCapacity(1), this.buffer[this.length++] = e & 255;
|
|
@@ -548,10 +548,10 @@ class D {
|
|
|
548
548
|
this.ensureCapacity(8), this.dataView.setBigUint64(this.length, e, !0), this.length += 8;
|
|
549
549
|
}
|
|
550
550
|
writeVarUInt(e) {
|
|
551
|
-
let
|
|
552
|
-
for (;
|
|
553
|
-
this.ensureCapacity(1), this.buffer[this.length++] =
|
|
554
|
-
this.ensureCapacity(1), this.buffer[this.length++] =
|
|
551
|
+
let n = e >>> 0;
|
|
552
|
+
for (; n >= 128; )
|
|
553
|
+
this.ensureCapacity(1), this.buffer[this.length++] = n & 127 | 128, n >>>= 7;
|
|
554
|
+
this.ensureCapacity(1), this.buffer[this.length++] = n & 127;
|
|
555
555
|
}
|
|
556
556
|
toUint8Array() {
|
|
557
557
|
return this.buffer.slice(0, this.length);
|
|
@@ -575,82 +575,82 @@ function J(t) {
|
|
|
575
575
|
function It(t) {
|
|
576
576
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
577
577
|
}
|
|
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 || {});
|
|
578
|
+
var N = /* @__PURE__ */ ((t) => (t[t.None = 0] = "None", t[t.WebSocket = 1] = "WebSocket", t[t.WebSocketProxy = 2] = "WebSocketProxy", t[t.WebTransport = 4] = "WebTransport", t[t.WebTransportProxy = 8] = "WebTransportProxy", t[t.Tcp = 16] = "Tcp", t[t.TcpProxy = 32] = "TcpProxy", t[t.Https = 64] = "Https", t[t.WebRTC = 128] = "WebRTC", t[t.TcpTls = 256] = "TcpTls", t[t.Udp = 512] = "Udp", t[t.UdpDtls = 1024] = "UdpDtls", t))(N || {}), V = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", t[t.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", t[t.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", t[t.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", t[t.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", t[t.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", t[t.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", t[t.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", t[t.CORE_WEBRTC_VIDEO_CAPTURE = 65572] = "CORE_WEBRTC_VIDEO_CAPTURE", t[t.CORE_RELAY_AGENT_AUTH = 65576] = "CORE_RELAY_AGENT_AUTH", t[t.CORE_RELAY_AGENT_AUTH_RESULT = 65577] = "CORE_RELAY_AGENT_AUTH_RESULT", t[t.CORE_RELAY_HEARTBEAT = 65578] = "CORE_RELAY_HEARTBEAT", t[t.CORE_RELAY_TCP_CONNECTION_OPENED = 65579] = "CORE_RELAY_TCP_CONNECTION_OPENED", t[t.CORE_RELAY_TCP_CONNECTION_CLOSED = 65580] = "CORE_RELAY_TCP_CONNECTION_CLOSED", t[t.CORE_RELAY_TCP_DATA = 65581] = "CORE_RELAY_TCP_DATA", t[t.CORE_RELAY_UDP_DATA = 65582] = "CORE_RELAY_UDP_DATA", t[t.CORE_RELAY_ADD_TUNNEL = 65583] = "CORE_RELAY_ADD_TUNNEL", t[t.CORE_RELAY_TUNNEL_ADDED = 65584] = "CORE_RELAY_TUNNEL_ADDED", t[t.CORE_RELAY_REMOVE_TUNNEL = 65585] = "CORE_RELAY_REMOVE_TUNNEL", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.ANALYTICS_IKON_RELAY_SERVER_STATS = 524297] = "ANALYTICS_IKON_RELAY_SERVER_STATS", t[t.ANALYTICS_IKON_TURN_SERVER_STATS = 524298] = "ANALYTICS_IKON_TURN_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", t[t.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", t[t.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", t[t.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", t[t.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", t[t.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", t[t.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", t[t.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", t[t.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", t[t.ACTION_FUNCTION_ENUMERATION_ITEM_BATCH = 1048651] = "ACTION_FUNCTION_ENUMERATION_ITEM_BATCH", t[t.ACTION_CALL_ACK = 1048652] = "ACTION_CALL_ACK", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.AUDIO_SHAPE_FRAME = 4194310] = "AUDIO_SHAPE_FRAME", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.GROUP_APP_LOCAL = 1073741824] = "GROUP_APP_LOCAL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(V || {});
|
|
579
579
|
const et = 1, At = 131074;
|
|
580
|
-
function
|
|
580
|
+
function nt(t) {
|
|
581
581
|
return {};
|
|
582
582
|
}
|
|
583
583
|
function ut(t) {
|
|
584
584
|
return new G(et).finish();
|
|
585
585
|
}
|
|
586
|
-
function rt(t, e,
|
|
586
|
+
function rt(t, e, n) {
|
|
587
587
|
const r = ut();
|
|
588
|
-
return
|
|
588
|
+
return Et(At, r, et, e);
|
|
589
589
|
}
|
|
590
|
-
class
|
|
591
|
-
constructor(e,
|
|
592
|
-
super(e), this.cause =
|
|
590
|
+
class st extends Error {
|
|
591
|
+
constructor(e, n) {
|
|
592
|
+
super(e), this.cause = n, this.name = "ConnectionError";
|
|
593
593
|
}
|
|
594
594
|
}
|
|
595
|
-
class
|
|
596
|
-
constructor(e,
|
|
597
|
-
super(e,
|
|
595
|
+
class y extends st {
|
|
596
|
+
constructor(e, n) {
|
|
597
|
+
super(e, n), this.name = "TransportError";
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
class q extends
|
|
600
|
+
class q extends y {
|
|
601
601
|
constructor(e) {
|
|
602
602
|
super(`No keepalive received within ${e}ms`), this.name = "KeepaliveTimeoutError";
|
|
603
603
|
}
|
|
604
604
|
}
|
|
605
|
-
class Z extends
|
|
605
|
+
class Z extends st {
|
|
606
606
|
constructor(e) {
|
|
607
607
|
super(`Maximum reconnection attempts (${e}) exceeded`), this.name = "MaxRetriesExceededError";
|
|
608
608
|
}
|
|
609
609
|
}
|
|
610
610
|
function Ct(t, e) {
|
|
611
|
-
return new Promise((
|
|
612
|
-
const
|
|
613
|
-
clearTimeout(i), r(new
|
|
611
|
+
return new Promise((n, r) => {
|
|
612
|
+
const s = () => {
|
|
613
|
+
clearTimeout(i), r(new DOMException("Aborted", "AbortError"));
|
|
614
614
|
}, i = setTimeout(() => {
|
|
615
|
-
e?.removeEventListener("abort",
|
|
615
|
+
e?.removeEventListener("abort", s), n();
|
|
616
616
|
}, t);
|
|
617
617
|
if (e?.aborted) {
|
|
618
|
-
clearTimeout(i), r(new
|
|
618
|
+
clearTimeout(i), r(new DOMException("Aborted", "AbortError"));
|
|
619
619
|
return;
|
|
620
620
|
}
|
|
621
|
-
e?.addEventListener("abort",
|
|
621
|
+
e?.addEventListener("abort", s, { once: !0 });
|
|
622
622
|
});
|
|
623
623
|
}
|
|
624
|
-
let
|
|
625
|
-
const
|
|
624
|
+
let Nt = 1;
|
|
625
|
+
const ft = /* @__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 Ut(t, e) {
|
|
633
633
|
return `[${t}] ${e}`;
|
|
634
634
|
}
|
|
635
|
-
function k(t, e,
|
|
636
|
-
const
|
|
637
|
-
timestamp:
|
|
635
|
+
function k(t, e, n, r) {
|
|
636
|
+
const s = (/* @__PURE__ */ new Date()).toISOString(), i = Rt[t], o = {
|
|
637
|
+
timestamp: s,
|
|
638
638
|
level: t,
|
|
639
639
|
levelName: i,
|
|
640
640
|
component: e,
|
|
641
|
-
message:
|
|
641
|
+
message: n,
|
|
642
642
|
args: r
|
|
643
643
|
};
|
|
644
|
-
for (const [a,
|
|
645
|
-
const
|
|
646
|
-
if (t >=
|
|
644
|
+
for (const [a, E] of ft) {
|
|
645
|
+
const _ = E?.minLevel ?? 2;
|
|
646
|
+
if (t >= _)
|
|
647
647
|
try {
|
|
648
648
|
a(o);
|
|
649
649
|
} catch {
|
|
650
650
|
}
|
|
651
651
|
}
|
|
652
|
-
if (
|
|
653
|
-
const a =
|
|
652
|
+
if (Nt <= t) {
|
|
653
|
+
const a = Ut(e, n);
|
|
654
654
|
switch (t) {
|
|
655
655
|
case 0:
|
|
656
656
|
console.debug(a, ...r);
|
|
@@ -667,41 +667,41 @@ function k(t, e, s, r) {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
}
|
|
670
|
-
function
|
|
670
|
+
function p(t) {
|
|
671
671
|
return {
|
|
672
|
-
debug(e, ...
|
|
673
|
-
k(0, t, e,
|
|
672
|
+
debug(e, ...n) {
|
|
673
|
+
k(0, t, e, n);
|
|
674
674
|
},
|
|
675
|
-
info(e, ...
|
|
676
|
-
k(1, t, e,
|
|
675
|
+
info(e, ...n) {
|
|
676
|
+
k(1, t, e, n);
|
|
677
677
|
},
|
|
678
|
-
warn(e, ...
|
|
679
|
-
k(2, t, e,
|
|
678
|
+
warn(e, ...n) {
|
|
679
|
+
k(2, t, e, n);
|
|
680
680
|
},
|
|
681
|
-
error(e, ...
|
|
682
|
-
k(3, t, e,
|
|
681
|
+
error(e, ...n) {
|
|
682
|
+
k(3, t, e, n);
|
|
683
683
|
}
|
|
684
684
|
};
|
|
685
685
|
}
|
|
686
|
-
const
|
|
686
|
+
const yt = "ikon-retry";
|
|
687
687
|
function St(t, e) {
|
|
688
688
|
if (typeof window > "u")
|
|
689
689
|
return null;
|
|
690
|
-
const
|
|
690
|
+
const n = new URLSearchParams(window.location.search), r = n.get(t);
|
|
691
691
|
if (r !== null)
|
|
692
692
|
return r;
|
|
693
|
-
const
|
|
694
|
-
return
|
|
693
|
+
const s = n.get(t.replace(/-/g, "_"));
|
|
694
|
+
return s !== null ? s : null;
|
|
695
695
|
}
|
|
696
696
|
function wt(t, e) {
|
|
697
|
-
const
|
|
698
|
-
return
|
|
697
|
+
const n = St(t);
|
|
698
|
+
return n === "true" ? !0 : n === "false" ? !1 : null;
|
|
699
699
|
}
|
|
700
700
|
function Lt() {
|
|
701
|
-
return wt(
|
|
701
|
+
return wt(yt) !== !1;
|
|
702
702
|
}
|
|
703
|
-
const b =
|
|
704
|
-
class
|
|
703
|
+
const b = p("WebSocketTransport"), gt = 1e4;
|
|
704
|
+
class Pt {
|
|
705
705
|
ws = null;
|
|
706
706
|
keepaliveTimeout = null;
|
|
707
707
|
isClosed = !1;
|
|
@@ -717,37 +717,37 @@ class mt {
|
|
|
717
717
|
get isConnected() {
|
|
718
718
|
return this.ws?.readyState === WebSocket.OPEN;
|
|
719
719
|
}
|
|
720
|
-
async connect(e,
|
|
720
|
+
async connect(e, n) {
|
|
721
721
|
this.isClosed = !1;
|
|
722
722
|
const r = Date.now();
|
|
723
|
-
return new Promise((
|
|
723
|
+
return new Promise((s, i) => {
|
|
724
724
|
try {
|
|
725
725
|
this.ws = new WebSocket(e), this.ws.binaryType = "arraybuffer";
|
|
726
|
-
} catch (
|
|
727
|
-
i(new
|
|
726
|
+
} catch (l) {
|
|
727
|
+
i(new y(`Failed to create WebSocket: ${l}`, l instanceof Error ? l : void 0));
|
|
728
728
|
return;
|
|
729
729
|
}
|
|
730
730
|
let o = !1, a = !1;
|
|
731
|
-
const
|
|
732
|
-
clearTimeout(
|
|
733
|
-
},
|
|
734
|
-
a || (a = !0,
|
|
731
|
+
const E = () => {
|
|
732
|
+
clearTimeout(_), this.ws && (this.ws.onopen = null, this.ws.onerror = null, this.ws.onclose = null, this.ws.onmessage = null);
|
|
733
|
+
}, _ = setTimeout(() => {
|
|
734
|
+
a || (a = !0, E(), this.ws?.close(), b.warn(`WebSocket connection timeout after ${this.connectionTimeoutMs}ms`), i(new y("WebSocket connection timeout")));
|
|
735
735
|
}, this.connectionTimeoutMs);
|
|
736
736
|
this.ws.onopen = () => {
|
|
737
|
-
o = !0, clearTimeout(
|
|
737
|
+
o = !0, clearTimeout(_), this.ws.send(n), this.resetKeepaliveTimeout(), a || (a = !0, b.info(`WebSocket connected in ${Date.now() - r}ms`), s());
|
|
738
738
|
}, this.ws.onerror = () => {
|
|
739
|
-
clearTimeout(
|
|
740
|
-
}, this.ws.onclose = (
|
|
739
|
+
clearTimeout(_), a || (a = !0, E(), b.debug(`WebSocket connection failed after ${Date.now() - r}ms`), i(new y("WebSocket connection failed")));
|
|
740
|
+
}, this.ws.onclose = (l) => {
|
|
741
741
|
if (this.clearKeepaliveTimeout(), !o && !a) {
|
|
742
|
-
a = !0,
|
|
742
|
+
a = !0, E(), i(new y("WebSocket connection closed before opening"));
|
|
743
743
|
return;
|
|
744
744
|
}
|
|
745
745
|
if (this.isClosed)
|
|
746
746
|
return;
|
|
747
|
-
const
|
|
748
|
-
this.callbacks.onClose(
|
|
749
|
-
}, this.ws.onmessage = (
|
|
750
|
-
this.handleProtocolMessage(new Uint8Array(
|
|
747
|
+
const T = l.wasClean && (l.code === 1e3 || l.code === 1001), S = l.reason || `code=${l.code}`;
|
|
748
|
+
this.callbacks.onClose(S, T);
|
|
749
|
+
}, this.ws.onmessage = (l) => {
|
|
750
|
+
this.handleProtocolMessage(new Uint8Array(l.data));
|
|
751
751
|
};
|
|
752
752
|
});
|
|
753
753
|
}
|
|
@@ -761,17 +761,17 @@ class mt {
|
|
|
761
761
|
* Get or create a cached keepalive response message.
|
|
762
762
|
*/
|
|
763
763
|
getKeepaliveResponse() {
|
|
764
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(
|
|
764
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(nt(), this.sessionId)), this.keepaliveResponseMessage;
|
|
765
765
|
}
|
|
766
766
|
handleProtocolMessage(e) {
|
|
767
767
|
try {
|
|
768
|
-
if (H(e).opcode ===
|
|
768
|
+
if (H(e).opcode === V.KEEPALIVE_REQUEST) {
|
|
769
769
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
770
770
|
return;
|
|
771
771
|
}
|
|
772
772
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
773
|
-
} catch (
|
|
774
|
-
b.error("Failed to process protocol message:",
|
|
773
|
+
} catch (n) {
|
|
774
|
+
b.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
resetKeepaliveTimeout() {
|
|
@@ -783,7 +783,7 @@ class mt {
|
|
|
783
783
|
this.keepaliveTimeout && (clearTimeout(this.keepaliveTimeout), this.keepaliveTimeout = null);
|
|
784
784
|
}
|
|
785
785
|
}
|
|
786
|
-
const
|
|
786
|
+
const U = p("WebTransportTransport"), mt = 1e4, tt = 4, Dt = 65536;
|
|
787
787
|
function it() {
|
|
788
788
|
return typeof WebTransport < "u";
|
|
789
789
|
}
|
|
@@ -809,48 +809,48 @@ class Ot {
|
|
|
809
809
|
callbacks;
|
|
810
810
|
sessionId;
|
|
811
811
|
constructor(e) {
|
|
812
|
-
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 ?? mt;
|
|
813
813
|
}
|
|
814
814
|
get isConnected() {
|
|
815
815
|
return this.transport !== null && this.writer !== null;
|
|
816
816
|
}
|
|
817
|
-
async connect(e,
|
|
817
|
+
async connect(e, n) {
|
|
818
818
|
if (!it())
|
|
819
|
-
throw new
|
|
819
|
+
throw new y("WebTransport is not supported in this browser");
|
|
820
820
|
this.isClosed = !1;
|
|
821
821
|
const r = Date.now();
|
|
822
822
|
try {
|
|
823
823
|
this.transport = new WebTransport(e);
|
|
824
|
-
let
|
|
824
|
+
let s;
|
|
825
825
|
const i = new Promise((o, a) => {
|
|
826
|
-
|
|
827
|
-
() => a(new
|
|
826
|
+
s = setTimeout(
|
|
827
|
+
() => a(new y("WebTransport connection timeout")),
|
|
828
828
|
this.connectionTimeoutMs
|
|
829
829
|
);
|
|
830
830
|
});
|
|
831
831
|
try {
|
|
832
|
-
await Promise.race([this.transport.ready, i]), clearTimeout(
|
|
832
|
+
await Promise.race([this.transport.ready, i]), clearTimeout(s);
|
|
833
833
|
} catch (o) {
|
|
834
|
-
throw clearTimeout(
|
|
834
|
+
throw clearTimeout(s), o instanceof y && U.warn(`WebTransport connection timeout after ${this.connectionTimeoutMs}ms`), o;
|
|
835
835
|
}
|
|
836
|
-
|
|
836
|
+
U.info(`WebTransport connected in ${Date.now() - r}ms`), this.transport.closed.then(() => {
|
|
837
837
|
this.handleClose("Connection closed", !0);
|
|
838
838
|
}).catch((o) => {
|
|
839
|
-
|
|
840
|
-
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(
|
|
841
|
-
} catch (
|
|
839
|
+
U.error("WebTransport connection closed with error:", o), this.handleClose(o.message || "Connection error", !1);
|
|
840
|
+
}), this.stream = await this.transport.createBidirectionalStream(), this.reader = this.stream.readable.getReader(), this.writer = this.stream.writable.getWriter(), await this.writer.write(n), this.resetKeepaliveTimeout(), this.startReadLoop();
|
|
841
|
+
} catch (s) {
|
|
842
842
|
this.cleanup();
|
|
843
843
|
const i = Date.now() - r;
|
|
844
|
-
throw
|
|
844
|
+
throw U.warn(`WebTransport connection failed after ${i}ms: ${s}`), new y(`Failed to connect WebTransport: ${s}`, s instanceof Error ? s : void 0);
|
|
845
845
|
}
|
|
846
846
|
}
|
|
847
847
|
send(e) {
|
|
848
848
|
if (!this.writer) {
|
|
849
|
-
|
|
849
|
+
U.warn("Cannot send: WebTransport not connected");
|
|
850
850
|
return;
|
|
851
851
|
}
|
|
852
|
-
this.writer.write(e).catch((
|
|
853
|
-
|
|
852
|
+
this.writer.write(e).catch((n) => {
|
|
853
|
+
U.error("Failed to send protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
|
|
854
854
|
});
|
|
855
855
|
}
|
|
856
856
|
close() {
|
|
@@ -864,14 +864,14 @@ class Ot {
|
|
|
864
864
|
this.readLoopActive = !0;
|
|
865
865
|
try {
|
|
866
866
|
for (; this.readLoopActive && this.reader; ) {
|
|
867
|
-
const { value: e, done:
|
|
868
|
-
if (
|
|
867
|
+
const { value: e, done: n } = await this.reader.read();
|
|
868
|
+
if (n)
|
|
869
869
|
break;
|
|
870
870
|
e && (this.appendToBuffer(e), this.processBufferedMessages());
|
|
871
871
|
}
|
|
872
872
|
this.readLoopActive && this.handleClose("Stream ended", !1);
|
|
873
873
|
} catch (e) {
|
|
874
|
-
this.readLoopActive && (
|
|
874
|
+
this.readLoopActive && (U.error("Read loop error:", e), this.callbacks.onError(e instanceof Error ? e : new Error(String(e))));
|
|
875
875
|
}
|
|
876
876
|
}
|
|
877
877
|
}
|
|
@@ -880,10 +880,10 @@ class Ot {
|
|
|
880
880
|
* Compacts when offset exceeds half capacity and data is sparse.
|
|
881
881
|
*/
|
|
882
882
|
appendToBuffer(e) {
|
|
883
|
-
const
|
|
883
|
+
const n = this.receiveBufferLength + e.length, r = this.receiveBufferOffset + this.receiveBufferLength;
|
|
884
884
|
if (r + e.length > this.receiveBuffer.length)
|
|
885
|
-
if (
|
|
886
|
-
const
|
|
885
|
+
if (n > this.receiveBuffer.length) {
|
|
886
|
+
const s = Math.max(n, this.receiveBuffer.length * 2), i = new Uint8Array(s);
|
|
887
887
|
i.set(this.receiveBuffer.subarray(this.receiveBufferOffset, r)), this.receiveBuffer = i, this.receiveBufferOffset = 0, this.receiveDataViewBuffer = null;
|
|
888
888
|
} else
|
|
889
889
|
this.receiveBuffer.copyWithin(0, this.receiveBufferOffset, r), this.receiveBufferOffset = 0;
|
|
@@ -900,7 +900,7 @@ class Ot {
|
|
|
900
900
|
* Get or create a cached keepalive response message.
|
|
901
901
|
*/
|
|
902
902
|
getKeepaliveResponse() {
|
|
903
|
-
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(
|
|
903
|
+
return this.keepaliveResponseMessage || (this.keepaliveResponseMessage = rt(nt(), this.sessionId)), this.keepaliveResponseMessage;
|
|
904
904
|
}
|
|
905
905
|
/**
|
|
906
906
|
* Process complete messages from the receive buffer.
|
|
@@ -910,15 +910,15 @@ class Ot {
|
|
|
910
910
|
processBufferedMessages() {
|
|
911
911
|
const e = this.getReceiveDataView();
|
|
912
912
|
for (; this.receiveBufferLength >= tt; ) {
|
|
913
|
-
const
|
|
914
|
-
if (
|
|
915
|
-
|
|
913
|
+
const n = e.getUint32(this.receiveBufferOffset, !0);
|
|
914
|
+
if (n < tt) {
|
|
915
|
+
U.error(`Invalid message length: ${n}`), this.callbacks.onError(new Error(`Invalid protocol message length: ${n}`)), this.receiveBufferOffset = 0, this.receiveBufferLength = 0;
|
|
916
916
|
return;
|
|
917
917
|
}
|
|
918
|
-
if (this.receiveBufferLength <
|
|
918
|
+
if (this.receiveBufferLength < n)
|
|
919
919
|
return;
|
|
920
|
-
const r = this.receiveBuffer.subarray(this.receiveBufferOffset, this.receiveBufferOffset +
|
|
921
|
-
this.receiveBufferOffset +=
|
|
920
|
+
const r = this.receiveBuffer.subarray(this.receiveBufferOffset, this.receiveBufferOffset + n);
|
|
921
|
+
this.receiveBufferOffset += n, this.receiveBufferLength -= n, this.handleProtocolMessage(r);
|
|
922
922
|
}
|
|
923
923
|
this.receiveBufferLength === 0 && (this.receiveBufferOffset = 0);
|
|
924
924
|
}
|
|
@@ -927,27 +927,27 @@ class Ot {
|
|
|
927
927
|
*/
|
|
928
928
|
handleProtocolMessage(e) {
|
|
929
929
|
try {
|
|
930
|
-
if (H(e).opcode ===
|
|
930
|
+
if (H(e).opcode === V.KEEPALIVE_REQUEST) {
|
|
931
931
|
this.send(this.getKeepaliveResponse()), this.resetKeepaliveTimeout();
|
|
932
932
|
return;
|
|
933
933
|
}
|
|
934
934
|
this.resetKeepaliveTimeout(), this.callbacks.onProtocolMessage(e);
|
|
935
|
-
} catch (
|
|
936
|
-
|
|
935
|
+
} catch (n) {
|
|
936
|
+
U.error("Failed to process protocol message:", n), this.callbacks.onError(n instanceof Error ? n : new Error(String(n)));
|
|
937
937
|
}
|
|
938
938
|
}
|
|
939
939
|
/**
|
|
940
940
|
* Handle connection close.
|
|
941
941
|
*/
|
|
942
|
-
handleClose(e,
|
|
943
|
-
this.isClosed || (this.isClosed = !0, this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e,
|
|
942
|
+
handleClose(e, n) {
|
|
943
|
+
this.isClosed || (this.isClosed = !0, this.clearKeepaliveTimeout(), this.readLoopActive = !1, this.cleanup(), this.callbacks.onClose(e, n));
|
|
944
944
|
}
|
|
945
945
|
/**
|
|
946
946
|
* Reset the keepalive timeout.
|
|
947
947
|
*/
|
|
948
948
|
resetKeepaliveTimeout() {
|
|
949
949
|
this.clearKeepaliveTimeout(), this.keepaliveTimeout = setTimeout(() => {
|
|
950
|
-
|
|
950
|
+
U.error(`No keepalive received in ${this.keepaliveTimeoutMs}ms, closing connection`), this.callbacks.onError(new q(this.keepaliveTimeoutMs)), this.close();
|
|
951
951
|
}, this.keepaliveTimeoutMs);
|
|
952
952
|
}
|
|
953
953
|
/**
|
|
@@ -969,7 +969,7 @@ class Ot {
|
|
|
969
969
|
}
|
|
970
970
|
}
|
|
971
971
|
}
|
|
972
|
-
const x =
|
|
972
|
+
const x = p("Channel");
|
|
973
973
|
class bt {
|
|
974
974
|
state = "disconnected";
|
|
975
975
|
transport = null;
|
|
@@ -1021,6 +1021,15 @@ class bt {
|
|
|
1021
1021
|
disconnect() {
|
|
1022
1022
|
this.transport && (this.transport.close(), this.transport = null), this.setState("disconnected");
|
|
1023
1023
|
}
|
|
1024
|
+
/**
|
|
1025
|
+
* Force the channel to drop its transport and notify the manager so the
|
|
1026
|
+
* normal reconnect flow kicks in. Used when an upper layer (e.g. action-ack
|
|
1027
|
+
* timeout) has evidence the connection is dead even though the transport
|
|
1028
|
+
* still believes it is open.
|
|
1029
|
+
*/
|
|
1030
|
+
triggerReconnect(e) {
|
|
1031
|
+
this.transport && (this.transport.close(), this.transport = null), this.config.onClose?.(e, !1);
|
|
1032
|
+
}
|
|
1024
1033
|
/**
|
|
1025
1034
|
* Check transport health and trigger close if the connection is dead.
|
|
1026
1035
|
* Used after tab resume to detect WebSockets closed by the OS while suspended.
|
|
@@ -1042,29 +1051,29 @@ class bt {
|
|
|
1042
1051
|
* Connect the transport to the entrypoint.
|
|
1043
1052
|
*/
|
|
1044
1053
|
async connectTransport() {
|
|
1045
|
-
const e = this.entrypoint,
|
|
1054
|
+
const e = this.entrypoint, n = {
|
|
1046
1055
|
sessionId: this.config.sessionId,
|
|
1047
1056
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
1048
1057
|
connectionTimeoutMs: this.config.connectionTimeoutMs,
|
|
1049
1058
|
callbacks: {
|
|
1050
1059
|
onProtocolMessage: (r) => this.handleProtocolMessage(r),
|
|
1051
|
-
onClose: (r,
|
|
1060
|
+
onClose: (r, s) => this.handleClose(r, s),
|
|
1052
1061
|
onError: (r) => this.handleError(r)
|
|
1053
1062
|
}
|
|
1054
1063
|
};
|
|
1055
1064
|
switch (e.Type) {
|
|
1056
|
-
case
|
|
1057
|
-
case
|
|
1058
|
-
this.transport = new
|
|
1065
|
+
case N.WebSocket:
|
|
1066
|
+
case N.WebSocketProxy:
|
|
1067
|
+
this.transport = new Pt(n);
|
|
1059
1068
|
break;
|
|
1060
|
-
case
|
|
1061
|
-
case
|
|
1069
|
+
case N.WebTransport:
|
|
1070
|
+
case N.WebTransportProxy:
|
|
1062
1071
|
if (!it())
|
|
1063
1072
|
throw new Error("WebTransport is not supported in this browser");
|
|
1064
|
-
this.transport = new Ot(
|
|
1073
|
+
this.transport = new Ot(n);
|
|
1065
1074
|
break;
|
|
1066
1075
|
default:
|
|
1067
|
-
throw new Error(`Unsupported entrypoint type: ${
|
|
1076
|
+
throw new Error(`Unsupported entrypoint type: ${N[e.Type]}`);
|
|
1068
1077
|
}
|
|
1069
1078
|
await this.transport.connect(e.Uri, e.AuthTicket);
|
|
1070
1079
|
}
|
|
@@ -1073,21 +1082,21 @@ class bt {
|
|
|
1073
1082
|
*/
|
|
1074
1083
|
handleProtocolMessage(e) {
|
|
1075
1084
|
try {
|
|
1076
|
-
const
|
|
1077
|
-
if (
|
|
1085
|
+
const n = e;
|
|
1086
|
+
if (j(n) === V.CORE_ON_SERVER_STOPPING) {
|
|
1078
1087
|
x.debug("Received server stopping message"), this.setState("stopped"), this.transport?.close();
|
|
1079
1088
|
return;
|
|
1080
1089
|
}
|
|
1081
|
-
this.config.onProtocolMessage?.(
|
|
1082
|
-
} catch (
|
|
1083
|
-
x.error("Failed to handle protocol message:",
|
|
1090
|
+
this.config.onProtocolMessage?.(n);
|
|
1091
|
+
} catch (n) {
|
|
1092
|
+
x.error("Failed to handle protocol message:", n), this.config.onError?.(n instanceof Error ? n : new Error(String(n)));
|
|
1084
1093
|
}
|
|
1085
1094
|
}
|
|
1086
1095
|
/**
|
|
1087
1096
|
* Handle transport close.
|
|
1088
1097
|
*/
|
|
1089
|
-
handleClose(e,
|
|
1090
|
-
this.transport = null, this.config.onClose?.(e,
|
|
1098
|
+
handleClose(e, n) {
|
|
1099
|
+
this.transport = null, this.config.onClose?.(e, n);
|
|
1091
1100
|
}
|
|
1092
1101
|
/**
|
|
1093
1102
|
* Handle transport error.
|
|
@@ -1102,19 +1111,16 @@ class bt {
|
|
|
1102
1111
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1103
1112
|
}
|
|
1104
1113
|
}
|
|
1105
|
-
const
|
|
1106
|
-
class
|
|
1114
|
+
const I = p("ChannelManager");
|
|
1115
|
+
class Mt {
|
|
1107
1116
|
channels = /* @__PURE__ */ new Map();
|
|
1108
1117
|
// keyed by opcode group
|
|
1109
1118
|
activeType = null;
|
|
1110
1119
|
state = "idle";
|
|
1111
1120
|
reconnectAttempts = 0;
|
|
1112
|
-
stabilityTimer = null;
|
|
1113
1121
|
shouldReconnect = !0;
|
|
1114
1122
|
entrypoints = [];
|
|
1115
1123
|
abortController = null;
|
|
1116
|
-
demotedTypes = /* @__PURE__ */ new Set();
|
|
1117
|
-
connectionStable = !1;
|
|
1118
1124
|
connectionTimeoutMs;
|
|
1119
1125
|
config;
|
|
1120
1126
|
constructor(e) {
|
|
@@ -1135,10 +1141,10 @@ class dt {
|
|
|
1135
1141
|
/**
|
|
1136
1142
|
* Connect to the server using the provided entrypoints.
|
|
1137
1143
|
*/
|
|
1138
|
-
async connect(e,
|
|
1144
|
+
async connect(e, n) {
|
|
1139
1145
|
if (this.state !== "idle" && this.state !== "offline")
|
|
1140
1146
|
throw new Error(`Cannot connect: already in state ${this.state}`);
|
|
1141
|
-
if (this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.
|
|
1147
|
+
if (this.entrypoints = e, this.shouldReconnect = !0, this.reconnectAttempts = 0, this.abortController = new AbortController(), n?.retry) {
|
|
1142
1148
|
this.attemptReconnect();
|
|
1143
1149
|
return;
|
|
1144
1150
|
}
|
|
@@ -1148,27 +1154,27 @@ class dt {
|
|
|
1148
1154
|
* Disconnect all channels.
|
|
1149
1155
|
*/
|
|
1150
1156
|
disconnect() {
|
|
1151
|
-
this.shouldReconnect = !1, this.
|
|
1157
|
+
this.shouldReconnect = !1, this.abortController?.abort(), this.abortController = null, this.disconnectAll(), this.setState("idle");
|
|
1152
1158
|
}
|
|
1153
1159
|
/**
|
|
1154
1160
|
* Send a protocol message to the appropriate channel.
|
|
1155
1161
|
* The opcode group is extracted from the message automatically.
|
|
1156
1162
|
*/
|
|
1157
1163
|
sendProtocolMessage(e) {
|
|
1158
|
-
const
|
|
1159
|
-
for (const [r,
|
|
1160
|
-
if (r &
|
|
1161
|
-
|
|
1164
|
+
const n = v(e);
|
|
1165
|
+
for (const [r, s] of this.channels)
|
|
1166
|
+
if (r & n) {
|
|
1167
|
+
s.send(e);
|
|
1162
1168
|
return;
|
|
1163
1169
|
}
|
|
1164
|
-
this.state === "connected" &&
|
|
1170
|
+
this.state === "connected" && I.warn("No channel found for message");
|
|
1165
1171
|
}
|
|
1166
1172
|
/**
|
|
1167
1173
|
* Send a protocol message to all channels (for broadcast messages).
|
|
1168
1174
|
*/
|
|
1169
1175
|
sendToAll(e) {
|
|
1170
|
-
for (const
|
|
1171
|
-
|
|
1176
|
+
for (const n of this.channels.values())
|
|
1177
|
+
n.send(e);
|
|
1172
1178
|
}
|
|
1173
1179
|
/**
|
|
1174
1180
|
* Check health of all channels.
|
|
@@ -1181,53 +1187,62 @@ class dt {
|
|
|
1181
1187
|
for (const e of this.channels.values())
|
|
1182
1188
|
e.checkHealth();
|
|
1183
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Force every active channel to drop its transport and notify the manager,
|
|
1192
|
+
* kicking off the normal reconnect flow. Used when a higher layer has
|
|
1193
|
+
* evidence that the connection is dead (e.g. no ACK received for a user
|
|
1194
|
+
* action within the ack-timeout window).
|
|
1195
|
+
*/
|
|
1196
|
+
triggerReconnect(e) {
|
|
1197
|
+
if (this.state === "connected") {
|
|
1198
|
+
I.debug(`Forcing reconnect: ${e}`);
|
|
1199
|
+
for (const n of this.channels.values())
|
|
1200
|
+
n.triggerReconnect(e);
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
1184
1203
|
/**
|
|
1185
1204
|
* Internal connect implementation.
|
|
1186
1205
|
* @param isReconnect - If true, don't set offline state on failure (let attemptReconnect handle it)
|
|
1187
1206
|
*/
|
|
1188
1207
|
async connectInternal(e = !1) {
|
|
1189
1208
|
this.setState("connecting");
|
|
1190
|
-
let
|
|
1209
|
+
let n = this.entrypoints;
|
|
1191
1210
|
if (this.config.webRtcEnabled) {
|
|
1192
|
-
|
|
1211
|
+
I.debug(`WebRTC enabled, filtering entrypoints (total: ${this.entrypoints.length})`);
|
|
1193
1212
|
for (const i of this.entrypoints)
|
|
1194
|
-
|
|
1195
|
-
|
|
1213
|
+
I.debug(` Entrypoint: type=${i.Type} fromServer=0x${i.OpcodeGroupsFromServer.toString(16)} toServer=0x${i.OpcodeGroupsToServer.toString(16)} uri=${i.Uri}`);
|
|
1214
|
+
n = this.entrypoints.filter((i) => i.Type === N.WebRTC ? (I.debug(` Filtered out WebRTC entrypoint (type=${i.Type})`), !1) : !0), I.debug(`After filtering: ${n.length} entrypoints remain for WS/WT channels`);
|
|
1196
1215
|
}
|
|
1197
|
-
const r = this.groupByType(
|
|
1216
|
+
const r = this.groupByType(n);
|
|
1198
1217
|
if (r.size === 0)
|
|
1199
1218
|
throw this.setState("offline"), new Error("No entrypoints available");
|
|
1200
|
-
let
|
|
1219
|
+
let s;
|
|
1201
1220
|
if (this.config.orderedEndpointTypes && this.config.orderedEndpointTypes.length > 0) {
|
|
1202
1221
|
const i = new Set(r.keys());
|
|
1203
|
-
|
|
1204
|
-
} else this.config.endpointSelector ?
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
n = [...i, ...o];
|
|
1208
|
-
}
|
|
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`);
|
|
1210
|
-
for (const i of n) {
|
|
1222
|
+
s = this.config.orderedEndpointTypes.filter((o) => i.has(o));
|
|
1223
|
+
} else this.config.endpointSelector ? s = this.config.endpointSelector.getOrderedTypes(r) : s = Array.from(r.keys());
|
|
1224
|
+
this.connectionTimeoutMs = s.length > 1 ? 5e3 : 1e4, I.info(`Endpoint types to try: [${s.map((i) => N[i]).join(", ")}], transport timeout: ${this.connectionTimeoutMs}ms`);
|
|
1225
|
+
for (const i of s) {
|
|
1211
1226
|
if (!this.shouldReconnect)
|
|
1212
1227
|
return;
|
|
1213
1228
|
const o = r.get(i), a = Date.now();
|
|
1214
|
-
|
|
1229
|
+
I.info(`Trying ${N[i]} (${o.length} channel(s))`);
|
|
1215
1230
|
try {
|
|
1216
|
-
await this.connectAllChannels(o), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, this.
|
|
1231
|
+
await this.connectAllChannels(o), this.config.endpointSelector?.rememberWorkingType(i), this.config.onRememberWorkingType?.(i), this.activeType = i, this.reconnectAttempts = 0, I.info(`Connected via ${N[i]} in ${Date.now() - a}ms`), this.setState("connected");
|
|
1217
1232
|
return;
|
|
1218
|
-
} catch (
|
|
1219
|
-
|
|
1220
|
-
const
|
|
1221
|
-
if (this.disconnectAll(),
|
|
1233
|
+
} catch (E) {
|
|
1234
|
+
I.warn(`Failed to connect using ${N[i]} after ${Date.now() - a}ms: ${E instanceof Error ? E.message : E}`);
|
|
1235
|
+
const _ = this.channels.size > 0;
|
|
1236
|
+
if (this.disconnectAll(), _ && this.config.onRefreshEntrypoints)
|
|
1222
1237
|
try {
|
|
1223
|
-
|
|
1224
|
-
const
|
|
1225
|
-
this.entrypoints =
|
|
1226
|
-
const
|
|
1227
|
-
for (const [
|
|
1228
|
-
r.set(
|
|
1229
|
-
} catch (
|
|
1230
|
-
|
|
1238
|
+
I.info("Partial connection detected, refreshing entrypoints");
|
|
1239
|
+
const l = await this.config.onRefreshEntrypoints();
|
|
1240
|
+
this.entrypoints = l.entrypoints, this.config.sessionId = l.sessionId;
|
|
1241
|
+
const T = this.config.webRtcEnabled ? l.entrypoints.filter((c) => c.Type !== N.WebRTC) : l.entrypoints, S = this.groupByType(T);
|
|
1242
|
+
for (const [c, g] of S)
|
|
1243
|
+
r.set(c, g);
|
|
1244
|
+
} catch (l) {
|
|
1245
|
+
I.warn(`Failed to refresh entrypoints: ${l}`);
|
|
1231
1246
|
}
|
|
1232
1247
|
}
|
|
1233
1248
|
}
|
|
@@ -1239,20 +1254,20 @@ class dt {
|
|
|
1239
1254
|
async connectAllChannels(e) {
|
|
1240
1255
|
if (e.length === 0)
|
|
1241
1256
|
throw new Error("No entrypoints to connect");
|
|
1242
|
-
const r = (await Promise.allSettled(e.map((
|
|
1257
|
+
const r = (await Promise.allSettled(e.map((s) => this.connectChannel(s)))).filter((s) => s.status === "rejected");
|
|
1243
1258
|
if (r.length > 0) {
|
|
1244
|
-
const
|
|
1259
|
+
const s = r.map((i) => {
|
|
1245
1260
|
const o = i.reason;
|
|
1246
1261
|
return o instanceof Error ? o.message : String(o);
|
|
1247
1262
|
});
|
|
1248
|
-
throw new Error(
|
|
1263
|
+
throw new Error(s.join(", "));
|
|
1249
1264
|
}
|
|
1250
1265
|
}
|
|
1251
1266
|
/**
|
|
1252
1267
|
* Connect a single channel.
|
|
1253
1268
|
*/
|
|
1254
1269
|
async connectChannel(e) {
|
|
1255
|
-
const
|
|
1270
|
+
const n = new bt({
|
|
1256
1271
|
entrypoint: e,
|
|
1257
1272
|
sessionId: this.config.sessionId,
|
|
1258
1273
|
keepaliveTimeoutMs: this.config.keepaliveTimeoutMs,
|
|
@@ -1263,43 +1278,42 @@ class dt {
|
|
|
1263
1278
|
onStateChange: (r) => {
|
|
1264
1279
|
this.handleChannelStateChange(e.OpcodeGroupsFromServer, r);
|
|
1265
1280
|
},
|
|
1266
|
-
onClose: (r,
|
|
1267
|
-
this.handleChannelClose(e.OpcodeGroupsFromServer, r,
|
|
1281
|
+
onClose: (r, s) => {
|
|
1282
|
+
this.handleChannelClose(e.OpcodeGroupsFromServer, r, s);
|
|
1268
1283
|
},
|
|
1269
1284
|
onError: (r) => {
|
|
1270
1285
|
this.config.onError?.(r);
|
|
1271
1286
|
}
|
|
1272
1287
|
});
|
|
1273
|
-
await
|
|
1288
|
+
await n.connect(), this.channels.set(e.OpcodeGroupsFromServer, n);
|
|
1274
1289
|
}
|
|
1275
1290
|
/**
|
|
1276
1291
|
* Group entrypoints by type.
|
|
1277
1292
|
*/
|
|
1278
1293
|
groupByType(e) {
|
|
1279
|
-
const
|
|
1294
|
+
const n = /* @__PURE__ */ new Map();
|
|
1280
1295
|
for (const r of e) {
|
|
1281
|
-
const
|
|
1282
|
-
|
|
1296
|
+
const s = n.get(r.Type) ?? [];
|
|
1297
|
+
s.push(r), n.set(r.Type, s);
|
|
1283
1298
|
}
|
|
1284
|
-
return
|
|
1299
|
+
return n;
|
|
1285
1300
|
}
|
|
1286
1301
|
/**
|
|
1287
1302
|
* Handle channel state change.
|
|
1288
1303
|
*/
|
|
1289
|
-
handleChannelStateChange(e,
|
|
1290
|
-
|
|
1304
|
+
handleChannelStateChange(e, n) {
|
|
1305
|
+
n === "stopped" && (this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped"));
|
|
1291
1306
|
}
|
|
1292
1307
|
/**
|
|
1293
1308
|
* Handle channel close.
|
|
1309
|
+
*
|
|
1310
|
+
* Only `CORE_ON_SERVER_STOPPING` (handled separately via channel state →
|
|
1311
|
+
* `handleChannelStateChange`) means the server is gone. Any transport-level
|
|
1312
|
+
* close — including a clean WebSocket code 1000 — just means this transport
|
|
1313
|
+
* dropped, and we reconnect.
|
|
1294
1314
|
*/
|
|
1295
|
-
handleChannelClose(e,
|
|
1296
|
-
|
|
1297
|
-
if (n) {
|
|
1298
|
-
T.debug("Channel closed by server"), this.shouldReconnect = !1, this.disconnectAll(), this.setState("stopped");
|
|
1299
|
-
return;
|
|
1300
|
-
}
|
|
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());
|
|
1302
|
-
}
|
|
1315
|
+
handleChannelClose(e, n, r) {
|
|
1316
|
+
this.state === "idle" || this.state === "stopped" || this.state === "offline" || this.channels.has(e) && this.state === "connected" && (I.warn("Channel closed unexpectedly, attempting reconnect"), this.disconnectAll(), this.attemptReconnect());
|
|
1303
1317
|
}
|
|
1304
1318
|
/**
|
|
1305
1319
|
* Attempt to reconnect with fixed-interval retry.
|
|
@@ -1308,14 +1322,14 @@ class dt {
|
|
|
1308
1322
|
async attemptReconnect() {
|
|
1309
1323
|
if (this.shouldReconnect) {
|
|
1310
1324
|
if (!Lt()) {
|
|
1311
|
-
|
|
1325
|
+
I.warn("Retry disabled via ikon-retry=false, skipping reconnect"), this.setState("offline"), this.config.onError?.(new Z(0));
|
|
1312
1326
|
return;
|
|
1313
1327
|
}
|
|
1314
1328
|
if (this.reconnectAttempts >= this.config.maxReconnectAttempts) {
|
|
1315
|
-
|
|
1329
|
+
I.warn(`Max reconnect attempts (${this.config.maxReconnectAttempts}) reached`), this.setState("offline"), this.config.onError?.(new Z(this.config.maxReconnectAttempts));
|
|
1316
1330
|
return;
|
|
1317
1331
|
}
|
|
1318
|
-
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (
|
|
1332
|
+
if (this.setState("reconnecting"), this.reconnectAttempts++, this.reconnectAttempts > 1 ? (I.info(`Reconnecting in ${this.config.reconnectBackoffMs}ms (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), await Ct(this.config.reconnectBackoffMs, this.abortController?.signal)) : I.info(`Reconnecting immediately (attempt ${this.reconnectAttempts}/${this.config.maxReconnectAttempts})`), !!this.shouldReconnect)
|
|
1319
1333
|
try {
|
|
1320
1334
|
await this.connectInternal(!0);
|
|
1321
1335
|
} catch {
|
|
@@ -1327,26 +1341,10 @@ class dt {
|
|
|
1327
1341
|
* Disconnect all channels.
|
|
1328
1342
|
*/
|
|
1329
1343
|
disconnectAll() {
|
|
1330
|
-
this.clearStabilityTimer();
|
|
1331
1344
|
for (const e of this.channels.values())
|
|
1332
1345
|
e.disconnect();
|
|
1333
1346
|
this.channels.clear(), this.activeType = null;
|
|
1334
1347
|
}
|
|
1335
|
-
/**
|
|
1336
|
-
* Start stability timer that resets reconnect attempts after the connection
|
|
1337
|
-
* survives one keepalive timeout period without dying.
|
|
1338
|
-
*/
|
|
1339
|
-
startStabilityTimer() {
|
|
1340
|
-
this.clearStabilityTimer(), this.connectionStable = !1, this.stabilityTimer = setTimeout(() => {
|
|
1341
|
-
this.stabilityTimer = null, this.reconnectAttempts = 0, this.connectionStable = !0, this.demotedTypes.clear();
|
|
1342
|
-
}, this.config.keepaliveTimeoutMs);
|
|
1343
|
-
}
|
|
1344
|
-
/**
|
|
1345
|
-
* Clear the stability timer.
|
|
1346
|
-
*/
|
|
1347
|
-
clearStabilityTimer() {
|
|
1348
|
-
this.stabilityTimer && (clearTimeout(this.stabilityTimer), this.stabilityTimer = null);
|
|
1349
|
-
}
|
|
1350
1348
|
/**
|
|
1351
1349
|
* Update and notify state change.
|
|
1352
1350
|
*/
|
|
@@ -1354,24 +1352,24 @@ class dt {
|
|
|
1354
1352
|
this.state !== e && (this.state = e, this.config.onStateChange?.(e));
|
|
1355
1353
|
}
|
|
1356
1354
|
}
|
|
1357
|
-
const at =
|
|
1355
|
+
const at = p("ProtocolWorker"), L = (t, e) => {
|
|
1358
1356
|
self.postMessage(t, e ?? []);
|
|
1359
1357
|
};
|
|
1360
|
-
let
|
|
1361
|
-
const
|
|
1362
|
-
function
|
|
1358
|
+
let A = null, B = null, d = null, X, C = null;
|
|
1359
|
+
const P = [], f = [], F = /* @__PURE__ */ new Map(), R = [], u = [], w = /* @__PURE__ */ new Map(), $ = [];
|
|
1360
|
+
function Q() {
|
|
1363
1361
|
try {
|
|
1364
|
-
|
|
1362
|
+
A?.disconnect();
|
|
1365
1363
|
} catch (t) {
|
|
1366
1364
|
at.warn(`Failed to disconnect channel manager: ${t}`);
|
|
1367
1365
|
}
|
|
1368
|
-
|
|
1369
|
-
for (let t = 0; t <
|
|
1366
|
+
A = null;
|
|
1367
|
+
for (let t = 0; t < f.length; t++)
|
|
1370
1368
|
try {
|
|
1371
|
-
|
|
1369
|
+
f[t].port.close();
|
|
1372
1370
|
} catch {
|
|
1373
1371
|
}
|
|
1374
|
-
|
|
1372
|
+
P.length = 0, f.length = 0, F.clear();
|
|
1375
1373
|
for (let t = 0; t < u.length; t++)
|
|
1376
1374
|
try {
|
|
1377
1375
|
u[t].port.close();
|
|
@@ -1379,133 +1377,132 @@ function z() {
|
|
|
1379
1377
|
}
|
|
1380
1378
|
R.length = 0, u.length = 0, w.clear();
|
|
1381
1379
|
}
|
|
1382
|
-
function
|
|
1380
|
+
function M(t) {
|
|
1383
1381
|
const e = t instanceof Error ? t : new Error(String(t));
|
|
1384
1382
|
L({ type: "error", error: { name: e.name, message: e.message, stack: e.stack } });
|
|
1385
1383
|
}
|
|
1386
|
-
function
|
|
1384
|
+
function Bt() {
|
|
1387
1385
|
let t = 0;
|
|
1388
|
-
for (let e = 0; e <
|
|
1389
|
-
t |=
|
|
1386
|
+
for (let e = 0; e < f.length; e++)
|
|
1387
|
+
t |= f[e].opcodeGroupsMask;
|
|
1390
1388
|
return t;
|
|
1391
1389
|
}
|
|
1392
|
-
function
|
|
1390
|
+
function dt(t) {
|
|
1393
1391
|
if (X === void 0)
|
|
1394
1392
|
return !0;
|
|
1395
|
-
const e =
|
|
1393
|
+
const e = v(t);
|
|
1396
1394
|
if ((e & X) !== 0)
|
|
1397
1395
|
return !0;
|
|
1398
|
-
const
|
|
1399
|
-
return (e &
|
|
1396
|
+
const n = Bt();
|
|
1397
|
+
return (e & n) !== 0;
|
|
1400
1398
|
}
|
|
1401
1399
|
function ot(t) {
|
|
1402
1400
|
$.length = 0;
|
|
1403
|
-
for (let e = 0; e <
|
|
1404
|
-
const
|
|
1405
|
-
(
|
|
1401
|
+
for (let e = 0; e < f.length; e++) {
|
|
1402
|
+
const n = f[e];
|
|
1403
|
+
(n.opcodeGroupsMask & t) !== 0 && $.push(n.port);
|
|
1406
1404
|
}
|
|
1407
1405
|
return $;
|
|
1408
1406
|
}
|
|
1409
|
-
function Bt(t, e) {
|
|
1410
|
-
return (F(t) & e) !== 0;
|
|
1411
|
-
}
|
|
1412
1407
|
function Ft(t, e) {
|
|
1413
|
-
|
|
1408
|
+
return (v(t) & e) !== 0;
|
|
1409
|
+
}
|
|
1410
|
+
function vt(t, e) {
|
|
1411
|
+
if (!A || !e || typeof e != "object")
|
|
1414
1412
|
return;
|
|
1415
|
-
const
|
|
1416
|
-
if (!(
|
|
1413
|
+
const n = e;
|
|
1414
|
+
if (!(n.type !== "send" || !(n.message instanceof ArrayBuffer)))
|
|
1417
1415
|
try {
|
|
1418
|
-
const r = new Uint8Array(
|
|
1419
|
-
if (!
|
|
1416
|
+
const r = new Uint8Array(n.message);
|
|
1417
|
+
if (!Ft(r, t))
|
|
1420
1418
|
return;
|
|
1421
|
-
|
|
1419
|
+
A.sendProtocolMessage(r), C && C.postMessage({ direction: "sent", message: Array.from(r) });
|
|
1422
1420
|
} catch (r) {
|
|
1423
|
-
|
|
1421
|
+
M(r);
|
|
1424
1422
|
}
|
|
1425
1423
|
}
|
|
1426
1424
|
async function Gt(t) {
|
|
1427
|
-
|
|
1425
|
+
Q(), A = new Mt({
|
|
1428
1426
|
sessionId: t.sessionId,
|
|
1429
1427
|
keepaliveTimeoutMs: t.keepaliveTimeoutMs,
|
|
1430
1428
|
reconnectBackoffMs: t.reconnectBackoffMs,
|
|
1431
1429
|
maxReconnectAttempts: t.maxReconnectAttempts,
|
|
1432
1430
|
orderedEndpointTypes: t.orderedEndpointTypes,
|
|
1433
|
-
hasTransportConstraint: t.hasTransportConstraint,
|
|
1434
1431
|
webRtcEnabled: t.webRtcEnabled,
|
|
1435
1432
|
onStateChange: (e) => {
|
|
1436
|
-
L({ type: "state", state: e, activeType:
|
|
1433
|
+
L({ type: "state", state: e, activeType: A?.activeEndpointType ?? void 0 });
|
|
1437
1434
|
},
|
|
1438
1435
|
onRememberWorkingType: () => {
|
|
1439
|
-
L({ type: "state", state:
|
|
1436
|
+
L({ type: "state", state: A?.managerState ?? "idle", activeType: A?.activeEndpointType ?? void 0 });
|
|
1440
1437
|
},
|
|
1441
1438
|
onError: (e) => {
|
|
1442
|
-
|
|
1439
|
+
M(e);
|
|
1443
1440
|
},
|
|
1444
|
-
onRefreshEntrypoints: () => new Promise((e,
|
|
1445
|
-
|
|
1441
|
+
onRefreshEntrypoints: () => new Promise((e, n) => {
|
|
1442
|
+
B = e, d = n, L({ type: "refreshEntrypoints" });
|
|
1446
1443
|
}),
|
|
1447
1444
|
onProtocolMessage: (e) => {
|
|
1448
|
-
C && (C.postMessage({ direction: "received", message: Array.from(e) }),
|
|
1449
|
-
const
|
|
1450
|
-
if (!(!r &&
|
|
1445
|
+
C && (C.postMessage({ direction: "received", message: Array.from(e) }), j(e) === V.ANALYTICS_LOGS && C.postMessage({ type: "serverLogs", message: Array.from(e) }));
|
|
1446
|
+
const n = v(e), r = dt(e), s = ot(n);
|
|
1447
|
+
if (!(!r && s.length === 0))
|
|
1451
1448
|
try {
|
|
1452
|
-
const i = H(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, a =
|
|
1453
|
-
if (a && !r &&
|
|
1454
|
-
const
|
|
1455
|
-
|
|
1449
|
+
const i = H(e), o = e.buffer instanceof ArrayBuffer && e.byteOffset === 0 && e.byteLength === e.buffer.byteLength, a = s.length > 0;
|
|
1450
|
+
if (a && !r && s.length === 1 && o) {
|
|
1451
|
+
const E = e.buffer;
|
|
1452
|
+
s[0].postMessage({ type: "protocol", message: E, headers: i }, [E]);
|
|
1456
1453
|
return;
|
|
1457
1454
|
}
|
|
1458
1455
|
if (!a && r && o) {
|
|
1459
|
-
const
|
|
1460
|
-
L({ type: "protocol", message:
|
|
1456
|
+
const E = e.buffer;
|
|
1457
|
+
L({ type: "protocol", message: E, headers: i }, [E]);
|
|
1461
1458
|
return;
|
|
1462
1459
|
}
|
|
1463
1460
|
if (a && o) {
|
|
1464
|
-
const
|
|
1465
|
-
for (let
|
|
1466
|
-
|
|
1467
|
-
const
|
|
1468
|
-
|
|
1469
|
-
for (let
|
|
1470
|
-
|
|
1471
|
-
|
|
1461
|
+
const E = [];
|
|
1462
|
+
for (let T = 1; T < s.length; T++)
|
|
1463
|
+
E.push(e.slice().buffer);
|
|
1464
|
+
const _ = r ? e.slice().buffer : null, l = e.buffer;
|
|
1465
|
+
s[0].postMessage({ type: "protocol", message: l, headers: i }, [l]);
|
|
1466
|
+
for (let T = 1; T < s.length; T++)
|
|
1467
|
+
s[T].postMessage({ type: "protocol", message: E[T - 1], headers: i }, [E[T - 1]]);
|
|
1468
|
+
_ && L({ type: "protocol", message: _, headers: i }, [_]);
|
|
1472
1469
|
return;
|
|
1473
1470
|
}
|
|
1474
1471
|
if (a)
|
|
1475
|
-
for (const
|
|
1476
|
-
const
|
|
1477
|
-
|
|
1472
|
+
for (const E of s) {
|
|
1473
|
+
const _ = e.slice().buffer;
|
|
1474
|
+
E.postMessage({ type: "protocol", message: _, headers: i }, [_]);
|
|
1478
1475
|
}
|
|
1479
1476
|
if (r) {
|
|
1480
|
-
const
|
|
1481
|
-
L({ type: "protocol", message:
|
|
1477
|
+
const E = e.slice().buffer;
|
|
1478
|
+
L({ type: "protocol", message: E, headers: i }, [E]);
|
|
1482
1479
|
}
|
|
1483
1480
|
} catch (i) {
|
|
1484
|
-
|
|
1481
|
+
M(i);
|
|
1485
1482
|
}
|
|
1486
1483
|
}
|
|
1487
|
-
}), await
|
|
1484
|
+
}), await A.connect(t.entrypoints, { retry: t.retry });
|
|
1488
1485
|
}
|
|
1489
1486
|
self.addEventListener("message", (t) => {
|
|
1490
1487
|
const e = t.data;
|
|
1491
1488
|
if (e.type === "connect") {
|
|
1492
|
-
Gt(e).catch((
|
|
1493
|
-
at.error(`Failed to connect: ${
|
|
1489
|
+
Gt(e).catch((n) => {
|
|
1490
|
+
at.error(`Failed to connect: ${n}`), M(n), Q();
|
|
1494
1491
|
});
|
|
1495
1492
|
return;
|
|
1496
1493
|
}
|
|
1497
1494
|
if (e.type === "disconnect") {
|
|
1498
|
-
|
|
1495
|
+
Q(), L({ type: "state", state: "idle" });
|
|
1499
1496
|
return;
|
|
1500
1497
|
}
|
|
1501
1498
|
if (e.type === "send") {
|
|
1502
|
-
if (!
|
|
1499
|
+
if (!A)
|
|
1503
1500
|
return;
|
|
1504
1501
|
try {
|
|
1505
|
-
const
|
|
1506
|
-
|
|
1507
|
-
} catch (
|
|
1508
|
-
|
|
1502
|
+
const n = new Uint8Array(e.message);
|
|
1503
|
+
A.sendProtocolMessage(n), C && C.postMessage({ direction: "sent", message: Array.from(n) });
|
|
1504
|
+
} catch (n) {
|
|
1505
|
+
M(n);
|
|
1509
1506
|
}
|
|
1510
1507
|
return;
|
|
1511
1508
|
}
|
|
@@ -1518,29 +1515,33 @@ self.addEventListener("message", (t) => {
|
|
|
1518
1515
|
return;
|
|
1519
1516
|
}
|
|
1520
1517
|
if (e.type === "checkHealth") {
|
|
1521
|
-
|
|
1518
|
+
A?.checkHealth();
|
|
1519
|
+
return;
|
|
1520
|
+
}
|
|
1521
|
+
if (e.type === "triggerReconnect") {
|
|
1522
|
+
A?.triggerReconnect(e.reason);
|
|
1522
1523
|
return;
|
|
1523
1524
|
}
|
|
1524
1525
|
if (e.type === "refreshedEntrypoints") {
|
|
1525
|
-
|
|
1526
|
+
B && (B({ entrypoints: e.entrypoints, sessionId: e.sessionId }), B = null, d = null);
|
|
1526
1527
|
return;
|
|
1527
1528
|
}
|
|
1528
1529
|
if (e.type === "refreshEntrypointsFailed") {
|
|
1529
|
-
|
|
1530
|
+
d && (d(new Error("Failed to refresh entrypoints")), B = null, d = null);
|
|
1530
1531
|
return;
|
|
1531
1532
|
}
|
|
1532
1533
|
if (e.type === "forwardToPorts") {
|
|
1533
1534
|
try {
|
|
1534
|
-
const
|
|
1535
|
-
if (
|
|
1536
|
-
const i = H(
|
|
1537
|
-
for (const o of
|
|
1538
|
-
const a =
|
|
1535
|
+
const n = new Uint8Array(e.message), r = v(n), s = ot(r);
|
|
1536
|
+
if (s.length > 0) {
|
|
1537
|
+
const i = H(n);
|
|
1538
|
+
for (const o of s) {
|
|
1539
|
+
const a = n.slice().buffer;
|
|
1539
1540
|
o.postMessage({ type: "protocol", message: a, headers: i }, [a]);
|
|
1540
1541
|
}
|
|
1541
1542
|
}
|
|
1542
|
-
} catch (
|
|
1543
|
-
|
|
1543
|
+
} catch (n) {
|
|
1544
|
+
M(n);
|
|
1544
1545
|
}
|
|
1545
1546
|
return;
|
|
1546
1547
|
}
|
|
@@ -1549,65 +1550,65 @@ self.addEventListener("message", (t) => {
|
|
|
1549
1550
|
e.port.start?.();
|
|
1550
1551
|
} catch {
|
|
1551
1552
|
}
|
|
1552
|
-
const
|
|
1553
|
-
|
|
1553
|
+
const n = P.length;
|
|
1554
|
+
P.push(e.portId), f.push({ port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }), F.set(e.portId, n);
|
|
1554
1555
|
return;
|
|
1555
1556
|
}
|
|
1556
1557
|
if (e.type === "detachPort") {
|
|
1557
|
-
const
|
|
1558
|
-
if (
|
|
1559
|
-
const r =
|
|
1558
|
+
const n = F.get(e.portId);
|
|
1559
|
+
if (n !== void 0) {
|
|
1560
|
+
const r = f[n];
|
|
1560
1561
|
try {
|
|
1561
1562
|
r.port.close();
|
|
1562
1563
|
} catch {
|
|
1563
1564
|
}
|
|
1564
|
-
const
|
|
1565
|
-
if (
|
|
1566
|
-
const i =
|
|
1567
|
-
|
|
1565
|
+
const s = P.length - 1;
|
|
1566
|
+
if (n !== s) {
|
|
1567
|
+
const i = P[s];
|
|
1568
|
+
P[n] = i, f[n] = f[s], F.set(i, n);
|
|
1568
1569
|
}
|
|
1569
|
-
|
|
1570
|
+
P.length--, f.length--, F.delete(e.portId);
|
|
1570
1571
|
}
|
|
1571
1572
|
return;
|
|
1572
1573
|
}
|
|
1573
1574
|
if (e.type === "attachSendPort") {
|
|
1574
|
-
const
|
|
1575
|
-
if (
|
|
1576
|
-
const i = u[
|
|
1575
|
+
const n = w.get(e.portId);
|
|
1576
|
+
if (n !== void 0) {
|
|
1577
|
+
const i = u[n];
|
|
1577
1578
|
try {
|
|
1578
1579
|
i.port.close();
|
|
1579
1580
|
} catch {
|
|
1580
1581
|
}
|
|
1581
1582
|
const o = R.length - 1;
|
|
1582
|
-
if (
|
|
1583
|
+
if (n !== o) {
|
|
1583
1584
|
const a = R[o];
|
|
1584
|
-
R[
|
|
1585
|
+
R[n] = a, u[n] = u[o], w.set(a, n);
|
|
1585
1586
|
}
|
|
1586
1587
|
R.length--, u.length--, w.delete(e.portId);
|
|
1587
1588
|
}
|
|
1588
|
-
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask },
|
|
1589
|
-
R.push(e.portId), u.push(r), w.set(e.portId,
|
|
1589
|
+
const r = { port: e.port, opcodeGroupsMask: e.opcodeGroupsMask }, s = R.length;
|
|
1590
|
+
R.push(e.portId), u.push(r), w.set(e.portId, s);
|
|
1590
1591
|
try {
|
|
1591
1592
|
r.port.start?.();
|
|
1592
1593
|
} catch {
|
|
1593
1594
|
}
|
|
1594
1595
|
r.port.addEventListener("message", (i) => {
|
|
1595
|
-
|
|
1596
|
+
vt(r.opcodeGroupsMask, i.data);
|
|
1596
1597
|
});
|
|
1597
1598
|
return;
|
|
1598
1599
|
}
|
|
1599
1600
|
if (e.type === "detachSendPort") {
|
|
1600
|
-
const
|
|
1601
|
-
if (
|
|
1602
|
-
const r = u[
|
|
1601
|
+
const n = w.get(e.portId);
|
|
1602
|
+
if (n !== void 0) {
|
|
1603
|
+
const r = u[n];
|
|
1603
1604
|
try {
|
|
1604
1605
|
r.port.close();
|
|
1605
1606
|
} catch {
|
|
1606
1607
|
}
|
|
1607
|
-
const
|
|
1608
|
-
if (
|
|
1609
|
-
const i = R[
|
|
1610
|
-
R[
|
|
1608
|
+
const s = R.length - 1;
|
|
1609
|
+
if (n !== s) {
|
|
1610
|
+
const i = R[s];
|
|
1611
|
+
R[n] = i, u[n] = u[s], w.set(i, n);
|
|
1611
1612
|
}
|
|
1612
1613
|
R.length--, u.length--, w.delete(e.portId);
|
|
1613
1614
|
}
|