@ikonai/sdk 1.0.3 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/{audio-playback-worker-YOW1Tosq.js → audio-playback-worker-DPybcm1k.js} +174 -154
- package/assets/{protocol-worker-BnPqA34K.js → protocol-worker-DIKCgk1A.js} +69 -73
- package/assets/{video-capture-worker-y4Nlx7f9.js → video-capture-worker-DP3lFDjq.js} +62 -62
- package/assets/{video-playback-worker-CRGdbDmu.js → video-playback-worker-qauTQ7Et.js} +260 -240
- package/index.js +739 -719
- package/package.json +1 -1
|
@@ -1,42 +1,62 @@
|
|
|
1
|
-
|
|
1
|
+
const J = {
|
|
2
|
+
Compressed: 8
|
|
3
|
+
};
|
|
4
|
+
function Z(t) {
|
|
2
5
|
const r = O(t), e = new DataView(r.buffer, r.byteOffset, r.byteLength);
|
|
3
6
|
if (r.length < 27)
|
|
4
7
|
throw new Error("Protocol payload too short");
|
|
5
|
-
const n = e.getUint32(0, !0), s = e.getUint32(4, !0), E = e.getUint32(8, !0), _ = e.getUint32(12, !0),
|
|
6
|
-
if (27 +
|
|
8
|
+
const n = e.getUint32(0, !0), s = e.getUint32(4, !0), E = e.getUint32(8, !0), _ = e.getUint32(12, !0), i = e.getUint32(16, !0), N = e.getUint32(20, !0), o = e.getUint8(24), m = e.getUint8(25), Q = e.getUint8(26);
|
|
9
|
+
if (27 + N * 4 > r.length)
|
|
7
10
|
throw new Error("Protocol header exceeds payload length");
|
|
8
|
-
const
|
|
9
|
-
let
|
|
10
|
-
for (let
|
|
11
|
-
|
|
11
|
+
const d = [];
|
|
12
|
+
let b = 27;
|
|
13
|
+
for (let H = 0; H < N; H++)
|
|
14
|
+
d.push(e.getUint32(b, !0)), b += 4;
|
|
12
15
|
return {
|
|
13
16
|
length: n,
|
|
14
17
|
opcode: s,
|
|
15
18
|
senderId: E,
|
|
16
19
|
trackId: _,
|
|
17
|
-
sequenceId:
|
|
18
|
-
targetIds:
|
|
19
|
-
payloadVersion:
|
|
20
|
-
payloadType:
|
|
20
|
+
sequenceId: i,
|
|
21
|
+
targetIds: d,
|
|
22
|
+
payloadVersion: o,
|
|
23
|
+
payloadType: m,
|
|
21
24
|
flags: Q
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
|
-
function
|
|
25
|
-
const n = O(t), s =
|
|
27
|
+
async function x(t, r, e) {
|
|
28
|
+
const n = O(t), s = Z(n);
|
|
26
29
|
if (r !== void 0 && s.opcode !== r)
|
|
27
30
|
throw new Error(`Unexpected opcode ${s.opcode}`);
|
|
28
|
-
if (s.payloadVersion !== e)
|
|
29
|
-
throw new Error(`Unexpected payload version ${s.payloadVersion}`);
|
|
30
31
|
if (s.payloadType !== 8)
|
|
31
32
|
throw new Error(`Unexpected payload type ${s.payloadType}`);
|
|
32
33
|
const E = 27 + s.targetIds.length * 4;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
let _ = n.subarray(E, s.length);
|
|
35
|
+
return (s.flags & J.Compressed) !== 0 && (_ = await p(_)), _;
|
|
36
|
+
}
|
|
37
|
+
async function p(t) {
|
|
38
|
+
if (typeof DecompressionStream > "u")
|
|
39
|
+
throw new Error("DecompressionStream not supported");
|
|
40
|
+
const r = new DecompressionStream("gzip"), e = r.writable.getWriter(), n = new Uint8Array(t);
|
|
41
|
+
e.write(n), e.close();
|
|
42
|
+
const s = r.readable.getReader(), E = [];
|
|
43
|
+
let _ = 0;
|
|
44
|
+
for (; ; ) {
|
|
45
|
+
const { done: o, value: m } = await s.read();
|
|
46
|
+
if (o) break;
|
|
47
|
+
E.push(m), _ += m.length;
|
|
48
|
+
}
|
|
49
|
+
const i = new Uint8Array(_);
|
|
50
|
+
let N = 0;
|
|
51
|
+
for (let o = 0; o < E.length; o++)
|
|
52
|
+
i.set(E[o], N), N += E[o].length;
|
|
53
|
+
return i;
|
|
54
|
+
}
|
|
55
|
+
var U = /* @__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))(U || {});
|
|
56
|
+
const tt = 161, rt = 162;
|
|
37
57
|
new TextEncoder();
|
|
38
|
-
const
|
|
39
|
-
class
|
|
58
|
+
const et = new TextDecoder("utf-8", { fatal: !0 });
|
|
59
|
+
class P {
|
|
40
60
|
constructor(r, e, n) {
|
|
41
61
|
this.buffer = r, this.version = e, this.offset = n, this.end = r.length - 1;
|
|
42
62
|
}
|
|
@@ -46,33 +66,33 @@ class w {
|
|
|
46
66
|
const e = O(r);
|
|
47
67
|
if (e.length < 2)
|
|
48
68
|
throw new Error("Teleport payload too short");
|
|
49
|
-
if (e[0] !==
|
|
69
|
+
if (e[0] !== tt || e[e.length - 1] !== rt)
|
|
50
70
|
throw new Error("Teleport object missing markers");
|
|
51
|
-
const n = { offset: 1 }, s =
|
|
52
|
-
return new
|
|
71
|
+
const n = { offset: 1 }, s = A(e, n, "InvalidLength");
|
|
72
|
+
return new P(e, s, n.offset);
|
|
53
73
|
}
|
|
54
74
|
next() {
|
|
55
75
|
if (this.offset >= this.end)
|
|
56
76
|
return null;
|
|
57
77
|
if (this.offset + 5 > this.buffer.length)
|
|
58
78
|
throw new Error("Teleport object truncated");
|
|
59
|
-
const r =
|
|
79
|
+
const r = _t(this.buffer, this.offset);
|
|
60
80
|
this.offset += 4;
|
|
61
81
|
const e = this.buffer[this.offset++], n = e >> 4 & 15;
|
|
62
82
|
if ((e & 15) !== 0)
|
|
63
83
|
throw new Error("Teleport field flags must be zero");
|
|
64
|
-
const s =
|
|
84
|
+
const s = l(n);
|
|
65
85
|
let E;
|
|
66
86
|
if (s >= 0)
|
|
67
|
-
|
|
87
|
+
I(this.buffer, this.offset, s), E = this.buffer.subarray(this.offset, this.offset + s), this.offset += s;
|
|
68
88
|
else {
|
|
69
|
-
const _ = { offset: this.offset },
|
|
70
|
-
|
|
89
|
+
const _ = { offset: this.offset }, i = A(this.buffer, _, "InvalidLength");
|
|
90
|
+
I(this.buffer, _.offset, i), E = this.buffer.subarray(_.offset, _.offset + i), this.offset = _.offset + i;
|
|
71
91
|
}
|
|
72
|
-
return new
|
|
92
|
+
return new nt(r, n, E);
|
|
73
93
|
}
|
|
74
94
|
}
|
|
75
|
-
class
|
|
95
|
+
class f {
|
|
76
96
|
constructor(r, e) {
|
|
77
97
|
this.type = r, this.payload = e;
|
|
78
98
|
}
|
|
@@ -134,38 +154,38 @@ class N {
|
|
|
134
154
|
return this.ensureType(
|
|
135
155
|
12
|
|
136
156
|
/* String */
|
|
137
|
-
),
|
|
157
|
+
), et.decode(this.payload);
|
|
138
158
|
}
|
|
139
159
|
asGuid() {
|
|
140
160
|
return this.ensureType(
|
|
141
161
|
14
|
|
142
162
|
/* Guid */
|
|
143
|
-
),
|
|
163
|
+
), a.fromBytes(this.payload);
|
|
144
164
|
}
|
|
145
165
|
asObject() {
|
|
146
166
|
return this.ensureType(
|
|
147
167
|
11
|
|
148
168
|
/* Object */
|
|
149
|
-
),
|
|
169
|
+
), P.create(this.payload);
|
|
150
170
|
}
|
|
151
171
|
asArray() {
|
|
152
172
|
return this.ensureType(
|
|
153
173
|
9
|
|
154
174
|
/* Array */
|
|
155
|
-
),
|
|
175
|
+
), V.create(this.payload);
|
|
156
176
|
}
|
|
157
177
|
asDictionary() {
|
|
158
178
|
return this.ensureType(
|
|
159
179
|
10
|
|
160
180
|
/* Dict */
|
|
161
|
-
),
|
|
181
|
+
), M.create(this.payload);
|
|
162
182
|
}
|
|
163
183
|
ensureType(r) {
|
|
164
184
|
if (this.type !== r)
|
|
165
|
-
throw new Error(`Teleport value has type ${
|
|
185
|
+
throw new Error(`Teleport value has type ${U[this.type]}, expected ${U[r]}`);
|
|
166
186
|
}
|
|
167
187
|
}
|
|
168
|
-
class
|
|
188
|
+
class nt extends f {
|
|
169
189
|
constructor(r, e, n) {
|
|
170
190
|
super(e, n), this.fieldId = r;
|
|
171
191
|
}
|
|
@@ -173,7 +193,7 @@ class rt extends N {
|
|
|
173
193
|
return this.type === 1;
|
|
174
194
|
}
|
|
175
195
|
}
|
|
176
|
-
class
|
|
196
|
+
class V {
|
|
177
197
|
payload;
|
|
178
198
|
elementType;
|
|
179
199
|
count;
|
|
@@ -186,10 +206,10 @@ class m {
|
|
|
186
206
|
if (this.elementType = e >> 4 & 15, (e & 15) !== 0)
|
|
187
207
|
throw new Error("Array flags must be zero");
|
|
188
208
|
const n = { offset: 1 };
|
|
189
|
-
this.count =
|
|
209
|
+
this.count = A(r, n, "ArrayMalformed"), this.offset = n.offset;
|
|
190
210
|
}
|
|
191
211
|
static create(r) {
|
|
192
|
-
return new
|
|
212
|
+
return new V(O(r));
|
|
193
213
|
}
|
|
194
214
|
next() {
|
|
195
215
|
if (this.index >= this.count) {
|
|
@@ -210,43 +230,43 @@ class m {
|
|
|
210
230
|
case 4:
|
|
211
231
|
case 6:
|
|
212
232
|
case 14: {
|
|
213
|
-
const r =
|
|
214
|
-
|
|
233
|
+
const r = l(this.elementType);
|
|
234
|
+
I(this.payload, this.offset, r);
|
|
215
235
|
const e = this.payload.subarray(this.offset, this.offset + r);
|
|
216
236
|
return this.offset += r, new D(this.elementType, e);
|
|
217
237
|
}
|
|
218
238
|
case 12:
|
|
219
239
|
case 13: {
|
|
220
|
-
const r = { offset: this.offset }, e =
|
|
221
|
-
|
|
240
|
+
const r = { offset: this.offset }, e = A(this.payload, r, "ArrayMalformed");
|
|
241
|
+
I(this.payload, r.offset, e);
|
|
222
242
|
const n = this.payload.subarray(r.offset, r.offset + e);
|
|
223
243
|
return this.offset = r.offset + e, new D(this.elementType, n);
|
|
224
244
|
}
|
|
225
245
|
case 11: {
|
|
226
|
-
const r = { offset: this.offset }, e =
|
|
227
|
-
|
|
246
|
+
const r = { offset: this.offset }, e = A(this.payload, r, "ArrayMalformed");
|
|
247
|
+
I(this.payload, r.offset, e);
|
|
228
248
|
const n = this.payload.subarray(r.offset, r.offset + e);
|
|
229
249
|
return this.offset = r.offset + e, new D(11, n);
|
|
230
250
|
}
|
|
231
251
|
case 9: {
|
|
232
|
-
const r =
|
|
252
|
+
const r = G(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
|
|
233
253
|
return this.offset += r, new D(9, e);
|
|
234
254
|
}
|
|
235
255
|
case 10: {
|
|
236
|
-
const r =
|
|
256
|
+
const r = B(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
|
|
237
257
|
return this.offset += r, new D(10, e);
|
|
238
258
|
}
|
|
239
259
|
default:
|
|
240
|
-
throw new Error(`Unsupported array element type ${
|
|
260
|
+
throw new Error(`Unsupported array element type ${U[this.elementType]}`);
|
|
241
261
|
}
|
|
242
262
|
}
|
|
243
263
|
}
|
|
244
|
-
class D extends
|
|
264
|
+
class D extends f {
|
|
245
265
|
constructor(r, e) {
|
|
246
266
|
super(r, e);
|
|
247
267
|
}
|
|
248
268
|
}
|
|
249
|
-
class
|
|
269
|
+
class M {
|
|
250
270
|
payload;
|
|
251
271
|
keyType;
|
|
252
272
|
valueType;
|
|
@@ -258,12 +278,12 @@ class F {
|
|
|
258
278
|
throw new Error("Dictionary payload too short");
|
|
259
279
|
if (this.keyType = r[0] >> 4 & 15, this.valueType = r[1] >> 4 & 15, (r[0] & 15) !== 0 || (r[1] & 15) !== 0)
|
|
260
280
|
throw new Error("Dictionary key/value flags must be zero");
|
|
261
|
-
|
|
281
|
+
k(this.keyType);
|
|
262
282
|
const e = { offset: 2 };
|
|
263
|
-
this.count =
|
|
283
|
+
this.count = A(r, e, "DictMalformed"), this.offset = e.offset;
|
|
264
284
|
}
|
|
265
285
|
static create(r) {
|
|
266
|
-
return new
|
|
286
|
+
return new M(O(r));
|
|
267
287
|
}
|
|
268
288
|
next() {
|
|
269
289
|
if (this.index >= this.count) {
|
|
@@ -272,20 +292,20 @@ class F {
|
|
|
272
292
|
return null;
|
|
273
293
|
}
|
|
274
294
|
const r = this.readKey(), e = this.readValue();
|
|
275
|
-
return this.index++, new
|
|
295
|
+
return this.index++, new st(r, e);
|
|
276
296
|
}
|
|
277
297
|
readKey() {
|
|
278
|
-
const r =
|
|
298
|
+
const r = l(this.keyType);
|
|
279
299
|
if (r >= 0) {
|
|
280
|
-
|
|
300
|
+
I(this.payload, this.offset, r);
|
|
281
301
|
const e = this.payload.subarray(this.offset, this.offset + r);
|
|
282
|
-
return this.offset += r, new
|
|
302
|
+
return this.offset += r, new f(this.keyType, e);
|
|
283
303
|
}
|
|
284
304
|
if (this.keyType === 12 || this.keyType === 13) {
|
|
285
|
-
const e = { offset: this.offset }, n =
|
|
286
|
-
|
|
305
|
+
const e = { offset: this.offset }, n = A(this.payload, e, "DictMalformed");
|
|
306
|
+
I(this.payload, e.offset, n);
|
|
287
307
|
const s = this.payload.subarray(e.offset, e.offset + n);
|
|
288
|
-
return this.offset = e.offset + n, new
|
|
308
|
+
return this.offset = e.offset + n, new f(this.keyType, s);
|
|
289
309
|
}
|
|
290
310
|
throw new Error("Unsupported dictionary key type");
|
|
291
311
|
}
|
|
@@ -293,24 +313,24 @@ class F {
|
|
|
293
313
|
switch (this.valueType) {
|
|
294
314
|
case 12:
|
|
295
315
|
case 13: {
|
|
296
|
-
const r = { offset: this.offset }, e =
|
|
297
|
-
|
|
316
|
+
const r = { offset: this.offset }, e = A(this.payload, r, "DictMalformed");
|
|
317
|
+
I(this.payload, r.offset, e);
|
|
298
318
|
const n = this.payload.subarray(r.offset, r.offset + e);
|
|
299
|
-
return this.offset = r.offset + e, new
|
|
319
|
+
return this.offset = r.offset + e, new f(this.valueType, n);
|
|
300
320
|
}
|
|
301
321
|
case 11: {
|
|
302
|
-
const r = { offset: this.offset }, e =
|
|
303
|
-
|
|
322
|
+
const r = { offset: this.offset }, e = A(this.payload, r, "DictMalformed");
|
|
323
|
+
I(this.payload, r.offset, e);
|
|
304
324
|
const n = this.payload.subarray(r.offset, r.offset + e);
|
|
305
|
-
return this.offset = r.offset + e, new
|
|
325
|
+
return this.offset = r.offset + e, new f(11, n);
|
|
306
326
|
}
|
|
307
327
|
case 9: {
|
|
308
|
-
const r =
|
|
309
|
-
return this.offset += r, new
|
|
328
|
+
const r = G(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
|
|
329
|
+
return this.offset += r, new f(9, e);
|
|
310
330
|
}
|
|
311
331
|
case 10: {
|
|
312
|
-
const r =
|
|
313
|
-
return this.offset += r, new
|
|
332
|
+
const r = B(this.payload, this.offset), e = this.payload.subarray(this.offset, this.offset + r);
|
|
333
|
+
return this.offset += r, new f(10, e);
|
|
314
334
|
}
|
|
315
335
|
case 3:
|
|
316
336
|
case 5:
|
|
@@ -321,22 +341,22 @@ class F {
|
|
|
321
341
|
case 6:
|
|
322
342
|
case 14:
|
|
323
343
|
case 1: {
|
|
324
|
-
const r =
|
|
325
|
-
|
|
344
|
+
const r = l(this.valueType);
|
|
345
|
+
I(this.payload, this.offset, r);
|
|
326
346
|
const e = this.payload.subarray(this.offset, this.offset + r);
|
|
327
|
-
return this.offset += r, new
|
|
347
|
+
return this.offset += r, new f(this.valueType, e);
|
|
328
348
|
}
|
|
329
349
|
default:
|
|
330
|
-
throw new Error(`Unsupported dictionary value type ${
|
|
350
|
+
throw new Error(`Unsupported dictionary value type ${U[this.valueType]}`);
|
|
331
351
|
}
|
|
332
352
|
}
|
|
333
353
|
}
|
|
334
|
-
class
|
|
354
|
+
class st {
|
|
335
355
|
constructor(r, e) {
|
|
336
356
|
this.key = r, this.value = e;
|
|
337
357
|
}
|
|
338
358
|
}
|
|
339
|
-
class
|
|
359
|
+
class a {
|
|
340
360
|
constructor(r) {
|
|
341
361
|
this.bytes = r;
|
|
342
362
|
}
|
|
@@ -346,19 +366,19 @@ class i {
|
|
|
346
366
|
const e = r.replace(/-/g, "");
|
|
347
367
|
if (e.length !== 32)
|
|
348
368
|
throw new Error("Guid string must be 32 hex characters");
|
|
349
|
-
const n = new Uint8Array(16), s =
|
|
350
|
-
|
|
351
|
-
for (let
|
|
352
|
-
n[8 +
|
|
353
|
-
return new
|
|
369
|
+
const n = new Uint8Array(16), s = a.parseHexSlice(e, 0, 8), E = a.parseHexSlice(e, 8, 4), _ = a.parseHexSlice(e, 12, 4);
|
|
370
|
+
a.writeUInt32LE(n, 0, s), a.writeUInt16LE(n, 4, E), a.writeUInt16LE(n, 6, _);
|
|
371
|
+
for (let i = 0; i < 8; i++)
|
|
372
|
+
n[8 + i] = a.parseHexSlice(e, 16 + i * 2, 2);
|
|
373
|
+
return new a(n);
|
|
354
374
|
}
|
|
355
375
|
static fromBytes(r) {
|
|
356
376
|
if (r.length !== 16)
|
|
357
377
|
throw new Error("Guid byte array must be 16 bytes");
|
|
358
|
-
return new
|
|
378
|
+
return new a(Uint8Array.from(r));
|
|
359
379
|
}
|
|
360
380
|
static createZero() {
|
|
361
|
-
return new
|
|
381
|
+
return new a(new Uint8Array(16));
|
|
362
382
|
}
|
|
363
383
|
static createRandom() {
|
|
364
384
|
const r = new Uint8Array(16), e = globalThis.crypto;
|
|
@@ -367,16 +387,16 @@ class i {
|
|
|
367
387
|
else
|
|
368
388
|
for (let n = 0; n < r.length; n++)
|
|
369
389
|
r[n] = Math.floor(Math.random() * 256);
|
|
370
|
-
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, new
|
|
390
|
+
return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, new a(r);
|
|
371
391
|
}
|
|
372
392
|
toString() {
|
|
373
393
|
const r = this.bytes;
|
|
374
394
|
return [
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
395
|
+
a.toHex(a.readUInt32LE(r, 0), 8),
|
|
396
|
+
a.toHex(a.readUInt16LE(r, 4), 4),
|
|
397
|
+
a.toHex(a.readUInt16LE(r, 6), 4),
|
|
398
|
+
K(r.subarray(8, 10)),
|
|
399
|
+
K(r.subarray(10, 16))
|
|
380
400
|
].join("-");
|
|
381
401
|
}
|
|
382
402
|
asBytes() {
|
|
@@ -406,14 +426,14 @@ class i {
|
|
|
406
426
|
return (r >>> 0).toString(16).padStart(e, "0");
|
|
407
427
|
}
|
|
408
428
|
}
|
|
409
|
-
function
|
|
429
|
+
function A(t, r, e) {
|
|
410
430
|
if (r.offset >= t.length)
|
|
411
431
|
throw new Error(e);
|
|
412
432
|
let n = 0, s = 0, E = 0;
|
|
413
433
|
for (; r.offset < t.length; ) {
|
|
414
434
|
const _ = t[r.offset++];
|
|
415
435
|
if (E++, n |= (_ & 127) << s, (_ & 128) === 0) {
|
|
416
|
-
if (E !==
|
|
436
|
+
if (E !== Et(n))
|
|
417
437
|
throw new Error("Teleport VarUInt is not canonical");
|
|
418
438
|
return n >>> 0;
|
|
419
439
|
}
|
|
@@ -422,10 +442,10 @@ function T(t, r, e) {
|
|
|
422
442
|
}
|
|
423
443
|
throw new Error(e);
|
|
424
444
|
}
|
|
425
|
-
function
|
|
445
|
+
function Et(t) {
|
|
426
446
|
return t < 128 ? 1 : t < 16384 ? 2 : t < 2097152 ? 3 : t < 268435456 ? 4 : 5;
|
|
427
447
|
}
|
|
428
|
-
function
|
|
448
|
+
function l(t) {
|
|
429
449
|
switch (t) {
|
|
430
450
|
case 3:
|
|
431
451
|
case 5:
|
|
@@ -445,96 +465,96 @@ function U(t) {
|
|
|
445
465
|
return -1;
|
|
446
466
|
}
|
|
447
467
|
}
|
|
448
|
-
function
|
|
468
|
+
function k(t) {
|
|
449
469
|
if (t === 9 || t === 11 || t === 10 || t === 1)
|
|
450
470
|
throw new Error("Dictionary keys must be primitive Teleport types");
|
|
451
471
|
}
|
|
452
|
-
function
|
|
472
|
+
function I(t, r, e) {
|
|
453
473
|
if (r < 0 || e < 0 || r + e > t.length)
|
|
454
474
|
throw new Error("Teleport payload exceeds bounds");
|
|
455
475
|
}
|
|
456
|
-
function
|
|
476
|
+
function _t(t, r) {
|
|
457
477
|
return (t[r] | t[r + 1] << 8 | t[r + 2] << 16 | t[r + 3] << 24) >>> 0;
|
|
458
478
|
}
|
|
459
|
-
function
|
|
479
|
+
function G(t, r) {
|
|
460
480
|
if (r >= t.length)
|
|
461
481
|
throw new Error("Array payload exceeds bounds");
|
|
462
482
|
const e = t[r], n = e >> 4 & 15;
|
|
463
483
|
if ((e & 15) !== 0)
|
|
464
484
|
throw new Error("Array flags must be zero");
|
|
465
|
-
const s = { offset: r + 1 }, E =
|
|
485
|
+
const s = { offset: r + 1 }, E = A(t, s, "ArrayMalformed"), _ = l(n);
|
|
466
486
|
if (_ >= 0) {
|
|
467
|
-
const
|
|
468
|
-
return
|
|
487
|
+
const N = _ * E;
|
|
488
|
+
return I(t, s.offset, N), s.offset + N - r;
|
|
469
489
|
}
|
|
470
|
-
let
|
|
471
|
-
for (let
|
|
472
|
-
|
|
473
|
-
return
|
|
490
|
+
let i = s.offset;
|
|
491
|
+
for (let N = 0; N < E; N++)
|
|
492
|
+
i = F(n, t, i, "ArrayMalformed");
|
|
493
|
+
return i - r;
|
|
474
494
|
}
|
|
475
|
-
function
|
|
495
|
+
function B(t, r) {
|
|
476
496
|
if (r + 2 > t.length)
|
|
477
497
|
throw new Error("Dictionary payload too short");
|
|
478
498
|
const e = t[r] >> 4 & 15, n = t[r + 1] >> 4 & 15;
|
|
479
499
|
if ((t[r] & 15) !== 0 || (t[r + 1] & 15) !== 0)
|
|
480
500
|
throw new Error("Dictionary key/value flags must be zero");
|
|
481
|
-
|
|
482
|
-
const s = { offset: r + 2 }, E =
|
|
501
|
+
k(e);
|
|
502
|
+
const s = { offset: r + 2 }, E = A(t, s, "DictMalformed");
|
|
483
503
|
let _ = s.offset;
|
|
484
|
-
for (let
|
|
485
|
-
_ =
|
|
504
|
+
for (let i = 0; i < E; i++)
|
|
505
|
+
_ = F(e, t, _, "DictMalformed"), _ = F(n, t, _, "DictMalformed");
|
|
486
506
|
return _ - r;
|
|
487
507
|
}
|
|
488
|
-
function
|
|
489
|
-
const s =
|
|
508
|
+
function F(t, r, e, n) {
|
|
509
|
+
const s = l(t);
|
|
490
510
|
if (s >= 0)
|
|
491
|
-
return
|
|
511
|
+
return I(r, e, s), e + s;
|
|
492
512
|
switch (t) {
|
|
493
513
|
case 12:
|
|
494
514
|
case 13: {
|
|
495
|
-
const E = { offset: e }, _ =
|
|
496
|
-
return
|
|
515
|
+
const E = { offset: e }, _ = A(r, E, n);
|
|
516
|
+
return I(r, E.offset, _), E.offset + _;
|
|
497
517
|
}
|
|
498
518
|
case 11: {
|
|
499
|
-
const E = { offset: e }, _ =
|
|
500
|
-
return
|
|
519
|
+
const E = { offset: e }, _ = A(r, E, n);
|
|
520
|
+
return I(r, E.offset, _), E.offset + _;
|
|
501
521
|
}
|
|
502
522
|
case 9:
|
|
503
|
-
return e +
|
|
523
|
+
return e + G(r, e);
|
|
504
524
|
case 10:
|
|
505
|
-
return e +
|
|
525
|
+
return e + B(r, e);
|
|
506
526
|
default:
|
|
507
|
-
throw new Error(`Unsupported Teleport type ${
|
|
527
|
+
throw new Error(`Unsupported Teleport type ${U[t]}`);
|
|
508
528
|
}
|
|
509
529
|
}
|
|
510
|
-
function
|
|
530
|
+
function K(t) {
|
|
511
531
|
return Array.from(t).map((r) => r.toString(16).padStart(2, "0")).join("");
|
|
512
532
|
}
|
|
513
533
|
function O(t) {
|
|
514
534
|
return t instanceof Uint8Array ? t : new Uint8Array(t);
|
|
515
535
|
}
|
|
516
|
-
var u = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(u || {}), L = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.ANALYTICS_DEVTOOLS_CONSOLE_OUTPUT = 524297] = "ANALYTICS_DEVTOOLS_CONSOLE_OUTPUT", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(L || {});
|
|
517
|
-
const
|
|
518
|
-
function
|
|
536
|
+
var h = /* @__PURE__ */ ((t) => (t[t.Unknown = 0] = "Unknown", t[t.H264 = 1] = "H264", t[t.Vp8 = 2] = "Vp8", t[t.Vp9 = 3] = "Vp9", t[t.Av1 = 4] = "Av1", t))(h || {}), L = /* @__PURE__ */ ((t) => (t[t.NONE = 0] = "NONE", t[t.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", t[t.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", t[t.GROUP_CORE = 65536] = "GROUP_CORE", t[t.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", t[t.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", t[t.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", t[t.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", t[t.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", t[t.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", t[t.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", t[t.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", t[t.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", t[t.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", t[t.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", t[t.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", t[t.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", t[t.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", t[t.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", t[t.CORE_SERVER_START = 65552] = "CORE_SERVER_START", t[t.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", t[t.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", t[t.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", t[t.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", t[t.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", t[t.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", t[t.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", t[t.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", t[t.GROUP_EVENTS = 262144] = "GROUP_EVENTS", t[t.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", t[t.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", t[t.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", t[t.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", t[t.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", t[t.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", t[t.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", t[t.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", t[t.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", t[t.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", t[t.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", t[t.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", t[t.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", t[t.ACTION_CALL = 1048577] = "ACTION_CALL", t[t.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", t[t.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", t[t.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", t[t.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", t[t.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", t[t.ACTION_TAP = 1048583] = "ACTION_TAP", t[t.ACTION_PAN = 1048584] = "ACTION_PAN", t[t.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", t[t.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", t[t.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", t[t.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", t[t.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", t[t.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", t[t.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", t[t.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", t[t.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", t[t.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", t[t.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", t[t.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", t[t.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", t[t.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", t[t.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", t[t.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", t[t.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", t[t.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", t[t.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", t[t.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", t[t.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", t[t.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", t[t.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", t[t.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", t[t.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", t[t.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", t[t.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", t[t.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", t[t.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", t[t.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", t[t.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", t[t.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", t[t.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", t[t.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", t[t.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", t[t.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", t[t.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", t[t.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", t[t.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", t[t.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", t[t.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", t[t.ACTION_OPTIMISTIC_CLIENT_CALLS = 1048626] = "ACTION_OPTIMISTIC_CLIENT_CALLS", t[t.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", t[t.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", t[t.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", t[t.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", t[t.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", t[t.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", t[t.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", t[t.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", t[t.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", t[t.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", t[t.ACTION_CALL2 = 1048637] = "ACTION_CALL2", t[t.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", t[t.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", t[t.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", t[t.GROUP_UI = 2097152] = "GROUP_UI", t[t.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", t[t.UI_STREAM_END = 2097154] = "UI_STREAM_END", t[t.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", t[t.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", t[t.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", t[t.UI_SECTION_END = 2097158] = "UI_SECTION_END", t[t.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", t[t.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", t[t.UI_LIST_END = 2097161] = "UI_LIST_END", t[t.UI_TEXT = 2097162] = "UI_TEXT", t[t.UI_HEADER = 2097163] = "UI_HEADER", t[t.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", t[t.UI_BUTTON = 2097165] = "UI_BUTTON", t[t.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", t[t.UI_IMAGE = 2097167] = "UI_IMAGE", t[t.UI_FILE = 2097168] = "UI_FILE", t[t.UI_BADGE = 2097169] = "UI_BADGE", t[t.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", t[t.UI_MAP = 2097171] = "UI_MAP", t[t.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", t[t.UI_ICON = 2097173] = "UI_ICON", t[t.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", t[t.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", t[t.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", t[t.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", t[t.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", t[t.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", t[t.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", t[t.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", t[t.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", t[t.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", t[t.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", t[t.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", t[t.UI_QS = 2097186] = "UI_QS", t[t.UI_ELEMENT = 2097187] = "UI_ELEMENT", t[t.UI_STYLES = 2097188] = "UI_STYLES", t[t.UI_SVG = 2097189] = "UI_SVG", t[t.UI_UPDATE = 2097190] = "UI_UPDATE", t[t.UI_INIT = 2097191] = "UI_INIT", t[t.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", t[t.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", t[t.GROUP_COMMON = 4128768] = "GROUP_COMMON", t[t.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", t[t.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", t[t.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", t[t.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", t[t.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", t[t.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", t[t.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", t[t.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", t[t.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", t[t.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", t[t.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", t[t.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", t[t.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", t[t.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", t[t.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", t[t.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", t[t.GROUP_SCENE = 33554432] = "GROUP_SCENE", t[t.SCENE_MESH = 33554433] = "SCENE_MESH", t[t.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", t[t.GROUP_ALL = 67043328] = "GROUP_ALL", t[t.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", t))(L || {});
|
|
537
|
+
const it = 8388609, at = 164808083, It = 1368629611, At = 2739413426, Tt = 2768375929, Nt = 2950031986, ft = 3284746250, ot = 4065070594;
|
|
538
|
+
function Ct(t) {
|
|
519
539
|
const r = {};
|
|
520
|
-
return
|
|
521
|
-
}
|
|
522
|
-
function v(t) {
|
|
523
|
-
return t.Description = "", t.Codec = u.H264, t.Width = 0, t.Height = 0, t.Framerate = 30, t.Bitrate = 0, t.IsHardwareAccelerated = !1, t;
|
|
540
|
+
return Y(r), r;
|
|
524
541
|
}
|
|
525
|
-
function
|
|
526
|
-
|
|
527
|
-
return ut(e, r);
|
|
542
|
+
function Y(t) {
|
|
543
|
+
return t.Description = "", t.Codec = h.H264, t.Width = 0, t.Height = 0, t.Framerate = 30, t.Bitrate = 0, t.IsHardwareAccelerated = !1, t;
|
|
528
544
|
}
|
|
529
545
|
function ut(t, r) {
|
|
530
|
-
const e =
|
|
531
|
-
return
|
|
546
|
+
const e = P.create(t);
|
|
547
|
+
return ht(e, r);
|
|
532
548
|
}
|
|
533
549
|
function ht(t, r) {
|
|
550
|
+
const e = r ?? Ct();
|
|
551
|
+
return Y(e), Rt(t, e), e;
|
|
552
|
+
}
|
|
553
|
+
function Rt(t, r) {
|
|
534
554
|
let e;
|
|
535
555
|
for (; (e = t.next()) !== null; )
|
|
536
556
|
switch (e.fieldId) {
|
|
537
|
-
case
|
|
557
|
+
case at: {
|
|
538
558
|
if (e.isNull) throw new Error();
|
|
539
559
|
r.Framerate = e.asInt32();
|
|
540
560
|
break;
|
|
@@ -544,7 +564,7 @@ function ht(t, r) {
|
|
|
544
564
|
r.Description = e.asString();
|
|
545
565
|
break;
|
|
546
566
|
}
|
|
547
|
-
case
|
|
567
|
+
case At: {
|
|
548
568
|
if (e.isNull) throw new Error();
|
|
549
569
|
r.IsHardwareAccelerated = e.asBool();
|
|
550
570
|
break;
|
|
@@ -554,42 +574,42 @@ function ht(t, r) {
|
|
|
554
574
|
r.Bitrate = e.asInt32();
|
|
555
575
|
break;
|
|
556
576
|
}
|
|
557
|
-
case
|
|
577
|
+
case Nt: {
|
|
558
578
|
if (e.isNull) throw new Error();
|
|
559
579
|
r.Height = e.asInt32();
|
|
560
580
|
break;
|
|
561
581
|
}
|
|
562
|
-
case
|
|
582
|
+
case ft: {
|
|
563
583
|
if (e.isNull) throw new Error();
|
|
564
584
|
r.Codec = e.asInt32();
|
|
565
585
|
break;
|
|
566
586
|
}
|
|
567
|
-
case
|
|
587
|
+
case ot: {
|
|
568
588
|
if (e.isNull) throw new Error();
|
|
569
589
|
r.Width = e.asInt32();
|
|
570
590
|
break;
|
|
571
591
|
}
|
|
572
592
|
}
|
|
573
593
|
}
|
|
574
|
-
function
|
|
575
|
-
const e =
|
|
576
|
-
return
|
|
594
|
+
async function Ut(t, r) {
|
|
595
|
+
const e = await x(t, it);
|
|
596
|
+
return ut(e, r);
|
|
577
597
|
}
|
|
578
|
-
const
|
|
598
|
+
const lt = 8388611, St = 271275304, ct = 2541432218, Dt = 2986785889, Lt = 3105403172, yt = 3456383222;
|
|
579
599
|
function wt(t) {
|
|
580
600
|
const r = {};
|
|
581
|
-
return
|
|
601
|
+
return X(r), r;
|
|
582
602
|
}
|
|
583
|
-
function
|
|
603
|
+
function X(t) {
|
|
584
604
|
return t.Data = new Uint8Array(0), t.FrameNumber = 0, t.IsKey = !1, t.TimestampInUs = 0n, t.DurationInUs = 0, t;
|
|
585
605
|
}
|
|
586
|
-
function Ot(t, r) {
|
|
587
|
-
const e = w.create(t);
|
|
588
|
-
return Pt(e, r);
|
|
589
|
-
}
|
|
590
606
|
function Pt(t, r) {
|
|
607
|
+
const e = P.create(t);
|
|
608
|
+
return Ot(e, r);
|
|
609
|
+
}
|
|
610
|
+
function Ot(t, r) {
|
|
591
611
|
const e = r ?? wt();
|
|
592
|
-
return
|
|
612
|
+
return X(e), gt(t, e), e;
|
|
593
613
|
}
|
|
594
614
|
function gt(t, r) {
|
|
595
615
|
let e;
|
|
@@ -600,17 +620,17 @@ function gt(t, r) {
|
|
|
600
620
|
r.TimestampInUs = e.asUInt64();
|
|
601
621
|
break;
|
|
602
622
|
}
|
|
603
|
-
case
|
|
623
|
+
case ct: {
|
|
604
624
|
if (e.isNull) throw new Error();
|
|
605
625
|
r.DurationInUs = e.asUInt32();
|
|
606
626
|
break;
|
|
607
627
|
}
|
|
608
|
-
case
|
|
628
|
+
case Dt: {
|
|
609
629
|
if (e.isNull) throw new Error();
|
|
610
630
|
r.Data = e.asBinary();
|
|
611
631
|
break;
|
|
612
632
|
}
|
|
613
|
-
case
|
|
633
|
+
case Lt: {
|
|
614
634
|
if (e.isNull) throw new Error();
|
|
615
635
|
r.IsKey = e.asBool();
|
|
616
636
|
break;
|
|
@@ -622,25 +642,25 @@ function gt(t, r) {
|
|
|
622
642
|
}
|
|
623
643
|
}
|
|
624
644
|
}
|
|
625
|
-
function mt(t, r) {
|
|
626
|
-
const e =
|
|
627
|
-
return
|
|
645
|
+
async function mt(t, r) {
|
|
646
|
+
const e = await x(t, lt);
|
|
647
|
+
return Pt(e, r);
|
|
628
648
|
}
|
|
629
|
-
const Ft = "avc1.42E01E", Vt = "vp8", Mt = "vp09.00.10.08", Gt = "av01.0.04M.08", Bt = 3,
|
|
630
|
-
let
|
|
631
|
-
const
|
|
632
|
-
function
|
|
649
|
+
const Ft = "avc1.42E01E", Vt = "vp8", Mt = "vp09.00.10.08", Gt = "av01.0.04M.08", Bt = 3, S = (t, r) => self.postMessage(t, r ?? []);
|
|
650
|
+
let R = null, w = !0;
|
|
651
|
+
const T = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map();
|
|
652
|
+
function C(t) {
|
|
633
653
|
const r = t instanceof Error ? t : new Error(String(t));
|
|
634
|
-
|
|
654
|
+
S({ type: "error", error: { name: r.name, message: r.message, stack: r.stack } });
|
|
635
655
|
}
|
|
636
|
-
function
|
|
656
|
+
function g(t, r) {
|
|
637
657
|
return t << 16 | r & 65535;
|
|
638
658
|
}
|
|
639
|
-
function
|
|
659
|
+
function W(t, r) {
|
|
640
660
|
return `${t}_${r}`;
|
|
641
661
|
}
|
|
642
|
-
function
|
|
643
|
-
const e =
|
|
662
|
+
function z(t, r) {
|
|
663
|
+
const e = T.get(t);
|
|
644
664
|
if (e)
|
|
645
665
|
return e;
|
|
646
666
|
const n = {
|
|
@@ -659,38 +679,38 @@ function X(t, r) {
|
|
|
659
679
|
isKeyFrameRequired: !0,
|
|
660
680
|
pendingDecodeCount: 0
|
|
661
681
|
};
|
|
662
|
-
return
|
|
682
|
+
return T.set(t, n), c.set(r, t), n;
|
|
663
683
|
}
|
|
664
|
-
function
|
|
665
|
-
const r =
|
|
684
|
+
function v(t) {
|
|
685
|
+
const r = c.get(t);
|
|
666
686
|
if (r !== void 0) {
|
|
667
|
-
const _ =
|
|
687
|
+
const _ = T.get(r);
|
|
668
688
|
if (_)
|
|
669
689
|
return _;
|
|
670
690
|
}
|
|
671
|
-
const e = t.split("_"), n = Number(e[0]) || 0, s = Number(e[1]) || 0, E =
|
|
672
|
-
return
|
|
691
|
+
const e = t.split("_"), n = Number(e[0]) || 0, s = Number(e[1]) || 0, E = g(n, s);
|
|
692
|
+
return z(E, t);
|
|
673
693
|
}
|
|
674
|
-
function
|
|
675
|
-
if (t ===
|
|
676
|
-
if (t ===
|
|
677
|
-
if (t ===
|
|
678
|
-
if (t ===
|
|
694
|
+
function dt(t) {
|
|
695
|
+
if (t === h.H264) return Ft;
|
|
696
|
+
if (t === h.Vp8) return Vt;
|
|
697
|
+
if (t === h.Vp9) return Mt;
|
|
698
|
+
if (t === h.Av1) return Gt;
|
|
679
699
|
throw new Error(`Unknown codec: ${t}`);
|
|
680
700
|
}
|
|
681
|
-
function
|
|
682
|
-
|
|
701
|
+
function u(t) {
|
|
702
|
+
S({ type: "requestIdr", streamId: t });
|
|
683
703
|
}
|
|
684
|
-
async function
|
|
704
|
+
async function bt(t, r) {
|
|
685
705
|
try {
|
|
686
|
-
if (!
|
|
706
|
+
if (!w || !t.watched)
|
|
687
707
|
return;
|
|
688
708
|
if (typeof createImageBitmap == "function") {
|
|
689
709
|
const e = await createImageBitmap(r);
|
|
690
|
-
|
|
710
|
+
S({ type: "frame", streamId: t.streamId, width: t.width, height: t.height, bitmap: e }, [e]);
|
|
691
711
|
}
|
|
692
712
|
} catch (e) {
|
|
693
|
-
|
|
713
|
+
C(e);
|
|
694
714
|
} finally {
|
|
695
715
|
t.pendingDecodeCount--;
|
|
696
716
|
try {
|
|
@@ -723,13 +743,13 @@ async function Ht(t, r, e) {
|
|
|
723
743
|
}
|
|
724
744
|
return null;
|
|
725
745
|
}
|
|
726
|
-
async function
|
|
746
|
+
async function y(t) {
|
|
727
747
|
if (t.codec == null)
|
|
728
748
|
return;
|
|
729
|
-
const r =
|
|
749
|
+
const r = dt(t.codec);
|
|
730
750
|
if (t.decoder || (t.decoder = new VideoDecoder({
|
|
731
751
|
output: (e) => {
|
|
732
|
-
if (t.pendingDecodeCount++, !
|
|
752
|
+
if (t.pendingDecodeCount++, !w || !t.watched) {
|
|
733
753
|
t.pendingDecodeCount--;
|
|
734
754
|
try {
|
|
735
755
|
e.close();
|
|
@@ -750,7 +770,7 @@ async function c(t) {
|
|
|
750
770
|
try {
|
|
751
771
|
t.ctx2d.drawImage(e, 0, 0, n, s);
|
|
752
772
|
} catch (E) {
|
|
753
|
-
|
|
773
|
+
C(E);
|
|
754
774
|
} finally {
|
|
755
775
|
t.pendingDecodeCount--;
|
|
756
776
|
try {
|
|
@@ -760,58 +780,58 @@ async function c(t) {
|
|
|
760
780
|
}
|
|
761
781
|
return;
|
|
762
782
|
}
|
|
763
|
-
|
|
783
|
+
bt(t, e);
|
|
764
784
|
},
|
|
765
785
|
error: (e) => {
|
|
766
|
-
|
|
786
|
+
C(e), t.isKeyFrameRequired = !0, u(t.streamId);
|
|
767
787
|
}
|
|
768
788
|
})), t.decoderCodec !== r) {
|
|
769
789
|
const e = await Ht(r, t.width, t.height);
|
|
770
790
|
if (!e) {
|
|
771
|
-
|
|
791
|
+
C(new Error(`Decoder not supported for codec ${r}`));
|
|
772
792
|
return;
|
|
773
793
|
}
|
|
774
794
|
t.decoderCodec = r;
|
|
775
795
|
try {
|
|
776
|
-
t.decoder.configure(e.config), t.isKeyFrameRequired = !0,
|
|
796
|
+
t.decoder.configure(e.config), t.isKeyFrameRequired = !0, u(t.streamId);
|
|
777
797
|
const n = e.isHardwareAccelerated ? "hardware" : "software", s = t.framerate > 0 ? `@${Math.round(t.framerate)}fps` : "";
|
|
778
|
-
|
|
798
|
+
S({ type: "log", message: `Decoder configured: codec=${r}, ${t.width}x${t.height}${s}, hw=${n}` });
|
|
779
799
|
} catch (n) {
|
|
780
|
-
|
|
800
|
+
C(n);
|
|
781
801
|
}
|
|
782
802
|
t.surface && t.ctx2d && t.width > 0 && t.height > 0 && (t.surface.width !== t.width || t.surface.height !== t.height) && (t.surface.width = t.width, t.surface.height = t.height);
|
|
783
803
|
}
|
|
784
804
|
}
|
|
785
|
-
function Kt(t, r) {
|
|
786
|
-
const e =
|
|
787
|
-
E.codec = s.Codec, E.width = s.Width, E.height = s.Height, E.framerate = s.Framerate, E.bitrate = s.Bitrate,
|
|
805
|
+
async function Kt(t, r) {
|
|
806
|
+
const e = g(r.senderId, r.trackId), n = W(r.senderId, r.trackId), s = await Ut(t), E = z(e, n);
|
|
807
|
+
E.codec = s.Codec, E.width = s.Width, E.height = s.Height, E.framerate = s.Framerate, E.bitrate = s.Bitrate, S({ type: "streamBegin", streamId: n, width: s.Width, height: s.Height, codec: s.Codec }), E.watched && (E.surface && E.ctx2d && s.Width > 0 && s.Height > 0 && (E.surface.width !== s.Width || E.surface.height !== s.Height) && (E.surface.width = s.Width, E.surface.height = s.Height), y(E));
|
|
788
808
|
}
|
|
789
|
-
function
|
|
790
|
-
const r =
|
|
791
|
-
|
|
792
|
-
const n =
|
|
809
|
+
function vt(t) {
|
|
810
|
+
const r = g(t.senderId, t.trackId), e = W(t.senderId, t.trackId);
|
|
811
|
+
S({ type: "streamEnd", streamId: e });
|
|
812
|
+
const n = T.get(r);
|
|
793
813
|
if (n) {
|
|
794
814
|
if (n.decoder)
|
|
795
815
|
try {
|
|
796
816
|
n.decoder.close();
|
|
797
817
|
} catch {
|
|
798
818
|
}
|
|
799
|
-
|
|
819
|
+
T.delete(r), c.delete(e);
|
|
800
820
|
}
|
|
801
821
|
}
|
|
802
|
-
function
|
|
803
|
-
const r =
|
|
822
|
+
function $(t) {
|
|
823
|
+
const r = c.get(t);
|
|
804
824
|
if (r === void 0)
|
|
805
825
|
return;
|
|
806
|
-
const e =
|
|
826
|
+
const e = T.get(r);
|
|
807
827
|
e && (e.surface = null, e.ctx2d = null);
|
|
808
828
|
}
|
|
809
|
-
function
|
|
810
|
-
const r =
|
|
829
|
+
function q(t) {
|
|
830
|
+
const r = c.get(t);
|
|
811
831
|
if (r === void 0)
|
|
812
832
|
return;
|
|
813
|
-
const e =
|
|
814
|
-
if (e && (e.watched = !1, e.isKeyFrameRequired = !0,
|
|
833
|
+
const e = T.get(r);
|
|
834
|
+
if (e && (e.watched = !1, e.isKeyFrameRequired = !0, $(t), e.decoder)) {
|
|
815
835
|
try {
|
|
816
836
|
e.decoder.close();
|
|
817
837
|
} catch {
|
|
@@ -819,11 +839,11 @@ function z(t) {
|
|
|
819
839
|
e.decoder = null, e.decoderCodec = null;
|
|
820
840
|
}
|
|
821
841
|
}
|
|
822
|
-
function
|
|
823
|
-
const e =
|
|
824
|
-
if (!n || !
|
|
842
|
+
async function xt(t, r) {
|
|
843
|
+
const e = g(r.senderId, r.trackId), n = T.get(e);
|
|
844
|
+
if (!n || !w || !n.watched || ((!n.decoder || !n.decoderCodec) && y(n), !n.decoder || !n.decoderCodec))
|
|
825
845
|
return;
|
|
826
|
-
const s = mt(t);
|
|
846
|
+
const s = await mt(t);
|
|
827
847
|
if (n.isKeyFrameRequired) {
|
|
828
848
|
if (!s.IsKey)
|
|
829
849
|
return;
|
|
@@ -839,84 +859,84 @@ function vt(t, r) {
|
|
|
839
859
|
})
|
|
840
860
|
);
|
|
841
861
|
} catch (E) {
|
|
842
|
-
n.isKeyFrameRequired = !0,
|
|
862
|
+
n.isKeyFrameRequired = !0, u(n.streamId), C(E);
|
|
843
863
|
}
|
|
844
864
|
}
|
|
845
|
-
function
|
|
846
|
-
const r =
|
|
847
|
-
e && (e.isKeyFrameRequired = !0, e.watched &&
|
|
865
|
+
function kt(t) {
|
|
866
|
+
const r = g(t.senderId, t.trackId), e = T.get(r);
|
|
867
|
+
e && (e.isKeyFrameRequired = !0, e.watched && u(e.streamId));
|
|
848
868
|
}
|
|
849
|
-
function
|
|
869
|
+
function Yt(t, r) {
|
|
850
870
|
switch (r.opcode) {
|
|
851
871
|
case L.VIDEO_STREAM_BEGIN:
|
|
852
872
|
Kt(t, r);
|
|
853
873
|
return;
|
|
854
874
|
case L.VIDEO_STREAM_END:
|
|
855
|
-
|
|
875
|
+
vt(r);
|
|
856
876
|
return;
|
|
857
877
|
case L.VIDEO_FRAME:
|
|
858
|
-
|
|
878
|
+
xt(t, r);
|
|
859
879
|
return;
|
|
860
880
|
case L.VIDEO_INVALIDATE_FRAME:
|
|
861
|
-
|
|
881
|
+
kt(r);
|
|
862
882
|
return;
|
|
863
883
|
default:
|
|
864
884
|
return;
|
|
865
885
|
}
|
|
866
886
|
}
|
|
867
|
-
function
|
|
868
|
-
if (
|
|
887
|
+
function j() {
|
|
888
|
+
if (R) {
|
|
869
889
|
try {
|
|
870
|
-
|
|
890
|
+
R.close();
|
|
871
891
|
} catch {
|
|
872
892
|
}
|
|
873
|
-
|
|
893
|
+
R = null;
|
|
874
894
|
}
|
|
875
895
|
}
|
|
876
896
|
function Xt() {
|
|
877
|
-
|
|
878
|
-
for (const t of
|
|
879
|
-
|
|
880
|
-
|
|
897
|
+
j();
|
|
898
|
+
for (const t of T.values())
|
|
899
|
+
q(t.streamId);
|
|
900
|
+
T.clear(), c.clear();
|
|
881
901
|
}
|
|
882
902
|
self.addEventListener("message", (t) => {
|
|
883
903
|
const r = t.data;
|
|
884
904
|
if (r.type !== "configure") {
|
|
885
905
|
if (r.type === "attachSurface") {
|
|
886
|
-
const e = r.streamId, n =
|
|
906
|
+
const e = r.streamId, n = v(e);
|
|
887
907
|
n.watched = !0, n.surface = r.canvas;
|
|
888
908
|
try {
|
|
889
909
|
n.ctx2d = n.surface.getContext("2d", { alpha: !1, desynchronized: !0 });
|
|
890
910
|
} catch (s) {
|
|
891
|
-
|
|
911
|
+
C(s), n.ctx2d = null;
|
|
892
912
|
}
|
|
893
|
-
n.isKeyFrameRequired = !0,
|
|
913
|
+
n.isKeyFrameRequired = !0, y(n), u(e);
|
|
894
914
|
return;
|
|
895
915
|
}
|
|
896
916
|
if (r.type === "detachSurface") {
|
|
897
|
-
|
|
917
|
+
$(r.streamId);
|
|
898
918
|
return;
|
|
899
919
|
}
|
|
900
920
|
if (r.type === "attachProtocolPort") {
|
|
901
|
-
|
|
921
|
+
j(), R = r.port, R.addEventListener("message", (e) => {
|
|
902
922
|
const n = e.data;
|
|
903
|
-
n?.type === "protocol" && n.message instanceof ArrayBuffer && n.headers &&
|
|
904
|
-
}),
|
|
923
|
+
n?.type === "protocol" && n.message instanceof ArrayBuffer && n.headers && Yt(new Uint8Array(n.message), n.headers);
|
|
924
|
+
}), R.start?.();
|
|
905
925
|
return;
|
|
906
926
|
}
|
|
907
927
|
if (r.type === "watchStream") {
|
|
908
|
-
const e =
|
|
909
|
-
e.watched = !0, e.isKeyFrameRequired = !0,
|
|
928
|
+
const e = v(r.streamId);
|
|
929
|
+
e.watched = !0, e.isKeyFrameRequired = !0, y(e), u(e.streamId);
|
|
910
930
|
return;
|
|
911
931
|
}
|
|
912
932
|
if (r.type === "unwatchStream") {
|
|
913
|
-
|
|
933
|
+
q(r.streamId);
|
|
914
934
|
return;
|
|
915
935
|
}
|
|
916
936
|
if (r.type === "setEnabled") {
|
|
917
|
-
if (
|
|
918
|
-
for (const e of
|
|
919
|
-
e.watched && (e.isKeyFrameRequired = !0,
|
|
937
|
+
if (w = r.enabled, w)
|
|
938
|
+
for (const e of T.values())
|
|
939
|
+
e.watched && (e.isKeyFrameRequired = !0, y(e), u(e.streamId));
|
|
920
940
|
return;
|
|
921
941
|
}
|
|
922
942
|
r.type === "dispose" && Xt();
|