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