@ikonai/sdk-ui 1.0.2 → 1.0.4

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