@chobantonov/jsonforms-react-antd-webcomponent 0.0.0-stage → 0.1.0

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.
Files changed (102) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +86 -2
  3. package/dist/JsonFormsAntdElement.d.ts +26 -0
  4. package/dist/index.d.ts +3 -0
  5. package/dist/jsonforms-react-antd.js +1 -0
  6. package/dist/register.d.ts +1 -0
  7. package/dist/register.js +6 -0
  8. package/dist/register.js.map +1 -0
  9. package/dist/renderers.d.ts +2 -0
  10. package/dist/src-BFTWxxIf.mjs +202 -0
  11. package/dist/src-BFTWxxIf.mjs.map +1 -0
  12. package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-B7smOgCn.mjs +39186 -0
  13. package/dist/standalone/AgGridControlRenderer.impl-BZS8_ocu-B7smOgCn.mjs.map +1 -0
  14. package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-DwdyKIB1.mjs +14894 -0
  15. package/dist/standalone/DynamicJSXRenderer-DyB3ZpZV-DwdyKIB1.mjs.map +1 -0
  16. package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-D5lfFu1i.mjs +12 -0
  17. package/dist/standalone/MarkupLabelRenderer.impl-CWfdcUuH-D5lfFu1i.mjs.map +1 -0
  18. package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-CQ8xjLar.mjs +774 -0
  19. package/dist/standalone/MonacoControlRenderer.impl-CyjMHbOd-CQ8xjLar.mjs.map +1 -0
  20. package/dist/standalone/RactiveTemplate-Cat7CxUp-BXSHwrZ1.mjs +8028 -0
  21. package/dist/standalone/RactiveTemplate-Cat7CxUp-BXSHwrZ1.mjs.map +1 -0
  22. package/dist/standalone/bg-peTJz2yn.mjs +54 -0
  23. package/dist/standalone/bg-peTJz2yn.mjs.map +1 -0
  24. package/dist/standalone/bg_BG-B44LSCyD.mjs +222 -0
  25. package/dist/standalone/bg_BG-B44LSCyD.mjs.map +1 -0
  26. package/dist/standalone/celTemplate-D_AGhaIL-RG6XN-Eu.mjs +137 -0
  27. package/dist/standalone/celTemplate-D_AGhaIL-RG6XN-Eu.mjs.map +1 -0
  28. package/dist/standalone/common-BEnIxhFt.mjs +18 -0
  29. package/dist/standalone/common-BEnIxhFt.mjs.map +1 -0
  30. package/dist/standalone/dayjs.min-adoc_mEQ.mjs +300 -0
  31. package/dist/standalone/dayjs.min-adoc_mEQ.mjs.map +1 -0
  32. package/dist/standalone/dynamicCel.esm-DGWfIAPF.mjs +43 -0
  33. package/dist/standalone/dynamicCel.esm-DGWfIAPF.mjs.map +1 -0
  34. package/dist/standalone/en-D7K60EG2.mjs +25 -0
  35. package/dist/standalone/en-D7K60EG2.mjs.map +1 -0
  36. package/dist/standalone/en_US-Bk9ytucu.mjs +223 -0
  37. package/dist/standalone/en_US-Bk9ytucu.mjs.map +1 -0
  38. package/dist/standalone/es-BToyXotK.mjs +51 -0
  39. package/dist/standalone/es-BToyXotK.mjs.map +1 -0
  40. package/dist/standalone/es_ES-n86UqGMA.mjs +245 -0
  41. package/dist/standalone/es_ES-n86UqGMA.mjs.map +1 -0
  42. package/dist/standalone/fr-DlN8a0TJ.mjs +52 -0
  43. package/dist/standalone/fr-DlN8a0TJ.mjs.map +1 -0
  44. package/dist/standalone/fr_FR-BNIh97oT.mjs +223 -0
  45. package/dist/standalone/fr_FR-BNIh97oT.mjs.map +1 -0
  46. package/dist/standalone/index.js +56734 -0
  47. package/dist/standalone/index.js.map +1 -0
  48. package/dist/standalone/it-0HHNpxpp.mjs +51 -0
  49. package/dist/standalone/it-0HHNpxpp.mjs.map +1 -0
  50. package/dist/standalone/it_IT-COjke9P6.mjs +245 -0
  51. package/dist/standalone/it_IT-COjke9P6.mjs.map +1 -0
  52. package/dist/standalone/ja-CqnjT8BB.mjs +57 -0
  53. package/dist/standalone/ja-CqnjT8BB.mjs.map +1 -0
  54. package/dist/standalone/ja_JP-DA4GA8OS.mjs +248 -0
  55. package/dist/standalone/ja_JP-DA4GA8OS.mjs.map +1 -0
  56. package/dist/standalone/jsonforms-react-extended.esm-CQmkt5NG.mjs +13673 -0
  57. package/dist/standalone/jsonforms-react-extended.esm-CQmkt5NG.mjs.map +1 -0
  58. package/dist/standalone/lib-0rajvaUg.mjs +3170 -0
  59. package/dist/standalone/lib-0rajvaUg.mjs.map +1 -0
  60. package/dist/standalone/markdown-C_y73Q0w-CfLH-8Sz.mjs +3061 -0
  61. package/dist/standalone/markdown-C_y73Q0w-CfLH-8Sz.mjs.map +1 -0
  62. package/dist/standalone/nl-CFqJarW7.mjs +52 -0
  63. package/dist/standalone/nl-CFqJarW7.mjs.map +1 -0
  64. package/dist/standalone/nl_NL-4FmulTf3.mjs +222 -0
  65. package/dist/standalone/nl_NL-4FmulTf3.mjs.map +1 -0
  66. package/dist/standalone/objectSpread2-C50HRvBU.mjs +71 -0
  67. package/dist/standalone/pl-Du1zDNA_.mjs +71 -0
  68. package/dist/standalone/pl-Du1zDNA_.mjs.map +1 -0
  69. package/dist/standalone/pl_PL-CBfuF99B.mjs +248 -0
  70. package/dist/standalone/pl_PL-CBfuF99B.mjs.map +1 -0
  71. package/dist/standalone/plainRecord.esm-BR1q_7e9.mjs +30 -0
  72. package/dist/standalone/plainRecord.esm-BR1q_7e9.mjs.map +1 -0
  73. package/dist/standalone/pt-Dg1pEKF5.mjs +52 -0
  74. package/dist/standalone/pt-Dg1pEKF5.mjs.map +1 -0
  75. package/dist/standalone/pt_PT--r6dtf89.mjs +268 -0
  76. package/dist/standalone/pt_PT--r6dtf89.mjs.map +1 -0
  77. package/dist/standalone/react-dom-Slk9aa5V.mjs +5644 -0
  78. package/dist/standalone/react-dom-Slk9aa5V.mjs.map +1 -0
  79. package/dist/standalone/rolldown-runtime-DUcC5eAW.mjs +26 -0
  80. package/dist/standalone/rowDetail.esm-Ce56gyeo.mjs +770 -0
  81. package/dist/standalone/rowDetail.esm-Ce56gyeo.mjs.map +1 -0
  82. package/dist/standalone/ru-CeNU1BY9.mjs +74 -0
  83. package/dist/standalone/ru-CeNU1BY9.mjs.map +1 -0
  84. package/dist/standalone/ru_RU-CIRMzMfd.mjs +245 -0
  85. package/dist/standalone/ru_RU-CIRMzMfd.mjs.map +1 -0
  86. package/dist/standalone/tr-Demj1YNf.mjs +51 -0
  87. package/dist/standalone/tr-Demj1YNf.mjs.map +1 -0
  88. package/dist/standalone/tr_TR-DOU85NN8.mjs +245 -0
  89. package/dist/standalone/tr_TR-DOU85NN8.mjs.map +1 -0
  90. package/dist/standalone/uk-Dq-ndPcu.mjs +67 -0
  91. package/dist/standalone/uk-Dq-ndPcu.mjs.map +1 -0
  92. package/dist/standalone/uk_UA-_65wU-M8.mjs +245 -0
  93. package/dist/standalone/uk_UA-_65wU-M8.mjs.map +1 -0
  94. package/dist/standalone/zh-cn-DteM8IK0.mjs +60 -0
  95. package/dist/standalone/zh-cn-DteM8IK0.mjs.map +1 -0
  96. package/dist/standalone/zh_CN-BaFiZ2OD.mjs +226 -0
  97. package/dist/standalone/zh_CN-BaFiZ2OD.mjs.map +1 -0
  98. package/package.json +62 -3
  99. package/src/JsonFormsAntdElement.tsx +327 -0
  100. package/src/index.tsx +4 -0
  101. package/src/register.ts +5 -0
  102. package/src/renderers.ts +20 -0
