@code0-tech/definition-reader 0.0.14 → 0.0.16

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.
@@ -0,0 +1,3911 @@
1
+ import { readdirSync as Ve, readFileSync as Ae } from "node:fs";
2
+ import je from "node:path";
3
+ function De(a) {
4
+ let e = typeof a;
5
+ if (e == "object") {
6
+ if (Array.isArray(a))
7
+ return "array";
8
+ if (a === null)
9
+ return "null";
10
+ }
11
+ return e;
12
+ }
13
+ function Pe(a) {
14
+ return a !== null && typeof a == "object" && !Array.isArray(a);
15
+ }
16
+ let K = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""), q = [];
17
+ for (let a = 0; a < K.length; a++)
18
+ q[K[a].charCodeAt(0)] = a;
19
+ q[45] = K.indexOf("+");
20
+ q[95] = K.indexOf("/");
21
+ function _e(a) {
22
+ let e = a.length * 3 / 4;
23
+ a[a.length - 2] == "=" ? e -= 2 : a[a.length - 1] == "=" && (e -= 1);
24
+ let t = new Uint8Array(e), n = 0, r = 0, i, l = 0;
25
+ for (let s = 0; s < a.length; s++) {
26
+ if (i = q[a.charCodeAt(s)], i === void 0)
27
+ switch (a[s]) {
28
+ case "=":
29
+ r = 0;
30
+ // reset state when padding found
31
+ case `
32
+ `:
33
+ case "\r":
34
+ case " ":
35
+ case " ":
36
+ continue;
37
+ // skip white-space, and padding
38
+ default:
39
+ throw Error("invalid base64 string.");
40
+ }
41
+ switch (r) {
42
+ case 0:
43
+ l = i, r = 1;
44
+ break;
45
+ case 1:
46
+ t[n++] = l << 2 | (i & 48) >> 4, l = i, r = 2;
47
+ break;
48
+ case 2:
49
+ t[n++] = (l & 15) << 4 | (i & 60) >> 2, l = i, r = 3;
50
+ break;
51
+ case 3:
52
+ t[n++] = (l & 3) << 6 | i, r = 0;
53
+ break;
54
+ }
55
+ }
56
+ if (r == 1)
57
+ throw Error("invalid base64 string.");
58
+ return t.subarray(0, n);
59
+ }
60
+ function Se(a) {
61
+ let e = "", t = 0, n, r = 0;
62
+ for (let i = 0; i < a.length; i++)
63
+ switch (n = a[i], t) {
64
+ case 0:
65
+ e += K[n >> 2], r = (n & 3) << 4, t = 1;
66
+ break;
67
+ case 1:
68
+ e += K[r | n >> 4], r = (n & 15) << 2, t = 2;
69
+ break;
70
+ case 2:
71
+ e += K[r | n >> 6], e += K[n & 63], t = 0;
72
+ break;
73
+ }
74
+ return t && (e += K[r], e += "=", t == 1 && (e += "=")), e;
75
+ }
76
+ var d;
77
+ (function(a) {
78
+ a.symbol = Symbol.for("protobuf-ts/unknown"), a.onRead = (t, n, r, i, l) => {
79
+ (e(n) ? n[a.symbol] : n[a.symbol] = []).push({ no: r, wireType: i, data: l });
80
+ }, a.onWrite = (t, n, r) => {
81
+ for (let { no: i, wireType: l, data: s } of a.list(n))
82
+ r.tag(i, l).raw(s);
83
+ }, a.list = (t, n) => {
84
+ if (e(t)) {
85
+ let r = t[a.symbol];
86
+ return n ? r.filter((i) => i.no == n) : r;
87
+ }
88
+ return [];
89
+ }, a.last = (t, n) => a.list(t, n).slice(-1)[0];
90
+ const e = (t) => t && Array.isArray(t[a.symbol]);
91
+ })(d || (d = {}));
92
+ var u;
93
+ (function(a) {
94
+ a[a.Varint = 0] = "Varint", a[a.Bit64 = 1] = "Bit64", a[a.LengthDelimited = 2] = "LengthDelimited", a[a.StartGroup = 3] = "StartGroup", a[a.EndGroup = 4] = "EndGroup", a[a.Bit32 = 5] = "Bit32";
95
+ })(u || (u = {}));
96
+ function Me() {
97
+ let a = 0, e = 0;
98
+ for (let n = 0; n < 28; n += 7) {
99
+ let r = this.buf[this.pos++];
100
+ if (a |= (r & 127) << n, (r & 128) == 0)
101
+ return this.assertBounds(), [a, e];
102
+ }
103
+ let t = this.buf[this.pos++];
104
+ if (a |= (t & 15) << 28, e = (t & 112) >> 4, (t & 128) == 0)
105
+ return this.assertBounds(), [a, e];
106
+ for (let n = 3; n <= 31; n += 7) {
107
+ let r = this.buf[this.pos++];
108
+ if (e |= (r & 127) << n, (r & 128) == 0)
109
+ return this.assertBounds(), [a, e];
110
+ }
111
+ throw new Error("invalid varint");
112
+ }
113
+ function Q(a, e, t) {
114
+ for (let i = 0; i < 28; i = i + 7) {
115
+ const l = a >>> i, s = !(!(l >>> 7) && e == 0), o = (s ? l | 128 : l) & 255;
116
+ if (t.push(o), !s)
117
+ return;
118
+ }
119
+ const n = a >>> 28 & 15 | (e & 7) << 4, r = e >> 3 != 0;
120
+ if (t.push((r ? n | 128 : n) & 255), !!r) {
121
+ for (let i = 3; i < 31; i = i + 7) {
122
+ const l = e >>> i, s = !!(l >>> 7), o = (s ? l | 128 : l) & 255;
123
+ if (t.push(o), !s)
124
+ return;
125
+ }
126
+ t.push(e >>> 31 & 1);
127
+ }
128
+ }
129
+ const G = 65536 * 65536;
130
+ function Oe(a) {
131
+ let e = a[0] == "-";
132
+ e && (a = a.slice(1));
133
+ const t = 1e6;
134
+ let n = 0, r = 0;
135
+ function i(l, s) {
136
+ const o = Number(a.slice(l, s));
137
+ r *= t, n = n * t + o, n >= G && (r = r + (n / G | 0), n = n % G);
138
+ }
139
+ return i(-24, -18), i(-18, -12), i(-12, -6), i(-6), [e, n, r];
140
+ }
141
+ function ge(a, e) {
142
+ if (e >>> 0 <= 2097151)
143
+ return "" + (G * e + (a >>> 0));
144
+ let t = a & 16777215, n = (a >>> 24 | e << 8) >>> 0 & 16777215, r = e >> 16 & 65535, i = t + n * 6777216 + r * 6710656, l = n + r * 8147497, s = r * 2, o = 1e7;
145
+ i >= o && (l += Math.floor(i / o), i %= o), l >= o && (s += Math.floor(l / o), l %= o);
146
+ function f(h, g) {
147
+ let k = h ? String(h) : "";
148
+ return g ? "0000000".slice(k.length) + k : k;
149
+ }
150
+ return f(
151
+ s,
152
+ /*needLeadingZeros=*/
153
+ 0
154
+ ) + f(
155
+ l,
156
+ /*needLeadingZeros=*/
157
+ s
158
+ ) + // If the final 1e7 digit didn't need leading zeros, we would have
159
+ // returned via the trivial code path at the top.
160
+ f(
161
+ i,
162
+ /*needLeadingZeros=*/
163
+ 1
164
+ );
165
+ }
166
+ function Te(a, e) {
167
+ if (a >= 0) {
168
+ for (; a > 127; )
169
+ e.push(a & 127 | 128), a = a >>> 7;
170
+ e.push(a);
171
+ } else {
172
+ for (let t = 0; t < 9; t++)
173
+ e.push(a & 127 | 128), a = a >> 7;
174
+ e.push(1);
175
+ }
176
+ }
177
+ function Xe() {
178
+ let a = this.buf[this.pos++], e = a & 127;
179
+ if ((a & 128) == 0)
180
+ return this.assertBounds(), e;
181
+ if (a = this.buf[this.pos++], e |= (a & 127) << 7, (a & 128) == 0)
182
+ return this.assertBounds(), e;
183
+ if (a = this.buf[this.pos++], e |= (a & 127) << 14, (a & 128) == 0)
184
+ return this.assertBounds(), e;
185
+ if (a = this.buf[this.pos++], e |= (a & 127) << 21, (a & 128) == 0)
186
+ return this.assertBounds(), e;
187
+ a = this.buf[this.pos++], e |= (a & 15) << 28;
188
+ for (let t = 5; (a & 128) !== 0 && t < 10; t++)
189
+ a = this.buf[this.pos++];
190
+ if ((a & 128) != 0)
191
+ throw new Error("invalid varint");
192
+ return this.assertBounds(), e >>> 0;
193
+ }
194
+ let T;
195
+ function Ge() {
196
+ const a = new DataView(new ArrayBuffer(8));
197
+ T = globalThis.BigInt !== void 0 && typeof a.getBigInt64 == "function" && typeof a.getBigUint64 == "function" && typeof a.setBigInt64 == "function" && typeof a.setBigUint64 == "function" ? {
198
+ MIN: BigInt("-9223372036854775808"),
199
+ MAX: BigInt("9223372036854775807"),
200
+ UMIN: BigInt("0"),
201
+ UMAX: BigInt("18446744073709551615"),
202
+ C: BigInt,
203
+ V: a
204
+ } : void 0;
205
+ }
206
+ Ge();
207
+ function Fe(a) {
208
+ if (!a)
209
+ throw new Error("BigInt unavailable, see https://github.com/timostamm/protobuf-ts/blob/v1.0.8/MANUAL.md#bigint-support");
210
+ }
211
+ const Ue = /^-?[0-9]+$/, J = 4294967296, M = 2147483648;
212
+ class $e {
213
+ /**
214
+ * Create a new instance with the given bits.
215
+ */
216
+ constructor(e, t) {
217
+ this.lo = e | 0, this.hi = t | 0;
218
+ }
219
+ /**
220
+ * Is this instance equal to 0?
221
+ */
222
+ isZero() {
223
+ return this.lo == 0 && this.hi == 0;
224
+ }
225
+ /**
226
+ * Convert to a native number.
227
+ */
228
+ toNumber() {
229
+ let e = this.hi * J + (this.lo >>> 0);
230
+ if (!Number.isSafeInteger(e))
231
+ throw new Error("cannot convert to safe number");
232
+ return e;
233
+ }
234
+ }
235
+ class B extends $e {
236
+ /**
237
+ * Create instance from a `string`, `number` or `bigint`.
238
+ */
239
+ static from(e) {
240
+ if (T)
241
+ switch (typeof e) {
242
+ case "string":
243
+ if (e == "0")
244
+ return this.ZERO;
245
+ if (e == "")
246
+ throw new Error("string is no integer");
247
+ e = T.C(e);
248
+ case "number":
249
+ if (e === 0)
250
+ return this.ZERO;
251
+ e = T.C(e);
252
+ case "bigint":
253
+ if (!e)
254
+ return this.ZERO;
255
+ if (e < T.UMIN)
256
+ throw new Error("signed value for ulong");
257
+ if (e > T.UMAX)
258
+ throw new Error("ulong too large");
259
+ return T.V.setBigUint64(0, e, !0), new B(T.V.getInt32(0, !0), T.V.getInt32(4, !0));
260
+ }
261
+ else
262
+ switch (typeof e) {
263
+ case "string":
264
+ if (e == "0")
265
+ return this.ZERO;
266
+ if (e = e.trim(), !Ue.test(e))
267
+ throw new Error("string is no integer");
268
+ let [t, n, r] = Oe(e);
269
+ if (t)
270
+ throw new Error("signed value for ulong");
271
+ return new B(n, r);
272
+ case "number":
273
+ if (e == 0)
274
+ return this.ZERO;
275
+ if (!Number.isSafeInteger(e))
276
+ throw new Error("number is no integer");
277
+ if (e < 0)
278
+ throw new Error("signed value for ulong");
279
+ return new B(e, e / J);
280
+ }
281
+ throw new Error("unknown value " + typeof e);
282
+ }
283
+ /**
284
+ * Convert to decimal string.
285
+ */
286
+ toString() {
287
+ return T ? this.toBigInt().toString() : ge(this.lo, this.hi);
288
+ }
289
+ /**
290
+ * Convert to native bigint.
291
+ */
292
+ toBigInt() {
293
+ return Fe(T), T.V.setInt32(0, this.lo, !0), T.V.setInt32(4, this.hi, !0), T.V.getBigUint64(0, !0);
294
+ }
295
+ }
296
+ B.ZERO = new B(0, 0);
297
+ class N extends $e {
298
+ /**
299
+ * Create instance from a `string`, `number` or `bigint`.
300
+ */
301
+ static from(e) {
302
+ if (T)
303
+ switch (typeof e) {
304
+ case "string":
305
+ if (e == "0")
306
+ return this.ZERO;
307
+ if (e == "")
308
+ throw new Error("string is no integer");
309
+ e = T.C(e);
310
+ case "number":
311
+ if (e === 0)
312
+ return this.ZERO;
313
+ e = T.C(e);
314
+ case "bigint":
315
+ if (!e)
316
+ return this.ZERO;
317
+ if (e < T.MIN)
318
+ throw new Error("signed long too small");
319
+ if (e > T.MAX)
320
+ throw new Error("signed long too large");
321
+ return T.V.setBigInt64(0, e, !0), new N(T.V.getInt32(0, !0), T.V.getInt32(4, !0));
322
+ }
323
+ else
324
+ switch (typeof e) {
325
+ case "string":
326
+ if (e == "0")
327
+ return this.ZERO;
328
+ if (e = e.trim(), !Ue.test(e))
329
+ throw new Error("string is no integer");
330
+ let [t, n, r] = Oe(e);
331
+ if (t) {
332
+ if (r > M || r == M && n != 0)
333
+ throw new Error("signed long too small");
334
+ } else if (r >= M)
335
+ throw new Error("signed long too large");
336
+ let i = new N(n, r);
337
+ return t ? i.negate() : i;
338
+ case "number":
339
+ if (e == 0)
340
+ return this.ZERO;
341
+ if (!Number.isSafeInteger(e))
342
+ throw new Error("number is no integer");
343
+ return e > 0 ? new N(e, e / J) : new N(-e, -e / J).negate();
344
+ }
345
+ throw new Error("unknown value " + typeof e);
346
+ }
347
+ /**
348
+ * Do we have a minus sign?
349
+ */
350
+ isNegative() {
351
+ return (this.hi & M) !== 0;
352
+ }
353
+ /**
354
+ * Negate two's complement.
355
+ * Invert all the bits and add one to the result.
356
+ */
357
+ negate() {
358
+ let e = ~this.hi, t = this.lo;
359
+ return t ? t = ~t + 1 : e += 1, new N(t, e);
360
+ }
361
+ /**
362
+ * Convert to decimal string.
363
+ */
364
+ toString() {
365
+ if (T)
366
+ return this.toBigInt().toString();
367
+ if (this.isNegative()) {
368
+ let e = this.negate();
369
+ return "-" + ge(e.lo, e.hi);
370
+ }
371
+ return ge(this.lo, this.hi);
372
+ }
373
+ /**
374
+ * Convert to native bigint.
375
+ */
376
+ toBigInt() {
377
+ return Fe(T), T.V.setInt32(0, this.lo, !0), T.V.setInt32(4, this.hi, !0), T.V.getBigInt64(0, !0);
378
+ }
379
+ }
380
+ N.ZERO = new N(0, 0);
381
+ const be = {
382
+ readUnknownField: !0,
383
+ readerFactory: (a) => new Ye(a)
384
+ };
385
+ function Je(a) {
386
+ return a ? Object.assign(Object.assign({}, be), a) : be;
387
+ }
388
+ class Ye {
389
+ constructor(e, t) {
390
+ this.varint64 = Me, this.uint32 = Xe, this.buf = e, this.len = e.length, this.pos = 0, this.view = new DataView(e.buffer, e.byteOffset, e.byteLength), this.textDecoder = t ?? new TextDecoder("utf-8", {
391
+ fatal: !0,
392
+ ignoreBOM: !0
393
+ });
394
+ }
395
+ /**
396
+ * Reads a tag - field number and wire type.
397
+ */
398
+ tag() {
399
+ let e = this.uint32(), t = e >>> 3, n = e & 7;
400
+ if (t <= 0 || n < 0 || n > 5)
401
+ throw new Error("illegal tag: field no " + t + " wire type " + n);
402
+ return [t, n];
403
+ }
404
+ /**
405
+ * Skip one element on the wire and return the skipped data.
406
+ * Supports WireType.StartGroup since v2.0.0-alpha.23.
407
+ */
408
+ skip(e) {
409
+ let t = this.pos;
410
+ switch (e) {
411
+ case u.Varint:
412
+ for (; this.buf[this.pos++] & 128; )
413
+ ;
414
+ break;
415
+ case u.Bit64:
416
+ this.pos += 4;
417
+ case u.Bit32:
418
+ this.pos += 4;
419
+ break;
420
+ case u.LengthDelimited:
421
+ let n = this.uint32();
422
+ this.pos += n;
423
+ break;
424
+ case u.StartGroup:
425
+ let r;
426
+ for (; (r = this.tag()[1]) !== u.EndGroup; )
427
+ this.skip(r);
428
+ break;
429
+ default:
430
+ throw new Error("cant skip wire type " + e);
431
+ }
432
+ return this.assertBounds(), this.buf.subarray(t, this.pos);
433
+ }
434
+ /**
435
+ * Throws error if position in byte array is out of range.
436
+ */
437
+ assertBounds() {
438
+ if (this.pos > this.len)
439
+ throw new RangeError("premature EOF");
440
+ }
441
+ /**
442
+ * Read a `int32` field, a signed 32 bit varint.
443
+ */
444
+ int32() {
445
+ return this.uint32() | 0;
446
+ }
447
+ /**
448
+ * Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
449
+ */
450
+ sint32() {
451
+ let e = this.uint32();
452
+ return e >>> 1 ^ -(e & 1);
453
+ }
454
+ /**
455
+ * Read a `int64` field, a signed 64-bit varint.
456
+ */
457
+ int64() {
458
+ return new N(...this.varint64());
459
+ }
460
+ /**
461
+ * Read a `uint64` field, an unsigned 64-bit varint.
462
+ */
463
+ uint64() {
464
+ return new B(...this.varint64());
465
+ }
466
+ /**
467
+ * Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
468
+ */
469
+ sint64() {
470
+ let [e, t] = this.varint64(), n = -(e & 1);
471
+ return e = (e >>> 1 | (t & 1) << 31) ^ n, t = t >>> 1 ^ n, new N(e, t);
472
+ }
473
+ /**
474
+ * Read a `bool` field, a variant.
475
+ */
476
+ bool() {
477
+ let [e, t] = this.varint64();
478
+ return e !== 0 || t !== 0;
479
+ }
480
+ /**
481
+ * Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
482
+ */
483
+ fixed32() {
484
+ return this.view.getUint32((this.pos += 4) - 4, !0);
485
+ }
486
+ /**
487
+ * Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
488
+ */
489
+ sfixed32() {
490
+ return this.view.getInt32((this.pos += 4) - 4, !0);
491
+ }
492
+ /**
493
+ * Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
494
+ */
495
+ fixed64() {
496
+ return new B(this.sfixed32(), this.sfixed32());
497
+ }
498
+ /**
499
+ * Read a `fixed64` field, a signed, fixed-length 64-bit integer.
500
+ */
501
+ sfixed64() {
502
+ return new N(this.sfixed32(), this.sfixed32());
503
+ }
504
+ /**
505
+ * Read a `float` field, 32-bit floating point number.
506
+ */
507
+ float() {
508
+ return this.view.getFloat32((this.pos += 4) - 4, !0);
509
+ }
510
+ /**
511
+ * Read a `double` field, a 64-bit floating point number.
512
+ */
513
+ double() {
514
+ return this.view.getFloat64((this.pos += 8) - 8, !0);
515
+ }
516
+ /**
517
+ * Read a `bytes` field, length-delimited arbitrary data.
518
+ */
519
+ bytes() {
520
+ let e = this.uint32(), t = this.pos;
521
+ return this.pos += e, this.assertBounds(), this.buf.subarray(t, t + e);
522
+ }
523
+ /**
524
+ * Read a `string` field, length-delimited data converted to UTF-8 text.
525
+ */
526
+ string() {
527
+ return this.textDecoder.decode(this.bytes());
528
+ }
529
+ }
530
+ function y(a, e) {
531
+ if (!a)
532
+ throw new Error(e);
533
+ }
534
+ const Ze = 34028234663852886e22, ve = -34028234663852886e22, qe = 4294967295, ze = 2147483647, Qe = -2147483648;
535
+ function _(a) {
536
+ if (typeof a != "number")
537
+ throw new Error("invalid int 32: " + typeof a);
538
+ if (!Number.isInteger(a) || a > ze || a < Qe)
539
+ throw new Error("invalid int 32: " + a);
540
+ }
541
+ function Y(a) {
542
+ if (typeof a != "number")
543
+ throw new Error("invalid uint 32: " + typeof a);
544
+ if (!Number.isInteger(a) || a > qe || a < 0)
545
+ throw new Error("invalid uint 32: " + a);
546
+ }
547
+ function ke(a) {
548
+ if (typeof a != "number")
549
+ throw new Error("invalid float 32: " + typeof a);
550
+ if (Number.isFinite(a) && (a > Ze || a < ve))
551
+ throw new Error("invalid float 32: " + a);
552
+ }
553
+ const we = {
554
+ writeUnknownFields: !0,
555
+ writerFactory: () => new et()
556
+ };
557
+ function He(a) {
558
+ return a ? Object.assign(Object.assign({}, we), a) : we;
559
+ }
560
+ class et {
561
+ constructor(e) {
562
+ this.stack = [], this.textEncoder = e ?? new TextEncoder(), this.chunks = [], this.buf = [];
563
+ }
564
+ /**
565
+ * Return all bytes written and reset this writer.
566
+ */
567
+ finish() {
568
+ this.chunks.push(new Uint8Array(this.buf));
569
+ let e = 0;
570
+ for (let r = 0; r < this.chunks.length; r++)
571
+ e += this.chunks[r].length;
572
+ let t = new Uint8Array(e), n = 0;
573
+ for (let r = 0; r < this.chunks.length; r++)
574
+ t.set(this.chunks[r], n), n += this.chunks[r].length;
575
+ return this.chunks = [], t;
576
+ }
577
+ /**
578
+ * Start a new fork for length-delimited data like a message
579
+ * or a packed repeated field.
580
+ *
581
+ * Must be joined later with `join()`.
582
+ */
583
+ fork() {
584
+ return this.stack.push({ chunks: this.chunks, buf: this.buf }), this.chunks = [], this.buf = [], this;
585
+ }
586
+ /**
587
+ * Join the last fork. Write its length and bytes, then
588
+ * return to the previous state.
589
+ */
590
+ join() {
591
+ let e = this.finish(), t = this.stack.pop();
592
+ if (!t)
593
+ throw new Error("invalid state, fork stack empty");
594
+ return this.chunks = t.chunks, this.buf = t.buf, this.uint32(e.byteLength), this.raw(e);
595
+ }
596
+ /**
597
+ * Writes a tag (field number and wire type).
598
+ *
599
+ * Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
600
+ *
601
+ * Generated code should compute the tag ahead of time and call `uint32()`.
602
+ */
603
+ tag(e, t) {
604
+ return this.uint32((e << 3 | t) >>> 0);
605
+ }
606
+ /**
607
+ * Write a chunk of raw bytes.
608
+ */
609
+ raw(e) {
610
+ return this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []), this.chunks.push(e), this;
611
+ }
612
+ /**
613
+ * Write a `uint32` value, an unsigned 32 bit varint.
614
+ */
615
+ uint32(e) {
616
+ for (Y(e); e > 127; )
617
+ this.buf.push(e & 127 | 128), e = e >>> 7;
618
+ return this.buf.push(e), this;
619
+ }
620
+ /**
621
+ * Write a `int32` value, a signed 32 bit varint.
622
+ */
623
+ int32(e) {
624
+ return _(e), Te(e, this.buf), this;
625
+ }
626
+ /**
627
+ * Write a `bool` value, a variant.
628
+ */
629
+ bool(e) {
630
+ return this.buf.push(e ? 1 : 0), this;
631
+ }
632
+ /**
633
+ * Write a `bytes` value, length-delimited arbitrary data.
634
+ */
635
+ bytes(e) {
636
+ return this.uint32(e.byteLength), this.raw(e);
637
+ }
638
+ /**
639
+ * Write a `string` value, length-delimited data converted to UTF-8 text.
640
+ */
641
+ string(e) {
642
+ let t = this.textEncoder.encode(e);
643
+ return this.uint32(t.byteLength), this.raw(t);
644
+ }
645
+ /**
646
+ * Write a `float` value, 32-bit floating point number.
647
+ */
648
+ float(e) {
649
+ ke(e);
650
+ let t = new Uint8Array(4);
651
+ return new DataView(t.buffer).setFloat32(0, e, !0), this.raw(t);
652
+ }
653
+ /**
654
+ * Write a `double` value, a 64-bit floating point number.
655
+ */
656
+ double(e) {
657
+ let t = new Uint8Array(8);
658
+ return new DataView(t.buffer).setFloat64(0, e, !0), this.raw(t);
659
+ }
660
+ /**
661
+ * Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
662
+ */
663
+ fixed32(e) {
664
+ Y(e);
665
+ let t = new Uint8Array(4);
666
+ return new DataView(t.buffer).setUint32(0, e, !0), this.raw(t);
667
+ }
668
+ /**
669
+ * Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
670
+ */
671
+ sfixed32(e) {
672
+ _(e);
673
+ let t = new Uint8Array(4);
674
+ return new DataView(t.buffer).setInt32(0, e, !0), this.raw(t);
675
+ }
676
+ /**
677
+ * Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
678
+ */
679
+ sint32(e) {
680
+ return _(e), e = (e << 1 ^ e >> 31) >>> 0, Te(e, this.buf), this;
681
+ }
682
+ /**
683
+ * Write a `fixed64` value, a signed, fixed-length 64-bit integer.
684
+ */
685
+ sfixed64(e) {
686
+ let t = new Uint8Array(8), n = new DataView(t.buffer), r = N.from(e);
687
+ return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
688
+ }
689
+ /**
690
+ * Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
691
+ */
692
+ fixed64(e) {
693
+ let t = new Uint8Array(8), n = new DataView(t.buffer), r = B.from(e);
694
+ return n.setInt32(0, r.lo, !0), n.setInt32(4, r.hi, !0), this.raw(t);
695
+ }
696
+ /**
697
+ * Write a `int64` value, a signed 64-bit varint.
698
+ */
699
+ int64(e) {
700
+ let t = N.from(e);
701
+ return Q(t.lo, t.hi, this.buf), this;
702
+ }
703
+ /**
704
+ * Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
705
+ */
706
+ sint64(e) {
707
+ let t = N.from(e), n = t.hi >> 31, r = t.lo << 1 ^ n, i = (t.hi << 1 | t.lo >>> 31) ^ n;
708
+ return Q(r, i, this.buf), this;
709
+ }
710
+ /**
711
+ * Write a `uint64` value, an unsigned 64-bit varint.
712
+ */
713
+ uint64(e) {
714
+ let t = B.from(e);
715
+ return Q(t.lo, t.hi, this.buf), this;
716
+ }
717
+ }
718
+ const Ne = {
719
+ emitDefaultValues: !1,
720
+ enumAsInteger: !1,
721
+ useProtoFieldName: !1,
722
+ prettySpaces: 0
723
+ }, Ie = {
724
+ ignoreUnknownFields: !1
725
+ };
726
+ function tt(a) {
727
+ return a ? Object.assign(Object.assign({}, Ie), a) : Ie;
728
+ }
729
+ function nt(a) {
730
+ return a ? Object.assign(Object.assign({}, Ne), a) : Ne;
731
+ }
732
+ const Le = Symbol.for("protobuf-ts/message-type");
733
+ function Be(a) {
734
+ let e = !1;
735
+ const t = [];
736
+ for (let n = 0; n < a.length; n++) {
737
+ let r = a.charAt(n);
738
+ r == "_" ? e = !0 : /\d/.test(r) ? (t.push(r), e = !0) : e ? (t.push(r.toUpperCase()), e = !1) : n == 0 ? t.push(r.toLowerCase()) : t.push(r);
739
+ }
740
+ return t.join("");
741
+ }
742
+ var c;
743
+ (function(a) {
744
+ a[a.DOUBLE = 1] = "DOUBLE", a[a.FLOAT = 2] = "FLOAT", a[a.INT64 = 3] = "INT64", a[a.UINT64 = 4] = "UINT64", a[a.INT32 = 5] = "INT32", a[a.FIXED64 = 6] = "FIXED64", a[a.FIXED32 = 7] = "FIXED32", a[a.BOOL = 8] = "BOOL", a[a.STRING = 9] = "STRING", a[a.BYTES = 12] = "BYTES", a[a.UINT32 = 13] = "UINT32", a[a.SFIXED32 = 15] = "SFIXED32", a[a.SFIXED64 = 16] = "SFIXED64", a[a.SINT32 = 17] = "SINT32", a[a.SINT64 = 18] = "SINT64";
745
+ })(c || (c = {}));
746
+ var F;
747
+ (function(a) {
748
+ a[a.BIGINT = 0] = "BIGINT", a[a.STRING = 1] = "STRING", a[a.NUMBER = 2] = "NUMBER";
749
+ })(F || (F = {}));
750
+ var Z;
751
+ (function(a) {
752
+ a[a.NO = 0] = "NO", a[a.PACKED = 1] = "PACKED", a[a.UNPACKED = 2] = "UNPACKED";
753
+ })(Z || (Z = {}));
754
+ function it(a) {
755
+ var e, t, n, r;
756
+ return a.localName = (e = a.localName) !== null && e !== void 0 ? e : Be(a.name), a.jsonName = (t = a.jsonName) !== null && t !== void 0 ? t : Be(a.name), a.repeat = (n = a.repeat) !== null && n !== void 0 ? n : Z.NO, a.opt = (r = a.opt) !== null && r !== void 0 ? r : a.repeat || a.oneof ? !1 : a.kind == "message", a;
757
+ }
758
+ function rt(a) {
759
+ if (typeof a != "object" || a === null || !a.hasOwnProperty("oneofKind"))
760
+ return !1;
761
+ switch (typeof a.oneofKind) {
762
+ case "string":
763
+ return a[a.oneofKind] === void 0 ? !1 : Object.keys(a).length == 2;
764
+ case "undefined":
765
+ return Object.keys(a).length == 1;
766
+ default:
767
+ return !1;
768
+ }
769
+ }
770
+ class at {
771
+ constructor(e) {
772
+ var t;
773
+ this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
774
+ }
775
+ prepare() {
776
+ if (this.data)
777
+ return;
778
+ const e = [], t = [], n = [];
779
+ for (let r of this.fields)
780
+ if (r.oneof)
781
+ n.includes(r.oneof) || (n.push(r.oneof), e.push(r.oneof), t.push(r.oneof));
782
+ else
783
+ switch (t.push(r.localName), r.kind) {
784
+ case "scalar":
785
+ case "enum":
786
+ (!r.opt || r.repeat) && e.push(r.localName);
787
+ break;
788
+ case "message":
789
+ r.repeat && e.push(r.localName);
790
+ break;
791
+ case "map":
792
+ e.push(r.localName);
793
+ break;
794
+ }
795
+ this.data = { req: e, known: t, oneofs: Object.values(n) };
796
+ }
797
+ /**
798
+ * Is the argument a valid message as specified by the
799
+ * reflection information?
800
+ *
801
+ * Checks all field types recursively. The `depth`
802
+ * specifies how deep into the structure the check will be.
803
+ *
804
+ * With a depth of 0, only the presence of fields
805
+ * is checked.
806
+ *
807
+ * With a depth of 1 or more, the field types are checked.
808
+ *
809
+ * With a depth of 2 or more, the members of map, repeated
810
+ * and message fields are checked.
811
+ *
812
+ * Message fields will be checked recursively with depth - 1.
813
+ *
814
+ * The number of map entries / repeated values being checked
815
+ * is < depth.
816
+ */
817
+ is(e, t, n = !1) {
818
+ if (t < 0)
819
+ return !0;
820
+ if (e == null || typeof e != "object")
821
+ return !1;
822
+ this.prepare();
823
+ let r = Object.keys(e), i = this.data;
824
+ if (r.length < i.req.length || i.req.some((l) => !r.includes(l)) || !n && r.some((l) => !i.known.includes(l)))
825
+ return !1;
826
+ if (t < 1)
827
+ return !0;
828
+ for (const l of i.oneofs) {
829
+ const s = e[l];
830
+ if (!rt(s))
831
+ return !1;
832
+ if (s.oneofKind === void 0)
833
+ continue;
834
+ const o = this.fields.find((f) => f.localName === s.oneofKind);
835
+ if (!o || !this.field(s[s.oneofKind], o, n, t))
836
+ return !1;
837
+ }
838
+ for (const l of this.fields)
839
+ if (l.oneof === void 0 && !this.field(e[l.localName], l, n, t))
840
+ return !1;
841
+ return !0;
842
+ }
843
+ field(e, t, n, r) {
844
+ let i = t.repeat;
845
+ switch (t.kind) {
846
+ case "scalar":
847
+ return e === void 0 ? t.opt : i ? this.scalars(e, t.T, r, t.L) : this.scalar(e, t.T, t.L);
848
+ case "enum":
849
+ return e === void 0 ? t.opt : i ? this.scalars(e, c.INT32, r) : this.scalar(e, c.INT32);
850
+ case "message":
851
+ return e === void 0 ? !0 : i ? this.messages(e, t.T(), n, r) : this.message(e, t.T(), n, r);
852
+ case "map":
853
+ if (typeof e != "object" || e === null)
854
+ return !1;
855
+ if (r < 2)
856
+ return !0;
857
+ if (!this.mapKeys(e, t.K, r))
858
+ return !1;
859
+ switch (t.V.kind) {
860
+ case "scalar":
861
+ return this.scalars(Object.values(e), t.V.T, r, t.V.L);
862
+ case "enum":
863
+ return this.scalars(Object.values(e), c.INT32, r);
864
+ case "message":
865
+ return this.messages(Object.values(e), t.V.T(), n, r);
866
+ }
867
+ break;
868
+ }
869
+ return !0;
870
+ }
871
+ message(e, t, n, r) {
872
+ return n ? t.isAssignable(e, r) : t.is(e, r);
873
+ }
874
+ messages(e, t, n, r) {
875
+ if (!Array.isArray(e))
876
+ return !1;
877
+ if (r < 2)
878
+ return !0;
879
+ if (n) {
880
+ for (let i = 0; i < e.length && i < r; i++)
881
+ if (!t.isAssignable(e[i], r - 1))
882
+ return !1;
883
+ } else
884
+ for (let i = 0; i < e.length && i < r; i++)
885
+ if (!t.is(e[i], r - 1))
886
+ return !1;
887
+ return !0;
888
+ }
889
+ scalar(e, t, n) {
890
+ let r = typeof e;
891
+ switch (t) {
892
+ case c.UINT64:
893
+ case c.FIXED64:
894
+ case c.INT64:
895
+ case c.SFIXED64:
896
+ case c.SINT64:
897
+ switch (n) {
898
+ case F.BIGINT:
899
+ return r == "bigint";
900
+ case F.NUMBER:
901
+ return r == "number" && !isNaN(e);
902
+ default:
903
+ return r == "string";
904
+ }
905
+ case c.BOOL:
906
+ return r == "boolean";
907
+ case c.STRING:
908
+ return r == "string";
909
+ case c.BYTES:
910
+ return e instanceof Uint8Array;
911
+ case c.DOUBLE:
912
+ case c.FLOAT:
913
+ return r == "number" && !isNaN(e);
914
+ default:
915
+ return r == "number" && Number.isInteger(e);
916
+ }
917
+ }
918
+ scalars(e, t, n, r) {
919
+ if (!Array.isArray(e))
920
+ return !1;
921
+ if (n < 2)
922
+ return !0;
923
+ if (Array.isArray(e)) {
924
+ for (let i = 0; i < e.length && i < n; i++)
925
+ if (!this.scalar(e[i], t, r))
926
+ return !1;
927
+ }
928
+ return !0;
929
+ }
930
+ mapKeys(e, t, n) {
931
+ let r = Object.keys(e);
932
+ switch (t) {
933
+ case c.INT32:
934
+ case c.FIXED32:
935
+ case c.SFIXED32:
936
+ case c.SINT32:
937
+ case c.UINT32:
938
+ return this.scalars(r.slice(0, n).map((i) => parseInt(i)), t, n);
939
+ case c.BOOL:
940
+ return this.scalars(r.slice(0, n).map((i) => i == "true" ? !0 : i == "false" ? !1 : i), t, n);
941
+ default:
942
+ return this.scalars(r, t, n, F.STRING);
943
+ }
944
+ }
945
+ }
946
+ function O(a, e) {
947
+ switch (e) {
948
+ case F.BIGINT:
949
+ return a.toBigInt();
950
+ case F.NUMBER:
951
+ return a.toNumber();
952
+ default:
953
+ return a.toString();
954
+ }
955
+ }
956
+ class st {
957
+ constructor(e) {
958
+ this.info = e;
959
+ }
960
+ prepare() {
961
+ var e;
962
+ if (this.fMap === void 0) {
963
+ this.fMap = {};
964
+ const t = (e = this.info.fields) !== null && e !== void 0 ? e : [];
965
+ for (const n of t)
966
+ this.fMap[n.name] = n, this.fMap[n.jsonName] = n, this.fMap[n.localName] = n;
967
+ }
968
+ }
969
+ // Cannot parse JSON <type of jsonValue> for <type name>#<fieldName>.
970
+ assert(e, t, n) {
971
+ if (!e) {
972
+ let r = De(n);
973
+ throw (r == "number" || r == "boolean") && (r = n.toString()), new Error(`Cannot parse JSON ${r} for ${this.info.typeName}#${t}`);
974
+ }
975
+ }
976
+ /**
977
+ * Reads a message from canonical JSON format into the target message.
978
+ *
979
+ * Repeated fields are appended. Map entries are added, overwriting
980
+ * existing keys.
981
+ *
982
+ * If a message field is already present, it will be merged with the
983
+ * new data.
984
+ */
985
+ read(e, t, n) {
986
+ this.prepare();
987
+ const r = [];
988
+ for (const [i, l] of Object.entries(e)) {
989
+ const s = this.fMap[i];
990
+ if (!s) {
991
+ if (!n.ignoreUnknownFields)
992
+ throw new Error(`Found unknown field while reading ${this.info.typeName} from JSON format. JSON key: ${i}`);
993
+ continue;
994
+ }
995
+ const o = s.localName;
996
+ let f;
997
+ if (s.oneof) {
998
+ if (l === null && (s.kind !== "enum" || s.T()[0] !== "google.protobuf.NullValue"))
999
+ continue;
1000
+ if (r.includes(s.oneof))
1001
+ throw new Error(`Multiple members of the oneof group "${s.oneof}" of ${this.info.typeName} are present in JSON.`);
1002
+ r.push(s.oneof), f = t[s.oneof] = {
1003
+ oneofKind: o
1004
+ };
1005
+ } else
1006
+ f = t;
1007
+ if (s.kind == "map") {
1008
+ if (l === null)
1009
+ continue;
1010
+ this.assert(Pe(l), s.name, l);
1011
+ const h = f[o];
1012
+ for (const [g, k] of Object.entries(l)) {
1013
+ this.assert(k !== null, s.name + " map value", null);
1014
+ let R;
1015
+ switch (s.V.kind) {
1016
+ case "message":
1017
+ R = s.V.T().internalJsonRead(k, n);
1018
+ break;
1019
+ case "enum":
1020
+ if (R = this.enum(s.V.T(), k, s.name, n.ignoreUnknownFields), R === !1)
1021
+ continue;
1022
+ break;
1023
+ case "scalar":
1024
+ R = this.scalar(k, s.V.T, s.V.L, s.name);
1025
+ break;
1026
+ }
1027
+ this.assert(R !== void 0, s.name + " map value", k);
1028
+ let U = g;
1029
+ s.K == c.BOOL && (U = U == "true" ? !0 : U == "false" ? !1 : U), U = this.scalar(U, s.K, F.STRING, s.name).toString(), h[U] = R;
1030
+ }
1031
+ } else if (s.repeat) {
1032
+ if (l === null)
1033
+ continue;
1034
+ this.assert(Array.isArray(l), s.name, l);
1035
+ const h = f[o];
1036
+ for (const g of l) {
1037
+ this.assert(g !== null, s.name, null);
1038
+ let k;
1039
+ switch (s.kind) {
1040
+ case "message":
1041
+ k = s.T().internalJsonRead(g, n);
1042
+ break;
1043
+ case "enum":
1044
+ if (k = this.enum(s.T(), g, s.name, n.ignoreUnknownFields), k === !1)
1045
+ continue;
1046
+ break;
1047
+ case "scalar":
1048
+ k = this.scalar(g, s.T, s.L, s.name);
1049
+ break;
1050
+ }
1051
+ this.assert(k !== void 0, s.name, l), h.push(k);
1052
+ }
1053
+ } else
1054
+ switch (s.kind) {
1055
+ case "message":
1056
+ if (l === null && s.T().typeName != "google.protobuf.Value") {
1057
+ this.assert(s.oneof === void 0, s.name + " (oneof member)", null);
1058
+ continue;
1059
+ }
1060
+ f[o] = s.T().internalJsonRead(l, n, f[o]);
1061
+ break;
1062
+ case "enum":
1063
+ if (l === null)
1064
+ continue;
1065
+ let h = this.enum(s.T(), l, s.name, n.ignoreUnknownFields);
1066
+ if (h === !1)
1067
+ continue;
1068
+ f[o] = h;
1069
+ break;
1070
+ case "scalar":
1071
+ if (l === null)
1072
+ continue;
1073
+ f[o] = this.scalar(l, s.T, s.L, s.name);
1074
+ break;
1075
+ }
1076
+ }
1077
+ }
1078
+ /**
1079
+ * Returns `false` for unrecognized string representations.
1080
+ *
1081
+ * google.protobuf.NullValue accepts only JSON `null` (or the old `"NULL_VALUE"`).
1082
+ */
1083
+ enum(e, t, n, r) {
1084
+ if (e[0] == "google.protobuf.NullValue" && y(t === null || t === "NULL_VALUE", `Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} only accepts null.`), t === null)
1085
+ return 0;
1086
+ switch (typeof t) {
1087
+ case "number":
1088
+ return y(Number.isInteger(t), `Unable to parse field ${this.info.typeName}#${n}, enum can only be integral number, got ${t}.`), t;
1089
+ case "string":
1090
+ let i = t;
1091
+ e[2] && t.substring(0, e[2].length) === e[2] && (i = t.substring(e[2].length));
1092
+ let l = e[1][i];
1093
+ return typeof l > "u" && r ? !1 : (y(typeof l == "number", `Unable to parse field ${this.info.typeName}#${n}, enum ${e[0]} has no value for "${t}".`), l);
1094
+ }
1095
+ y(!1, `Unable to parse field ${this.info.typeName}#${n}, cannot parse enum value from ${typeof t}".`);
1096
+ }
1097
+ scalar(e, t, n, r) {
1098
+ let i;
1099
+ try {
1100
+ switch (t) {
1101
+ // float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
1102
+ // Either numbers or strings are accepted. Exponent notation is also accepted.
1103
+ case c.DOUBLE:
1104
+ case c.FLOAT:
1105
+ if (e === null)
1106
+ return 0;
1107
+ if (e === "NaN")
1108
+ return Number.NaN;
1109
+ if (e === "Infinity")
1110
+ return Number.POSITIVE_INFINITY;
1111
+ if (e === "-Infinity")
1112
+ return Number.NEGATIVE_INFINITY;
1113
+ if (e === "") {
1114
+ i = "empty string";
1115
+ break;
1116
+ }
1117
+ if (typeof e == "string" && e.trim().length !== e.length) {
1118
+ i = "extra whitespace";
1119
+ break;
1120
+ }
1121
+ if (typeof e != "string" && typeof e != "number")
1122
+ break;
1123
+ let l = Number(e);
1124
+ if (Number.isNaN(l)) {
1125
+ i = "not a number";
1126
+ break;
1127
+ }
1128
+ if (!Number.isFinite(l)) {
1129
+ i = "too large or small";
1130
+ break;
1131
+ }
1132
+ return t == c.FLOAT && ke(l), l;
1133
+ // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
1134
+ case c.INT32:
1135
+ case c.FIXED32:
1136
+ case c.SFIXED32:
1137
+ case c.SINT32:
1138
+ case c.UINT32:
1139
+ if (e === null)
1140
+ return 0;
1141
+ let s;
1142
+ if (typeof e == "number" ? s = e : e === "" ? i = "empty string" : typeof e == "string" && (e.trim().length !== e.length ? i = "extra whitespace" : s = Number(e)), s === void 0)
1143
+ break;
1144
+ return t == c.UINT32 ? Y(s) : _(s), s;
1145
+ // int64, fixed64, uint64: JSON value will be a decimal string. Either numbers or strings are accepted.
1146
+ case c.INT64:
1147
+ case c.SFIXED64:
1148
+ case c.SINT64:
1149
+ if (e === null)
1150
+ return O(N.ZERO, n);
1151
+ if (typeof e != "number" && typeof e != "string")
1152
+ break;
1153
+ return O(N.from(e), n);
1154
+ case c.FIXED64:
1155
+ case c.UINT64:
1156
+ if (e === null)
1157
+ return O(B.ZERO, n);
1158
+ if (typeof e != "number" && typeof e != "string")
1159
+ break;
1160
+ return O(B.from(e), n);
1161
+ // bool:
1162
+ case c.BOOL:
1163
+ if (e === null)
1164
+ return !1;
1165
+ if (typeof e != "boolean")
1166
+ break;
1167
+ return e;
1168
+ // string:
1169
+ case c.STRING:
1170
+ if (e === null)
1171
+ return "";
1172
+ if (typeof e != "string") {
1173
+ i = "extra whitespace";
1174
+ break;
1175
+ }
1176
+ try {
1177
+ encodeURIComponent(e);
1178
+ } catch (o) {
1179
+ o = "invalid UTF8";
1180
+ break;
1181
+ }
1182
+ return e;
1183
+ // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
1184
+ // Either standard or URL-safe base64 encoding with/without paddings are accepted.
1185
+ case c.BYTES:
1186
+ if (e === null || e === "")
1187
+ return new Uint8Array(0);
1188
+ if (typeof e != "string")
1189
+ break;
1190
+ return _e(e);
1191
+ }
1192
+ } catch (l) {
1193
+ i = l.message;
1194
+ }
1195
+ this.assert(!1, r + (i ? " - " + i : ""), e);
1196
+ }
1197
+ }
1198
+ class ot {
1199
+ constructor(e) {
1200
+ var t;
1201
+ this.fields = (t = e.fields) !== null && t !== void 0 ? t : [];
1202
+ }
1203
+ /**
1204
+ * Converts the message to a JSON object, based on the field descriptors.
1205
+ */
1206
+ write(e, t) {
1207
+ const n = {}, r = e;
1208
+ for (const i of this.fields) {
1209
+ if (!i.oneof) {
1210
+ let f = this.field(i, r[i.localName], t);
1211
+ f !== void 0 && (n[t.useProtoFieldName ? i.name : i.jsonName] = f);
1212
+ continue;
1213
+ }
1214
+ const l = r[i.oneof];
1215
+ if (l.oneofKind !== i.localName)
1216
+ continue;
1217
+ const s = i.kind == "scalar" || i.kind == "enum" ? Object.assign(Object.assign({}, t), { emitDefaultValues: !0 }) : t;
1218
+ let o = this.field(i, l[i.localName], s);
1219
+ y(o !== void 0), n[t.useProtoFieldName ? i.name : i.jsonName] = o;
1220
+ }
1221
+ return n;
1222
+ }
1223
+ field(e, t, n) {
1224
+ let r;
1225
+ if (e.kind == "map") {
1226
+ y(typeof t == "object" && t !== null);
1227
+ const i = {};
1228
+ switch (e.V.kind) {
1229
+ case "scalar":
1230
+ for (const [o, f] of Object.entries(t)) {
1231
+ const h = this.scalar(e.V.T, f, e.name, !1, !0);
1232
+ y(h !== void 0), i[o.toString()] = h;
1233
+ }
1234
+ break;
1235
+ case "message":
1236
+ const l = e.V.T();
1237
+ for (const [o, f] of Object.entries(t)) {
1238
+ const h = this.message(l, f, e.name, n);
1239
+ y(h !== void 0), i[o.toString()] = h;
1240
+ }
1241
+ break;
1242
+ case "enum":
1243
+ const s = e.V.T();
1244
+ for (const [o, f] of Object.entries(t)) {
1245
+ y(f === void 0 || typeof f == "number");
1246
+ const h = this.enum(s, f, e.name, !1, !0, n.enumAsInteger);
1247
+ y(h !== void 0), i[o.toString()] = h;
1248
+ }
1249
+ break;
1250
+ }
1251
+ (n.emitDefaultValues || Object.keys(i).length > 0) && (r = i);
1252
+ } else if (e.repeat) {
1253
+ y(Array.isArray(t));
1254
+ const i = [];
1255
+ switch (e.kind) {
1256
+ case "scalar":
1257
+ for (let o = 0; o < t.length; o++) {
1258
+ const f = this.scalar(e.T, t[o], e.name, e.opt, !0);
1259
+ y(f !== void 0), i.push(f);
1260
+ }
1261
+ break;
1262
+ case "enum":
1263
+ const l = e.T();
1264
+ for (let o = 0; o < t.length; o++) {
1265
+ y(t[o] === void 0 || typeof t[o] == "number");
1266
+ const f = this.enum(l, t[o], e.name, e.opt, !0, n.enumAsInteger);
1267
+ y(f !== void 0), i.push(f);
1268
+ }
1269
+ break;
1270
+ case "message":
1271
+ const s = e.T();
1272
+ for (let o = 0; o < t.length; o++) {
1273
+ const f = this.message(s, t[o], e.name, n);
1274
+ y(f !== void 0), i.push(f);
1275
+ }
1276
+ break;
1277
+ }
1278
+ (n.emitDefaultValues || i.length > 0 || n.emitDefaultValues) && (r = i);
1279
+ } else
1280
+ switch (e.kind) {
1281
+ case "scalar":
1282
+ r = this.scalar(e.T, t, e.name, e.opt, n.emitDefaultValues);
1283
+ break;
1284
+ case "enum":
1285
+ r = this.enum(e.T(), t, e.name, e.opt, n.emitDefaultValues, n.enumAsInteger);
1286
+ break;
1287
+ case "message":
1288
+ r = this.message(e.T(), t, e.name, n);
1289
+ break;
1290
+ }
1291
+ return r;
1292
+ }
1293
+ /**
1294
+ * Returns `null` as the default for google.protobuf.NullValue.
1295
+ */
1296
+ enum(e, t, n, r, i, l) {
1297
+ if (e[0] == "google.protobuf.NullValue")
1298
+ return !i && !r ? void 0 : null;
1299
+ if (t === void 0) {
1300
+ y(r);
1301
+ return;
1302
+ }
1303
+ if (!(t === 0 && !i && !r))
1304
+ return y(typeof t == "number"), y(Number.isInteger(t)), l || !e[1].hasOwnProperty(t) ? t : e[2] ? e[2] + e[1][t] : e[1][t];
1305
+ }
1306
+ message(e, t, n, r) {
1307
+ return t === void 0 ? r.emitDefaultValues ? null : void 0 : e.internalJsonWrite(t, r);
1308
+ }
1309
+ scalar(e, t, n, r, i) {
1310
+ if (t === void 0) {
1311
+ y(r);
1312
+ return;
1313
+ }
1314
+ const l = i || r;
1315
+ switch (e) {
1316
+ // int32, fixed32, uint32: JSON value will be a decimal number. Either numbers or strings are accepted.
1317
+ case c.INT32:
1318
+ case c.SFIXED32:
1319
+ case c.SINT32:
1320
+ return t === 0 ? l ? 0 : void 0 : (_(t), t);
1321
+ case c.FIXED32:
1322
+ case c.UINT32:
1323
+ return t === 0 ? l ? 0 : void 0 : (Y(t), t);
1324
+ // float, double: JSON value will be a number or one of the special string values "NaN", "Infinity", and "-Infinity".
1325
+ // Either numbers or strings are accepted. Exponent notation is also accepted.
1326
+ case c.FLOAT:
1327
+ ke(t);
1328
+ case c.DOUBLE:
1329
+ return t === 0 ? l ? 0 : void 0 : (y(typeof t == "number"), Number.isNaN(t) ? "NaN" : t === Number.POSITIVE_INFINITY ? "Infinity" : t === Number.NEGATIVE_INFINITY ? "-Infinity" : t);
1330
+ // string:
1331
+ case c.STRING:
1332
+ return t === "" ? l ? "" : void 0 : (y(typeof t == "string"), t);
1333
+ // bool:
1334
+ case c.BOOL:
1335
+ return t === !1 ? l ? !1 : void 0 : (y(typeof t == "boolean"), t);
1336
+ // JSON value will be a decimal string. Either numbers or strings are accepted.
1337
+ case c.UINT64:
1338
+ case c.FIXED64:
1339
+ y(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
1340
+ let s = B.from(t);
1341
+ return s.isZero() && !l ? void 0 : s.toString();
1342
+ // JSON value will be a decimal string. Either numbers or strings are accepted.
1343
+ case c.INT64:
1344
+ case c.SFIXED64:
1345
+ case c.SINT64:
1346
+ y(typeof t == "number" || typeof t == "string" || typeof t == "bigint");
1347
+ let o = N.from(t);
1348
+ return o.isZero() && !l ? void 0 : o.toString();
1349
+ // bytes: JSON value will be the data encoded as a string using standard base64 encoding with paddings.
1350
+ // Either standard or URL-safe base64 encoding with/without paddings are accepted.
1351
+ case c.BYTES:
1352
+ return y(t instanceof Uint8Array), t.byteLength ? Se(t) : l ? "" : void 0;
1353
+ }
1354
+ }
1355
+ }
1356
+ function ye(a, e = F.STRING) {
1357
+ switch (a) {
1358
+ case c.BOOL:
1359
+ return !1;
1360
+ case c.UINT64:
1361
+ case c.FIXED64:
1362
+ return O(B.ZERO, e);
1363
+ case c.INT64:
1364
+ case c.SFIXED64:
1365
+ case c.SINT64:
1366
+ return O(N.ZERO, e);
1367
+ case c.DOUBLE:
1368
+ case c.FLOAT:
1369
+ return 0;
1370
+ case c.BYTES:
1371
+ return new Uint8Array(0);
1372
+ case c.STRING:
1373
+ return "";
1374
+ default:
1375
+ return 0;
1376
+ }
1377
+ }
1378
+ class lt {
1379
+ constructor(e) {
1380
+ this.info = e;
1381
+ }
1382
+ prepare() {
1383
+ var e;
1384
+ if (!this.fieldNoToField) {
1385
+ const t = (e = this.info.fields) !== null && e !== void 0 ? e : [];
1386
+ this.fieldNoToField = new Map(t.map((n) => [n.no, n]));
1387
+ }
1388
+ }
1389
+ /**
1390
+ * Reads a message from binary format into the target message.
1391
+ *
1392
+ * Repeated fields are appended. Map entries are added, overwriting
1393
+ * existing keys.
1394
+ *
1395
+ * If a message field is already present, it will be merged with the
1396
+ * new data.
1397
+ */
1398
+ read(e, t, n, r) {
1399
+ this.prepare();
1400
+ const i = r === void 0 ? e.len : e.pos + r;
1401
+ for (; e.pos < i; ) {
1402
+ const [l, s] = e.tag(), o = this.fieldNoToField.get(l);
1403
+ if (!o) {
1404
+ let k = n.readUnknownField;
1405
+ if (k == "throw")
1406
+ throw new Error(`Unknown field ${l} (wire type ${s}) for ${this.info.typeName}`);
1407
+ let R = e.skip(s);
1408
+ k !== !1 && (k === !0 ? d.onRead : k)(this.info.typeName, t, l, s, R);
1409
+ continue;
1410
+ }
1411
+ let f = t, h = o.repeat, g = o.localName;
1412
+ switch (o.oneof && (f = f[o.oneof], f.oneofKind !== g && (f = t[o.oneof] = {
1413
+ oneofKind: g
1414
+ })), o.kind) {
1415
+ case "scalar":
1416
+ case "enum":
1417
+ let k = o.kind == "enum" ? c.INT32 : o.T, R = o.kind == "scalar" ? o.L : void 0;
1418
+ if (h) {
1419
+ let S = f[g];
1420
+ if (s == u.LengthDelimited && k != c.STRING && k != c.BYTES) {
1421
+ let z = e.uint32() + e.pos;
1422
+ for (; e.pos < z; )
1423
+ S.push(this.scalar(e, k, R));
1424
+ } else
1425
+ S.push(this.scalar(e, k, R));
1426
+ } else
1427
+ f[g] = this.scalar(e, k, R);
1428
+ break;
1429
+ case "message":
1430
+ if (h) {
1431
+ let S = f[g], z = o.T().internalBinaryRead(e, e.uint32(), n);
1432
+ S.push(z);
1433
+ } else
1434
+ f[g] = o.T().internalBinaryRead(e, e.uint32(), n, f[g]);
1435
+ break;
1436
+ case "map":
1437
+ let [U, Ce] = this.mapEntry(o, e, n);
1438
+ f[g][U] = Ce;
1439
+ break;
1440
+ }
1441
+ }
1442
+ }
1443
+ /**
1444
+ * Read a map field, expecting key field = 1, value field = 2
1445
+ */
1446
+ mapEntry(e, t, n) {
1447
+ let r = t.uint32(), i = t.pos + r, l, s;
1448
+ for (; t.pos < i; ) {
1449
+ let [o, f] = t.tag();
1450
+ switch (o) {
1451
+ case 1:
1452
+ e.K == c.BOOL ? l = t.bool().toString() : l = this.scalar(t, e.K, F.STRING);
1453
+ break;
1454
+ case 2:
1455
+ switch (e.V.kind) {
1456
+ case "scalar":
1457
+ s = this.scalar(t, e.V.T, e.V.L);
1458
+ break;
1459
+ case "enum":
1460
+ s = t.int32();
1461
+ break;
1462
+ case "message":
1463
+ s = e.V.T().internalBinaryRead(t, t.uint32(), n);
1464
+ break;
1465
+ }
1466
+ break;
1467
+ default:
1468
+ throw new Error(`Unknown field ${o} (wire type ${f}) in map entry for ${this.info.typeName}#${e.name}`);
1469
+ }
1470
+ }
1471
+ if (l === void 0) {
1472
+ let o = ye(e.K);
1473
+ l = e.K == c.BOOL ? o.toString() : o;
1474
+ }
1475
+ if (s === void 0)
1476
+ switch (e.V.kind) {
1477
+ case "scalar":
1478
+ s = ye(e.V.T, e.V.L);
1479
+ break;
1480
+ case "enum":
1481
+ s = 0;
1482
+ break;
1483
+ case "message":
1484
+ s = e.V.T().create();
1485
+ break;
1486
+ }
1487
+ return [l, s];
1488
+ }
1489
+ scalar(e, t, n) {
1490
+ switch (t) {
1491
+ case c.INT32:
1492
+ return e.int32();
1493
+ case c.STRING:
1494
+ return e.string();
1495
+ case c.BOOL:
1496
+ return e.bool();
1497
+ case c.DOUBLE:
1498
+ return e.double();
1499
+ case c.FLOAT:
1500
+ return e.float();
1501
+ case c.INT64:
1502
+ return O(e.int64(), n);
1503
+ case c.UINT64:
1504
+ return O(e.uint64(), n);
1505
+ case c.FIXED64:
1506
+ return O(e.fixed64(), n);
1507
+ case c.FIXED32:
1508
+ return e.fixed32();
1509
+ case c.BYTES:
1510
+ return e.bytes();
1511
+ case c.UINT32:
1512
+ return e.uint32();
1513
+ case c.SFIXED32:
1514
+ return e.sfixed32();
1515
+ case c.SFIXED64:
1516
+ return O(e.sfixed64(), n);
1517
+ case c.SINT32:
1518
+ return e.sint32();
1519
+ case c.SINT64:
1520
+ return O(e.sint64(), n);
1521
+ }
1522
+ }
1523
+ }
1524
+ class ft {
1525
+ constructor(e) {
1526
+ this.info = e;
1527
+ }
1528
+ prepare() {
1529
+ if (!this.fields) {
1530
+ const e = this.info.fields ? this.info.fields.concat() : [];
1531
+ this.fields = e.sort((t, n) => t.no - n.no);
1532
+ }
1533
+ }
1534
+ /**
1535
+ * Writes the message to binary format.
1536
+ */
1537
+ write(e, t, n) {
1538
+ this.prepare();
1539
+ for (const i of this.fields) {
1540
+ let l, s, o = i.repeat, f = i.localName;
1541
+ if (i.oneof) {
1542
+ const h = e[i.oneof];
1543
+ if (h.oneofKind !== f)
1544
+ continue;
1545
+ l = h[f], s = !0;
1546
+ } else
1547
+ l = e[f], s = !1;
1548
+ switch (i.kind) {
1549
+ case "scalar":
1550
+ case "enum":
1551
+ let h = i.kind == "enum" ? c.INT32 : i.T;
1552
+ if (o)
1553
+ if (y(Array.isArray(l)), o == Z.PACKED)
1554
+ this.packed(t, h, i.no, l);
1555
+ else
1556
+ for (const g of l)
1557
+ this.scalar(t, h, i.no, g, !0);
1558
+ else l === void 0 ? y(i.opt) : this.scalar(t, h, i.no, l, s || i.opt);
1559
+ break;
1560
+ case "message":
1561
+ if (o) {
1562
+ y(Array.isArray(l));
1563
+ for (const g of l)
1564
+ this.message(t, n, i.T(), i.no, g);
1565
+ } else
1566
+ this.message(t, n, i.T(), i.no, l);
1567
+ break;
1568
+ case "map":
1569
+ y(typeof l == "object" && l !== null);
1570
+ for (const [g, k] of Object.entries(l))
1571
+ this.mapEntry(t, n, i, g, k);
1572
+ break;
1573
+ }
1574
+ }
1575
+ let r = n.writeUnknownFields;
1576
+ r !== !1 && (r === !0 ? d.onWrite : r)(this.info.typeName, e, t);
1577
+ }
1578
+ mapEntry(e, t, n, r, i) {
1579
+ e.tag(n.no, u.LengthDelimited), e.fork();
1580
+ let l = r;
1581
+ switch (n.K) {
1582
+ case c.INT32:
1583
+ case c.FIXED32:
1584
+ case c.UINT32:
1585
+ case c.SFIXED32:
1586
+ case c.SINT32:
1587
+ l = Number.parseInt(r);
1588
+ break;
1589
+ case c.BOOL:
1590
+ y(r == "true" || r == "false"), l = r == "true";
1591
+ break;
1592
+ }
1593
+ switch (this.scalar(e, n.K, 1, l, !0), n.V.kind) {
1594
+ case "scalar":
1595
+ this.scalar(e, n.V.T, 2, i, !0);
1596
+ break;
1597
+ case "enum":
1598
+ this.scalar(e, c.INT32, 2, i, !0);
1599
+ break;
1600
+ case "message":
1601
+ this.message(e, t, n.V.T(), 2, i);
1602
+ break;
1603
+ }
1604
+ e.join();
1605
+ }
1606
+ message(e, t, n, r, i) {
1607
+ i !== void 0 && (n.internalBinaryWrite(i, e.tag(r, u.LengthDelimited).fork(), t), e.join());
1608
+ }
1609
+ /**
1610
+ * Write a single scalar value.
1611
+ */
1612
+ scalar(e, t, n, r, i) {
1613
+ let [l, s, o] = this.scalarInfo(t, r);
1614
+ (!o || i) && (e.tag(n, l), e[s](r));
1615
+ }
1616
+ /**
1617
+ * Write an array of scalar values in packed format.
1618
+ */
1619
+ packed(e, t, n, r) {
1620
+ if (!r.length)
1621
+ return;
1622
+ y(t !== c.BYTES && t !== c.STRING), e.tag(n, u.LengthDelimited), e.fork();
1623
+ let [, i] = this.scalarInfo(t);
1624
+ for (let l = 0; l < r.length; l++)
1625
+ e[i](r[l]);
1626
+ e.join();
1627
+ }
1628
+ /**
1629
+ * Get information for writing a scalar value.
1630
+ *
1631
+ * Returns tuple:
1632
+ * [0]: appropriate WireType
1633
+ * [1]: name of the appropriate method of IBinaryWriter
1634
+ * [2]: whether the given value is a default value
1635
+ *
1636
+ * If argument `value` is omitted, [2] is always false.
1637
+ */
1638
+ scalarInfo(e, t) {
1639
+ let n = u.Varint, r, i = t === void 0, l = t === 0;
1640
+ switch (e) {
1641
+ case c.INT32:
1642
+ r = "int32";
1643
+ break;
1644
+ case c.STRING:
1645
+ l = i || !t.length, n = u.LengthDelimited, r = "string";
1646
+ break;
1647
+ case c.BOOL:
1648
+ l = t === !1, r = "bool";
1649
+ break;
1650
+ case c.UINT32:
1651
+ r = "uint32";
1652
+ break;
1653
+ case c.DOUBLE:
1654
+ n = u.Bit64, r = "double";
1655
+ break;
1656
+ case c.FLOAT:
1657
+ n = u.Bit32, r = "float";
1658
+ break;
1659
+ case c.INT64:
1660
+ l = i || N.from(t).isZero(), r = "int64";
1661
+ break;
1662
+ case c.UINT64:
1663
+ l = i || B.from(t).isZero(), r = "uint64";
1664
+ break;
1665
+ case c.FIXED64:
1666
+ l = i || B.from(t).isZero(), n = u.Bit64, r = "fixed64";
1667
+ break;
1668
+ case c.BYTES:
1669
+ l = i || !t.byteLength, n = u.LengthDelimited, r = "bytes";
1670
+ break;
1671
+ case c.FIXED32:
1672
+ n = u.Bit32, r = "fixed32";
1673
+ break;
1674
+ case c.SFIXED32:
1675
+ n = u.Bit32, r = "sfixed32";
1676
+ break;
1677
+ case c.SFIXED64:
1678
+ l = i || N.from(t).isZero(), n = u.Bit64, r = "sfixed64";
1679
+ break;
1680
+ case c.SINT32:
1681
+ r = "sint32";
1682
+ break;
1683
+ case c.SINT64:
1684
+ l = i || N.from(t).isZero(), r = "sint64";
1685
+ break;
1686
+ }
1687
+ return [n, r, i || l];
1688
+ }
1689
+ }
1690
+ function ut(a) {
1691
+ const e = a.messagePrototype ? Object.create(a.messagePrototype) : Object.defineProperty({}, Le, { value: a });
1692
+ for (let t of a.fields) {
1693
+ let n = t.localName;
1694
+ if (!t.opt)
1695
+ if (t.oneof)
1696
+ e[t.oneof] = { oneofKind: void 0 };
1697
+ else if (t.repeat)
1698
+ e[n] = [];
1699
+ else
1700
+ switch (t.kind) {
1701
+ case "scalar":
1702
+ e[n] = ye(t.T, t.L);
1703
+ break;
1704
+ case "enum":
1705
+ e[n] = 0;
1706
+ break;
1707
+ case "map":
1708
+ e[n] = {};
1709
+ break;
1710
+ }
1711
+ }
1712
+ return e;
1713
+ }
1714
+ function m(a, e, t) {
1715
+ let n, r = t, i;
1716
+ for (let l of a.fields) {
1717
+ let s = l.localName;
1718
+ if (l.oneof) {
1719
+ const o = r[l.oneof];
1720
+ if (o?.oneofKind == null)
1721
+ continue;
1722
+ if (n = o[s], i = e[l.oneof], i.oneofKind = o.oneofKind, n == null) {
1723
+ delete i[s];
1724
+ continue;
1725
+ }
1726
+ } else if (n = r[s], i = e, n == null)
1727
+ continue;
1728
+ switch (l.repeat && (i[s].length = n.length), l.kind) {
1729
+ case "scalar":
1730
+ case "enum":
1731
+ if (l.repeat)
1732
+ for (let f = 0; f < n.length; f++)
1733
+ i[s][f] = n[f];
1734
+ else
1735
+ i[s] = n;
1736
+ break;
1737
+ case "message":
1738
+ let o = l.T();
1739
+ if (l.repeat)
1740
+ for (let f = 0; f < n.length; f++)
1741
+ i[s][f] = o.create(n[f]);
1742
+ else i[s] === void 0 ? i[s] = o.create(n) : o.mergePartial(i[s], n);
1743
+ break;
1744
+ case "map":
1745
+ switch (l.V.kind) {
1746
+ case "scalar":
1747
+ case "enum":
1748
+ Object.assign(i[s], n);
1749
+ break;
1750
+ case "message":
1751
+ let f = l.V.T();
1752
+ for (let h of Object.keys(n))
1753
+ i[s][h] = f.create(n[h]);
1754
+ break;
1755
+ }
1756
+ break;
1757
+ }
1758
+ }
1759
+ }
1760
+ function ct(a, e, t) {
1761
+ if (e === t)
1762
+ return !0;
1763
+ if (!e || !t)
1764
+ return !1;
1765
+ for (let n of a.fields) {
1766
+ let r = n.localName, i = n.oneof ? e[n.oneof][r] : e[r], l = n.oneof ? t[n.oneof][r] : t[r];
1767
+ switch (n.kind) {
1768
+ case "enum":
1769
+ case "scalar":
1770
+ let s = n.kind == "enum" ? c.INT32 : n.T;
1771
+ if (!(n.repeat ? Re(s, i, l) : Ke(s, i, l)))
1772
+ return !1;
1773
+ break;
1774
+ case "map":
1775
+ if (!(n.V.kind == "message" ? Ee(n.V.T(), X(i), X(l)) : Re(n.V.kind == "enum" ? c.INT32 : n.V.T, X(i), X(l))))
1776
+ return !1;
1777
+ break;
1778
+ case "message":
1779
+ let o = n.T();
1780
+ if (!(n.repeat ? Ee(o, i, l) : o.equals(i, l)))
1781
+ return !1;
1782
+ break;
1783
+ }
1784
+ }
1785
+ return !0;
1786
+ }
1787
+ const X = Object.values;
1788
+ function Ke(a, e, t) {
1789
+ if (e === t)
1790
+ return !0;
1791
+ if (a !== c.BYTES)
1792
+ return !1;
1793
+ let n = e, r = t;
1794
+ if (n.length !== r.length)
1795
+ return !1;
1796
+ for (let i = 0; i < n.length; i++)
1797
+ if (n[i] != r[i])
1798
+ return !1;
1799
+ return !0;
1800
+ }
1801
+ function Re(a, e, t) {
1802
+ if (e.length !== t.length)
1803
+ return !1;
1804
+ for (let n = 0; n < e.length; n++)
1805
+ if (!Ke(a, e[n], t[n]))
1806
+ return !1;
1807
+ return !0;
1808
+ }
1809
+ function Ee(a, e, t) {
1810
+ if (e.length !== t.length)
1811
+ return !1;
1812
+ for (let n = 0; n < e.length; n++)
1813
+ if (!a.equals(e[n], t[n]))
1814
+ return !1;
1815
+ return !0;
1816
+ }
1817
+ const xe = Object.getOwnPropertyDescriptors(Object.getPrototypeOf({})), ht = xe[Le] = {};
1818
+ class b {
1819
+ constructor(e, t, n) {
1820
+ this.defaultCheckDepth = 16, this.typeName = e, this.fields = t.map(it), this.options = n ?? {}, ht.value = this, this.messagePrototype = Object.create(null, xe), this.refTypeCheck = new at(this), this.refJsonReader = new st(this), this.refJsonWriter = new ot(this), this.refBinReader = new lt(this), this.refBinWriter = new ft(this);
1821
+ }
1822
+ create(e) {
1823
+ let t = ut(this);
1824
+ return e !== void 0 && m(this, t, e), t;
1825
+ }
1826
+ /**
1827
+ * Clone the message.
1828
+ *
1829
+ * Unknown fields are discarded.
1830
+ */
1831
+ clone(e) {
1832
+ let t = this.create();
1833
+ return m(this, t, e), t;
1834
+ }
1835
+ /**
1836
+ * Determines whether two message of the same type have the same field values.
1837
+ * Checks for deep equality, traversing repeated fields, oneof groups, maps
1838
+ * and messages recursively.
1839
+ * Will also return true if both messages are `undefined`.
1840
+ */
1841
+ equals(e, t) {
1842
+ return ct(this, e, t);
1843
+ }
1844
+ /**
1845
+ * Is the given value assignable to our message type
1846
+ * and contains no [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
1847
+ */
1848
+ is(e, t = this.defaultCheckDepth) {
1849
+ return this.refTypeCheck.is(e, t, !1);
1850
+ }
1851
+ /**
1852
+ * Is the given value assignable to our message type,
1853
+ * regardless of [excess properties](https://www.typescriptlang.org/docs/handbook/interfaces.html#excess-property-checks)?
1854
+ */
1855
+ isAssignable(e, t = this.defaultCheckDepth) {
1856
+ return this.refTypeCheck.is(e, t, !0);
1857
+ }
1858
+ /**
1859
+ * Copy partial data into the target message.
1860
+ */
1861
+ mergePartial(e, t) {
1862
+ m(this, e, t);
1863
+ }
1864
+ /**
1865
+ * Create a new message from binary format.
1866
+ */
1867
+ fromBinary(e, t) {
1868
+ let n = Je(t);
1869
+ return this.internalBinaryRead(n.readerFactory(e), e.byteLength, n);
1870
+ }
1871
+ /**
1872
+ * Read a new message from a JSON value.
1873
+ */
1874
+ fromJson(e, t) {
1875
+ return this.internalJsonRead(e, tt(t));
1876
+ }
1877
+ /**
1878
+ * Read a new message from a JSON string.
1879
+ * This is equivalent to `T.fromJson(JSON.parse(json))`.
1880
+ */
1881
+ fromJsonString(e, t) {
1882
+ let n = JSON.parse(e);
1883
+ return this.fromJson(n, t);
1884
+ }
1885
+ /**
1886
+ * Write the message to canonical JSON value.
1887
+ */
1888
+ toJson(e, t) {
1889
+ return this.internalJsonWrite(e, nt(t));
1890
+ }
1891
+ /**
1892
+ * Convert the message to canonical JSON string.
1893
+ * This is equivalent to `JSON.stringify(T.toJson(t))`
1894
+ */
1895
+ toJsonString(e, t) {
1896
+ var n;
1897
+ let r = this.toJson(e, t);
1898
+ return JSON.stringify(r, null, (n = t?.prettySpaces) !== null && n !== void 0 ? n : 0);
1899
+ }
1900
+ /**
1901
+ * Write the message to binary format.
1902
+ */
1903
+ toBinary(e, t) {
1904
+ let n = He(t);
1905
+ return this.internalBinaryWrite(e, n.writerFactory(), n).finish();
1906
+ }
1907
+ /**
1908
+ * This is an internal method. If you just want to read a message from
1909
+ * JSON, use `fromJson()` or `fromJsonString()`.
1910
+ *
1911
+ * Reads JSON value and merges the fields into the target
1912
+ * according to protobuf rules. If the target is omitted,
1913
+ * a new instance is created first.
1914
+ */
1915
+ internalJsonRead(e, t, n) {
1916
+ if (e !== null && typeof e == "object" && !Array.isArray(e)) {
1917
+ let r = n ?? this.create();
1918
+ return this.refJsonReader.read(e, r, t), r;
1919
+ }
1920
+ throw new Error(`Unable to parse message ${this.typeName} from JSON ${De(e)}.`);
1921
+ }
1922
+ /**
1923
+ * This is an internal method. If you just want to write a message
1924
+ * to JSON, use `toJson()` or `toJsonString().
1925
+ *
1926
+ * Writes JSON value and returns it.
1927
+ */
1928
+ internalJsonWrite(e, t) {
1929
+ return this.refJsonWriter.write(e, t);
1930
+ }
1931
+ /**
1932
+ * This is an internal method. If you just want to write a message
1933
+ * in binary format, use `toBinary()`.
1934
+ *
1935
+ * Serializes the message in binary format and appends it to the given
1936
+ * writer. Returns passed writer.
1937
+ */
1938
+ internalBinaryWrite(e, t, n) {
1939
+ return this.refBinWriter.write(e, t, n), t;
1940
+ }
1941
+ /**
1942
+ * This is an internal method. If you just want to read a message from
1943
+ * binary data, use `fromBinary()`.
1944
+ *
1945
+ * Reads data from binary format and merges the fields into
1946
+ * the target according to protobuf rules. If the target is
1947
+ * omitted, a new instance is created first.
1948
+ */
1949
+ internalBinaryRead(e, t, n, r) {
1950
+ let i = r ?? this.create();
1951
+ return this.refBinReader.read(e, i, n, t), i;
1952
+ }
1953
+ }
1954
+ var We = /* @__PURE__ */ ((a) => (a[a.NULL_VALUE = 0] = "NULL_VALUE", a))(We || {});
1955
+ class dt extends b {
1956
+ constructor() {
1957
+ super("shared.Struct", [
1958
+ { no: 1, name: "fields", kind: "map", K: 9, V: { kind: "message", T: () => I } }
1959
+ ]);
1960
+ }
1961
+ create(e) {
1962
+ const t = globalThis.Object.create(this.messagePrototype);
1963
+ return t.fields = {}, e !== void 0 && m(this, t, e), t;
1964
+ }
1965
+ internalBinaryRead(e, t, n, r) {
1966
+ let i = r ?? this.create(), l = e.pos + t;
1967
+ for (; e.pos < l; ) {
1968
+ let [s, o] = e.tag();
1969
+ switch (s) {
1970
+ case /* map<string, shared.Value> fields */
1971
+ 1:
1972
+ this.binaryReadMap1(i.fields, e, n);
1973
+ break;
1974
+ default:
1975
+ let f = n.readUnknownField;
1976
+ if (f === "throw")
1977
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
1978
+ let h = e.skip(o);
1979
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
1980
+ }
1981
+ }
1982
+ return i;
1983
+ }
1984
+ binaryReadMap1(e, t, n) {
1985
+ let r = t.uint32(), i = t.pos + r, l, s;
1986
+ for (; t.pos < i; ) {
1987
+ let [o, f] = t.tag();
1988
+ switch (o) {
1989
+ case 1:
1990
+ l = t.string();
1991
+ break;
1992
+ case 2:
1993
+ s = I.internalBinaryRead(t, t.uint32(), n);
1994
+ break;
1995
+ default:
1996
+ throw new globalThis.Error("unknown map entry field for shared.Struct.fields");
1997
+ }
1998
+ }
1999
+ e[l ?? ""] = s ?? I.create();
2000
+ }
2001
+ internalBinaryWrite(e, t, n) {
2002
+ for (let i of globalThis.Object.keys(e.fields))
2003
+ t.tag(1, u.LengthDelimited).fork().tag(1, u.LengthDelimited).string(i), t.tag(2, u.LengthDelimited).fork(), I.internalBinaryWrite(e.fields[i], t, n), t.join().join();
2004
+ let r = n.writeUnknownFields;
2005
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2006
+ }
2007
+ }
2008
+ const H = new dt();
2009
+ class pt extends b {
2010
+ constructor() {
2011
+ super("shared.Value", [
2012
+ { no: 1, name: "null_value", kind: "enum", oneof: "kind", T: () => ["shared.NullValue", We] },
2013
+ {
2014
+ no: 2,
2015
+ name: "number_value",
2016
+ kind: "scalar",
2017
+ oneof: "kind",
2018
+ T: 1
2019
+ /*ScalarType.DOUBLE*/
2020
+ },
2021
+ {
2022
+ no: 3,
2023
+ name: "string_value",
2024
+ kind: "scalar",
2025
+ oneof: "kind",
2026
+ T: 9
2027
+ /*ScalarType.STRING*/
2028
+ },
2029
+ {
2030
+ no: 4,
2031
+ name: "bool_value",
2032
+ kind: "scalar",
2033
+ oneof: "kind",
2034
+ T: 8
2035
+ /*ScalarType.BOOL*/
2036
+ },
2037
+ { no: 5, name: "struct_value", kind: "message", oneof: "kind", T: () => H },
2038
+ { no: 6, name: "list_value", kind: "message", oneof: "kind", T: () => ee }
2039
+ ]);
2040
+ }
2041
+ create(e) {
2042
+ const t = globalThis.Object.create(this.messagePrototype);
2043
+ return t.kind = { oneofKind: void 0 }, e !== void 0 && m(this, t, e), t;
2044
+ }
2045
+ internalBinaryRead(e, t, n, r) {
2046
+ let i = r ?? this.create(), l = e.pos + t;
2047
+ for (; e.pos < l; ) {
2048
+ let [s, o] = e.tag();
2049
+ switch (s) {
2050
+ case /* shared.NullValue null_value */
2051
+ 1:
2052
+ i.kind = {
2053
+ oneofKind: "nullValue",
2054
+ nullValue: e.int32()
2055
+ };
2056
+ break;
2057
+ case /* double number_value */
2058
+ 2:
2059
+ i.kind = {
2060
+ oneofKind: "numberValue",
2061
+ numberValue: e.double()
2062
+ };
2063
+ break;
2064
+ case /* string string_value */
2065
+ 3:
2066
+ i.kind = {
2067
+ oneofKind: "stringValue",
2068
+ stringValue: e.string()
2069
+ };
2070
+ break;
2071
+ case /* bool bool_value */
2072
+ 4:
2073
+ i.kind = {
2074
+ oneofKind: "boolValue",
2075
+ boolValue: e.bool()
2076
+ };
2077
+ break;
2078
+ case /* shared.Struct struct_value */
2079
+ 5:
2080
+ i.kind = {
2081
+ oneofKind: "structValue",
2082
+ structValue: H.internalBinaryRead(e, e.uint32(), n, i.kind.structValue)
2083
+ };
2084
+ break;
2085
+ case /* shared.ListValue list_value */
2086
+ 6:
2087
+ i.kind = {
2088
+ oneofKind: "listValue",
2089
+ listValue: ee.internalBinaryRead(e, e.uint32(), n, i.kind.listValue)
2090
+ };
2091
+ break;
2092
+ default:
2093
+ let f = n.readUnknownField;
2094
+ if (f === "throw")
2095
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2096
+ let h = e.skip(o);
2097
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2098
+ }
2099
+ }
2100
+ return i;
2101
+ }
2102
+ internalBinaryWrite(e, t, n) {
2103
+ e.kind.oneofKind === "nullValue" && t.tag(1, u.Varint).int32(e.kind.nullValue), e.kind.oneofKind === "numberValue" && t.tag(2, u.Bit64).double(e.kind.numberValue), e.kind.oneofKind === "stringValue" && t.tag(3, u.LengthDelimited).string(e.kind.stringValue), e.kind.oneofKind === "boolValue" && t.tag(4, u.Varint).bool(e.kind.boolValue), e.kind.oneofKind === "structValue" && H.internalBinaryWrite(e.kind.structValue, t.tag(5, u.LengthDelimited).fork(), n).join(), e.kind.oneofKind === "listValue" && ee.internalBinaryWrite(e.kind.listValue, t.tag(6, u.LengthDelimited).fork(), n).join();
2104
+ let r = n.writeUnknownFields;
2105
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2106
+ }
2107
+ }
2108
+ const I = new pt();
2109
+ class gt extends b {
2110
+ constructor() {
2111
+ super("shared.ListValue", [
2112
+ { no: 1, name: "values", kind: "message", repeat: 2, T: () => I }
2113
+ ]);
2114
+ }
2115
+ create(e) {
2116
+ const t = globalThis.Object.create(this.messagePrototype);
2117
+ return t.values = [], e !== void 0 && m(this, t, e), t;
2118
+ }
2119
+ internalBinaryRead(e, t, n, r) {
2120
+ let i = r ?? this.create(), l = e.pos + t;
2121
+ for (; e.pos < l; ) {
2122
+ let [s, o] = e.tag();
2123
+ switch (s) {
2124
+ case /* repeated shared.Value values */
2125
+ 1:
2126
+ i.values.push(I.internalBinaryRead(e, e.uint32(), n));
2127
+ break;
2128
+ default:
2129
+ let f = n.readUnknownField;
2130
+ if (f === "throw")
2131
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2132
+ let h = e.skip(o);
2133
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2134
+ }
2135
+ }
2136
+ return i;
2137
+ }
2138
+ internalBinaryWrite(e, t, n) {
2139
+ for (let i = 0; i < e.values.length; i++)
2140
+ I.internalBinaryWrite(e.values[i], t.tag(1, u.LengthDelimited).fork(), n).join();
2141
+ let r = n.writeUnknownFields;
2142
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2143
+ }
2144
+ }
2145
+ const ee = new gt();
2146
+ class yt extends b {
2147
+ constructor() {
2148
+ super("shared.Version", [
2149
+ {
2150
+ no: 1,
2151
+ name: "major",
2152
+ kind: "scalar",
2153
+ T: 5
2154
+ /*ScalarType.INT32*/
2155
+ },
2156
+ {
2157
+ no: 2,
2158
+ name: "minor",
2159
+ kind: "scalar",
2160
+ T: 5
2161
+ /*ScalarType.INT32*/
2162
+ },
2163
+ {
2164
+ no: 3,
2165
+ name: "patch",
2166
+ kind: "scalar",
2167
+ T: 5
2168
+ /*ScalarType.INT32*/
2169
+ }
2170
+ ]);
2171
+ }
2172
+ create(e) {
2173
+ const t = globalThis.Object.create(this.messagePrototype);
2174
+ return t.major = 0, t.minor = 0, t.patch = 0, e !== void 0 && m(this, t, e), t;
2175
+ }
2176
+ internalBinaryRead(e, t, n, r) {
2177
+ let i = r ?? this.create(), l = e.pos + t;
2178
+ for (; e.pos < l; ) {
2179
+ let [s, o] = e.tag();
2180
+ switch (s) {
2181
+ case /* int32 major */
2182
+ 1:
2183
+ i.major = e.int32();
2184
+ break;
2185
+ case /* int32 minor */
2186
+ 2:
2187
+ i.minor = e.int32();
2188
+ break;
2189
+ case /* int32 patch */
2190
+ 3:
2191
+ i.patch = e.int32();
2192
+ break;
2193
+ default:
2194
+ let f = n.readUnknownField;
2195
+ if (f === "throw")
2196
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2197
+ let h = e.skip(o);
2198
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2199
+ }
2200
+ }
2201
+ return i;
2202
+ }
2203
+ internalBinaryWrite(e, t, n) {
2204
+ e.major !== 0 && t.tag(1, u.Varint).int32(e.major), e.minor !== 0 && t.tag(2, u.Varint).int32(e.minor), e.patch !== 0 && t.tag(3, u.Varint).int32(e.patch);
2205
+ let r = n.writeUnknownFields;
2206
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2207
+ }
2208
+ }
2209
+ const x = new yt();
2210
+ class mt extends b {
2211
+ constructor() {
2212
+ super("shared.Translation", [
2213
+ {
2214
+ no: 1,
2215
+ name: "code",
2216
+ kind: "scalar",
2217
+ T: 9
2218
+ /*ScalarType.STRING*/
2219
+ },
2220
+ {
2221
+ no: 2,
2222
+ name: "content",
2223
+ kind: "scalar",
2224
+ T: 9
2225
+ /*ScalarType.STRING*/
2226
+ }
2227
+ ]);
2228
+ }
2229
+ create(e) {
2230
+ const t = globalThis.Object.create(this.messagePrototype);
2231
+ return t.code = "", t.content = "", e !== void 0 && m(this, t, e), t;
2232
+ }
2233
+ internalBinaryRead(e, t, n, r) {
2234
+ let i = r ?? this.create(), l = e.pos + t;
2235
+ for (; e.pos < l; ) {
2236
+ let [s, o] = e.tag();
2237
+ switch (s) {
2238
+ case /* string code */
2239
+ 1:
2240
+ i.code = e.string();
2241
+ break;
2242
+ case /* string content */
2243
+ 2:
2244
+ i.content = e.string();
2245
+ break;
2246
+ default:
2247
+ let f = n.readUnknownField;
2248
+ if (f === "throw")
2249
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2250
+ let h = e.skip(o);
2251
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2252
+ }
2253
+ }
2254
+ return i;
2255
+ }
2256
+ internalBinaryWrite(e, t, n) {
2257
+ e.code !== "" && t.tag(1, u.LengthDelimited).string(e.code), e.content !== "" && t.tag(2, u.LengthDelimited).string(e.content);
2258
+ let r = n.writeUnknownFields;
2259
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2260
+ }
2261
+ }
2262
+ const p = new mt();
2263
+ var L = /* @__PURE__ */ ((a) => (a[a.UNKNOWN = 0] = "UNKNOWN", a[a.PRIMITIVE = 1] = "PRIMITIVE", a[a.TYPE = 2] = "TYPE", a[a.OBJECT = 3] = "OBJECT", a[a.DATATYPE = 4] = "DATATYPE", a[a.ARRAY = 5] = "ARRAY", a[a.ERROR = 6] = "ERROR", a[a.NODE = 7] = "NODE", a))(L || {}), v = /* @__PURE__ */ ((a) => (a[a.UNKNOWN = 0] = "UNKNOWN", a[a.AND = 1] = "AND", a[a.OR = 2] = "OR", a))(v || {});
2264
+ class kt extends b {
2265
+ constructor() {
2266
+ super("shared.DefinitionDataType", [
2267
+ { no: 1, name: "variant", kind: "enum", T: () => ["shared.DefinitionDataType.Variant", L] },
2268
+ {
2269
+ no: 2,
2270
+ name: "identifier",
2271
+ kind: "scalar",
2272
+ T: 9
2273
+ /*ScalarType.STRING*/
2274
+ },
2275
+ { no: 3, name: "name", kind: "message", repeat: 2, T: () => p },
2276
+ { no: 4, name: "rules", kind: "message", repeat: 2, T: () => te },
2277
+ {
2278
+ no: 5,
2279
+ name: "generic_keys",
2280
+ kind: "scalar",
2281
+ repeat: 2,
2282
+ T: 9
2283
+ /*ScalarType.STRING*/
2284
+ },
2285
+ { no: 6, name: "version", kind: "message", T: () => x }
2286
+ ]);
2287
+ }
2288
+ create(e) {
2289
+ const t = globalThis.Object.create(this.messagePrototype);
2290
+ return t.variant = 0, t.identifier = "", t.name = [], t.rules = [], t.genericKeys = [], e !== void 0 && m(this, t, e), t;
2291
+ }
2292
+ internalBinaryRead(e, t, n, r) {
2293
+ let i = r ?? this.create(), l = e.pos + t;
2294
+ for (; e.pos < l; ) {
2295
+ let [s, o] = e.tag();
2296
+ switch (s) {
2297
+ case /* shared.DefinitionDataType.Variant variant */
2298
+ 1:
2299
+ i.variant = e.int32();
2300
+ break;
2301
+ case /* string identifier */
2302
+ 2:
2303
+ i.identifier = e.string();
2304
+ break;
2305
+ case /* repeated shared.Translation name */
2306
+ 3:
2307
+ i.name.push(p.internalBinaryRead(e, e.uint32(), n));
2308
+ break;
2309
+ case /* repeated shared.DefinitionDataTypeRule rules */
2310
+ 4:
2311
+ i.rules.push(te.internalBinaryRead(e, e.uint32(), n));
2312
+ break;
2313
+ case /* repeated string generic_keys */
2314
+ 5:
2315
+ i.genericKeys.push(e.string());
2316
+ break;
2317
+ case /* shared.Version version */
2318
+ 6:
2319
+ i.version = x.internalBinaryRead(e, e.uint32(), n, i.version);
2320
+ break;
2321
+ default:
2322
+ let f = n.readUnknownField;
2323
+ if (f === "throw")
2324
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2325
+ let h = e.skip(o);
2326
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2327
+ }
2328
+ }
2329
+ return i;
2330
+ }
2331
+ internalBinaryWrite(e, t, n) {
2332
+ e.variant !== 0 && t.tag(1, u.Varint).int32(e.variant), e.identifier !== "" && t.tag(2, u.LengthDelimited).string(e.identifier);
2333
+ for (let i = 0; i < e.name.length; i++)
2334
+ p.internalBinaryWrite(e.name[i], t.tag(3, u.LengthDelimited).fork(), n).join();
2335
+ for (let i = 0; i < e.rules.length; i++)
2336
+ te.internalBinaryWrite(e.rules[i], t.tag(4, u.LengthDelimited).fork(), n).join();
2337
+ for (let i = 0; i < e.genericKeys.length; i++)
2338
+ t.tag(5, u.LengthDelimited).string(e.genericKeys[i]);
2339
+ e.version && x.internalBinaryWrite(e.version, t.tag(6, u.LengthDelimited).fork(), n).join();
2340
+ let r = n.writeUnknownFields;
2341
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2342
+ }
2343
+ }
2344
+ const Tt = new kt();
2345
+ class bt extends b {
2346
+ constructor() {
2347
+ super("shared.ExecutionDataType", [
2348
+ {
2349
+ no: 1,
2350
+ name: "identifier",
2351
+ kind: "scalar",
2352
+ T: 9
2353
+ /*ScalarType.STRING*/
2354
+ },
2355
+ { no: 2, name: "rules", kind: "message", repeat: 2, T: () => ne }
2356
+ ]);
2357
+ }
2358
+ create(e) {
2359
+ const t = globalThis.Object.create(this.messagePrototype);
2360
+ return t.identifier = "", t.rules = [], e !== void 0 && m(this, t, e), t;
2361
+ }
2362
+ internalBinaryRead(e, t, n, r) {
2363
+ let i = r ?? this.create(), l = e.pos + t;
2364
+ for (; e.pos < l; ) {
2365
+ let [s, o] = e.tag();
2366
+ switch (s) {
2367
+ case /* string identifier */
2368
+ 1:
2369
+ i.identifier = e.string();
2370
+ break;
2371
+ case /* repeated shared.ExecutionDataTypeRule rules */
2372
+ 2:
2373
+ i.rules.push(ne.internalBinaryRead(e, e.uint32(), n));
2374
+ break;
2375
+ default:
2376
+ let f = n.readUnknownField;
2377
+ if (f === "throw")
2378
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2379
+ let h = e.skip(o);
2380
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2381
+ }
2382
+ }
2383
+ return i;
2384
+ }
2385
+ internalBinaryWrite(e, t, n) {
2386
+ e.identifier !== "" && t.tag(1, u.LengthDelimited).string(e.identifier);
2387
+ for (let i = 0; i < e.rules.length; i++)
2388
+ ne.internalBinaryWrite(e.rules[i], t.tag(2, u.LengthDelimited).fork(), n).join();
2389
+ let r = n.writeUnknownFields;
2390
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2391
+ }
2392
+ }
2393
+ new bt();
2394
+ class wt extends b {
2395
+ constructor() {
2396
+ super("shared.DefinitionDataTypeRule", [
2397
+ { no: 1, name: "contains_key", kind: "message", oneof: "config", T: () => re },
2398
+ { no: 2, name: "contains_type", kind: "message", oneof: "config", T: () => se },
2399
+ { no: 3, name: "item_of_collection", kind: "message", oneof: "config", T: () => V },
2400
+ { no: 4, name: "number_range", kind: "message", oneof: "config", T: () => A },
2401
+ { no: 5, name: "regex", kind: "message", oneof: "config", T: () => j },
2402
+ { no: 6, name: "input_types", kind: "message", oneof: "config", T: () => le },
2403
+ { no: 7, name: "return_type", kind: "message", oneof: "config", T: () => ue },
2404
+ { no: 8, name: "parent_type", kind: "message", oneof: "config", T: () => ie }
2405
+ ]);
2406
+ }
2407
+ create(e) {
2408
+ const t = globalThis.Object.create(this.messagePrototype);
2409
+ return t.config = { oneofKind: void 0 }, e !== void 0 && m(this, t, e), t;
2410
+ }
2411
+ internalBinaryRead(e, t, n, r) {
2412
+ let i = r ?? this.create(), l = e.pos + t;
2413
+ for (; e.pos < l; ) {
2414
+ let [s, o] = e.tag();
2415
+ switch (s) {
2416
+ case /* shared.DefinitionDataTypeContainsKeyRuleConfig contains_key */
2417
+ 1:
2418
+ i.config = {
2419
+ oneofKind: "containsKey",
2420
+ containsKey: re.internalBinaryRead(e, e.uint32(), n, i.config.containsKey)
2421
+ };
2422
+ break;
2423
+ case /* shared.DefinitionDataTypeContainsTypeRuleConfig contains_type */
2424
+ 2:
2425
+ i.config = {
2426
+ oneofKind: "containsType",
2427
+ containsType: se.internalBinaryRead(e, e.uint32(), n, i.config.containsType)
2428
+ };
2429
+ break;
2430
+ case /* shared.DataTypeItemOfCollectionRuleConfig item_of_collection */
2431
+ 3:
2432
+ i.config = {
2433
+ oneofKind: "itemOfCollection",
2434
+ itemOfCollection: V.internalBinaryRead(e, e.uint32(), n, i.config.itemOfCollection)
2435
+ };
2436
+ break;
2437
+ case /* shared.DataTypeNumberRangeRuleConfig number_range */
2438
+ 4:
2439
+ i.config = {
2440
+ oneofKind: "numberRange",
2441
+ numberRange: A.internalBinaryRead(e, e.uint32(), n, i.config.numberRange)
2442
+ };
2443
+ break;
2444
+ case /* shared.DataTypeRegexRuleConfig regex */
2445
+ 5:
2446
+ i.config = {
2447
+ oneofKind: "regex",
2448
+ regex: j.internalBinaryRead(e, e.uint32(), n, i.config.regex)
2449
+ };
2450
+ break;
2451
+ case /* shared.DefinitionDataTypeInputTypesRuleConfig input_types */
2452
+ 6:
2453
+ i.config = {
2454
+ oneofKind: "inputTypes",
2455
+ inputTypes: le.internalBinaryRead(e, e.uint32(), n, i.config.inputTypes)
2456
+ };
2457
+ break;
2458
+ case /* shared.DefinitionDataTypeReturnTypeRuleConfig return_type */
2459
+ 7:
2460
+ i.config = {
2461
+ oneofKind: "returnType",
2462
+ returnType: ue.internalBinaryRead(e, e.uint32(), n, i.config.returnType)
2463
+ };
2464
+ break;
2465
+ case /* shared.DefinitionDataTypeParentTypeRuleConfig parent_type */
2466
+ 8:
2467
+ i.config = {
2468
+ oneofKind: "parentType",
2469
+ parentType: ie.internalBinaryRead(e, e.uint32(), n, i.config.parentType)
2470
+ };
2471
+ break;
2472
+ default:
2473
+ let f = n.readUnknownField;
2474
+ if (f === "throw")
2475
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2476
+ let h = e.skip(o);
2477
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2478
+ }
2479
+ }
2480
+ return i;
2481
+ }
2482
+ internalBinaryWrite(e, t, n) {
2483
+ e.config.oneofKind === "containsKey" && re.internalBinaryWrite(e.config.containsKey, t.tag(1, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "containsType" && se.internalBinaryWrite(e.config.containsType, t.tag(2, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "itemOfCollection" && V.internalBinaryWrite(e.config.itemOfCollection, t.tag(3, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "numberRange" && A.internalBinaryWrite(e.config.numberRange, t.tag(4, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "regex" && j.internalBinaryWrite(e.config.regex, t.tag(5, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "inputTypes" && le.internalBinaryWrite(e.config.inputTypes, t.tag(6, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "returnType" && ue.internalBinaryWrite(e.config.returnType, t.tag(7, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "parentType" && ie.internalBinaryWrite(e.config.parentType, t.tag(8, u.LengthDelimited).fork(), n).join();
2484
+ let r = n.writeUnknownFields;
2485
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2486
+ }
2487
+ }
2488
+ const te = new wt();
2489
+ class Nt extends b {
2490
+ constructor() {
2491
+ super("shared.ExecutionDataTypeRule", [
2492
+ { no: 1, name: "contains_key", kind: "message", oneof: "config", T: () => ae },
2493
+ { no: 2, name: "contains_type", kind: "message", oneof: "config", T: () => oe },
2494
+ { no: 3, name: "item_of_collection", kind: "message", oneof: "config", T: () => V },
2495
+ { no: 4, name: "number_range", kind: "message", oneof: "config", T: () => A },
2496
+ { no: 5, name: "regex", kind: "message", oneof: "config", T: () => j }
2497
+ ]);
2498
+ }
2499
+ create(e) {
2500
+ const t = globalThis.Object.create(this.messagePrototype);
2501
+ return t.config = { oneofKind: void 0 }, e !== void 0 && m(this, t, e), t;
2502
+ }
2503
+ internalBinaryRead(e, t, n, r) {
2504
+ let i = r ?? this.create(), l = e.pos + t;
2505
+ for (; e.pos < l; ) {
2506
+ let [s, o] = e.tag();
2507
+ switch (s) {
2508
+ case /* shared.ExecutionDataTypeContainsKeyRuleConfig contains_key */
2509
+ 1:
2510
+ i.config = {
2511
+ oneofKind: "containsKey",
2512
+ containsKey: ae.internalBinaryRead(e, e.uint32(), n, i.config.containsKey)
2513
+ };
2514
+ break;
2515
+ case /* shared.ExecutionDataTypeContainsTypeRuleConfig contains_type */
2516
+ 2:
2517
+ i.config = {
2518
+ oneofKind: "containsType",
2519
+ containsType: oe.internalBinaryRead(e, e.uint32(), n, i.config.containsType)
2520
+ };
2521
+ break;
2522
+ case /* shared.DataTypeItemOfCollectionRuleConfig item_of_collection */
2523
+ 3:
2524
+ i.config = {
2525
+ oneofKind: "itemOfCollection",
2526
+ itemOfCollection: V.internalBinaryRead(e, e.uint32(), n, i.config.itemOfCollection)
2527
+ };
2528
+ break;
2529
+ case /* shared.DataTypeNumberRangeRuleConfig number_range */
2530
+ 4:
2531
+ i.config = {
2532
+ oneofKind: "numberRange",
2533
+ numberRange: A.internalBinaryRead(e, e.uint32(), n, i.config.numberRange)
2534
+ };
2535
+ break;
2536
+ case /* shared.DataTypeRegexRuleConfig regex */
2537
+ 5:
2538
+ i.config = {
2539
+ oneofKind: "regex",
2540
+ regex: j.internalBinaryRead(e, e.uint32(), n, i.config.regex)
2541
+ };
2542
+ break;
2543
+ default:
2544
+ let f = n.readUnknownField;
2545
+ if (f === "throw")
2546
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2547
+ let h = e.skip(o);
2548
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2549
+ }
2550
+ }
2551
+ return i;
2552
+ }
2553
+ internalBinaryWrite(e, t, n) {
2554
+ e.config.oneofKind === "containsKey" && ae.internalBinaryWrite(e.config.containsKey, t.tag(1, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "containsType" && oe.internalBinaryWrite(e.config.containsType, t.tag(2, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "itemOfCollection" && V.internalBinaryWrite(e.config.itemOfCollection, t.tag(3, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "numberRange" && A.internalBinaryWrite(e.config.numberRange, t.tag(4, u.LengthDelimited).fork(), n).join(), e.config.oneofKind === "regex" && j.internalBinaryWrite(e.config.regex, t.tag(5, u.LengthDelimited).fork(), n).join();
2555
+ let r = n.writeUnknownFields;
2556
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2557
+ }
2558
+ }
2559
+ const ne = new Nt();
2560
+ class It extends b {
2561
+ constructor() {
2562
+ super("shared.DefinitionDataTypeParentTypeRuleConfig", [
2563
+ { no: 1, name: "parent_type", kind: "message", T: () => w }
2564
+ ]);
2565
+ }
2566
+ create(e) {
2567
+ const t = globalThis.Object.create(this.messagePrototype);
2568
+ return e !== void 0 && m(this, t, e), t;
2569
+ }
2570
+ internalBinaryRead(e, t, n, r) {
2571
+ let i = r ?? this.create(), l = e.pos + t;
2572
+ for (; e.pos < l; ) {
2573
+ let [s, o] = e.tag();
2574
+ switch (s) {
2575
+ case /* shared.DataTypeIdentifier parent_type */
2576
+ 1:
2577
+ i.parentType = w.internalBinaryRead(e, e.uint32(), n, i.parentType);
2578
+ break;
2579
+ default:
2580
+ let f = n.readUnknownField;
2581
+ if (f === "throw")
2582
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2583
+ let h = e.skip(o);
2584
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2585
+ }
2586
+ }
2587
+ return i;
2588
+ }
2589
+ internalBinaryWrite(e, t, n) {
2590
+ e.parentType && w.internalBinaryWrite(e.parentType, t.tag(1, u.LengthDelimited).fork(), n).join();
2591
+ let r = n.writeUnknownFields;
2592
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2593
+ }
2594
+ }
2595
+ const ie = new It();
2596
+ class Bt extends b {
2597
+ constructor() {
2598
+ super("shared.DefinitionDataTypeContainsKeyRuleConfig", [
2599
+ {
2600
+ no: 1,
2601
+ name: "key",
2602
+ kind: "scalar",
2603
+ T: 9
2604
+ /*ScalarType.STRING*/
2605
+ },
2606
+ { no: 2, name: "data_type_identifier", kind: "message", T: () => w }
2607
+ ]);
2608
+ }
2609
+ create(e) {
2610
+ const t = globalThis.Object.create(this.messagePrototype);
2611
+ return t.key = "", e !== void 0 && m(this, t, e), t;
2612
+ }
2613
+ internalBinaryRead(e, t, n, r) {
2614
+ let i = r ?? this.create(), l = e.pos + t;
2615
+ for (; e.pos < l; ) {
2616
+ let [s, o] = e.tag();
2617
+ switch (s) {
2618
+ case /* string key */
2619
+ 1:
2620
+ i.key = e.string();
2621
+ break;
2622
+ case /* shared.DataTypeIdentifier data_type_identifier */
2623
+ 2:
2624
+ i.dataTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.dataTypeIdentifier);
2625
+ break;
2626
+ default:
2627
+ let f = n.readUnknownField;
2628
+ if (f === "throw")
2629
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2630
+ let h = e.skip(o);
2631
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2632
+ }
2633
+ }
2634
+ return i;
2635
+ }
2636
+ internalBinaryWrite(e, t, n) {
2637
+ e.key !== "" && t.tag(1, u.LengthDelimited).string(e.key), e.dataTypeIdentifier && w.internalBinaryWrite(e.dataTypeIdentifier, t.tag(2, u.LengthDelimited).fork(), n).join();
2638
+ let r = n.writeUnknownFields;
2639
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2640
+ }
2641
+ }
2642
+ const re = new Bt();
2643
+ class Rt extends b {
2644
+ constructor() {
2645
+ super("shared.ExecutionDataTypeContainsKeyRuleConfig", [
2646
+ {
2647
+ no: 1,
2648
+ name: "key",
2649
+ kind: "scalar",
2650
+ T: 9
2651
+ /*ScalarType.STRING*/
2652
+ },
2653
+ {
2654
+ no: 2,
2655
+ name: "data_type_identifier",
2656
+ kind: "scalar",
2657
+ T: 9
2658
+ /*ScalarType.STRING*/
2659
+ }
2660
+ ]);
2661
+ }
2662
+ create(e) {
2663
+ const t = globalThis.Object.create(this.messagePrototype);
2664
+ return t.key = "", t.dataTypeIdentifier = "", e !== void 0 && m(this, t, e), t;
2665
+ }
2666
+ internalBinaryRead(e, t, n, r) {
2667
+ let i = r ?? this.create(), l = e.pos + t;
2668
+ for (; e.pos < l; ) {
2669
+ let [s, o] = e.tag();
2670
+ switch (s) {
2671
+ case /* string key */
2672
+ 1:
2673
+ i.key = e.string();
2674
+ break;
2675
+ case /* string data_type_identifier */
2676
+ 2:
2677
+ i.dataTypeIdentifier = e.string();
2678
+ break;
2679
+ default:
2680
+ let f = n.readUnknownField;
2681
+ if (f === "throw")
2682
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2683
+ let h = e.skip(o);
2684
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2685
+ }
2686
+ }
2687
+ return i;
2688
+ }
2689
+ internalBinaryWrite(e, t, n) {
2690
+ e.key !== "" && t.tag(1, u.LengthDelimited).string(e.key), e.dataTypeIdentifier !== "" && t.tag(2, u.LengthDelimited).string(e.dataTypeIdentifier);
2691
+ let r = n.writeUnknownFields;
2692
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2693
+ }
2694
+ }
2695
+ const ae = new Rt();
2696
+ class Et extends b {
2697
+ constructor() {
2698
+ super("shared.DefinitionDataTypeContainsTypeRuleConfig", [
2699
+ { no: 1, name: "data_type_identifier", kind: "message", T: () => w }
2700
+ ]);
2701
+ }
2702
+ create(e) {
2703
+ const t = globalThis.Object.create(this.messagePrototype);
2704
+ return e !== void 0 && m(this, t, e), t;
2705
+ }
2706
+ internalBinaryRead(e, t, n, r) {
2707
+ let i = r ?? this.create(), l = e.pos + t;
2708
+ for (; e.pos < l; ) {
2709
+ let [s, o] = e.tag();
2710
+ switch (s) {
2711
+ case /* shared.DataTypeIdentifier data_type_identifier */
2712
+ 1:
2713
+ i.dataTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.dataTypeIdentifier);
2714
+ break;
2715
+ default:
2716
+ let f = n.readUnknownField;
2717
+ if (f === "throw")
2718
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2719
+ let h = e.skip(o);
2720
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2721
+ }
2722
+ }
2723
+ return i;
2724
+ }
2725
+ internalBinaryWrite(e, t, n) {
2726
+ e.dataTypeIdentifier && w.internalBinaryWrite(e.dataTypeIdentifier, t.tag(1, u.LengthDelimited).fork(), n).join();
2727
+ let r = n.writeUnknownFields;
2728
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2729
+ }
2730
+ }
2731
+ const se = new Et();
2732
+ class Dt extends b {
2733
+ constructor() {
2734
+ super("shared.ExecutionDataTypeContainsTypeRuleConfig", [
2735
+ {
2736
+ no: 1,
2737
+ name: "data_type_identifier",
2738
+ kind: "scalar",
2739
+ T: 9
2740
+ /*ScalarType.STRING*/
2741
+ }
2742
+ ]);
2743
+ }
2744
+ create(e) {
2745
+ const t = globalThis.Object.create(this.messagePrototype);
2746
+ return t.dataTypeIdentifier = "", e !== void 0 && m(this, t, e), t;
2747
+ }
2748
+ internalBinaryRead(e, t, n, r) {
2749
+ let i = r ?? this.create(), l = e.pos + t;
2750
+ for (; e.pos < l; ) {
2751
+ let [s, o] = e.tag();
2752
+ switch (s) {
2753
+ case /* string data_type_identifier */
2754
+ 1:
2755
+ i.dataTypeIdentifier = e.string();
2756
+ break;
2757
+ default:
2758
+ let f = n.readUnknownField;
2759
+ if (f === "throw")
2760
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2761
+ let h = e.skip(o);
2762
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2763
+ }
2764
+ }
2765
+ return i;
2766
+ }
2767
+ internalBinaryWrite(e, t, n) {
2768
+ e.dataTypeIdentifier !== "" && t.tag(1, u.LengthDelimited).string(e.dataTypeIdentifier);
2769
+ let r = n.writeUnknownFields;
2770
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2771
+ }
2772
+ }
2773
+ const oe = new Dt();
2774
+ class Ot extends b {
2775
+ constructor() {
2776
+ super("shared.DataTypeItemOfCollectionRuleConfig", [
2777
+ { no: 1, name: "items", kind: "message", repeat: 2, T: () => I }
2778
+ ]);
2779
+ }
2780
+ create(e) {
2781
+ const t = globalThis.Object.create(this.messagePrototype);
2782
+ return t.items = [], e !== void 0 && m(this, t, e), t;
2783
+ }
2784
+ internalBinaryRead(e, t, n, r) {
2785
+ let i = r ?? this.create(), l = e.pos + t;
2786
+ for (; e.pos < l; ) {
2787
+ let [s, o] = e.tag();
2788
+ switch (s) {
2789
+ case /* repeated shared.Value items */
2790
+ 1:
2791
+ i.items.push(I.internalBinaryRead(e, e.uint32(), n));
2792
+ break;
2793
+ default:
2794
+ let f = n.readUnknownField;
2795
+ if (f === "throw")
2796
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2797
+ let h = e.skip(o);
2798
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2799
+ }
2800
+ }
2801
+ return i;
2802
+ }
2803
+ internalBinaryWrite(e, t, n) {
2804
+ for (let i = 0; i < e.items.length; i++)
2805
+ I.internalBinaryWrite(e.items[i], t.tag(1, u.LengthDelimited).fork(), n).join();
2806
+ let r = n.writeUnknownFields;
2807
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2808
+ }
2809
+ }
2810
+ const V = new Ot();
2811
+ class Ft extends b {
2812
+ constructor() {
2813
+ super("shared.DataTypeNumberRangeRuleConfig", [
2814
+ {
2815
+ no: 1,
2816
+ name: "from",
2817
+ kind: "scalar",
2818
+ T: 3,
2819
+ L: 0
2820
+ /*LongType.BIGINT*/
2821
+ },
2822
+ {
2823
+ no: 2,
2824
+ name: "to",
2825
+ kind: "scalar",
2826
+ T: 3,
2827
+ L: 0
2828
+ /*LongType.BIGINT*/
2829
+ },
2830
+ {
2831
+ no: 3,
2832
+ name: "steps",
2833
+ kind: "scalar",
2834
+ opt: !0,
2835
+ T: 3,
2836
+ L: 0
2837
+ /*LongType.BIGINT*/
2838
+ }
2839
+ ]);
2840
+ }
2841
+ create(e) {
2842
+ const t = globalThis.Object.create(this.messagePrototype);
2843
+ return t.from = 0n, t.to = 0n, e !== void 0 && m(this, t, e), t;
2844
+ }
2845
+ internalBinaryRead(e, t, n, r) {
2846
+ let i = r ?? this.create(), l = e.pos + t;
2847
+ for (; e.pos < l; ) {
2848
+ let [s, o] = e.tag();
2849
+ switch (s) {
2850
+ case /* int64 from */
2851
+ 1:
2852
+ i.from = e.int64().toBigInt();
2853
+ break;
2854
+ case /* int64 to */
2855
+ 2:
2856
+ i.to = e.int64().toBigInt();
2857
+ break;
2858
+ case /* optional int64 steps */
2859
+ 3:
2860
+ i.steps = e.int64().toBigInt();
2861
+ break;
2862
+ default:
2863
+ let f = n.readUnknownField;
2864
+ if (f === "throw")
2865
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2866
+ let h = e.skip(o);
2867
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2868
+ }
2869
+ }
2870
+ return i;
2871
+ }
2872
+ internalBinaryWrite(e, t, n) {
2873
+ e.from !== 0n && t.tag(1, u.Varint).int64(e.from), e.to !== 0n && t.tag(2, u.Varint).int64(e.to), e.steps !== void 0 && t.tag(3, u.Varint).int64(e.steps);
2874
+ let r = n.writeUnknownFields;
2875
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2876
+ }
2877
+ }
2878
+ const A = new Ft();
2879
+ class Ut extends b {
2880
+ constructor() {
2881
+ super("shared.DataTypeRegexRuleConfig", [
2882
+ {
2883
+ no: 1,
2884
+ name: "pattern",
2885
+ kind: "scalar",
2886
+ T: 9
2887
+ /*ScalarType.STRING*/
2888
+ }
2889
+ ]);
2890
+ }
2891
+ create(e) {
2892
+ const t = globalThis.Object.create(this.messagePrototype);
2893
+ return t.pattern = "", e !== void 0 && m(this, t, e), t;
2894
+ }
2895
+ internalBinaryRead(e, t, n, r) {
2896
+ let i = r ?? this.create(), l = e.pos + t;
2897
+ for (; e.pos < l; ) {
2898
+ let [s, o] = e.tag();
2899
+ switch (s) {
2900
+ case /* string pattern */
2901
+ 1:
2902
+ i.pattern = e.string();
2903
+ break;
2904
+ default:
2905
+ let f = n.readUnknownField;
2906
+ if (f === "throw")
2907
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2908
+ let h = e.skip(o);
2909
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2910
+ }
2911
+ }
2912
+ return i;
2913
+ }
2914
+ internalBinaryWrite(e, t, n) {
2915
+ e.pattern !== "" && t.tag(1, u.LengthDelimited).string(e.pattern);
2916
+ let r = n.writeUnknownFields;
2917
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2918
+ }
2919
+ }
2920
+ const j = new Ut();
2921
+ class $t extends b {
2922
+ constructor() {
2923
+ super("shared.DefinitionDataTypeInputTypesRuleConfig", [
2924
+ { no: 1, name: "input_types", kind: "message", repeat: 2, T: () => fe }
2925
+ ]);
2926
+ }
2927
+ create(e) {
2928
+ const t = globalThis.Object.create(this.messagePrototype);
2929
+ return t.inputTypes = [], e !== void 0 && m(this, t, e), t;
2930
+ }
2931
+ internalBinaryRead(e, t, n, r) {
2932
+ let i = r ?? this.create(), l = e.pos + t;
2933
+ for (; e.pos < l; ) {
2934
+ let [s, o] = e.tag();
2935
+ switch (s) {
2936
+ case /* repeated shared.DefinitionDataTypeInputTypesRuleConfig.DataTypeInputType input_types */
2937
+ 1:
2938
+ i.inputTypes.push(fe.internalBinaryRead(e, e.uint32(), n));
2939
+ break;
2940
+ default:
2941
+ let f = n.readUnknownField;
2942
+ if (f === "throw")
2943
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2944
+ let h = e.skip(o);
2945
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2946
+ }
2947
+ }
2948
+ return i;
2949
+ }
2950
+ internalBinaryWrite(e, t, n) {
2951
+ for (let i = 0; i < e.inputTypes.length; i++)
2952
+ fe.internalBinaryWrite(e.inputTypes[i], t.tag(1, u.LengthDelimited).fork(), n).join();
2953
+ let r = n.writeUnknownFields;
2954
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
2955
+ }
2956
+ }
2957
+ const le = new $t();
2958
+ class Lt extends b {
2959
+ constructor() {
2960
+ super("shared.DefinitionDataTypeInputTypesRuleConfig.DataTypeInputType", [
2961
+ { no: 1, name: "data_type_identifier", kind: "message", T: () => w },
2962
+ {
2963
+ no: 2,
2964
+ name: "input_identifier",
2965
+ kind: "scalar",
2966
+ T: 9
2967
+ /*ScalarType.STRING*/
2968
+ }
2969
+ ]);
2970
+ }
2971
+ create(e) {
2972
+ const t = globalThis.Object.create(this.messagePrototype);
2973
+ return t.inputIdentifier = "", e !== void 0 && m(this, t, e), t;
2974
+ }
2975
+ internalBinaryRead(e, t, n, r) {
2976
+ let i = r ?? this.create(), l = e.pos + t;
2977
+ for (; e.pos < l; ) {
2978
+ let [s, o] = e.tag();
2979
+ switch (s) {
2980
+ case /* shared.DataTypeIdentifier data_type_identifier */
2981
+ 1:
2982
+ i.dataTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.dataTypeIdentifier);
2983
+ break;
2984
+ case /* string input_identifier */
2985
+ 2:
2986
+ i.inputIdentifier = e.string();
2987
+ break;
2988
+ default:
2989
+ let f = n.readUnknownField;
2990
+ if (f === "throw")
2991
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
2992
+ let h = e.skip(o);
2993
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
2994
+ }
2995
+ }
2996
+ return i;
2997
+ }
2998
+ internalBinaryWrite(e, t, n) {
2999
+ e.dataTypeIdentifier && w.internalBinaryWrite(e.dataTypeIdentifier, t.tag(1, u.LengthDelimited).fork(), n).join(), e.inputIdentifier !== "" && t.tag(2, u.LengthDelimited).string(e.inputIdentifier);
3000
+ let r = n.writeUnknownFields;
3001
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3002
+ }
3003
+ }
3004
+ const fe = new Lt();
3005
+ class Kt extends b {
3006
+ constructor() {
3007
+ super("shared.DefinitionDataTypeReturnTypeRuleConfig", [
3008
+ { no: 1, name: "data_type_identifier", kind: "message", T: () => w }
3009
+ ]);
3010
+ }
3011
+ create(e) {
3012
+ const t = globalThis.Object.create(this.messagePrototype);
3013
+ return e !== void 0 && m(this, t, e), t;
3014
+ }
3015
+ internalBinaryRead(e, t, n, r) {
3016
+ let i = r ?? this.create(), l = e.pos + t;
3017
+ for (; e.pos < l; ) {
3018
+ let [s, o] = e.tag();
3019
+ switch (s) {
3020
+ case /* shared.DataTypeIdentifier data_type_identifier */
3021
+ 1:
3022
+ i.dataTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.dataTypeIdentifier);
3023
+ break;
3024
+ default:
3025
+ let f = n.readUnknownField;
3026
+ if (f === "throw")
3027
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3028
+ let h = e.skip(o);
3029
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3030
+ }
3031
+ }
3032
+ return i;
3033
+ }
3034
+ internalBinaryWrite(e, t, n) {
3035
+ e.dataTypeIdentifier && w.internalBinaryWrite(e.dataTypeIdentifier, t.tag(1, u.LengthDelimited).fork(), n).join();
3036
+ let r = n.writeUnknownFields;
3037
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3038
+ }
3039
+ }
3040
+ const ue = new Kt();
3041
+ class xt extends b {
3042
+ constructor() {
3043
+ super("shared.DataTypeIdentifier", [
3044
+ {
3045
+ no: 1,
3046
+ name: "data_type_identifier",
3047
+ kind: "scalar",
3048
+ oneof: "type",
3049
+ T: 9
3050
+ /*ScalarType.STRING*/
3051
+ },
3052
+ { no: 2, name: "generic_type", kind: "message", oneof: "type", T: () => ce },
3053
+ {
3054
+ no: 3,
3055
+ name: "generic_key",
3056
+ kind: "scalar",
3057
+ oneof: "type",
3058
+ T: 9
3059
+ /*ScalarType.STRING*/
3060
+ }
3061
+ ]);
3062
+ }
3063
+ create(e) {
3064
+ const t = globalThis.Object.create(this.messagePrototype);
3065
+ return t.type = { oneofKind: void 0 }, e !== void 0 && m(this, t, e), t;
3066
+ }
3067
+ internalBinaryRead(e, t, n, r) {
3068
+ let i = r ?? this.create(), l = e.pos + t;
3069
+ for (; e.pos < l; ) {
3070
+ let [s, o] = e.tag();
3071
+ switch (s) {
3072
+ case /* string data_type_identifier */
3073
+ 1:
3074
+ i.type = {
3075
+ oneofKind: "dataTypeIdentifier",
3076
+ dataTypeIdentifier: e.string()
3077
+ };
3078
+ break;
3079
+ case /* shared.GenericType generic_type */
3080
+ 2:
3081
+ i.type = {
3082
+ oneofKind: "genericType",
3083
+ genericType: ce.internalBinaryRead(e, e.uint32(), n, i.type.genericType)
3084
+ };
3085
+ break;
3086
+ case /* string generic_key */
3087
+ 3:
3088
+ i.type = {
3089
+ oneofKind: "genericKey",
3090
+ genericKey: e.string()
3091
+ };
3092
+ break;
3093
+ default:
3094
+ let f = n.readUnknownField;
3095
+ if (f === "throw")
3096
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3097
+ let h = e.skip(o);
3098
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3099
+ }
3100
+ }
3101
+ return i;
3102
+ }
3103
+ internalBinaryWrite(e, t, n) {
3104
+ e.type.oneofKind === "dataTypeIdentifier" && t.tag(1, u.LengthDelimited).string(e.type.dataTypeIdentifier), e.type.oneofKind === "genericType" && ce.internalBinaryWrite(e.type.genericType, t.tag(2, u.LengthDelimited).fork(), n).join(), e.type.oneofKind === "genericKey" && t.tag(3, u.LengthDelimited).string(e.type.genericKey);
3105
+ let r = n.writeUnknownFields;
3106
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3107
+ }
3108
+ }
3109
+ const w = new xt();
3110
+ class Wt extends b {
3111
+ constructor() {
3112
+ super("shared.GenericType", [
3113
+ {
3114
+ no: 1,
3115
+ name: "data_type_identifier",
3116
+ kind: "scalar",
3117
+ T: 9
3118
+ /*ScalarType.STRING*/
3119
+ },
3120
+ { no: 2, name: "generic_mappers", kind: "message", repeat: 2, T: () => he }
3121
+ ]);
3122
+ }
3123
+ create(e) {
3124
+ const t = globalThis.Object.create(this.messagePrototype);
3125
+ return t.dataTypeIdentifier = "", t.genericMappers = [], e !== void 0 && m(this, t, e), t;
3126
+ }
3127
+ internalBinaryRead(e, t, n, r) {
3128
+ let i = r ?? this.create(), l = e.pos + t;
3129
+ for (; e.pos < l; ) {
3130
+ let [s, o] = e.tag();
3131
+ switch (s) {
3132
+ case /* string data_type_identifier */
3133
+ 1:
3134
+ i.dataTypeIdentifier = e.string();
3135
+ break;
3136
+ case /* repeated shared.GenericMapper generic_mappers */
3137
+ 2:
3138
+ i.genericMappers.push(he.internalBinaryRead(e, e.uint32(), n));
3139
+ break;
3140
+ default:
3141
+ let f = n.readUnknownField;
3142
+ if (f === "throw")
3143
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3144
+ let h = e.skip(o);
3145
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3146
+ }
3147
+ }
3148
+ return i;
3149
+ }
3150
+ internalBinaryWrite(e, t, n) {
3151
+ e.dataTypeIdentifier !== "" && t.tag(1, u.LengthDelimited).string(e.dataTypeIdentifier);
3152
+ for (let i = 0; i < e.genericMappers.length; i++)
3153
+ he.internalBinaryWrite(e.genericMappers[i], t.tag(2, u.LengthDelimited).fork(), n).join();
3154
+ let r = n.writeUnknownFields;
3155
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3156
+ }
3157
+ }
3158
+ const ce = new Wt();
3159
+ class Ct extends b {
3160
+ constructor() {
3161
+ super("shared.GenericMapper", [
3162
+ { no: 1, name: "source", kind: "message", repeat: 2, T: () => w },
3163
+ {
3164
+ no: 2,
3165
+ name: "target",
3166
+ kind: "scalar",
3167
+ T: 9
3168
+ /*ScalarType.STRING*/
3169
+ },
3170
+ { no: 3, name: "generic_combinations", kind: "enum", repeat: 1, T: () => ["shared.GenericMapper.GenericCombinationStrategy", v] }
3171
+ ]);
3172
+ }
3173
+ create(e) {
3174
+ const t = globalThis.Object.create(this.messagePrototype);
3175
+ return t.source = [], t.target = "", t.genericCombinations = [], e !== void 0 && m(this, t, e), t;
3176
+ }
3177
+ internalBinaryRead(e, t, n, r) {
3178
+ let i = r ?? this.create(), l = e.pos + t;
3179
+ for (; e.pos < l; ) {
3180
+ let [s, o] = e.tag();
3181
+ switch (s) {
3182
+ case /* repeated shared.DataTypeIdentifier source */
3183
+ 1:
3184
+ i.source.push(w.internalBinaryRead(e, e.uint32(), n));
3185
+ break;
3186
+ case /* string target */
3187
+ 2:
3188
+ i.target = e.string();
3189
+ break;
3190
+ case /* repeated shared.GenericMapper.GenericCombinationStrategy generic_combinations */
3191
+ 3:
3192
+ if (o === u.LengthDelimited)
3193
+ for (let g = e.int32() + e.pos; e.pos < g; )
3194
+ i.genericCombinations.push(e.int32());
3195
+ else
3196
+ i.genericCombinations.push(e.int32());
3197
+ break;
3198
+ default:
3199
+ let f = n.readUnknownField;
3200
+ if (f === "throw")
3201
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3202
+ let h = e.skip(o);
3203
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3204
+ }
3205
+ }
3206
+ return i;
3207
+ }
3208
+ internalBinaryWrite(e, t, n) {
3209
+ for (let i = 0; i < e.source.length; i++)
3210
+ w.internalBinaryWrite(e.source[i], t.tag(1, u.LengthDelimited).fork(), n).join();
3211
+ if (e.target !== "" && t.tag(2, u.LengthDelimited).string(e.target), e.genericCombinations.length) {
3212
+ t.tag(3, u.LengthDelimited).fork();
3213
+ for (let i = 0; i < e.genericCombinations.length; i++)
3214
+ t.int32(e.genericCombinations[i]);
3215
+ t.join();
3216
+ }
3217
+ let r = n.writeUnknownFields;
3218
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3219
+ }
3220
+ }
3221
+ const he = new Ct();
3222
+ class Vt extends b {
3223
+ constructor() {
3224
+ super("shared.FlowType", [
3225
+ {
3226
+ no: 1,
3227
+ name: "identifier",
3228
+ kind: "scalar",
3229
+ T: 9
3230
+ /*ScalarType.STRING*/
3231
+ },
3232
+ { no: 2, name: "settings", kind: "message", repeat: 2, T: () => de },
3233
+ {
3234
+ no: 3,
3235
+ name: "input_type_identifier",
3236
+ kind: "scalar",
3237
+ opt: !0,
3238
+ T: 9
3239
+ /*ScalarType.STRING*/
3240
+ },
3241
+ {
3242
+ no: 4,
3243
+ name: "return_type_identifier",
3244
+ kind: "scalar",
3245
+ opt: !0,
3246
+ T: 9
3247
+ /*ScalarType.STRING*/
3248
+ },
3249
+ {
3250
+ no: 5,
3251
+ name: "editable",
3252
+ kind: "scalar",
3253
+ T: 8
3254
+ /*ScalarType.BOOL*/
3255
+ },
3256
+ { no: 6, name: "name", kind: "message", repeat: 2, T: () => p },
3257
+ { no: 7, name: "description", kind: "message", repeat: 2, T: () => p },
3258
+ { no: 8, name: "documentation", kind: "message", repeat: 2, T: () => p },
3259
+ { no: 9, name: "version", kind: "message", T: () => x }
3260
+ ]);
3261
+ }
3262
+ create(e) {
3263
+ const t = globalThis.Object.create(this.messagePrototype);
3264
+ return t.identifier = "", t.settings = [], t.editable = !1, t.name = [], t.description = [], t.documentation = [], e !== void 0 && m(this, t, e), t;
3265
+ }
3266
+ internalBinaryRead(e, t, n, r) {
3267
+ let i = r ?? this.create(), l = e.pos + t;
3268
+ for (; e.pos < l; ) {
3269
+ let [s, o] = e.tag();
3270
+ switch (s) {
3271
+ case /* string identifier */
3272
+ 1:
3273
+ i.identifier = e.string();
3274
+ break;
3275
+ case /* repeated shared.FlowTypeSetting settings */
3276
+ 2:
3277
+ i.settings.push(de.internalBinaryRead(e, e.uint32(), n));
3278
+ break;
3279
+ case /* optional string input_type_identifier */
3280
+ 3:
3281
+ i.inputTypeIdentifier = e.string();
3282
+ break;
3283
+ case /* optional string return_type_identifier */
3284
+ 4:
3285
+ i.returnTypeIdentifier = e.string();
3286
+ break;
3287
+ case /* bool editable */
3288
+ 5:
3289
+ i.editable = e.bool();
3290
+ break;
3291
+ case /* repeated shared.Translation name */
3292
+ 6:
3293
+ i.name.push(p.internalBinaryRead(e, e.uint32(), n));
3294
+ break;
3295
+ case /* repeated shared.Translation description */
3296
+ 7:
3297
+ i.description.push(p.internalBinaryRead(e, e.uint32(), n));
3298
+ break;
3299
+ case /* repeated shared.Translation documentation */
3300
+ 8:
3301
+ i.documentation.push(p.internalBinaryRead(e, e.uint32(), n));
3302
+ break;
3303
+ case /* shared.Version version */
3304
+ 9:
3305
+ i.version = x.internalBinaryRead(e, e.uint32(), n, i.version);
3306
+ break;
3307
+ default:
3308
+ let f = n.readUnknownField;
3309
+ if (f === "throw")
3310
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3311
+ let h = e.skip(o);
3312
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3313
+ }
3314
+ }
3315
+ return i;
3316
+ }
3317
+ internalBinaryWrite(e, t, n) {
3318
+ e.identifier !== "" && t.tag(1, u.LengthDelimited).string(e.identifier);
3319
+ for (let i = 0; i < e.settings.length; i++)
3320
+ de.internalBinaryWrite(e.settings[i], t.tag(2, u.LengthDelimited).fork(), n).join();
3321
+ e.inputTypeIdentifier !== void 0 && t.tag(3, u.LengthDelimited).string(e.inputTypeIdentifier), e.returnTypeIdentifier !== void 0 && t.tag(4, u.LengthDelimited).string(e.returnTypeIdentifier), e.editable !== !1 && t.tag(5, u.Varint).bool(e.editable);
3322
+ for (let i = 0; i < e.name.length; i++)
3323
+ p.internalBinaryWrite(e.name[i], t.tag(6, u.LengthDelimited).fork(), n).join();
3324
+ for (let i = 0; i < e.description.length; i++)
3325
+ p.internalBinaryWrite(e.description[i], t.tag(7, u.LengthDelimited).fork(), n).join();
3326
+ for (let i = 0; i < e.documentation.length; i++)
3327
+ p.internalBinaryWrite(e.documentation[i], t.tag(8, u.LengthDelimited).fork(), n).join();
3328
+ e.version && x.internalBinaryWrite(e.version, t.tag(9, u.LengthDelimited).fork(), n).join();
3329
+ let r = n.writeUnknownFields;
3330
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3331
+ }
3332
+ }
3333
+ const At = new Vt();
3334
+ class jt extends b {
3335
+ constructor() {
3336
+ super("shared.FlowTypeSetting", [
3337
+ {
3338
+ no: 1,
3339
+ name: "identifier",
3340
+ kind: "scalar",
3341
+ T: 9
3342
+ /*ScalarType.STRING*/
3343
+ },
3344
+ {
3345
+ no: 2,
3346
+ name: "unique",
3347
+ kind: "scalar",
3348
+ T: 8
3349
+ /*ScalarType.BOOL*/
3350
+ },
3351
+ {
3352
+ no: 3,
3353
+ name: "data_type_identifier",
3354
+ kind: "scalar",
3355
+ T: 9
3356
+ /*ScalarType.STRING*/
3357
+ },
3358
+ { no: 4, name: "default_value", kind: "message", T: () => I },
3359
+ { no: 5, name: "name", kind: "message", repeat: 2, T: () => p },
3360
+ { no: 6, name: "description", kind: "message", repeat: 2, T: () => p }
3361
+ ]);
3362
+ }
3363
+ create(e) {
3364
+ const t = globalThis.Object.create(this.messagePrototype);
3365
+ return t.identifier = "", t.unique = !1, t.dataTypeIdentifier = "", t.name = [], t.description = [], e !== void 0 && m(this, t, e), t;
3366
+ }
3367
+ internalBinaryRead(e, t, n, r) {
3368
+ let i = r ?? this.create(), l = e.pos + t;
3369
+ for (; e.pos < l; ) {
3370
+ let [s, o] = e.tag();
3371
+ switch (s) {
3372
+ case /* string identifier */
3373
+ 1:
3374
+ i.identifier = e.string();
3375
+ break;
3376
+ case /* bool unique */
3377
+ 2:
3378
+ i.unique = e.bool();
3379
+ break;
3380
+ case /* string data_type_identifier */
3381
+ 3:
3382
+ i.dataTypeIdentifier = e.string();
3383
+ break;
3384
+ case /* optional shared.Value default_value */
3385
+ 4:
3386
+ i.defaultValue = I.internalBinaryRead(e, e.uint32(), n, i.defaultValue);
3387
+ break;
3388
+ case /* repeated shared.Translation name */
3389
+ 5:
3390
+ i.name.push(p.internalBinaryRead(e, e.uint32(), n));
3391
+ break;
3392
+ case /* repeated shared.Translation description */
3393
+ 6:
3394
+ i.description.push(p.internalBinaryRead(e, e.uint32(), n));
3395
+ break;
3396
+ default:
3397
+ let f = n.readUnknownField;
3398
+ if (f === "throw")
3399
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3400
+ let h = e.skip(o);
3401
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3402
+ }
3403
+ }
3404
+ return i;
3405
+ }
3406
+ internalBinaryWrite(e, t, n) {
3407
+ e.identifier !== "" && t.tag(1, u.LengthDelimited).string(e.identifier), e.unique !== !1 && t.tag(2, u.Varint).bool(e.unique), e.dataTypeIdentifier !== "" && t.tag(3, u.LengthDelimited).string(e.dataTypeIdentifier), e.defaultValue && I.internalBinaryWrite(e.defaultValue, t.tag(4, u.LengthDelimited).fork(), n).join();
3408
+ for (let i = 0; i < e.name.length; i++)
3409
+ p.internalBinaryWrite(e.name[i], t.tag(5, u.LengthDelimited).fork(), n).join();
3410
+ for (let i = 0; i < e.description.length; i++)
3411
+ p.internalBinaryWrite(e.description[i], t.tag(6, u.LengthDelimited).fork(), n).join();
3412
+ let r = n.writeUnknownFields;
3413
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3414
+ }
3415
+ }
3416
+ const de = new jt();
3417
+ class Pt extends b {
3418
+ constructor() {
3419
+ super("shared.RuntimeFunctionDefinition", [
3420
+ {
3421
+ no: 1,
3422
+ name: "runtime_name",
3423
+ kind: "scalar",
3424
+ T: 9
3425
+ /*ScalarType.STRING*/
3426
+ },
3427
+ { no: 2, name: "runtime_parameter_definitions", kind: "message", repeat: 2, T: () => pe },
3428
+ { no: 3, name: "return_type_identifier", kind: "message", T: () => w },
3429
+ {
3430
+ no: 4,
3431
+ name: "throws_error",
3432
+ kind: "scalar",
3433
+ T: 8
3434
+ /*ScalarType.BOOL*/
3435
+ },
3436
+ {
3437
+ no: 5,
3438
+ name: "generic_keys",
3439
+ kind: "scalar",
3440
+ repeat: 2,
3441
+ T: 9
3442
+ /*ScalarType.STRING*/
3443
+ },
3444
+ { no: 6, name: "name", kind: "message", repeat: 2, T: () => p },
3445
+ { no: 7, name: "description", kind: "message", repeat: 2, T: () => p },
3446
+ { no: 8, name: "documentation", kind: "message", repeat: 2, T: () => p },
3447
+ { no: 9, name: "deprecation_message", kind: "message", repeat: 2, T: () => p },
3448
+ { no: 10, name: "version", kind: "message", T: () => x }
3449
+ ]);
3450
+ }
3451
+ create(e) {
3452
+ const t = globalThis.Object.create(this.messagePrototype);
3453
+ return t.runtimeName = "", t.runtimeParameterDefinitions = [], t.throwsError = !1, t.genericKeys = [], t.name = [], t.description = [], t.documentation = [], t.deprecationMessage = [], e !== void 0 && m(this, t, e), t;
3454
+ }
3455
+ internalBinaryRead(e, t, n, r) {
3456
+ let i = r ?? this.create(), l = e.pos + t;
3457
+ for (; e.pos < l; ) {
3458
+ let [s, o] = e.tag();
3459
+ switch (s) {
3460
+ case /* string runtime_name */
3461
+ 1:
3462
+ i.runtimeName = e.string();
3463
+ break;
3464
+ case /* repeated shared.RuntimeParameterDefinition runtime_parameter_definitions */
3465
+ 2:
3466
+ i.runtimeParameterDefinitions.push(pe.internalBinaryRead(e, e.uint32(), n));
3467
+ break;
3468
+ case /* optional shared.DataTypeIdentifier return_type_identifier */
3469
+ 3:
3470
+ i.returnTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.returnTypeIdentifier);
3471
+ break;
3472
+ case /* bool throws_error */
3473
+ 4:
3474
+ i.throwsError = e.bool();
3475
+ break;
3476
+ case /* repeated string generic_keys */
3477
+ 5:
3478
+ i.genericKeys.push(e.string());
3479
+ break;
3480
+ case /* repeated shared.Translation name */
3481
+ 6:
3482
+ i.name.push(p.internalBinaryRead(e, e.uint32(), n));
3483
+ break;
3484
+ case /* repeated shared.Translation description */
3485
+ 7:
3486
+ i.description.push(p.internalBinaryRead(e, e.uint32(), n));
3487
+ break;
3488
+ case /* repeated shared.Translation documentation */
3489
+ 8:
3490
+ i.documentation.push(p.internalBinaryRead(e, e.uint32(), n));
3491
+ break;
3492
+ case /* repeated shared.Translation deprecation_message */
3493
+ 9:
3494
+ i.deprecationMessage.push(p.internalBinaryRead(e, e.uint32(), n));
3495
+ break;
3496
+ case /* shared.Version version */
3497
+ 10:
3498
+ i.version = x.internalBinaryRead(e, e.uint32(), n, i.version);
3499
+ break;
3500
+ default:
3501
+ let f = n.readUnknownField;
3502
+ if (f === "throw")
3503
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3504
+ let h = e.skip(o);
3505
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3506
+ }
3507
+ }
3508
+ return i;
3509
+ }
3510
+ internalBinaryWrite(e, t, n) {
3511
+ e.runtimeName !== "" && t.tag(1, u.LengthDelimited).string(e.runtimeName);
3512
+ for (let i = 0; i < e.runtimeParameterDefinitions.length; i++)
3513
+ pe.internalBinaryWrite(e.runtimeParameterDefinitions[i], t.tag(2, u.LengthDelimited).fork(), n).join();
3514
+ e.returnTypeIdentifier && w.internalBinaryWrite(e.returnTypeIdentifier, t.tag(3, u.LengthDelimited).fork(), n).join(), e.throwsError !== !1 && t.tag(4, u.Varint).bool(e.throwsError);
3515
+ for (let i = 0; i < e.genericKeys.length; i++)
3516
+ t.tag(5, u.LengthDelimited).string(e.genericKeys[i]);
3517
+ for (let i = 0; i < e.name.length; i++)
3518
+ p.internalBinaryWrite(e.name[i], t.tag(6, u.LengthDelimited).fork(), n).join();
3519
+ for (let i = 0; i < e.description.length; i++)
3520
+ p.internalBinaryWrite(e.description[i], t.tag(7, u.LengthDelimited).fork(), n).join();
3521
+ for (let i = 0; i < e.documentation.length; i++)
3522
+ p.internalBinaryWrite(e.documentation[i], t.tag(8, u.LengthDelimited).fork(), n).join();
3523
+ for (let i = 0; i < e.deprecationMessage.length; i++)
3524
+ p.internalBinaryWrite(e.deprecationMessage[i], t.tag(9, u.LengthDelimited).fork(), n).join();
3525
+ e.version && x.internalBinaryWrite(e.version, t.tag(10, u.LengthDelimited).fork(), n).join();
3526
+ let r = n.writeUnknownFields;
3527
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3528
+ }
3529
+ }
3530
+ const _t = new Pt();
3531
+ class St extends b {
3532
+ constructor() {
3533
+ super("shared.RuntimeParameterDefinition", [
3534
+ { no: 1, name: "data_type_identifier", kind: "message", T: () => w },
3535
+ {
3536
+ no: 2,
3537
+ name: "runtime_name",
3538
+ kind: "scalar",
3539
+ T: 9
3540
+ /*ScalarType.STRING*/
3541
+ },
3542
+ { no: 3, name: "default_value", kind: "message", T: () => I },
3543
+ { no: 4, name: "name", kind: "message", repeat: 2, T: () => p },
3544
+ { no: 5, name: "description", kind: "message", repeat: 2, T: () => p },
3545
+ { no: 6, name: "documentation", kind: "message", repeat: 2, T: () => p }
3546
+ ]);
3547
+ }
3548
+ create(e) {
3549
+ const t = globalThis.Object.create(this.messagePrototype);
3550
+ return t.runtimeName = "", t.name = [], t.description = [], t.documentation = [], e !== void 0 && m(this, t, e), t;
3551
+ }
3552
+ internalBinaryRead(e, t, n, r) {
3553
+ let i = r ?? this.create(), l = e.pos + t;
3554
+ for (; e.pos < l; ) {
3555
+ let [s, o] = e.tag();
3556
+ switch (s) {
3557
+ case /* shared.DataTypeIdentifier data_type_identifier */
3558
+ 1:
3559
+ i.dataTypeIdentifier = w.internalBinaryRead(e, e.uint32(), n, i.dataTypeIdentifier);
3560
+ break;
3561
+ case /* string runtime_name */
3562
+ 2:
3563
+ i.runtimeName = e.string();
3564
+ break;
3565
+ case /* optional shared.Value default_value */
3566
+ 3:
3567
+ i.defaultValue = I.internalBinaryRead(e, e.uint32(), n, i.defaultValue);
3568
+ break;
3569
+ case /* repeated shared.Translation name */
3570
+ 4:
3571
+ i.name.push(p.internalBinaryRead(e, e.uint32(), n));
3572
+ break;
3573
+ case /* repeated shared.Translation description */
3574
+ 5:
3575
+ i.description.push(p.internalBinaryRead(e, e.uint32(), n));
3576
+ break;
3577
+ case /* repeated shared.Translation documentation */
3578
+ 6:
3579
+ i.documentation.push(p.internalBinaryRead(e, e.uint32(), n));
3580
+ break;
3581
+ default:
3582
+ let f = n.readUnknownField;
3583
+ if (f === "throw")
3584
+ throw new globalThis.Error(`Unknown field ${s} (wire type ${o}) for ${this.typeName}`);
3585
+ let h = e.skip(o);
3586
+ f !== !1 && (f === !0 ? d.onRead : f)(this.typeName, i, s, o, h);
3587
+ }
3588
+ }
3589
+ return i;
3590
+ }
3591
+ internalBinaryWrite(e, t, n) {
3592
+ e.dataTypeIdentifier && w.internalBinaryWrite(e.dataTypeIdentifier, t.tag(1, u.LengthDelimited).fork(), n).join(), e.runtimeName !== "" && t.tag(2, u.LengthDelimited).string(e.runtimeName), e.defaultValue && I.internalBinaryWrite(e.defaultValue, t.tag(3, u.LengthDelimited).fork(), n).join();
3593
+ for (let i = 0; i < e.name.length; i++)
3594
+ p.internalBinaryWrite(e.name[i], t.tag(4, u.LengthDelimited).fork(), n).join();
3595
+ for (let i = 0; i < e.description.length; i++)
3596
+ p.internalBinaryWrite(e.description[i], t.tag(5, u.LengthDelimited).fork(), n).join();
3597
+ for (let i = 0; i < e.documentation.length; i++)
3598
+ p.internalBinaryWrite(e.documentation[i], t.tag(6, u.LengthDelimited).fork(), n).join();
3599
+ let r = n.writeUnknownFields;
3600
+ return r !== !1 && (r == !0 ? d.onWrite : r)(this.typeName, e, t), t;
3601
+ }
3602
+ }
3603
+ const pe = new St();
3604
+ var $ = /* @__PURE__ */ ((a) => (a.ContainsKey = "CONTAINS_KEY", a.ContainsType = "CONTAINS_TYPE", a.InputType = "INPUT_TYPE", a.ItemOfCollection = "ITEM_OF_COLLECTION", a.NumberRange = "NUMBER_RANGE", a.ParentType = "PARENT_TYPE", a.Regex = "REGEX", a.ReturnType = "RETURN_TYPE", a))($ || {}), W = /* @__PURE__ */ ((a) => (a.Array = "ARRAY", a.DataType = "DATA_TYPE", a.Error = "ERROR", a.Node = "NODE", a.Object = "OBJECT", a.Primitive = "PRIMITIVE", a.Type = "TYPE", a))(W || {}), me = /* @__PURE__ */ ((a) => (a.And = "AND", a.Or = "OR", a))(me || {});
3605
+ function E(a) {
3606
+ return {
3607
+ count: a.length,
3608
+ nodes: a
3609
+ };
3610
+ }
3611
+ function P(a, e) {
3612
+ const t = e.constructedDataTypes.find((n) => n.identifier === a);
3613
+ if (t == null) {
3614
+ const n = e.scannedTucanaTypes.find((i) => i.identifier === a);
3615
+ if (n == null)
3616
+ return console.error("Skipping Identifier because it can't be identified:" + a), null;
3617
+ const r = {
3618
+ id: `gid://sagittarius/DataType/${D(e)}`,
3619
+ genericKeys: n.genericKeys,
3620
+ identifier: n.identifier,
3621
+ name: E(n.name),
3622
+ rules: Mt(n.rules, e),
3623
+ variant: Xt(n.variant)
3624
+ };
3625
+ return e.constructedDataTypes.push(r), r;
3626
+ }
3627
+ return t;
3628
+ }
3629
+ function Mt(a, e) {
3630
+ return {
3631
+ count: a.length,
3632
+ nodes: a.map(
3633
+ (t) => {
3634
+ switch (t.config.oneofKind) {
3635
+ case "containsType": {
3636
+ const n = {
3637
+ dataTypeIdentifier: C(t.config.containsType.dataTypeIdentifier, e)
3638
+ };
3639
+ return {
3640
+ variant: $.ContainsType,
3641
+ config: n
3642
+ };
3643
+ }
3644
+ case "containsKey": {
3645
+ const n = {
3646
+ dataTypeIdentifier: C(t.config.containsKey.dataTypeIdentifier, e),
3647
+ key: t.config.containsKey.key
3648
+ };
3649
+ return {
3650
+ variant: $.ContainsKey,
3651
+ config: n
3652
+ };
3653
+ }
3654
+ case "itemOfCollection": {
3655
+ const n = {
3656
+ items: t.config.itemOfCollection.items
3657
+ //TODO: This needs to be checked
3658
+ };
3659
+ return {
3660
+ variant: $.ItemOfCollection,
3661
+ config: n
3662
+ };
3663
+ }
3664
+ case "numberRange": {
3665
+ const n = {
3666
+ from: Number(t.config.numberRange.from),
3667
+ steps: t.config.numberRange.steps ? Number(t.config.numberRange.steps) : void 0,
3668
+ to: Number(t.config.numberRange.to)
3669
+ };
3670
+ return {
3671
+ variant: $.NumberRange,
3672
+ config: n
3673
+ };
3674
+ }
3675
+ case "regex": {
3676
+ const n = {
3677
+ pattern: t.config.regex.pattern
3678
+ };
3679
+ return {
3680
+ variant: $.Regex,
3681
+ config: n
3682
+ };
3683
+ }
3684
+ case "inputTypes": {
3685
+ const n = {
3686
+ inputTypes: t.config.inputTypes.inputTypes.map((i) => (console.log("AF: " + i.inputIdentifier), {
3687
+ dataTypeIdentifier: C(i.dataTypeIdentifier, e),
3688
+ inputIdentifier: i.inputIdentifier
3689
+ }))
3690
+ };
3691
+ return {
3692
+ variant: $.InputType,
3693
+ config: n
3694
+ };
3695
+ }
3696
+ case "returnType": {
3697
+ const n = {
3698
+ dataTypeIdentifier: C(t.config.returnType.dataTypeIdentifier, e)
3699
+ };
3700
+ return {
3701
+ variant: $.ReturnType,
3702
+ config: n
3703
+ };
3704
+ }
3705
+ case "parentType": {
3706
+ const n = {
3707
+ dataTypeIdentifier: C(t.config.parentType.parentType, e)
3708
+ };
3709
+ return {
3710
+ variant: $.ParentType,
3711
+ config: n
3712
+ };
3713
+ }
3714
+ }
3715
+ throw new Error(`Unknown rule: ${a}`);
3716
+ }
3717
+ )
3718
+ };
3719
+ }
3720
+ function Xt(a) {
3721
+ switch (a) {
3722
+ case L.ARRAY:
3723
+ return W.Array;
3724
+ case L.DATATYPE:
3725
+ return W.DataType;
3726
+ case L.ERROR:
3727
+ return W.Error;
3728
+ case L.NODE:
3729
+ return W.Node;
3730
+ case L.OBJECT:
3731
+ return W.Object;
3732
+ case L.PRIMITIVE:
3733
+ return W.Primitive;
3734
+ case L.TYPE:
3735
+ return W.Type;
3736
+ default:
3737
+ throw new Error(`Unknown variant: ${a}`);
3738
+ }
3739
+ }
3740
+ function C(a, e) {
3741
+ if (a == null)
3742
+ return null;
3743
+ switch (a.type.oneofKind) {
3744
+ case "genericType":
3745
+ return {
3746
+ id: `gid://sagittarius/DataTypeIdentifier/${D(e)}`,
3747
+ genericType: {
3748
+ id: `gid://sagittarius/GenericType/${D(e)}`,
3749
+ dataType: P(a.type.genericType.dataTypeIdentifier, e),
3750
+ genericMappers: a.type.genericType.genericMappers.map((t) => ({
3751
+ genericCombinationStrategies: t.genericCombinations.map((n) => {
3752
+ let r;
3753
+ switch (n) {
3754
+ case v.AND:
3755
+ r = me.And;
3756
+ break;
3757
+ case v.OR:
3758
+ r = me.Or;
3759
+ break;
3760
+ default:
3761
+ throw new Error("GenericCombinationStrategy was Unknown");
3762
+ }
3763
+ return {
3764
+ id: `gid://sagittarius/GenericCombinationStrategy/${D(e)}`,
3765
+ type: r
3766
+ };
3767
+ }),
3768
+ sources: t.source.map(
3769
+ (n) => C(n, e)
3770
+ ).filter((n) => n != null),
3771
+ target: t.target,
3772
+ id: `gid://sagittarius/GenericMapper/${D(e)}`
3773
+ }))
3774
+ }
3775
+ };
3776
+ case "dataTypeIdentifier":
3777
+ return {
3778
+ id: `gid://sagittarius/DataTypeIdentifier/${D(e)}`,
3779
+ dataType: P(a.type.dataTypeIdentifier, e)
3780
+ };
3781
+ case "genericKey":
3782
+ return {
3783
+ id: `gid://sagittarius/DataTypeIdentifier/${D(e)}`,
3784
+ genericKey: a.type.genericKey
3785
+ };
3786
+ }
3787
+ return null;
3788
+ }
3789
+ function Gt(a, e) {
3790
+ return {
3791
+ id: `gid://sagittarius/TypesFlowType/${D(e)}`,
3792
+ identifier: a.identifier,
3793
+ inputType: P(a.inputTypeIdentifier, e),
3794
+ returnType: P(a.returnTypeIdentifier, e),
3795
+ flowTypeSettings: Jt(a.settings, e),
3796
+ names: E(a.name),
3797
+ descriptions: E(a.description),
3798
+ editable: a.editable
3799
+ };
3800
+ }
3801
+ function Jt(a, e) {
3802
+ return a.map((t) => ({
3803
+ id: `gid://sagittarius/FlowTypeSetting/${D(e)}`,
3804
+ names: E(t.name),
3805
+ descriptions: E(t.description),
3806
+ dataType: P(t.dataTypeIdentifier, e),
3807
+ identifier: t.identifier,
3808
+ unique: t.unique
3809
+ }));
3810
+ }
3811
+ function Yt(a, e) {
3812
+ return {
3813
+ id: `gid://sagittarius/FunctionDefinition/${D(e)}`,
3814
+ genericKeys: a.genericKeys,
3815
+ names: E(a.name),
3816
+ descriptions: E(a.description),
3817
+ documentations: E(a.documentation),
3818
+ deprecationMessages: E(a.deprecationMessage),
3819
+ throwsError: a.throwsError,
3820
+ returnType: C(a.returnTypeIdentifier, e),
3821
+ parameterDefinitions: Zt(a.runtimeParameterDefinitions, e)
3822
+ };
3823
+ }
3824
+ function Zt(a, e) {
3825
+ return {
3826
+ count: a.length,
3827
+ nodes: a.map((t) => ({
3828
+ id: `gid://sagittarius/ParameterDefinition/${D(e)}`,
3829
+ names: E(t.name),
3830
+ descriptions: E(t.description),
3831
+ documentations: E(t.documentation),
3832
+ dataType: C(t.dataTypeIdentifier, e)
3833
+ }))
3834
+ };
3835
+ }
3836
+ function D(a) {
3837
+ const e = a.id;
3838
+ return a.id += 1, e;
3839
+ }
3840
+ const zt = (a) => {
3841
+ const e = [], t = [], n = [];
3842
+ Ve(a, { withFileTypes: !0 }).forEach((s) => {
3843
+ const o = s.name.split("_")[0];
3844
+ if (o == null)
3845
+ throw new Error("Feature name is null");
3846
+ const f = je.join(s.parentPath, s.name), h = Ae(f);
3847
+ if (s.name.includes("data_type")) {
3848
+ const g = Tt.fromBinary(h);
3849
+ e.push(
3850
+ {
3851
+ feature: o,
3852
+ type: g
3853
+ }
3854
+ );
3855
+ }
3856
+ if (s.name.includes("function")) {
3857
+ const g = _t.fromBinary(h);
3858
+ t.push(
3859
+ {
3860
+ feature: o,
3861
+ func: g
3862
+ }
3863
+ );
3864
+ }
3865
+ if (s.name.includes("flow_type")) {
3866
+ const g = At.fromBinary(h);
3867
+ n.push(
3868
+ {
3869
+ feature: o,
3870
+ flow: g
3871
+ }
3872
+ );
3873
+ }
3874
+ });
3875
+ const r = [], i = {
3876
+ scannedTucanaTypes: e.map((s) => s.type),
3877
+ constructedDataTypes: [],
3878
+ id: 0
3879
+ };
3880
+ function l(s) {
3881
+ const o = r.find((h) => h.name === s);
3882
+ if (o != null)
3883
+ return o;
3884
+ const f = {
3885
+ name: s,
3886
+ dataTypes: [],
3887
+ flowTypes: [],
3888
+ runtimeFunctions: []
3889
+ };
3890
+ return r.push(f), f;
3891
+ }
3892
+ return e.map((s) => ({
3893
+ name: s.feature,
3894
+ type: P(s.type.identifier, i)
3895
+ })).forEach((s) => {
3896
+ s.type != null && l(s.name).dataTypes.push(s.type);
3897
+ }), t.map((s) => ({
3898
+ name: s.feature,
3899
+ type: Yt(s.func, i)
3900
+ })).forEach((s) => {
3901
+ s.type != null && l(s.name).runtimeFunctions.push(s.type);
3902
+ }), n.map((s) => ({
3903
+ name: s.feature,
3904
+ type: Gt(s.flow, i)
3905
+ })).forEach((s) => {
3906
+ s.type != null && l(s.name).flowTypes.push(s.type);
3907
+ }), r;
3908
+ };
3909
+ export {
3910
+ zt as Definition
3911
+ };