@ikonai/sdk-ui 1.0.60 → 1.0.62

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.
@@ -1,2784 +0,0 @@
1
- const et = {
2
- Compressed: 8
3
- };
4
- function tt(e) {
5
- if (e.length < 8)
6
- throw new Error("Protocol message too short");
7
- return (e[4] | e[5] << 8 | e[6] << 16 | e[7] << 24) >>> 0;
8
- }
9
- function Z(e) {
10
- const r = K(e), t = new DataView(r.buffer, r.byteOffset, r.byteLength);
11
- if (r.length < 27)
12
- throw new Error("Protocol payload too short");
13
- const s = t.getUint32(0, !0), n = t.getUint32(4, !0), i = t.getUint32(8, !0), o = t.getUint32(12, !0), a = t.getUint32(16, !0), I = t.getUint32(20, !0), _ = t.getUint8(24), E = t.getUint8(25), l = t.getUint8(26);
14
- if (27 + I * 4 > r.length)
15
- throw new Error("Protocol header exceeds payload length");
16
- const w = [];
17
- let d = 27;
18
- for (let W = 0; W < I; W++)
19
- w.push(t.getUint32(d, !0)), d += 4;
20
- return {
21
- length: s,
22
- opcode: n,
23
- senderId: i,
24
- trackId: o,
25
- sequenceId: a,
26
- targetIds: w,
27
- payloadVersion: _,
28
- payloadType: E,
29
- flags: l
30
- };
31
- }
32
- async function p(e, r, t) {
33
- const s = K(e), n = Z(s);
34
- if (r !== void 0 && n.opcode !== r)
35
- throw new Error(`Unexpected opcode ${n.opcode}`);
36
- if (n.payloadType !== 8)
37
- throw new Error(`Unexpected payload type ${n.payloadType}`);
38
- const i = 27 + n.targetIds.length * 4;
39
- let o = s.subarray(i, n.length);
40
- return (n.flags & et.Compressed) !== 0 && (o = await rt(o)), o;
41
- }
42
- async function rt(e) {
43
- if (typeof DecompressionStream > "u")
44
- throw new Error("DecompressionStream not supported");
45
- const r = new DecompressionStream("gzip"), t = r.writable.getWriter(), s = new Uint8Array(e);
46
- t.write(s), t.close();
47
- const n = r.readable.getReader(), i = [];
48
- let o = 0;
49
- for (; ; ) {
50
- const { done: _, value: E } = await n.read();
51
- if (_) break;
52
- i.push(E), o += E.length;
53
- }
54
- const a = new Uint8Array(o);
55
- let I = 0;
56
- for (let _ = 0; _ < i.length; _++)
57
- a.set(i[_], I), I += i[_].length;
58
- return a;
59
- }
60
- var F = /* @__PURE__ */ ((e) => (e[e.Null = 1] = "Null", e[e.Bool = 2] = "Bool", e[e.Int32 = 3] = "Int32", e[e.Int64 = 4] = "Int64", e[e.UInt32 = 5] = "UInt32", e[e.UInt64 = 6] = "UInt64", e[e.Float32 = 7] = "Float32", e[e.Float64 = 8] = "Float64", e[e.Array = 9] = "Array", e[e.Dict = 10] = "Dict", e[e.Object = 11] = "Object", e[e.String = 12] = "String", e[e.Binary = 13] = "Binary", e[e.Guid = 14] = "Guid", e))(F || {});
61
- const st = 161, nt = 162;
62
- new TextEncoder();
63
- const it = new TextDecoder("utf-8", { fatal: !0 });
64
- class O {
65
- constructor(r, t, s) {
66
- this.buffer = r, this.version = t, this.offset = s, this.end = r.length - 1;
67
- }
68
- offset;
69
- end;
70
- static create(r) {
71
- const t = K(r);
72
- if (t.length < 2)
73
- throw new Error("Teleport payload too short");
74
- if (t[0] !== st || t[t.length - 1] !== nt)
75
- throw new Error("Teleport object missing markers");
76
- const s = { offset: 1 }, n = S(t, s, "InvalidLength");
77
- return new O(t, n, s.offset);
78
- }
79
- next() {
80
- if (this.offset >= this.end)
81
- return null;
82
- if (this.offset + 5 > this.buffer.length)
83
- throw new Error("Teleport object truncated");
84
- const r = It(this.buffer, this.offset);
85
- this.offset += 4;
86
- const t = this.buffer[this.offset++], s = t >> 4 & 15;
87
- if ((t & 15) !== 0)
88
- throw new Error("Teleport field flags must be zero");
89
- const n = b(s);
90
- let i;
91
- if (n >= 0)
92
- N(this.buffer, this.offset, n), i = this.buffer.subarray(this.offset, this.offset + n), this.offset += n;
93
- else {
94
- const o = { offset: this.offset }, a = S(this.buffer, o, "InvalidLength");
95
- N(this.buffer, o.offset, a), i = this.buffer.subarray(o.offset, o.offset + a), this.offset = o.offset + a;
96
- }
97
- return new ot(r, s, i);
98
- }
99
- }
100
- class L {
101
- constructor(r, t) {
102
- this.type = r, this.payload = t;
103
- }
104
- asInt32() {
105
- return this.ensureType(
106
- 3
107
- /* Int32 */
108
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getInt32(0, !0);
109
- }
110
- asUInt32() {
111
- return this.ensureType(
112
- 5
113
- /* UInt32 */
114
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getUint32(0, !0);
115
- }
116
- asInt64() {
117
- return this.ensureType(
118
- 4
119
- /* Int64 */
120
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigInt64(0, !0);
121
- }
122
- asUInt64() {
123
- return this.ensureType(
124
- 6
125
- /* UInt64 */
126
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getBigUint64(0, !0);
127
- }
128
- asFloat32() {
129
- return this.ensureType(
130
- 7
131
- /* Float32 */
132
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 4).getFloat32(0, !0);
133
- }
134
- asFloat64() {
135
- return this.ensureType(
136
- 8
137
- /* Float64 */
138
- ), new DataView(this.payload.buffer, this.payload.byteOffset, 8).getFloat64(0, !0);
139
- }
140
- asBool() {
141
- return this.ensureType(
142
- 2
143
- /* Bool */
144
- ), this.payload.length > 0 && this.payload[0] !== 0;
145
- }
146
- asBinary() {
147
- return this.ensureType(
148
- 13
149
- /* Binary */
150
- ), this.payload;
151
- }
152
- asUtf8() {
153
- return this.ensureType(
154
- 12
155
- /* String */
156
- ), this.payload;
157
- }
158
- asString() {
159
- return this.ensureType(
160
- 12
161
- /* String */
162
- ), it.decode(this.payload);
163
- }
164
- asGuid() {
165
- return this.ensureType(
166
- 14
167
- /* Guid */
168
- ), T.fromBytes(this.payload);
169
- }
170
- asObject() {
171
- return this.ensureType(
172
- 11
173
- /* Object */
174
- ), O.create(this.payload);
175
- }
176
- asArray() {
177
- return this.ensureType(
178
- 9
179
- /* Array */
180
- ), ee.create(this.payload);
181
- }
182
- asDictionary() {
183
- return this.ensureType(
184
- 10
185
- /* Dict */
186
- ), te.create(this.payload);
187
- }
188
- ensureType(r) {
189
- if (this.type !== r)
190
- throw new Error(`Teleport value has type ${F[this.type]}, expected ${F[r]}`);
191
- }
192
- }
193
- class ot extends L {
194
- constructor(r, t, s) {
195
- super(t, s), this.fieldId = r;
196
- }
197
- get isNull() {
198
- return this.type === 1;
199
- }
200
- }
201
- class ee {
202
- payload;
203
- elementType;
204
- count;
205
- offset;
206
- index = 0;
207
- constructor(r) {
208
- if (this.payload = r, r.length === 0)
209
- throw new Error("Array payload too short");
210
- const t = r[0];
211
- if (this.elementType = t >> 4 & 15, (t & 15) !== 0)
212
- throw new Error("Array flags must be zero");
213
- const s = { offset: 1 };
214
- this.count = S(r, s, "ArrayMalformed"), this.offset = s.offset;
215
- }
216
- static create(r) {
217
- return new ee(K(r));
218
- }
219
- next() {
220
- if (this.index >= this.count) {
221
- if (this.offset !== this.payload.length)
222
- throw new Error("Array payload contains trailing data");
223
- return null;
224
- }
225
- const r = this.readValue();
226
- return this.index++, r;
227
- }
228
- readValue() {
229
- switch (this.elementType) {
230
- case 3:
231
- case 5:
232
- case 7:
233
- case 8:
234
- case 2:
235
- case 4:
236
- case 6:
237
- case 14: {
238
- const r = b(this.elementType);
239
- N(this.payload, this.offset, r);
240
- const t = this.payload.subarray(this.offset, this.offset + r);
241
- return this.offset += r, new k(this.elementType, t);
242
- }
243
- case 12:
244
- case 13: {
245
- const r = { offset: this.offset }, t = S(this.payload, r, "ArrayMalformed");
246
- N(this.payload, r.offset, t);
247
- const s = this.payload.subarray(r.offset, r.offset + t);
248
- return this.offset = r.offset + t, new k(this.elementType, s);
249
- }
250
- case 11: {
251
- const r = { offset: this.offset }, t = S(this.payload, r, "ArrayMalformed");
252
- N(this.payload, r.offset, t);
253
- const s = this.payload.subarray(r.offset, r.offset + t);
254
- return this.offset = r.offset + t, new k(11, s);
255
- }
256
- case 9: {
257
- const r = re(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
258
- return this.offset += r, new k(9, t);
259
- }
260
- case 10: {
261
- const r = se(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
262
- return this.offset += r, new k(10, t);
263
- }
264
- default:
265
- throw new Error(`Unsupported array element type ${F[this.elementType]}`);
266
- }
267
- }
268
- }
269
- class k extends L {
270
- constructor(r, t) {
271
- super(r, t);
272
- }
273
- }
274
- class te {
275
- payload;
276
- keyType;
277
- valueType;
278
- count;
279
- offset;
280
- index = 0;
281
- constructor(r) {
282
- if (this.payload = r, r.length < 2)
283
- throw new Error("Dictionary payload too short");
284
- if (this.keyType = r[0] >> 4 & 15, this.valueType = r[1] >> 4 & 15, (r[0] & 15) !== 0 || (r[1] & 15) !== 0)
285
- throw new Error("Dictionary key/value flags must be zero");
286
- Ee(this.keyType);
287
- const t = { offset: 2 };
288
- this.count = S(r, t, "DictMalformed"), this.offset = t.offset;
289
- }
290
- static create(r) {
291
- return new te(K(r));
292
- }
293
- next() {
294
- if (this.index >= this.count) {
295
- if (this.offset !== this.payload.length)
296
- throw new Error("Dictionary payload contains trailing data");
297
- return null;
298
- }
299
- const r = this.readKey(), t = this.readValue();
300
- return this.index++, new at(r, t);
301
- }
302
- readKey() {
303
- const r = b(this.keyType);
304
- if (r >= 0) {
305
- N(this.payload, this.offset, r);
306
- const t = this.payload.subarray(this.offset, this.offset + r);
307
- return this.offset += r, new L(this.keyType, t);
308
- }
309
- if (this.keyType === 12 || this.keyType === 13) {
310
- const t = { offset: this.offset }, s = S(this.payload, t, "DictMalformed");
311
- N(this.payload, t.offset, s);
312
- const n = this.payload.subarray(t.offset, t.offset + s);
313
- return this.offset = t.offset + s, new L(this.keyType, n);
314
- }
315
- throw new Error("Unsupported dictionary key type");
316
- }
317
- readValue() {
318
- switch (this.valueType) {
319
- case 12:
320
- case 13: {
321
- const r = { offset: this.offset }, t = S(this.payload, r, "DictMalformed");
322
- N(this.payload, r.offset, t);
323
- const s = this.payload.subarray(r.offset, r.offset + t);
324
- return this.offset = r.offset + t, new L(this.valueType, s);
325
- }
326
- case 11: {
327
- const r = { offset: this.offset }, t = S(this.payload, r, "DictMalformed");
328
- N(this.payload, r.offset, t);
329
- const s = this.payload.subarray(r.offset, r.offset + t);
330
- return this.offset = r.offset + t, new L(11, s);
331
- }
332
- case 9: {
333
- const r = re(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
334
- return this.offset += r, new L(9, t);
335
- }
336
- case 10: {
337
- const r = se(this.payload, this.offset), t = this.payload.subarray(this.offset, this.offset + r);
338
- return this.offset += r, new L(10, t);
339
- }
340
- case 3:
341
- case 5:
342
- case 7:
343
- case 8:
344
- case 2:
345
- case 4:
346
- case 6:
347
- case 14:
348
- case 1: {
349
- const r = b(this.valueType);
350
- N(this.payload, this.offset, r);
351
- const t = this.payload.subarray(this.offset, this.offset + r);
352
- return this.offset += r, new L(this.valueType, t);
353
- }
354
- default:
355
- throw new Error(`Unsupported dictionary value type ${F[this.valueType]}`);
356
- }
357
- }
358
- }
359
- class at {
360
- constructor(r, t) {
361
- this.key = r, this.value = t;
362
- }
363
- }
364
- class T {
365
- constructor(r) {
366
- this.bytes = r;
367
- }
368
- static fromString(r) {
369
- if (!r)
370
- throw new Error("Guid string is empty");
371
- const t = r.replace(/-/g, "");
372
- if (t.length !== 32)
373
- throw new Error("Guid string must be 32 hex characters");
374
- const s = new Uint8Array(16), n = T.parseHexSlice(t, 0, 8), i = T.parseHexSlice(t, 8, 4), o = T.parseHexSlice(t, 12, 4);
375
- T.writeUInt32LE(s, 0, n), T.writeUInt16LE(s, 4, i), T.writeUInt16LE(s, 6, o);
376
- for (let a = 0; a < 8; a++)
377
- s[8 + a] = T.parseHexSlice(t, 16 + a * 2, 2);
378
- return new T(s);
379
- }
380
- static fromBytes(r) {
381
- if (r.length !== 16)
382
- throw new Error("Guid byte array must be 16 bytes");
383
- return new T(Uint8Array.from(r));
384
- }
385
- static createZero() {
386
- return new T(new Uint8Array(16));
387
- }
388
- static createRandom() {
389
- const r = new Uint8Array(16), t = globalThis.crypto;
390
- if (t?.getRandomValues)
391
- t.getRandomValues(r);
392
- else
393
- for (let s = 0; s < r.length; s++)
394
- r[s] = Math.floor(Math.random() * 256);
395
- return r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, new T(r);
396
- }
397
- toString() {
398
- const r = this.bytes;
399
- return [
400
- T.toHex(T.readUInt32LE(r, 0), 8),
401
- T.toHex(T.readUInt16LE(r, 4), 4),
402
- T.toHex(T.readUInt16LE(r, 6), 4),
403
- ie(r.subarray(8, 10)),
404
- ie(r.subarray(10, 16))
405
- ].join("-");
406
- }
407
- asBytes() {
408
- return this.bytes.slice();
409
- }
410
- static parseHexSlice(r, t, s) {
411
- const n = r.substr(t, s), i = Number.parseInt(n, 16);
412
- if (Number.isNaN(i))
413
- throw new Error("Guid string contains invalid characters");
414
- return i >>> 0;
415
- }
416
- static writeUInt32LE(r, t, s) {
417
- const n = s >>> 0;
418
- r[t] = n & 255, r[t + 1] = n >>> 8 & 255, r[t + 2] = n >>> 16 & 255, r[t + 3] = n >>> 24 & 255;
419
- }
420
- static writeUInt16LE(r, t, s) {
421
- const n = s & 65535;
422
- r[t] = n & 255, r[t + 1] = n >>> 8 & 255;
423
- }
424
- static readUInt32LE(r, t) {
425
- return (r[t] | r[t + 1] << 8 | r[t + 2] << 16 | r[t + 3] << 24) >>> 0;
426
- }
427
- static readUInt16LE(r, t) {
428
- return (r[t] | r[t + 1] << 8) & 65535;
429
- }
430
- static toHex(r, t) {
431
- return (r >>> 0).toString(16).padStart(t, "0");
432
- }
433
- }
434
- function S(e, r, t) {
435
- if (r.offset >= e.length)
436
- throw new Error(t);
437
- let s = 0, n = 0, i = 0;
438
- for (; r.offset < e.length; ) {
439
- const o = e[r.offset++];
440
- if (i++, s |= (o & 127) << n, (o & 128) === 0) {
441
- if (i !== Et(s))
442
- throw new Error("Teleport VarUInt is not canonical");
443
- return s >>> 0;
444
- }
445
- if (n += 7, n >= 35)
446
- throw new Error("Teleport VarUInt exceeds 32-bit range");
447
- }
448
- throw new Error(t);
449
- }
450
- function Et(e) {
451
- return e < 128 ? 1 : e < 16384 ? 2 : e < 2097152 ? 3 : e < 268435456 ? 4 : 5;
452
- }
453
- function b(e) {
454
- switch (e) {
455
- case 3:
456
- case 5:
457
- case 7:
458
- return 4;
459
- case 4:
460
- case 6:
461
- case 8:
462
- return 8;
463
- case 14:
464
- return 16;
465
- case 2:
466
- return 1;
467
- case 1:
468
- return 0;
469
- default:
470
- return -1;
471
- }
472
- }
473
- function Ee(e) {
474
- if (e === 9 || e === 11 || e === 10 || e === 1)
475
- throw new Error("Dictionary keys must be primitive Teleport types");
476
- }
477
- function N(e, r, t) {
478
- if (r < 0 || t < 0 || r + t > e.length)
479
- throw new Error("Teleport payload exceeds bounds");
480
- }
481
- function It(e, r) {
482
- return (e[r] | e[r + 1] << 8 | e[r + 2] << 16 | e[r + 3] << 24) >>> 0;
483
- }
484
- function re(e, r) {
485
- if (r >= e.length)
486
- throw new Error("Array payload exceeds bounds");
487
- const t = e[r], s = t >> 4 & 15;
488
- if ((t & 15) !== 0)
489
- throw new Error("Array flags must be zero");
490
- const n = { offset: r + 1 }, i = S(e, n, "ArrayMalformed"), o = b(s);
491
- if (o >= 0) {
492
- const I = o * i;
493
- return N(e, n.offset, I), n.offset + I - r;
494
- }
495
- let a = n.offset;
496
- for (let I = 0; I < i; I++)
497
- a = Q(s, e, a, "ArrayMalformed");
498
- return a - r;
499
- }
500
- function se(e, r) {
501
- if (r + 2 > e.length)
502
- throw new Error("Dictionary payload too short");
503
- const t = e[r] >> 4 & 15, s = e[r + 1] >> 4 & 15;
504
- if ((e[r] & 15) !== 0 || (e[r + 1] & 15) !== 0)
505
- throw new Error("Dictionary key/value flags must be zero");
506
- Ee(t);
507
- const n = { offset: r + 2 }, i = S(e, n, "DictMalformed");
508
- let o = n.offset;
509
- for (let a = 0; a < i; a++)
510
- o = Q(t, e, o, "DictMalformed"), o = Q(s, e, o, "DictMalformed");
511
- return o - r;
512
- }
513
- function Q(e, r, t, s) {
514
- const n = b(e);
515
- if (n >= 0)
516
- return N(r, t, n), t + n;
517
- switch (e) {
518
- case 12:
519
- case 13: {
520
- const i = { offset: t }, o = S(r, i, s);
521
- return N(r, i.offset, o), i.offset + o;
522
- }
523
- case 11: {
524
- const i = { offset: t }, o = S(r, i, s);
525
- return N(r, i.offset, o), i.offset + o;
526
- }
527
- case 9:
528
- return t + re(r, t);
529
- case 10:
530
- return t + se(r, t);
531
- default:
532
- throw new Error(`Unsupported Teleport type ${F[e]}`);
533
- }
534
- }
535
- function ie(e) {
536
- return Array.from(e).map((r) => r.toString(16).padStart(2, "0")).join("");
537
- }
538
- function K(e) {
539
- return e instanceof Uint8Array ? e : new Uint8Array(e);
540
- }
541
- var Ie = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Opus = 1] = "Opus", e[e.Mp3 = 2] = "Mp3", e[e.RawPcm16 = 3] = "RawPcm16", e))(Ie || {}), _e = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.MobileWeb = 1] = "MobileWeb", e[e.MobileApp = 2] = "MobileApp", e[e.DesktopWeb = 3] = "DesktopWeb", e[e.DesktopApp = 4] = "DesktopApp", e))(_e || {}), le = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Backend = 2] = "Backend", e[e.Server = 4] = "Server", e[e.Plugin = 8] = "Plugin", e[e.Browser = 16] = "Browser", e))(le || {}), ce = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.MessagePack = 1] = "MessagePack", e[e.MemoryPack = 2] = "MemoryPack", e[e.Json = 4] = "Json", e[e.Teleport = 8] = "Teleport", e[e.All = 15] = "All", e))(ce || {}), fe = /* @__PURE__ */ ((e) => (e[e.Face = 0] = "Face", e[e.Hands = 1] = "Hands", e[e.Pose = 2] = "Pose", e[e.All = 3] = "All", e))(fe || {}), ue = /* @__PURE__ */ ((e) => (e[e.Css = 0] = "Css", e[e.Flutter = 1] = "Flutter", e))(ue || {}), Te = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.Machine = 1] = "Machine", e[e.Human = 2] = "Human", e))(Te || {}), he = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.H264 = 1] = "H264", e[e.Vp8 = 2] = "Vp8", e[e.Vp9 = 3] = "Vp9", e[e.Av1 = 4] = "Av1", e))(he || {}), Ae = /* @__PURE__ */ ((e) => (e[e.Unknown = 0] = "Unknown", e[e.DotNet = 1] = "DotNet", e[e.TypeScript = 2] = "TypeScript", e[e.Cpp = 3] = "Cpp", e[e.Dart = 4] = "Dart", e[e.Rust = 5] = "Rust", e))(Ae || {}), Ne = /* @__PURE__ */ ((e) => (e[e.Local = 0] = "Local", e[e.Cloud = 1] = "Cloud", e))(Ne || {}), Se = /* @__PURE__ */ ((e) => (e[e.Bundle = 0] = "Bundle", e[e.GitSource = 1] = "GitSource", e))(Se || {}), m = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.CONSTANT_GROUP_BITS = 15] = "CONSTANT_GROUP_BITS", e[e.CONSTANT_GROUP_OFFSET = 16] = "CONSTANT_GROUP_OFFSET", e[e.GROUP_CORE = 65536] = "GROUP_CORE", e[e.CORE_AUTH_RESPONSE = 65537] = "CORE_AUTH_RESPONSE", e[e.CORE_AUTH_TICKET = 65538] = "CORE_AUTH_TICKET", e[e.CORE_GLOBAL_STATE = 65539] = "CORE_GLOBAL_STATE", e[e.CORE_ON_SERVER_STATUS_PING = 65540] = "CORE_ON_SERVER_STATUS_PING", e[e.CORE_ON_USER_JOINED = 65541] = "CORE_ON_USER_JOINED", e[e.CORE_ON_USER_LEFT = 65542] = "CORE_ON_USER_LEFT", e[e.CORE_ON_CLIENT_JOINED = 65543] = "CORE_ON_CLIENT_JOINED", e[e.CORE_ON_CLIENT_LEFT = 65544] = "CORE_ON_CLIENT_LEFT", e[e.CORE_ON_SERVER_STARTED = 65545] = "CORE_ON_SERVER_STARTED", e[e.CORE_ON_SERVER_STOPPED = 65546] = "CORE_ON_SERVER_STOPPED", e[e.CORE_ON_SERVER_STOPPING = 65547] = "CORE_ON_SERVER_STOPPING", e[e.CORE_ON_CLIENT_READY = 65548] = "CORE_ON_CLIENT_READY", e[e.CORE_CLIENT_READY = 65549] = "CORE_CLIENT_READY", e[e.CORE_SERVER_INIT = 65550] = "CORE_SERVER_INIT", e[e.CORE_ON_PLUGIN_RELOADED = 65551] = "CORE_ON_PLUGIN_RELOADED", e[e.CORE_SERVER_START = 65552] = "CORE_SERVER_START", e[e.CORE_SERVER_STOP = 65553] = "CORE_SERVER_STOP", e[e.CORE_ON_HOSTED_SERVER_EXIT = 65554] = "CORE_ON_HOSTED_SERVER_EXIT", e[e.CORE_DYNAMIC_CONFIG = 65555] = "CORE_DYNAMIC_CONFIG", e[e.CORE_PROXY_RPC_AUTH_TICKET = 65556] = "CORE_PROXY_RPC_AUTH_TICKET", e[e.CORE_SERVER_INIT2 = 65557] = "CORE_SERVER_INIT2", e[e.CORE_UPDATE_CLIENT_CONTEXT = 65558] = "CORE_UPDATE_CLIENT_CONTEXT", e[e.CORE_BACKGROUND_WORK_ACTIVE = 65559] = "CORE_BACKGROUND_WORK_ACTIVE", e[e.CORE_RESET_IDLE = 65560] = "CORE_RESET_IDLE", e[e.CORE_CLIENT_DISCONNECTING = 65561] = "CORE_CLIENT_DISCONNECTING", e[e.CORE_WEBRTC_OFFER = 65566] = "CORE_WEBRTC_OFFER", e[e.CORE_WEBRTC_ANSWER = 65567] = "CORE_WEBRTC_ANSWER", e[e.CORE_WEBRTC_ICE_CANDIDATE = 65568] = "CORE_WEBRTC_ICE_CANDIDATE", e[e.CORE_WEBRTC_READY = 65569] = "CORE_WEBRTC_READY", e[e.CORE_WEBRTC_AUDIO_SEGMENT = 65570] = "CORE_WEBRTC_AUDIO_SEGMENT", e[e.CORE_WEBRTC_TRACK_MAP = 65571] = "CORE_WEBRTC_TRACK_MAP", e[e.CORE_WEBRTC_VIDEO_CAPTURE = 65572] = "CORE_WEBRTC_VIDEO_CAPTURE", e[e.CORE_RELAY_AGENT_AUTH = 65576] = "CORE_RELAY_AGENT_AUTH", e[e.CORE_RELAY_AGENT_AUTH_RESULT = 65577] = "CORE_RELAY_AGENT_AUTH_RESULT", e[e.CORE_RELAY_HEARTBEAT = 65578] = "CORE_RELAY_HEARTBEAT", e[e.CORE_RELAY_TCP_CONNECTION_OPENED = 65579] = "CORE_RELAY_TCP_CONNECTION_OPENED", e[e.CORE_RELAY_TCP_CONNECTION_CLOSED = 65580] = "CORE_RELAY_TCP_CONNECTION_CLOSED", e[e.CORE_RELAY_TCP_DATA = 65581] = "CORE_RELAY_TCP_DATA", e[e.CORE_RELAY_UDP_DATA = 65582] = "CORE_RELAY_UDP_DATA", e[e.CORE_RELAY_ADD_TUNNEL = 65583] = "CORE_RELAY_ADD_TUNNEL", e[e.CORE_RELAY_TUNNEL_ADDED = 65584] = "CORE_RELAY_TUNNEL_ADDED", e[e.CORE_RELAY_REMOVE_TUNNEL = 65585] = "CORE_RELAY_REMOVE_TUNNEL", e[e.CORE_IKON_SERVER_ENDPOINT_HOST_INFO = 65586] = "CORE_IKON_SERVER_ENDPOINT_HOST_INFO", e[e.CORE_CLIENT_INITIALIZATION = 65587] = "CORE_CLIENT_INITIALIZATION", e[e.CORE_CLIENT_LIFECYCLE_BATCH = 65588] = "CORE_CLIENT_LIFECYCLE_BATCH", e[e.CORE_APP_CONFIG = 65589] = "CORE_APP_CONFIG", e[e.GROUP_KEEPALIVE = 131072] = "GROUP_KEEPALIVE", e[e.KEEPALIVE_REQUEST = 131073] = "KEEPALIVE_REQUEST", e[e.KEEPALIVE_RESPONSE = 131074] = "KEEPALIVE_RESPONSE", e[e.GROUP_EVENTS = 262144] = "GROUP_EVENTS", e[e.EVENTS_PROFILE_UPDATE = 262145] = "EVENTS_PROFILE_UPDATE", e[e.EVENTS_CHANNEL_COMPLETE = 262146] = "EVENTS_CHANNEL_COMPLETE", e[e.EVENTS_SPEECH_PLAYBACK_COMPLETE = 262147] = "EVENTS_SPEECH_PLAYBACK_COMPLETE", e[e.GROUP_ANALYTICS = 524288] = "GROUP_ANALYTICS", e[e.ANALYTICS_LOGS = 524289] = "ANALYTICS_LOGS", e[e.ANALYTICS_EVENTS = 524290] = "ANALYTICS_EVENTS", e[e.ANALYTICS_USAGES = 524291] = "ANALYTICS_USAGES", e[e.ANALYTICS_USAGE = 524292] = "ANALYTICS_USAGE", e[e.ANALYTICS_SPECIAL_LOG = 524293] = "ANALYTICS_SPECIAL_LOG", e[e.ANALYTICS_PROCESSING_UPDATE = 524294] = "ANALYTICS_PROCESSING_UPDATE", e[e.ANALYTICS_REACTIVE_PROCESSING_UPDATE = 524295] = "ANALYTICS_REACTIVE_PROCESSING_UPDATE", e[e.ANALYTICS_IKON_PROXY_SERVER_STATS = 524296] = "ANALYTICS_IKON_PROXY_SERVER_STATS", e[e.ANALYTICS_IKON_RELAY_SERVER_STATS = 524297] = "ANALYTICS_IKON_RELAY_SERVER_STATS", e[e.ANALYTICS_IKON_TURN_SERVER_STATS = 524298] = "ANALYTICS_IKON_TURN_SERVER_STATS", e[e.GROUP_ACTIONS = 1048576] = "GROUP_ACTIONS", e[e.ACTION_CALL = 1048577] = "ACTION_CALL", e[e.ACTION_ACTIVE = 1048578] = "ACTION_ACTIVE", e[e.ACTION_TEXT_OUTPUT = 1048579] = "ACTION_TEXT_OUTPUT", e[e.ACTION_TEXT_OUTPUT_DELTA = 1048580] = "ACTION_TEXT_OUTPUT_DELTA", e[e.ACTION_TEXT_OUTPUT_DELTA_FULL = 1048581] = "ACTION_TEXT_OUTPUT_DELTA_FULL", e[e.ACTION_SET_STATE = 1048582] = "ACTION_SET_STATE", e[e.ACTION_TAP = 1048583] = "ACTION_TAP", e[e.ACTION_PAN = 1048584] = "ACTION_PAN", e[e.ACTION_ZOOM = 1048585] = "ACTION_ZOOM", e[e.ACTION_FILE_UPLOAD_BEGIN = 1048586] = "ACTION_FILE_UPLOAD_BEGIN", e[e.ACTION_FILE_UPLOAD_DATA = 1048587] = "ACTION_FILE_UPLOAD_DATA", e[e.ACTION_FILE_UPLOAD_ACK = 1048588] = "ACTION_FILE_UPLOAD_ACK", e[e.ACTION_FILE_UPLOAD_END = 1048589] = "ACTION_FILE_UPLOAD_END", e[e.ACTION_FILE_UPLOAD_RESULT = 1048590] = "ACTION_FILE_UPLOAD_RESULT", e[e.ACTION_OPEN_CHANNEL = 1048591] = "ACTION_OPEN_CHANNEL", e[e.ACTION_OPEN_EXTERNAL_URL = 1048592] = "ACTION_OPEN_EXTERNAL_URL", e[e.ACTION_UI_OPEN_VIEW = 1048593] = "ACTION_UI_OPEN_VIEW", e[e.ACTION_UI_CLOSE_VIEW = 1048594] = "ACTION_UI_CLOSE_VIEW", e[e.ACTION_UI_BLOCKING_BEGIN = 1048595] = "ACTION_UI_BLOCKING_BEGIN", e[e.ACTION_UI_BLOCKING_END = 1048596] = "ACTION_UI_BLOCKING_END", e[e.ACTION_UI_UPDATE_TEXT_DELTA = 1048597] = "ACTION_UI_UPDATE_TEXT_DELTA", e[e.ACTION_UI_DELETE_CONTAINER = 1048598] = "ACTION_UI_DELETE_CONTAINER", e[e.ACTION_UPDATE_GFX_SHADER = 1048599] = "ACTION_UPDATE_GFX_SHADER", e[e.ACTION_FUNCTION_REGISTER = 1048600] = "ACTION_FUNCTION_REGISTER", e[e.ACTION_FUNCTION_CALL = 1048601] = "ACTION_FUNCTION_CALL", e[e.ACTION_FUNCTION_RESULT = 1048602] = "ACTION_FUNCTION_RESULT", e[e.ACTION_GENERATE_ANSWER = 1048603] = "ACTION_GENERATE_ANSWER", e[e.ACTION_REGENERATE_ANSWER = 1048604] = "ACTION_REGENERATE_ANSWER", e[e.ACTION_CLEAR_CHAT_MESSAGE_HISTORY = 1048605] = "ACTION_CLEAR_CHAT_MESSAGE_HISTORY", e[e.ACTION_CLEAR_STATE = 1048606] = "ACTION_CLEAR_STATE", e[e.ACTION_RELOAD_CHANNELS = 1048607] = "ACTION_RELOAD_CHANNELS", e[e.ACTION_RELOAD_PROFILE = 1048608] = "ACTION_RELOAD_PROFILE", e[e.ACTION_CLASSIFICATION_RESULT = 1048609] = "ACTION_CLASSIFICATION_RESULT", e[e.ACTION_AUDIO_STOP = 1048610] = "ACTION_AUDIO_STOP", e[e.ACTION_CALL_TEXT = 1048611] = "ACTION_CALL_TEXT", e[e.ACTION_RELOAD_APPLICATION = 1048612] = "ACTION_RELOAD_APPLICATION", e[e.ACTION_CANCEL_GENERATION = 1048613] = "ACTION_CANCEL_GENERATION", e[e.ACTION_UI_SET_CONTAINER_STABLE = 1048614] = "ACTION_UI_SET_CONTAINER_STABLE", e[e.ACTION_SPEECH_RECOGNIZED = 1048615] = "ACTION_SPEECH_RECOGNIZED", e[e.ACTION_CALL_RESULT = 1048616] = "ACTION_CALL_RESULT", e[e.ACTION_RELOAD_PROVIDER = 1048617] = "ACTION_RELOAD_PROVIDER", e[e.ACTION_DOWNLOAD = 1048618] = "ACTION_DOWNLOAD", e[e.ACTION_SCROLL_TO_CONTAINER = 1048619] = "ACTION_SCROLL_TO_CONTAINER", e[e.ACTION_UI_CLEAR_STREAM = 1048620] = "ACTION_UI_CLEAR_STREAM", e[e.ACTION_PLAY_SOUND = 1048621] = "ACTION_PLAY_SOUND", e[e.ACTION_ENTER_FULLSCREEN = 1048622] = "ACTION_ENTER_FULLSCREEN", e[e.ACTION_STOP_SOUND = 1048623] = "ACTION_STOP_SOUND", e[e.ACTION_START_RECORDING = 1048624] = "ACTION_START_RECORDING", e[e.ACTION_STOP_RECORDING = 1048625] = "ACTION_STOP_RECORDING", e[e.ACTION_FUNCTION_ENUMERATION_ITEM = 1048627] = "ACTION_FUNCTION_ENUMERATION_ITEM", e[e.ACTION_FUNCTION_ENUMERATION_END = 1048628] = "ACTION_FUNCTION_ENUMERATION_END", e[e.ACTION_FUNCTION_CANCEL = 1048629] = "ACTION_FUNCTION_CANCEL", e[e.ACTION_FUNCTION_DISPOSE = 1048630] = "ACTION_FUNCTION_DISPOSE", e[e.ACTION_FUNCTION_ERROR = 1048631] = "ACTION_FUNCTION_ERROR", e[e.ACTION_FUNCTION_ACK = 1048632] = "ACTION_FUNCTION_ACK", e[e.ACTION_FUNCTION_AWAITING_APPROVAL = 1048633] = "ACTION_FUNCTION_AWAITING_APPROVAL", e[e.ACTION_FUNCTION_APPROVAL_REQUIRED = 1048634] = "ACTION_FUNCTION_APPROVAL_REQUIRED", e[e.ACTION_FUNCTION_APPROVAL_RESPONSE = 1048635] = "ACTION_FUNCTION_APPROVAL_RESPONSE", e[e.UI_UPDATE_ACK = 1048636] = "UI_UPDATE_ACK", e[e.ACTION_CALL2 = 1048637] = "ACTION_CALL2", e[e.ACTION_FUNCTION_REGISTER_BATCH = 1048638] = "ACTION_FUNCTION_REGISTER_BATCH", e[e.ACTION_TRIGGER_GIT_PULL = 1048639] = "ACTION_TRIGGER_GIT_PULL", e[e.ACTION_FILE_UPLOAD_CALLBACK = 1048640] = "ACTION_FILE_UPLOAD_CALLBACK", e[e.ACTION_CUSTOM_USER_MESSAGE = 1048641] = "ACTION_CUSTOM_USER_MESSAGE", e[e.ACTION_URL_CHANGED = 1048642] = "ACTION_URL_CHANGED", e[e.ACTION_FILE_UPLOAD_PRE_START2 = 1048643] = "ACTION_FILE_UPLOAD_PRE_START2", e[e.ACTION_FILE_UPLOAD_PRE_START_RESPONSE2 = 1048644] = "ACTION_FILE_UPLOAD_PRE_START_RESPONSE2", e[e.ACTION_FILE_UPLOAD_START2 = 1048645] = "ACTION_FILE_UPLOAD_START2", e[e.ACTION_FILE_UPLOAD_START_RESPONSE2 = 1048646] = "ACTION_FILE_UPLOAD_START_RESPONSE2", e[e.ACTION_FILE_UPLOAD_DATA2 = 1048647] = "ACTION_FILE_UPLOAD_DATA2", e[e.ACTION_FILE_UPLOAD_ACK2 = 1048648] = "ACTION_FILE_UPLOAD_ACK2", e[e.ACTION_FILE_UPLOAD_END2 = 1048649] = "ACTION_FILE_UPLOAD_END2", e[e.ACTION_FILE_UPLOAD_COMPLETE2 = 1048650] = "ACTION_FILE_UPLOAD_COMPLETE2", e[e.ACTION_FUNCTION_ENUMERATION_ITEM_BATCH = 1048651] = "ACTION_FUNCTION_ENUMERATION_ITEM_BATCH", e[e.ACTION_CALL_ACK = 1048652] = "ACTION_CALL_ACK", e[e.ACTION_TRIGGER_CRON = 1048653] = "ACTION_TRIGGER_CRON", e[e.GROUP_UI = 2097152] = "GROUP_UI", e[e.UI_STREAM_BEGIN = 2097153] = "UI_STREAM_BEGIN", e[e.UI_STREAM_END = 2097154] = "UI_STREAM_END", e[e.UI_CONTAINER_BEGIN = 2097155] = "UI_CONTAINER_BEGIN", e[e.UI_CONTAINER_END = 2097156] = "UI_CONTAINER_END", e[e.UI_SECTION_BEGIN = 2097157] = "UI_SECTION_BEGIN", e[e.UI_SECTION_END = 2097158] = "UI_SECTION_END", e[e.UI_LIST_BEGIN = 2097159] = "UI_LIST_BEGIN", e[e.UI_LIST_ITEM = 2097160] = "UI_LIST_ITEM", e[e.UI_LIST_END = 2097161] = "UI_LIST_END", e[e.UI_TEXT = 2097162] = "UI_TEXT", e[e.UI_HEADER = 2097163] = "UI_HEADER", e[e.UI_SEPARATOR = 2097164] = "UI_SEPARATOR", e[e.UI_BUTTON = 2097165] = "UI_BUTTON", e[e.UI_ICON_BUTTON = 2097166] = "UI_ICON_BUTTON", e[e.UI_IMAGE = 2097167] = "UI_IMAGE", e[e.UI_FILE = 2097168] = "UI_FILE", e[e.UI_BADGE = 2097169] = "UI_BADGE", e[e.UI_CONTENT_LINK = 2097170] = "UI_CONTENT_LINK", e[e.UI_MAP = 2097171] = "UI_MAP", e[e.UI_VEGA_CHART = 2097172] = "UI_VEGA_CHART", e[e.UI_ICON = 2097173] = "UI_ICON", e[e.UI_FILE_UPLOAD_SECTION_BEGIN = 2097174] = "UI_FILE_UPLOAD_SECTION_BEGIN", e[e.UI_FILE_UPLOAD_SECTION_END = 2097175] = "UI_FILE_UPLOAD_SECTION_END", e[e.UI_MATERIAL_SYMBOL = 2097176] = "UI_MATERIAL_SYMBOL", e[e.UI_BUTTON_BEGIN = 2097177] = "UI_BUTTON_BEGIN", e[e.UI_BUTTON_END = 2097178] = "UI_BUTTON_END", e[e.UI_CONTAINER_DELETE = 2097179] = "UI_CONTAINER_DELETE", e[e.UI_INPUT_TEXT = 2097180] = "UI_INPUT_TEXT", e[e.UI_PROGRESS_BAR = 2097181] = "UI_PROGRESS_BAR", e[e.UI_UPDATE_BEGIN = 2097182] = "UI_UPDATE_BEGIN", e[e.UI_UPDATE_END = 2097183] = "UI_UPDATE_END", e[e.UI_AUTOCOMPLETE = 2097184] = "UI_AUTOCOMPLETE", e[e.UI_CHECKBOX = 2097185] = "UI_CHECKBOX", e[e.UI_QS = 2097186] = "UI_QS", e[e.UI_ELEMENT = 2097187] = "UI_ELEMENT", e[e.UI_STYLES = 2097188] = "UI_STYLES", e[e.UI_SVG = 2097189] = "UI_SVG", e[e.UI_UPDATE = 2097190] = "UI_UPDATE", e[e.UI_INIT = 2097191] = "UI_INIT", e[e.UI_STYLES_BATCH = 2097192] = "UI_STYLES_BATCH", e[e.UI_STYLES_DELETE = 2097193] = "UI_STYLES_DELETE", e[e.GROUP_COMMON = 4128768] = "GROUP_COMMON", e[e.GROUP_AUDIO = 4194304] = "GROUP_AUDIO", e[e.AUDIO_STREAM_BEGIN = 4194305] = "AUDIO_STREAM_BEGIN", e[e.AUDIO_STREAM_END = 4194306] = "AUDIO_STREAM_END", e[e.AUDIO_FRAME = 4194307] = "AUDIO_FRAME", e[e.AUDIO_FRAME_VOLUME = 4194308] = "AUDIO_FRAME_VOLUME", e[e.AUDIO_FRAME2 = 4194309] = "AUDIO_FRAME2", e[e.AUDIO_SHAPE_FRAME = 4194310] = "AUDIO_SHAPE_FRAME", e[e.GROUP_VIDEO = 8388608] = "GROUP_VIDEO", e[e.VIDEO_STREAM_BEGIN = 8388609] = "VIDEO_STREAM_BEGIN", e[e.VIDEO_STREAM_END = 8388610] = "VIDEO_STREAM_END", e[e.VIDEO_FRAME = 8388611] = "VIDEO_FRAME", e[e.VIDEO_REQUEST_IDR_FRAME = 8388612] = "VIDEO_REQUEST_IDR_FRAME", e[e.VIDEO_INVALIDATE_FRAME = 8388613] = "VIDEO_INVALIDATE_FRAME", e[e.GROUP_TRACKING = 16777216] = "GROUP_TRACKING", e[e.TRACKING_STREAM_BEGIN = 16777217] = "TRACKING_STREAM_BEGIN", e[e.TRACKING_STREAM_END = 16777218] = "TRACKING_STREAM_END", e[e.TRACKING_FRAME = 16777219] = "TRACKING_FRAME", e[e.GROUP_SCENE = 33554432] = "GROUP_SCENE", e[e.SCENE_MESH = 33554433] = "SCENE_MESH", e[e.SCENE_ARRAY = 33554434] = "SCENE_ARRAY", e[e.GROUP_ALL = 67043328] = "GROUP_ALL", e[e.GROUP_APP_LOCAL = 1073741824] = "GROUP_APP_LOCAL", e[e.CONSTANT_GROUP_MASK = 2147418112] = "CONSTANT_GROUP_MASK", e))(m || {});
542
- const _t = 161083277, lt = 265814330, ct = 1368629611, ft = 2431514951, ut = 2514959030, Tt = 2745379226, ht = 3282782683, At = 3284746250, Nt = 4101844078;
543
- function Ce(e) {
544
- const r = {};
545
- return De(r), r;
546
- }
547
- function De(e) {
548
- return e.StreamId = "", e.Description = "", e.SourceType = "", e.Codec = Ie.Unknown, e.CodecDetails = "", e.SampleRate = 0, e.Channels = 0, e.ShapeSets = void 0, e.CorrelationId = void 0, e;
549
- }
550
- function St(e, r) {
551
- const t = r ?? Ce();
552
- return De(t), Ct(e, t), t;
553
- }
554
- function Ct(e, r) {
555
- let t;
556
- for (; (t = e.next()) !== null; )
557
- switch (t.fieldId) {
558
- case _t: {
559
- if (t.isNull) throw new Error();
560
- r.StreamId = t.asString();
561
- break;
562
- }
563
- case lt: {
564
- if (t.isNull) {
565
- r.ShapeSets = void 0;
566
- break;
567
- }
568
- r.ShapeSets = Dt(t.asArray());
569
- break;
570
- }
571
- case ct: {
572
- if (t.isNull) throw new Error();
573
- r.Description = t.asString();
574
- break;
575
- }
576
- case ft: {
577
- if (t.isNull) throw new Error();
578
- r.Channels = t.asInt32();
579
- break;
580
- }
581
- case ut: {
582
- if (t.isNull) {
583
- r.CorrelationId = void 0;
584
- break;
585
- }
586
- r.CorrelationId = t.asString();
587
- break;
588
- }
589
- case Tt: {
590
- if (t.isNull) throw new Error();
591
- r.CodecDetails = t.asString();
592
- break;
593
- }
594
- case ht: {
595
- if (t.isNull) throw new Error();
596
- r.SourceType = t.asString();
597
- break;
598
- }
599
- case At: {
600
- if (t.isNull) throw new Error();
601
- r.Codec = t.asInt32();
602
- break;
603
- }
604
- case Nt: {
605
- if (t.isNull) throw new Error();
606
- r.SampleRate = t.asInt32();
607
- break;
608
- }
609
- }
610
- }
611
- function Dt(e) {
612
- const r = [];
613
- let t;
614
- for (; (t = e.next()) !== null; )
615
- r.push(yt(t.asObject()));
616
- return r;
617
- }
618
- const Rt = 1107713536, dt = 1154362099, wt = 1185721362;
619
- function Lt(e) {
620
- const r = {};
621
- return Re(r), r;
622
- }
623
- function Re(e) {
624
- return e.SetId = 0, e.Name = "", e.ShapeNames = [], e;
625
- }
626
- function yt(e, r) {
627
- const t = r ?? Lt();
628
- return Re(t), Ut(e, t), t;
629
- }
630
- function Ut(e, r) {
631
- let t;
632
- for (; (t = e.next()) !== null; )
633
- switch (t.fieldId) {
634
- case Rt: {
635
- if (t.isNull) throw new Error();
636
- r.Name = t.asString();
637
- break;
638
- }
639
- case dt: {
640
- if (t.isNull) throw new Error();
641
- r.SetId = t.asUInt32();
642
- break;
643
- }
644
- case wt: {
645
- if (t.isNull) throw new Error();
646
- r.ShapeNames = Ot(t.asArray());
647
- break;
648
- }
649
- }
650
- }
651
- function Ot(e) {
652
- const r = [];
653
- let t;
654
- for (; (t = e.next()) !== null; )
655
- r.push(t.asString());
656
- return r;
657
- }
658
- const mt = 76337612, Pt = 185396121, gt = 250031587, Ft = 388632637, bt = 417197284, Mt = 425972532, vt = 469070965, kt = 470595159, Gt = 594855258, Bt = 617065367, Vt = 661691032, xt = 781727218, Ht = 834078886, Yt = 1043273762, pt = 1236999138, Kt = 1286979607, $t = 1368629611, Xt = 1437068682, jt = 1715899485, Wt = 1942830531, zt = 1999510636, Jt = 2033288346, Qt = 2079864626, qt = 2142346422, Zt = 2228539873, er = 2232517119, tr = 2598291686, rr = 2719718823, sr = 2810953526, nr = 2840065720, ir = 2885165957, or = 3542818975, ar = 3586157513, Er = 3717933110, Ir = 4062655306;
659
- function _r(e) {
660
- const r = {};
661
- return de(r), r;
662
- }
663
- function de(e) {
664
- return e.ContextType = le.Unknown, e.UserType = Te.Unknown, e.PayloadType = ce.Unknown, e.Description = "", e.UserId = "", e.DeviceId = "", e.ProductId = "", e.VersionId = "", e.InstallId = "", e.Locale = "", e.SessionId = -1, e.IsInternal = !1, e.IsReady = !1, e.HasInput = !1, e.ChannelLocale = "", e.EmbeddedSpaceId = "", e.AuthSessionId = "", e.ReceiveAllMessages = !1, e.PreciseJoinedAt = 0n, e.UserAgent = "", e.ClientType = _e.Unknown, e.UniqueSessionId = "", e.Parameters = /* @__PURE__ */ Object.create(null), e.SdkType = Ae.Unknown, e.SdkCapability = 0, e.ViewportWidth = 0, e.ViewportHeight = 0, e.Theme = "", e.Timezone = "", e.IsTouchDevice = !1, e.InitialPath = "", e.StyleFormat = ue.Css, e.SupportsCompression = !0, e.IsSoftDisconnected = !1, e.SoftDisconnectAt = 0n, e;
665
- }
666
- function lr(e, r) {
667
- const t = r ?? _r();
668
- return de(t), cr(e, t), t;
669
- }
670
- function cr(e, r) {
671
- let t;
672
- for (; (t = e.next()) !== null; )
673
- switch (t.fieldId) {
674
- case mt: {
675
- if (t.isNull) throw new Error();
676
- r.DeviceId = t.asString();
677
- break;
678
- }
679
- case Pt: {
680
- if (t.isNull) throw new Error();
681
- r.InstallId = t.asString();
682
- break;
683
- }
684
- case gt: {
685
- if (t.isNull) throw new Error();
686
- r.Theme = t.asString();
687
- break;
688
- }
689
- case Ft: {
690
- if (t.isNull) throw new Error();
691
- r.UserAgent = t.asString();
692
- break;
693
- }
694
- case bt: {
695
- if (t.isNull) throw new Error();
696
- r.ContextType = t.asInt32();
697
- break;
698
- }
699
- case Mt: {
700
- if (t.isNull) throw new Error();
701
- r.SoftDisconnectAt = t.asUInt64();
702
- break;
703
- }
704
- case vt: {
705
- if (t.isNull) throw new Error();
706
- r.HasInput = t.asBool();
707
- break;
708
- }
709
- case kt: {
710
- if (t.isNull) throw new Error();
711
- r.UserType = t.asInt32();
712
- break;
713
- }
714
- case Gt: {
715
- if (t.isNull) throw new Error();
716
- r.InitialPath = t.asString();
717
- break;
718
- }
719
- case Bt: {
720
- if (t.isNull) throw new Error();
721
- r.IsSoftDisconnected = t.asBool();
722
- break;
723
- }
724
- case Vt: {
725
- if (t.isNull) throw new Error();
726
- r.SupportsCompression = t.asBool();
727
- break;
728
- }
729
- case xt: {
730
- if (t.isNull) throw new Error();
731
- r.UserId = t.asString();
732
- break;
733
- }
734
- case Ht: {
735
- if (t.isNull) throw new Error();
736
- r.ProductId = t.asString();
737
- break;
738
- }
739
- case Yt: {
740
- if (t.isNull) throw new Error();
741
- r.AuthSessionId = t.asString();
742
- break;
743
- }
744
- case pt: {
745
- if (t.isNull) throw new Error();
746
- r.ReceiveAllMessages = t.asBool();
747
- break;
748
- }
749
- case Kt: {
750
- if (t.isNull) throw new Error();
751
- r.ViewportHeight = t.asInt32();
752
- break;
753
- }
754
- case $t: {
755
- if (t.isNull) throw new Error();
756
- r.Description = t.asString();
757
- break;
758
- }
759
- case Xt: {
760
- if (t.isNull) throw new Error();
761
- r.SdkCapability = t.asInt32();
762
- break;
763
- }
764
- case jt: {
765
- if (t.isNull) throw new Error();
766
- r.Locale = t.asString();
767
- break;
768
- }
769
- case Wt: {
770
- if (t.isNull) throw new Error();
771
- r.SdkType = t.asInt32();
772
- break;
773
- }
774
- case zt: {
775
- if (t.isNull) throw new Error();
776
- r.SessionId = t.asInt32();
777
- break;
778
- }
779
- case Jt: {
780
- if (t.isNull) throw new Error();
781
- r.ViewportWidth = t.asInt32();
782
- break;
783
- }
784
- case Qt: {
785
- if (t.isNull) throw new Error();
786
- r.PreciseJoinedAt = t.asUInt64();
787
- break;
788
- }
789
- case qt: {
790
- if (t.isNull) throw new Error();
791
- r.PayloadType = t.asInt32();
792
- break;
793
- }
794
- case Zt: {
795
- if (t.isNull) throw new Error();
796
- r.StyleFormat = t.asInt32();
797
- break;
798
- }
799
- case er: {
800
- if (t.isNull) throw new Error();
801
- r.IsTouchDevice = t.asBool();
802
- break;
803
- }
804
- case tr: {
805
- if (t.isNull) throw new Error();
806
- r.VersionId = t.asString();
807
- break;
808
- }
809
- case rr: {
810
- if (t.isNull) throw new Error();
811
- r.UniqueSessionId = t.asString();
812
- break;
813
- }
814
- case sr: {
815
- if (t.isNull) throw new Error();
816
- r.ClientType = t.asInt32();
817
- break;
818
- }
819
- case nr: {
820
- if (t.isNull) throw new Error();
821
- r.IsReady = t.asBool();
822
- break;
823
- }
824
- case ir: {
825
- if (t.isNull) throw new Error();
826
- r.Parameters = fr(t.asDictionary());
827
- break;
828
- }
829
- case or: {
830
- if (t.isNull) throw new Error();
831
- r.Timezone = t.asString();
832
- break;
833
- }
834
- case ar: {
835
- if (t.isNull) throw new Error();
836
- r.IsInternal = t.asBool();
837
- break;
838
- }
839
- case Er: {
840
- if (t.isNull) throw new Error();
841
- r.ChannelLocale = t.asString();
842
- break;
843
- }
844
- case Ir: {
845
- if (t.isNull) throw new Error();
846
- r.EmbeddedSpaceId = t.asString();
847
- break;
848
- }
849
- }
850
- }
851
- function fr(e) {
852
- const r = /* @__PURE__ */ Object.create(null);
853
- let t;
854
- for (; (t = e.next()) !== null; ) {
855
- const s = t.key.asString();
856
- r[s] = t.value.asString();
857
- }
858
- return r;
859
- }
860
- const ur = 703025676, Tr = 814454131, hr = 972460562, Ar = 976255570, Nr = 1368629611, Sr = 1479280922, Cr = 1533537016, Dr = 1909301063, Rr = 2274386296, dr = 2603556958, wr = 2885165957, Lr = 3568439632;
861
- function yr(e) {
862
- const r = {};
863
- return we(r), r;
864
- }
865
- function we(e) {
866
- return e.FunctionId = T.fromBytes(new Uint8Array(16)), e.FunctionName = "", e.Parameters = [], e.ResultTypeName = "", e.IsEnumerable = !1, e.EnumerableItemTypeName = "", e.IsCancellable = !1, e.Description = "", e.LlmInlineResult = !1, e.LlmCallOnlyOnce = !1, e.RequiresInstance = !1, e.Versions = [], e;
867
- }
868
- function Ur(e, r) {
869
- const t = r ?? yr();
870
- return we(t), Or(e, t), t;
871
- }
872
- function Or(e, r) {
873
- let t;
874
- for (; (t = e.next()) !== null; )
875
- switch (t.fieldId) {
876
- case ur: {
877
- if (t.isNull) throw new Error();
878
- r.ResultTypeName = t.asString();
879
- break;
880
- }
881
- case Tr: {
882
- if (t.isNull) throw new Error();
883
- r.FunctionName = t.asString();
884
- break;
885
- }
886
- case hr: {
887
- if (t.isNull) throw new Error();
888
- r.EnumerableItemTypeName = t.asString();
889
- break;
890
- }
891
- case Ar: {
892
- if (t.isNull) throw new Error();
893
- r.FunctionId = t.asGuid();
894
- break;
895
- }
896
- case Nr: {
897
- if (t.isNull) throw new Error();
898
- r.Description = t.asString();
899
- break;
900
- }
901
- case Sr: {
902
- if (t.isNull) throw new Error();
903
- r.IsCancellable = t.asBool();
904
- break;
905
- }
906
- case Cr: {
907
- if (t.isNull) throw new Error();
908
- r.RequiresInstance = t.asBool();
909
- break;
910
- }
911
- case Dr: {
912
- if (t.isNull) throw new Error();
913
- r.Versions = mr(t.asArray());
914
- break;
915
- }
916
- case Rr: {
917
- if (t.isNull) throw new Error();
918
- r.LlmInlineResult = t.asBool();
919
- break;
920
- }
921
- case dr: {
922
- if (t.isNull) throw new Error();
923
- r.IsEnumerable = t.asBool();
924
- break;
925
- }
926
- case wr: {
927
- if (t.isNull) throw new Error();
928
- r.Parameters = Pr(t.asArray());
929
- break;
930
- }
931
- case Lr: {
932
- if (t.isNull) throw new Error();
933
- r.LlmCallOnlyOnce = t.asBool();
934
- break;
935
- }
936
- }
937
- }
938
- function mr(e) {
939
- const r = [];
940
- let t;
941
- for (; (t = e.next()) !== null; )
942
- r.push(t.asString());
943
- return r;
944
- }
945
- function Pr(e) {
946
- const r = [];
947
- let t;
948
- for (; (t = e.next()) !== null; )
949
- r.push(Hr(t.asObject()));
950
- return r;
951
- }
952
- const gr = 607861992, Fr = 894485888, br = 972460562, Mr = 1368629611, vr = 1883521406, kr = 2603556958, Gr = 3609695522, Br = 4075263697, Vr = 4257460908;
953
- function xr(e) {
954
- const r = {};
955
- return Le(r), r;
956
- }
957
- function Le(e) {
958
- return e.ParameterIndex = 0, e.ParameterName = "", e.TypeName = "", e.HasDefaultValue = !1, e.DefaultValueJson = "", e.DefaultValueData = new Uint8Array(0), e.IsEnumerable = !1, e.EnumerableItemTypeName = "", e.Description = "", e;
959
- }
960
- function Hr(e, r) {
961
- const t = r ?? xr();
962
- return Le(t), Yr(e, t), t;
963
- }
964
- function Yr(e, r) {
965
- let t;
966
- for (; (t = e.next()) !== null; )
967
- switch (t.fieldId) {
968
- case gr: {
969
- if (t.isNull) throw new Error();
970
- r.HasDefaultValue = t.asBool();
971
- break;
972
- }
973
- case Fr: {
974
- if (t.isNull) throw new Error();
975
- r.DefaultValueJson = t.asString();
976
- break;
977
- }
978
- case br: {
979
- if (t.isNull) throw new Error();
980
- r.EnumerableItemTypeName = t.asString();
981
- break;
982
- }
983
- case Mr: {
984
- if (t.isNull) throw new Error();
985
- r.Description = t.asString();
986
- break;
987
- }
988
- case vr: {
989
- if (t.isNull) throw new Error();
990
- r.DefaultValueData = t.asBinary();
991
- break;
992
- }
993
- case kr: {
994
- if (t.isNull) throw new Error();
995
- r.IsEnumerable = t.asBool();
996
- break;
997
- }
998
- case Gr: {
999
- if (t.isNull) throw new Error();
1000
- r.TypeName = t.asString();
1001
- break;
1002
- }
1003
- case Br: {
1004
- if (t.isNull) throw new Error();
1005
- r.ParameterName = t.asString();
1006
- break;
1007
- }
1008
- case Vr: {
1009
- if (t.isNull) throw new Error();
1010
- r.ParameterIndex = t.asInt32();
1011
- break;
1012
- }
1013
- }
1014
- }
1015
- const pr = 3167053791, Kr = 3342364356, $r = 3612929027;
1016
- function ye(e) {
1017
- const r = {};
1018
- return Ue(r), r;
1019
- }
1020
- function Ue(e) {
1021
- return e.Category = "", e.Type = fe.Face, e.FaceBlendshapes = [], e;
1022
- }
1023
- function Xr(e, r) {
1024
- const t = r ?? ye();
1025
- return Ue(t), jr(e, t), t;
1026
- }
1027
- function jr(e, r) {
1028
- let t;
1029
- for (; (t = e.next()) !== null; )
1030
- switch (t.fieldId) {
1031
- case pr: {
1032
- if (t.isNull) throw new Error();
1033
- r.Type = t.asInt32();
1034
- break;
1035
- }
1036
- case Kr: {
1037
- if (t.isNull) throw new Error();
1038
- r.FaceBlendshapes = Wr(t.asArray());
1039
- break;
1040
- }
1041
- case $r: {
1042
- if (t.isNull) throw new Error();
1043
- r.Category = t.asString();
1044
- break;
1045
- }
1046
- }
1047
- }
1048
- function Wr(e) {
1049
- const r = [];
1050
- let t;
1051
- for (; (t = e.next()) !== null; )
1052
- r.push(t.asString());
1053
- return r;
1054
- }
1055
- const zr = 1405462580, Jr = 2968276160;
1056
- function Qr(e) {
1057
- const r = {};
1058
- return Oe(r), r;
1059
- }
1060
- function Oe(e) {
1061
- return e.MimeType = "", e.Value = new Uint8Array(0), e;
1062
- }
1063
- function qr(e, r) {
1064
- const t = r ?? Qr();
1065
- return Oe(t), Zr(e, t), t;
1066
- }
1067
- function Zr(e, r) {
1068
- let t;
1069
- for (; (t = e.next()) !== null; )
1070
- switch (t.fieldId) {
1071
- case zr: {
1072
- if (t.isNull) throw new Error();
1073
- r.Value = t.asBinary();
1074
- break;
1075
- }
1076
- case Jr: {
1077
- if (t.isNull) throw new Error();
1078
- r.MimeType = t.asString();
1079
- break;
1080
- }
1081
- }
1082
- }
1083
- const es = 3612929027;
1084
- function me(e) {
1085
- const r = {};
1086
- return Pe(r), r;
1087
- }
1088
- function Pe(e) {
1089
- return e.Category = "", e;
1090
- }
1091
- function ts(e, r) {
1092
- const t = r ?? me();
1093
- return Pe(t), rs(e, t), t;
1094
- }
1095
- function rs(e, r) {
1096
- let t;
1097
- for (; (t = e.next()) !== null; )
1098
- switch (t.fieldId) {
1099
- case es: {
1100
- if (t.isNull) throw new Error();
1101
- r.Category = t.asString();
1102
- break;
1103
- }
1104
- }
1105
- }
1106
- const ss = 2097188, ns = 979822885, is = 2374537704;
1107
- function os(e) {
1108
- const r = {};
1109
- return ge(r), r;
1110
- }
1111
- function ge(e) {
1112
- return e.StyleId = "", e.Style = /* @__PURE__ */ Object.create(null), e;
1113
- }
1114
- function as(e, r) {
1115
- const t = O.create(e);
1116
- return Es(t, r);
1117
- }
1118
- function Es(e, r) {
1119
- const t = r ?? os();
1120
- return ge(t), Is(e, t), t;
1121
- }
1122
- function Is(e, r) {
1123
- let t;
1124
- for (; (t = e.next()) !== null; )
1125
- switch (t.fieldId) {
1126
- case ns: {
1127
- if (t.isNull) throw new Error();
1128
- r.StyleId = t.asString();
1129
- break;
1130
- }
1131
- case is: {
1132
- if (t.isNull) throw new Error();
1133
- r.Style = ls(t.asDictionary());
1134
- break;
1135
- }
1136
- }
1137
- }
1138
- async function _s(e, r) {
1139
- const t = await p(e, ss);
1140
- return as(t, r);
1141
- }
1142
- function ls(e) {
1143
- const r = /* @__PURE__ */ Object.create(null);
1144
- let t;
1145
- for (; (t = e.next()) !== null; ) {
1146
- const s = t.key.asString();
1147
- r[s] = t.value.asString();
1148
- }
1149
- return r;
1150
- }
1151
- const cs = 2097192, fs = 2136687806;
1152
- function us(e) {
1153
- const r = {};
1154
- return Fe(r), r;
1155
- }
1156
- function Fe(e) {
1157
- return e.Styles = [], e;
1158
- }
1159
- function Ts(e, r) {
1160
- const t = O.create(e);
1161
- return hs(t, r);
1162
- }
1163
- function hs(e, r) {
1164
- const t = r ?? us();
1165
- return Fe(t), As(e, t), t;
1166
- }
1167
- function As(e, r) {
1168
- let t;
1169
- for (; (t = e.next()) !== null; )
1170
- switch (t.fieldId) {
1171
- case fs: {
1172
- if (t.isNull) throw new Error();
1173
- r.Styles = Ss(t.asArray());
1174
- break;
1175
- }
1176
- }
1177
- }
1178
- async function Ns(e, r) {
1179
- const t = await p(e, cs);
1180
- return Ts(t, r);
1181
- }
1182
- function Ss(e) {
1183
- const r = [];
1184
- let t;
1185
- for (; (t = e.next()) !== null; )
1186
- r.push(ds(t.asObject()));
1187
- return r;
1188
- }
1189
- const Cs = 979822885, Ds = 2374537704;
1190
- function Rs(e) {
1191
- const r = {};
1192
- return be(r), r;
1193
- }
1194
- function be(e) {
1195
- return e.StyleId = "", e.Style = /* @__PURE__ */ Object.create(null), e;
1196
- }
1197
- function ds(e, r) {
1198
- const t = r ?? Rs();
1199
- return be(t), ws(e, t), t;
1200
- }
1201
- function ws(e, r) {
1202
- let t;
1203
- for (; (t = e.next()) !== null; )
1204
- switch (t.fieldId) {
1205
- case Cs: {
1206
- if (t.isNull) throw new Error();
1207
- r.StyleId = t.asString();
1208
- break;
1209
- }
1210
- case Ds: {
1211
- if (t.isNull) throw new Error();
1212
- r.Style = Ls(t.asDictionary());
1213
- break;
1214
- }
1215
- }
1216
- }
1217
- function Ls(e) {
1218
- const r = /* @__PURE__ */ Object.create(null);
1219
- let t;
1220
- for (; (t = e.next()) !== null; ) {
1221
- const s = t.key.asString();
1222
- r[s] = t.value.asString();
1223
- }
1224
- return r;
1225
- }
1226
- const ys = 2097193, Us = 1415642792;
1227
- function Os(e) {
1228
- const r = {};
1229
- return Me(r), r;
1230
- }
1231
- function Me(e) {
1232
- return e.StyleIds = [], e;
1233
- }
1234
- function ms(e, r) {
1235
- const t = O.create(e);
1236
- return Ps(t, r);
1237
- }
1238
- function Ps(e, r) {
1239
- const t = r ?? Os();
1240
- return Me(t), gs(e, t), t;
1241
- }
1242
- function gs(e, r) {
1243
- let t;
1244
- for (; (t = e.next()) !== null; )
1245
- switch (t.fieldId) {
1246
- case Us: {
1247
- if (t.isNull) throw new Error();
1248
- r.StyleIds = bs(t.asArray());
1249
- break;
1250
- }
1251
- }
1252
- }
1253
- async function Fs(e, r) {
1254
- const t = await p(e, ys);
1255
- return ms(t, r);
1256
- }
1257
- function bs(e) {
1258
- const r = [];
1259
- let t;
1260
- for (; (t = e.next()) !== null; )
1261
- r.push(t.asString());
1262
- return r;
1263
- }
1264
- const Ms = 2097190, vs = 425183262, ks = 653781469;
1265
- function Gs(e) {
1266
- const r = {};
1267
- return ve(r), r;
1268
- }
1269
- function ve(e) {
1270
- return e.Json = "", e.Payloads = /* @__PURE__ */ Object.create(null), e;
1271
- }
1272
- function Bs(e, r) {
1273
- const t = O.create(e);
1274
- return Vs(t, r);
1275
- }
1276
- function Vs(e, r) {
1277
- const t = r ?? Gs();
1278
- return ve(t), xs(e, t), t;
1279
- }
1280
- function xs(e, r) {
1281
- let t;
1282
- for (; (t = e.next()) !== null; )
1283
- switch (t.fieldId) {
1284
- case vs: {
1285
- if (t.isNull) throw new Error();
1286
- r.Json = t.asString();
1287
- break;
1288
- }
1289
- case ks: {
1290
- if (t.isNull) throw new Error();
1291
- r.Payloads = Ys(t.asDictionary());
1292
- break;
1293
- }
1294
- }
1295
- }
1296
- async function Hs(e, r) {
1297
- const t = await p(e, Ms);
1298
- return Bs(t, r);
1299
- }
1300
- function Ys(e) {
1301
- const r = /* @__PURE__ */ Object.create(null);
1302
- let t;
1303
- for (; (t = e.next()) !== null; ) {
1304
- const s = t.key.asString();
1305
- r[s] = qr(t.value.asObject());
1306
- }
1307
- return r;
1308
- }
1309
- const ps = 161083277, Ks = 164808083, $s = 1368629611, Xs = 2514959030, js = 2745379226, Ws = 2950031986, zs = 3282782683, Js = 3284746250, Qs = 4065070594;
1310
- function ke(e) {
1311
- const r = {};
1312
- return Ge(r), r;
1313
- }
1314
- function Ge(e) {
1315
- return e.StreamId = "", e.Description = "", e.SourceType = "", e.Codec = he.H264, e.CodecDetails = "", e.Width = 0, e.Height = 0, e.Framerate = 30, e.CorrelationId = void 0, e;
1316
- }
1317
- function qs(e, r) {
1318
- const t = r ?? ke();
1319
- return Ge(t), Zs(e, t), t;
1320
- }
1321
- function Zs(e, r) {
1322
- let t;
1323
- for (; (t = e.next()) !== null; )
1324
- switch (t.fieldId) {
1325
- case ps: {
1326
- if (t.isNull) throw new Error();
1327
- r.StreamId = t.asString();
1328
- break;
1329
- }
1330
- case Ks: {
1331
- if (t.isNull) throw new Error();
1332
- r.Framerate = t.asFloat64();
1333
- break;
1334
- }
1335
- case $s: {
1336
- if (t.isNull) throw new Error();
1337
- r.Description = t.asString();
1338
- break;
1339
- }
1340
- case Xs: {
1341
- if (t.isNull) {
1342
- r.CorrelationId = void 0;
1343
- break;
1344
- }
1345
- r.CorrelationId = t.asString();
1346
- break;
1347
- }
1348
- case js: {
1349
- if (t.isNull) throw new Error();
1350
- r.CodecDetails = t.asString();
1351
- break;
1352
- }
1353
- case Ws: {
1354
- if (t.isNull) throw new Error();
1355
- r.Height = t.asInt32();
1356
- break;
1357
- }
1358
- case zs: {
1359
- if (t.isNull) throw new Error();
1360
- r.SourceType = t.asString();
1361
- break;
1362
- }
1363
- case Js: {
1364
- if (t.isNull) throw new Error();
1365
- r.Codec = t.asInt32();
1366
- break;
1367
- }
1368
- case Qs: {
1369
- if (t.isNull) throw new Error();
1370
- r.Width = t.asInt32();
1371
- break;
1372
- }
1373
- }
1374
- }
1375
- const en = 65539, tn = 693643444, rn = 976837618, sn = 1144553441, nn = 1497620243, on = 1559330978, an = 1976546434, En = 2271236852, In = 2277643855, _n = 2469008121, ln = 3042922213, cn = 3064612128, fn = 3219210453, un = 3504054055, Tn = 3678477544, hn = 3696445035, An = 3707543140, Nn = 3712281496, Sn = 3895362455, Cn = 3897397815, Dn = 3914217035, Rn = 4225107827;
1376
- function dn(e) {
1377
- const r = {};
1378
- return Be(r), r;
1379
- }
1380
- function Be(e) {
1381
- return e.Clients = /* @__PURE__ */ Object.create(null), e.Functions = /* @__PURE__ */ Object.create(null), e.UIStreams = /* @__PURE__ */ Object.create(null), e.AudioStreams = /* @__PURE__ */ Object.create(null), e.VideoStreams = /* @__PURE__ */ Object.create(null), e.TrackingStreams = /* @__PURE__ */ Object.create(null), e.SpaceId = "", e.ChannelId = "", e.ServerSessionId = "", e.SessionHash = "", e.ChannelUrl = "", e.SessionChannelUrl = "", e.FirstUserId = "", e.PrimaryUserId = "", e.OrganisationName = "", e.SpaceName = "", e.ChannelName = "", e.ServerRunType = Ne.Local, e.AppSourceType = Se.Bundle, e.PublicAccess = !1, e.DebugMode = !1, e;
1382
- }
1383
- function wn(e, r) {
1384
- const t = O.create(e);
1385
- return Ln(t, r);
1386
- }
1387
- function Ln(e, r) {
1388
- const t = r ?? dn();
1389
- return Be(t), yn(e, t), t;
1390
- }
1391
- function yn(e, r) {
1392
- let t;
1393
- for (; (t = e.next()) !== null; )
1394
- switch (t.fieldId) {
1395
- case tn: {
1396
- if (t.isNull) throw new Error();
1397
- r.FirstUserId = t.asString();
1398
- break;
1399
- }
1400
- case rn: {
1401
- if (t.isNull) throw new Error();
1402
- r.SessionHash = t.asString();
1403
- break;
1404
- }
1405
- case sn: {
1406
- if (t.isNull) throw new Error();
1407
- r.Clients = On(t.asDictionary());
1408
- break;
1409
- }
1410
- case nn: {
1411
- if (t.isNull) throw new Error();
1412
- r.TrackingStreams = mn(t.asDictionary());
1413
- break;
1414
- }
1415
- case on: {
1416
- if (t.isNull) throw new Error();
1417
- r.ChannelId = t.asString();
1418
- break;
1419
- }
1420
- case an: {
1421
- if (t.isNull) throw new Error();
1422
- r.AppSourceType = t.asInt32();
1423
- break;
1424
- }
1425
- case En: {
1426
- if (t.isNull) throw new Error();
1427
- r.SessionChannelUrl = t.asString();
1428
- break;
1429
- }
1430
- case In: {
1431
- if (t.isNull) throw new Error();
1432
- r.ChannelUrl = t.asString();
1433
- break;
1434
- }
1435
- case _n: {
1436
- if (t.isNull) throw new Error();
1437
- r.ChannelName = t.asString();
1438
- break;
1439
- }
1440
- case ln: {
1441
- if (t.isNull) throw new Error();
1442
- r.PublicAccess = t.asBool();
1443
- break;
1444
- }
1445
- case cn: {
1446
- if (t.isNull) throw new Error();
1447
- r.ServerRunType = t.asInt32();
1448
- break;
1449
- }
1450
- case fn: {
1451
- if (t.isNull) throw new Error();
1452
- r.OrganisationName = t.asString();
1453
- break;
1454
- }
1455
- case un: {
1456
- if (t.isNull) throw new Error();
1457
- r.DebugMode = t.asBool();
1458
- break;
1459
- }
1460
- case Tn: {
1461
- if (t.isNull) throw new Error();
1462
- r.Functions = Pn(t.asDictionary());
1463
- break;
1464
- }
1465
- case hn: {
1466
- if (t.isNull) throw new Error();
1467
- r.UIStreams = gn(t.asDictionary());
1468
- break;
1469
- }
1470
- case An: {
1471
- if (t.isNull) throw new Error();
1472
- r.SpaceId = t.asString();
1473
- break;
1474
- }
1475
- case Nn: {
1476
- if (t.isNull) throw new Error();
1477
- r.PrimaryUserId = t.asString();
1478
- break;
1479
- }
1480
- case Sn: {
1481
- if (t.isNull) throw new Error();
1482
- r.AudioStreams = Fn(t.asDictionary());
1483
- break;
1484
- }
1485
- case Cn: {
1486
- if (t.isNull) throw new Error();
1487
- r.VideoStreams = bn(t.asDictionary());
1488
- break;
1489
- }
1490
- case Dn: {
1491
- if (t.isNull) throw new Error();
1492
- r.ServerSessionId = t.asString();
1493
- break;
1494
- }
1495
- case Rn: {
1496
- if (t.isNull) throw new Error();
1497
- r.SpaceName = t.asString();
1498
- break;
1499
- }
1500
- }
1501
- }
1502
- async function Un(e, r) {
1503
- const t = await p(e, en);
1504
- return wn(t, r);
1505
- }
1506
- function On(e) {
1507
- const r = /* @__PURE__ */ Object.create(null);
1508
- let t;
1509
- for (; (t = e.next()) !== null; ) {
1510
- const s = t.key.asInt32();
1511
- r[s] = lr(t.value.asObject());
1512
- }
1513
- return r;
1514
- }
1515
- function mn(e) {
1516
- const r = /* @__PURE__ */ Object.create(null);
1517
- let t;
1518
- for (; (t = e.next()) !== null; ) {
1519
- const s = t.key.asString();
1520
- r[s] = ai(t.value.asObject());
1521
- }
1522
- return r;
1523
- }
1524
- function Pn(e) {
1525
- const r = /* @__PURE__ */ Object.create(null);
1526
- let t;
1527
- for (; (t = e.next()) !== null; ) {
1528
- const s = t.key.asInt32();
1529
- r[s] = Mn(t.value.asArray());
1530
- }
1531
- return r;
1532
- }
1533
- function gn(e) {
1534
- const r = /* @__PURE__ */ Object.create(null);
1535
- let t;
1536
- for (; (t = e.next()) !== null; ) {
1537
- const s = t.key.asString();
1538
- r[s] = xn(t.value.asObject());
1539
- }
1540
- return r;
1541
- }
1542
- function Fn(e) {
1543
- const r = /* @__PURE__ */ Object.create(null);
1544
- let t;
1545
- for (; (t = e.next()) !== null; ) {
1546
- const s = t.key.asString();
1547
- r[s] = jn(t.value.asObject());
1548
- }
1549
- return r;
1550
- }
1551
- function bn(e) {
1552
- const r = /* @__PURE__ */ Object.create(null);
1553
- let t;
1554
- for (; (t = e.next()) !== null; ) {
1555
- const s = t.key.asString();
1556
- r[s] = ei(t.value.asObject());
1557
- }
1558
- return r;
1559
- }
1560
- function Mn(e) {
1561
- const r = [];
1562
- let t;
1563
- for (; (t = e.next()) !== null; )
1564
- r.push(Ur(t.asObject()));
1565
- return r;
1566
- }
1567
- const vn = 161083277, kn = 325678206, Gn = 3469892363, Bn = 3645544153;
1568
- function Vn(e) {
1569
- const r = {};
1570
- return Ve(r), r;
1571
- }
1572
- function Ve(e) {
1573
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = me(), e;
1574
- }
1575
- function xn(e, r) {
1576
- const t = r ?? Vn();
1577
- return Ve(t), Hn(e, t), t;
1578
- }
1579
- function Hn(e, r) {
1580
- let t;
1581
- for (; (t = e.next()) !== null; )
1582
- switch (t.fieldId) {
1583
- case vn: {
1584
- if (t.isNull) throw new Error();
1585
- r.StreamId = t.asString();
1586
- break;
1587
- }
1588
- case kn: {
1589
- if (t.isNull) throw new Error();
1590
- r.ClientSessionId = t.asInt32();
1591
- break;
1592
- }
1593
- case Gn: {
1594
- if (t.isNull) throw new Error();
1595
- r.TrackId = t.asInt32();
1596
- break;
1597
- }
1598
- case Bn: {
1599
- if (t.isNull) throw new Error();
1600
- r.Info = ts(t.asObject());
1601
- break;
1602
- }
1603
- }
1604
- }
1605
- const Yn = 161083277, pn = 325678206, Kn = 3469892363, $n = 3645544153;
1606
- function Xn(e) {
1607
- const r = {};
1608
- return xe(r), r;
1609
- }
1610
- function xe(e) {
1611
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = Ce(), e;
1612
- }
1613
- function jn(e, r) {
1614
- const t = r ?? Xn();
1615
- return xe(t), Wn(e, t), t;
1616
- }
1617
- function Wn(e, r) {
1618
- let t;
1619
- for (; (t = e.next()) !== null; )
1620
- switch (t.fieldId) {
1621
- case Yn: {
1622
- if (t.isNull) throw new Error();
1623
- r.StreamId = t.asString();
1624
- break;
1625
- }
1626
- case pn: {
1627
- if (t.isNull) throw new Error();
1628
- r.ClientSessionId = t.asInt32();
1629
- break;
1630
- }
1631
- case Kn: {
1632
- if (t.isNull) throw new Error();
1633
- r.TrackId = t.asInt32();
1634
- break;
1635
- }
1636
- case $n: {
1637
- if (t.isNull) throw new Error();
1638
- r.Info = St(t.asObject());
1639
- break;
1640
- }
1641
- }
1642
- }
1643
- const zn = 161083277, Jn = 325678206, Qn = 3469892363, qn = 3645544153;
1644
- function Zn(e) {
1645
- const r = {};
1646
- return He(r), r;
1647
- }
1648
- function He(e) {
1649
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = ke(), e;
1650
- }
1651
- function ei(e, r) {
1652
- const t = r ?? Zn();
1653
- return He(t), ti(e, t), t;
1654
- }
1655
- function ti(e, r) {
1656
- let t;
1657
- for (; (t = e.next()) !== null; )
1658
- switch (t.fieldId) {
1659
- case zn: {
1660
- if (t.isNull) throw new Error();
1661
- r.StreamId = t.asString();
1662
- break;
1663
- }
1664
- case Jn: {
1665
- if (t.isNull) throw new Error();
1666
- r.ClientSessionId = t.asInt32();
1667
- break;
1668
- }
1669
- case Qn: {
1670
- if (t.isNull) throw new Error();
1671
- r.TrackId = t.asInt32();
1672
- break;
1673
- }
1674
- case qn: {
1675
- if (t.isNull) throw new Error();
1676
- r.Info = qs(t.asObject());
1677
- break;
1678
- }
1679
- }
1680
- }
1681
- const ri = 161083277, si = 325678206, ni = 3469892363, ii = 3645544153;
1682
- function oi(e) {
1683
- const r = {};
1684
- return Ye(r), r;
1685
- }
1686
- function Ye(e) {
1687
- return e.StreamId = "", e.ClientSessionId = 0, e.TrackId = 0, e.Info = ye(), e;
1688
- }
1689
- function ai(e, r) {
1690
- const t = r ?? oi();
1691
- return Ye(t), Ei(e, t), t;
1692
- }
1693
- function Ei(e, r) {
1694
- let t;
1695
- for (; (t = e.next()) !== null; )
1696
- switch (t.fieldId) {
1697
- case ri: {
1698
- if (t.isNull) throw new Error();
1699
- r.StreamId = t.asString();
1700
- break;
1701
- }
1702
- case si: {
1703
- if (t.isNull) throw new Error();
1704
- r.ClientSessionId = t.asInt32();
1705
- break;
1706
- }
1707
- case ni: {
1708
- if (t.isNull) throw new Error();
1709
- r.TrackId = t.asInt32();
1710
- break;
1711
- }
1712
- case ii: {
1713
- if (t.isNull) throw new Error();
1714
- r.Info = Xr(t.asObject());
1715
- break;
1716
- }
1717
- }
1718
- }
1719
- function D(e) {
1720
- return typeof e == "object" && e !== null && !Array.isArray(e);
1721
- }
1722
- function pe(e) {
1723
- const r = {}, t = Object.keys(e);
1724
- for (let s = 0; s < t.length; s++) {
1725
- const n = t[s];
1726
- r[n] = e[n];
1727
- }
1728
- return r;
1729
- }
1730
- function Ke(e, r, t, s) {
1731
- if (!(e === void 0 && s)) {
1732
- if (Array.isArray(e)) {
1733
- const n = [];
1734
- for (let i = 0; i < e.length; i++) {
1735
- const o = e[i];
1736
- if (typeof o != "string")
1737
- throw new Error(`Invalid styleIds entry at ${r}.styleIds[${i}] for element ${t}`);
1738
- const a = o.trim();
1739
- a.length !== 0 && n.push(a);
1740
- }
1741
- return n;
1742
- }
1743
- if (e != null)
1744
- throw new Error(`Invalid styleIds for element ${t}`);
1745
- return [];
1746
- }
1747
- }
1748
- function ne(e, r) {
1749
- if (!e || typeof e != "object")
1750
- throw new Error(`Invalid UI node at ${r}`);
1751
- const t = e.Id, s = e.Type, n = e.Props, i = e.Children, o = e.StyleIds;
1752
- if (typeof t != "string")
1753
- throw new Error(`Invalid or missing node id at ${r}`);
1754
- if (typeof s != "string")
1755
- throw new Error(`Invalid or missing node type for ${t}`);
1756
- let a = {};
1757
- if (n != null) {
1758
- if (!D(n))
1759
- throw new Error(`Invalid props for node ${t}`);
1760
- a = pe(n);
1761
- }
1762
- let I = [];
1763
- Array.isArray(i) && (I = i.map(
1764
- (l, c) => ne(l ?? {}, `${r}.children[${c}]`)
1765
- ));
1766
- const _ = Ke(o, r, t, !1), E = typeof e.SourceMarker == "string" ? e.SourceMarker : void 0;
1767
- return {
1768
- id: t,
1769
- type: s,
1770
- props: a,
1771
- children: I,
1772
- styleIds: _ ?? [],
1773
- ...E ? { sourceMarker: E } : {}
1774
- };
1775
- }
1776
- function Ii(e, r) {
1777
- if (!D(e))
1778
- throw new Error(`Invalid text delta at ${r}`);
1779
- const t = e.NodeId, s = e.PropertyName, n = e.Start, i = e.End, o = e.InsertedText;
1780
- if (typeof t != "string" || t.length === 0)
1781
- throw new Error(`Invalid text delta node id at ${r}`);
1782
- if (typeof s != "string" || s.length === 0)
1783
- throw new Error(`Invalid text delta property name at ${r}`);
1784
- if (typeof n != "number" || !Number.isFinite(n))
1785
- throw new Error(`Invalid text delta start at ${r}`);
1786
- if (typeof o != "string")
1787
- throw new Error(`Invalid text delta inserted text at ${r}`);
1788
- let a;
1789
- if (typeof i == "number") {
1790
- if (!Number.isFinite(i))
1791
- throw new Error(`Invalid text delta end at ${r}`);
1792
- a = i;
1793
- } else if (i != null)
1794
- throw new Error(`Invalid text delta end at ${r}`);
1795
- return {
1796
- nodeId: t,
1797
- propertyName: s,
1798
- start: n,
1799
- end: a,
1800
- insertedText: o
1801
- };
1802
- }
1803
- function _i(e, r) {
1804
- if (!D(e))
1805
- throw new Error(`Invalid child insert at ${r}`);
1806
- const t = e.Index, s = e.Node;
1807
- if (typeof t != "number" || !Number.isFinite(t))
1808
- throw new Error(`Invalid child insert index at ${r}`);
1809
- if (!D(s))
1810
- throw new Error(`Invalid child insert node at ${r}`);
1811
- return {
1812
- index: t,
1813
- node: ne(s, `${r}.node`)
1814
- };
1815
- }
1816
- function li(e, r) {
1817
- if (!D(e))
1818
- throw new Error(`Invalid child move at ${r}`);
1819
- const t = e.NodeId, s = e.FromIndex, n = e.ToIndex;
1820
- if (typeof t != "string" || t.length === 0)
1821
- throw new Error(`Invalid child move nodeId at ${r}`);
1822
- if (typeof s != "number" || !Number.isFinite(s))
1823
- throw new Error(`Invalid child move fromIndex at ${r}`);
1824
- if (typeof n != "number" || !Number.isFinite(n))
1825
- throw new Error(`Invalid child move toIndex at ${r}`);
1826
- return {
1827
- nodeId: t,
1828
- fromIndex: s,
1829
- toIndex: n
1830
- };
1831
- }
1832
- function ci(e, r) {
1833
- if (!D(e))
1834
- throw new Error(`Invalid child remove at ${r}`);
1835
- const t = e.NodeId, s = e.Index;
1836
- if (typeof t != "string" || t.length === 0)
1837
- throw new Error(`Invalid child remove nodeId at ${r}`);
1838
- if (typeof s != "number" || !Number.isFinite(s))
1839
- throw new Error(`Invalid child remove index at ${r}`);
1840
- return {
1841
- nodeId: t,
1842
- index: s
1843
- };
1844
- }
1845
- function fi(e, r) {
1846
- if (!D(e))
1847
- throw new Error(`Invalid node change at ${r}`);
1848
- const t = e.nodeId;
1849
- if (typeof t != "string" || t.length === 0)
1850
- throw new Error(`Invalid node change nodeId at ${r}`);
1851
- const s = Array.isArray(e.inserts) ? e.inserts.map(
1852
- (E, l) => _i(E ?? {}, `${r}.inserts[${l}]`)
1853
- ) : void 0, n = Array.isArray(e.moves) ? e.moves.map(
1854
- (E, l) => li(E ?? {}, `${r}.moves[${l}]`)
1855
- ) : void 0, i = Array.isArray(e.removals) ? e.removals.map(
1856
- (E, l) => ci(E ?? {}, `${r}.removals[${l}]`)
1857
- ) : void 0;
1858
- let o;
1859
- if (D(e.changedProps)) {
1860
- o = /* @__PURE__ */ new Map();
1861
- for (const [E, l] of Object.entries(e.changedProps)) {
1862
- if (!D(l))
1863
- continue;
1864
- const c = l.New;
1865
- c === void 0 ? o.set(E, void 0) : D(c) ? o.set(E, pe(c)) : o.set(E, c);
1866
- }
1867
- }
1868
- const a = Array.isArray(e.textUpdates) ? e.textUpdates.map(
1869
- (E, l) => Ii(E ?? {}, `${r}.textUpdates[${l}]`)
1870
- ) : void 0, I = e.styleIds, _ = I !== void 0 ? Ke(I, r, t, !0) : void 0;
1871
- return {
1872
- nodeId: t,
1873
- ...s && s.length > 0 ? { inserts: s } : {},
1874
- ...n && n.length > 0 ? { moves: n } : {},
1875
- ...i && i.length > 0 ? { removals: i } : {},
1876
- ...o && o.size > 0 ? { changedProps: o } : {},
1877
- ...a && a.length > 0 ? { textUpdates: a } : {},
1878
- ..._ !== void 0 ? { styleIds: _ } : {}
1879
- };
1880
- }
1881
- function ui(e) {
1882
- const r = /* @__PURE__ */ new Map();
1883
- for (const [t, s] of Object.entries(e))
1884
- r.set(t, s);
1885
- return r;
1886
- }
1887
- function Ti(e, r, t) {
1888
- if (!e || typeof e != "object")
1889
- throw new R("UI update graph is missing");
1890
- const s = ne(e, "graph");
1891
- if (s.type !== "root")
1892
- throw new R('UI update root element must have type "root"');
1893
- const n = Ai(s.props, r);
1894
- return {
1895
- type: "full",
1896
- version: t,
1897
- root: s,
1898
- metadata: n
1899
- };
1900
- }
1901
- function hi(e, r, t) {
1902
- if (!Array.isArray(e))
1903
- throw new R("UI diff changes must be an array");
1904
- if (!D(r))
1905
- throw new R("UI diff metadata must be an object");
1906
- const s = r.viewId;
1907
- if (typeof s != "string" || s.length === 0)
1908
- throw new R("UI diff metadata is missing viewId");
1909
- const n = e.map(
1910
- (a, I) => fi(a ?? {}, `changes[${I}]`)
1911
- ), i = typeof r.isUpdate == "boolean" ? r.isUpdate : void 0, o = {
1912
- viewId: s,
1913
- ...i !== void 0 ? { isUpdate: i } : {}
1914
- };
1915
- return {
1916
- type: "diff",
1917
- version: t,
1918
- changes: n,
1919
- metadata: o
1920
- };
1921
- }
1922
- function Ai(e, r) {
1923
- const t = e.viewId;
1924
- if (typeof t != "string" || t.length === 0)
1925
- throw new R("UI update root is missing viewId");
1926
- let s = t, n = typeof e.isUpdate == "boolean" ? e.isUpdate : void 0;
1927
- return D(r) && (typeof r.viewId == "string" && r.viewId.length > 0 && (s = r.viewId), typeof r.isUpdate == "boolean" && (n = r.isUpdate)), {
1928
- viewId: s,
1929
- ...n !== void 0 ? { isUpdate: n } : {}
1930
- };
1931
- }
1932
- class R extends Error {
1933
- constructor(r, t) {
1934
- super(r), this.causeError = t, this.name = "UiUpdateParseError", t instanceof Error && (this.stack = t.stack);
1935
- }
1936
- }
1937
- function Ni(e) {
1938
- let r;
1939
- try {
1940
- r = JSON.parse(e.Json);
1941
- } catch (o) {
1942
- throw new R("Failed to parse UIUpdate.Json payload", o);
1943
- }
1944
- if (!r || typeof r != "object")
1945
- throw new R("UI update snapshot must be an object");
1946
- const { type: t, version: s } = r;
1947
- if (t !== "full" && t !== "diff")
1948
- throw new R(`Unknown UI update type: ${String(t)}`);
1949
- if (typeof s != "number")
1950
- throw new R("UI update version must be a number");
1951
- const n = t === "full" ? Ti(r.graph, r.metadata, s) : hi(r.changes, r.metadata, s), i = e.Payloads ? ui(e.Payloads) : /* @__PURE__ */ new Map();
1952
- return {
1953
- snapshot: n,
1954
- payloads: i
1955
- };
1956
- }
1957
- let Si = 1;
1958
- const Ci = /* @__PURE__ */ new Map(), Di = {
1959
- 0: "DEBUG",
1960
- 1: "INFO",
1961
- 2: "WARN",
1962
- 3: "ERROR",
1963
- 4: "NONE"
1964
- };
1965
- function Ri(e, r) {
1966
- return `[${e}] ${r}`;
1967
- }
1968
- function $(e, r, t, s) {
1969
- const n = (/* @__PURE__ */ new Date()).toISOString(), i = Di[e], o = {
1970
- timestamp: n,
1971
- level: e,
1972
- levelName: i,
1973
- component: r,
1974
- message: t,
1975
- args: s
1976
- };
1977
- for (const [a, I] of Ci) {
1978
- const _ = I?.minLevel ?? 2;
1979
- if (e >= _)
1980
- try {
1981
- a(o);
1982
- } catch {
1983
- }
1984
- }
1985
- if (Si <= e) {
1986
- const a = Ri(r, t);
1987
- switch (e) {
1988
- case 0:
1989
- console.debug(a, ...s);
1990
- break;
1991
- case 1:
1992
- console.info(a, ...s);
1993
- break;
1994
- case 2:
1995
- console.warn(a, ...s);
1996
- break;
1997
- case 3:
1998
- console.error(a, ...s);
1999
- break;
2000
- }
2001
- }
2002
- }
2003
- function di(e) {
2004
- return {
2005
- debug(r, ...t) {
2006
- $(0, e, r, t);
2007
- },
2008
- info(r, ...t) {
2009
- $(1, e, r, t);
2010
- },
2011
- warn(r, ...t) {
2012
- $(2, e, r, t);
2013
- },
2014
- error(r, ...t) {
2015
- $(3, e, r, t);
2016
- }
2017
- };
2018
- }
2019
- class wi {
2020
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
2021
- cache = /* @__PURE__ */ new Map();
2022
- /**
2023
- * Get a cached void handler (no payload) for a node/action combination.
2024
- * Creates and caches the handler if it doesn't exist.
2025
- */
2026
- getHandler(r, t, s) {
2027
- const n = `${r}:${t}`;
2028
- let i = this.cache.get(n);
2029
- return i || (i = () => s(t), this.cache.set(n, i)), i;
2030
- }
2031
- /**
2032
- * Get a cached handler that accepts a payload.
2033
- * Creates and caches the handler if it doesn't exist.
2034
- */
2035
- getHandlerWithPayload(r, t, s) {
2036
- const n = `${r}:${t}:payload`;
2037
- let i = this.cache.get(n);
2038
- return i || (i = (o) => s(t, o), this.cache.set(n, i)), i;
2039
- }
2040
- /**
2041
- * Get a cached handler for boolean payloads.
2042
- */
2043
- getBooleanHandler(r, t, s) {
2044
- return this.getHandlerWithPayload(r, t, s);
2045
- }
2046
- /**
2047
- * Get a cached handler for string payloads.
2048
- */
2049
- getStringHandler(r, t, s) {
2050
- return this.getHandlerWithPayload(r, t, s);
2051
- }
2052
- /**
2053
- * Get a cached handler for number payloads.
2054
- */
2055
- getNumberHandler(r, t, s) {
2056
- return this.getHandlerWithPayload(r, t, s);
2057
- }
2058
- /**
2059
- * Get a cached handler for number array payloads.
2060
- */
2061
- getNumberArrayHandler(r, t, s) {
2062
- return this.getHandlerWithPayload(r, t, s);
2063
- }
2064
- /**
2065
- * Get a cached handler for nullable boolean payloads.
2066
- */
2067
- getNullableBooleanHandler(r, t, s) {
2068
- const n = `${r}:${t}:nullable-bool`;
2069
- let i = this.cache.get(n);
2070
- return i || (i = (o) => s(t, o ?? null), this.cache.set(n, i)), i;
2071
- }
2072
- /**
2073
- * Invalidate all cached handlers for a specific node.
2074
- * Call this when a node is removed from the tree.
2075
- */
2076
- invalidateNode(r) {
2077
- const t = `${r}:`;
2078
- for (const s of this.cache.keys())
2079
- s.startsWith(t) && this.cache.delete(s);
2080
- }
2081
- /**
2082
- * Invalidate a specific handler.
2083
- */
2084
- invalidateHandler(r, t) {
2085
- this.cache.delete(`${r}:${t}`), this.cache.delete(`${r}:${t}:payload`), this.cache.delete(`${r}:${t}:nullable-bool`);
2086
- }
2087
- /**
2088
- * Clear all cached handlers.
2089
- */
2090
- clear() {
2091
- this.cache.clear();
2092
- }
2093
- /**
2094
- * Get the number of cached handlers (for debugging/testing).
2095
- */
2096
- get size() {
2097
- return this.cache.size;
2098
- }
2099
- }
2100
- const Li = di("UiStreamStore");
2101
- class yi {
2102
- views = /* @__PURE__ */ new Map();
2103
- listeners = /* @__PURE__ */ new Set();
2104
- payloads = /* @__PURE__ */ new Map();
2105
- snapshotMode = !1;
2106
- snapshot = {
2107
- views: /* @__PURE__ */ new Map(),
2108
- payloads: /* @__PURE__ */ new Map(),
2109
- version: -1
2110
- };
2111
- rootViewId;
2112
- // Per-node subscriptions for granular updates
2113
- nodeListeners = /* @__PURE__ */ new Map();
2114
- changedNodeIds = /* @__PURE__ */ new Set();
2115
- nodeVersions = /* @__PURE__ */ new Map();
2116
- structureChanged = !1;
2117
- // Dirty flags for lazy snapshot rebuilding - start true to ensure first snapshot builds correctly
2118
- viewsDirty = !0;
2119
- payloadsDirty = !0;
2120
- // Handler cache for stable event handlers
2121
- handlerCache = new wi();
2122
- apply(r) {
2123
- if (this.snapshotMode) {
2124
- if (r.snapshot.type !== "full")
2125
- return !1;
2126
- this.snapshotMode = !1, this.views.clear(), this.payloads.clear(), this.rootViewId = void 0, this.viewsDirty = !0, this.payloadsDirty = !0, this.snapshot = {
2127
- views: /* @__PURE__ */ new Map(),
2128
- payloads: /* @__PURE__ */ new Map(),
2129
- version: -1
2130
- };
2131
- }
2132
- const { snapshot: t, payloads: s } = r, { metadata: n } = t, { viewId: i } = n;
2133
- let o = this.views.get(i);
2134
- o || (o = {
2135
- version: 0
2136
- }, this.views.set(i, o));
2137
- const a = t.type === "diff" && n.isUpdate === !0;
2138
- if (t.version < o.version || t.version === o.version && !a)
2139
- return !1;
2140
- let I = !1;
2141
- this.rootViewId || (this.rootViewId = i, I = !0, this.structureChanged = !0);
2142
- const _ = o.root;
2143
- if (t.type === "full")
2144
- o.root = t.root, o.version = t.version, I = !0, this.viewsDirty = !0, this.structureChanged = !0, t.root && B(t.root, this.changedNodeIds);
2145
- else {
2146
- if (!_)
2147
- return !1;
2148
- const E = Oi(_, t.changes);
2149
- E !== _ ? (o.root = E, I = !0, this.viewsDirty = !0, J(_, E, this.changedNodeIds)) : o.root = E, o.version = t.version;
2150
- }
2151
- for (const [E, l] of s)
2152
- this.payloads.get(E) !== l && (this.payloads.set(E, l), I = !0, this.payloadsDirty = !0);
2153
- return I ? (this.commitSnapshot(), this.notify(), !0) : (o.version = t.version, !1);
2154
- }
2155
- replaceFromWire(r) {
2156
- const t = {
2157
- rootViewId: r.rootViewId,
2158
- views: new Map(r.views),
2159
- payloads: new Map(r.payloads),
2160
- version: r.version
2161
- };
2162
- return this.replaceSnapshot(t);
2163
- }
2164
- patchFromOp(r) {
2165
- this.snapshotMode = !0;
2166
- const t = r.expectedBaseVersion;
2167
- if (t !== void 0 && this.snapshot.version !== t)
2168
- return !1;
2169
- let s = !1, n = null, i = null;
2170
- const o = () => (n || (n = new Map(this.snapshot.views)), n), a = () => (i || (i = new Map(this.snapshot.payloads)), i);
2171
- if (r.deleteViews && r.deleteViews.length > 0)
2172
- for (const E of r.deleteViews)
2173
- o().delete(E) && (s = !0, this.structureChanged = !0);
2174
- if (r.upsertViews && r.upsertViews.length > 0)
2175
- for (const [E, l] of r.upsertViews) {
2176
- const c = o(), w = c.get(E);
2177
- w !== l && (c.set(E, l), s = !0, w ? J(w, l, this.changedNodeIds) : (B(l, this.changedNodeIds), this.structureChanged = !0));
2178
- }
2179
- if (r.deletePayloads && r.deletePayloads.length > 0)
2180
- for (const E of r.deletePayloads)
2181
- a().delete(E) && (s = !0);
2182
- if (r.upsertPayloads && r.upsertPayloads.length > 0)
2183
- for (const [E, l] of r.upsertPayloads) {
2184
- const c = a();
2185
- c.get(E) !== l && (c.set(E, l), s = !0);
2186
- }
2187
- const I = r.rootViewId ?? this.snapshot.rootViewId;
2188
- I !== this.snapshot.rootViewId && (s = !0, this.structureChanged = !0);
2189
- const _ = r.nextVersion;
2190
- if (_ !== this.snapshot.version && (s = !0), !s)
2191
- return this.snapshot = { ...this.snapshot, version: _ }, !1;
2192
- for (const E of this.changedNodeIds)
2193
- this.nodeVersions.set(E, (this.nodeVersions.get(E) ?? 0) + 1);
2194
- return this.snapshot = {
2195
- rootViewId: I,
2196
- views: n ?? new Map(this.snapshot.views),
2197
- payloads: i ?? new Map(this.snapshot.payloads),
2198
- version: _
2199
- }, this.notify(), !0;
2200
- }
2201
- replaceSnapshot(r) {
2202
- this.snapshotMode = !0;
2203
- const t = this.snapshot, s = t.version !== r.version || t.rootViewId !== r.rootViewId || t.views.size !== r.views.size || t.payloads.size !== r.payloads.size;
2204
- (t.rootViewId !== r.rootViewId || t.views.size !== r.views.size) && (this.structureChanged = !0);
2205
- for (const [n, i] of r.views) {
2206
- const o = t.views.get(n);
2207
- o ? J(o, i, this.changedNodeIds) : (B(i, this.changedNodeIds), this.structureChanged = !0);
2208
- }
2209
- for (const n of this.changedNodeIds)
2210
- this.nodeVersions.set(n, (this.nodeVersions.get(n) ?? 0) + 1);
2211
- return this.snapshot = r, s && this.notify(), s;
2212
- }
2213
- clear() {
2214
- (this.snapshot.rootViewId === void 0 || this.snapshot.rootViewId.length === 0) && this.snapshot.views.size === 0 && this.snapshot.payloads.size === 0 || (this.snapshotMode = !0, this.views.clear(), this.payloads.clear(), this.rootViewId = void 0, this.viewsDirty = !0, this.payloadsDirty = !0, this.snapshot = {
2215
- views: /* @__PURE__ */ new Map(),
2216
- payloads: /* @__PURE__ */ new Map(),
2217
- version: -1
2218
- }, this.structureChanged = !0, this.notify());
2219
- }
2220
- getSnapshot() {
2221
- return this.snapshot;
2222
- }
2223
- subscribe(r) {
2224
- return this.listeners.add(r), () => {
2225
- this.listeners.delete(r);
2226
- };
2227
- }
2228
- subscribeNode(r, t) {
2229
- let s = this.nodeListeners.get(r);
2230
- return s || (s = /* @__PURE__ */ new Set(), this.nodeListeners.set(r, s)), s.add(t), () => {
2231
- s && (s.delete(t), s.size === 0 && this.nodeListeners.delete(r));
2232
- };
2233
- }
2234
- getNode(r) {
2235
- const t = this.snapshot.views.get(r);
2236
- if (t)
2237
- return t;
2238
- for (const s of this.snapshot.views.values()) {
2239
- const n = je(s, r);
2240
- if (n)
2241
- return n;
2242
- }
2243
- }
2244
- getNodeVersion(r) {
2245
- return this.nodeVersions.get(r) ?? 0;
2246
- }
2247
- notifyNodes() {
2248
- if (this.changedNodeIds.size === 0 || this.nodeListeners.size === 0) {
2249
- this.changedNodeIds.clear();
2250
- return;
2251
- }
2252
- for (const r of this.changedNodeIds) {
2253
- const t = this.nodeListeners.get(r);
2254
- if (t)
2255
- for (const s of t)
2256
- s();
2257
- }
2258
- this.changedNodeIds.clear();
2259
- }
2260
- commitSnapshot() {
2261
- let r, t;
2262
- if (this.viewsDirty) {
2263
- const n = /* @__PURE__ */ new Map();
2264
- for (const [i, o] of this.views)
2265
- o.root && n.set(i, o.root);
2266
- r = n, this.viewsDirty = !1;
2267
- } else
2268
- r = this.snapshot.views;
2269
- this.payloadsDirty ? (t = new Map(this.payloads), this.payloadsDirty = !1) : t = this.snapshot.payloads;
2270
- let s = this.rootViewId && this.views.has(this.rootViewId) ? this.views.get(this.rootViewId)?.version : void 0;
2271
- if (s === void 0)
2272
- for (const n of this.views.values())
2273
- s = s === void 0 ? n.version : Math.max(s, n.version);
2274
- this.snapshot = {
2275
- rootViewId: this.rootViewId,
2276
- views: r,
2277
- payloads: t,
2278
- version: s
2279
- };
2280
- for (const n of this.changedNodeIds)
2281
- this.nodeVersions.set(n, (this.nodeVersions.get(n) ?? 0) + 1);
2282
- }
2283
- notify() {
2284
- if (this.notifyNodes(), this.structureChanged) {
2285
- this.structureChanged = !1;
2286
- for (const r of this.listeners)
2287
- r();
2288
- }
2289
- }
2290
- }
2291
- class Ui {
2292
- streams = /* @__PURE__ */ new Map();
2293
- listeners = /* @__PURE__ */ new Set();
2294
- apply(r, t) {
2295
- const n = this.getOrCreateStreamEntry(r).store.apply(t);
2296
- return n && this.notify(r), n;
2297
- }
2298
- applyStoreOp(r) {
2299
- if (r.type === "ReplaceStreamSnapshot") {
2300
- const t = this.getOrCreateStreamEntry(r.snapshot.streamId), s = t.category !== r.snapshot.category;
2301
- return t.category = r.snapshot.category, t.store.replaceFromWire(r.snapshot) || s ? (this.notify(r.snapshot.streamId), !0) : !1;
2302
- }
2303
- if (r.type === "PatchStreamSnapshot") {
2304
- const t = this.getOrCreateStreamEntry(r.streamId), s = r.category !== void 0 && t.category !== r.category;
2305
- return r.category !== void 0 && (t.category = r.category), t.store.patchFromOp(r) || s ? (this.notify(r.streamId), !0) : !1;
2306
- }
2307
- if (r.type === "ClearStream") {
2308
- const t = this.streams.get(r.streamId);
2309
- return t ? (t.store.clear(), this.notify(r.streamId), !0) : !1;
2310
- }
2311
- return r.type === "RemoveStream" ? this.streams.delete(r.streamId) ? (this.notify(r.streamId), !0) : !1 : r.type === "SetStreamCategory" ? (this.setCategory(r.streamId, r.category), !0) : !1;
2312
- }
2313
- applyStoreOps(r) {
2314
- for (const t of r)
2315
- this.applyStoreOp(t);
2316
- }
2317
- clear(r) {
2318
- const t = this.streams.get(r);
2319
- t && (t.store.clear(), this.notify(r));
2320
- }
2321
- remove(r) {
2322
- this.streams.delete(r) && this.notify(r);
2323
- }
2324
- setCategory(r, t) {
2325
- const s = this.getOrCreateStreamEntry(r);
2326
- s.category !== t && (s.category = t, this.notify(r));
2327
- }
2328
- getSnapshot(r) {
2329
- const t = this.streams.get(r);
2330
- return t ? {
2331
- ...t.store.getSnapshot(),
2332
- streamId: r,
2333
- category: t.category
2334
- } : void 0;
2335
- }
2336
- getSnapshots() {
2337
- const r = [];
2338
- for (const [t, s] of this.streams) {
2339
- const n = s.store.getSnapshot();
2340
- r.push({
2341
- ...n,
2342
- streamId: t,
2343
- category: s.category
2344
- });
2345
- }
2346
- return r;
2347
- }
2348
- subscribe(r) {
2349
- return this.listeners.add(r), () => {
2350
- this.listeners.delete(r);
2351
- };
2352
- }
2353
- getOrCreateStreamEntry(r) {
2354
- let t = this.streams.get(r);
2355
- return t || (t = { store: new yi() }, this.streams.set(r, t)), t;
2356
- }
2357
- notify(r) {
2358
- for (const t of this.listeners)
2359
- t(r);
2360
- }
2361
- }
2362
- function Oi(e, r, t) {
2363
- if (r.length === 0)
2364
- return e;
2365
- const s = /* @__PURE__ */ new Map();
2366
- for (const n of r)
2367
- s.set(n.nodeId, n);
2368
- return $e(e, s);
2369
- }
2370
- function $e(e, r, t) {
2371
- const s = r.get(e.id);
2372
- let n = e, i = !1;
2373
- if (s?.textUpdates && s.textUpdates.length > 0) {
2374
- const f = Fi(e, s.textUpdates);
2375
- n = f.node, i = f.changed;
2376
- }
2377
- let o = !1, a = n.props;
2378
- if (s?.changedProps && s.changedProps.size > 0)
2379
- for (const [f, A] of s.changedProps.entries()) {
2380
- const u = a[f];
2381
- if (A === void 0)
2382
- (u !== void 0 || f in a) && (o || (a = G(a), o = !0), delete a[f]);
2383
- else if (q(A)) {
2384
- const h = G(A);
2385
- M(h, u) || (o || (a = G(a), o = !0), a[f] = h);
2386
- } else
2387
- M(A, u) || (o || (a = G(a), o = !0), a[f] = A);
2388
- }
2389
- let I = !1, _ = n.styleIds;
2390
- s?.styleIds !== void 0 && (We(n.styleIds, s.styleIds) || (_ = s.styleIds, I = !0));
2391
- const E = n.children ?? [];
2392
- let l = E, c = !1;
2393
- if (s?.removals && s.removals.length > 0 || s?.moves && s.moves.length > 0 || s?.inserts && s.inserts.length > 0) {
2394
- const f = l.slice();
2395
- if (s?.removals && s.removals.length > 0) {
2396
- const A = [...s.removals].sort((u, h) => h.index - u.index);
2397
- for (const u of A)
2398
- if (u.index >= 0 && u.index < f.length && f[u.index].id === u.nodeId)
2399
- f.splice(u.index, 1);
2400
- else {
2401
- const h = f.findIndex((C) => C.id === u.nodeId);
2402
- h >= 0 && f.splice(h, 1);
2403
- }
2404
- c = !0;
2405
- }
2406
- if (s?.moves && s.moves.length > 0) {
2407
- const A = [...s.moves].sort((h, C) => h.toIndex - C.toIndex), u = /* @__PURE__ */ new Map();
2408
- for (const h of A) {
2409
- const C = f.findIndex((z) => z.id === h.nodeId);
2410
- C >= 0 && (u.set(h.nodeId, f[C]), f.splice(C, 1));
2411
- }
2412
- for (const h of A) {
2413
- const C = u.get(h.nodeId);
2414
- if (C) {
2415
- const z = Math.min(h.toIndex, f.length);
2416
- f.splice(z, 0, C);
2417
- }
2418
- }
2419
- c = !0;
2420
- }
2421
- if (s?.inserts && s.inserts.length > 0) {
2422
- const A = [...s.inserts].sort((u, h) => u.index - h.index);
2423
- for (const u of A) {
2424
- f.some((C) => C.id === u.node.id) && Li.warn(`Duplicate node id '${u.node.id}' (type '${u.node.type}') inserted next to an existing sibling — UI tree diverged from the server`);
2425
- const h = Math.min(u.index, f.length);
2426
- f.splice(h, 0, u.node);
2427
- }
2428
- c = !0;
2429
- }
2430
- l = f;
2431
- }
2432
- let d;
2433
- for (let f = 0; f < l.length; f++) {
2434
- const A = l[f], u = $e(A, r);
2435
- u !== A && (d || (d = l.slice()), d[f] = u);
2436
- }
2437
- return d && (l = d, c = !0), i || o || I || c ? !o && !c && !I ? n : {
2438
- id: e.id,
2439
- type: e.type,
2440
- props: o ? a : n.props,
2441
- children: c ? l : E,
2442
- styleIds: I ? _ : n.styleIds,
2443
- ...e.sourceMarker ? { sourceMarker: e.sourceMarker } : {}
2444
- } : e;
2445
- }
2446
- function B(e, r) {
2447
- if (r.add(e.id), e.children)
2448
- for (const t of e.children)
2449
- B(t, r);
2450
- }
2451
- const X = [];
2452
- function mi(e) {
2453
- for (; X.length <= e; )
2454
- X.push(/* @__PURE__ */ new Map());
2455
- return X[e].clear(), X[e];
2456
- }
2457
- function J(e, r, t) {
2458
- Xe(e, r, t, 0);
2459
- }
2460
- function Xe(e, r, t, s) {
2461
- if (e === r)
2462
- return;
2463
- (e.type !== r.type || !Pi(e.props, r.props) || !We(e.styleIds, r.styleIds)) && t.add(r.id);
2464
- const i = e.children ?? [], o = r.children ?? [];
2465
- if (i !== o) {
2466
- const a = mi(s);
2467
- for (const _ of i)
2468
- a.set(_.id, _);
2469
- let I = !1;
2470
- for (let _ = 0; _ < o.length; _++) {
2471
- const E = o[_], l = a.get(E.id);
2472
- l ? (Xe(l, E, t, s + 1), !I && _ < i.length && i[_].id !== E.id && (I = !0)) : (B(E, t), I = !0);
2473
- }
2474
- (i.length !== o.length || I) && t.add(r.id);
2475
- }
2476
- }
2477
- function Pi(e, r) {
2478
- return M(e, r);
2479
- }
2480
- function je(e, r) {
2481
- if (e.id === r)
2482
- return e;
2483
- if (e.children)
2484
- for (const t of e.children) {
2485
- const s = je(t, r);
2486
- if (s)
2487
- return s;
2488
- }
2489
- }
2490
- function We(e, r) {
2491
- return M(e, r);
2492
- }
2493
- function gi(e, r) {
2494
- if (r.length === 0)
2495
- return e;
2496
- const t = [...r].sort((i, o) => i.start - o.start);
2497
- let s = e, n = 0;
2498
- for (const i of t) {
2499
- const o = oe(i.start + n, 0, s.length);
2500
- if (i.end == null) {
2501
- const E = s.slice(o), l = bi(E, i.insertedText);
2502
- s = s.slice(0, o) + i.insertedText + E.slice(l), n += i.insertedText.length - l;
2503
- continue;
2504
- }
2505
- const a = i.end + n, I = oe(a, o, s.length), _ = I - o;
2506
- s = s.slice(0, o) + i.insertedText + s.slice(I), n += i.insertedText.length - _;
2507
- }
2508
- return s;
2509
- }
2510
- function Fi(e, r, t) {
2511
- if (r.length === 0)
2512
- return { node: e, changed: !1 };
2513
- const s = /* @__PURE__ */ new Map();
2514
- for (const n of r) {
2515
- const i = s.get(n.nodeId);
2516
- i ? i.push(n) : s.set(n.nodeId, [n]);
2517
- }
2518
- return ze(e, s);
2519
- }
2520
- function ze(e, r, t) {
2521
- const s = r.get(e.id) ?? [];
2522
- let n = !1, i = e.props;
2523
- if (s.length > 0) {
2524
- const _ = /* @__PURE__ */ new Map();
2525
- for (const E of s) {
2526
- const l = _.get(E.propertyName);
2527
- l ? l.push(E) : _.set(E.propertyName, [E]);
2528
- }
2529
- for (const [E, l] of _.entries()) {
2530
- const c = i[E], d = gi(typeof c == "string" ? c : "", l);
2531
- n || (i = G(i), n = !0), i[E] = d;
2532
- }
2533
- }
2534
- let o = !1;
2535
- const a = e.children ?? [];
2536
- let I = a;
2537
- if (a.length > 0) {
2538
- let _;
2539
- for (let E = 0; E < a.length; E++) {
2540
- const l = a[E], c = ze(l, r);
2541
- c.changed && (_ || (_ = [...a]), _[E] = c.node);
2542
- }
2543
- _ && (I = _, o = !0);
2544
- }
2545
- return !n && !o ? { node: e, changed: !1 } : {
2546
- node: {
2547
- id: e.id,
2548
- type: e.type,
2549
- props: n ? i : e.props,
2550
- children: o ? I : a,
2551
- styleIds: e.styleIds,
2552
- ...e.sourceMarker ? { sourceMarker: e.sourceMarker } : {}
2553
- },
2554
- changed: !0
2555
- };
2556
- }
2557
- function oe(e, r, t) {
2558
- return Math.max(r, Math.min(t, e));
2559
- }
2560
- function bi(e, r) {
2561
- const t = Math.min(e.length, r.length);
2562
- let s = 0;
2563
- for (; s < t && e.charCodeAt(s) === r.charCodeAt(s); )
2564
- s++;
2565
- return s;
2566
- }
2567
- function G(e) {
2568
- const r = {}, t = Object.keys(e);
2569
- for (let s = 0; s < t.length; s++) {
2570
- const n = t[s];
2571
- r[n] = e[n];
2572
- }
2573
- return r;
2574
- }
2575
- function q(e) {
2576
- return typeof e == "object" && e !== null && !Array.isArray(e);
2577
- }
2578
- function M(e, r) {
2579
- if (Object.is(e, r))
2580
- return !0;
2581
- if (Array.isArray(e) && Array.isArray(r)) {
2582
- if (e.length !== r.length)
2583
- return !1;
2584
- for (let t = 0; t < e.length; t++)
2585
- if (!M(e[t], r[t]))
2586
- return !1;
2587
- return !0;
2588
- }
2589
- if (q(e) && q(r)) {
2590
- const t = Object.keys(e), s = Object.keys(r);
2591
- if (t.length !== s.length)
2592
- return !1;
2593
- for (const n of t)
2594
- if (!M(e[n], r[n]))
2595
- return !1;
2596
- return !0;
2597
- }
2598
- return !1;
2599
- }
2600
- const Mi = 16, vi = 50, U = new Ui(), v = /* @__PURE__ */ new Map(), Y = /* @__PURE__ */ new Map();
2601
- let Je = Mi, Qe = vi, V = [], x = null, H = null, y = 0, j = 0;
2602
- const g = /* @__PURE__ */ new Map();
2603
- function ki() {
2604
- return typeof performance < "u" ? performance.now() : Date.now();
2605
- }
2606
- function Gi() {
2607
- try {
2608
- return crypto.randomUUID();
2609
- } catch {
2610
- return `${Date.now()}_${Math.random().toString(16).slice(2)}`;
2611
- }
2612
- }
2613
- function Bi(e) {
2614
- const r = [];
2615
- for (const s of e.views)
2616
- r.push(s);
2617
- const t = [];
2618
- for (const s of e.payloads)
2619
- t.push(s);
2620
- return {
2621
- streamId: e.streamId,
2622
- category: e.category,
2623
- version: e.version ?? -1,
2624
- rootViewId: e.rootViewId,
2625
- views: r,
2626
- payloads: t
2627
- };
2628
- }
2629
- function Vi(e, r, t) {
2630
- if (!t || t.version === -1)
2631
- return { type: "ReplaceStreamSnapshot", snapshot: Bi(r) };
2632
- let s, n;
2633
- for (const [a, I] of r.views)
2634
- t.views.get(a) !== I && (s ??= []).push([a, I]);
2635
- for (const a of t.views.keys())
2636
- r.views.has(a) || (n ??= []).push(a);
2637
- let i, o;
2638
- for (const [a, I] of r.payloads)
2639
- t.payloads.get(a) !== I && (i ??= []).push([a, I]);
2640
- for (const a of t.payloads.keys())
2641
- r.payloads.has(a) || (o ??= []).push(a);
2642
- return {
2643
- type: "PatchStreamSnapshot",
2644
- streamId: e,
2645
- category: r.category,
2646
- nextVersion: r.version ?? -1,
2647
- expectedBaseVersion: t.version ?? -1,
2648
- rootViewId: r.rootViewId,
2649
- upsertViews: s,
2650
- deleteViews: n,
2651
- upsertPayloads: i,
2652
- deletePayloads: o
2653
- };
2654
- }
2655
- function qe() {
2656
- x || (x = setTimeout(ae, Je)), H || (H = setTimeout(ae, Qe));
2657
- }
2658
- function P(e) {
2659
- V.push(e), qe();
2660
- }
2661
- function ae() {
2662
- if (x && (clearTimeout(x), x = null), H && (clearTimeout(H), H = null), V.length === 0 && g.size === 0) {
2663
- y = 0, j = 0;
2664
- return;
2665
- }
2666
- const e = [];
2667
- for (const [t, s] of g)
2668
- e.push({ trackId: t, version: s.version, senderId: s.senderId });
2669
- const r = {
2670
- batchId: Gi(),
2671
- createdAtMs: ki(),
2672
- ops: V,
2673
- ...e.length > 0 ? { acks: e } : {},
2674
- stats: { uiMessagesConsumed: y, bytesConsumed: j }
2675
- };
2676
- V = [], y = 0, j = 0, g.clear(), self.postMessage(r);
2677
- }
2678
- function Ze(e) {
2679
- return `${e.senderId}_${e.trackId}`;
2680
- }
2681
- async function xi(e) {
2682
- const r = await Un(e), t = /* @__PURE__ */ new Set();
2683
- for (const s of Object.values(r.UIStreams ?? {})) {
2684
- const n = s.StreamId;
2685
- t.add(n);
2686
- const i = s.Info?.Category;
2687
- U.getSnapshot(n)?.category !== i && (U.setCategory(n, i), P({ type: "SetStreamCategory", streamId: n, category: i }));
2688
- }
2689
- for (const s of U.getSnapshots())
2690
- t.has(s.streamId) || (U.remove(s.streamId), Y.delete(s.streamId), P({ type: "RemoveStream", streamId: s.streamId }));
2691
- }
2692
- async function Hi(e) {
2693
- const r = Z(e), t = Ze(r), s = await Hs(e), n = Ni(s), i = g.get(r.trackId);
2694
- if ((i === void 0 || n.snapshot.version > i.version) && (g.set(r.trackId, { version: n.snapshot.version, senderId: r.senderId }), qe()), !U.apply(t, n))
2695
- return;
2696
- const a = U.getSnapshot(t);
2697
- if (!a)
2698
- return;
2699
- const I = Y.get(t);
2700
- Y.set(t, a), P(Vi(t, a, I));
2701
- }
2702
- async function Yi(e) {
2703
- const r = await _s(e);
2704
- if (!r.StyleId)
2705
- return;
2706
- const t = {
2707
- styleId: r.StyleId,
2708
- css: r.Style?.css,
2709
- common: r.Style?.common
2710
- }, s = v.get(t.styleId);
2711
- s && s.css === t.css && s.common === t.common || (v.set(t.styleId, t), P({ type: "UpsertUiStyle", style: t }));
2712
- }
2713
- async function pi(e) {
2714
- const r = await Ns(e);
2715
- if (r.Styles)
2716
- for (const t of r.Styles) {
2717
- if (!t.StyleId)
2718
- continue;
2719
- const s = {
2720
- styleId: t.StyleId,
2721
- css: t.Style?.css,
2722
- common: t.Style?.common
2723
- }, n = v.get(s.styleId);
2724
- n && n.css === s.css && n.common === s.common || (v.set(s.styleId, s), P({ type: "UpsertUiStyle", style: s }));
2725
- }
2726
- }
2727
- function Ki(e) {
2728
- const r = Z(e), t = Ze(r);
2729
- U.clear(t), Y.delete(t), P({ type: "ClearStream", streamId: t });
2730
- }
2731
- async function $i(e) {
2732
- const r = await Fs(e);
2733
- if (!(!r.StyleIds || r.StyleIds.length === 0))
2734
- for (const t of r.StyleIds)
2735
- v.delete(t) && P({ type: "RemoveUiStyle", styleId: t });
2736
- }
2737
- async function Xi(e) {
2738
- const r = new Uint8Array(e);
2739
- j += r.byteLength;
2740
- const t = r;
2741
- switch (tt(t)) {
2742
- case m.CORE_GLOBAL_STATE:
2743
- await xi(t), y++;
2744
- return;
2745
- case m.UI_UPDATE:
2746
- try {
2747
- await Hi(t);
2748
- } catch (n) {
2749
- return n instanceof R, void 0;
2750
- } finally {
2751
- y++;
2752
- }
2753
- return;
2754
- case m.UI_STYLES:
2755
- await Yi(t), y++;
2756
- return;
2757
- case m.UI_STYLES_BATCH:
2758
- await pi(t), y++;
2759
- return;
2760
- case m.UI_STYLES_DELETE:
2761
- await $i(t), y++;
2762
- return;
2763
- case m.ACTION_UI_CLEAR_STREAM:
2764
- Ki(t), y++;
2765
- return;
2766
- default:
2767
- return;
2768
- }
2769
- }
2770
- self.addEventListener("message", (e) => {
2771
- const r = e.data;
2772
- if (r.type === "configure") {
2773
- typeof r.flushIntervalMs == "number" && Number.isFinite(r.flushIntervalMs) && r.flushIntervalMs >= 0 && (Je = r.flushIntervalMs), typeof r.maxLatencyMs == "number" && Number.isFinite(r.maxLatencyMs) && r.maxLatencyMs >= 0 && (Qe = r.maxLatencyMs);
2774
- return;
2775
- }
2776
- if (r.type === "clear") {
2777
- V = [], Y.clear(), g.clear(), v.clear();
2778
- for (const t of U.getSnapshots())
2779
- U.remove(t.streamId);
2780
- return;
2781
- }
2782
- r.type === "protocol" && Xi(r.message).catch(() => {
2783
- });
2784
- });