@@ -0,0 +1,3170 @@
1
+ import { i as e, n as t, r as n, t as r } from "./objectSpread2-C50HRvBU.mjs";
2
+ import { n as i, r as a } from "./plainRecord.esm-BR1q_7e9.mjs";
3
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/checkPrivateRedeclaration.js
4
+ function o(e, t) {
5
+ if (t.has(e)) throw TypeError("Cannot initialize the same private elements twice on an object");
6
+ }
7
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldInitSpec.js
8
+ function s(e, t, n) {
9
+ o(e, t), t.set(e, n);
10
+ }
11
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/assertClassBrand.js
12
+ function c(e, t, n) {
13
+ if (typeof e == "function" ? e === t : e.has(t)) return arguments.length < 3 ? t : n;
14
+ throw TypeError("Private element is not present on this object");
15
+ }
16
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldSet2.js
17
+ function l(e, t, n) {
18
+ return e.set(c(e, t), n), n;
19
+ }
20
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateFieldGet2.js
21
+ function u(e, t) {
22
+ return e.get(c(e, t));
23
+ }
24
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/errors.js
25
+ var d = /* @__PURE__ */ new WeakMap(), f = /* @__PURE__ */ new WeakMap(), p = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakMap(), te = class extends Error {
26
+ constructor({ name: e, code: t, message: n, node: r, cause: i, range: a }) {
27
+ super(n, i ? { cause: i } : void 0), s(this, d, void 0), s(this, f, void 0), s(this, p, void 0), s(this, ee, void 0), this.name = e, l(f, this, t), l(ee, this, n), l(d, this, r), l(p, this, a && se(a) || se(r)), r != null && r.input && (this.message = ce(u(ee, this), r, u(p, this)));
28
+ }
29
+ get node() {
30
+ return u(d, this);
31
+ }
32
+ get code() {
33
+ return u(f, this);
34
+ }
35
+ get range() {
36
+ return u(p, this);
37
+ }
38
+ get summary() {
39
+ return u(ee, this);
40
+ }
41
+ withAst(e) {
42
+ return u(d, this) || !(e != null && e.input) || (l(d, this, e), u(p, this) != null || l(p, this, se(e)), this.message = ce(u(ee, this), e, u(p, this))), this;
43
+ }
44
+ };
45
+ function ne(e, t, n, r, i) {
46
+ if (typeof n == "string") return {
47
+ name: e,
48
+ code: t,
49
+ message: n,
50
+ node: r,
51
+ cause: i
52
+ };
53
+ let a = n;
54
+ if (typeof a != "object") throw Error("First param to error must be a string or object");
55
+ return {
56
+ name: e,
57
+ code: a.code || t,
58
+ message: a.message,
59
+ node: a.node,
60
+ cause: a.cause,
61
+ range: a.range
62
+ };
63
+ }
64
+ var re = class extends te {
65
+ constructor(e, t, n) {
66
+ super(ne("ParseError", "parse_error", e, t, n));
67
+ }
68
+ }, ie = class extends te {
69
+ constructor(e, t, n) {
70
+ super(ne("EvaluationError", "evaluation_error", e, t, n));
71
+ }
72
+ }, ae = class extends te {
73
+ constructor(e, t, n) {
74
+ super(ne("TypeError", "type_error", e, t, n));
75
+ }
76
+ };
77
+ function m(e, t, n) {
78
+ return typeof e == "object" ? new re(e) : new re({
79
+ code: e,
80
+ message: t,
81
+ node: n
82
+ });
83
+ }
84
+ function h(e, t, n) {
85
+ return typeof e == "object" ? new ie(e) : new ie({
86
+ code: e,
87
+ message: t,
88
+ node: n
89
+ });
90
+ }
91
+ function oe(e, t, n) {
92
+ return typeof e == "object" ? new ae(e) : new ae({
93
+ code: e,
94
+ message: t,
95
+ node: n
96
+ });
97
+ }
98
+ function se(e) {
99
+ var t;
100
+ let n = (t = e == null ? void 0 : e.pos) == null ? e == null ? void 0 : e.start : t;
101
+ if (typeof n == "number") return {
102
+ start: n,
103
+ end: typeof e.end == "number" ? e.end : n
104
+ };
105
+ }
106
+ function ce(e, t, n) {
107
+ var r;
108
+ let i = (r = t.pos) == null ? n == null ? void 0 : n.start : r;
109
+ if (typeof i != "number") return e;
110
+ let a = t.input, o = 1, s = 0, c = 0;
111
+ for (; s < i;) a[s] === "\n" ? (o++, c = 0) : c++, s++;
112
+ let l = i, u = i;
113
+ for (; l > 0 && a[l - 1] !== "\n";) l--;
114
+ for (; u < a.length && a[u] !== "\n";) u++;
115
+ let d = a.slice(l, u);
116
+ return `${e}\n\n${`> ${`${o}`.padStart(4, " ")} | ${d}\n${" ".repeat(9 + c)}^`}`;
117
+ }
118
+ function le(e, t) {
119
+ return e instanceof te ? e.withAst(t) : e;
120
+ }
121
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/optional.js
122
+ var ue, de, g = /* @__PURE__ */ new WeakMap();
123
+ ue = Symbol.toStringTag, de = Symbol.for("nodejs.util.inspect.custom");
124
+ var _ = class e {
125
+ constructor(e) {
126
+ s(this, g, void 0), l(g, this, e);
127
+ }
128
+ static of(t) {
129
+ return t === void 0 ? fe : new e(t);
130
+ }
131
+ static none() {
132
+ return fe;
133
+ }
134
+ hasValue() {
135
+ return u(g, this) !== void 0;
136
+ }
137
+ value() {
138
+ if (u(g, this) === void 0) throw h("optional_value_missing", "Optional value is not present");
139
+ return u(g, this);
140
+ }
141
+ or(t) {
142
+ if (u(g, this) !== void 0) return this;
143
+ if (t instanceof e) return t;
144
+ throw h("invalid_optional_argument", "Optional.or must be called with an Optional argument");
145
+ }
146
+ orValue(e) {
147
+ return u(g, this) === void 0 ? e : u(g, this);
148
+ }
149
+ get [ue]() {
150
+ return "optional";
151
+ }
152
+ [de]() {
153
+ return u(g, this) === void 0 ? "Optional { none }" : `Optional { value: ${JSON.stringify(u(g, this))} }`;
154
+ }
155
+ }, fe = Object.freeze(new _()), pe = class {}, me = new pe();
156
+ function he(e, t) {
157
+ let n = t ? me : void 0;
158
+ e.deleteVariable("optional"), e.registerConstant("optional", "OptionalNamespace", n);
159
+ }
160
+ function ge(e) {
161
+ let t = { async: !1 }, n = (n, r) => e.registerFunctionOverload(n, r, t), r = e.enableOptionalTypes ? me : void 0;
162
+ e.registerType("OptionalNamespace", pe), e.registerConstant("optional", "OptionalNamespace", r), n("optional.hasValue(): bool", (e) => e.hasValue()), n("optional<A>.value(): A", (e) => e.value()), e.registerFunctionOverload("OptionalNamespace.none(): optional<T>", () => _.none()), n("OptionalNamespace.of(A): optional<A>", (e, t) => _.of(t));
163
+ function i(e, t, n) {
164
+ if (e instanceof _) return e;
165
+ throw h("optional_expected", `${n} must be optional`, t);
166
+ }
167
+ function a(e, t, n) {
168
+ let r = e.run(t.receiver, n);
169
+ return r instanceof Promise ? r.then((r) => o(r, e, t, n)) : o(r, e, t, n);
170
+ }
171
+ function o(e, t, n, r) {
172
+ let a = i(e, n.receiver, `${n.functionDesc} receiver`);
173
+ return a.hasValue() ? n.onHasValue(a) : n.onEmpty(t, n, r);
174
+ }
175
+ function s(e, t, n, r) {
176
+ let i = e.check(t, n);
177
+ if (i.kind === "optional") return i;
178
+ if (i.kind === "dyn") return e.getType("optional");
179
+ throw e.createError("optional_expected", `${r} must be optional, got '${i}'`, t);
180
+ }
181
+ function c({ functionDesc: e, evaluate: t, typeCheck: n, onHasValue: r, onEmpty: i }) {
182
+ return ({ ast: a, args: o, receiver: s }) => ({
183
+ ast: a,
184
+ functionDesc: e,
185
+ receiver: s,
186
+ arg: o[0],
187
+ evaluate: t,
188
+ typeCheck: n,
189
+ onHasValue: r,
190
+ onEmpty: i
191
+ });
192
+ }
193
+ let l = "optional.or(optional) argument";
194
+ e.registerFunctionOverload("optional.or(ast): optional<dyn>", c({
195
+ functionDesc: "optional.or(optional)",
196
+ evaluate: a,
197
+ typeCheck(e, t, n) {
198
+ let r = s(e, t.receiver, n, "optional.or(optional) receiver"), i = s(e, t.arg, n, l);
199
+ t.receiver.maybeAsync || t.arg.maybeAsync || t.ast.setMeta("async", !1);
200
+ let a = r.unify(e.registry, i);
201
+ if (a) return a;
202
+ throw e.createError("incompatible_argument_type", `${t.functionDesc} argument must be compatible type, got '${r}' and '${i}'`, t.arg);
203
+ },
204
+ onHasValue: (e) => e,
205
+ onEmpty(e, t, n) {
206
+ let r = t.arg, a = e.run(r, n);
207
+ return a instanceof Promise ? a.then((e) => i(e, r, l)) : i(a, r, l);
208
+ }
209
+ })), e.registerFunctionOverload("optional.orValue(ast): dyn", c({
210
+ functionDesc: "optional.orValue(value)",
211
+ onHasValue: (e) => e.value(),
212
+ onEmpty(e, t, n) {
213
+ return e.run(t.arg, n);
214
+ },
215
+ evaluate: a,
216
+ typeCheck(e, t, n) {
217
+ let r = s(e, t.receiver, n, "optional.orValue() receiver").valueType, i = e.check(t.arg, n);
218
+ t.receiver.maybeAsync || t.arg.maybeAsync || t.ast.setMeta("async", !1);
219
+ let a = r.unify(e.registry, i);
220
+ if (a) return a;
221
+ throw e.createError("incompatible_argument_type", `${t.functionDesc} argument must be compatible type, got '${r}' and '${i}'`, t.arg);
222
+ }
223
+ }));
224
+ }
225
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/globals.js
226
+ var _e = Object.hasOwn, v = Object.keys, y = Object.freeze, ve = Object.entries, ye = Array.isArray, be = Array.from;
227
+ function xe(e, t) {
228
+ return (e == null ? void 0 : e[Symbol.toStringTag]) === "AsyncFunction" || typeof t != "boolean" || t;
229
+ }
230
+ var Se = /* @__PURE__ */ new Set([
231
+ "as",
232
+ "break",
233
+ "const",
234
+ "continue",
235
+ "else",
236
+ "for",
237
+ "function",
238
+ "if",
239
+ "import",
240
+ "let",
241
+ "loop",
242
+ "package",
243
+ "namespace",
244
+ "return",
245
+ "var",
246
+ "void",
247
+ "while",
248
+ "__proto__",
249
+ "prototype"
250
+ ]), Ce, we, Te, Ee, b = /* @__PURE__ */ new WeakMap();
251
+ Ce = Symbol.toStringTag, we = Symbol.for("nodejs.util.inspect.custom");
252
+ var x = class {
253
+ constructor(e) {
254
+ s(this, b, void 0), this.verify(typeof e == "bigint" ? e : BigInt(e));
255
+ }
256
+ get value() {
257
+ return u(b, this);
258
+ }
259
+ valueOf() {
260
+ return u(b, this);
261
+ }
262
+ toString() {
263
+ return `${u(b, this)}`;
264
+ }
265
+ verify(e) {
266
+ if (e < 0n || e > 18446744073709551615n) throw h("numeric_overflow", "Unsigned integer overflow");
267
+ l(b, this, e);
268
+ }
269
+ get [Ce]() {
270
+ return `value = ${u(b, this)}`;
271
+ }
272
+ [we]() {
273
+ return `UnsignedInteger { value: ${u(b, this)} }`;
274
+ }
275
+ }, De = 1e9, Oe = 1000000000n, ke = {
276
+ h: 3600000000000n,
277
+ m: 60000000000n,
278
+ s: Oe,
279
+ ms: 1000000n,
280
+ us: 1000n,
281
+ µs: 1000n,
282
+ ns: 1n
283
+ }, S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap();
284
+ Te = Symbol.toStringTag, Ee = Symbol.for("nodejs.util.inspect.custom");
285
+ var Ae = class e {
286
+ constructor(e, t = 0) {
287
+ s(this, S, void 0), s(this, C, void 0), l(S, this, BigInt(e)), l(C, this, t);
288
+ }
289
+ get seconds() {
290
+ return u(S, this);
291
+ }
292
+ get nanos() {
293
+ return u(C, this);
294
+ }
295
+ valueOf() {
296
+ return Number(u(S, this)) * 1e3 + u(C, this) / 1e6;
297
+ }
298
+ static fromMilliseconds(t) {
299
+ let n = BigInt(Math.trunc(t * 1e6)), r = n / Oe, i = Number(n % Oe);
300
+ return new e(r, i);
301
+ }
302
+ addDuration(t) {
303
+ let n = u(C, this) + t.nanos;
304
+ return new e(u(S, this) + t.seconds + BigInt(Math.floor(n / De)), n % De);
305
+ }
306
+ subtractDuration(t) {
307
+ let n = u(C, this) - t.nanos;
308
+ return new e(u(S, this) - t.seconds + BigInt(Math.floor(n / De)), (n + De) % De);
309
+ }
310
+ extendTimestamp(e) {
311
+ return new Date(e.getTime() + Number(u(S, this)) * 1e3 + Math.floor(u(C, this) / 1e6));
312
+ }
313
+ subtractTimestamp(e) {
314
+ return /* @__PURE__ */ new Date(e.getTime() - Number(u(S, this)) * 1e3 - Math.floor(u(C, this) / 1e6));
315
+ }
316
+ toString() {
317
+ let e = u(C, this) ? (u(C, this) / De).toLocaleString("en-US", {
318
+ useGrouping: !1,
319
+ maximumFractionDigits: 9
320
+ }).slice(1) : "";
321
+ return `${u(S, this)}${e}s`;
322
+ }
323
+ getHours() {
324
+ return u(S, this) / 3600n;
325
+ }
326
+ getMinutes() {
327
+ return u(S, this) / 60n;
328
+ }
329
+ getSeconds() {
330
+ return u(S, this);
331
+ }
332
+ getMilliseconds() {
333
+ return u(S, this) * 1000n + BigInt(Math.floor(u(C, this) / 1e6));
334
+ }
335
+ get [Te]() {
336
+ return "google.protobuf.Duration";
337
+ }
338
+ [Ee]() {
339
+ return `google.protobuf.Duration { seconds: ${u(S, this)}, nanos: ${u(C, this)} }`;
340
+ }
341
+ };
342
+ function je(e) {
343
+ let t = { async: !1 }, n = (n, r) => e.registerFunctionOverload(n, r, t), r = (e) => e;
344
+ n("dyn(dyn): dyn", r);
345
+ for (let e in E) {
346
+ let t = E[e];
347
+ t instanceof T && n(`type(${t.name}): type`, () => t);
348
+ }
349
+ n("bool(bool): bool", r), n("bool(string): bool", (e) => {
350
+ switch (e) {
351
+ case "1":
352
+ case "t":
353
+ case "true":
354
+ case "TRUE":
355
+ case "True": return !0;
356
+ case "0":
357
+ case "f":
358
+ case "false":
359
+ case "FALSE":
360
+ case "False": return !1;
361
+ default: throw h("bool_conversion_error", `bool() conversion error: invalid string value "${e}"`);
362
+ }
363
+ }), n("size(string): int", (e) => BigInt(Me(e))), n("size(bytes): int", (e) => BigInt(e.length)), n("size(list): int", (e) => {
364
+ var t;
365
+ return BigInt((t = e.length) == null ? e.size : t);
366
+ }), n("size(map): int", (e) => BigInt(e instanceof Map ? e.size : v(e).length)), n("string.size(): int", (e) => BigInt(Me(e))), n("bytes.size(): int", (e) => BigInt(e.length)), n("list.size(): int", (e) => {
367
+ var t;
368
+ return BigInt((t = e.length) == null ? e.size : t);
369
+ }), n("map.size(): int", (e) => BigInt(e instanceof Map ? e.size : v(e).length)), n("bytes(string): bytes", (e) => o.fromString(e)), n("bytes(bytes): bytes", r), n("double(double): double", r), n("double(int): double", (e) => Number(e)), n("double(uint): double", (e) => Number(e)), n("double(string): double", (e) => {
370
+ if (!e || e !== e.trim()) throw h("double_conversion_error", "double() type error: cannot convert to double");
371
+ switch (e.toLowerCase()) {
372
+ case "inf":
373
+ case "+inf":
374
+ case "infinity":
375
+ case "+infinity": return Infinity;
376
+ case "-inf":
377
+ case "-infinity": return -Infinity;
378
+ case "nan": return NaN;
379
+ default: {
380
+ let t = Number(e);
381
+ if (!Number.isNaN(t)) return t;
382
+ throw h("double_conversion_error", "double() type error: cannot convert to double");
383
+ }
384
+ }
385
+ }), n("int(int): int", r), n("int(double): int", (e) => {
386
+ if (Number.isFinite(e)) return BigInt(Math.trunc(e));
387
+ throw h("numeric_overflow", "int() type error: integer overflow");
388
+ }), n("int(string): int", (e) => {
389
+ if (e !== e.trim() || e.length > 20 || e.includes("0x")) throw h("int_conversion_error", "int() type error: cannot convert to int");
390
+ try {
391
+ let t = BigInt(e);
392
+ if (t <= 9223372036854775807n && t >= -9223372036854775808n) return t;
393
+ } catch (e) {}
394
+ throw h("int_conversion_error", "int() type error: cannot convert to int");
395
+ }), n("uint(uint): uint", r), n("uint(int): uint", (e) => {
396
+ try {
397
+ return new x(e);
398
+ } catch (e) {
399
+ throw h("uint_conversion_error", "uint() type error: cannot convert to uint");
400
+ }
401
+ }), n("uint(double): uint", (e) => {
402
+ try {
403
+ return new x(Math.trunc(e));
404
+ } catch (e) {
405
+ throw h("numeric_overflow", "uint() type error: unsigned integer overflow");
406
+ }
407
+ }), n("uint(string): uint", (e) => {
408
+ if (e !== e.trim() || e.length > 20 || e.includes("0x")) throw h("uint_conversion_error", "uint() type error: cannot convert to uint");
409
+ try {
410
+ return new x(e);
411
+ } catch (e) {
412
+ throw h("uint_conversion_error", "uint() type error: cannot convert to uint");
413
+ }
414
+ }), n("string(string): string", r), n("string(bool): string", (e) => `${e}`), n("string(int): string", (e) => `${e}`), n("string(uint): string", (e) => `${e}`), n("string(bytes): string", (e) => o.toUtf8(e)), n("string(double): string", (e) => e === Infinity ? "+Inf" : e === -Infinity ? "-Inf" : `${e}`), n("string.startsWith(string): bool", (e, t) => e.startsWith(t)), n("string.endsWith(string): bool", (e, t) => e.endsWith(t)), n("string.contains(string): bool", (e, t) => e.includes(t)), n("string.lowerAscii(): string", (e) => e.toLowerCase()), n("string.upperAscii(): string", (e) => e.toUpperCase()), n("string.trim(): string", (e) => e.trim()), n("string.indexOf(string): int", (e, t) => BigInt(e.indexOf(t))), n("string.indexOf(string, int): int", (e, t, n) => {
415
+ if (t === "") return n;
416
+ if (n = Number(n), n < 0 || n >= e.length) throw h("index_out_of_range", "string.indexOf(search, fromIndex): fromIndex out of range");
417
+ return BigInt(e.indexOf(t, n));
418
+ }), n("string.lastIndexOf(string): int", (e, t) => BigInt(e.lastIndexOf(t))), n("string.lastIndexOf(string, int): int", (e, t, n) => {
419
+ if (t === "") return n;
420
+ if (n = Number(n), n < 0 || n >= e.length) throw h("index_out_of_range", "string.lastIndexOf(search, fromIndex): fromIndex out of range");
421
+ return BigInt(e.lastIndexOf(t, n));
422
+ }), n("string.substring(int): string", (e, t) => {
423
+ if (t = Number(t), t < 0 || t > e.length) throw h("index_out_of_range", "string.substring(start, end): start index out of range");
424
+ return e.substring(t);
425
+ }), n("string.substring(int, int): string", (e, t, n) => {
426
+ if (t = Number(t), t < 0 || t > e.length) throw h("index_out_of_range", "string.substring(start, end): start index out of range");
427
+ if (n = Number(n), n < t || n > e.length) throw h("index_out_of_range", "string.substring(start, end): end index out of range");
428
+ return e.substring(t, n);
429
+ }), n("string.matches(string): bool", (e, t) => {
430
+ try {
431
+ return new RegExp(t).test(e);
432
+ } catch (e) {
433
+ throw h("invalid_regular_expression", `Invalid regular expression: ${t}`);
434
+ }
435
+ }), n("string.split(string): list<string>", (e, t) => e.split(t)), n("string.split(string, int): list<string>", (e, t, n) => {
436
+ if (n = Number(n), n === 0) return [];
437
+ let r = e.split(t);
438
+ if (n < 0 || r.length <= n) return r;
439
+ let i = r.slice(0, n - 1);
440
+ return i.push(r.slice(n - 1).join(t)), i;
441
+ }), n("list<string>.join(): string", (e) => {
442
+ for (let t = 0; t < e.length; t++) if (typeof e[t] != "string") throw h("invalid_list_element_type", "string.join(): list must contain only strings");
443
+ return e.join("");
444
+ }), n("list<string>.join(string): string", (e, t) => {
445
+ for (let t = 0; t < e.length; t++) if (typeof e[t] != "string") throw h("invalid_list_element_type", "string.join(separator): list must contain only strings");
446
+ return e.join(t);
447
+ });
448
+ let i = new TextEncoder("utf8"), a = new TextDecoder("utf8"), o = typeof Buffer < "u" ? {
449
+ byteLength: (e) => Buffer.byteLength(e),
450
+ fromString: (e) => Buffer.from(e, "utf8"),
451
+ toHex: (e) => Buffer.prototype.hexSlice.call(e, 0, e.length),
452
+ toBase64: (e) => Buffer.prototype.base64Slice.call(e, 0, e.length),
453
+ toUtf8: (e) => Buffer.prototype.utf8Slice.call(e, 0, e.length),
454
+ jsonParse: (e) => JSON.parse(e)
455
+ } : {
456
+ textEncoder: new TextEncoder("utf8"),
457
+ byteLength: (e) => i.encode(e).length,
458
+ fromString: (e) => i.encode(e),
459
+ toHex: Uint8Array.prototype.toHex ? (e) => e.toHex() : (e) => be(e, (e) => e.toString(16).padStart(2, "0")).join(""),
460
+ toBase64: Uint8Array.prototype.toBase64 ? (e) => e.toBase64() : (e) => btoa(be(e, (e) => String.fromCodePoint(e)).join("")),
461
+ toUtf8: (e) => a.decode(e),
462
+ jsonParse: (e) => JSON.parse(i.decode(e))
463
+ };
464
+ n("bytes.json(): map", o.jsonParse), n("bytes.hex(): string", o.toHex), n("bytes.string(): string", o.toUtf8), n("bytes.base64(): string", o.toBase64), n("bytes.at(int): int", (e, t) => {
465
+ if (t < 0 || t >= e.length) throw h("index_out_of_range", "Bytes index out of range");
466
+ return BigInt(e[t]);
467
+ });
468
+ let s = "google.protobuf.Timestamp", c = e.registerType(s, Date).typeType, l = e.registerType("google.protobuf.Duration", Ae).typeType;
469
+ e.registerConstant("google", "map<string, map<string, type>>", { protobuf: {
470
+ Duration: l,
471
+ Timestamp: c
472
+ } });
473
+ function u(e, t) {
474
+ return new Date(e.toLocaleString("en-US", { timeZone: t }));
475
+ }
476
+ function d(e, t) {
477
+ let n = t ? u(e, t) : new Date(e.getUTCFullYear(), e.getUTCMonth(), e.getUTCDate()), r = new Date(n.getFullYear(), 0, 0);
478
+ return BigInt(Math.floor((n - r) / 864e5) - 1);
479
+ }
480
+ n(`timestamp(string): ${s}`, (e) => {
481
+ if (e.length < 20 || e.length > 30) throw h("invalid_timestamp", "timestamp() requires a string in ISO 8601 format");
482
+ let t = new Date(e);
483
+ if (t <= 0xe677d21fdbff && t >= -621355968e5) return t;
484
+ throw h("invalid_timestamp", "timestamp() requires a string in ISO 8601 format");
485
+ }), n(`timestamp(int): ${s}`, (e) => {
486
+ if (e = Number(e) * 1e3, e <= 0xe677d21fdbff && e >= -621355968e5) return new Date(e);
487
+ throw h("invalid_timestamp", "timestamp() requires a valid integer unix timestamp");
488
+ }), n(`${s}.getDate(): int`, (e) => BigInt(e.getUTCDate())), n(`${s}.getDate(string): int`, (e, t) => BigInt(u(e, t).getDate())), n(`${s}.getDayOfMonth(): int`, (e) => BigInt(e.getUTCDate() - 1)), n(`${s}.getDayOfMonth(string): int`, (e, t) => BigInt(u(e, t).getDate() - 1)), n(`${s}.getDayOfWeek(): int`, (e) => BigInt(e.getUTCDay())), n(`${s}.getDayOfWeek(string): int`, (e, t) => BigInt(u(e, t).getDay())), n(`${s}.getDayOfYear(): int`, d), n(`${s}.getDayOfYear(string): int`, d), n(`${s}.getFullYear(): int`, (e) => BigInt(e.getUTCFullYear())), n(`${s}.getFullYear(string): int`, (e, t) => BigInt(u(e, t).getFullYear())), n(`${s}.getHours(): int`, (e) => BigInt(e.getUTCHours())), n(`${s}.getHours(string): int`, (e, t) => BigInt(u(e, t).getHours())), n(`${s}.getMilliseconds(): int`, (e) => BigInt(e.getUTCMilliseconds())), n(`${s}.getMilliseconds(string): int`, (e) => BigInt(e.getUTCMilliseconds())), n(`${s}.getMinutes(): int`, (e) => BigInt(e.getUTCMinutes())), n(`${s}.getMinutes(string): int`, (e, t) => BigInt(u(e, t).getMinutes())), n(`${s}.getMonth(): int`, (e) => BigInt(e.getUTCMonth())), n(`${s}.getMonth(string): int`, (e, t) => BigInt(u(e, t).getMonth())), n(`${s}.getSeconds(): int`, (e) => BigInt(e.getUTCSeconds())), n(`${s}.getSeconds(string): int`, (e, t) => BigInt(u(e, t).getSeconds()));
489
+ let f = /(\d*\.?\d*)(ns|us|µs|ms|s|m|h)/;
490
+ function p(e) {
491
+ if (!e) throw h("invalid_duration", "Invalid duration string: ''");
492
+ let t = e[0] === "-";
493
+ (e[0] === "-" || e[0] === "+") && (e = e.slice(1));
494
+ let n = BigInt(0);
495
+ for (;;) {
496
+ let t = f.exec(e);
497
+ if (!t || t.index !== 0) throw h("invalid_duration", `Invalid duration string: ${e}`);
498
+ e = e.slice(t[0].length);
499
+ let r = ke[t[2]], [i = "0", a = ""] = t[1].split("."), o = BigInt(i) * r, s = a ? BigInt(a.slice(0, 13).padEnd(13, "0")) * r / 10000000000000n : 0n;
500
+ if (n += o + s, e === "") break;
501
+ }
502
+ let r = n >= Oe ? n / Oe : 0n, i = Number(n % Oe);
503
+ return t ? new Ae(-r, -i) : new Ae(r, i);
504
+ }
505
+ n("duration(string): google.protobuf.Duration", (e) => p(e)), n("google.protobuf.Duration.getHours(): int", (e) => e.getHours()), n("google.protobuf.Duration.getMinutes(): int", (e) => e.getMinutes()), n("google.protobuf.Duration.getSeconds(): int", (e) => e.getSeconds()), n("google.protobuf.Duration.getMilliseconds(): int", (e) => e.getMilliseconds()), ge(e);
506
+ }
507
+ function Me(e) {
508
+ let t = 0;
509
+ for (let n of e) t++;
510
+ return t;
511
+ }
512
+ // \0@oxc-project+runtime@0.156.0/helpers/esm/classPrivateMethodInitSpec.js
513
+ function w(e, t) {
514
+ o(e, t), t.add(e);
515
+ }
516
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/registry.js
517
+ e();
518
+ var Ne, Pe, Fe = /* @__PURE__ */ new WeakMap();
519
+ Ne = Symbol.toStringTag;
520
+ var T = class {
521
+ constructor(e) {
522
+ s(this, Fe, void 0), l(Fe, this, e), y(this);
523
+ }
524
+ get name() {
525
+ return u(Fe, this);
526
+ }
527
+ get [Ne]() {
528
+ return `Type<${u(Fe, this)}>`;
529
+ }
530
+ toString() {
531
+ return `Type<${u(Fe, this)}>`;
532
+ }
533
+ }, E = {
534
+ string: new T("string"),
535
+ bool: new T("bool"),
536
+ int: new T("int"),
537
+ uint: new T("uint"),
538
+ double: new T("double"),
539
+ map: new T("map"),
540
+ list: new T("list"),
541
+ bytes: new T("bytes"),
542
+ null_type: new T("null"),
543
+ type: new T("type")
544
+ }, Ie = new T("optional"), Le = {
545
+ dyn(e, t) {
546
+ switch (typeof e) {
547
+ case "string":
548
+ case "bigint":
549
+ case "number":
550
+ case "boolean": return !0;
551
+ case "object": switch (e && e.constructor) {
552
+ case null:
553
+ case void 0:
554
+ case Object:
555
+ case Map:
556
+ case Array:
557
+ case Set: return !0;
558
+ default: if (t.objectTypesByConstructor.get(e.constructor)) return !0;
559
+ }
560
+ }
561
+ return !!t.debugType(e);
562
+ },
563
+ string(e) {
564
+ return typeof e == "string";
565
+ },
566
+ int(e) {
567
+ return typeof e == "bigint";
568
+ },
569
+ double(e) {
570
+ return typeof e == "number";
571
+ },
572
+ bool(e) {
573
+ return typeof e == "boolean";
574
+ },
575
+ null(e) {
576
+ return e === null;
577
+ },
578
+ bytes(e) {
579
+ return e instanceof Uint8Array;
580
+ },
581
+ uint(e) {
582
+ return e instanceof x;
583
+ },
584
+ type(e) {
585
+ return e instanceof T;
586
+ },
587
+ list(e) {
588
+ switch (e == null ? void 0 : e.constructor) {
589
+ case Array:
590
+ case Set: return !0;
591
+ default: return !1;
592
+ }
593
+ },
594
+ map(e) {
595
+ switch (typeof e == "object" && e ? e.constructor : null) {
596
+ case void 0:
597
+ case Object:
598
+ case Map: return !0;
599
+ default: return !1;
600
+ }
601
+ },
602
+ optional(e) {
603
+ return e instanceof _;
604
+ },
605
+ message(e, t) {
606
+ return this === t.debugType(e);
607
+ }
608
+ };
609
+ Le.param = Le.dyn;
610
+ var Re = /* @__PURE__ */ new WeakMap(), D = /* @__PURE__ */ new WeakSet(), O = class {
611
+ constructor({ kind: e, type: t, name: n, keyType: r, valueType: i }) {
612
+ var a, o, l, u;
613
+ w(this, D), s(this, Re, /* @__PURE__ */ new WeakMap()), this.kind = e, this.type = t, this.name = n, this.keyType = r, this.valueType = i, this.unwrappedType = e === "dyn" && i ? i.unwrappedType : this, this.wrappedType = e === "dyn" ? this : $e(this.unwrappedType), this.hasDynType = this.kind === "dyn" || ((a = this.valueType) == null ? void 0 : a.hasDynType) || ((o = this.keyType) == null ? void 0 : o.hasDynType) || !1, this.hasPlaceholderType = this.kind === "param" || ((l = this.keyType) == null ? void 0 : l.hasPlaceholderType) || ((u = this.valueType) == null ? void 0 : u.hasPlaceholderType) || !1, e === "list" ? this.fieldLazy = c(D, this, Ue) : e === "map" ? this.fieldLazy = c(D, this, Ve) : e === "message" ? this.fieldLazy = c(D, this, Be) : e === "optional" && (this.fieldLazy = c(D, this, ze)), this.matchesValueType = Le[n] || Le[e], y(this);
614
+ }
615
+ isDynOrBool() {
616
+ return this.type === "bool" || this.kind === "dyn";
617
+ }
618
+ isEmpty() {
619
+ return this.valueType && this.valueType.kind === "param";
620
+ }
621
+ unify(e, t) {
622
+ let n = this;
623
+ if (n === t || n.kind === "dyn" || t.kind === "param") return n;
624
+ if (t.kind === "dyn" || n.kind === "param") return t;
625
+ if (n.kind !== t.kind || !(n.hasPlaceholderType || t.hasPlaceholderType || n.hasDynType || t.hasDynType)) return null;
626
+ let r = n.valueType.unify(e, t.valueType);
627
+ if (!r) return null;
628
+ switch (n.kind) {
629
+ case "optional": return e.getOptionalType(r);
630
+ case "list": return e.getListType(r);
631
+ case "map":
632
+ let i = n.keyType.unify(e, t.keyType);
633
+ return i ? e.getMapType(i, r) : null;
634
+ }
635
+ }
636
+ templated(e, t) {
637
+ if (!this.hasPlaceholderType) return this;
638
+ switch (this.kind) {
639
+ case "dyn": return this.valueType.templated(e, t);
640
+ case "param": return (t == null ? void 0 : t.get(this.name)) || this;
641
+ case "map": return e.getMapType(this.keyType.templated(e, t), this.valueType.templated(e, t));
642
+ case "list": return e.getListType(this.valueType.templated(e, t));
643
+ case "optional": return e.getOptionalType(this.valueType.templated(e, t));
644
+ default: return this;
645
+ }
646
+ }
647
+ toString() {
648
+ return this.name;
649
+ }
650
+ fieldLazy() {}
651
+ field(e, t, n, r) {
652
+ let i = this.fieldLazy(e, t, n, r);
653
+ if (i !== void 0) return i;
654
+ throw h("no_such_key", `No such key: ${t}`, n);
655
+ }
656
+ matchesBoth(e) {
657
+ return this.matches(e) && e.matches(this);
658
+ }
659
+ matches(e) {
660
+ var t;
661
+ let n = this.unwrappedType;
662
+ return e = e.unwrappedType, n === e || n.kind === "dyn" || e.kind === "dyn" || e.kind === "param" ? !0 : (t = u(Re, this).get(e)) == null ? u(Re, this).set(e, c(D, this, We).call(this, n, e)).get(e) : t;
663
+ }
664
+ };
665
+ function ze(e, t, n, r) {
666
+ if (e = e instanceof _ ? e.orValue() : e, e === void 0) return fe;
667
+ let i = r.debugType(e);
668
+ try {
669
+ return _.of(i.fieldLazy(e, t, n, r));
670
+ } catch (e) {
671
+ if (e instanceof ie) return fe;
672
+ throw e;
673
+ }
674
+ }
675
+ function Be(e, t, n, r) {
676
+ let i = e ? r.objectTypesByConstructor.get(e.constructor) : void 0;
677
+ if (!i) return;
678
+ let a = i.fields ? i.fields[t] : A;
679
+ if (!a) return;
680
+ let o = e instanceof Map ? e.get(t) : e[t];
681
+ if (o !== void 0) {
682
+ if (a.matchesValueType(o, r)) return o;
683
+ throw h("field_type_mismatch", `Field '${t}' is not of type '${a}', got '${r.debugType(o)}'`, n);
684
+ }
685
+ }
686
+ function Ve(e, t, n, r) {
687
+ let i = e instanceof Map ? e.get(t) : e && _e(e, t) ? e[t] : void 0;
688
+ if (i !== void 0) {
689
+ if (this.valueType.matchesValueType(i, r)) return i;
690
+ throw h("field_type_mismatch", `Field '${t}' is not of type '${this.valueType}', got '${r.debugType(i)}'`, n);
691
+ }
692
+ }
693
+ function He(e, t) {
694
+ switch (e == null ? void 0 : e.constructor) {
695
+ case Array: return e[t];
696
+ case Set: {
697
+ let n = 0;
698
+ for (let r of e) if (n++ === t) return r;
699
+ }
700
+ }
701
+ }
702
+ function Ue(e, t, n, r) {
703
+ if (typeof t == "bigint") t = Number(t);
704
+ else if (typeof t != "number") return;
705
+ let i = c(D, this, He).call(this, e, t);
706
+ if (i === void 0) {
707
+ if (!e) return;
708
+ throw h("index_out_of_bounds", `No such key: index out of bounds, index ${t} ${t < 0 ? "< 0" : `>= size ${e.length || e.size}`}`, n);
709
+ }
710
+ if (this.valueType.matchesValueType(i, r)) return i;
711
+ throw h("list_item_type_mismatch", `List item with index '${t}' is not of type '${this.valueType}', got '${r.debugType(i)}'`, n);
712
+ }
713
+ function We(e, t) {
714
+ switch (e.kind) {
715
+ case "dyn":
716
+ case "param": return !0;
717
+ case "list": return t.kind === "list" && e.valueType.matches(t.valueType);
718
+ case "map": return t.kind === "map" && e.keyType.matches(t.keyType) && e.valueType.matches(t.valueType);
719
+ case "optional": return t.kind === "optional" && e.valueType.matches(t.valueType);
720
+ default: return e.name === t.name;
721
+ }
722
+ }
723
+ var Ge = "have a .callAst property or .evaluate(checker, macro, ctx) method.", Ke = "have a .callAst property or .typeCheck(checker, macro, ctx) method.";
724
+ function qe(e, t) {
725
+ let n = `Macro '${e}' must`;
726
+ return function(e) {
727
+ let r = t(e);
728
+ if (!r || typeof r != "object") throw Error(`${n} return an object.`);
729
+ if (r.callAst) return r;
730
+ if (!r.evaluate) throw Error(`${n} ${Ge}`);
731
+ if (!r.typeCheck) throw Error(`${n} ${Ke}`);
732
+ return r;
733
+ };
734
+ }
735
+ var Je = class {
736
+ constructor(e, t, n, r) {
737
+ this.name = e, this.type = t, this.description = n == null ? null : n, this.constant = r !== void 0, this.value = r, y(this);
738
+ }
739
+ }, Ye = class {
740
+ constructor({ name: e, receiverType: t, returnType: n, handler: r, description: i, params: a, async: o }) {
741
+ var s;
742
+ if (typeof e != "string") throw Error("name must be a string");
743
+ if (typeof r != "function") throw Error("handler must be a function");
744
+ this.name = e, this.async = xe(r, o), this.receiverType = t == null ? null : t, this.returnType = n, this.description = i == null ? null : i, this.params = a, this.argTypes = a.map((e) => e.type), this.macro = this.argTypes.includes(rt);
745
+ let c = t ? `${t}.` : "";
746
+ this.signature = `${c}${e}(${this.argTypes.join(", ")}): ${n}`, this.handler = this.macro ? qe(this.signature, r) : r, this.partitionKey = `${t ? "rcall" : "call"}:${e}:${a.length}`, this.hasPlaceholderType = this.returnType.hasPlaceholderType || ((s = this.receiverType) == null ? void 0 : s.hasPlaceholderType) || this.argTypes.some((e) => e.hasPlaceholderType) || !1, y(this);
747
+ }
748
+ matchesArgs(e) {
749
+ return e.length === this.argTypes.length && this.argTypes.every((t, n) => t.matches(e[n])) ? this : null;
750
+ }
751
+ }, Xe = class {
752
+ constructor({ op: e, leftType: t, rightType: n, handler: r, returnType: i, async: a }) {
753
+ var o;
754
+ this.operator = e, this.leftType = t, this.rightType = n || null, this.handler = r, this.async = xe(r, a), this.returnType = i, this.signature = n ? `${t} ${e} ${n}: ${i}` : `${e}${t}: ${i}`, this.hasPlaceholderType = this.leftType.hasPlaceholderType || ((o = this.rightType) == null ? void 0 : o.hasPlaceholderType) || !1, y(this);
755
+ }
756
+ equals(e) {
757
+ return this.operator === e.operator && this.leftType === e.leftType && this.rightType === e.rightType;
758
+ }
759
+ };
760
+ function Ze(e) {
761
+ return new O({
762
+ kind: "list",
763
+ name: `list<${e}>`,
764
+ type: "list",
765
+ valueType: e
766
+ });
767
+ }
768
+ function k(e) {
769
+ return new O({
770
+ kind: "primitive",
771
+ name: e,
772
+ type: e
773
+ });
774
+ }
775
+ function Qe(e) {
776
+ return new O({
777
+ kind: "message",
778
+ name: e,
779
+ type: e
780
+ });
781
+ }
782
+ function $e(e) {
783
+ let t = e ? `dyn<${e}>` : "dyn";
784
+ return new O({
785
+ kind: "dyn",
786
+ name: t,
787
+ type: t,
788
+ valueType: e
789
+ });
790
+ }
791
+ function et(e) {
792
+ return new O({
793
+ kind: "optional",
794
+ name: `optional<${e}>`,
795
+ type: "optional",
796
+ valueType: e
797
+ });
798
+ }
799
+ function tt(e, t) {
800
+ return new O({
801
+ kind: "map",
802
+ name: `map<${e}, ${t}>`,
803
+ type: "map",
804
+ keyType: e,
805
+ valueType: t
806
+ });
807
+ }
808
+ function nt(e) {
809
+ return new O({
810
+ kind: "param",
811
+ name: e,
812
+ type: e
813
+ });
814
+ }
815
+ var A = $e(), rt = k("ast"), it = Ze(A), at = tt(A, A), j = {
816
+ string: k("string"),
817
+ bool: k("bool"),
818
+ int: k("int"),
819
+ uint: k("uint"),
820
+ double: k("double"),
821
+ bytes: k("bytes"),
822
+ dyn: A,
823
+ null: k("null"),
824
+ type: k("type"),
825
+ optional: et(A),
826
+ list: it,
827
+ "list<dyn>": it,
828
+ map: at,
829
+ "map<dyn, dyn>": at
830
+ };
831
+ for (let e of [
832
+ j.string,
833
+ j.double,
834
+ j.int
835
+ ]) {
836
+ let t = Ze(e), n = tt(j.string, e);
837
+ j[t.name] = t, j[n.name] = n;
838
+ }
839
+ Object.freeze(j);
840
+ var M = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), N = /* @__PURE__ */ new WeakSet();
841
+ Pe = Symbol.iterator;
842
+ var st = class {
843
+ constructor(e) {
844
+ w(this, N), n(this, "returnType", null), n(this, "async", !1), n(this, "macro", !1), s(this, M, null), s(this, ot, null), n(this, "declarations", []), this.registry = e;
845
+ }
846
+ [Pe]() {
847
+ return this.declarations[Symbol.iterator]();
848
+ }
849
+ add(e) {
850
+ var t, n;
851
+ this.returnType = (this.returnType || e.returnType).unify(this.registry, e.returnType) || A, e.macro && (this.macro = e), e.async && !this.async && (this.async = !0), this.declarations.push(e), (t = u(M, this)) == null || t.clear(), (n = u(ot, this)) == null || n.clear();
852
+ }
853
+ findFunction(e, t = null) {
854
+ for (let n = 0; n < this.declarations.length; n++) {
855
+ let r = c(N, this, pt).call(this, this.declarations[n], e, t);
856
+ if (r) return r;
857
+ }
858
+ return null;
859
+ }
860
+ findUnaryOverload(e) {
861
+ var t;
862
+ let n = ((t = u(M, this)) == null ? l(M, this, /* @__PURE__ */ new Map()) : t).get(e);
863
+ if (n !== void 0) return n;
864
+ let r = !1;
865
+ for (let t of this.declarations) if (t.leftType === e) {
866
+ r = t;
867
+ break;
868
+ }
869
+ return u(M, this).set(e, r), r;
870
+ }
871
+ findBinaryOverload(e, t) {
872
+ var n, r, i;
873
+ return e.kind === "dyn" && e.valueType ? t = t.wrappedType : t.kind === "dyn" && t.valueType && (e = e.wrappedType), (n = (r = ((i = u(M, this)) == null ? l(M, this, /* @__PURE__ */ new Map()) : i).get(e)) == null ? void 0 : r.get(t)) == null ? c(N, this, ct).call(this, u(M, this), e, t, c(N, this, lt).call(this, e, t)) : n;
874
+ }
875
+ checkBinaryOverload(e, t) {
876
+ var n, r, i;
877
+ return (n = (r = ((i = u(ot, this)) == null ? l(ot, this, /* @__PURE__ */ new Map()) : i).get(e)) == null ? void 0 : r.get(t)) == null ? c(N, this, ct).call(this, u(ot, this), e, t, c(N, this, ut).call(this, e, t)) : n;
878
+ }
879
+ };
880
+ function ct(e, t, n, r) {
881
+ return (e.get(t) || e.set(t, /* @__PURE__ */ new Map()).get(t)).set(n, r), r;
882
+ }
883
+ function lt(e, t) {
884
+ let n = c(N, this, dt).call(this, e, t);
885
+ if (n.length === 0) return !1;
886
+ if (n.length === 1) return n[0];
887
+ throw Error(`Operator overload '${n[0].signature}' overlaps with '${n[1].signature}'.`);
888
+ }
889
+ function ut(e, t) {
890
+ let n = c(N, this, dt).call(this, e, t);
891
+ if (n.length === 0) return !1;
892
+ let r = n[0].returnType;
893
+ for (let e = 1; e < n.length; e++) r = r.unify(this.registry, n[e].returnType) || A;
894
+ return r;
895
+ }
896
+ function dt(e, t) {
897
+ let n = [];
898
+ for (let r of this.declarations) {
899
+ if (r.leftType === e && r.rightType === t) return [r];
900
+ let i = c(N, this, ft).call(this, r, e, t);
901
+ i && n.push(i);
902
+ }
903
+ if (n.length === 0) {
904
+ var r;
905
+ let t = (r = this.declarations[0]) == null ? void 0 : r.operator;
906
+ if ((t === "==" || t === "!=") && e.kind === "dyn") return Ct[t];
907
+ }
908
+ return n;
909
+ }
910
+ function ft(e, t, n) {
911
+ let r = e.hasPlaceholderType ? /* @__PURE__ */ new Map() : null, i = c(N, this, ht).call(this, e.leftType, t, r);
912
+ if (!i) return;
913
+ let a = c(N, this, ht).call(this, e.rightType, n, r);
914
+ if (a) return (e.operator === "==" || e.operator === "!=") && e.leftType.kind === "dyn" && e.leftType.valueType && t.kind !== "dyn" && n.kind !== "dyn" ? !1 : e.hasPlaceholderType ? {
915
+ async: e.async,
916
+ signature: e.signature,
917
+ handler: e.handler,
918
+ leftType: i,
919
+ rightType: a,
920
+ returnType: e.returnType.templated(this.registry, r)
921
+ } : e;
922
+ }
923
+ function pt(e, t, n) {
924
+ if (e.hasPlaceholderType) return c(N, this, mt).call(this, e, t, n);
925
+ if (!(n && e.receiverType && !n.matches(e.receiverType))) return e.matchesArgs(t);
926
+ }
927
+ function mt(e, t, n) {
928
+ let r = /* @__PURE__ */ new Map();
929
+ if (n && e.receiverType && !c(N, this, ht).call(this, e.receiverType, n, r)) return null;
930
+ for (let n = 0; n < t.length; n++) if (!c(N, this, ht).call(this, e.argTypes[n], t[n], r)) return null;
931
+ return {
932
+ async: e.async,
933
+ handler: e.handler,
934
+ signature: e.signature,
935
+ returnType: e.returnType.templated(this.registry, r)
936
+ };
937
+ }
938
+ function ht(e, t, n) {
939
+ if (!e.hasPlaceholderType) return t.matches(e) ? t : null;
940
+ let r = t.kind === "dyn";
941
+ return c(N, this, gt).call(this, e, t, n, r) && (r || t.matches(e.templated(this.registry, n))) ? t : null;
942
+ }
943
+ function gt(e, t, n, r = !1) {
944
+ if (!e.hasPlaceholderType) return !0;
945
+ if (!t) return !1;
946
+ let i = r || t.kind === "dyn";
947
+ switch (t = t.unwrappedType, e.kind) {
948
+ case "param": {
949
+ let r = i ? A : t, a = n.get(e.name);
950
+ return a ? a.kind === "dyn" || r.kind === "dyn" || a.matchesBoth(r) : n.set(e.name, r) && !0;
951
+ }
952
+ case "list": return t.name === "dyn" && (t = e), t.kind === "list" && c(N, this, gt).call(this, e.valueType, t.valueType, n, i);
953
+ case "map": return t.name === "dyn" && (t = e), t.kind === "map" && c(N, this, gt).call(this, e.keyType, t.keyType, n, i) && c(N, this, gt).call(this, e.valueType, t.valueType, n, i);
954
+ case "optional": return t.name === "dyn" && (t = e), t.kind === "optional" && c(N, this, gt).call(this, e.valueType, t.valueType, n, i);
955
+ }
956
+ return !0;
957
+ }
958
+ function _t(e) {
959
+ let t = [], n = "", r = 0;
960
+ for (let i of e) {
961
+ if (i === "<") r++;
962
+ else if (i === ">") r--;
963
+ else if (i === "," && r === 0) {
964
+ t.push(n.trim()), n = "";
965
+ continue;
966
+ }
967
+ n += i;
968
+ }
969
+ return n && t.push(n.trim()), t;
970
+ }
971
+ var vt = [
972
+ [
973
+ x,
974
+ "uint",
975
+ E.uint,
976
+ j.uint
977
+ ],
978
+ [
979
+ T,
980
+ "type",
981
+ E.type,
982
+ j.type
983
+ ],
984
+ [
985
+ _,
986
+ "optional",
987
+ Ie,
988
+ j.optional
989
+ ],
990
+ [
991
+ Uint8Array,
992
+ "bytes",
993
+ E.bytes,
994
+ j.bytes
995
+ ],
996
+ ...typeof Buffer < "u" ? [[
997
+ Buffer,
998
+ "bytes",
999
+ E.bytes,
1000
+ j.bytes
1001
+ ]] : []
1002
+ ].map(([e, t, n, r]) => Object.freeze({
1003
+ name: t,
1004
+ typeType: n,
1005
+ type: r,
1006
+ ctor: e
1007
+ })), yt = vt.map((e) => [e.name, e]), bt = vt.map((e) => [e.ctor, e]), xt = (e) => /* @__PURE__ */ Error(`Invalid variable declaration: ${e}`), St = (e) => /* @__PURE__ */ Error(`Invalid type declaration: ${e}`), Ct = {
1008
+ "==": [{
1009
+ handler: (e, t) => e === t,
1010
+ returnType: j.bool
1011
+ }],
1012
+ "!=": [{
1013
+ handler: (e, t) => e !== t,
1014
+ returnType: j.bool
1015
+ }]
1016
+ }, wt = /* @__PURE__ */ new WeakMap(), P = /* @__PURE__ */ new WeakMap(), Tt = /* @__PURE__ */ new WeakMap(), F = /* @__PURE__ */ new WeakMap(), I = /* @__PURE__ */ new WeakMap(), L = /* @__PURE__ */ new WeakMap(), R = /* @__PURE__ */ new WeakMap(), Et = /* @__PURE__ */ new WeakMap(), z = /* @__PURE__ */ new WeakMap(), Dt = /* @__PURE__ */ new WeakMap(), Ot = /* @__PURE__ */ new WeakMap(), B = /* @__PURE__ */ new WeakMap(), V = /* @__PURE__ */ new WeakSet(), kt = class e {
1017
+ constructor(t = {}) {
1018
+ var n, r;
1019
+ w(this, V), s(this, wt, null), s(this, P, void 0), s(this, Tt, !0), s(this, F, null), s(this, I, null), s(this, L, null), s(this, R, null), s(this, Et, null), s(this, z, null), s(this, Dt, null), s(this, Ot, null), s(this, B, !1), this.enableOptionalTypes = (n = t.enableOptionalTypes) != null && n, this.unlistedVariablesAreDyn = (r = t.unlistedVariablesAreDyn) != null && r;
1020
+ let i = t.parent instanceof e ? t.parent : null;
1021
+ if (i) {
1022
+ l(wt, this, i);
1023
+ let e = i;
1024
+ for (; e && !u(F, e);) e = u(wt, e);
1025
+ let t = i;
1026
+ for (; t && !u(I, t);) t = u(wt, t);
1027
+ l(L, this, u(L, i)), l(R, this, u(R, i)), l(Ot, this, {
1028
+ operators: u(F, e),
1029
+ functions: u(I, t)
1030
+ }), this.objectTypes = new Map(i.objectTypes), this.objectTypesByConstructor = new Map(i.objectTypesByConstructor), this.variables = i.variables, l(Tt, this, !1), l(P, this, u(P, i)), l(Et, this, u(Et, i)), l(z, this, u(z, i)), l(Dt, this, u(Dt, i)), (this.enableOptionalTypes !== i.enableOptionalTypes || this.unlistedVariablesAreDyn !== i.unlistedVariablesAreDyn) && he(this, this.enableOptionalTypes);
1031
+ } else {
1032
+ l(F, this, []), l(I, this, []), this.objectTypes = new Map(yt), this.objectTypesByConstructor = new Map(bt), l(P, this, new Map(ve(j))), l(Et, this, /* @__PURE__ */ new Map()), l(z, this, /* @__PURE__ */ new Map()), l(Dt, this, /* @__PURE__ */ new Map()), this.variables = /* @__PURE__ */ new Map(), this.variables.dyn = this.unlistedVariablesAreDyn;
1033
+ for (let e in E) this.registerConstant(e, "type", E[e]);
1034
+ }
1035
+ }
1036
+ deleteVariable(e) {
1037
+ c(V, this, At).call(this), this.variables.delete(e);
1038
+ }
1039
+ operatorCandidates(e) {
1040
+ if (u(L, this)) return c(V, this, Nt).call(this, u(L, this), e);
1041
+ let t = l(L, this, /* @__PURE__ */ new Map());
1042
+ for (let e of c(V, this, Pt).call(this)) c(V, this, Nt).call(this, t, e.operator).add(e);
1043
+ return c(V, this, Nt).call(this, t, e);
1044
+ }
1045
+ functionCandidates(e, t, n) {
1046
+ return c(V, this, It).call(this, `${e ? "rcall" : "call"}:${t}:${n}`);
1047
+ }
1048
+ registerVariable(e, t, n) {
1049
+ if (u(B, this)) throw Error("Cannot modify frozen registry");
1050
+ let r = n == null ? void 0 : n.description, i;
1051
+ if (typeof e == "string" && typeof t == "object" && !(t instanceof O) ? (r = t.description, i = t.value, t = t.schema ? this.registerType({
1052
+ name: `$${e}`,
1053
+ schema: t.schema
1054
+ }).type : t.type) : typeof e == "object" && (t = e.schema ? this.registerType({
1055
+ name: `$${e.name}`,
1056
+ schema: e.schema
1057
+ }).type : e.type, r = e.description, i = e.value, e = e.name), typeof e != "string" || !e) throw xt("name must be a string");
1058
+ if (Se.has(e)) throw xt(`'${e}' is a reserved name`);
1059
+ if (this.variables.get(e) !== void 0) throw xt(`'${e}' is already registered`);
1060
+ if (typeof t == "string") t = this.getType(t);
1061
+ else if (!(t instanceof O)) throw xt("type is required");
1062
+ return c(V, this, At).call(this), this.variables.set(e, new Je(e, t, r, i)), this;
1063
+ }
1064
+ registerConstant(e, t, n) {
1065
+ return typeof e == "object" ? this.registerVariable(e) : this.registerVariable({
1066
+ name: e,
1067
+ type: t,
1068
+ value: n
1069
+ }), this;
1070
+ }
1071
+ getType(e) {
1072
+ return c(V, this, H).call(this, e, !0);
1073
+ }
1074
+ getListType(e) {
1075
+ return u(Et, this).get(e) || u(Et, this).set(e, c(V, this, H).call(this, `list<${e}>`, !0)).get(e);
1076
+ }
1077
+ getMapType(e, t) {
1078
+ var n;
1079
+ return ((n = u(z, this).get(e)) == null ? void 0 : n.get(t)) || (u(z, this).get(e) || u(z, this).set(e, /* @__PURE__ */ new Map()).get(e)).set(t, c(V, this, H).call(this, `map<${e}, ${t}>`, !0)).get(t);
1080
+ }
1081
+ getOptionalType(e) {
1082
+ return u(Dt, this).get(e) || u(Dt, this).set(e, c(V, this, H).call(this, `optional<${e}>`, !0)).get(e);
1083
+ }
1084
+ assertType(e, t, n) {
1085
+ try {
1086
+ return c(V, this, H).call(this, e, !0);
1087
+ } catch (r) {
1088
+ throw r.message = `Invalid ${t} '${r.unknownType || e}' in '${n}'`, r;
1089
+ }
1090
+ }
1091
+ getFunctionType(e) {
1092
+ if (e === "ast") return rt;
1093
+ let t = c(V, this, H).call(this, e, !0);
1094
+ if (t.kind === "dyn" && t.valueType) throw Error(`type '${t.name}' is not supported`);
1095
+ return t;
1096
+ }
1097
+ registerType(e, t) {
1098
+ var n;
1099
+ if (u(B, this)) throw Error("Cannot modify frozen registry");
1100
+ if (typeof e == "object" && (t = e, e = t.fullName || t.name || ((n = t.ctor) == null ? void 0 : n.name)), typeof e == "string" && e[0] === "." && (e = e.slice(1)), typeof e != "string" || e.length < 2 || Se.has(e)) throw St(`name '${e}' is not valid`);
1101
+ if (this.objectTypes.has(e)) throw St(`type '${e}' already registered`);
1102
+ let r = c(V, this, H).call(this, e, !1);
1103
+ if (r.kind !== "message") throw St(`type '${e}' is not valid`);
1104
+ let i = {
1105
+ name: e,
1106
+ typeType: new T(e),
1107
+ type: r,
1108
+ ctor: typeof t == "function" ? t : t == null ? void 0 : t.ctor,
1109
+ convert: typeof t == "function" || t == null ? void 0 : t.convert,
1110
+ fields: typeof (t == null ? void 0 : t.schema) == "object" ? c(V, this, Vt).call(this, e, c(V, this, Lt).call(this, e, t.schema)) : c(V, this, Vt).call(this, e, typeof t == "function" || t == null ? void 0 : t.fields)
1111
+ };
1112
+ if (typeof i.ctor != "function") {
1113
+ if (!i.fields) throw St(`type '${e}' requires a constructor or fields`);
1114
+ Object.assign(i, c(V, this, Ht).call(this, e, i.fields));
1115
+ }
1116
+ return this.objectTypes.set(e, Object.freeze(i)), this.objectTypesByConstructor.set(i.ctor, i), this.registerFunctionOverload(`type(${e}): type`, () => i.typeType, { async: !1 }), i;
1117
+ }
1118
+ findMacro(e, t, n) {
1119
+ return this.functionCandidates(t, e, n).macro;
1120
+ }
1121
+ findUnaryOverload(e, t) {
1122
+ return this.operatorCandidates(e).findUnaryOverload(t);
1123
+ }
1124
+ findBinaryOverload(e, t, n) {
1125
+ return this.operatorCandidates(e).findBinaryOverload(t, n);
1126
+ }
1127
+ clone(t) {
1128
+ return l(B, this, !0), new e({
1129
+ parent: this,
1130
+ unlistedVariablesAreDyn: t.unlistedVariablesAreDyn,
1131
+ enableOptionalTypes: t.enableOptionalTypes
1132
+ });
1133
+ }
1134
+ getDefinitions() {
1135
+ let e = [], t = [];
1136
+ for (let [, t] of this.variables) t && e.push({
1137
+ name: t.name,
1138
+ description: t.description || null,
1139
+ type: t.type.name
1140
+ });
1141
+ for (let e of c(V, this, Ft).call(this)) t.push({
1142
+ signature: e.signature,
1143
+ name: e.name,
1144
+ description: e.description,
1145
+ receiverType: e.receiverType ? e.receiverType.name : null,
1146
+ returnType: e.returnType.name,
1147
+ params: e.params.map((e) => ({
1148
+ name: e.name,
1149
+ type: e.type.name,
1150
+ description: e.description
1151
+ }))
1152
+ });
1153
+ return {
1154
+ variables: e,
1155
+ functions: t
1156
+ };
1157
+ }
1158
+ registerFunctionOverload(e, t, n) {
1159
+ var r;
1160
+ if (u(B, this)) throw Error("Cannot modify frozen registry");
1161
+ typeof e == "object" ? n = e : typeof t == "object" ? n = t : n || (n = {});
1162
+ let i = typeof e == "string" ? e : (r = n.signature) == null ? void 0 : r, a = i === void 0 ? void 0 : c(V, this, Ut).call(this, i), o = (a == null ? void 0 : a.name) || n.name, s = (a == null ? void 0 : a.receiverType) || n.receiverType, l = a == null ? void 0 : a.argTypes, d = (a == null ? void 0 : a.returnType) || n.returnType, f = n.params;
1163
+ t = typeof t == "function" ? t : n.handler;
1164
+ let p;
1165
+ try {
1166
+ if (!o) throw Error("signature or name are required");
1167
+ if (!d) throw Error("must have a returnType");
1168
+ if (f) {
1169
+ if (l && f.length !== l.length) throw Error("mismatched length in params and args in signature");
1170
+ } else if (!l) throw Error("signature or params are required");
1171
+ p = new Ye({
1172
+ name: o,
1173
+ async: n == null ? void 0 : n.async,
1174
+ receiverType: s ? this.getType(s) : null,
1175
+ returnType: this.getType(d),
1176
+ handler: t,
1177
+ description: n.description,
1178
+ params: (l || f).map((e, t) => c(V, this, Kt).call(this, t, l == null ? void 0 : l[t], f == null ? void 0 : f[t]))
1179
+ });
1180
+ } catch (e) {
1181
+ throw e.message = typeof i == "string" ? `Invalid function declaration '${i}': ${e.message}` : o ? `Invalid function declaration '${o}': ${e.message}` : `Invalid function declaration: ${e.message}`, e;
1182
+ }
1183
+ c(V, this, Gt).call(this, p), c(V, this, Mt).call(this, p);
1184
+ }
1185
+ registerOperatorOverload(e, t, n) {
1186
+ let r = e.match(/^([-!])([\w.<>]+)(?::\s*([\w.<>]+))?$/);
1187
+ if (r) {
1188
+ let [, e, i, a] = r;
1189
+ return this.unaryOverload(e, i, t, a, n == null ? void 0 : n.async);
1190
+ }
1191
+ let i = e.match(/^([\w.<>]+) ([-+*%/]|==|!=|<|<=|>|>=|in) ([\w.<>]+)(?::\s*([\w.<>]+))?$/);
1192
+ if (!i) throw Error(`Operator overload invalid: ${e}`);
1193
+ let [, a, o, s, c] = i;
1194
+ return this.binaryOverload(a, o, s, t, c);
1195
+ }
1196
+ unaryOverload(e, t, n, r, i) {
1197
+ if (u(B, this)) throw Error("Cannot modify frozen registry");
1198
+ let a = this.assertType(t, "type", `${e}${t}`), o = this.assertType(r || t, "return type", `${e}${t}: ${r || t}`), s = new Xe({
1199
+ op: `${e}_`,
1200
+ leftType: a,
1201
+ returnType: o,
1202
+ handler: n,
1203
+ async: i
1204
+ });
1205
+ c(V, this, jt).call(this, c(V, this, Jt).call(this, s));
1206
+ }
1207
+ binaryOverload(e, t, n, r, i, a) {
1208
+ if (u(B, this)) throw Error("Cannot modify frozen registry");
1209
+ i != null || (i = Yt.has(t) ? "bool" : e);
1210
+ let o = `${e} ${t} ${n}: ${i}`, s = this.assertType(e, "left type", o), l = this.assertType(n, "right type", o), d = this.assertType(i, "return type", o);
1211
+ if (s.kind === "dyn" && s.valueType ? l = l.wrappedType : l.kind === "dyn" && l.valueType && (s = s.wrappedType), Yt.has(t) && d.type !== "bool") throw Error(`Comparison operator '${t}' must return 'bool', got '${d.type}'`);
1212
+ let f = new Xe({
1213
+ op: t,
1214
+ leftType: s,
1215
+ rightType: l,
1216
+ returnType: d,
1217
+ handler: r,
1218
+ async: a
1219
+ });
1220
+ if (f.hasPlaceholderType && !(l.hasPlaceholderType && s.hasPlaceholderType)) throw Error(`Operator overload with placeholders must use them in both left and right types: ${o}`);
1221
+ if (c(V, this, Jt).call(this, f), t === "==") {
1222
+ let e = [new Xe({
1223
+ op: "!=",
1224
+ leftType: s,
1225
+ rightType: l,
1226
+ handler(e, t, n, i) {
1227
+ return !r(e, t, n, i);
1228
+ },
1229
+ returnType: d,
1230
+ async: a
1231
+ })];
1232
+ s !== l && e.push(new Xe({
1233
+ op: "==",
1234
+ leftType: l,
1235
+ rightType: s,
1236
+ handler(e, t, n, i) {
1237
+ return r(t, e, n, i);
1238
+ },
1239
+ returnType: d,
1240
+ async: a
1241
+ }), new Xe({
1242
+ op: "!=",
1243
+ leftType: l,
1244
+ rightType: s,
1245
+ handler(e, t, n, i) {
1246
+ return !r(t, e, n, i);
1247
+ },
1248
+ returnType: d,
1249
+ async: a
1250
+ }));
1251
+ for (let t of e) c(V, this, Jt).call(this, t);
1252
+ for (let t of e) c(V, this, jt).call(this, t);
1253
+ }
1254
+ c(V, this, jt).call(this, f);
1255
+ }
1256
+ };
1257
+ function At() {
1258
+ u(Tt, this) || (this.variables = new Map(this.variables), this.variables.dyn = this.unlistedVariablesAreDyn, l(Tt, this, !0));
1259
+ }
1260
+ function jt(e) {
1261
+ u(F, this) || l(L, this, null), this.operatorCandidates(e.operator).add(e), u(F, this).push(e);
1262
+ }
1263
+ function Mt(e) {
1264
+ u(I, this) || l(R, this, null), c(V, this, It).call(this, e.partitionKey).add(e), u(I, this).push(e);
1265
+ }
1266
+ function Nt(e, t) {
1267
+ return e.get(t) || e.set(t, new st(this)).get(t);
1268
+ }
1269
+ function Pt() {
1270
+ return u(F, this) ? u(F, this) : l(F, this, [...u(Ot, this).operators]);
1271
+ }
1272
+ function Ft() {
1273
+ return u(I, this) ? u(I, this) : l(I, this, [...u(Ot, this).functions]);
1274
+ }
1275
+ function It(e) {
1276
+ if (u(R, this)) return c(V, this, Nt).call(this, u(R, this), e);
1277
+ let t = l(R, this, /* @__PURE__ */ new Map());
1278
+ for (let e of c(V, this, Ft).call(this)) c(V, this, Nt).call(this, t, e.partitionKey).add(e);
1279
+ return c(V, this, Nt).call(this, t, e);
1280
+ }
1281
+ function Lt(e, t) {
1282
+ let n = Object.create(null);
1283
+ for (let r of v(t)) {
1284
+ let i = t[r];
1285
+ if (typeof i == "object" && i) n[r] = this.registerType({
1286
+ name: `${e}.${r}`,
1287
+ schema: i
1288
+ }).type.name;
1289
+ else if (typeof i == "string") n[r] = i;
1290
+ else throw Error(`Invalid field definition for '${e}.${r}'`);
1291
+ }
1292
+ return n;
1293
+ }
1294
+ function H(e, t = !0) {
1295
+ let n = u(P, this).get(e);
1296
+ if (n) return n;
1297
+ if (typeof e != "string" || !e.length) throw Error("Invalid type: must be a string");
1298
+ if (n = e.match(/^[A-Z]$/), n) return c(V, this, Rt).call(this, nt, e, e);
1299
+ if (n = e.match(/^(dyn|list|map|optional)<(.+)>$/), !n) {
1300
+ if (t) {
1301
+ let t = /* @__PURE__ */ Error(`Unknown type: ${e}`);
1302
+ throw t.unknownType = e, t;
1303
+ }
1304
+ return c(V, this, Rt).call(this, Qe, e, e);
1305
+ }
1306
+ let r = n[1], i = n[2].trim();
1307
+ switch (r) {
1308
+ case "dyn": {
1309
+ let e = c(V, this, H).call(this, i, t).wrappedType;
1310
+ return u(P, this).set(e.name, e), e;
1311
+ }
1312
+ case "list": {
1313
+ let e = c(V, this, H).call(this, i, t);
1314
+ return c(V, this, Rt).call(this, Ze, `list<${e}>`, e);
1315
+ }
1316
+ case "map": {
1317
+ let n = _t(i);
1318
+ if (n.length !== 2) throw Error(`Invalid map type: ${e}`);
1319
+ let r = c(V, this, H).call(this, n[0], t), a = c(V, this, H).call(this, n[1], t);
1320
+ return c(V, this, Rt).call(this, tt, `map<${r}, ${a}>`, r, a);
1321
+ }
1322
+ case "optional": {
1323
+ let e = c(V, this, H).call(this, i, t);
1324
+ return c(V, this, Rt).call(this, et, `optional<${e}>`, e);
1325
+ }
1326
+ }
1327
+ }
1328
+ function Rt(e, t, ...n) {
1329
+ return u(P, this).get(t) || u(P, this).set(t, e(...n)).get(t);
1330
+ }
1331
+ function zt(e) {
1332
+ return typeof e == "string" ? { type: e } : e.id ? an(e) : e;
1333
+ }
1334
+ function Bt(e, t, n, r = !1) {
1335
+ try {
1336
+ let e = c(V, this, zt).call(this, t[n]);
1337
+ if (typeof (e == null ? void 0 : e.type) != "string") throw Error("unsupported declaration");
1338
+ return c(V, this, H).call(this, e.type, r);
1339
+ } catch (r) {
1340
+ throw r.message = `Field '${n}' in type '${e}' has unsupported declaration: ${JSON.stringify(t[n])}`, r;
1341
+ }
1342
+ }
1343
+ function Vt(e, t) {
1344
+ if (!t) return;
1345
+ let n = Object.create(null);
1346
+ for (let r of v(t)) n[r] = c(V, this, Bt).call(this, e, t, r);
1347
+ return n;
1348
+ }
1349
+ function Ht(e, t) {
1350
+ var n;
1351
+ let r, i = v(t), a = Object.create(null);
1352
+ for (let e of i) {
1353
+ let n = t[e], r = n.kind === "message" && this.objectTypes.get(n.name);
1354
+ a[e] = r === !1 ? !1 : r.convert ? r : !1;
1355
+ }
1356
+ let o = { [e]: (n = /* @__PURE__ */ new WeakMap(), r = Symbol.iterator, class extends Map {
1357
+ constructor(e) {
1358
+ super(), s(this, n, void 0), l(n, this, e);
1359
+ }
1360
+ [r]() {
1361
+ if (this.size !== i.length) for (let e of i) this.get(e);
1362
+ return super[Symbol.iterator]();
1363
+ }
1364
+ get(e) {
1365
+ var t;
1366
+ let r = super.get(e);
1367
+ if (r !== void 0 || this.has(e)) return r;
1368
+ let i = a[e];
1369
+ if (i !== void 0) {
1370
+ if (r = u(n, this) instanceof Map ? u(n, this).get(e) : (t = u(n, this)) == null ? void 0 : t[e], i && r && typeof r == "object") switch (r.constructor) {
1371
+ case void 0:
1372
+ case Object:
1373
+ case Map: r = i.convert(r);
1374
+ }
1375
+ return super.set(e, r), r;
1376
+ }
1377
+ }
1378
+ }) }[e];
1379
+ return {
1380
+ ctor: o,
1381
+ convert(e) {
1382
+ if (e) return e.constructor === o ? e : new o(e);
1383
+ }
1384
+ };
1385
+ }
1386
+ function Ut(e) {
1387
+ if (typeof e != "string") throw Error("Invalid signature: must be a string");
1388
+ let t = e.match(/^(?:([a-zA-Z0-9.<>]+)\.)?(\w+)\(([^)]*)\):(.*)$/);
1389
+ if (!t) throw Error(`Invalid signature: ${e}`);
1390
+ let n = t[4].trim();
1391
+ if (!n) throw Error(`Invalid signature: ${e}`);
1392
+ return {
1393
+ receiverType: t[1] || null,
1394
+ name: t[2],
1395
+ argTypes: _t(t[3]),
1396
+ returnType: n
1397
+ };
1398
+ }
1399
+ function Wt(e, t) {
1400
+ return e.name !== t.name || e.argTypes.length !== t.argTypes.length || (e.receiverType || t.receiverType) && (!e.receiverType || !t.receiverType) ? !1 : (e.receiverType === t.receiverType || e.receiverType === A || t.receiverType === A) && (t.macro || e.macro || t.argTypes.every((t, n) => {
1401
+ let r = e.argTypes[n];
1402
+ return t === r || t === A || r === A;
1403
+ }));
1404
+ }
1405
+ function Gt(e) {
1406
+ for (let t of c(V, this, It).call(this, e.partitionKey)) if (c(V, this, Wt).call(this, t, e)) throw Error(`Function signature '${e.signature}' overlaps with existing overload '${t.signature}'.`);
1407
+ }
1408
+ function Kt(e, t, n) {
1409
+ var r;
1410
+ if (!n) return {
1411
+ type: this.getFunctionType(t),
1412
+ name: `arg${e}`,
1413
+ description: null
1414
+ };
1415
+ let i = n.type || t;
1416
+ if (!i) throw Error(`params[${e}].type is required`);
1417
+ if (t && i !== t) throw Error(`params[${e}].type not equal to signature type`);
1418
+ return {
1419
+ name: n.name || `arg${e}`,
1420
+ type: this.getFunctionType(i),
1421
+ description: (r = n.description) == null ? null : r
1422
+ };
1423
+ }
1424
+ function qt(e) {
1425
+ for (let t of this.operatorCandidates(e.operator)) if (e.equals(t)) return !0;
1426
+ return !1;
1427
+ }
1428
+ function Jt(e) {
1429
+ if (!c(V, this, qt).call(this, e)) return e;
1430
+ throw Error(`Operator overload already registered: ${e.signature}`);
1431
+ }
1432
+ var Yt = /* @__PURE__ */ new Set([
1433
+ "<",
1434
+ "<=",
1435
+ ">",
1436
+ ">=",
1437
+ "==",
1438
+ "!=",
1439
+ "in"
1440
+ ]);
1441
+ function Xt(e) {
1442
+ return new kt(e);
1443
+ }
1444
+ var Zt = /* @__PURE__ */ new WeakMap(), Qt = /* @__PURE__ */ new WeakMap(), $t = /* @__PURE__ */ new WeakMap(), en = /* @__PURE__ */ new WeakMap(), tn = class {
1445
+ constructor(e, t) {
1446
+ if (s(this, Zt, void 0), s(this, Qt, void 0), s(this, $t, void 0), s(this, en, void 0), l(Zt, this, e.variables), t != null) {
1447
+ if (typeof t != "object") throw h("invalid_context", "Context must be an object");
1448
+ t instanceof Map ? l($t, this, t) : l(Qt, this, t);
1449
+ }
1450
+ }
1451
+ getValue(e) {
1452
+ var t, n;
1453
+ return ((t = u(en, this)) == null ? void 0 : t.get(e)) || (u(Qt, this) ? u(Qt, this)[e] : (n = u($t, this)) == null ? void 0 : n.get(e));
1454
+ }
1455
+ getVariable(e) {
1456
+ var t;
1457
+ return (t = u(Zt, this).get(e)) == null ? u(Zt, this).dyn && !Se.has(e) ? new Je(e, A) : void 0 : t;
1458
+ }
1459
+ getCheckedValue(e, t) {
1460
+ let n = this.getValue(t.args);
1461
+ if (n === void 0) throw e.createError("unknown_variable", `Unknown variable: ${t.args}`, t);
1462
+ if (t.checkedType.matchesValueType(n, e)) return n;
1463
+ let r = t.checkedType, i = e.debugType(n);
1464
+ if (r.kind === "message" && i.kind === "map") {
1465
+ var a, o, s;
1466
+ let i = (a = e.objectTypes.get(r.name)) == null || (o = a.convert) == null ? void 0 : o.call(a, n);
1467
+ if (i) return ((s = u(en, this)) == null ? l(en, this, /* @__PURE__ */ new Map()) : s).set(t.args, i), i;
1468
+ }
1469
+ throw e.createError("variable_type_mismatch", `Variable '${t.args}' is not of type '${r}', got '${i}'`, t);
1470
+ }
1471
+ forkWithVariable(e, t) {
1472
+ return new rn(this, e, t);
1473
+ }
1474
+ }, nn = /* @__PURE__ */ new WeakMap(), rn = class e {
1475
+ constructor(e, t, r) {
1476
+ s(this, nn, void 0), n(this, "accuType", void 0), n(this, "accuValue", void 0), n(this, "iterValue", void 0), l(nn, this, e), this.iterVar = t, this.iterType = r;
1477
+ }
1478
+ forkWithVariable(t, n) {
1479
+ return new e(this, t, n);
1480
+ }
1481
+ reuse(t) {
1482
+ if (!this.async) return l(nn, this, t), this;
1483
+ let n = new e(t, this.iterVar, this.iterType);
1484
+ return n.accuType = this.accuType, n;
1485
+ }
1486
+ setIterValue(e, t) {
1487
+ if (this.iterType.matchesValueType(e, t)) return this.iterValue = e, this;
1488
+ let n = this.iterType, r = t.debugType(e);
1489
+ if (n.kind === "message" && r.kind === "map") {
1490
+ var i, a;
1491
+ let r = (i = t.objectTypes.get(n.name)) == null || (a = i.convert) == null ? void 0 : a.call(i, e);
1492
+ if (r) return this.iterValue = r, this;
1493
+ }
1494
+ throw t.createError("variable_type_mismatch", `Variable '${this.iterVar}' is not of type '${n}', got '${r}'`);
1495
+ }
1496
+ setAccuType(e) {
1497
+ return this.accuType = e, this;
1498
+ }
1499
+ setAccuValue(e) {
1500
+ return this.accuValue = e, this;
1501
+ }
1502
+ getValue(e) {
1503
+ return this.iterVar === e ? this.iterValue : u(nn, this).getValue(e);
1504
+ }
1505
+ getCheckedValue(e, t) {
1506
+ return this.iterVar === t.args ? this.iterValue : u(nn, this).getCheckedValue(e, t);
1507
+ }
1508
+ getVariable(e) {
1509
+ return this.iterVar === e ? new Je(e, this.iterType) : u(nn, this).getVariable(e);
1510
+ }
1511
+ };
1512
+ function an(e) {
1513
+ let t;
1514
+ return t = e.map ? `map<${on(e.keyType, e.resolvedKeyType)}, ${on(e.type, e.resolvedType)}>` : on(e.type, e.resolvedType), { type: e.repeated ? `list<${t}>` : t };
1515
+ }
1516
+ function on(e, t) {
1517
+ switch (e) {
1518
+ case "string": return "string";
1519
+ case "bytes": return "bytes";
1520
+ case "bool": return "bool";
1521
+ case "double":
1522
+ case "float":
1523
+ case "int32":
1524
+ case "int64":
1525
+ case "sint32":
1526
+ case "sint64":
1527
+ case "sfixed32":
1528
+ case "sfixed64":
1529
+ case "uint32":
1530
+ case "uint64":
1531
+ case "fixed32":
1532
+ case "fixed64": return "double";
1533
+ default:
1534
+ switch (t == null ? void 0 : t.constructor.name) {
1535
+ case "Type": return t.fullName.slice(1);
1536
+ case "Enum": return "int";
1537
+ }
1538
+ return e != null && e.includes(".") ? e : "dyn";
1539
+ }
1540
+ }
1541
+ e(), a();
1542
+ var sn = j.dyn, cn = class {
1543
+ constructor(e) {
1544
+ n(this, "dynType", j.dyn), n(this, "optionalType", j.optional), n(this, "stringType", j.string), n(this, "intType", j.int), n(this, "doubleType", j.double), n(this, "boolType", j.bool), n(this, "nullType", j.null), n(this, "listType", j.list), n(this, "mapType", j.map), this.opts = e.opts, this.registry = e.registry, this.objectTypes = this.registry.objectTypes, this.objectTypesByConstructor = this.registry.objectTypesByConstructor;
1545
+ }
1546
+ getType(e) {
1547
+ return this.registry.getType(e);
1548
+ }
1549
+ debugType(e) {
1550
+ switch (typeof e) {
1551
+ case "string": return this.stringType;
1552
+ case "bigint": return this.intType;
1553
+ case "number": return this.doubleType;
1554
+ case "boolean": return this.boolType;
1555
+ case "object":
1556
+ if (e === null) return this.nullType;
1557
+ switch (e.constructor) {
1558
+ case void 0:
1559
+ case Object:
1560
+ case Map: return this.mapType;
1561
+ case Array:
1562
+ case Set: return this.listType;
1563
+ default:
1564
+ var t, n;
1565
+ return ((t = this.objectTypesByConstructor.get(e.constructor)) == null ? void 0 : t.type) || ln(this, ((n = e.constructor) == null ? void 0 : n.name) || typeof e);
1566
+ }
1567
+ default: ln(this, typeof e);
1568
+ }
1569
+ }
1570
+ };
1571
+ function ln(e, t) {
1572
+ throw e.createError("unsupported_type", `Unsupported type: ${t}`);
1573
+ }
1574
+ var un = (e) => Array.isArray(e) ? e.some((e) => e.maybeAsync) : !1;
1575
+ function U(e, t, n) {
1576
+ return t === !0 || t && (t != null && t.maybeAsync || un(t)) ? dn(n) : e === !0 || e && (e != null && e.maybeAsync || un(e)) ? fn(n) : n;
1577
+ }
1578
+ function dn(e) {
1579
+ var t;
1580
+ return (t = e.__asyncBoth) == null ? e.__asyncBoth = function(t, n, r, i) {
1581
+ return t instanceof Promise || n instanceof Promise ? n instanceof Promise ? t instanceof Promise ? Promise.all([t, n]).then((t) => e(t[0], t[1], r, i)) : n.then((n) => e(t, n, r, i)) : t.then((t) => e(t, n, r, i)) : e(t, n, r, i);
1582
+ } : t;
1583
+ }
1584
+ function fn(e) {
1585
+ var t;
1586
+ return (t = e.__asyncFirst) == null ? e.__asyncFirst = function(t, n, r, i) {
1587
+ return t instanceof Promise ? t.then((t) => e(t, n, r, i)) : e(t, n, r, i);
1588
+ } : t;
1589
+ }
1590
+ function pn(e, t, n) {
1591
+ t.right = t.args[1];
1592
+ let r = e.check(t.left = t.args[0], n);
1593
+ return t.op === "[]" && e.check(t.right, n), t.handle = U(t.left, t.op === "[]" && t.right, r === sn ? Xn : Jn), r.kind === "optional" ? e.registry.getOptionalType(e.checkAccessOnType(t, n, r.valueType, !0)) : e.checkAccessOnType(t, n, r);
1594
+ }
1595
+ function mn(e, t, n) {
1596
+ t.right = t.args[1];
1597
+ let r = e.check(t.left = t.args[0], n);
1598
+ t.op === "[?]" && e.check(t.right, n), t.handle = U(t.left, t.op === "[?]" && t.right, qn);
1599
+ let i = r.kind === "optional" ? r.valueType : r;
1600
+ return e.registry.getOptionalType(e.checkAccessOnType(t, n, i, !0));
1601
+ }
1602
+ var hn = {
1603
+ heterogeneous_list_element: "List elements must have the same type,",
1604
+ heterogeneous_map_key: "Map key uses wrong type,",
1605
+ heterogeneous_map_value: "Map value uses wrong type,"
1606
+ };
1607
+ function gn(e, t, n, r, i) {
1608
+ let a = e.check(r, t);
1609
+ if (a === n || n.isEmpty()) return a;
1610
+ if (a.isEmpty()) return n;
1611
+ throw e.createError(i, `${hn[i]} expected type '${e.formatType(n)}' but found '${e.formatType(a)}'`, r);
1612
+ }
1613
+ function _n(e, t, n, r) {
1614
+ return n.unify(e.registry, e.check(r, t)) || sn;
1615
+ }
1616
+ function vn(e, t, n) {
1617
+ let r = e.debugRuntimeType(t);
1618
+ return e.createError("invalid_condition_type", `${n.meta.label || "Ternary condition must be bool"}, got '${r}'`, n);
1619
+ }
1620
+ function yn(e, t, n, r) {
1621
+ if (e === !0) return t.run(n.left, r);
1622
+ if (e === !1) return t.run(n.right, r);
1623
+ throw vn(t, e, n.condition);
1624
+ }
1625
+ function bn(e, t, n) {
1626
+ let r = e.debugRuntimeType(t);
1627
+ return e.createError("invalid_logical_operand", `Logical operator requires bool operands, got '${r}'`, n);
1628
+ }
1629
+ function xn(e, t, n) {
1630
+ return t instanceof Error ? t : bn(e, t, n);
1631
+ }
1632
+ function Sn(e, t, n, r, i) {
1633
+ if (i === e) return e;
1634
+ if (i === !e) {
1635
+ if (r === i) return i;
1636
+ throw xn(t, r, n.left);
1637
+ }
1638
+ if (i instanceof Promise) return i.then((i) => Cn(e, t, n, r, i));
1639
+ throw bn(t, i, n.left);
1640
+ }
1641
+ function Cn(e, t, n, r, i) {
1642
+ if (i === e) return e;
1643
+ if (typeof i != "boolean") throw bn(t, i, n.right);
1644
+ if (typeof r != "boolean") throw xn(t, r, n.left);
1645
+ return !e;
1646
+ }
1647
+ function wn(e, t, n) {
1648
+ let r = e.check(t.left = t.args[0], n), i = e.check(t.right = t.args[1], n);
1649
+ if (!r.isDynOrBool()) throw e.createError("invalid_logical_operand", `Logical operator requires bool operands, got '${e.formatType(r)}'`, t);
1650
+ if (!i.isDynOrBool()) throw e.createError("invalid_logical_operand", `Logical operator requires bool operands, got '${e.formatType(i)}'`, t);
1651
+ return e.boolType;
1652
+ }
1653
+ function Tn(e, t, n) {
1654
+ let r = t.op, i = e.check(t.args, n);
1655
+ if (t.candidates = e.registry.operatorCandidates(r), i.kind === "dyn") return t.handle = U(t.args, !1, En), t.candidates.returnType;
1656
+ let a = t.candidates.findUnaryOverload(i);
1657
+ if (!a) throw e.createError("no_such_overload", `no such overload: ${r[0]}${e.formatType(i)}`, t);
1658
+ return t.handle = U(t.args, !1, a.handler), a.returnType;
1659
+ }
1660
+ function En(e, t, n) {
1661
+ let r = n.debugRuntimeType(e, t.args.checkedType), i = t.candidates.findUnaryOverload(r);
1662
+ if (i) return i.handler(e);
1663
+ throw n.createError("no_such_overload", `no such overload: ${t.op[0]}${r}`, t);
1664
+ }
1665
+ function Dn(e, t, n) {
1666
+ return t.handle(e.run(t.args, n), t, e);
1667
+ }
1668
+ function On(e, t, n) {
1669
+ let r = t.op, i = e.check(t.left = t.args[0], n), a = e.check(t.right = t.args[1], n);
1670
+ t.candidates = e.registry.operatorCandidates(r);
1671
+ let o = i.hasDynType || a.hasDynType ? void 0 : t.candidates.findBinaryOverload(i, a);
1672
+ if (t.handle = U(t.left, t.right, (o == null ? void 0 : o.handler) || jn), o) return o.returnType;
1673
+ let s = t.candidates.checkBinaryOverload(i, a);
1674
+ if (i.hasDynType || (t.leftStaticType = i), a.hasDynType || (t.rightStaticType = a), s) return s;
1675
+ throw e.createError("no_such_overload", `no such overload: ${e.formatType(i)} ${r} ${e.formatType(a)}`, t);
1676
+ }
1677
+ function kn(e, t, n) {
1678
+ return t.handle(e.run(t.left, n), e.run(t.right, n), t, e);
1679
+ }
1680
+ function An(e, t, n) {
1681
+ return t.handle(e.run(t.left, n), t.right, t, e);
1682
+ }
1683
+ function jn(e, t, n, r) {
1684
+ let i = n.leftStaticType || r.debugTypeDeep(e).wrappedType, a = n.rightStaticType || r.debugTypeDeep(t).wrappedType, o = n.candidates.findBinaryOverload(i, a);
1685
+ if (o) return o.handler(e, t, n, r);
1686
+ throw r.createError("no_such_overload", `no such overload: ${i} ${n.op} ${a}`, n);
1687
+ }
1688
+ function Mn(e, t, n, r) {
1689
+ try {
1690
+ let i = e.apply(t, n);
1691
+ return i instanceof Promise ? i.catch((e) => {
1692
+ throw le(e, r);
1693
+ }) : i;
1694
+ } catch (e) {
1695
+ throw le(e, r);
1696
+ }
1697
+ }
1698
+ function Nn(e, t, n) {
1699
+ let r = t.args[1], i = t.argTypes, a = r.length;
1700
+ for (; a--;) i[a] = n.debugRuntimeType(e[a], r[a].checkedType);
1701
+ let o = t.candidates.findFunction(i);
1702
+ if (o) return Mn(o.handler, n, e, t);
1703
+ throw n.createError("no_matching_overload", `found no matching overload for '${t.args[0]}(${i.map((e) => e.unwrappedType).join(", ")})'`, t);
1704
+ }
1705
+ function Pn(e, t, n) {
1706
+ let [, r, i] = n.args, a = n.argTypes;
1707
+ for (let n = 0; n < a.length; n++) a[n] = t.debugRuntimeType(e[n + 1], i[n].checkedType);
1708
+ let o = t.debugRuntimeType(e[0], r.checkedType), s = n.candidates.findFunction(a, o);
1709
+ if (s) return Mn(s.handler, t, e, n);
1710
+ throw t.createError("no_matching_overload", `found no matching overload for '${o.type}.${n.args[0]}(${a.map((e) => e.unwrappedType).join(", ")})'`, n);
1711
+ }
1712
+ function Fn(e, t, n, r = t.length) {
1713
+ if (r === 0) return [];
1714
+ let i, a = Array(r);
1715
+ for (; r--;) (a[r] = e.run(t[r], n)) instanceof Promise && (i != null || (i = !0));
1716
+ return i ? Promise.all(a) : a;
1717
+ }
1718
+ function In(e) {
1719
+ let t = {};
1720
+ for (let n = 0; n < e.length; n++) {
1721
+ let [r, i] = e[n];
1722
+ r !== "__proto__" && r !== "constructor" && r !== "prototype" && (t[r] = i);
1723
+ }
1724
+ return t;
1725
+ }
1726
+ function Ln(e, t, n) {
1727
+ let r = e.check(t, n);
1728
+ if (r.kind === "dyn") return r;
1729
+ if (r.kind === "list") return r.valueType;
1730
+ if (r.kind === "map") return r.keyType;
1731
+ throw e.createError("invalid_comprehension_range", `Expression of type '${e.formatType(r)}' cannot be range of a comprehension (must be list, map, or dynamic).`, t);
1732
+ }
1733
+ function Rn(e, t, n) {
1734
+ if (n instanceof Set) return [...n];
1735
+ if (n instanceof Map) return [...n.keys()];
1736
+ if (n && typeof n == "object") return v(n);
1737
+ throw e.createError("invalid_comprehension_range", `Expression of type '${e.debugType(n)}' cannot be range of a comprehension (must be list, map, or dynamic).`, t.iterable);
1738
+ }
1739
+ function zn(e, t, n, r) {
1740
+ ye(e) || (e = Rn(n, t, e));
1741
+ let i = n.run(t.init, r = t.iterCtx.reuse(r));
1742
+ return r.accuValue = i, r === t.iterCtx ? Wn(n, r, t, e, i, 0) : Gn(n, r, t, e, i, 0);
1743
+ }
1744
+ function Bn(e, t, n, r) {
1745
+ ye(e) || (e = Rn(n, t, e));
1746
+ let i = n.run(t.init, r = t.iterCtx.reuse(r));
1747
+ return r.accuValue = i, r === t.iterCtx ? Vn(n, r, t, e, i, 0) : Hn(n, r, t, e, i, 0);
1748
+ }
1749
+ function Vn(e, t, n, r, i, a) {
1750
+ let o = n.condition, s = n.step, c = r.length;
1751
+ for (; a < c && (!o || o(i));) if (i = e.run(s, t.setIterValue(r[a++], e)), i instanceof Promise) return Hn(e, t, n, r, i, a);
1752
+ return n.result(i);
1753
+ }
1754
+ function Hn(e, t, n, r, i, a) {
1755
+ return Un.apply(this, arguments);
1756
+ }
1757
+ function Un() {
1758
+ return Un = i(function* (e, t, n, r, i, a) {
1759
+ t === n.iterCtx && (t.async = !0);
1760
+ let o = n.condition, s = n.step, c = r.length;
1761
+ for (i = yield i; a < c;) {
1762
+ if (o && !o(i)) return n.result(i);
1763
+ i = e.run(s, t.setIterValue(r[a++], e)), i instanceof Promise && (i = yield i);
1764
+ }
1765
+ return n.result(i);
1766
+ }), Un.apply(this, arguments);
1767
+ }
1768
+ function Wn(e, t, n, r, i, a, o, s) {
1769
+ let c = n.condition, l = n.step, u = r.length;
1770
+ for (; a < u;) {
1771
+ var d;
1772
+ if (!c(i)) return n.result(i);
1773
+ if (s = e.tryEval(l, t.setIterValue(r[a++], e)), s instanceof Promise) return Gn(e, t, n, r, i, a, o, s);
1774
+ s instanceof Error && ((d = o) == null ? o = s : d) || (i = s);
1775
+ }
1776
+ if (o && c(i)) throw o;
1777
+ return n.result(i);
1778
+ }
1779
+ function Gn(e, t, n, r, i, a, o, s) {
1780
+ return Kn.apply(this, arguments);
1781
+ }
1782
+ function Kn() {
1783
+ return Kn = i(function* (e, t, n, r, i, a, o, s) {
1784
+ t === n.iterCtx && (t.async = !0);
1785
+ let c = n.condition, l = n.step, u = r.length;
1786
+ for (s = yield s, s instanceof Error ? o != null || (o = s) : i = s; a < u;) {
1787
+ var d;
1788
+ if (!c(i)) return n.result(i);
1789
+ s = e.tryEval(l, t.setIterValue(r[a++], e)), s instanceof Promise && (s = yield s), s instanceof Error && ((d = o) == null ? o = s : d) || (i = s);
1790
+ }
1791
+ if (o && c(i)) throw o;
1792
+ return n.result(i);
1793
+ }), Kn.apply(this, arguments);
1794
+ }
1795
+ function qn(e, t, n, r) {
1796
+ return r.optionalType.field(e, t, n, r);
1797
+ }
1798
+ function Jn(e, t, n, r) {
1799
+ return n.left.checkedType.field(e, t, n, r);
1800
+ }
1801
+ var Yn = Object.create(null);
1802
+ function Xn(e, t, n, r) {
1803
+ switch (e == null ? void 0 : e.constructor) {
1804
+ case void 0:
1805
+ case Object: {
1806
+ let n = _e(e || Yn, t) ? e[t] : void 0;
1807
+ if (n !== void 0) return r.debugType(n), n;
1808
+ break;
1809
+ }
1810
+ case Map: {
1811
+ let n = e.get(t);
1812
+ if (n !== void 0) return r.debugType(n), n;
1813
+ break;
1814
+ }
1815
+ case Array:
1816
+ case Set: return r.listType.field(e, t, n, r);
1817
+ default:
1818
+ let i = r.objectTypesByConstructor.get(e.constructor);
1819
+ if (i) return i.type.field(e, t, n, r);
1820
+ typeof e == "object" && ln(r, e.constructor.name);
1821
+ }
1822
+ throw r.createError("no_such_key", `No such key: ${t}`, n);
1823
+ }
1824
+ var Zn = () => [], Qn = () => ({}), W = {
1825
+ value: {
1826
+ check(e, t) {
1827
+ return e.debugType(t.args);
1828
+ },
1829
+ evaluate(e, t) {
1830
+ return t.args;
1831
+ }
1832
+ },
1833
+ id: {
1834
+ check(e, t, n) {
1835
+ let r = n.getVariable(t.args);
1836
+ if (!r) throw e.createError("unknown_variable", `Unknown variable: ${t.args}`, t);
1837
+ if (r.constant) {
1838
+ let i = t.clone(W.value, r.value);
1839
+ return t.setMeta("alternate", i), e.check(i, n);
1840
+ }
1841
+ return r.type;
1842
+ },
1843
+ evaluate(e, t, n) {
1844
+ return n.getCheckedValue(e, t);
1845
+ }
1846
+ },
1847
+ ".": {
1848
+ alias: "fieldAccess",
1849
+ check: pn,
1850
+ evaluate: An
1851
+ },
1852
+ ".?": {
1853
+ alias: "optionalFieldAccess",
1854
+ check: mn,
1855
+ evaluate: An
1856
+ },
1857
+ "[]": {
1858
+ alias: "bracketAccess",
1859
+ check: pn,
1860
+ evaluate: kn
1861
+ },
1862
+ "[?]": {
1863
+ alias: "optionalBracketAccess",
1864
+ check: mn,
1865
+ evaluate: kn
1866
+ },
1867
+ call: {
1868
+ check(e, t, n) {
1869
+ var r, i;
1870
+ let [a, o] = t.args, s = t.candidates = e.registry.functionCandidates(!1, a, o.length), c = t.argTypes = o.map((t) => e.check(t, n)), l = s.findFunction(c);
1871
+ if (!l) throw e.createError("no_matching_overload", `found no matching overload for '${a}(${e.formatTypeList(c)})'`, t);
1872
+ return t.handle = U(o, !1, c.some((e) => e.hasDynType) ? Nn : (i = (r = l.handler).__handle) == null ? r.__handle = (e, t, n) => Mn(l.handler, n, e, t) : i), l.returnType;
1873
+ },
1874
+ evaluate(e, t, n) {
1875
+ return t.handle(Fn(e, t.args[1], n), t, e);
1876
+ }
1877
+ },
1878
+ rcall: {
1879
+ check(e, t, n) {
1880
+ let [r, i, a] = t.args, o = e.check(i, n), s = t.candidates = e.registry.functionCandidates(!0, r, a.length), c = t.argTypes = a.map((t) => e.check(t, n));
1881
+ if (t.receiverWithArgs = [i, ...a], t.handle = U(t.receiverWithArgs, !1, Pn), o.kind === "dyn" && s.returnType) return s.returnType;
1882
+ let l = s.findFunction(c, o);
1883
+ if (!l) throw e.createError("no_matching_overload", `found no matching overload for '${o.type}.${r}(${e.formatTypeList(c)})'`, t);
1884
+ if (!o.hasPlaceholderType && !c.some((e) => e.hasDynType)) {
1885
+ var u;
1886
+ let e = l.handler, n = (u = e.__handle) == null ? e.__handle = (t, n, r) => Mn(e, n, t, r) : u;
1887
+ t.handle = U(t.receiverWithArgs, !1, n);
1888
+ }
1889
+ return l.returnType;
1890
+ },
1891
+ evaluate(e, t, n) {
1892
+ return t.handle(Fn(e, t.receiverWithArgs, n), e, t);
1893
+ }
1894
+ },
1895
+ list: {
1896
+ check(e, t, n) {
1897
+ let r = t.args, i = r.length;
1898
+ if (i === 0) return t.setMeta("evaluate", Zn) && e.getType("list<T>");
1899
+ let a = e.check(r[0], n), o = e.opts.homogeneousAggregateLiterals ? gn : _n;
1900
+ for (let t = 1; t < i; t++) a = o(e, n, a, r[t], "heterogeneous_list_element");
1901
+ return e.registry.getListType(a);
1902
+ },
1903
+ evaluate(e, t, n) {
1904
+ return Fn(e, t.args, n);
1905
+ }
1906
+ },
1907
+ map: {
1908
+ check(e, t, n) {
1909
+ let r = t.args, i = r.length;
1910
+ if (i === 0) return t.setMeta("evaluate", Qn) && e.getType("map<K, V>");
1911
+ let a = e.opts.homogeneousAggregateLiterals ? gn : _n, o = e.check(r[0][0], n), s = e.check(r[0][1], n);
1912
+ for (let t = 1; t < i; t++) {
1913
+ let i = r[t];
1914
+ o = a(e, n, o, i[0], "heterogeneous_map_key"), s = a(e, n, s, i[1], "heterogeneous_map_value");
1915
+ }
1916
+ return e.registry.getMapType(o, s);
1917
+ },
1918
+ evaluate(e, t, n) {
1919
+ let r = t.args, i = r.length, a = Array(i), o;
1920
+ for (let t = 0; t < i; t++) {
1921
+ let i = r[t], s = e.run(i[0], n), c = e.run(i[1], n);
1922
+ s instanceof Promise || c instanceof Promise ? (a[t] = Promise.all([s, c]), o != null || (o = !0)) : a[t] = [s, c];
1923
+ }
1924
+ return o ? Promise.all(a).then(In) : In(a);
1925
+ }
1926
+ },
1927
+ comprehension: {
1928
+ check(e, t, n) {
1929
+ let r = t.args;
1930
+ r.iterCtx = n.forkWithVariable(r.iterVarName, Ln(e, r.iterable, n)).setAccuType(e.check(r.init, n));
1931
+ let i = e.check(r.step, r.iterCtx), a = r.errorsAreFatal ? Bn : zn;
1932
+ return t.handle = U(r.iterable, !1, a), r.kind === "quantifier" ? e.boolType : i;
1933
+ },
1934
+ evaluate(e, t, n) {
1935
+ return t.handle(e.run(t.args.iterable, n), t.args, e, n);
1936
+ }
1937
+ },
1938
+ accuValue: {
1939
+ check(e, t, n) {
1940
+ return n.accuType;
1941
+ },
1942
+ evaluate(e, t, n) {
1943
+ return n.accuValue;
1944
+ }
1945
+ },
1946
+ accuInc: {
1947
+ check(e, t, n) {
1948
+ return n.accuType;
1949
+ },
1950
+ evaluate(e, t, n) {
1951
+ return n.accuValue += 1;
1952
+ }
1953
+ },
1954
+ accuPush: {
1955
+ check(e, t, n) {
1956
+ let r = n.accuType, i = e.check(t.args, n);
1957
+ return t.args.maybeAsync || t.setMeta("evaluate", W.accuPush.evaluateSync), r.kind === "list" && r.valueType.kind !== "param" ? r : e.registry.getListType(i);
1958
+ },
1959
+ evaluateSync(e, t, n) {
1960
+ return n.accuValue.push(e.run(t.args, n)), n.accuValue;
1961
+ },
1962
+ evaluate(e, t, n) {
1963
+ let r = n.accuValue, i = e.run(t.args, n);
1964
+ return i instanceof Promise ? i.then((e) => r.push(e) && r) : (r.push(i), r);
1965
+ }
1966
+ },
1967
+ "?:": {
1968
+ alias: "ternary",
1969
+ check(e, t, n) {
1970
+ let r = t.condition = t.args[0], i = t.left = t.args[1], a = t.right = t.args[2], o = e.check(r, n);
1971
+ if (!o.isDynOrBool()) throw e.createError("invalid_condition_type", `${r.meta.label || "Ternary condition must be bool"}, got '${e.formatType(o)}'`, r);
1972
+ let s = e.check(i, n), c = e.check(a, n), l = s.unify(e.registry, c);
1973
+ if (t.handle = U(r, !1, yn), l) return l;
1974
+ throw e.createError("incompatible_ternary_branches", `Ternary branches must have the same type, got '${e.formatType(s)}' and '${e.formatType(c)}'`, t);
1975
+ },
1976
+ evaluate(e, t, n) {
1977
+ return t.handle(e.run(t.condition, n), e, t, n);
1978
+ }
1979
+ },
1980
+ "||": {
1981
+ check: wn,
1982
+ evaluate(e, t, n) {
1983
+ let r = e.tryEval(t.left, n);
1984
+ if (r === !0) return !0;
1985
+ if (r === !1) {
1986
+ let i = e.run(t.right, n);
1987
+ return typeof i == "boolean" ? i : Sn(!0, e, t, r, i);
1988
+ }
1989
+ return r instanceof Promise ? r.then((r) => r === !0 ? r : Sn(!0, e, t, r, e.run(t.right, n))) : Sn(!0, e, t, r, e.run(t.right, n));
1990
+ }
1991
+ },
1992
+ "&&": {
1993
+ check: wn,
1994
+ evaluate(e, t, n) {
1995
+ let r = e.tryEval(t.left, n);
1996
+ if (r === !1) return !1;
1997
+ if (r === !0) {
1998
+ let i = e.run(t.right, n);
1999
+ return typeof i == "boolean" ? i : Sn(!1, e, t, r, i);
2000
+ }
2001
+ return r instanceof Promise ? r.then((r) => r === !1 ? r : Sn(!1, e, t, r, e.run(t.right, n))) : Sn(!1, e, t, r, e.run(t.right, n));
2002
+ }
2003
+ },
2004
+ "!_": {
2005
+ alias: "unaryNot",
2006
+ check: Tn,
2007
+ evaluate: Dn
2008
+ },
2009
+ "-_": {
2010
+ alias: "unaryMinus",
2011
+ check: Tn,
2012
+ evaluate: Dn
2013
+ }
2014
+ };
2015
+ for (let e of [
2016
+ "!=",
2017
+ "==",
2018
+ "in",
2019
+ "+",
2020
+ "-",
2021
+ "*",
2022
+ "/",
2023
+ "%",
2024
+ "<",
2025
+ "<=",
2026
+ ">",
2027
+ ">="
2028
+ ]) W[e] = {
2029
+ check: On,
2030
+ evaluate: kn
2031
+ };
2032
+ for (let e of v(W)) {
2033
+ let t = W[e];
2034
+ t.name = e, t.alias && (W[t.alias] = t);
2035
+ }
2036
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/macros.js
2037
+ var $n = (e) => e;
2038
+ function er(e, t) {
2039
+ if (e.op === "id") return e.args;
2040
+ throw m("invalid_macro_argument", t, e);
2041
+ }
2042
+ function tr(e) {
2043
+ let t = e ? "map(var, filter, transform)" : "map(var, transform)", n = `${t} invalid predicate iteration variable`, r = `${t} filter predicate must return bool`;
2044
+ return ({ args: t, receiver: i, ast: a }) => {
2045
+ let [o, s, c] = e ? t : [
2046
+ t[0],
2047
+ null,
2048
+ t[1]
2049
+ ], l = c.clone(W.accuPush, c);
2050
+ if (s) {
2051
+ let e = s.clone(W.accuValue);
2052
+ l = s.clone(W.ternary, [
2053
+ s.setMeta("label", r),
2054
+ l,
2055
+ e
2056
+ ]);
2057
+ }
2058
+ return { callAst: a.clone(W.comprehension, {
2059
+ errorsAreFatal: !0,
2060
+ iterable: i,
2061
+ iterVarName: er(o, n),
2062
+ init: a.clone(W.list, []),
2063
+ step: l,
2064
+ result: $n
2065
+ }) };
2066
+ };
2067
+ }
2068
+ function nr() {
2069
+ let e = "filter(var, predicate)", t = `${e} invalid predicate iteration variable`, n = `${e} predicate must return bool`;
2070
+ return ({ args: e, receiver: r, ast: i }) => {
2071
+ let a = er(e[0], t), o = i.clone(W.accuValue), s = e[1].setMeta("label", n), c = i.clone(W.accuPush, i.clone(W.id, a)), l = s.clone(W.ternary, [
2072
+ s,
2073
+ c,
2074
+ o
2075
+ ]);
2076
+ return { callAst: i.clone(W.comprehension, {
2077
+ errorsAreFatal: !0,
2078
+ iterable: r,
2079
+ iterVarName: a,
2080
+ init: i.clone(W.list, []),
2081
+ step: l,
2082
+ result: $n
2083
+ }) };
2084
+ };
2085
+ }
2086
+ function rr(e) {
2087
+ let t = `${e.name}(var, predicate) invalid predicate iteration variable`, n = `${e.name}(var, predicate) predicate must return bool`;
2088
+ return ({ args: r, receiver: i, ast: a }) => {
2089
+ let o = r[1].setMeta("label", n), s = e.transform({
2090
+ args: r,
2091
+ ast: a,
2092
+ predicate: o,
2093
+ opts: e
2094
+ });
2095
+ return { callAst: a.clone(W.comprehension, {
2096
+ kind: "quantifier",
2097
+ errorsAreFatal: e.errorsAreFatal || !1,
2098
+ iterable: i,
2099
+ iterVarName: er(r[0], t),
2100
+ init: s.init,
2101
+ condition: s.condition,
2102
+ step: s.step,
2103
+ result: s.result || $n
2104
+ }) };
2105
+ };
2106
+ }
2107
+ function ir() {
2108
+ let e = "has() invalid argument";
2109
+ function t(e, t, n) {
2110
+ let r = t.macroHasProps, i = r.length, a = e.run(r[--i], n), o;
2111
+ for (; i--;) {
2112
+ let t = r[i];
2113
+ if (t.op === ".?" && (o != null || (o = !0)), a = e.debugType(a).fieldLazy(a, t.args[1], t, e), a === void 0) {
2114
+ if (o || !i || t.op !== ".") break;
2115
+ throw h("no_such_key", `No such key: ${t.args[1]}`, t);
2116
+ }
2117
+ }
2118
+ return a !== void 0;
2119
+ }
2120
+ function n(t, n, r) {
2121
+ let i = n.args[0];
2122
+ if (i.op !== ".") throw t.createError("invalid_macro_argument", e, i);
2123
+ if (!n.macroHasProps) {
2124
+ let a = [];
2125
+ for (; i.op === "." || i.op === ".?";) i = a.push(i) && i.args[0];
2126
+ if (i.op !== "id") throw t.createError("invalid_macro_argument", e, i);
2127
+ t.check(i, r), a.push(i), n.macroHasProps = a;
2128
+ }
2129
+ return t.getType("bool");
2130
+ }
2131
+ return function({ args: e }) {
2132
+ return {
2133
+ args: e,
2134
+ evaluate: t,
2135
+ typeCheck: n,
2136
+ async: !1
2137
+ };
2138
+ };
2139
+ }
2140
+ function ar(e) {
2141
+ let t = (t, n) => e.registerFunctionOverload(t, n);
2142
+ t("has(ast): bool", ir()), t("list.all(ast, ast): bool", rr({
2143
+ name: "all",
2144
+ transform({ ast: e, predicate: t, opts: n }) {
2145
+ return {
2146
+ init: e.clone(W.value, !0),
2147
+ condition: $n,
2148
+ step: t.clone(W.ternary, [
2149
+ t,
2150
+ t.clone(W.value, !0),
2151
+ t.clone(W.value, !1)
2152
+ ])
2153
+ };
2154
+ }
2155
+ })), t("list.exists(ast, ast): bool", rr({
2156
+ name: "exists",
2157
+ condition(e) {
2158
+ return !e;
2159
+ },
2160
+ transform({ ast: e, predicate: t, opts: n }) {
2161
+ return {
2162
+ init: e.clone(W.value, !1),
2163
+ condition: n.condition,
2164
+ step: t.clone(W.ternary, [
2165
+ t,
2166
+ t.clone(W.value, !0),
2167
+ t.clone(W.value, !1)
2168
+ ])
2169
+ };
2170
+ }
2171
+ })), t("list.exists_one(ast, ast): bool", rr({
2172
+ name: "exists_one",
2173
+ errorsAreFatal: !0,
2174
+ result(e) {
2175
+ return e === 1;
2176
+ },
2177
+ transform({ ast: e, predicate: t, opts: n }) {
2178
+ let r = e.clone(W.accuValue);
2179
+ return {
2180
+ init: e.clone(W.value, 0),
2181
+ step: t.clone(W.ternary, [
2182
+ t,
2183
+ e.clone(W.accuInc),
2184
+ r
2185
+ ]),
2186
+ result: n.result
2187
+ };
2188
+ }
2189
+ })), t("list.map(ast, ast): list<dyn>", tr(!1)), t("list.map(ast, ast, ast): list<dyn>", tr(!0)), t("list.filter(ast, ast): list<dyn>", nr());
2190
+ class n {}
2191
+ let r = new n();
2192
+ e.registerType("CelNamespace", n), e.registerConstant("cel", "CelNamespace", r);
2193
+ function i(e, t, n) {
2194
+ t.bindCtx = n.forkWithVariable(t.var, e.check(t.val, n));
2195
+ let r = e.check(t.exp, t.bindCtx);
2196
+ return t.val.maybeAsync || t.exp.maybeAsync || (t.ast.setMeta("async", !1), t.evaluate = s), r;
2197
+ }
2198
+ function a(e, t, n, r, i) {
2199
+ let a = e.run(t, r = n.reuse(r).setIterValue(i, e));
2200
+ return a instanceof Promise && r === n && (r.async = !0), a;
2201
+ }
2202
+ function o(e, { val: t, exp: n, bindCtx: r }, i) {
2203
+ let o = e.run(t, i);
2204
+ return o instanceof Promise ? o.then((t) => a(e, n, r, i, t)) : a(e, n, r, i, o);
2205
+ }
2206
+ function s(e, { val: t, exp: n, bindCtx: r }, i) {
2207
+ return e.run(n, r.reuse(i).setIterValue(e.run(t, i), e));
2208
+ }
2209
+ t("CelNamespace.bind(ast, dyn, ast): dyn", ({ ast: e, args: t }) => ({
2210
+ ast: e,
2211
+ var: er(t[0], "invalid variable argument"),
2212
+ val: t[1],
2213
+ exp: t[2],
2214
+ bindCtx: void 0,
2215
+ typeCheck: i,
2216
+ evaluate: o
2217
+ }));
2218
+ }
2219
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/overloads.js
2220
+ function or(e) {
2221
+ let t = (t, n, r, i) => e.unaryOverload(t, n, r, i, !1), n = (t, n, r, i, a) => e.binaryOverload(t, n, r, i, a, !1);
2222
+ function r(e, t) {
2223
+ if (e <= 9223372036854775807n && e >= -9223372036854775808n) return e;
2224
+ throw h("numeric_overflow", `integer overflow: ${e}`, t);
2225
+ }
2226
+ function i(e) {
2227
+ throw h("division_by_zero", "division by zero", e);
2228
+ }
2229
+ function a(e) {
2230
+ throw h("modulo_by_zero", "modulo by zero", e);
2231
+ }
2232
+ t("!", "bool", (e) => !e), t("-", "int", (e) => -e), n("dyn<int>", "==", "double", (e, t) => e == t), n("dyn<int>", "==", "uint", (e, t) => e == t.valueOf()), n("int", "*", "int", (e, t, n) => r(e * t, n)), n("int", "+", "int", (e, t, n) => r(e + t, n)), n("int", "-", "int", (e, t, n) => r(e - t, n)), n("int", "/", "int", (e, t, n) => t === 0n ? i(n) : e / t), n("int", "%", "int", (e, t, n) => t === 0n ? a(n) : e % t), t("-", "double", (e) => -e), n("double", "*", "double", (e, t) => e * t), n("double", "+", "double", (e, t) => e + t), n("double", "-", "double", (e, t) => e - t), n("double", "/", "double", (e, t) => e / t), n("string", "+", "string", (e, t) => e + t), n("list<V>", "+", "list<V>", (e, t) => [...e, ...t]), n("bytes", "+", "bytes", (e, t) => {
2233
+ if (!e.length) return t;
2234
+ if (!t.length) return e;
2235
+ let n = new Uint8Array(e.length + t.length);
2236
+ return n.set(e, 0), n.set(t, e.length), n;
2237
+ });
2238
+ let o = "google.protobuf.Duration";
2239
+ n(o, "+", o, (e, t) => e.addDuration(t)), n(o, "-", o, (e, t) => e.subtractDuration(t)), n(o, "==", o, (e, t) => e.seconds === t.seconds && e.nanos === t.nanos);
2240
+ let s = "google.protobuf.Timestamp";
2241
+ n(s, "==", s, (e, t) => e.getTime() === t.getTime()), n(s, "-", s, (e, t) => Ae.fromMilliseconds(e.getTime() - t.getTime()), o), n(s, "-", o, (e, t) => t.subtractTimestamp(e)), n(s, "+", o, (e, t) => t.extendTimestamp(e)), n(o, "+", s, (e, t) => e.extendTimestamp(t));
2242
+ function c(e, t, n, r) {
2243
+ if (t instanceof Set && t.has(e)) return !0;
2244
+ for (let i of t) if (sr(e, i, n, r)) return !0;
2245
+ return !1;
2246
+ }
2247
+ function l(e, t) {
2248
+ return t instanceof Map ? t.get(e) !== void 0 : _e(t, e) ? t[e] !== void 0 : !1;
2249
+ }
2250
+ function u(e, t, n, r) {
2251
+ return c(e, t, n, r);
2252
+ }
2253
+ n("V", "in", "list<V>", u), n("K", "in", "map<K, V>", l);
2254
+ for (let e of [
2255
+ "type",
2256
+ "null",
2257
+ "bool",
2258
+ "string",
2259
+ "int",
2260
+ "double"
2261
+ ]) n(e, "==", e, (e, t) => e === t);
2262
+ n("bytes", "==", "bytes", (e, t) => {
2263
+ if (e === t) return !0;
2264
+ let n = e.length;
2265
+ if (n !== t.length) return !1;
2266
+ for (; n--;) if (e[n] !== t[n]) return !1;
2267
+ return !0;
2268
+ }), n("list<V>", "==", "list<V>", (e, t, n, r) => {
2269
+ if (e === t) return !0;
2270
+ if (ye(e) && ye(t)) {
2271
+ let i = e.length;
2272
+ if (i !== t.length) return !1;
2273
+ for (let a = 0; a < i; a++) if (!sr(e[a], t[a], n, r)) return !1;
2274
+ return !0;
2275
+ }
2276
+ if (e instanceof Set && t instanceof Set) {
2277
+ if (e.size !== t.size) return !1;
2278
+ for (let n of e) if (!t.has(n)) return !1;
2279
+ return !0;
2280
+ }
2281
+ let i = e instanceof Set ? t : e, a = e instanceof Set ? e : t;
2282
+ if (!ye(i) || i.length !== (a == null ? void 0 : a.size)) return !1;
2283
+ for (let e = 0; e < i.length; e++) if (!a.has(i[e])) return !1;
2284
+ return !0;
2285
+ }), n("map<K, V>", "==", "map<K, V>", (e, t, n, r) => {
2286
+ if (e === t) return !0;
2287
+ if (e instanceof Map && t instanceof Map) {
2288
+ if (e.size !== t.size) return !1;
2289
+ for (let [i, a] of e) if (!(t.has(i) && sr(a, t.get(i), n, r))) return !1;
2290
+ return !0;
2291
+ }
2292
+ if (e instanceof Map || t instanceof Map) {
2293
+ let i = e instanceof Map ? t : e, a = e instanceof Map ? e : t, o = v(i);
2294
+ if (a.size !== o.length) return !1;
2295
+ for (let [e, t] of a) if (!(e in i && sr(t, i[e], n, r))) return !1;
2296
+ return !0;
2297
+ }
2298
+ let i = v(e), a = v(t);
2299
+ if (i.length !== a.length) return !1;
2300
+ for (let a = 0; a < i.length; a++) {
2301
+ let o = i[a];
2302
+ if (!(o in t && sr(e[o], t[o], n, r))) return !1;
2303
+ }
2304
+ return !0;
2305
+ }), n("uint", "==", "uint", (e, t) => e.valueOf() === t.valueOf()), n("dyn<uint>", "==", "double", (e, t) => e.valueOf() == t), n("uint", "+", "uint", (e, t) => new x(e.valueOf() + t.valueOf())), n("uint", "-", "uint", (e, t) => new x(e.valueOf() - t.valueOf())), n("uint", "*", "uint", (e, t) => new x(e.valueOf() * t.valueOf())), n("uint", "/", "uint", (e, t, n) => t.valueOf() === 0n ? i(n) : new x(e.valueOf() / t.valueOf())), n("uint", "%", "uint", (e, t, n) => t.valueOf() === 0n ? a(n) : new x(e.valueOf() % t.valueOf()));
2306
+ for (let [e, t] of [
2307
+ ["bool", "bool"],
2308
+ ["int", "int"],
2309
+ ["uint", "uint"],
2310
+ ["double", "double"],
2311
+ ["string", "string"],
2312
+ ["google.protobuf.Timestamp", "google.protobuf.Timestamp"],
2313
+ ["google.protobuf.Duration", "google.protobuf.Duration"],
2314
+ ["int", "uint"],
2315
+ ["int", "double"],
2316
+ ["double", "int"],
2317
+ ["double", "uint"],
2318
+ ["uint", "int"],
2319
+ ["uint", "double"]
2320
+ ]) n(e, "<", t, (e, t) => e < t), n(e, "<=", t, (e, t) => e <= t), n(e, ">", t, (e, t) => e > t), n(e, ">=", t, (e, t) => e >= t);
2321
+ }
2322
+ function sr(e, t, n, r) {
2323
+ if (e === t) return !0;
2324
+ switch (typeof e) {
2325
+ case "undefined":
2326
+ case "string":
2327
+ case "boolean": return !1;
2328
+ case "bigint": return typeof t == "number" && e == t;
2329
+ case "number": return typeof t == "bigint" && e == t;
2330
+ case "object":
2331
+ if (typeof t != "object") return !1;
2332
+ let i = r.debugType(e), a = r.debugType(t);
2333
+ if (i !== a) return !1;
2334
+ let o = r.registry.findBinaryOverload("==", i, a);
2335
+ return o ? o.handler(e, t, n, r) : !1;
2336
+ }
2337
+ throw h("invalid_comparison_type", `Cannot compare values of type ${typeof e}`, n);
2338
+ }
2339
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/type-checker.js
2340
+ var cr = (/* @__PURE__ */ new Map()).set("A", "dyn").set("T", "dyn").set("K", "dyn").set("V", "dyn"), lr = class extends cn {
2341
+ constructor(e, t) {
2342
+ super(e), this.createError = t ? h : oe;
2343
+ }
2344
+ check(e, t) {
2345
+ try {
2346
+ var n;
2347
+ return (n = e.checkedType) == null ? e.checkedType = e.check(this, e, t) : n;
2348
+ } catch (t) {
2349
+ throw le(t, e);
2350
+ }
2351
+ }
2352
+ checkAccessOnType(e, t, n, r = !1) {
2353
+ if (n === this.dynType) return n;
2354
+ let i = (e.op === "[]" || e.op === "[?]" ? this.check(e.args[1], t) : this.stringType).type;
2355
+ if (n.kind === "list") {
2356
+ if (i === "int" || i === "dyn") return n.valueType;
2357
+ throw this.createError("invalid_index_type", `List index must be int, got '${i}'`, e);
2358
+ }
2359
+ if (n.kind === "map") return n.valueType;
2360
+ let a = this.objectTypes.get(n.name);
2361
+ if (a) {
2362
+ if (i !== "string" && i !== "dyn") throw this.createError("invalid_index_type", `Cannot index type '${n.name}' with type '${i}'`, e);
2363
+ if (a.fields) {
2364
+ let t;
2365
+ if (e.op === "." || e.op === ".?" ? t = e.args[1] : e.args[1].op === "value" && (t = e.args[1].args), typeof t == "string") {
2366
+ let n = a.fields[t];
2367
+ if (n) return n;
2368
+ if (r) return this.dynType;
2369
+ throw this.createError("no_such_key", `No such key: ${t}`, e);
2370
+ }
2371
+ }
2372
+ return this.dynType;
2373
+ }
2374
+ throw this.createError("cannot_index_type", `Cannot index type '${this.formatType(n)}'`, e);
2375
+ }
2376
+ formatType(e) {
2377
+ return e.hasPlaceholderType ? e.templated(this.registry, cr).name : e.name;
2378
+ }
2379
+ formatTypeList(e) {
2380
+ return e.map((e) => this.formatType(e)).join(", ");
2381
+ }
2382
+ };
2383
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/parser.js
2384
+ e();
2385
+ var G = {
2386
+ EOF: 0,
2387
+ NUMBER: 1,
2388
+ STRING: 2,
2389
+ BOOLEAN: 3,
2390
+ NULL: 4,
2391
+ IDENTIFIER: 5,
2392
+ PLUS: 6,
2393
+ MINUS: 7,
2394
+ MULTIPLY: 8,
2395
+ DIVIDE: 9,
2396
+ MODULO: 10,
2397
+ EQ: 11,
2398
+ NE: 12,
2399
+ LT: 13,
2400
+ LE: 14,
2401
+ GT: 15,
2402
+ GE: 16,
2403
+ AND: 17,
2404
+ OR: 18,
2405
+ NOT: 19,
2406
+ IN: 20,
2407
+ LPAREN: 21,
2408
+ RPAREN: 22,
2409
+ LBRACKET: 23,
2410
+ RBRACKET: 24,
2411
+ LBRACE: 25,
2412
+ RBRACE: 26,
2413
+ DOT: 27,
2414
+ COMMA: 28,
2415
+ COLON: 29,
2416
+ QUESTION: 30,
2417
+ BYTES: 31
2418
+ }, ur = {
2419
+ [G.EQ]: W["=="],
2420
+ [G.PLUS]: W["+"],
2421
+ [G.MINUS]: W["-"],
2422
+ [G.MULTIPLY]: W["*"],
2423
+ [G.DIVIDE]: W["/"],
2424
+ [G.MODULO]: W["%"],
2425
+ [G.LE]: W["<="],
2426
+ [G.LT]: W["<"],
2427
+ [G.GE]: W[">="],
2428
+ [G.GT]: W[">"],
2429
+ [G.NE]: W["!="],
2430
+ [G.IN]: W.in
2431
+ }, dr = {};
2432
+ for (let e in G) dr[G[e]] = e;
2433
+ var fr = /* @__PURE__ */ new Uint8Array(128);
2434
+ for (let e of "0123456789abcdefABCDEF") fr[e.charCodeAt(0)] = 1;
2435
+ var pr = {
2436
+ bytes_unicode_escape: (e) => `\\${e} not allowed in bytes literals`,
2437
+ invalid_unicode_escape: (e) => `Invalid Unicode escape: \\${e}`,
2438
+ invalid_unicode_surrogate: (e) => `Invalid Unicode surrogate: \\${e}`,
2439
+ invalid_hex_escape: (e) => `Invalid hex escape: \\${e}`,
2440
+ invalid_octal_escape: () => "Octal escape must be 3 digits",
2441
+ octal_escape_out_of_range: (e) => `Octal escape out of range: \\${e}`,
2442
+ invalid_escape_sequence: (e) => `Invalid escape sequence: \\${e}`
2443
+ }, mr = {
2444
+ "\\": "\\",
2445
+ "?": "?",
2446
+ "\"": "\"",
2447
+ "'": "'",
2448
+ "`": "`",
2449
+ a: "\x07",
2450
+ b: "\b",
2451
+ f: "\f",
2452
+ n: "\n",
2453
+ r: "\r",
2454
+ t: " ",
2455
+ v: "\v"
2456
+ }, K = /* @__PURE__ */ new WeakMap(), hr = /* @__PURE__ */ new WeakMap(), gr = /* @__PURE__ */ new WeakSet(), _r = class e {
2457
+ constructor(e, t, n, r, i, a) {
2458
+ w(this, gr), s(this, K, void 0), s(this, hr, void 0), l(K, this, {
2459
+ check: i.check,
2460
+ evaluate: i.evaluate
2461
+ }), l(hr, this, e), this.op = i.name, this.args = a, this.pos = t, this.start = n, this.end = r;
2462
+ }
2463
+ clone(t, n) {
2464
+ return new e(u(hr, this), this.pos, this.start, this.end, t, n);
2465
+ }
2466
+ get meta() {
2467
+ return u(K, this);
2468
+ }
2469
+ get input() {
2470
+ return u(hr, this);
2471
+ }
2472
+ get maybeAsync() {
2473
+ var e, t;
2474
+ return (t = (e = u(K, this)).async) == null ? e.async = c(gr, this, vr).call(this) : t;
2475
+ }
2476
+ check(e, t, n) {
2477
+ let r = u(K, this);
2478
+ return r.alternate ? e.check(r.alternate, n) : r.macro ? r.macro.typeCheck(e, r.macro, n) : r.check(e, t, n);
2479
+ }
2480
+ evaluate(e, t, n) {
2481
+ let r = u(K, this);
2482
+ return this.evaluate = r.alternate ? c(gr, this, yr) : r.macro ? c(gr, this, br) : r.evaluate, this.evaluate(e, t, n);
2483
+ }
2484
+ setMeta(e, t) {
2485
+ return u(K, this)[e] = t, this;
2486
+ }
2487
+ get range() {
2488
+ return {
2489
+ start: this.start,
2490
+ end: this.end
2491
+ };
2492
+ }
2493
+ toOldStructure() {
2494
+ let t = Array.isArray(this.args) ? this.args : [this.args];
2495
+ return [this.op, ...t.map((t) => t instanceof e ? t.toOldStructure() : t)];
2496
+ }
2497
+ };
2498
+ function vr() {
2499
+ var e;
2500
+ let t = (e = u(K, this).alternate) == null ? this : e;
2501
+ switch (t.op) {
2502
+ case "value":
2503
+ case "id":
2504
+ case "accuValue":
2505
+ case "accuInc": return !1;
2506
+ case "accuPush": return t.args.maybeAsync;
2507
+ case "!_":
2508
+ case "-_":
2509
+ var n;
2510
+ return ((n = t.candidates) == null ? void 0 : n.async) !== !1 || t.args.maybeAsync;
2511
+ case "!=":
2512
+ case "==":
2513
+ case "in":
2514
+ case "+":
2515
+ case "-":
2516
+ case "*":
2517
+ case "/":
2518
+ case "%":
2519
+ case "<":
2520
+ case "<=":
2521
+ case ">":
2522
+ case ">=":
2523
+ var r;
2524
+ return ((r = t.candidates) == null ? void 0 : r.async) !== !1 || t.args.some((e) => e.maybeAsync);
2525
+ case "call":
2526
+ case "rcall":
2527
+ var i;
2528
+ return ((i = t.candidates) == null ? void 0 : i.async) !== !1 || (t.receiverWithArgs || t.args[1]).some((e) => e.maybeAsync);
2529
+ case "comprehension": return t.args.iterable.maybeAsync || t.args.step.maybeAsync;
2530
+ case ".":
2531
+ case ".?": return t.args[0].maybeAsync;
2532
+ case "?:":
2533
+ case "list":
2534
+ case "[]":
2535
+ case "[?]": return t.args.some((e) => e.maybeAsync);
2536
+ case "||":
2537
+ case "&&": return t.args.some((e) => e.maybeAsync);
2538
+ case "map": return t.args.some((e) => e[0].maybeAsync || e[1].maybeAsync);
2539
+ default: return !0;
2540
+ }
2541
+ }
2542
+ function yr(e, t, n) {
2543
+ return (t = u(K, this).alternate).evaluate(e, t, n);
2544
+ }
2545
+ function br(e, t, n) {
2546
+ return (t = u(K, this).macro).evaluate(e, t, n);
2547
+ }
2548
+ var q = /* @__PURE__ */ new WeakSet(), xr = class {
2549
+ constructor() {
2550
+ w(this, q), n(this, "input", void 0), n(this, "pos", void 0), n(this, "length", void 0), n(this, "tokenPos", void 0), n(this, "tokenType", void 0), n(this, "tokenValue", void 0);
2551
+ }
2552
+ reset(e) {
2553
+ return this.pos = 0, this.input = e, this.length = e.length, e;
2554
+ }
2555
+ token(e, t, n) {
2556
+ return this.tokenPos = e, this.tokenType = t, this.tokenValue = n, this;
2557
+ }
2558
+ nextToken() {
2559
+ for (;;) {
2560
+ let { pos: e, input: t, length: n } = this;
2561
+ if (e >= n) return this.token(e, G.EOF);
2562
+ let r = t[e];
2563
+ switch (r) {
2564
+ case " ":
2565
+ case " ":
2566
+ case "\n":
2567
+ case "\r":
2568
+ this.pos++;
2569
+ continue;
2570
+ case "=":
2571
+ if (t[e + 1] !== "=") break;
2572
+ return this.token((this.pos += 2) - 2, G.EQ);
2573
+ case "&":
2574
+ if (t[e + 1] !== "&") break;
2575
+ return this.token((this.pos += 2) - 2, G.AND);
2576
+ case "|":
2577
+ if (t[e + 1] !== "|") break;
2578
+ return this.token((this.pos += 2) - 2, G.OR);
2579
+ case "+": return this.token(this.pos++, G.PLUS);
2580
+ case "-": return this.token(this.pos++, G.MINUS);
2581
+ case "*": return this.token(this.pos++, G.MULTIPLY);
2582
+ case "/":
2583
+ if (t[e + 1] === "/") {
2584
+ for (; this.pos < n && this.input[this.pos] !== "\n";) this.pos++;
2585
+ continue;
2586
+ }
2587
+ return this.token(this.pos++, G.DIVIDE);
2588
+ case "%": return this.token(this.pos++, G.MODULO);
2589
+ case "<": return t[e + 1] === "=" ? this.token((this.pos += 2) - 2, G.LE) : this.token(this.pos++, G.LT);
2590
+ case ">": return t[e + 1] === "=" ? this.token((this.pos += 2) - 2, G.GE) : this.token(this.pos++, G.GT);
2591
+ case "!": return t[e + 1] === "=" ? this.token((this.pos += 2) - 2, G.NE) : this.token(this.pos++, G.NOT);
2592
+ case "(": return this.token(this.pos++, G.LPAREN);
2593
+ case ")": return this.token(this.pos++, G.RPAREN);
2594
+ case "[": return this.token(this.pos++, G.LBRACKET);
2595
+ case "]": return this.token(this.pos++, G.RBRACKET);
2596
+ case "{": return this.token(this.pos++, G.LBRACE);
2597
+ case "}": return this.token(this.pos++, G.RBRACE);
2598
+ case ".": return this.token(this.pos++, G.DOT);
2599
+ case ",": return this.token(this.pos++, G.COMMA);
2600
+ case ":": return this.token(this.pos++, G.COLON);
2601
+ case "?": return this.token(this.pos++, G.QUESTION);
2602
+ case "\"":
2603
+ case "'": return this.readString(r);
2604
+ case "b":
2605
+ case "B":
2606
+ case "r":
2607
+ case "R": {
2608
+ let n = t[e + 1];
2609
+ return n === "\"" || n === "'" ? ++this.pos && this.readString(n, r) : this.readIdentifier();
2610
+ }
2611
+ default: {
2612
+ let e = r.charCodeAt(0);
2613
+ if (e <= 57 && e >= 48) return this.readNumber();
2614
+ if (this._isIdentifierCharCode(e)) return this.readIdentifier();
2615
+ }
2616
+ }
2617
+ throw m("unexpected_character", `Unexpected character: ${r}`, {
2618
+ pos: e,
2619
+ start: e,
2620
+ end: e + 1,
2621
+ input: t
2622
+ });
2623
+ }
2624
+ }
2625
+ _isIdentifierCharCode(e) {
2626
+ return e < 48 || e > 122 ? !1 : e >= 97 || e >= 65 && e <= 90 || e <= 57 || e === 95;
2627
+ }
2628
+ _parseAsDouble(e, t) {
2629
+ let n = Number(this.input.substring(e, t));
2630
+ if (Number.isFinite(n)) return this.token(e, G.NUMBER, n);
2631
+ throw m("invalid_number", `Invalid number: ${n}`, {
2632
+ pos: e,
2633
+ start: e,
2634
+ end: t,
2635
+ input: this.input
2636
+ });
2637
+ }
2638
+ _parseAsBigInt(e, t, n, r) {
2639
+ let i = this.input.substring(e, t);
2640
+ if (r === "u" || r === "U") {
2641
+ this.pos++;
2642
+ try {
2643
+ return this.token(e, G.NUMBER, new x(i));
2644
+ } catch (e) {}
2645
+ } else try {
2646
+ return this.token(e, G.NUMBER, BigInt(i));
2647
+ } catch (e) {}
2648
+ throw m(n ? "invalid_hex_integer" : "invalid_integer", n ? `Invalid hex integer: ${i}` : `Invalid integer: ${i}`, {
2649
+ pos: e,
2650
+ start: e,
2651
+ end: this.pos,
2652
+ input: this.input
2653
+ });
2654
+ }
2655
+ _readDigits(e, t, n, r) {
2656
+ for (; n < t && (r = e.charCodeAt(n)) && !(r > 57 || r < 48);) n++;
2657
+ return n;
2658
+ }
2659
+ _readExponent(e, t, n) {
2660
+ let r = n < t && e[n];
2661
+ if (r === "e" || r === "E") {
2662
+ r = ++n < t && e[n], (r === "-" || r === "+") && n++;
2663
+ let i = n;
2664
+ if (n = this._readDigits(e, t, n), i === n) throw m("invalid_exponent", "Invalid exponent", {
2665
+ pos: n,
2666
+ start: n,
2667
+ end: Math.min(n + 1, e.length),
2668
+ input: e
2669
+ });
2670
+ }
2671
+ return n;
2672
+ }
2673
+ readNumber() {
2674
+ let { input: e, length: t, pos: n } = this, r = n;
2675
+ if (e[r] === "0" && (e[r + 1] === "x" || e[r + 1] === "X")) {
2676
+ for (r += 2; r < t && fr[e[r].charCodeAt(0)];) r++;
2677
+ return this._parseAsBigInt(n, this.pos = r, !0, e[r]);
2678
+ }
2679
+ if (r = this._readDigits(e, t, r), r + 1 < t) {
2680
+ let i = !1, a = e[r] === "." ? this._readDigits(e, t, r + 1) : r + 1;
2681
+ if (a !== r + 1 && (i = !0) && (r = a), a = this._readExponent(e, t, r), a !== r && (i = !0) && (r = a), i) return this._parseAsDouble(n, this.pos = r);
2682
+ }
2683
+ return this._parseAsBigInt(n, this.pos = r, !1, e[r]);
2684
+ }
2685
+ readString(e, t) {
2686
+ let { input: n, pos: r } = this;
2687
+ return n[r + 1] === e && n[r + 2] === e ? this.readTripleQuotedString(e, t) : this.readSingleQuotedString(e, t);
2688
+ }
2689
+ _closeQuotedString(e, t, n, r) {
2690
+ switch (n) {
2691
+ case "b":
2692
+ case "B": {
2693
+ let n = this.processEscapes(e, t, !0), i = new Uint8Array(n.length);
2694
+ for (let e = 0; e < n.length; e++) i[e] = n.charCodeAt(e) & 255;
2695
+ return this.token(r - 1, G.BYTES, i);
2696
+ }
2697
+ case "r":
2698
+ case "R": return this.token(r - 1, G.STRING, t);
2699
+ default: {
2700
+ let n = this.processEscapes(e, t, !1);
2701
+ return this.token(r, G.STRING, n);
2702
+ }
2703
+ }
2704
+ }
2705
+ readSingleQuotedString(e, t) {
2706
+ let { input: n, length: r, pos: i } = this, a, o = this.pos + 1;
2707
+ for (; o < r && (a = n[o]);) {
2708
+ switch (a) {
2709
+ case e:
2710
+ let r = i + 1, a = n.slice(r, o);
2711
+ return this.pos = ++o, this._closeQuotedString(r, a, t, i);
2712
+ case "\n":
2713
+ case "\r": throw m("newline_in_string", "Newlines not allowed in single-quoted strings", {
2714
+ pos: o,
2715
+ start: o,
2716
+ end: o + 1,
2717
+ input: n
2718
+ });
2719
+ case "\\": o++;
2720
+ }
2721
+ o++;
2722
+ }
2723
+ throw m("unterminated_string", "Unterminated string", {
2724
+ pos: i,
2725
+ start: i,
2726
+ end: n.length,
2727
+ input: n
2728
+ });
2729
+ }
2730
+ readTripleQuotedString(e, t) {
2731
+ let { input: n, length: r, pos: i } = this, a, o = this.pos + 3;
2732
+ for (; o < r && (a = n[o]);) {
2733
+ switch (a) {
2734
+ case e:
2735
+ if (n[o + 1] === e && n[o + 2] === e) {
2736
+ let e = i + 3, r = n.slice(e, o);
2737
+ return this.pos = o + 3, this._closeQuotedString(e, r, t, i);
2738
+ }
2739
+ break;
2740
+ case "\\": o++;
2741
+ }
2742
+ o++;
2743
+ }
2744
+ throw m("unterminated_triple_quoted_string", "Unterminated triple-quoted string", {
2745
+ pos: i,
2746
+ start: i,
2747
+ end: n.length,
2748
+ input: n
2749
+ });
2750
+ }
2751
+ processEscapes(e, t, n) {
2752
+ if (!t.includes("\\")) return t;
2753
+ let r = t.length, i = "", a = 0;
2754
+ for (; a < r;) {
2755
+ if (t[a] !== "\\" || a + 1 >= r) {
2756
+ i += t[a++];
2757
+ continue;
2758
+ }
2759
+ let o = t[a + 1];
2760
+ if (mr[o]) i += mr[o], a += 2;
2761
+ else if (o === "u" || o === "U") {
2762
+ if (n) throw c(q, this, J).call(this, "bytes_unicode_escape", e, r, a, 2, o);
2763
+ let s = o === "u" ? 4 : 8, l = t.substring(a + 2, a + 2 + s), u = Number.parseInt(l, 16);
2764
+ if (l.length !== s || !/^[0-9a-fA-F]+$/.test(l) || u > 1114111) throw c(q, this, J).call(this, "invalid_unicode_escape", e, r, a, 2 + s, o + l);
2765
+ if (u >= 55296 && u <= 57343) throw c(q, this, J).call(this, "invalid_unicode_surrogate", e, r, a, 2 + s, o + l);
2766
+ i += String.fromCodePoint(u), a += 2 + s;
2767
+ } else if (o === "x" || o === "X") {
2768
+ let n = t.substring(a + 2, a + 4);
2769
+ if (!/^[0-9a-fA-F]{2}$/.test(n)) throw c(q, this, J).call(this, "invalid_hex_escape", e, r, a, 4, o + n);
2770
+ i += String.fromCharCode(Number.parseInt(n, 16)), a += 4;
2771
+ } else if (o >= "0" && o <= "7") {
2772
+ let n = t.substring(a + 1, a + 4);
2773
+ if (!/^[0-7]{3}$/.test(n)) throw c(q, this, J).call(this, "invalid_octal_escape", e, r, a, 4);
2774
+ let o = Number.parseInt(n, 8);
2775
+ if (o > 255) throw c(q, this, J).call(this, "octal_escape_out_of_range", e, r, a, 4, n);
2776
+ i += String.fromCharCode(o), a += 4;
2777
+ } else throw c(q, this, J).call(this, "invalid_escape_sequence", e, r, a, 2, o);
2778
+ }
2779
+ return i;
2780
+ }
2781
+ readIdentifier() {
2782
+ let { pos: e, input: t, length: n } = this, r = e;
2783
+ for (; r < n && this._isIdentifierCharCode(t[r].charCodeAt(0));) r++;
2784
+ let i = t.substring(e, this.pos = r);
2785
+ switch (i) {
2786
+ case "true": return this.token(e, G.BOOLEAN, !0);
2787
+ case "false": return this.token(e, G.BOOLEAN, !1);
2788
+ case "null": return this.token(e, G.NULL, null);
2789
+ case "in": return this.token(e, G.IN);
2790
+ default: return this.token(e, G.IDENTIFIER, i);
2791
+ }
2792
+ }
2793
+ };
2794
+ function J(e, t, n, r, i, a) {
2795
+ let o = t + r;
2796
+ return m(e, pr[e](a), {
2797
+ input: this.input,
2798
+ pos: o,
2799
+ start: o,
2800
+ end: Math.min(o + i, t + n)
2801
+ });
2802
+ }
2803
+ var Sr = new xr(), Y = /* @__PURE__ */ new WeakSet(), Cr = class {
2804
+ constructor(e, t) {
2805
+ w(this, Y), n(this, "lexer", Sr), n(this, "input", null), n(this, "maxDepthRemaining", null), n(this, "astNodesRemaining", null), n(this, "type", null), n(this, "pos", null), this.limits = e, this.registry = t;
2806
+ }
2807
+ get value() {
2808
+ return this.lexer.tokenValue;
2809
+ }
2810
+ consume(e) {
2811
+ if (this.type === e) return c(Y, this, Q).call(this);
2812
+ throw m("expected_token", `Expected ${dr[e]}, got ${dr[this.type]}`, {
2813
+ pos: this.pos,
2814
+ start: this.pos,
2815
+ end: this.lexer.pos,
2816
+ input: this.input
2817
+ });
2818
+ }
2819
+ match(e) {
2820
+ return this.type === e;
2821
+ }
2822
+ parse(e) {
2823
+ if (typeof e != "string") throw m("expression_must_be_string", "Expression must be a string");
2824
+ this.input = this.lexer.reset(e), c(Y, this, Q).call(this), this.maxDepthRemaining = this.limits.maxDepth, this.astNodesRemaining = this.limits.maxAstNodes;
2825
+ let t = this.parseExpression();
2826
+ if (this.match(G.EOF)) return t;
2827
+ throw m("unexpected_character", `Unexpected character: '${this.input[this.lexer.pos - 1]}'`, {
2828
+ pos: this.pos,
2829
+ start: this.pos,
2830
+ end: this.lexer.pos,
2831
+ input: this.input
2832
+ });
2833
+ }
2834
+ parseExpression() {
2835
+ this.maxDepthRemaining-- || c(Y, this, X).call(this, "maxDepth");
2836
+ let e = this.parseLogicalOr();
2837
+ if (!this.match(G.QUESTION)) return ++this.maxDepthRemaining && e;
2838
+ c(Y, this, Q).call(this);
2839
+ let t = this.parseExpression();
2840
+ this.consume(G.COLON);
2841
+ let n = this.parseExpression();
2842
+ return this.maxDepthRemaining++, c(Y, this, Tr).call(this, e, t, n);
2843
+ }
2844
+ parseLogicalOr() {
2845
+ let e = this.parseLogicalAnd();
2846
+ for (; this.match(G.OR);) c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, W["||"], e, this.parseLogicalAnd());
2847
+ return e;
2848
+ }
2849
+ parseLogicalAnd() {
2850
+ let e = this.parseEquality();
2851
+ for (; this.match(G.AND);) c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, W["&&"], e, this.parseEquality());
2852
+ return e;
2853
+ }
2854
+ parseEquality() {
2855
+ let e = this.parseRelational();
2856
+ for (; this.match(G.EQ) || this.match(G.NE);) {
2857
+ let t = ur[this.type];
2858
+ c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, t, e, this.parseRelational());
2859
+ }
2860
+ return e;
2861
+ }
2862
+ parseRelational() {
2863
+ let e = this.parseAdditive();
2864
+ for (; this.match(G.LT) || this.match(G.LE) || this.match(G.GT) || this.match(G.GE) || this.match(G.IN);) {
2865
+ let t = ur[this.type];
2866
+ c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, t, e, this.parseAdditive());
2867
+ }
2868
+ return e;
2869
+ }
2870
+ parseAdditive() {
2871
+ let e = this.parseMultiplicative();
2872
+ for (; this.match(G.PLUS) || this.match(G.MINUS);) {
2873
+ let t = ur[this.type];
2874
+ c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, t, e, this.parseMultiplicative());
2875
+ }
2876
+ return e;
2877
+ }
2878
+ parseMultiplicative() {
2879
+ let e = this.parseUnary();
2880
+ for (; this.match(G.MULTIPLY) || this.match(G.DIVIDE) || this.match(G.MODULO);) {
2881
+ let t = ur[this.type];
2882
+ c(Y, this, Q).call(this), e = c(Y, this, wr).call(this, t, e, this.parseUnary());
2883
+ }
2884
+ return e;
2885
+ }
2886
+ parseUnary() {
2887
+ return this.type === G.NOT ? c(Y, this, Er).call(this, c(Y, this, Q).call(this), W.unaryNot, this.parseUnary()) : this.type === G.MINUS ? c(Y, this, Er).call(this, c(Y, this, Q).call(this), W.unaryMinus, this.parseUnary()) : this.parsePostfix();
2888
+ }
2889
+ parsePostfix() {
2890
+ let e = this.parsePrimary(), t = this.maxDepthRemaining;
2891
+ for (;;) if (this.match(G.DOT)) {
2892
+ let t = c(Y, this, Q).call(this);
2893
+ this.maxDepthRemaining-- || c(Y, this, X).call(this, "maxDepth", t);
2894
+ let n = this.match(G.QUESTION) && this.registry.enableOptionalTypes && c(Y, this, Q).call(this) ? W.optionalFieldAccess : W.fieldAccess, r = this.value, i = this.pos, a = this.lexer.pos;
2895
+ if (this.consume(G.IDENTIFIER), n === W.fieldAccess && this.match(G.LPAREN) && c(Y, this, Q).call(this)) {
2896
+ let t = this.parseArgumentList(), n = this.lexer.pos;
2897
+ this.consume(G.RPAREN), e = c(Y, this, Or).call(this, e.start, n, W.rcall, [
2898
+ r,
2899
+ e,
2900
+ t
2901
+ ]);
2902
+ } else e = c(Y, this, Dr).call(this, n, e, r, a, i);
2903
+ } else if (this.match(G.LBRACKET)) {
2904
+ let t = c(Y, this, Q).call(this);
2905
+ this.maxDepthRemaining-- || c(Y, this, X).call(this, "maxDepth", t);
2906
+ let n = this.match(G.QUESTION) && this.registry.enableOptionalTypes && c(Y, this, Q).call(this) ? W.optionalBracketAccess : W.bracketAccess, r = this.parseExpression(), i = this.lexer.pos;
2907
+ this.consume(G.RBRACKET), e = c(Y, this, Dr).call(this, n, e, r, i);
2908
+ } else break;
2909
+ return this.maxDepthRemaining = t, e;
2910
+ }
2911
+ parsePrimary() {
2912
+ switch (this.type) {
2913
+ case G.NUMBER:
2914
+ case G.STRING:
2915
+ case G.BYTES:
2916
+ case G.BOOLEAN:
2917
+ case G.NULL: return c(Y, this, kr).call(this);
2918
+ case G.IDENTIFIER: return c(Y, this, Ar).call(this);
2919
+ case G.LPAREN: return c(Y, this, jr).call(this);
2920
+ case G.LBRACKET: return this.parseList();
2921
+ case G.LBRACE: return this.parseMap();
2922
+ }
2923
+ throw m("unexpected_token", `Unexpected token: ${dr[this.type]}`, {
2924
+ pos: this.pos,
2925
+ start: this.pos,
2926
+ end: this.lexer.pos,
2927
+ input: this.input
2928
+ });
2929
+ }
2930
+ parseList() {
2931
+ let e = this.consume(G.LBRACKET), t = [], n = this.limits.maxListElements;
2932
+ if (!this.match(G.RBRACKET)) for (t.push(this.parseExpression()), n-- || c(Y, this, X).call(this, "maxListElements", t.at(-1).pos); this.match(G.COMMA) && (c(Y, this, Q).call(this), !this.match(G.RBRACKET));) t.push(this.parseExpression()), n-- || c(Y, this, X).call(this, "maxListElements", t.at(-1).pos);
2933
+ let r = this.lexer.pos;
2934
+ return this.consume(G.RBRACKET), c(Y, this, Z).call(this, e, r, W.list, t);
2935
+ }
2936
+ parseMap() {
2937
+ let e = this.consume(G.LBRACE), t = [], n = this.limits.maxMapEntries;
2938
+ if (!this.match(G.RBRACE)) for (t.push(this.parseProperty()), n-- || c(Y, this, X).call(this, "maxMapEntries", t.at(-1)[0].pos); this.match(G.COMMA) && (c(Y, this, Q).call(this), !this.match(G.RBRACE));) t.push(this.parseProperty()), n-- || c(Y, this, X).call(this, "maxMapEntries", t.at(-1)[0].pos);
2939
+ let r = this.lexer.pos;
2940
+ return this.consume(G.RBRACE), c(Y, this, Z).call(this, e, r, W.map, t);
2941
+ }
2942
+ parseProperty() {
2943
+ return [this.parseExpression(), (this.consume(G.COLON), this.parseExpression())];
2944
+ }
2945
+ parseArgumentList() {
2946
+ let e = [], t = this.limits.maxCallArguments;
2947
+ if (!this.match(G.RPAREN)) for (e.push(this.parseExpression()), t-- || c(Y, this, X).call(this, "maxCallArguments", e.at(-1).pos); this.match(G.COMMA) && (c(Y, this, Q).call(this), !this.match(G.RPAREN));) e.push(this.parseExpression()), t-- || c(Y, this, X).call(this, "maxCallArguments", e.at(-1).pos);
2948
+ return e;
2949
+ }
2950
+ };
2951
+ function X(e, t = this.pos) {
2952
+ throw m("limit_exceeded", `Exceeded ${e} (${this.limits[e]})`, {
2953
+ pos: t,
2954
+ start: t,
2955
+ end: t,
2956
+ input: this.input
2957
+ });
2958
+ }
2959
+ function Z(e, t, n, r, i = e) {
2960
+ let a = new _r(this.input, i, e, t, n, r);
2961
+ return this.astNodesRemaining-- || c(Y, this, X).call(this, "maxAstNodes", i), a;
2962
+ }
2963
+ function wr(e, t, n) {
2964
+ return c(Y, this, Z).call(this, t.start, n.end, e, [t, n]);
2965
+ }
2966
+ function Tr(e, t, n) {
2967
+ return c(Y, this, Z).call(this, e.start, n.end, W.ternary, [
2968
+ e,
2969
+ t,
2970
+ n
2971
+ ]);
2972
+ }
2973
+ function Er(e, t, n) {
2974
+ return c(Y, this, Z).call(this, e, n.end, t, n);
2975
+ }
2976
+ function Dr(e, t, n, r, i = t.start) {
2977
+ return c(Y, this, Z).call(this, t.start, r, e, [t, n], i);
2978
+ }
2979
+ function Q(e = this.pos) {
2980
+ let t = this.lexer.nextToken();
2981
+ return this.pos = t.tokenPos, this.type = t.tokenType, e;
2982
+ }
2983
+ function Or(e, t, n, r) {
2984
+ let i = r[0], a = n === W.rcall ? r[1] : null, o = n === W.rcall ? r[2] : r[1], s = this.registry.findMacro(i, !!a, o.length), l = c(Y, this, Z).call(this, e, t, n, r);
2985
+ if (!s) return l;
2986
+ let u = s.handler({
2987
+ ast: l,
2988
+ args: o,
2989
+ receiver: a,
2990
+ methodName: i,
2991
+ parser: this
2992
+ });
2993
+ return u.callAst ? l.setMeta("alternate", u.callAst) : l.setMeta("macro", u).setMeta("async", xe(u.evaluate, u.async));
2994
+ }
2995
+ function kr() {
2996
+ return c(Y, this, Q).call(this, c(Y, this, Z).call(this, this.pos, this.lexer.pos, W.value, this.value));
2997
+ }
2998
+ function Ar() {
2999
+ let e = this.value, t = this.lexer.pos, n = this.consume(G.IDENTIFIER);
3000
+ if (Se.has(e)) throw m("reserved_identifier", `Reserved identifier: ${e}`, {
3001
+ pos: n,
3002
+ start: n,
3003
+ end: t,
3004
+ input: this.input
3005
+ });
3006
+ if (!this.match(G.LPAREN)) return c(Y, this, Z).call(this, n, t, W.id, e);
3007
+ c(Y, this, Q).call(this);
3008
+ let r = this.parseArgumentList(), i = this.lexer.pos;
3009
+ return this.consume(G.RPAREN), c(Y, this, Or).call(this, n, i, W.call, [e, r]);
3010
+ }
3011
+ function jr() {
3012
+ this.consume(G.LPAREN);
3013
+ let e = this.parseExpression();
3014
+ return this.consume(G.RPAREN), e;
3015
+ }
3016
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/options.js
3017
+ t();
3018
+ var Mr = y({
3019
+ maxAstNodes: 1e5,
3020
+ maxDepth: 250,
3021
+ maxListElements: 1e3,
3022
+ maxMapEntries: 1e3,
3023
+ maxCallArguments: 32
3024
+ }), Nr = new Set(v(Mr));
3025
+ function Pr(e, t = Mr) {
3026
+ let n = e ? v(e) : void 0;
3027
+ if (!(n != null && n.length)) return t;
3028
+ let i = r({}, t);
3029
+ for (let t of n) {
3030
+ if (!Nr.has(t)) throw TypeError(`Unknown limits option: ${t}`);
3031
+ let n = e[t];
3032
+ typeof n == "number" && (i[t] = n);
3033
+ }
3034
+ return y(i);
3035
+ }
3036
+ var Fr = y({
3037
+ unlistedVariablesAreDyn: !1,
3038
+ homogeneousAggregateLiterals: !0,
3039
+ enableOptionalTypes: !1,
3040
+ limits: Mr
3041
+ });
3042
+ function Ir(e, t, n) {
3043
+ var r;
3044
+ let i = (r = e == null ? void 0 : e[n]) == null ? t == null ? void 0 : t[n] : r;
3045
+ if (typeof i != "boolean") throw TypeError(`Invalid option: ${n}`);
3046
+ return i;
3047
+ }
3048
+ function Lr(e, t = Fr) {
3049
+ return e ? y({
3050
+ unlistedVariablesAreDyn: Ir(e, t, "unlistedVariablesAreDyn"),
3051
+ homogeneousAggregateLiterals: Ir(e, t, "homogeneousAggregateLiterals"),
3052
+ enableOptionalTypes: Ir(e, t, "enableOptionalTypes"),
3053
+ limits: Pr(e.limits, t.limits)
3054
+ }) : t;
3055
+ }
3056
+ // ../../node_modules/.pnpm/@marcbachmann+cel-js@8.0.0/node_modules/@marcbachmann/cel-js/lib/evaluator.js
3057
+ var Rr = Xt({ enableOptionalTypes: !1 });
3058
+ je(Rr), or(Rr), ar(Rr);
3059
+ var $ = /* @__PURE__ */ new WeakMap(), zr = /* @__PURE__ */ new WeakMap(), Br = /* @__PURE__ */ new WeakMap(), Vr = /* @__PURE__ */ new WeakMap(), Hr = /* @__PURE__ */ new WeakMap(), Ur = /* @__PURE__ */ new WeakSet(), Wr = class e {
3060
+ constructor(t, n) {
3061
+ w(this, Ur), s(this, $, void 0), s(this, zr, void 0), s(this, Br, void 0), s(this, Vr, void 0), s(this, Hr, void 0), this.opts = Lr(t, n == null ? void 0 : n.opts), l($, this, (n instanceof e ? u($, n) : Rr).clone(this.opts));
3062
+ let r = {
3063
+ registry: u($, this),
3064
+ opts: this.opts
3065
+ };
3066
+ l(Br, this, new lr(r)), l(Vr, this, new lr(r, !0)), l(zr, this, new Yr(r)), l(Hr, this, new Cr(this.opts.limits, u($, this))), Object.freeze(this);
3067
+ }
3068
+ clone(t) {
3069
+ return new e(t, this);
3070
+ }
3071
+ registerFunction(e, t, n) {
3072
+ return u($, this).registerFunctionOverload(e, t, n), this;
3073
+ }
3074
+ registerOperator(e, t, n) {
3075
+ return u($, this).registerOperatorOverload(e, t, n), this;
3076
+ }
3077
+ registerType(e, t) {
3078
+ return u($, this).registerType(e, t), this;
3079
+ }
3080
+ registerVariable(e, t, n) {
3081
+ return u($, this).registerVariable(e, t, n), this;
3082
+ }
3083
+ registerConstant(e, t, n) {
3084
+ return u($, this).registerConstant(e, t, n), this;
3085
+ }
3086
+ hasVariable(e) {
3087
+ return u($, this).variables.has(e);
3088
+ }
3089
+ getDefinitions() {
3090
+ return u($, this).getDefinitions();
3091
+ }
3092
+ check(e) {
3093
+ try {
3094
+ return c(Ur, this, Gr).call(this, u(Hr, this).parse(e));
3095
+ } catch (e) {
3096
+ return {
3097
+ valid: !1,
3098
+ error: e
3099
+ };
3100
+ }
3101
+ }
3102
+ parse(e) {
3103
+ let t = u(Hr, this).parse(e), n = c(Ur, this, qr).bind(this, t);
3104
+ return n.check = c(Ur, this, Gr).bind(this, t), n.ast = t, n;
3105
+ }
3106
+ evaluate(e, t) {
3107
+ return c(Ur, this, qr).call(this, u(Hr, this).parse(e), t);
3108
+ }
3109
+ };
3110
+ function Gr(e) {
3111
+ try {
3112
+ let t = u(Br, this).check(e, new tn(u($, this)));
3113
+ return {
3114
+ valid: !0,
3115
+ type: c(Ur, this, Kr).call(this, t)
3116
+ };
3117
+ } catch (e) {
3118
+ return {
3119
+ valid: !1,
3120
+ error: e
3121
+ };
3122
+ }
3123
+ }
3124
+ function Kr(e) {
3125
+ return e.name === "list<dyn>" ? "list" : e.name === "map<dyn, dyn>" ? "map" : e.name;
3126
+ }
3127
+ function qr(e, t) {
3128
+ return e.checkedType ? e.evaluate(u(zr, this), e, new tn(u($, this), t)) : (u(Vr, this).check(e, t = new tn(u($, this), t)), e.evaluate(u(zr, this), e, t));
3129
+ }
3130
+ var Jr = /* @__PURE__ */ new WeakSet(), Yr = class extends cn {
3131
+ constructor(e) {
3132
+ super(e), w(this, Jr), this.createError = h;
3133
+ }
3134
+ debugRuntimeType(e, t) {
3135
+ return (t == null ? void 0 : t.hasDynType) === !1 ? t : this.debugTypeDeep(e);
3136
+ }
3137
+ debugTypeDeep(e) {
3138
+ let t = this.debugType(e);
3139
+ switch (t.kind) {
3140
+ case "list": {
3141
+ let n = e instanceof Array ? e[0] : e.values().next().value;
3142
+ return n === void 0 ? t : this.registry.getListType(this.debugTypeDeep(n));
3143
+ }
3144
+ case "map": {
3145
+ let n = c(Jr, this, Xr).call(this, e);
3146
+ return n ? this.registry.getMapType(t.keyType.hasDynType ? this.debugTypeDeep(n[0]) : t.keyType, t.valueType.hasDynType ? this.debugTypeDeep(n[1]) : t.valueType) : t;
3147
+ }
3148
+ default: return t;
3149
+ }
3150
+ }
3151
+ tryEval(e, t) {
3152
+ try {
3153
+ let n = this.run(e, t);
3154
+ return n instanceof Promise ? n.catch((e) => e) : n;
3155
+ } catch (e) {
3156
+ return e;
3157
+ }
3158
+ }
3159
+ run(e, t) {
3160
+ return e.evaluate(this, e, t);
3161
+ }
3162
+ };
3163
+ function Xr(e) {
3164
+ if (e instanceof Map) return e.entries().next().value;
3165
+ for (let t in e) return [t, e[t]];
3166
+ }
3167
+ new Wr({ unlistedVariablesAreDyn: !0 });
3168
+ export { Wr as t };
3169
+
3170
+ //# sourceMappingURL=lib-0rajvaUg.mjs.map