@verbb/formie-browser 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2659 @@
1
+ //#region ../formie-core/dist/index.js
2
+ var e = Object.create, t = Object.defineProperty, n = Object.getOwnPropertyDescriptor, r = Object.getOwnPropertyNames, i = Object.getPrototypeOf, a = Object.prototype.hasOwnProperty, o = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), s = (e, i, o, s) => {
3
+ if (i && typeof i == "object" || typeof i == "function") for (var c = r(i), l = 0, u = c.length, d; l < u; l++) d = c[l], !a.call(e, d) && d !== o && t(e, d, {
4
+ get: ((e) => i[e]).bind(null, d),
5
+ enumerable: !(s = n(i, d)) || s.enumerable
6
+ });
7
+ return e;
8
+ }, c = (n, r, a) => (a = n == null ? {} : e(i(n)), s(r || !n || !n.__esModule ? t(a, "default", {
9
+ value: n,
10
+ enumerable: !0
11
+ }) : a, n));
12
+ function l(e) {
13
+ return Array.isArray(e) ? e.map((e) => String(e ?? "")) : [String(e ?? "")];
14
+ }
15
+ function u(e, t) {
16
+ return e.some((e) => t.includes(e));
17
+ }
18
+ function d(e, t) {
19
+ return e.some((e) => t.some((t) => t === e || t.includes(e)));
20
+ }
21
+ function f(e, t, n) {
22
+ return t.some((t) => e.some((e) => n(e, t)));
23
+ }
24
+ function p(e, t, n) {
25
+ return t.some((t) => {
26
+ let r = Number.parseFloat(t);
27
+ return Number.isFinite(r) ? e.some((e) => {
28
+ let t = Number.parseFloat(e);
29
+ return Number.isFinite(t) ? n(t, r) : !1;
30
+ }) : !1;
31
+ });
32
+ }
33
+ function m(e) {
34
+ return e.length === 0 || e.every((e) => e.trim() === "");
35
+ }
36
+ function h(e, t, n = {}) {
37
+ let r = String(e.condition || ""), i = l(e.value), a = n.visibility ?? null;
38
+ switch (r) {
39
+ case "=": return u(i, t);
40
+ case "!=": return !u(i, t);
41
+ case ">": return p(t, i, (e, t) => e > t);
42
+ case "<": return p(t, i, (e, t) => e < t);
43
+ case "contains": return d(i, t);
44
+ case "notContains": return !d(i, t);
45
+ case "startsWith": return f(t, i, (e, t) => e.startsWith(t));
46
+ case "endsWith": return f(t, i, (e, t) => e.endsWith(t));
47
+ case "empty": return m(t);
48
+ case "notEmpty": return !m(t);
49
+ case "visible": return a === !0;
50
+ case "hidden": return a === !1;
51
+ default: return !1;
52
+ }
53
+ }
54
+ function g(e, t) {
55
+ let n = e.conditionRule === "any" ? t.includes(!0) : t.every((e) => e === !0);
56
+ return {
57
+ finalResult: n,
58
+ shouldHide: n && e.showRule !== "show" || !n && e.showRule === "show"
59
+ };
60
+ }
61
+ var _ = /* @__PURE__ */ c((/* @__PURE__ */ o(((e, t) => {
62
+ (function(n, r) {
63
+ typeof e == "object" && t !== void 0 ? r(e) : typeof define == "function" && define.amd ? define(["exports"], r) : r((n = typeof globalThis < "u" ? globalThis : n || self).ExpressionLanguage = {});
64
+ })(e, function(e) {
65
+ function t(e, t, n) {
66
+ return (t = function(e) {
67
+ var t = function(e, t) {
68
+ if (typeof e != "object" || !e) return e;
69
+ var n = e[Symbol.toPrimitive];
70
+ if (n !== void 0) {
71
+ var r = n.call(e, t);
72
+ if (typeof r != "object") return r;
73
+ throw TypeError("@@toPrimitive must return a primitive value.");
74
+ }
75
+ return (t === "string" ? String : Number)(e);
76
+ }(e, "string");
77
+ return typeof t == "symbol" ? t : t + "";
78
+ }(t)) in e ? Object.defineProperty(e, t, {
79
+ value: n,
80
+ enumerable: !0,
81
+ configurable: !0,
82
+ writable: !0
83
+ }) : e[t] = n, e;
84
+ }
85
+ let n = function(e, t) {
86
+ if (e.length === 0) return t.length;
87
+ if (t.length === 0) return e.length;
88
+ let n, r, i = [];
89
+ for (n = 0; n <= t.length; n++) i[n] = [n];
90
+ for (r = 0; r <= e.length; r++) i[0] === void 0 && (i[0] = []), i[0][r] = r;
91
+ for (n = 1; n <= t.length; n++) for (r = 1; r <= e.length; r++) t.charAt(n - 1) === e.charAt(r - 1) ? i[n][r] = i[n - 1][r - 1] : i[n][r] = Math.min(i[n - 1][r - 1] + 1, Math.min(i[n][r - 1] + 1, i[n - 1][r] + 1));
92
+ return i[t.length] === void 0 && (i[t.length] = []), i[t.length][e.length];
93
+ };
94
+ class r extends Error {
95
+ constructor(e, t, n, r, i) {
96
+ super(e), this.name = "SyntaxError", this.cursor = t, this.expression = n, this.subject = r, this.proposals = i;
97
+ }
98
+ toString() {
99
+ let e = `${this.name}: ${this.message} around position ${this.cursor}`;
100
+ if (this.expression && (e += ` for expression \`${this.expression}\``), e += ".", this.subject && this.proposals) {
101
+ let t = 2 ** 53 - 1, r = null;
102
+ for (let e of this.proposals) {
103
+ let i = n(this.subject, e);
104
+ i < t && (r = e, t = i);
105
+ }
106
+ r !== null && t < 3 && (e += ` Did you mean "${r}"?`);
107
+ }
108
+ return e;
109
+ }
110
+ }
111
+ class i {
112
+ constructor(e, n) {
113
+ t(this, "next", () => {
114
+ if (this.position += 1, this.tokens[this.position] === void 0) throw new r("Unexpected end of expression", this.last.cursor, this.expression);
115
+ }), t(this, "expect", (e, t, n) => {
116
+ let i = this.current;
117
+ if (!i.test(e, t)) {
118
+ let a = "";
119
+ n && (a = n + ". ");
120
+ let o = "";
121
+ throw t && (o = ` with value "${t}"`), a += `Unexpected token "${i.type}" of value "${i.value}" ("${e}" expected${o})`, new r(a, i.cursor, this.expression);
122
+ }
123
+ this.next();
124
+ }), t(this, "isEOF", () => a.EOF_TYPE === this.current.type), t(this, "isEqualTo", (e) => {
125
+ if (e == null || !e instanceof i || e.tokens.length !== this.tokens.length) return !1;
126
+ let t = e.position;
127
+ e.position = 0;
128
+ let n = !0;
129
+ for (let t of this.tokens) {
130
+ if (!e.current.isEqualTo(t)) {
131
+ n = !1;
132
+ break;
133
+ }
134
+ e.position < e.tokens.length - 1 && e.next();
135
+ }
136
+ return e.position = t, n;
137
+ }), t(this, "diff", (e) => {
138
+ let t = [];
139
+ if (!this.isEqualTo(e)) {
140
+ let n = e.position;
141
+ e.position = 0;
142
+ for (let n of this.tokens) {
143
+ let r = n.diff(e.current);
144
+ r.length > 0 && t.push({
145
+ index: 0,
146
+ diff: r
147
+ }), e.position < e.tokens.length - 1 && e.next();
148
+ }
149
+ e.position = n;
150
+ }
151
+ return t;
152
+ }), this.expression = e, this.position = 0, this.tokens = n;
153
+ }
154
+ get current() {
155
+ return this.tokens[this.position];
156
+ }
157
+ get last() {
158
+ return this.tokens[this.position - 1];
159
+ }
160
+ toString() {
161
+ return this.tokens.join("\n");
162
+ }
163
+ }
164
+ class a {
165
+ constructor(e, n, r) {
166
+ t(this, "test", (e, t = null) => this.type === e && (t === null || this.value === t)), t(this, "isEqualTo", (e) => !(e == null || !e instanceof a) && e.value == this.value && e.type === this.type && e.cursor === this.cursor), t(this, "diff", (e) => {
167
+ let t = [];
168
+ return this.isEqualTo(e) || (e.value !== this.value && t.push(`Value: ${e.value} != ${this.value}`), e.cursor !== this.cursor && t.push(`Cursor: ${e.cursor} != ${this.cursor}`), e.type !== this.type && t.push(`Type: ${e.type} != ${this.type}`)), t;
169
+ }), this.value = n, this.type = e, this.cursor = r;
170
+ }
171
+ toString() {
172
+ return `${this.cursor} [${this.type}] ${this.value}`;
173
+ }
174
+ }
175
+ function o(e) {
176
+ let t = 0, n = [], o = [], c = (e = e.replace(/\r|\n|\t|\v|\f/g, " ")).length;
177
+ for (; t < c;) {
178
+ if (e[t] === " ") {
179
+ ++t;
180
+ continue;
181
+ }
182
+ if (e.substr(t, 2) === "/*") {
183
+ let n = e.indexOf("*/", t + 2);
184
+ if (n === -1) {
185
+ t = c;
186
+ break;
187
+ }
188
+ t = n + 2;
189
+ continue;
190
+ }
191
+ let i = s(e.substr(t));
192
+ if (i !== null) {
193
+ let e = i.length, r = i.replace(/_/g, "");
194
+ i = r.indexOf(".") === -1 && r.indexOf("e") === -1 && r.indexOf("E") === -1 ? parseInt(r, 10) : parseFloat(r), n.push(new a(a.NUMBER_TYPE, i, t + 1)), t += e;
195
+ } else if ("([{".indexOf(e[t]) >= 0) o.push([e[t], t]), n.push(new a(a.PUNCTUATION_TYPE, e[t], t + 1)), ++t;
196
+ else if (")]}".indexOf(e[t]) >= 0) {
197
+ if (o.length === 0) throw new r(`Unexpected "${e[t]}"`, t, e);
198
+ let [i, s] = o.pop(), c = i.replace("(", ")").replace("{", "}").replace("[", "]");
199
+ if (e[t] !== c) throw new r(`Unclosed "${i}"`, s, e);
200
+ n.push(new a(a.PUNCTUATION_TYPE, e[t], t + 1)), ++t;
201
+ } else {
202
+ let i = u(e.substr(t));
203
+ if (i !== null) n.push(new a(a.STRING_TYPE, i.captured, t + 1)), t += i.length;
204
+ else if (e.substr(t, 2) === "\\\\") n.push(new a(a.PUNCTUATION_TYPE, "\\", t + 1)), t += 2;
205
+ else {
206
+ let i = n.length > 0 ? n[n.length - 1] : null;
207
+ if (i && i.type === a.PUNCTUATION_TYPE && (i.value === "." || i.value === "?.")) {
208
+ let i = m(e.substr(t));
209
+ if (i) n.push(new a(a.NAME_TYPE, i, t + 1)), t += i.length;
210
+ else {
211
+ let i = p(e.substr(t));
212
+ if (i) n.push(new a(a.OPERATOR_TYPE, i, t + 1)), t += i.length;
213
+ else if (e.substr(t, 2) === "?." || e.substr(t, 2) === "??") n.push(new a(a.PUNCTUATION_TYPE, e.substr(t, 2), t + 1)), t += 2;
214
+ else {
215
+ if (!(".,?:".indexOf(e[t]) >= 0)) throw new r(`Unexpected character "${e[t]}"`, t, e);
216
+ n.push(new a(a.PUNCTUATION_TYPE, e[t], t + 1)), ++t;
217
+ }
218
+ }
219
+ } else {
220
+ let i = p(e.substr(t));
221
+ if (i) n.push(new a(a.OPERATOR_TYPE, i, t + 1)), t += i.length;
222
+ else if (e.substr(t, 2) === "?." || e.substr(t, 2) === "??") n.push(new a(a.PUNCTUATION_TYPE, e.substr(t, 2), t + 1)), t += 2;
223
+ else if (".,?:".indexOf(e[t]) >= 0) n.push(new a(a.PUNCTUATION_TYPE, e[t], t + 1)), ++t;
224
+ else {
225
+ let i = m(e.substr(t));
226
+ if (!i) throw new r(`Unexpected character "${e[t]}"`, t, e);
227
+ n.push(new a(a.NAME_TYPE, i, t + 1)), t += i.length;
228
+ }
229
+ }
230
+ }
231
+ }
232
+ }
233
+ if (n.push(new a(a.EOF_TYPE, null, t + 1)), o.length > 0) {
234
+ let [t, n] = o.pop();
235
+ throw new r(`Unclosed "${t}"`, n, e);
236
+ }
237
+ return new i(e, n);
238
+ }
239
+ function s(e) {
240
+ let t = null, n = e.match(/^(?:((?:\d(?:_?\d)*)\.(?:\d(?:_?\d)*)|\.(?:\d(?:_?\d)*)|(?:\d(?:_?\d)*))(?:[eE][+-]?\d(?:_?\d)*)?)/);
241
+ return n && n.length > 0 && (t = n[0]), t;
242
+ }
243
+ t(a, "EOF_TYPE", "end of expression"), t(a, "NAME_TYPE", "name"), t(a, "NUMBER_TYPE", "number"), t(a, "STRING_TYPE", "string"), t(a, "OPERATOR_TYPE", "operator"), t(a, "PUNCTUATION_TYPE", "punctuation");
244
+ let c = /^"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'/s;
245
+ function l(e, t) {
246
+ return t === "\"" ? e = e.replace(/\\\"/g, "\"") : t === "'" && (e = e.replace(/\\'/g, "'")), e = e.replace(/\\\\/g, "\\");
247
+ }
248
+ function u(e) {
249
+ let t = null;
250
+ if (["'", "\""].indexOf(e.substr(0, 1)) === -1) return t;
251
+ let n = c.exec(e);
252
+ return n !== null && n.length > 0 && (t = n[1] === void 0 ? { captured: l(n[2], "'") } : { captured: l(n[1], "\"") }, t.length = n[0].length), t;
253
+ }
254
+ let d = /* @__PURE__ */ "&&,and,||,or,+,-,**,*,/,%,&,|,^,>>,<<,===,!==,!=,==,<=,>=,<,>,contains,matches,starts with,ends with,not in,in,not,!,xor,~,..".split(","), f = [
255
+ "and",
256
+ "or",
257
+ "matches",
258
+ "contains",
259
+ "starts with",
260
+ "ends with",
261
+ "not in",
262
+ "in",
263
+ "not",
264
+ "xor"
265
+ ];
266
+ function p(e) {
267
+ let t = null;
268
+ for (let n of d) if (e.substr(0, n.length) === n) {
269
+ f.indexOf(n) >= 0 ? e.substr(0, n.length + 1) === n + " " && (t = n) : t = n;
270
+ break;
271
+ }
272
+ return t;
273
+ }
274
+ function m(e) {
275
+ let t = null, n = e.match(/^[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/);
276
+ return n && n.length > 0 && (t = n[0]), t;
277
+ }
278
+ function h(e) {
279
+ return /boolean|number|string/.test(typeof e);
280
+ }
281
+ function g(e, t) {
282
+ var n = "", r = [], i = 0, a = 0, o = "", s = "", c = "", l = "", u = "", d = 0, f = 0, p = 0, m = 0, h = 0, g = [], _ = "", v = /%([\dA-Fa-f]+)/g, y = function(e, t) {
283
+ return (e += "").length < t ? Array(++t - e.length).join("0") + e : e;
284
+ };
285
+ for (i = 0; i < t.length; i++) if (o = t.charAt(i), s = t.charAt(i + 1), o === "\\" && s && /\d/.test(s)) {
286
+ if (m = i + (p = (c = t.slice(i + 1).match(/^\d+/)[0]).length) + 1, t.charAt(m) + t.charAt(m + 1) === "..") {
287
+ if (d = c.charCodeAt(0), /\\\d/.test(t.charAt(m + 2) + t.charAt(m + 3))) l = t.slice(m + 3).match(/^\d+/)[0], i += 1;
288
+ else {
289
+ if (!t.charAt(m + 2)) throw Error("Range with no end point");
290
+ l = t.charAt(m + 2);
291
+ }
292
+ if ((f = l.charCodeAt(0)) > d) for (a = d; a <= f; a++) r.push(String.fromCharCode(a));
293
+ else r.push(".", c, l);
294
+ i += l.length + 2;
295
+ } else u = String.fromCharCode(parseInt(c, 8)), r.push(u);
296
+ i += p;
297
+ } else if (s + t.charAt(i + 2) === "..") {
298
+ if (d = (c = o).charCodeAt(0), /\\\d/.test(t.charAt(i + 3) + t.charAt(i + 4))) l = t.slice(i + 4).match(/^\d+/)[0], i += 1;
299
+ else {
300
+ if (!t.charAt(i + 3)) throw Error("Range with no end point");
301
+ l = t.charAt(i + 3);
302
+ }
303
+ if ((f = l.charCodeAt(0)) > d) for (a = d; a <= f; a++) r.push(String.fromCharCode(a));
304
+ else r.push(".", c, l);
305
+ i += l.length + 2;
306
+ } else r.push(o);
307
+ for (i = 0; i < e.length; i++) if (o = e.charAt(i), r.indexOf(o) !== -1) if (n += "\\", (h = o.charCodeAt(0)) < 32 || h > 126) switch (o) {
308
+ case "\n":
309
+ n += "n";
310
+ break;
311
+ case " ":
312
+ n += "t";
313
+ break;
314
+ case "\r":
315
+ n += "r";
316
+ break;
317
+ case "\x07":
318
+ n += "a";
319
+ break;
320
+ case "\v":
321
+ n += "v";
322
+ break;
323
+ case "\b":
324
+ n += "b";
325
+ break;
326
+ case "\f":
327
+ n += "f";
328
+ break;
329
+ default: for (_ = encodeURIComponent(o), (g = v.exec(_)) !== null && (n += y(parseInt(g[1], 16).toString(8), 3)); (g = v.exec(_)) !== null;) n += "\\" + y(parseInt(g[1], 16).toString(8), 3);
330
+ }
331
+ else n += o;
332
+ else n += o;
333
+ return n;
334
+ }
335
+ class _ {
336
+ constructor(e = {}, n = {}) {
337
+ t(this, "compile", (e) => {
338
+ for (let t of Object.values(this.nodes)) t.compile(e);
339
+ }), t(this, "evaluate", (e, t) => {
340
+ let n = [];
341
+ for (let r of Object.values(this.nodes)) n.push(r.evaluate(e, t));
342
+ return n;
343
+ }), t(this, "toArray", () => {
344
+ throw Error(`Dumping a "${this.name}" instance is not supported yet.`);
345
+ }), t(this, "dump", () => {
346
+ let e = "";
347
+ for (let t of this.toArray()) e += h(t) ? t : t.dump();
348
+ return e;
349
+ }), t(this, "dumpString", (e) => `"${g(e, "\0 \"\\")}"`), t(this, "isHash", (e) => {
350
+ let t = 0;
351
+ for (let n of Object.keys(e)) if (n = parseInt(n), n !== t++) return !0;
352
+ return !1;
353
+ }), this.name = "Node", this.nodes = e, this.attributes = n;
354
+ }
355
+ toString() {
356
+ let e = [];
357
+ for (let t of Object.keys(this.attributes)) {
358
+ let n = "null";
359
+ this.attributes[t] && (n = this.attributes[t].toString()), e.push(`${t}: '${n}'`);
360
+ }
361
+ let t = [this.name + "(" + e.join(", ")];
362
+ if (this.nodes.length > 0) {
363
+ for (let e of Object.values(this.nodes)) {
364
+ let n = e.toString().split("\n");
365
+ for (let e of n) t.push(" " + e);
366
+ }
367
+ t.push(")");
368
+ } else t[0] += ")";
369
+ return t.join("\n");
370
+ }
371
+ }
372
+ class v extends _ {
373
+ constructor(e, n, r) {
374
+ super({
375
+ left: n,
376
+ right: r
377
+ }, { operator: e }), t(this, "compile", (e) => {
378
+ let t = this.attributes.operator;
379
+ t === "matches" ? e.compile(this.nodes.right).raw(".test(").compile(this.nodes.left).raw(")") : t === "contains" ? e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().includes(").compile(this.nodes.right).raw(".toString().toLowerCase())") : t === "starts with" ? e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().startsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())") : t === "ends with" ? e.raw("(").compile(this.nodes.left).raw(".toString().toLowerCase().endsWith(").compile(this.nodes.right).raw(".toString().toLowerCase())") : v.functions[t] === void 0 ? (v.operators[t] !== void 0 && (t = v.operators[t]), e.raw("(").compile(this.nodes.left).raw(" ").raw(t).raw(" ").compile(this.nodes.right).raw(")")) : e.raw(`${v.functions[t]}(`).compile(this.nodes.left).raw(", ").compile(this.nodes.right).raw(")");
380
+ }), t(this, "evaluate", (e, t) => {
381
+ let n = this.attributes.operator, r = this.nodes.left.evaluate(e, t);
382
+ if (v.functions[n] !== void 0) {
383
+ let i = this.nodes.right.evaluate(e, t);
384
+ switch (n) {
385
+ case "not in": return i.indexOf(r) === -1;
386
+ case "in": return i.indexOf(r) >= 0;
387
+ case "..": return function(e, t) {
388
+ let n = [];
389
+ for (let r = e; r <= t; r++) n.push(r);
390
+ return n;
391
+ }(r, i);
392
+ case "**": return r ** +i;
393
+ }
394
+ }
395
+ let i = null;
396
+ switch (n) {
397
+ case "or":
398
+ case "||": return r || (i = this.nodes.right.evaluate(e, t)), r || i;
399
+ case "and":
400
+ case "&&": return r && (i = this.nodes.right.evaluate(e, t)), r && i;
401
+ case "xor": return i = this.nodes.right.evaluate(e, t), i && !r || r && !i;
402
+ case "<<": return i = this.nodes.right.evaluate(e, t), r << i;
403
+ case ">>": return i = this.nodes.right.evaluate(e, t), r >> i;
404
+ }
405
+ switch (i = this.nodes.right.evaluate(e, t), n) {
406
+ case "|": return r | i;
407
+ case "^": return r ^ i;
408
+ case "&": return r & i;
409
+ case "==": return r == i;
410
+ case "===": return r === i;
411
+ case "!=": return r != i;
412
+ case "!==": return r !== i;
413
+ case "<": return r < i;
414
+ case ">": return r > i;
415
+ case ">=": return r >= i;
416
+ case "<=": return r <= i;
417
+ case "not in": return i.indexOf(r) === -1;
418
+ case "in": return i.indexOf(r) >= 0;
419
+ case "+": return r + i;
420
+ case "-": return r - i;
421
+ case "~": return r.toString() + i.toString();
422
+ case "*": return r * i;
423
+ case "/": return r / i;
424
+ case "%": return r % i;
425
+ case "matches":
426
+ if (r == null) return !1;
427
+ let e = i.match(v.regex_expression);
428
+ return new RegExp(e[1], e[2]).test(r);
429
+ case "contains": return r.toString().toLowerCase().includes(i.toString().toLowerCase());
430
+ case "starts with": return r.toString().toLowerCase().startsWith(i.toString().toLowerCase());
431
+ case "ends with": return r.toString().toLowerCase().endsWith(i.toString().toLowerCase());
432
+ }
433
+ }), t(this, "toArray", () => [
434
+ "(",
435
+ this.nodes.left,
436
+ " " + this.attributes.operator + " ",
437
+ this.nodes.right,
438
+ ")"
439
+ ]), this.name = "BinaryNode";
440
+ }
441
+ }
442
+ t(v, "regex_expression", /\/(.+)\/(.*)/), t(v, "operators", {
443
+ "~": ".",
444
+ and: "&&",
445
+ or: "||",
446
+ xor: "xor",
447
+ "<<": "<<",
448
+ ">>": ">>"
449
+ }), t(v, "functions", {
450
+ "**": "Math.pow",
451
+ "..": "range",
452
+ in: "includes",
453
+ "not in": "!includes"
454
+ });
455
+ class y extends _ {
456
+ constructor(e, n) {
457
+ super({ node: n }, { operator: e }), t(this, "compile", (e) => {
458
+ e.raw("(").raw(y.operators[this.attributes.operator]).compile(this.nodes.node).raw(")");
459
+ }), t(this, "evaluate", (e, t) => {
460
+ let n = this.nodes.node.evaluate(e, t);
461
+ switch (this.attributes.operator) {
462
+ case "not":
463
+ case "!": return !n;
464
+ case "-": return -n;
465
+ case "~": return ~n;
466
+ }
467
+ return n;
468
+ }), t(this, "toArray", () => [
469
+ "(",
470
+ this.attributes.operator + " ",
471
+ this.nodes.node,
472
+ ")"
473
+ ]), this.name = "UnaryNode";
474
+ }
475
+ }
476
+ t(y, "operators", {
477
+ "!": "!",
478
+ not: "!",
479
+ "+": "+",
480
+ "-": "-",
481
+ "~": "~"
482
+ });
483
+ class b extends _ {
484
+ constructor(e, n = !1, r = !1) {
485
+ super({}, { value: e }), t(this, "compile", (e) => {
486
+ e.repr(this.attributes.value, this.isIdentifier);
487
+ }), t(this, "evaluate", (e, t) => this.attributes.value), t(this, "toArray", () => {
488
+ let e = [], t = this.attributes.value;
489
+ if (this.isIdentifier) e.push(t);
490
+ else if (!0 === t) e.push("true");
491
+ else if (!1 === t) e.push("false");
492
+ else if (t === null) e.push("null");
493
+ else if (typeof t == "number") e.push(t);
494
+ else if (typeof t == "string") e.push(this.dumpString(t));
495
+ else if (Array.isArray(t)) {
496
+ for (let n of t) e.push(","), e.push(new b(n));
497
+ e[0] = "[", e.push("]");
498
+ } else if (this.isHash(t)) {
499
+ for (let n of Object.keys(t)) e.push(", "), e.push(new b(n)), e.push(": "), e.push(new b(t[n]));
500
+ e[0] = "{", e.push("}");
501
+ }
502
+ return e;
503
+ }), this.isIdentifier = n, this.isNullSafe = r, this.name = "ConstantNode";
504
+ }
505
+ }
506
+ class x extends _ {
507
+ constructor(e, n, r) {
508
+ super({
509
+ expr1: e,
510
+ expr2: n,
511
+ expr3: r
512
+ }), t(this, "compile", (e) => {
513
+ e.raw("((").compile(this.nodes.expr1).raw(") ? (").compile(this.nodes.expr2).raw(") : (").compile(this.nodes.expr3).raw("))");
514
+ }), t(this, "evaluate", (e, t) => this.nodes.expr1.evaluate(e, t) ? this.nodes.expr2.evaluate(e, t) : this.nodes.expr3.evaluate(e, t)), t(this, "toArray", () => [
515
+ "(",
516
+ this.nodes.expr1,
517
+ " ? ",
518
+ this.nodes.expr2,
519
+ " : ",
520
+ this.nodes.expr3,
521
+ ")"
522
+ ]), this.name = "ConditionalNode";
523
+ }
524
+ }
525
+ class S extends _ {
526
+ constructor(e, n) {
527
+ super({ fnArguments: n }, { name: e }), t(this, "compile", (e) => {
528
+ let t = [];
529
+ for (let n of Object.values(this.nodes.fnArguments.nodes)) t.push(e.subcompile(n));
530
+ let n = e.getFunction(this.attributes.name);
531
+ e.raw(n.compiler.apply(null, t));
532
+ }), t(this, "evaluate", (e, t) => {
533
+ let n = [t];
534
+ for (let r of Object.values(this.nodes.fnArguments.nodes)) n.push(r.evaluate(e, t));
535
+ return e[this.attributes.name].evaluator.apply(null, n);
536
+ }), t(this, "toArray", () => {
537
+ let e = [];
538
+ e.push(this.attributes.name);
539
+ for (let t of Object.values(this.nodes.fnArguments.nodes)) e.push(", "), e.push(t);
540
+ return e[1] = "(", e.push(")"), e;
541
+ }), this.name = "FunctionNode";
542
+ }
543
+ }
544
+ class C extends _ {
545
+ constructor(e) {
546
+ super({}, { name: e }), t(this, "compile", (e) => {
547
+ e.raw(this.attributes.name);
548
+ }), t(this, "evaluate", (e, t) => t[this.attributes.name]), t(this, "toArray", () => [this.attributes.name]), this.name = "NameNode";
549
+ }
550
+ }
551
+ class w extends _ {
552
+ constructor() {
553
+ super(), t(this, "addElement", (e, t = null) => {
554
+ t === null ? t = new b(++this.index) : this.type === "Array" && (this.type = "Object"), this.nodes[(++this.keyIndex).toString()] = t, this.nodes[(++this.keyIndex).toString()] = e;
555
+ }), t(this, "compile", (e) => {
556
+ this.type === "Object" ? e.raw("{") : e.raw("["), this.compileArguments(e, this.type !== "Array"), this.type === "Object" ? e.raw("}") : e.raw("]");
557
+ }), t(this, "evaluate", (e, t) => {
558
+ let n;
559
+ if (this.type === "Array") {
560
+ n = [];
561
+ for (let r of this.getKeyValuePairs()) n.push(r.value.evaluate(e, t));
562
+ } else {
563
+ n = {};
564
+ for (let r of this.getKeyValuePairs()) n[r.key.evaluate(e, t)] = r.value.evaluate(e, t);
565
+ }
566
+ return n;
567
+ }), t(this, "toArray", () => {
568
+ let e = {};
569
+ for (let t of this.getKeyValuePairs()) e[t.key.attributes.value] = t.value;
570
+ let t = [];
571
+ if (this.isHash(e)) {
572
+ for (let n of Object.keys(e)) t.push(", "), t.push(new b(n)), t.push(": "), t.push(e[n]);
573
+ t[0] = "{", t.push("}");
574
+ } else {
575
+ for (let n of Object.values(e)) t.push(", "), t.push(n);
576
+ t[0] = "[", t.push("]");
577
+ }
578
+ return t;
579
+ }), t(this, "getKeyValuePairs", () => {
580
+ let e, t, n, r = [], i = Object.values(this.nodes);
581
+ for (e = 0, t = i.length; e < t; e += 2) n = i.slice(e, e + 2), r.push({
582
+ key: n[0],
583
+ value: n[1]
584
+ });
585
+ return r;
586
+ }), t(this, "compileArguments", (e, t = !0) => {
587
+ let n = !0;
588
+ for (let r of this.getKeyValuePairs()) n || e.raw(", "), n = !1, t && e.compile(r.key).raw(": "), e.compile(r.value);
589
+ }), this.name = "ArrayNode", this.type = "Array", this.index = -1, this.keyIndex = -1;
590
+ }
591
+ }
592
+ class T extends w {
593
+ constructor() {
594
+ super(), t(this, "compile", (e) => {
595
+ this.compileArguments(e, !1);
596
+ }), t(this, "toArray", () => {
597
+ let e = [];
598
+ for (let t of this.getKeyValuePairs()) e.push(t.value), e.push(", ");
599
+ return e.pop(), e;
600
+ }), this.name = "ArgumentsNode";
601
+ }
602
+ }
603
+ class E extends _ {
604
+ constructor(e, n, r, i) {
605
+ super({
606
+ node: e,
607
+ attribute: n,
608
+ fnArguments: r
609
+ }, {
610
+ type: i,
611
+ is_null_coalesce: !1,
612
+ is_short_circuited: !1
613
+ }), t(this, "compile", (e) => {
614
+ let t = this.nodes.attribute instanceof b && this.nodes.attribute.isNullSafe;
615
+ switch (this.attributes.type) {
616
+ case E.PROPERTY_CALL:
617
+ e.compile(this.nodes.node).raw(t ? "?." : ".").raw(this.nodes.attribute.attributes.value);
618
+ break;
619
+ case E.METHOD_CALL:
620
+ e.compile(this.nodes.node).raw(t ? "?." : ".").raw(this.nodes.attribute.attributes.value).raw("(").compile(this.nodes.fnArguments).raw(")");
621
+ break;
622
+ case E.ARRAY_CALL: e.compile(this.nodes.node).raw("[").compile(this.nodes.attribute).raw("]");
623
+ }
624
+ }), t(this, "evaluate", (e, t) => {
625
+ switch (this.attributes.type) {
626
+ case E.PROPERTY_CALL:
627
+ let n = this.nodes.node.evaluate(e, t);
628
+ if (n === null && (this.nodes.attribute.isNullSafe || this.attributes.is_null_coalesce)) return this.attributes.is_short_circuited = !0, null;
629
+ if (n === null && this.isShortCircuited()) return null;
630
+ if (typeof n != "object") throw Error(`Unable to get property "${r}" on a non-object: ` + typeof n);
631
+ let r = this.nodes.attribute.attributes.value;
632
+ return this.attributes.is_null_coalesce ? n[r] ?? null : n[r];
633
+ case E.METHOD_CALL:
634
+ let i = this.nodes.node.evaluate(e, t);
635
+ if (i === null && this.nodes.attribute.isNullSafe) return this.attributes.is_short_circuited = !0, null;
636
+ if (i === null && this.isShortCircuited()) return null;
637
+ let a = this.nodes.attribute.attributes.value;
638
+ if (typeof i != "object") throw Error(`Unable to call method "${a}" on a non-object: ` + typeof i);
639
+ if (i[a] === void 0) throw Error(`Method "${a}" is undefined on object.`);
640
+ if (typeof i[a] != "function") throw Error(`Method "${a}" is not a function on object.`);
641
+ let o = this.nodes.fnArguments.evaluate(e, t);
642
+ return i[a].apply(null, o);
643
+ case E.ARRAY_CALL:
644
+ let s = this.nodes.node.evaluate(e, t);
645
+ if (s === null && this.isShortCircuited()) return null;
646
+ if (!(Array.isArray(s) || typeof s == "object" || s === null && this.attributes.is_null_coalesce)) throw Error("Unable to get an item on a non-array: " + typeof s);
647
+ return this.attributes.is_null_coalesce ? s ? s[this.nodes.attribute.evaluate(e, t)] ?? null : null : s[this.nodes.attribute.evaluate(e, t)];
648
+ }
649
+ }), t(this, "toArray", () => {
650
+ let e = this.nodes.attribute instanceof b && this.nodes.attribute.isNullSafe;
651
+ switch (this.attributes.type) {
652
+ case E.PROPERTY_CALL: return [
653
+ this.nodes.node,
654
+ e ? "?." : ".",
655
+ this.nodes.attribute
656
+ ];
657
+ case E.METHOD_CALL: return [
658
+ this.nodes.node,
659
+ e ? "?." : ".",
660
+ this.nodes.attribute,
661
+ "(",
662
+ this.nodes.fnArguments,
663
+ ")"
664
+ ];
665
+ case E.ARRAY_CALL: return [
666
+ this.nodes.node,
667
+ "[",
668
+ this.nodes.attribute,
669
+ "]"
670
+ ];
671
+ }
672
+ }), this.name = "GetAttrNode";
673
+ }
674
+ isShortCircuited() {
675
+ return this.attributes.is_short_circuited || this.nodes.node instanceof E && this.nodes.node.isShortCircuited();
676
+ }
677
+ }
678
+ t(E, "PROPERTY_CALL", 1), t(E, "METHOD_CALL", 2), t(E, "ARRAY_CALL", 3);
679
+ class D extends _ {
680
+ constructor(e, n) {
681
+ super({
682
+ expr1: e,
683
+ expr2: n
684
+ }), t(this, "compile", (e) => {
685
+ e.raw("((").compile(this.nodes.expr1).raw(") ?? (").compile(this.nodes.expr2).raw("))");
686
+ }), t(this, "evaluate", (e, t) => (this.nodes.expr1 instanceof E && this._addNullCoalesceAttributeToGetAttrNodes(this.nodes.expr1), this.nodes.expr1.evaluate(e, t) ?? this.nodes.expr2.evaluate(e, t))), t(this, "toArray", () => [
687
+ "(",
688
+ this.nodes.expr1,
689
+ ") ?? (",
690
+ this.nodes.expr2,
691
+ ")"
692
+ ]), t(this, "_addNullCoalesceAttributeToGetAttrNodes", (e) => {
693
+ if (!(!e instanceof E)) {
694
+ e.attributes.is_null_coalesce = !0;
695
+ for (let t of Object.values(e.nodes)) this._addNullCoalesceAttributeToGetAttrNodes(t);
696
+ }
697
+ }), this.name = "NullCoalesceNode";
698
+ }
699
+ }
700
+ class O extends _ {
701
+ constructor(e) {
702
+ super({}, { name: e }), t(this, "compile", (e) => {
703
+ e.raw(this.attributes.name + " ?? null");
704
+ }), t(this, "evaluate", (e, t) => null), t(this, "toArray", () => [this.attributes.name + " ?? null"]), this.name = "NullCoalescedNameNode";
705
+ }
706
+ }
707
+ class k {
708
+ constructor(e = {}) {
709
+ t(this, "functions", {}), t(this, "unaryOperators", {
710
+ not: { precedence: 50 },
711
+ "!": { precedence: 50 },
712
+ "-": { precedence: 500 },
713
+ "+": { precedence: 500 },
714
+ "~": { precedence: 500 }
715
+ }), t(this, "binaryOperators", {
716
+ or: {
717
+ precedence: 10,
718
+ associativity: 1
719
+ },
720
+ "||": {
721
+ precedence: 10,
722
+ associativity: 1
723
+ },
724
+ xor: {
725
+ precedence: 12,
726
+ associativity: 1
727
+ },
728
+ and: {
729
+ precedence: 15,
730
+ associativity: 1
731
+ },
732
+ "&&": {
733
+ precedence: 15,
734
+ associativity: 1
735
+ },
736
+ "|": {
737
+ precedence: 16,
738
+ associativity: 1
739
+ },
740
+ "^": {
741
+ precedence: 17,
742
+ associativity: 1
743
+ },
744
+ "&": {
745
+ precedence: 18,
746
+ associativity: 1
747
+ },
748
+ "==": {
749
+ precedence: 20,
750
+ associativity: 1
751
+ },
752
+ "===": {
753
+ precedence: 20,
754
+ associativity: 1
755
+ },
756
+ "!=": {
757
+ precedence: 20,
758
+ associativity: 1
759
+ },
760
+ "!==": {
761
+ precedence: 20,
762
+ associativity: 1
763
+ },
764
+ "<": {
765
+ precedence: 20,
766
+ associativity: 1
767
+ },
768
+ ">": {
769
+ precedence: 20,
770
+ associativity: 1
771
+ },
772
+ ">=": {
773
+ precedence: 20,
774
+ associativity: 1
775
+ },
776
+ "<=": {
777
+ precedence: 20,
778
+ associativity: 1
779
+ },
780
+ "not in": {
781
+ precedence: 20,
782
+ associativity: 1
783
+ },
784
+ in: {
785
+ precedence: 20,
786
+ associativity: 1
787
+ },
788
+ matches: {
789
+ precedence: 20,
790
+ associativity: 1
791
+ },
792
+ contains: {
793
+ precedence: 20,
794
+ associativity: 1
795
+ },
796
+ "starts with": {
797
+ precedence: 20,
798
+ associativity: 1
799
+ },
800
+ "ends with": {
801
+ precedence: 20,
802
+ associativity: 1
803
+ },
804
+ "..": {
805
+ precedence: 25,
806
+ associativity: 1
807
+ },
808
+ "<<": {
809
+ precedence: 25,
810
+ associativity: 1
811
+ },
812
+ ">>": {
813
+ precedence: 25,
814
+ associativity: 1
815
+ },
816
+ "+": {
817
+ precedence: 30,
818
+ associativity: 1
819
+ },
820
+ "-": {
821
+ precedence: 30,
822
+ associativity: 1
823
+ },
824
+ "~": {
825
+ precedence: 40,
826
+ associativity: 1
827
+ },
828
+ "*": {
829
+ precedence: 60,
830
+ associativity: 1
831
+ },
832
+ "/": {
833
+ precedence: 60,
834
+ associativity: 1
835
+ },
836
+ "%": {
837
+ precedence: 60,
838
+ associativity: 1
839
+ },
840
+ "**": {
841
+ precedence: 200,
842
+ associativity: 2
843
+ }
844
+ }), t(this, "parse", (e, t = [], n = 0) => {
845
+ this.tokenStream = e, this.names = t, this.objectMatches = {}, this.cachedNames = null, this.nestedExecutions = 0, this.flags = n;
846
+ let i = this.parseExpression();
847
+ if (!this.tokenStream.isEOF()) throw new r(`Unexpected token "${this.tokenStream.current.type}" of value "${this.tokenStream.current.value}"`, this.tokenStream.current.cursor, this.tokenStream.expression);
848
+ return i;
849
+ }), t(this, "lint", (e, t = [], n = 0) => {
850
+ t === null && (console.log("Deprecated: passing \"null\" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument"), n |= 1, t = []), this.parse(e, t, n);
851
+ }), t(this, "parseExpression", (e = 0) => {
852
+ let t = this.getPrimary(), n = this.tokenStream.current;
853
+ if (this.nestedExecutions++, this.nestedExecutions > 1e3) throw Error("Way to many executions on '" + n.toString() + "' of '" + this.tokenStream.toString() + "'");
854
+ for (; n.test(a.OPERATOR_TYPE) && this.binaryOperators[n.value] !== void 0 && this.binaryOperators[n.value] !== null && this.binaryOperators[n.value].precedence >= e;) {
855
+ let e = this.binaryOperators[n.value];
856
+ this.tokenStream.next();
857
+ let r = this.parseExpression(e.associativity === 1 ? e.precedence + 1 : e.precedence);
858
+ t = new v(n.value, t, r), n = this.tokenStream.current;
859
+ }
860
+ return e === 0 ? this.parseConditionalExpression(t) : t;
861
+ }), t(this, "getPrimary", () => {
862
+ let e = this.tokenStream.current;
863
+ if (e.test(a.OPERATOR_TYPE) && this.unaryOperators[e.value] !== void 0 && this.unaryOperators[e.value] !== null) {
864
+ let t = this.unaryOperators[e.value];
865
+ this.tokenStream.next();
866
+ let n = this.parseExpression(t.precedence);
867
+ return this.parsePostfixExpression(new y(e.value, n));
868
+ }
869
+ if (e.test(a.PUNCTUATION_TYPE, "(")) {
870
+ this.tokenStream.next();
871
+ let e = this.parseExpression();
872
+ return this.tokenStream.expect(a.PUNCTUATION_TYPE, ")", "An opened parenthesis is not properly closed"), this.parsePostfixExpression(e);
873
+ }
874
+ return this.parsePrimaryExpression();
875
+ }), t(this, "hasVariable", (e) => this.getNames().indexOf(e) >= 0), t(this, "getNames", () => {
876
+ if (this.cachedNames !== null) return this.cachedNames;
877
+ if (this.names && this.names.length > 0) {
878
+ let e = [], t = 0;
879
+ this.objectMatches = {};
880
+ for (let n of this.names) typeof n == "object" ? (this.objectMatches[Object.values(n)[0]] = t, e.push(Object.keys(n)[0]), e.push(Object.values(n)[0])) : e.push(n), t++;
881
+ return this.cachedNames = e, e;
882
+ }
883
+ return [];
884
+ }), t(this, "parseArrayExpression", () => {
885
+ this.tokenStream.expect(a.PUNCTUATION_TYPE, "[", "An array element was expected");
886
+ let e = new w(), t = !0;
887
+ for (; !this.tokenStream.current.test(a.PUNCTUATION_TYPE, "]") && (t || (this.tokenStream.expect(a.PUNCTUATION_TYPE, ",", "An array element must be followed by a comma"), !this.tokenStream.current.test(a.PUNCTUATION_TYPE, "]")));) t = !1, e.addElement(this.parseExpression());
888
+ return this.tokenStream.expect(a.PUNCTUATION_TYPE, "]", "An opened array is not properly closed"), e;
889
+ }), t(this, "parseHashExpression", () => {
890
+ this.tokenStream.expect(a.PUNCTUATION_TYPE, "{", "A hash element was expected");
891
+ let e = new w(), t = !0;
892
+ for (; !this.tokenStream.current.test(a.PUNCTUATION_TYPE, "}") && (t || (this.tokenStream.expect(a.PUNCTUATION_TYPE, ",", "A hash value must be followed by a comma"), !this.tokenStream.current.test(a.PUNCTUATION_TYPE, "}")));) {
893
+ t = !1;
894
+ let n = null;
895
+ if (this.tokenStream.current.test(a.STRING_TYPE) || this.tokenStream.current.test(a.NAME_TYPE) || this.tokenStream.current.test(a.NUMBER_TYPE)) n = new b(this.tokenStream.current.value), this.tokenStream.next();
896
+ else {
897
+ if (!this.tokenStream.current.test(a.PUNCTUATION_TYPE, "(")) {
898
+ let e = this.tokenStream.current;
899
+ throw new r(`A hash key must be a quoted string, a number, a name, or an expression enclosed in parentheses (unexpected token "${e.type}" of value "${e.value}"`, e.cursor, this.tokenStream.expression);
900
+ }
901
+ n = this.parseExpression();
902
+ }
903
+ this.tokenStream.expect(a.PUNCTUATION_TYPE, ":", "A hash key must be followed by a colon (:)");
904
+ let i = this.parseExpression();
905
+ e.addElement(i, n);
906
+ }
907
+ return this.tokenStream.expect(a.PUNCTUATION_TYPE, "}", "An opened hash is not properly closed"), e;
908
+ }), t(this, "parsePostfixExpression", (e) => {
909
+ let t = this.tokenStream.current;
910
+ for (; a.PUNCTUATION_TYPE === t.type;) {
911
+ if (t.value === "." || t.value === "?.") {
912
+ let n = t.value === "?.";
913
+ if (this.tokenStream.next(), t = this.tokenStream.current, this.tokenStream.next(), a.NAME_TYPE !== t.type && (a.OPERATOR_TYPE !== t.type || !/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/.test(t.value))) throw new r("Expected name", t.cursor, this.tokenStream.expression);
914
+ let i = new b(t.value, !0, n), o = new T(), s = null;
915
+ if (this.tokenStream.current.test(a.PUNCTUATION_TYPE, "(")) {
916
+ s = E.METHOD_CALL;
917
+ for (let e of Object.values(this.parseArguments().nodes)) o.addElement(e);
918
+ } else s = E.PROPERTY_CALL;
919
+ e = new E(e, i, o, s);
920
+ } else {
921
+ if (t.value !== "[") break;
922
+ {
923
+ this.tokenStream.next();
924
+ let t = this.parseExpression();
925
+ this.tokenStream.expect(a.PUNCTUATION_TYPE, "]"), e = new E(e, t, new T(), E.ARRAY_CALL);
926
+ }
927
+ }
928
+ t = this.tokenStream.current;
929
+ }
930
+ return e;
931
+ }), t(this, "parseArguments", () => {
932
+ let e = [];
933
+ for (this.tokenStream.expect(a.PUNCTUATION_TYPE, "(", "A list of arguments must begin with an opening parenthesis"); !this.tokenStream.current.test(a.PUNCTUATION_TYPE, ")");) e.length !== 0 && this.tokenStream.expect(a.PUNCTUATION_TYPE, ",", "Arguments must be separated by a comma"), e.push(this.parseExpression());
934
+ return this.tokenStream.expect(a.PUNCTUATION_TYPE, ")", "A list of arguments must be closed by a parenthesis"), new _(e);
935
+ }), this.functions = e, this.tokenStream = null, this.names = null, this.objectMatches = {}, this.cachedNames = null, this.nestedExecutions = 0, this.flags = 0;
936
+ }
937
+ parseConditionalExpression(e) {
938
+ for (; this.tokenStream.current.test(a.PUNCTUATION_TYPE, "??");) {
939
+ this.tokenStream.next();
940
+ let t = this.parseExpression();
941
+ e = new D(e, t);
942
+ }
943
+ for (; this.tokenStream.current.test(a.PUNCTUATION_TYPE, "?");) {
944
+ let t, n;
945
+ this.tokenStream.next(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), t = e, n = this.parseExpression()) : (t = this.parseExpression(), this.tokenStream.current.test(a.PUNCTUATION_TYPE, ":") ? (this.tokenStream.next(), n = this.parseExpression()) : t instanceof b && typeof t.attributes?.value == "string" ? n = new b("") : t instanceof x ? (n = t.nodes.expr3, t = t.nodes.expr2) : (n = t, t = e)), e = new x(e, t, n);
946
+ }
947
+ return e;
948
+ }
949
+ parsePrimaryExpression() {
950
+ let e = this.tokenStream.current, t = null;
951
+ switch (e.type) {
952
+ case a.NAME_TYPE:
953
+ switch (this.tokenStream.next(), e.value) {
954
+ case "true":
955
+ case "TRUE": return new b(!0);
956
+ case "false":
957
+ case "FALSE": return new b(!1);
958
+ case "null":
959
+ case "NULL": return new b(null);
960
+ default: if (this.tokenStream.current.value === "(") {
961
+ if (this.functions[e.value] === void 0 && !(2 & this.flags)) throw new r(`The function "${e.value}" does not exist`, e.cursor, this.tokenStream.expression, e.values, Object.keys(this.functions));
962
+ t = new S(e.value, this.parseArguments());
963
+ } else {
964
+ let n = null;
965
+ if (1 & this.flags) n = e.value;
966
+ else {
967
+ if (!this.hasVariable(e.value)) {
968
+ if (this.tokenStream.current.test(a.PUNCTUATION_TYPE, "??")) return new O(e.value);
969
+ throw new r(`Variable "${e.value}" is not valid`, e.cursor, this.tokenStream.expression, e.value, this.getNames());
970
+ }
971
+ n = e.value, this.objectMatches[n] !== void 0 && (n = this.getNames()[this.objectMatches[n]]);
972
+ }
973
+ t = new C(n);
974
+ }
975
+ }
976
+ break;
977
+ case a.NUMBER_TYPE:
978
+ case a.STRING_TYPE: return this.tokenStream.next(), new b(e.value);
979
+ default: if (e.test(a.PUNCTUATION_TYPE, "[")) t = this.parseArrayExpression();
980
+ else {
981
+ if (!e.test(a.PUNCTUATION_TYPE, "{")) throw new r(`Unexpected token "${e.type}" of value "${e.value}"`, e.cursor, this.tokenStream.expression);
982
+ t = this.parseHashExpression();
983
+ }
984
+ }
985
+ return this.parsePostfixExpression(t);
986
+ }
987
+ }
988
+ class A {
989
+ constructor(e) {
990
+ t(this, "getFunction", (e) => this.functions[e]), t(this, "getSource", () => this.source), t(this, "reset", () => (this.source = "", this)), t(this, "compile", (e) => (e.compile(this), this)), t(this, "subcompile", (e) => {
991
+ let t = this.source;
992
+ this.source = "", e.compile(this);
993
+ let n = this.source;
994
+ return this.source = t, n;
995
+ }), t(this, "raw", (e) => (this.source += e, this)), t(this, "string", (e) => (this.source += "\"" + g(e, "\0 \"$\\") + "\"", this)), t(this, "repr", (e, t = !1) => {
996
+ if (t) this.raw(e);
997
+ else if (Number.isInteger(e) || +e === e && (!isFinite(e) || e % 1)) this.raw(e);
998
+ else if (e === null) this.raw("null");
999
+ else if (typeof e == "boolean") this.raw(e ? "true" : "false");
1000
+ else if (typeof e == "object") {
1001
+ this.raw("{");
1002
+ let t = !0;
1003
+ for (let n of Object.keys(e)) t || this.raw(", "), t = !1, this.repr(n), this.raw(":"), this.repr(e[n]);
1004
+ this.raw("}");
1005
+ } else if (Array.isArray(e)) {
1006
+ this.raw("[");
1007
+ let t = !0;
1008
+ for (let n of e) t || this.raw(", "), t = !1, this.repr(n);
1009
+ this.raw("]");
1010
+ } else this.string(e);
1011
+ return this;
1012
+ }), this.source = "", this.functions = e;
1013
+ }
1014
+ }
1015
+ class j {
1016
+ constructor(e) {
1017
+ this.expression = e;
1018
+ }
1019
+ toString() {
1020
+ return this.expression;
1021
+ }
1022
+ }
1023
+ class M extends j {
1024
+ constructor(e, n) {
1025
+ super(e), t(this, "getNodes", () => this.nodes), this.nodes = n;
1026
+ }
1027
+ static fromJSON(e) {
1028
+ let t = typeof e == "string" ? JSON.parse(e) : e, n = (e) => {
1029
+ if (e == null || e instanceof _ || typeof e != "object" || !e.name) return e;
1030
+ switch (e.name) {
1031
+ case "ConstantNode": return new b(e.attributes?.value, !!e.isIdentifier, !!e.isNullSafe);
1032
+ case "NameNode": return new C(e.attributes?.name);
1033
+ case "NullCoalescedNameNode": return new O(e.attributes?.name);
1034
+ case "UnaryNode": return new y(e.attributes?.operator, n(e.nodes?.node));
1035
+ case "BinaryNode": return new v(e.attributes?.operator, n(e.nodes?.left), n(e.nodes?.right));
1036
+ case "ConditionalNode": return new x(n(e.nodes?.expr1), n(e.nodes?.expr2), n(e.nodes?.expr3));
1037
+ case "NullCoalesceNode": return new D(n(e.nodes?.expr1), n(e.nodes?.expr2));
1038
+ case "ArgumentsNode": {
1039
+ let t = new T();
1040
+ typeof e.type == "string" && (t.type = e.type), typeof e.index == "number" && (t.index = e.index), typeof e.keyIndex == "number" && (t.keyIndex = e.keyIndex), t.nodes = {};
1041
+ for (let r of Object.keys(e.nodes || {})) t.nodes[r] = n(e.nodes[r]);
1042
+ return t;
1043
+ }
1044
+ case "ArrayNode": {
1045
+ let t = new w();
1046
+ typeof e.type == "string" && (t.type = e.type), typeof e.index == "number" && (t.index = e.index), typeof e.keyIndex == "number" && (t.keyIndex = e.keyIndex), t.nodes = {};
1047
+ for (let r of Object.keys(e.nodes || {})) t.nodes[r] = n(e.nodes[r]);
1048
+ return t;
1049
+ }
1050
+ case "FunctionNode": {
1051
+ let t = n(e.nodes?.arguments);
1052
+ return new S(e.attributes?.name, t);
1053
+ }
1054
+ case "GetAttrNode": {
1055
+ let t = new E(n(e.nodes?.node), n(e.nodes?.attribute), n(e.nodes?.fnArguments), e.attributes?.type);
1056
+ return e.attributes && typeof e.attributes.is_null_coalesce == "boolean" && (t.attributes.is_null_coalesce = e.attributes.is_null_coalesce), e.attributes && typeof e.attributes.is_short_circuited == "boolean" && (t.attributes.is_short_circuited = e.attributes.is_short_circuited), t;
1057
+ }
1058
+ case "Node": {
1059
+ let t = new _();
1060
+ if (Array.isArray(e.nodes)) t.nodes = e.nodes.map(n);
1061
+ else {
1062
+ t.nodes = {};
1063
+ for (let r of Object.keys(e.nodes || {})) t.nodes[r] = n(e.nodes[r]);
1064
+ }
1065
+ return t.attributes = e.attributes || {}, t;
1066
+ }
1067
+ default: {
1068
+ let t = new _();
1069
+ if (t.name = e.name, Array.isArray(e.nodes)) t.nodes = e.nodes.map(n);
1070
+ else {
1071
+ t.nodes = {};
1072
+ for (let r of Object.keys(e.nodes || {})) t.nodes[r] = n(e.nodes[r]);
1073
+ }
1074
+ return t.attributes = e.attributes || {}, t;
1075
+ }
1076
+ }
1077
+ }, r = t.expression;
1078
+ return new M(r, ((e) => {
1079
+ if (e == null) return e;
1080
+ if (e.name) return n(e);
1081
+ if (Array.isArray(e)) return e.map(n);
1082
+ if (typeof e == "object") {
1083
+ let t = {};
1084
+ for (let r of Object.keys(e)) t[r] = n(e[r]);
1085
+ return t;
1086
+ }
1087
+ return e;
1088
+ })(t.nodes));
1089
+ }
1090
+ }
1091
+ var N;
1092
+ class P {
1093
+ constructor(e = 0) {
1094
+ t(this, "createCacheItem", (e, t, n) => {
1095
+ let r = new F();
1096
+ return r.key = e, r.value = t, r.isHit = n, r.defaultLifetime = this.defaultLifetime, r;
1097
+ }), t(this, "get", (e, t, n = null, r = null) => {
1098
+ let i = this.getItem(e);
1099
+ return i.isHit || this.save(i.set(t(i, !0))), i.get();
1100
+ }), t(this, "getItem", (e) => {
1101
+ let t = this.hasItem(e), n = null;
1102
+ return t ? n = this.values[e] : this.values[e] = null, (0, this.createCacheItem)(e, n, t);
1103
+ }), t(this, "getItems", (e) => {
1104
+ for (let t of e) typeof t == "string" || this.expiries[t] || F.validateKey(t);
1105
+ return this.generateItems(e, (/* @__PURE__ */ new Date()).getTime() / 1e3, this.createCacheItem);
1106
+ }), t(this, "deleteItems", (e) => {
1107
+ for (let t of e) this.deleteItem(t);
1108
+ return !0;
1109
+ }), t(this, "save", (e) => !(!e instanceof F) && (e.expiry !== null && e.expiry <= (/* @__PURE__ */ new Date()).getTime() / 1e3 ? (this.deleteItem(e.key), !0) : (e.expiry === null && 0 < e.defaultLifetime && (e.expiry = (/* @__PURE__ */ new Date()).getTime() / 1e3 + e.defaultLifetime), this.values[e.key] = e.value, this.expiries[e.key] = e.expiry || 2 ** 53 - 1, !0))), t(this, "saveDeferred", (e) => this.save(e)), t(this, "commit", () => !0), t(this, "delete", (e) => this.deleteItem(e)), t(this, "getValues", () => this.values), t(this, "hasItem", (e) => !!(typeof e == "string" && this.expiries[e] && this.expiries[e] > (/* @__PURE__ */ new Date()).getTime() / 1e3) || (F.validateKey(e), !!this.expiries[e] && !this.deleteItem(e))), t(this, "clear", () => (this.values = {}, this.expiries = {}, !0)), t(this, "deleteItem", (e) => (typeof e == "string" && this.expiries[e] || F.validateKey(e), delete this.values[e], delete this.expiries[e], !0)), t(this, "reset", () => {
1110
+ this.clear();
1111
+ }), t(this, "generateItems", (e, t, n) => {
1112
+ let r = [];
1113
+ for (let i of e) {
1114
+ let e = null, a = !!this.expiries[i];
1115
+ a || !(this.expiries[i] > t) && this.deleteItem(i) ? e = this.values[i] : this.values[i] = null, r[i] = n(i, e, a);
1116
+ }
1117
+ return r;
1118
+ }), this.defaultLifetime = e, this.values = {}, this.expiries = {};
1119
+ }
1120
+ }
1121
+ class F {
1122
+ constructor() {
1123
+ t(this, "getKey", () => this.key), t(this, "get", () => this.value), t(this, "set", (e) => (this.value = e, this)), t(this, "expiresAt", (e) => {
1124
+ if (e === null) this.expiry = this.defaultLifetime > 0 ? Date.now() / 1e3 + this.defaultLifetime : null;
1125
+ else {
1126
+ if (!(e instanceof Date)) throw Error(`Expiration date must be instance of Date or be null, "${e.name}" given`);
1127
+ this.expiry = e.getTime() / 1e3;
1128
+ }
1129
+ return this;
1130
+ }), t(this, "expiresAfter", (e) => {
1131
+ if (e === null) this.expiry = this.defaultLifetime > 0 ? Date.now() / 1e3 + this.defaultLifetime : null;
1132
+ else {
1133
+ if (!Number.isInteger(e)) throw Error(`Expiration date must be an integer or be null, "${e.name}" given`);
1134
+ this.expiry = (/* @__PURE__ */ new Date()).getTime() / 1e3 + e;
1135
+ }
1136
+ return this;
1137
+ }), t(this, "tag", (e) => {
1138
+ if (!this.isTaggable) throw Error(`Cache item "${this.key}" comes from a non tag-aware pool: you cannot tag it.`);
1139
+ Array.isArray(e) || (e = [e]);
1140
+ for (let t of e) {
1141
+ if (typeof t != "string") throw Error(`Cache tag must by a string, "${typeof t}" given.`);
1142
+ if (this.newMetadata.tags[t] && t === "") throw Error("Cache tag length must be greater than zero");
1143
+ this.newMetadata.tags[t] = t;
1144
+ }
1145
+ return this;
1146
+ }), t(this, "getMetadata", () => this.metadata), this.key = null, this.value = null, this.isHit = !1, this.expiry = null, this.defaultLifetime = null, this.metadata = {}, this.newMetadata = {}, this.innerItem = null, this.poolHash = null, this.isTaggable = !1;
1147
+ }
1148
+ }
1149
+ N = F, t(F, "METADATA_EXPIRY_OFFSET", 1527506807), t(F, "RESERVED_CHARACTERS", [
1150
+ "{",
1151
+ "}",
1152
+ "(",
1153
+ ")",
1154
+ "/",
1155
+ "\\",
1156
+ "@",
1157
+ ":"
1158
+ ]), t(F, "validateKey", (e) => {
1159
+ if (typeof e != "string") throw Error(`Cache key must be string, "${typeof e}" given.`);
1160
+ if (e === "") throw Error("Cache key length must be greater than zero");
1161
+ for (let t of N.RESERVED_CHARACTERS) if (e.indexOf(t) >= 0) throw Error(`Cache key "${e}" contains reserved character "${t}".`);
1162
+ return e;
1163
+ });
1164
+ class ee extends Error {
1165
+ constructor(e) {
1166
+ super(e), this.name = "LogicException";
1167
+ }
1168
+ toString() {
1169
+ return `${this.name}: ${this.message}`;
1170
+ }
1171
+ }
1172
+ class I {
1173
+ constructor(e, n, r) {
1174
+ t(this, "getName", () => this.name), t(this, "getCompiler", () => this.compiler), t(this, "getEvaluator", () => this.evaluator), this.name = e, this.compiler = n, this.evaluator = r;
1175
+ }
1176
+ static fromJavascript(e, t = null) {
1177
+ if (typeof e != "string" || e.length === 0) throw TypeError("A JavaScript function name (string) must be provided.");
1178
+ let n = e.replace(/^\/+/, ""), r = n.split("."), i = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {};
1179
+ for (let e of r) {
1180
+ if (i == null) break;
1181
+ i = i[e];
1182
+ }
1183
+ if (typeof i != "function") throw Error(`JavaScript function "${n}" does not exist.`);
1184
+ if (!t && r.length > 1) throw Error(`An expression function name must be defined when JavaScript function "${n}" is namespaced.`);
1185
+ return new this(t || r[r.length - 1], (...e) => `${n}(${e.join(", ")})`, (e, ...t) => i(...t));
1186
+ }
1187
+ }
1188
+ class L {
1189
+ constructor(e = null, n = []) {
1190
+ t(this, "compile", (e, t = []) => this.getCompiler().compile(this.parse(e, t).getNodes()).getSource()), t(this, "evaluate", (e, t = {}) => this.parse(e, Object.keys(t)).getNodes().evaluate(this.functions, t)), t(this, "parse", (e, t, n = 0) => {
1191
+ if (e instanceof M) return e;
1192
+ t.sort((e, t) => {
1193
+ let n = e, r = t;
1194
+ return typeof e == "object" && (n = Object.values(e)[0]), typeof t == "object" && (r = Object.values(t)[0]), n.localeCompare(r);
1195
+ });
1196
+ let r = [];
1197
+ for (let e of t) {
1198
+ let t = e;
1199
+ typeof e == "object" && (t = Object.keys(e)[0] + ":" + Object.values(e)[0]), r.push(t);
1200
+ }
1201
+ let i = this.cache.getItem(this.fixedEncodeURIComponent(e + "//" + r.join("|"))), a = i.get();
1202
+ return a === null && (a = new M(e, this.getParser().parse(this.getLexer().tokenize(e), t, n)), i.set(a), this.cache.save(i)), a;
1203
+ }), t(this, "lint", (e, t = null, n = 0) => {
1204
+ t === null && (console.log("Deprecated: passing \"null\" as the second argument of lint is deprecated, pass IGNORE_UNKNOWN_VARIABLES instead as the third argument"), n |= 1, t = []), e instanceof M || this.getParser().lint(this.getLexer().tokenize(e), t, n);
1205
+ }), t(this, "fixedEncodeURIComponent", (e) => encodeURIComponent(e).replace(/[!'()*]/g, function(e) {
1206
+ return "%" + e.charCodeAt(0).toString(16);
1207
+ })), t(this, "register", (e, t, n) => {
1208
+ if (this.parser !== null) throw new ee("Registering functions after calling evaluate(), compile(), or parse() is not supported.");
1209
+ this.functions[e] = {
1210
+ compiler: t,
1211
+ evaluator: n
1212
+ };
1213
+ }), t(this, "addFunction", (e) => {
1214
+ this.register(e.getName(), e.getCompiler(), e.getEvaluator());
1215
+ }), t(this, "registerProvider", (e) => {
1216
+ for (let t of e.getFunctions()) this.addFunction(t);
1217
+ }), t(this, "getLexer", () => (this.lexer === null && (this.lexer = { tokenize: o }), this.lexer)), t(this, "getParser", () => (this.parser === null && (this.parser = new k(this.functions)), this.parser)), t(this, "getCompiler", () => (this.compiler === null && (this.compiler = new A(this.functions)), this.compiler.reset())), this.functions = [], this.lexer = null, this.parser = null, this.compiler = null, this.cache = e || new P(), this._registerBuiltinFunctions();
1218
+ for (let e of n) this.registerProvider(e);
1219
+ }
1220
+ _registerBuiltinFunctions() {
1221
+ let e = I.fromJavascript("Math.min", "min"), t = I.fromJavascript("Math.max", "max");
1222
+ this.addFunction(e), this.addFunction(t), this.addFunction(new I("constant", function(e) {
1223
+ return `(function(__n){var __g=(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:(typeof global!=='undefined'?global:{})));return __n.split('.').reduce(function(o,k){return o==null?undefined:o[k];}, __g)})(${e})`;
1224
+ }, function(e, t) {
1225
+ if (typeof t != "string" || !t) return;
1226
+ let n = (r = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, t.split(".").reduce((e, t) => e?.[t], r));
1227
+ var r;
1228
+ return n === void 0 && e && Object.prototype.hasOwnProperty.call(e, t) && (n = e[t]), n;
1229
+ })), this.addFunction(new I("enum", function(e) {
1230
+ return `(function(__n){var __g=(typeof globalThis!=='undefined'?globalThis:(typeof window!=='undefined'?window:(typeof global!=='undefined'?global:{})));if(typeof __n!=='string'||!__n)return undefined;var s=String(__n);var keys=[],buf='';for(var i=0;i<s.length;i++){var c=s.charCodeAt(i);if(c===46||c===92){if(buf){keys.push(buf);buf='';}continue;}if(c===58){if(i+1<s.length&&s.charCodeAt(i+1)===58){if(buf){keys.push(buf);buf='';}i++;continue;}}buf+=s[i];}if(buf)keys.push(buf);return keys.reduce(function(o,k){return o==null?undefined:o[k];}, __g)})(${e})`;
1231
+ }, function(e, t) {
1232
+ if (typeof t != "string" || !t) return;
1233
+ let n = String(t).replace(/\\/g, ".").replace(/::/g, ".");
1234
+ var r;
1235
+ return n ? (r = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : {}, n.split(".").reduce((e, t) => e?.[t], r)) : void 0;
1236
+ }));
1237
+ }
1238
+ }
1239
+ class R {
1240
+ getFunctions() {
1241
+ throw Error("getFunctions must be implemented by " + this.name);
1242
+ }
1243
+ }
1244
+ let z = new I("isset", function(e) {
1245
+ return `isset(${e})`;
1246
+ }, function(e, t) {
1247
+ if (typeof t != "string") return t != null;
1248
+ if (!(t.split(/[.\[]/)[0] in e)) return !0;
1249
+ let n = "", r = [], i = "", a = "";
1250
+ for (let e = 0; e < t.length; e++) {
1251
+ let o = t[e];
1252
+ if (o !== "]") if (o !== "[") {
1253
+ if (i === "object" && (!/[A-z0-9_]/.test(o) || e === t.length - 1)) {
1254
+ let n = !1;
1255
+ if (e === t.length - 1 && (a += o, n = !0), i = "", r.push({
1256
+ type: "object",
1257
+ attribute: a
1258
+ }), a = "", n) continue;
1259
+ }
1260
+ o === "." ? (i = "object", a = "") : i ? a += o : n += o;
1261
+ } else i = "array", a = "";
1262
+ else i = "", r.push({
1263
+ type: "array",
1264
+ index: a.replace(/"/g, "").replace(/'/g, "")
1265
+ }), a = "";
1266
+ }
1267
+ if (r.length > 0) {
1268
+ if (e[n] !== void 0) {
1269
+ let t = e[n];
1270
+ for (let e of r) {
1271
+ if (e.type === "array") {
1272
+ if (t[e.index] === void 0) return !1;
1273
+ t = t[e.index];
1274
+ }
1275
+ if (e.type === "object") {
1276
+ if (t[e.attribute] === void 0) return !1;
1277
+ t = t[e.attribute];
1278
+ }
1279
+ }
1280
+ return !0;
1281
+ }
1282
+ return !1;
1283
+ }
1284
+ return e[n] !== void 0;
1285
+ }), B = (e) => Object.entries(e);
1286
+ function V(e) {
1287
+ return typeof e == "object" && !!e;
1288
+ }
1289
+ function H(e) {
1290
+ return V(e) && !function(e) {
1291
+ return Array.isArray(e);
1292
+ }(e);
1293
+ }
1294
+ function U(e) {
1295
+ return function(e) {
1296
+ return V(e);
1297
+ }(e) ? e : {};
1298
+ }
1299
+ let W = typeof window == "object" && window !== null ? window : typeof global == "object" && global !== null ? global : {};
1300
+ function te() {
1301
+ let e = (() => {
1302
+ let e = W.$locutus;
1303
+ typeof e == "object" && e || (e = {}, W.$locutus = e);
1304
+ let t = e.php;
1305
+ return typeof t == "object" && t || (t = {}, e.php = t), t;
1306
+ })(), t = e.ini, n = e.locales, r = e.localeCategories, i = e.pointers, a = H(t) ? t : {}, o = ((e) => H(e))(n) ? n : {}, s = ((e) => H(e))(r) ? r : {}, c = Array.isArray(i) ? i : [];
1307
+ t !== a && (e.ini = a), n !== o && (e.locales = o), r !== s && (e.localeCategories = s), i !== c && (e.pointers = c);
1308
+ let l = e.locale_default;
1309
+ return {
1310
+ ini: a,
1311
+ locales: o,
1312
+ localeCategories: s,
1313
+ pointers: c,
1314
+ locale_default: typeof l == "string" ? l : void 0
1315
+ };
1316
+ }
1317
+ function G(e) {
1318
+ let t = te().ini[e];
1319
+ return t && t.local_value !== void 0 ? t.local_value === null ? "" : String(t.local_value) : "";
1320
+ }
1321
+ function ne(e, t, n) {
1322
+ let r = function(e) {
1323
+ if (typeof e == "boolean") return e ? "1" : "";
1324
+ if (typeof e == "string") return e;
1325
+ if (typeof e == "number") return isNaN(e) ? "NAN" : isFinite(e) ? e + "" : (e < 0 ? "-" : "") + "INF";
1326
+ if (e === void 0) return "";
1327
+ if (typeof e == "object") return Array.isArray(e) ? "Array" : e === null ? "" : "Object";
1328
+ throw Error("Unsupported value type");
1329
+ }(e), i = G("unicode.semantics") === "on" ? r.match(/[\uD800-\uDBFF][\uDC00-\uDFFF]|[\s\S]/g) || [] : null, a = i ? i.length : r.length, o = a;
1330
+ return t < 0 && (t += o), n !== void 0 && (o = n < 0 ? n + o : n + t), !(t > a || t < 0 || t > o) && (i ? i.slice(t, o).join("") : r.slice(t, o));
1331
+ }
1332
+ function re(e, ...t) {
1333
+ let n = {};
1334
+ if (t.length < 1) return n;
1335
+ let r = U(e);
1336
+ e: for (let [e, i] of B(r)) {
1337
+ for (let e of t) {
1338
+ let t = U(e), n = !1;
1339
+ for (let [, e] of B(t)) if (e === i) {
1340
+ n = !0;
1341
+ break;
1342
+ }
1343
+ if (!n) continue e;
1344
+ }
1345
+ n[e] = i;
1346
+ }
1347
+ return n;
1348
+ }
1349
+ let K = (e) => {
1350
+ if (!e || typeof e != "object") return !1;
1351
+ let t = Object.getPrototypeOf(e);
1352
+ return t === Array.prototype || t === Object.prototype;
1353
+ };
1354
+ function q(e, t = 0) {
1355
+ let n = 0;
1356
+ if (e == null) return 0;
1357
+ if (typeof e != "object") return 1;
1358
+ let r = Object.getPrototypeOf(e);
1359
+ if (r !== Array.prototype && r !== Object.prototype) return 1;
1360
+ let i = t === "COUNT_RECURSIVE" || t === 1;
1361
+ if (Array.isArray(e)) {
1362
+ for (let t of Object.keys(e)) {
1363
+ n++;
1364
+ let r = e[Number(t)];
1365
+ i && K(r) && (n += q(r, 1));
1366
+ }
1367
+ return n;
1368
+ }
1369
+ for (let t in e) if (Object.prototype.hasOwnProperty.call(e, t)) {
1370
+ n++;
1371
+ let r = e[t];
1372
+ i && K(r) && (n += q(r, 1));
1373
+ }
1374
+ return n;
1375
+ }
1376
+ let ie = new I("implode", function(e, t) {
1377
+ return `implode(${e}, ${t})`;
1378
+ }, function(e, t, n) {
1379
+ return function(...e) {
1380
+ let t, n = "", r = "", i = "";
1381
+ if (e.length === 1) {
1382
+ let [n] = e;
1383
+ t = n;
1384
+ } else {
1385
+ let [n, r] = e;
1386
+ i = String(n ?? ""), t = r;
1387
+ }
1388
+ if (typeof t == "object" && t) {
1389
+ if (Array.isArray(t)) return t.join(i);
1390
+ for (let e in t) n += r + t[e], r = i;
1391
+ return n;
1392
+ }
1393
+ return String(t);
1394
+ }(t, n);
1395
+ }), ae = new I("count", function(e, t) {
1396
+ let n = "";
1397
+ return t && (n = `, ${t}`), `count(${e}${n})`;
1398
+ }, function(e, t, n) {
1399
+ return q(t, n);
1400
+ }), oe = new I("array_intersect", function(e, ...t) {
1401
+ let n = "";
1402
+ return t.length > 0 && (n = ", " + t.join(", ")), `array_intersect(${e}${n})`;
1403
+ }, function(e) {
1404
+ let t = [], n = !0;
1405
+ for (let e = 1; e < arguments.length; e++) t.push(arguments[e]), Array.isArray(arguments[e]) || (n = !1);
1406
+ let r = re.apply(null, t);
1407
+ return n ? Object.values(r) : r;
1408
+ });
1409
+ function se(e, t) {
1410
+ let n, r = /* @__PURE__ */ new Date(), i = [
1411
+ "Sun",
1412
+ "Mon",
1413
+ "Tues",
1414
+ "Wednes",
1415
+ "Thurs",
1416
+ "Fri",
1417
+ "Satur",
1418
+ "January",
1419
+ "February",
1420
+ "March",
1421
+ "April",
1422
+ "May",
1423
+ "June",
1424
+ "July",
1425
+ "August",
1426
+ "September",
1427
+ "October",
1428
+ "November",
1429
+ "December"
1430
+ ], a = /\\?(.?)/gi, o = function(e, t) {
1431
+ return r = e, Object.prototype.hasOwnProperty.call(n, r) ? String(n[e]()) : t;
1432
+ var r;
1433
+ }, s = function(e, t) {
1434
+ let n = String(e);
1435
+ for (; n.length < t;) n = "0" + n;
1436
+ return n;
1437
+ };
1438
+ return n = {
1439
+ d: function() {
1440
+ return s(n.j(), 2);
1441
+ },
1442
+ D: function() {
1443
+ return String(n.l()).slice(0, 3);
1444
+ },
1445
+ j: function() {
1446
+ return r.getDate();
1447
+ },
1448
+ l: function() {
1449
+ return (i[Number(n.w())] ?? "") + "day";
1450
+ },
1451
+ N: function() {
1452
+ return Number(n.w()) || 7;
1453
+ },
1454
+ S: function() {
1455
+ let e = Number(n.j()), t = e % 10;
1456
+ return t <= 3 && Number.parseInt(String(e % 100 / 10), 10) === 1 && (t = 0), [
1457
+ "st",
1458
+ "nd",
1459
+ "rd"
1460
+ ][t - 1] || "th";
1461
+ },
1462
+ w: function() {
1463
+ return r.getDay();
1464
+ },
1465
+ z: function() {
1466
+ let e = new Date(Number(n.Y()), Number(n.n()) - 1, Number(n.j())), t = new Date(Number(n.Y()), 0, 1);
1467
+ return Math.round((e.getTime() - t.getTime()) / 864e5);
1468
+ },
1469
+ W: function() {
1470
+ let e = new Date(Number(n.Y()), Number(n.n()) - 1, Number(n.j()) - Number(n.N()) + 3), t = new Date(e.getFullYear(), 0, 4);
1471
+ return s(1 + Math.round((e.getTime() - t.getTime()) / 864e5 / 7), 2);
1472
+ },
1473
+ F: function() {
1474
+ return i[6 + Number(n.n())] ?? "";
1475
+ },
1476
+ m: function() {
1477
+ return s(n.n(), 2);
1478
+ },
1479
+ M: function() {
1480
+ return String(n.F()).slice(0, 3);
1481
+ },
1482
+ n: function() {
1483
+ return r.getMonth() + 1;
1484
+ },
1485
+ t: function() {
1486
+ return new Date(Number(n.Y()), Number(n.n()), 0).getDate();
1487
+ },
1488
+ L: function() {
1489
+ let e = Number(n.Y());
1490
+ return +(e % 4 == 0 && e % 100 != 0 || e % 400 == 0);
1491
+ },
1492
+ o: function() {
1493
+ let e = Number(n.n()), t = Number(n.W());
1494
+ return Number(n.Y()) + (e === 12 && t < 9 ? 1 : e === 1 && t > 9 ? -1 : 0);
1495
+ },
1496
+ Y: function() {
1497
+ return r.getFullYear();
1498
+ },
1499
+ y: function() {
1500
+ return String(n.Y()).slice(-2);
1501
+ },
1502
+ a: function() {
1503
+ return r.getHours() > 11 ? "pm" : "am";
1504
+ },
1505
+ A: function() {
1506
+ return String(n.a()).toUpperCase();
1507
+ },
1508
+ B: function() {
1509
+ let e = 3600 * r.getUTCHours(), t = 60 * r.getUTCMinutes(), n = r.getUTCSeconds();
1510
+ return s(Math.floor((e + t + n + 3600) / 86.4) % 1e3, 3);
1511
+ },
1512
+ g: function() {
1513
+ return Number(n.G()) % 12 || 12;
1514
+ },
1515
+ G: function() {
1516
+ return r.getHours();
1517
+ },
1518
+ h: function() {
1519
+ return s(n.g(), 2);
1520
+ },
1521
+ H: function() {
1522
+ return s(n.G(), 2);
1523
+ },
1524
+ i: function() {
1525
+ return s(r.getMinutes(), 2);
1526
+ },
1527
+ s: function() {
1528
+ return s(r.getSeconds(), 2);
1529
+ },
1530
+ u: function() {
1531
+ return s(1e3 * r.getMilliseconds(), 6);
1532
+ },
1533
+ e: function() {
1534
+ throw Error("Not supported (see source code of date() for timezone on how to add support)");
1535
+ },
1536
+ I: function() {
1537
+ let e = new Date(Number(n.Y()), 0), t = Date.UTC(Number(n.Y()), 0), r = new Date(Number(n.Y()), 6), i = Date.UTC(Number(n.Y()), 6);
1538
+ return e.getTime() - t === r.getTime() - i ? 0 : 1;
1539
+ },
1540
+ O: function() {
1541
+ let e = r.getTimezoneOffset(), t = Math.abs(e);
1542
+ return (e > 0 ? "-" : "+") + s(100 * Math.floor(t / 60) + t % 60, 4);
1543
+ },
1544
+ P: function() {
1545
+ let e = String(n.O());
1546
+ return e.slice(0, 3) + ":" + e.slice(3, 5);
1547
+ },
1548
+ T: function() {
1549
+ return "UTC";
1550
+ },
1551
+ Z: function() {
1552
+ return 60 * -r.getTimezoneOffset();
1553
+ },
1554
+ c: function() {
1555
+ return "Y-m-d\\TH:i:sP".replace(a, o);
1556
+ },
1557
+ r: function() {
1558
+ return "D, d M Y H:i:s O".replace(a, o);
1559
+ },
1560
+ U: function() {
1561
+ return r.getTime() / 1e3 | 0;
1562
+ }
1563
+ }, c = e, r = (l = t) === void 0 ? /* @__PURE__ */ new Date() : l instanceof Date ? new Date(l) : /* @__PURE__ */ new Date(1e3 * Number(l)), c.replace(a, o);
1564
+ var c, l;
1565
+ }
1566
+ function J(e, t) {
1567
+ switch (t?.toLowerCase()) {
1568
+ case "a":
1569
+ e += e === 12 ? -12 : 0;
1570
+ break;
1571
+ case "p": e += e === 12 ? 0 : 12;
1572
+ }
1573
+ return e;
1574
+ }
1575
+ function Y(e) {
1576
+ let t = +e;
1577
+ return e.length < 4 && t < 100 && (t += t < 70 ? 2e3 : 1900), t;
1578
+ }
1579
+ function X(e) {
1580
+ return {
1581
+ jan: 0,
1582
+ january: 0,
1583
+ i: 0,
1584
+ feb: 1,
1585
+ february: 1,
1586
+ ii: 1,
1587
+ mar: 2,
1588
+ march: 2,
1589
+ iii: 2,
1590
+ apr: 3,
1591
+ april: 3,
1592
+ iv: 3,
1593
+ may: 4,
1594
+ v: 4,
1595
+ jun: 5,
1596
+ june: 5,
1597
+ vi: 5,
1598
+ jul: 6,
1599
+ july: 6,
1600
+ vii: 6,
1601
+ aug: 7,
1602
+ august: 7,
1603
+ viii: 7,
1604
+ sep: 8,
1605
+ sept: 8,
1606
+ september: 8,
1607
+ ix: 8,
1608
+ oct: 9,
1609
+ october: 9,
1610
+ x: 9,
1611
+ nov: 10,
1612
+ november: 10,
1613
+ xi: 10,
1614
+ dec: 11,
1615
+ december: 11,
1616
+ xii: 11
1617
+ }[e.toLowerCase()] ?? NaN;
1618
+ }
1619
+ function Z(e, t = 0) {
1620
+ return {
1621
+ mon: 1,
1622
+ monday: 1,
1623
+ tue: 2,
1624
+ tuesday: 2,
1625
+ wed: 3,
1626
+ wednesday: 3,
1627
+ thu: 4,
1628
+ thursday: 4,
1629
+ fri: 5,
1630
+ friday: 5,
1631
+ sat: 6,
1632
+ saturday: 6,
1633
+ sun: 0,
1634
+ sunday: 0
1635
+ }[e.toLowerCase()] || t;
1636
+ }
1637
+ function Q(e, t = NaN) {
1638
+ let n = e?.match(/(?:GMT)?([+-])(\d+)(:?)(\d{0,2})/i);
1639
+ if (!n) return t;
1640
+ let r = n[1] === "-" ? -1 : 1, i = +(n[2] ?? 0), a = +(n[4] ?? 0);
1641
+ return n[4] || n[3] || (a = Math.floor(i % 100), i = Math.floor(i / 100)), r * (60 * i + a) * 60;
1642
+ }
1643
+ let ce = {
1644
+ acdt: 37800,
1645
+ acst: 34200,
1646
+ addt: -7200,
1647
+ adt: -10800,
1648
+ aedt: 39600,
1649
+ aest: 36e3,
1650
+ ahdt: -32400,
1651
+ ahst: -36e3,
1652
+ akdt: -28800,
1653
+ akst: -32400,
1654
+ amt: -13840,
1655
+ apt: -10800,
1656
+ ast: -14400,
1657
+ awdt: 32400,
1658
+ awst: 28800,
1659
+ awt: -10800,
1660
+ bdst: 7200,
1661
+ bdt: -36e3,
1662
+ bmt: -14309,
1663
+ bst: 3600,
1664
+ cast: 34200,
1665
+ cat: 7200,
1666
+ cddt: -14400,
1667
+ cdt: -18e3,
1668
+ cemt: 10800,
1669
+ cest: 7200,
1670
+ cet: 3600,
1671
+ cmt: -15408,
1672
+ cpt: -18e3,
1673
+ cst: -21600,
1674
+ cwt: -18e3,
1675
+ chst: 36e3,
1676
+ dmt: -1521,
1677
+ eat: 10800,
1678
+ eddt: -10800,
1679
+ edt: -14400,
1680
+ eest: 10800,
1681
+ eet: 7200,
1682
+ emt: -26248,
1683
+ ept: -14400,
1684
+ est: -18e3,
1685
+ ewt: -14400,
1686
+ ffmt: -14660,
1687
+ fmt: -4056,
1688
+ gdt: 39600,
1689
+ gmt: 0,
1690
+ gst: 36e3,
1691
+ hdt: -34200,
1692
+ hkst: 32400,
1693
+ hkt: 28800,
1694
+ hmt: -19776,
1695
+ hpt: -34200,
1696
+ hst: -36e3,
1697
+ hwt: -34200,
1698
+ iddt: 14400,
1699
+ idt: 10800,
1700
+ imt: 25025,
1701
+ ist: 7200,
1702
+ jdt: 36e3,
1703
+ jmt: 8440,
1704
+ jst: 32400,
1705
+ kdt: 36e3,
1706
+ kmt: 5736,
1707
+ kst: 30600,
1708
+ lst: 9394,
1709
+ mddt: -18e3,
1710
+ mdst: 16279,
1711
+ mdt: -21600,
1712
+ mest: 7200,
1713
+ met: 3600,
1714
+ mmt: 9017,
1715
+ mpt: -21600,
1716
+ msd: 14400,
1717
+ msk: 10800,
1718
+ mst: -25200,
1719
+ mwt: -21600,
1720
+ nddt: -5400,
1721
+ ndt: -9052,
1722
+ npt: -9e3,
1723
+ nst: -12600,
1724
+ nwt: -9e3,
1725
+ nzdt: 46800,
1726
+ nzmt: 41400,
1727
+ nzst: 43200,
1728
+ pddt: -21600,
1729
+ pdt: -25200,
1730
+ pkst: 21600,
1731
+ pkt: 18e3,
1732
+ plmt: 25590,
1733
+ pmt: -13236,
1734
+ ppmt: -17340,
1735
+ ppt: -25200,
1736
+ pst: -28800,
1737
+ pwt: -25200,
1738
+ qmt: -18840,
1739
+ rmt: 5794,
1740
+ sast: 7200,
1741
+ sdmt: -16800,
1742
+ sjmt: -20173,
1743
+ smt: -13884,
1744
+ sst: -39600,
1745
+ tbmt: 10751,
1746
+ tmt: 12344,
1747
+ uct: 0,
1748
+ utc: 0,
1749
+ wast: 7200,
1750
+ wat: 3600,
1751
+ wemt: 7200,
1752
+ west: 3600,
1753
+ wet: 0,
1754
+ wib: 25200,
1755
+ wita: 28800,
1756
+ wit: 32400,
1757
+ wmt: 5040,
1758
+ yddt: -25200,
1759
+ ydt: -28800,
1760
+ ypt: -28800,
1761
+ yst: -32400,
1762
+ ywt: -28800,
1763
+ a: 3600,
1764
+ b: 7200,
1765
+ c: 10800,
1766
+ d: 14400,
1767
+ e: 18e3,
1768
+ f: 21600,
1769
+ g: 25200,
1770
+ h: 28800,
1771
+ i: 32400,
1772
+ k: 36e3,
1773
+ l: 39600,
1774
+ m: 43200,
1775
+ n: -3600,
1776
+ o: -7200,
1777
+ p: -10800,
1778
+ q: -14400,
1779
+ r: -18e3,
1780
+ s: -21600,
1781
+ t: -25200,
1782
+ u: -28800,
1783
+ v: -32400,
1784
+ w: -36e3,
1785
+ x: -39600,
1786
+ y: -43200,
1787
+ z: 0
1788
+ }, $ = {
1789
+ yesterday: {
1790
+ regex: /^yesterday/i,
1791
+ name: "yesterday",
1792
+ callback() {
1793
+ return --this.rd, this.resetTime();
1794
+ }
1795
+ },
1796
+ now: {
1797
+ regex: /^now/i,
1798
+ name: "now"
1799
+ },
1800
+ noon: {
1801
+ regex: /^noon/i,
1802
+ name: "noon",
1803
+ callback() {
1804
+ return this.resetTime() && this.time(12, 0, 0, 0);
1805
+ }
1806
+ },
1807
+ midnightOrToday: {
1808
+ regex: /^(midnight|today)/i,
1809
+ name: "midnight | today",
1810
+ callback() {
1811
+ return this.resetTime();
1812
+ }
1813
+ },
1814
+ tomorrow: {
1815
+ regex: /^tomorrow/i,
1816
+ name: "tomorrow",
1817
+ callback() {
1818
+ return this.rd += 1, this.resetTime();
1819
+ }
1820
+ },
1821
+ timestamp: {
1822
+ regex: /^@(-?\d+)/i,
1823
+ name: "timestamp",
1824
+ callback(e, t) {
1825
+ return this.rs += +t, this.y = 1970, this.m = 0, this.d = 1, this.dates = 0, this.resetTime() && this.zone(0);
1826
+ }
1827
+ },
1828
+ firstOrLastDay: {
1829
+ regex: /^(first|last) day of/i,
1830
+ name: "firstdayof | lastdayof",
1831
+ callback(e, t) {
1832
+ t.toLowerCase() === "first" ? this.firstOrLastDayOfMonth = 1 : this.firstOrLastDayOfMonth = -1;
1833
+ }
1834
+ },
1835
+ backOrFrontOf: {
1836
+ regex: /* @__PURE__ */ RegExp("^(back|front) of (2[0-4]|[01]?[0-9])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))?", "i"),
1837
+ name: "backof | frontof",
1838
+ callback(e, t, n, r) {
1839
+ let i = +n, a = 15;
1840
+ return t.toLowerCase() === "back" || (--i, a = 45), i = J(i, r), this.resetTime() && this.time(i, a, 0, 0);
1841
+ }
1842
+ },
1843
+ mssqltime: {
1844
+ regex: /* @__PURE__ */ RegExp("^(0?[1-9]|1[0-2]):([0-5][0-9]):(60|[0-5][0-9])[:.]([0-9]+)(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
1845
+ name: "mssqltime",
1846
+ callback(e, t, n, r, i, a) {
1847
+ return this.time(J(+t, a), +n, +r, +i.substr(0, 3));
1848
+ }
1849
+ },
1850
+ oracledate: {
1851
+ regex: /^(\d{2})-([A-Z]{3})-(\d{2})$/i,
1852
+ name: "d-M-y",
1853
+ callback(e, t, n, r) {
1854
+ let i = {
1855
+ JAN: 0,
1856
+ FEB: 1,
1857
+ MAR: 2,
1858
+ APR: 3,
1859
+ MAY: 4,
1860
+ JUN: 5,
1861
+ JUL: 6,
1862
+ AUG: 7,
1863
+ SEP: 8,
1864
+ OCT: 9,
1865
+ NOV: 10,
1866
+ DEC: 11
1867
+ }[n.toUpperCase()] ?? NaN;
1868
+ return this.ymd(2e3 + parseInt(r, 10), i, parseInt(t, 10));
1869
+ }
1870
+ },
1871
+ timeLong12: {
1872
+ regex: /* @__PURE__ */ RegExp("^(0?[1-9]|1[0-2])[:.]([0-5]?[0-9])[:.](60|[0-5][0-9])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
1873
+ name: "timelong12",
1874
+ callback(e, t, n, r, i) {
1875
+ return this.time(J(+t, i), +n, +r, 0);
1876
+ }
1877
+ },
1878
+ timeShort12: {
1879
+ regex: /* @__PURE__ */ RegExp("^(0?[1-9]|1[0-2])[:.]([0-5][0-9])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
1880
+ name: "timeshort12",
1881
+ callback(e, t, n, r) {
1882
+ return this.time(J(+t, r), +n, 0, 0);
1883
+ }
1884
+ },
1885
+ timeTiny12: {
1886
+ regex: /* @__PURE__ */ RegExp("^(0?[1-9]|1[0-2])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
1887
+ name: "timetiny12",
1888
+ callback(e, t, n) {
1889
+ return this.time(J(+t, n), 0, 0, 0);
1890
+ }
1891
+ },
1892
+ soap: {
1893
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})-(0[0-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[01])T([01][0-9]|2[0-4]):([0-5][0-9]):(60|[0-5][0-9])(?:\\.([0-9]+))((?:GMT)?([+-])(2[0-4]|[01]?[0-9]):?([0-5]?[0-9])?)?", "i"),
1894
+ name: "soap",
1895
+ callback(e, t, n, r, i, a, o, s, c) {
1896
+ return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, +s.substr(0, 3)) && this.zone(Q(c));
1897
+ }
1898
+ },
1899
+ wddx: {
1900
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})-(1[0-2]|0?[0-9])-(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)T(2[0-4]|[01]?[0-9]):([0-5]?[0-9]):(60|[0-5]?[0-9])"),
1901
+ name: "wddx",
1902
+ callback(e, t, n, r, i, a, o) {
1903
+ return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
1904
+ }
1905
+ },
1906
+ exif: {
1907
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4}):(0[0-9]|1[0-2]):(0[0-9]|[1-2][0-9]|3[01]) ([01][0-9]|2[0-4]):([0-5][0-9]):(60|[0-5][0-9])", "i"),
1908
+ name: "exif",
1909
+ callback(e, t, n, r, i, a, o) {
1910
+ return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
1911
+ }
1912
+ },
1913
+ xmlRpc: {
1914
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})(0[0-9]|1[0-2])(0[0-9]|[1-2][0-9]|3[01])T(2[0-4]|[01]?[0-9]):([0-5][0-9]):(60|[0-5][0-9])"),
1915
+ name: "xmlrpc",
1916
+ callback(e, t, n, r, i, a, o) {
1917
+ return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
1918
+ }
1919
+ },
1920
+ xmlRpcNoColon: {
1921
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})(0[0-9]|1[0-2])(0[0-9]|[1-2][0-9]|3[01])[Tt](2[0-4]|[01]?[0-9])([0-5][0-9])(60|[0-5][0-9])"),
1922
+ name: "xmlrpcnocolon",
1923
+ callback(e, t, n, r, i, a, o) {
1924
+ return this.ymd(+t, n - 1, +r) && this.time(+i, +a, +o, 0);
1925
+ }
1926
+ },
1927
+ clf: {
1928
+ regex: /* @__PURE__ */ RegExp("^(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)/(jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)/([0-9]{4}):([01][0-9]|2[0-4]):([0-5][0-9]):(60|[0-5][0-9])[ \\t]+((?:GMT)?([+-])(2[0-4]|[01]?[0-9]):?([0-5]?[0-9])?)", "i"),
1929
+ name: "clf",
1930
+ callback(e, t, n, r, i, a, o, s) {
1931
+ return this.ymd(+r, X(n), +t) && this.time(+i, +a, +o, 0) && this.zone(Q(s));
1932
+ }
1933
+ },
1934
+ iso8601long: {
1935
+ regex: /* @__PURE__ */ RegExp("^t?(2[0-4]|[01]?[0-9])[:.]([0-5]?[0-9])[:.](60|[0-5]?[0-9])(?:\\.([0-9]+))", "i"),
1936
+ name: "iso8601long",
1937
+ callback(e, t, n, r, i) {
1938
+ return this.time(+t, +n, +r, +i.substr(0, 3));
1939
+ }
1940
+ },
1941
+ dateTextual: {
1942
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]+([0-9]{1,4})", "i"),
1943
+ name: "datetextual",
1944
+ callback(e, t, n, r) {
1945
+ return this.ymd(Y(r), X(t), +n);
1946
+ }
1947
+ },
1948
+ pointedDate4: {
1949
+ regex: /* @__PURE__ */ RegExp("^(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[.\\t-](1[0-2]|0?[0-9])[.-]([0-9]{4})"),
1950
+ name: "pointeddate4",
1951
+ callback(e, t, n, r) {
1952
+ return this.ymd(+r, n - 1, +t);
1953
+ }
1954
+ },
1955
+ pointedDate2: {
1956
+ regex: /* @__PURE__ */ RegExp("^(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[.\\t](1[0-2]|0?[0-9])\\.([0-9]{2})"),
1957
+ name: "pointeddate2",
1958
+ callback(e, t, n, r) {
1959
+ return this.ymd(Y(r), n - 1, +t);
1960
+ }
1961
+ },
1962
+ timeLong24: {
1963
+ regex: /* @__PURE__ */ RegExp("^t?(2[0-4]|[01]?[0-9])[:.]([0-5]?[0-9])[:.](60|[0-5]?[0-9])"),
1964
+ name: "timelong24",
1965
+ callback(e, t, n, r) {
1966
+ return this.time(+t, +n, +r, 0);
1967
+ }
1968
+ },
1969
+ dateNoColon: {
1970
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})(0[0-9]|1[0-2])(0[0-9]|[1-2][0-9]|3[01])"),
1971
+ name: "datenocolon",
1972
+ callback(e, t, n, r) {
1973
+ return this.ymd(+t, n - 1, +r);
1974
+ }
1975
+ },
1976
+ pgydotd: {
1977
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})\\.?(00[1-9]|0[1-9][0-9]|[12][0-9][0-9]|3[0-5][0-9]|36[0-6])"),
1978
+ name: "pgydotd",
1979
+ callback(e, t, n) {
1980
+ return this.ymd(+t, 0, +n);
1981
+ }
1982
+ },
1983
+ timeShort24: {
1984
+ regex: /* @__PURE__ */ RegExp("^t?(2[0-4]|[01]?[0-9])[:.]([0-5]?[0-9])", "i"),
1985
+ name: "timeshort24",
1986
+ callback(e, t, n) {
1987
+ return this.time(+t, +n, 0, 0);
1988
+ }
1989
+ },
1990
+ iso8601noColon: {
1991
+ regex: /* @__PURE__ */ RegExp("^t?([01][0-9]|2[0-4])([0-5][0-9])(60|[0-5][0-9])", "i"),
1992
+ name: "iso8601nocolon",
1993
+ callback(e, t, n, r) {
1994
+ return this.time(+t, +n, +r, 0);
1995
+ }
1996
+ },
1997
+ iso8601dateSlash: {
1998
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})/(0[0-9]|1[0-2])/(0[0-9]|[1-2][0-9]|3[01])/"),
1999
+ name: "iso8601dateslash",
2000
+ callback(e, t, n, r) {
2001
+ return this.ymd(+t, n - 1, +r);
2002
+ }
2003
+ },
2004
+ dateSlash: {
2005
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})/(1[0-2]|0?[0-9])/(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)"),
2006
+ name: "dateslash",
2007
+ callback(e, t, n, r) {
2008
+ return this.ymd(+t, n - 1, +r);
2009
+ }
2010
+ },
2011
+ american: {
2012
+ regex: /* @__PURE__ */ RegExp("^(1[0-2]|0?[0-9])/(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)/([0-9]{1,4})"),
2013
+ name: "american",
2014
+ callback(e, t, n, r) {
2015
+ return this.ymd(Y(r), t - 1, +n);
2016
+ }
2017
+ },
2018
+ americanShort: {
2019
+ regex: /* @__PURE__ */ RegExp("^(1[0-2]|0?[0-9])/(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)"),
2020
+ name: "americanshort",
2021
+ callback(e, t, n) {
2022
+ return this.ymd(this.y, t - 1, +n);
2023
+ }
2024
+ },
2025
+ gnuDateShortOrIso8601date2: {
2026
+ regex: /* @__PURE__ */ RegExp("^([0-9]{1,4})-(1[0-2]|0?[0-9])-(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)"),
2027
+ name: "gnudateshort | iso8601date2",
2028
+ callback(e, t, n, r) {
2029
+ return this.ymd(Y(t), n - 1, +r);
2030
+ }
2031
+ },
2032
+ iso8601date4: {
2033
+ regex: /* @__PURE__ */ RegExp("^([+-]?[0-9]{4})-(0[0-9]|1[0-2])-(0[0-9]|[1-2][0-9]|3[01])"),
2034
+ name: "iso8601date4",
2035
+ callback(e, t, n, r) {
2036
+ return this.ymd(+t, n - 1, +r);
2037
+ }
2038
+ },
2039
+ gnuNoColon: {
2040
+ regex: /* @__PURE__ */ RegExp("^t?([01][0-9]|2[0-4])([0-5][0-9])", "i"),
2041
+ name: "gnunocolon",
2042
+ callback(e, t, n) {
2043
+ switch (this.times) {
2044
+ case 0: return this.time(+t, +n, 0, this.f);
2045
+ case 1: return this.y = 100 * t + +n, this.times++, !0;
2046
+ default: return !1;
2047
+ }
2048
+ }
2049
+ },
2050
+ gnuDateShorter: {
2051
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})-(1[0-2]|0?[0-9])"),
2052
+ name: "gnudateshorter",
2053
+ callback(e, t, n) {
2054
+ return this.ymd(+t, n - 1, 1);
2055
+ }
2056
+ },
2057
+ pgTextReverse: {
2058
+ regex: /* @__PURE__ */ RegExp("^(\\d{3,4}|[4-9]\\d|3[2-9])-(jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)-(0[0-9]|[1-2][0-9]|3[01])", "i"),
2059
+ name: "pgtextreverse",
2060
+ callback(e, t, n, r) {
2061
+ return this.ymd(Y(t), X(n), +r);
2062
+ }
2063
+ },
2064
+ dateFull: {
2065
+ regex: /* @__PURE__ */ RegExp("^(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[ \\t.-]*(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ \\t.-]*([0-9]{1,4})", "i"),
2066
+ name: "datefull",
2067
+ callback(e, t, n, r) {
2068
+ return this.ymd(Y(r), X(n), +t);
2069
+ }
2070
+ },
2071
+ dateNoDay: {
2072
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*([0-9]{4})", "i"),
2073
+ name: "datenoday",
2074
+ callback(e, t, n) {
2075
+ return this.ymd(+n, X(t), 1);
2076
+ }
2077
+ },
2078
+ dateNoDayRev: {
2079
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})[ .\\t-]*(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})", "i"),
2080
+ name: "datenodayrev",
2081
+ callback(e, t, n) {
2082
+ return this.ymd(+t, X(n), 1);
2083
+ }
2084
+ },
2085
+ pgTextShort: {
2086
+ regex: /* @__PURE__ */ RegExp("^(jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)-(0[0-9]|[1-2][0-9]|3[01])-([0-9]{1,4})", "i"),
2087
+ name: "pgtextshort",
2088
+ callback(e, t, n, r) {
2089
+ return this.ymd(Y(r), X(t), +n);
2090
+ }
2091
+ },
2092
+ dateNoYear: {
2093
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]*", "i"),
2094
+ name: "datenoyear",
2095
+ callback(e, t, n) {
2096
+ return this.ymd(this.y, X(t), +n);
2097
+ }
2098
+ },
2099
+ dateNoYearRev: {
2100
+ regex: /* @__PURE__ */ RegExp("^(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[ .\\t-]*(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})", "i"),
2101
+ name: "datenoyearrev",
2102
+ callback(e, t, n) {
2103
+ return this.ymd(this.y, X(n), +t);
2104
+ }
2105
+ },
2106
+ isoWeekDay: {
2107
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})-?W(0[1-9]|[1-4][0-9]|5[0-3])(?:-?([0-7]))?"),
2108
+ name: "isoweekday | isoweek",
2109
+ callback(e, t, n, r) {
2110
+ let i = r ? +r : 1;
2111
+ if (!this.ymd(+t, 0, 1)) return !1;
2112
+ let a = new Date(this.y, this.m, this.d).getDay();
2113
+ return a = 0 - (a > 4 ? a - 7 : a), this.rd += a + 7 * (n - 1) + i, !0;
2114
+ }
2115
+ },
2116
+ relativeText: {
2117
+ regex: /* @__PURE__ */ RegExp("^(first|second|third|fourth|fifth|sixth|seventh|eighth?|ninth|tenth|eleventh|twelfth|next|last|previous|this)[ \\t]+((?:second|sec|minute|min|hour|day|fortnight|forthnight|month|year)s?|weeks|sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun|mon|tue|wed|thu|fri|sat|weekdays?)", "i"),
2118
+ name: "relativetext",
2119
+ callback(e, t, n) {
2120
+ let { amount: r } = function(e) {
2121
+ let t = e.toLowerCase();
2122
+ return {
2123
+ amount: {
2124
+ last: -1,
2125
+ previous: -1,
2126
+ this: 0,
2127
+ first: 1,
2128
+ next: 1,
2129
+ second: 2,
2130
+ third: 3,
2131
+ fourth: 4,
2132
+ fifth: 5,
2133
+ sixth: 6,
2134
+ seventh: 7,
2135
+ eight: 8,
2136
+ eighth: 8,
2137
+ ninth: 9,
2138
+ tenth: 10,
2139
+ eleventh: 11,
2140
+ twelfth: 12
2141
+ }[t] ?? 0,
2142
+ behavior: { this: 1 }[t] || 0
2143
+ };
2144
+ }(t);
2145
+ switch (n.toLowerCase()) {
2146
+ case "sec":
2147
+ case "secs":
2148
+ case "second":
2149
+ case "seconds":
2150
+ this.rs += r;
2151
+ break;
2152
+ case "min":
2153
+ case "mins":
2154
+ case "minute":
2155
+ case "minutes":
2156
+ this.ri += r;
2157
+ break;
2158
+ case "hour":
2159
+ case "hours":
2160
+ this.rh += r;
2161
+ break;
2162
+ case "day":
2163
+ case "days":
2164
+ this.rd += r;
2165
+ break;
2166
+ case "fortnight":
2167
+ case "fortnights":
2168
+ case "forthnight":
2169
+ case "forthnights":
2170
+ this.rd += 14 * r;
2171
+ break;
2172
+ case "week":
2173
+ case "weeks":
2174
+ this.rd += 7 * r;
2175
+ break;
2176
+ case "month":
2177
+ case "months":
2178
+ this.rm += r;
2179
+ break;
2180
+ case "year":
2181
+ case "years":
2182
+ this.ry += r;
2183
+ break;
2184
+ case "mon":
2185
+ case "monday":
2186
+ case "tue":
2187
+ case "tuesday":
2188
+ case "wed":
2189
+ case "wednesday":
2190
+ case "thu":
2191
+ case "thursday":
2192
+ case "fri":
2193
+ case "friday":
2194
+ case "sat":
2195
+ case "saturday":
2196
+ case "sun":
2197
+ case "sunday": this.resetTime(), this.weekday = Z(n, 7), this.weekdayBehavior = 1, this.rd += 7 * (r > 0 ? r - 1 : r);
2198
+ }
2199
+ }
2200
+ },
2201
+ relative: {
2202
+ regex: /* @__PURE__ */ RegExp("^([+-]*)[ \\t]*(\\d+)[ \\t]*((?:second|sec|minute|min|hour|day|fortnight|forthnight|month|year)s?|weeks|sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun|mon|tue|wed|thu|fri|sat|weekdays?|week)", "i"),
2203
+ name: "relative",
2204
+ callback(e, t, n, r) {
2205
+ let i = n * (-1) ** t.replace(/[^-]/g, "").length;
2206
+ switch (r.toLowerCase()) {
2207
+ case "sec":
2208
+ case "secs":
2209
+ case "second":
2210
+ case "seconds":
2211
+ this.rs += i;
2212
+ break;
2213
+ case "min":
2214
+ case "mins":
2215
+ case "minute":
2216
+ case "minutes":
2217
+ this.ri += i;
2218
+ break;
2219
+ case "hour":
2220
+ case "hours":
2221
+ this.rh += i;
2222
+ break;
2223
+ case "day":
2224
+ case "days":
2225
+ this.rd += i;
2226
+ break;
2227
+ case "fortnight":
2228
+ case "fortnights":
2229
+ case "forthnight":
2230
+ case "forthnights":
2231
+ this.rd += 14 * i;
2232
+ break;
2233
+ case "week":
2234
+ case "weeks":
2235
+ this.rd += 7 * i;
2236
+ break;
2237
+ case "month":
2238
+ case "months":
2239
+ this.rm += i;
2240
+ break;
2241
+ case "year":
2242
+ case "years":
2243
+ this.ry += i;
2244
+ break;
2245
+ case "mon":
2246
+ case "monday":
2247
+ case "tue":
2248
+ case "tuesday":
2249
+ case "wed":
2250
+ case "wednesday":
2251
+ case "thu":
2252
+ case "thursday":
2253
+ case "fri":
2254
+ case "friday":
2255
+ case "sat":
2256
+ case "saturday":
2257
+ case "sun":
2258
+ case "sunday": this.resetTime(), this.weekday = Z(r, 7), this.weekdayBehavior = 1, this.rd += 7 * (i > 0 ? i - 1 : i);
2259
+ }
2260
+ }
2261
+ },
2262
+ dayText: {
2263
+ regex: /* @__PURE__ */ RegExp("^(sunday|monday|tuesday|wednesday|thursday|friday|saturday|sun|mon|tue|wed|thu|fri|sat|weekdays?)", "i"),
2264
+ name: "daytext",
2265
+ callback(e, t) {
2266
+ this.resetTime(), this.weekday = Z(t, 0), this.weekdayBehavior !== 2 && (this.weekdayBehavior = 1);
2267
+ }
2268
+ },
2269
+ relativeTextWeek: {
2270
+ regex: /* @__PURE__ */ RegExp("^(next|last|previous|this)[ \\t]+week", "i"),
2271
+ name: "relativetextweek",
2272
+ callback(e, t) {
2273
+ switch (this.weekdayBehavior = 2, t.toLowerCase()) {
2274
+ case "this":
2275
+ this.rd += 0;
2276
+ break;
2277
+ case "next":
2278
+ this.rd += 7;
2279
+ break;
2280
+ case "last":
2281
+ case "previous": this.rd -= 7;
2282
+ }
2283
+ isNaN(this.weekday) && (this.weekday = 1);
2284
+ }
2285
+ },
2286
+ monthFullOrMonthAbbr: {
2287
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec)", "i"),
2288
+ name: "monthfull | monthabbr",
2289
+ callback(e, t) {
2290
+ return this.ymd(this.y, X(t), this.d);
2291
+ }
2292
+ },
2293
+ tzCorrection: {
2294
+ regex: /* @__PURE__ */ RegExp("^((?:GMT)?([+-])(2[0-4]|[01]?[0-9]):?([0-5]?[0-9])?)", "i"),
2295
+ name: "tzcorrection",
2296
+ callback(e) {
2297
+ return this.zone(Q(e));
2298
+ }
2299
+ },
2300
+ tzAbbr: {
2301
+ regex: /* @__PURE__ */ RegExp("^\\(?([a-zA-Z]{1,6})\\)?"),
2302
+ name: "tzabbr",
2303
+ callback(e, t) {
2304
+ let n = ce[t.toLowerCase()];
2305
+ return n != null && !Number.isNaN(n) && this.zone(n);
2306
+ }
2307
+ },
2308
+ ago: {
2309
+ regex: /^ago/i,
2310
+ name: "ago",
2311
+ callback() {
2312
+ this.ry = -this.ry, this.rm = -this.rm, this.rd = -this.rd, this.rh = -this.rh, this.ri = -this.ri, this.rs = -this.rs, this.rf = -this.rf;
2313
+ }
2314
+ },
2315
+ year4: {
2316
+ regex: /* @__PURE__ */ RegExp("^([0-9]{4})"),
2317
+ name: "year4",
2318
+ callback(e, t) {
2319
+ return this.y = +t, !0;
2320
+ }
2321
+ },
2322
+ whitespace: {
2323
+ regex: /^[ .,\t]+/,
2324
+ name: "whitespace"
2325
+ },
2326
+ dateShortWithTimeLong: {
2327
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]*t?(2[0-4]|[01]?[0-9])[:.]([0-5]?[0-9])[:.](60|[0-5]?[0-9])", "i"),
2328
+ name: "dateshortwithtimelong",
2329
+ callback(e, t, n, r, i, a) {
2330
+ return this.ymd(this.y, X(t), +n) && this.time(+r, +i, +a, 0);
2331
+ }
2332
+ },
2333
+ dateShortWithTimeLong12: {
2334
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]*(0?[1-9]|1[0-2])[:.]([0-5]?[0-9])[:.](60|[0-5][0-9])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
2335
+ name: "dateshortwithtimelong12",
2336
+ callback(e, t, n, r, i, a, o) {
2337
+ return this.ymd(this.y, X(t), +n) && this.time(J(+r, o), +i, +a, 0);
2338
+ }
2339
+ },
2340
+ dateShortWithTimeShort: {
2341
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]*t?(2[0-4]|[01]?[0-9])[:.]([0-5]?[0-9])", "i"),
2342
+ name: "dateshortwithtimeshort",
2343
+ callback(e, t, n, r, i) {
2344
+ return this.ymd(this.y, X(t), +n) && this.time(+r, +i, 0, 0);
2345
+ }
2346
+ },
2347
+ dateShortWithTimeShort12: {
2348
+ regex: /* @__PURE__ */ RegExp("^(january|february|march|april|may|june|july|august|september|october|november|december|jan|feb|mar|apr|may|jun|jul|aug|sept?|oct|nov|dec|i[vx]|vi{0,3}|xi{0,2}|i{1,3})[ .\\t-]*(?:(3[01]|[0-2]?[0-9])(?:st|nd|rd|th)?)[,.stndrh\\t ]*(0?[1-9]|1[0-2])[:.]([0-5][0-9])[ \\t]*(?:([ap])\\.?m\\.?([\\t ]|$))", "i"),
2349
+ name: "dateshortwithtimeshort12",
2350
+ callback(e, t, n, r, i, a) {
2351
+ return this.ymd(this.y, X(t), +n) && this.time(J(+r, a), +i, 0, 0);
2352
+ }
2353
+ }
2354
+ }, le = {
2355
+ y: NaN,
2356
+ m: NaN,
2357
+ d: NaN,
2358
+ h: NaN,
2359
+ i: NaN,
2360
+ s: NaN,
2361
+ f: NaN,
2362
+ ry: 0,
2363
+ rm: 0,
2364
+ rd: 0,
2365
+ rh: 0,
2366
+ ri: 0,
2367
+ rs: 0,
2368
+ rf: 0,
2369
+ weekday: NaN,
2370
+ weekdayBehavior: 0,
2371
+ firstOrLastDayOfMonth: 0,
2372
+ z: NaN,
2373
+ dates: 0,
2374
+ times: 0,
2375
+ zones: 0,
2376
+ ymd(e, t, n) {
2377
+ return !(this.dates > 0) && (this.dates++, this.y = e, this.m = t, this.d = n, !0);
2378
+ },
2379
+ time(e, t, n, r) {
2380
+ return !(this.times > 0) && (this.times++, this.h = e, this.i = t, this.s = n, this.f = r, !0);
2381
+ },
2382
+ resetTime() {
2383
+ return this.h = 0, this.i = 0, this.s = 0, this.f = 0, this.times = 0, !0;
2384
+ },
2385
+ zone(e) {
2386
+ return this.zones <= 1 && (this.zones++, this.z = e, !0);
2387
+ },
2388
+ toDate(e) {
2389
+ switch (this.dates && !this.times && (this.h = this.i = this.s = this.f = 0), isNaN(this.y) && (this.y = e.getFullYear()), isNaN(this.m) && (this.m = e.getMonth()), isNaN(this.d) && (this.d = e.getDate()), isNaN(this.h) && (this.h = e.getHours()), isNaN(this.i) && (this.i = e.getMinutes()), isNaN(this.s) && (this.s = e.getSeconds()), isNaN(this.f) && (this.f = e.getMilliseconds()), this.firstOrLastDayOfMonth) {
2390
+ case 1:
2391
+ this.d = 1;
2392
+ break;
2393
+ case -1: this.d = 0, this.m += 1;
2394
+ }
2395
+ if (!isNaN(this.weekday)) {
2396
+ let t = new Date(e.getTime());
2397
+ t.setFullYear(this.y, this.m, this.d), t.setHours(this.h, this.i, this.s, this.f);
2398
+ let n = t.getDay();
2399
+ if (this.weekdayBehavior === 2) n === 0 && this.weekday !== 0 && (this.weekday = -6), this.weekday === 0 && n !== 0 && (this.weekday = 7), this.d -= n, this.d += this.weekday;
2400
+ else {
2401
+ let e = this.weekday - n;
2402
+ (this.rd < 0 && e < 0 || this.rd >= 0 && e <= -this.weekdayBehavior) && (e += 7), this.weekday >= 0 ? this.d += e : this.d -= 7 - (Math.abs(this.weekday) - n), this.weekday = NaN;
2403
+ }
2404
+ }
2405
+ this.y += this.ry, this.m += this.rm, this.d += this.rd, this.h += this.rh, this.i += this.ri, this.s += this.rs, this.f += this.rf, this.ry = this.rm = this.rd = 0, this.rh = this.ri = this.rs = this.rf = 0;
2406
+ let t = new Date(e.getTime());
2407
+ switch (t.setFullYear(this.y, this.m, this.d), t.setHours(this.h, this.i, this.s, this.f), this.firstOrLastDayOfMonth) {
2408
+ case 1:
2409
+ t.setDate(1);
2410
+ break;
2411
+ case -1: t.setMonth(t.getMonth() + 1, 0);
2412
+ }
2413
+ return isNaN(this.z) || t.getTimezoneOffset() === this.z || (t.setUTCFullYear(t.getFullYear(), t.getMonth(), t.getDate()), t.setUTCHours(t.getHours(), t.getMinutes(), t.getSeconds() - this.z, t.getMilliseconds())), t;
2414
+ }
2415
+ };
2416
+ e.AbstractProvider = R, e.ArrayAdapter = P, e.ArrayProvider = class extends R {
2417
+ getFunctions() {
2418
+ return [
2419
+ ie,
2420
+ ae,
2421
+ oe
2422
+ ];
2423
+ }
2424
+ }, e.BasicProvider = class extends R {
2425
+ getFunctions() {
2426
+ return [z];
2427
+ }
2428
+ }, e.Compiler = A, e.DateProvider = class extends R {
2429
+ getFunctions() {
2430
+ return [new I("date", function(e, t) {
2431
+ let n = "";
2432
+ return t && (n = `, ${t}`), `date(${e}${n})`;
2433
+ }, function(e, t, n) {
2434
+ return se(t, n);
2435
+ }), new I("strtotime", function(e, t) {
2436
+ let n = "";
2437
+ return t && (n = `, ${t}`), `strtotime(${e}${n})`;
2438
+ }, function(e, t, n) {
2439
+ return function(e, t) {
2440
+ let n = t ?? Math.floor(Date.now() / 1e3), r = [
2441
+ $.yesterday,
2442
+ $.now,
2443
+ $.noon,
2444
+ $.midnightOrToday,
2445
+ $.tomorrow,
2446
+ $.timestamp,
2447
+ $.firstOrLastDay,
2448
+ $.backOrFrontOf,
2449
+ $.timeTiny12,
2450
+ $.timeShort12,
2451
+ $.timeLong12,
2452
+ $.mssqltime,
2453
+ $.oracledate,
2454
+ $.timeShort24,
2455
+ $.timeLong24,
2456
+ $.iso8601long,
2457
+ $.gnuNoColon,
2458
+ $.iso8601noColon,
2459
+ $.americanShort,
2460
+ $.american,
2461
+ $.iso8601date4,
2462
+ $.iso8601dateSlash,
2463
+ $.dateSlash,
2464
+ $.gnuDateShortOrIso8601date2,
2465
+ $.gnuDateShorter,
2466
+ $.dateFull,
2467
+ $.pointedDate4,
2468
+ $.pointedDate2,
2469
+ $.dateNoDay,
2470
+ $.dateNoDayRev,
2471
+ $.dateTextual,
2472
+ $.dateNoYear,
2473
+ $.dateNoYearRev,
2474
+ $.dateNoColon,
2475
+ $.xmlRpc,
2476
+ $.xmlRpcNoColon,
2477
+ $.soap,
2478
+ $.wddx,
2479
+ $.exif,
2480
+ $.pgydotd,
2481
+ $.isoWeekDay,
2482
+ $.pgTextShort,
2483
+ $.pgTextReverse,
2484
+ $.clf,
2485
+ $.year4,
2486
+ $.ago,
2487
+ $.dayText,
2488
+ $.relativeTextWeek,
2489
+ $.relativeText,
2490
+ $.monthFullOrMonthAbbr,
2491
+ $.tzCorrection,
2492
+ $.tzAbbr,
2493
+ $.dateShortWithTimeShort12,
2494
+ $.dateShortWithTimeLong12,
2495
+ $.dateShortWithTimeShort,
2496
+ $.dateShortWithTimeLong,
2497
+ $.relative,
2498
+ $.whitespace
2499
+ ], i = { ...le };
2500
+ for (; e.length;) {
2501
+ let t = null, n = null;
2502
+ for (let i of r) {
2503
+ let r = e.match(i.regex);
2504
+ r && (!t || r[0].length > t[0].length) && (t = r, n = i);
2505
+ }
2506
+ if (!n || !t || n.callback && !1 === n.callback.apply(i, t)) return !1;
2507
+ e = e.substr(t[0].length), n = null, t = null;
2508
+ }
2509
+ return Math.floor(i.toDate(/* @__PURE__ */ new Date(1e3 * n)).getTime() / 1e3);
2510
+ }(t, n);
2511
+ })];
2512
+ }
2513
+ }, e.ExpressionFunction = I, e.ExpressionLanguage = L, e.IGNORE_UNKNOWN_FUNCTIONS = 2, e.IGNORE_UNKNOWN_VARIABLES = 1, e.Parser = k, e.StringProvider = class extends R {
2514
+ getFunctions() {
2515
+ return [
2516
+ new I("strtolower", (e) => "strtolower(" + e + ")", (e, t) => function(e) {
2517
+ return (e + "").toLowerCase();
2518
+ }(t)),
2519
+ new I("strtoupper", (e) => "strtoupper(" + e + ")", (e, t) => function(e) {
2520
+ return (e + "").toUpperCase();
2521
+ }(t)),
2522
+ new I("explode", (e, t, n = "null") => `explode(${e}, ${t}, ${n})`, (e, t, n, r = null) => function(...e) {
2523
+ let [t, n, r] = e, i = t, a = n;
2524
+ if (e.length < 2 || i === void 0 || a === void 0) return null;
2525
+ if (i === "" || !1 === i || i === null) return !1;
2526
+ if (typeof i == "function" || typeof i == "object" || typeof a == "function" || typeof a == "object") return { 0: "" };
2527
+ !0 === i && (i = "1");
2528
+ let o = i + "", s = (a + "").split(o);
2529
+ return r === void 0 ? s : (r === 0 && (r = 1), r > 0 ? r >= s.length ? s : s.slice(0, r - 1).concat([s.slice(r - 1).join(o)]) : -r >= s.length ? [] : (s.splice(s.length + r), s));
2530
+ }(t, n, r)),
2531
+ new I("strlen", function(e) {
2532
+ return `strlen(${e});`;
2533
+ }, function(e, t) {
2534
+ return function(e) {
2535
+ let t = e + "";
2536
+ if ((G("unicode.semantics") || "off") === "off") return t.length;
2537
+ let n = 0, r = 0, i = function(e, t) {
2538
+ let n = e.charCodeAt(t);
2539
+ if (n >= 55296 && n <= 56319) {
2540
+ if (e.length <= t + 1) throw Error("High surrogate without following low surrogate");
2541
+ let n = e.charCodeAt(t + 1);
2542
+ if (n < 56320 || n > 57343) throw Error("High surrogate without following low surrogate");
2543
+ return e.charAt(t) + e.charAt(t + 1);
2544
+ }
2545
+ if (n >= 56320 && n <= 57343) {
2546
+ if (t === 0) throw Error("Low surrogate without preceding high surrogate");
2547
+ let n = e.charCodeAt(t - 1);
2548
+ if (n < 55296 || n > 56319) throw Error("Low surrogate without preceding high surrogate");
2549
+ return !1;
2550
+ }
2551
+ return e.charAt(t);
2552
+ };
2553
+ for (n = 0, r = 0; n < t.length; n++) !1 !== i(t, n) && r++;
2554
+ return r;
2555
+ }(t);
2556
+ }),
2557
+ new I("strstr", function(e, t, n) {
2558
+ let r = "";
2559
+ return n && (r = `, ${n}`), `strstr(${e}, ${t}${r});`;
2560
+ }, function(e, t, n, r) {
2561
+ return function(e, t, n) {
2562
+ let r = 0;
2563
+ return r = (e += "").indexOf(t), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
2564
+ }(t, n, r);
2565
+ }),
2566
+ new I("stristr", function(e, t, n) {
2567
+ let r = "";
2568
+ return n && (r = `, ${n}`), `stristr(${e}, ${t}${r});`;
2569
+ }, function(e, t, n, r) {
2570
+ return function(e, t, n) {
2571
+ let r = 0;
2572
+ return r = (e += "").toLowerCase().indexOf((t + "").toLowerCase()), r !== -1 && (n ? e.substr(0, r) : e.slice(r));
2573
+ }(t, n, r);
2574
+ }),
2575
+ new I("substr", function(e, t, n) {
2576
+ let r = "";
2577
+ return n && (r = `, ${n}`), `substr(${e}, ${t}${r});`;
2578
+ }, function(e, t, n, r) {
2579
+ return ne(t, n, r);
2580
+ })
2581
+ ];
2582
+ }
2583
+ }, e.default = L, e.tokenize = o, Object.defineProperty(e, "__esModule", { value: !0 });
2584
+ }), function(e) {
2585
+ var t = e.ExpressionLanguage;
2586
+ if (t && typeof t.ExpressionLanguage == "function") {
2587
+ var n = t.ExpressionLanguage;
2588
+ Object.keys(t).forEach(function(e) {
2589
+ e in n || (n[e] = t[e]);
2590
+ }), e.ExpressionLanguage = n;
2591
+ }
2592
+ }(typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : e);
2593
+ })))(), 1), v = null;
2594
+ function y() {
2595
+ let e = _, t = e.ExpressionLanguage || e.default || _;
2596
+ if (typeof t != "function") throw TypeError("Unable to resolve expression-language constructor.");
2597
+ return t;
2598
+ }
2599
+ function b() {
2600
+ return v ??= new (y())(), v;
2601
+ }
2602
+ function x(e) {
2603
+ return (e.formula?.expression || e.formula?.formula || "").trim();
2604
+ }
2605
+ function S(e) {
2606
+ return Object.entries(e.formula?.variables || {}).filter((e) => !!e[1]?.sourceKey);
2607
+ }
2608
+ function C(e, t) {
2609
+ return Object.entries(e).forEach(([t, n]) => {
2610
+ if (Array.isArray(n)) {
2611
+ let r = n.map((e) => typeof e == "string" && e.trim() !== "" && !Number.isNaN(Number(e)) ? Number(e) : e), i = r.filter((e) => typeof e == "number");
2612
+ e[t] = i.length === r.length && r.length > 0 ? i.reduce((e, t) => e + Number(t || 0), 0) : r;
2613
+ return;
2614
+ }
2615
+ typeof n == "string" && n.trim() !== "" && !Number.isNaN(Number(n)) && (e[t] = Number(n));
2616
+ }), e;
2617
+ }
2618
+ function w(e, t) {
2619
+ if (t.formatting !== "number") return typeof e == "number" || typeof e == "string" ? e : "";
2620
+ let n = e;
2621
+ Array.isArray(n) && (n = n.reduce((e, t) => e + Number(t || 0), 0));
2622
+ let r = typeof t.decimals == "number" ? t.decimals : 0, i = Number(n || 0).toFixed(r);
2623
+ return `${t.prefix || ""}${i}${t.suffix || ""}`;
2624
+ }
2625
+ function T(e, t) {
2626
+ let n = e.type?.endsWith("\\Number");
2627
+ return e.type?.endsWith("\\Checkboxes") ? Array.isArray(t) ? t.length ? t : "" : t ? [t] : "" : Array.isArray(t) ? t.length ? n ? t.map((e) => Number(e || 0)) : t : "" : n ? Number(t || 0) : t;
2628
+ }
2629
+ function E(e, t, n) {
2630
+ return w(b().evaluate(e, t), n);
2631
+ }
2632
+ var D = (() => {
2633
+ let e = Intl.Segmenter;
2634
+ return e ? new e(void 0, { granularity: "grapheme" }) : null;
2635
+ })(), O = /[\p{L}\p{N}\p{M}]+(?:['’._-][\p{L}\p{N}\p{M}]+)*/gu;
2636
+ function k(e) {
2637
+ return typeof DOMParser < "u" ? new DOMParser().parseFromString(e, "text/html").body.textContent || "" : e.replace(/<[^>]*>/g, " ");
2638
+ }
2639
+ function A(e) {
2640
+ return k(e);
2641
+ }
2642
+ function j(e) {
2643
+ return A(e).replace(/[\s\t\n\r]+/g, " ").trim();
2644
+ }
2645
+ function M(e) {
2646
+ return D ? Array.from(D.segment(e)).length : Array.from(e).length;
2647
+ }
2648
+ function N(e) {
2649
+ return e.match(O)?.length || 0;
2650
+ }
2651
+ function P(e) {
2652
+ let t = A(e), n = j(e);
2653
+ return {
2654
+ graphemeCount: M(t),
2655
+ wordCount: N(n)
2656
+ };
2657
+ }
2658
+ //#endregion
2659
+ export { g as a, x as c, P as i, T as n, h as o, S as r, E as s, C as t };