@ikonai/sdk-ui 1.0.1 → 1.0.3

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