@pebble-software/bonsai 0.1.0 → 0.1.1
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.
- package/README.md +4 -0
- package/dist/ast.js +10 -0
- package/dist/ast.js.map +1 -0
- package/dist/chunks/builder.meta-WpXc5VBB.js +666 -0
- package/dist/chunks/builder.meta-WpXc5VBB.js.map +1 -0
- package/dist/chunks/{button-CSLrIvsS.js → button-jfJanilw.js} +46 -51
- package/dist/chunks/button-jfJanilw.js.map +1 -0
- package/dist/chunks/{create-renderer-1cky1uN9.js → create-renderer-DHneTPd-.js} +8 -8
- package/dist/chunks/{create-renderer-1cky1uN9.js.map → create-renderer-DHneTPd-.js.map} +1 -1
- package/dist/chunks/index-DzpRdatr.js +359 -0
- package/dist/chunks/index-DzpRdatr.js.map +1 -0
- package/dist/chunks/{render-shared-CIUUkLDn.js → render-shared-Ci28BpkI.js} +601 -931
- package/dist/chunks/render-shared-Ci28BpkI.js.map +1 -0
- package/dist/constants.d.ts +1 -0
- package/dist/constants.js +11 -0
- package/dist/constants.js.map +1 -0
- package/dist/core.js +3 -3
- package/dist/index.js +308 -955
- package/dist/index.js.map +1 -1
- package/dist/library/constants/src/components.d.ts +59 -0
- package/dist/library/constants/src/index.d.ts +2 -0
- package/dist/library/constants/src/webhook-events.d.ts +6 -0
- package/dist/library/schemas/src/bonsai.schema.d.ts +24 -0
- package/dist/library/schemas/src/builder.meta.d.ts +26 -0
- package/dist/presets/calendar.js +12 -11
- package/dist/presets/calendar.js.map +1 -1
- package/dist/presets/signature.js +9 -8
- package/dist/presets/signature.js.map +1 -1
- package/dist/schemas.d.ts +2 -0
- package/dist/schemas.js +13 -0
- package/dist/schemas.js.map +1 -0
- package/dist/styles/css/base.css +144 -0
- package/dist/styles/css/fonts.css +25 -0
- package/dist/styles/css/maplibre.css +29 -0
- package/dist/styles/css/overrides.css +7 -0
- package/dist/styles/css/tailwind.css +1 -0
- package/dist/styles/css/theme.css +197 -0
- package/dist/styles/css/tw-animate.css +1 -0
- package/dist/styles/css/utilities.css +44 -0
- package/dist/styles/presets.json +20 -0
- package/dist/styles/vendor/maplibre-gl.css +701 -0
- package/dist/styles/vendor/tw-animate.css +692 -0
- package/package.json +19 -3
- package/dist/chunks/button-CSLrIvsS.js.map +0 -1
- package/dist/chunks/render-shared-CIUUkLDn.js.map +0 -1
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
import w from "jsep";
|
|
2
|
+
import x from "@jsep-plugin/arrow";
|
|
3
|
+
class A {
|
|
4
|
+
cache = /* @__PURE__ */ new Map();
|
|
5
|
+
maxSize;
|
|
6
|
+
constructor(e) {
|
|
7
|
+
this.maxSize = e;
|
|
8
|
+
}
|
|
9
|
+
get(e) {
|
|
10
|
+
const t = this.cache.get(e);
|
|
11
|
+
return t !== void 0 && (this.cache.delete(e), this.cache.set(e, t)), t;
|
|
12
|
+
}
|
|
13
|
+
set(e, t) {
|
|
14
|
+
if (this.cache.delete(e), this.cache.set(e, t), this.cache.size > this.maxSize) {
|
|
15
|
+
const { value: n, done: s } = this.cache.keys().next();
|
|
16
|
+
s || this.cache.delete(n);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.cache.clear();
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
w.plugins.register(x);
|
|
24
|
+
const C = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]);
|
|
25
|
+
function m(r, e) {
|
|
26
|
+
if (r != null && !(typeof e == "string" && C.has(e)) && Object.prototype.hasOwnProperty.call(r, e))
|
|
27
|
+
return r[e];
|
|
28
|
+
}
|
|
29
|
+
function g(r) {
|
|
30
|
+
if (r.type === "Identifier") return r.name;
|
|
31
|
+
if (r.type === "MemberExpression") {
|
|
32
|
+
const e = g(r.object);
|
|
33
|
+
if (e == null) return null;
|
|
34
|
+
const t = r.property;
|
|
35
|
+
return r.computed ? t.type !== "Literal" ? null : `${e}[${JSON.stringify(t.value)}]` : t.type !== "Identifier" ? null : `${e}.${t.name}`;
|
|
36
|
+
}
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
function M(r) {
|
|
40
|
+
const e = r.match(/^[^.[]+/);
|
|
41
|
+
return e ? e[0] : r;
|
|
42
|
+
}
|
|
43
|
+
function E(r) {
|
|
44
|
+
const e = /* @__PURE__ */ new Set();
|
|
45
|
+
function t(n, s) {
|
|
46
|
+
if (n)
|
|
47
|
+
switch (n.type) {
|
|
48
|
+
case "Identifier": {
|
|
49
|
+
const i = n.name;
|
|
50
|
+
s.has(i) || e.add(i);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
case "MemberExpression": {
|
|
54
|
+
const i = g(n);
|
|
55
|
+
if (i != null) {
|
|
56
|
+
s.has(M(i)) || e.add(i);
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
t(n.object, s), t(n.property, s);
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
case "UnaryExpression":
|
|
63
|
+
t(n.argument, s);
|
|
64
|
+
return;
|
|
65
|
+
case "BinaryExpression":
|
|
66
|
+
t(n.left, s), t(n.right, s);
|
|
67
|
+
return;
|
|
68
|
+
case "ConditionalExpression":
|
|
69
|
+
t(n.test, s), t(n.consequent, s), t(n.alternate, s);
|
|
70
|
+
return;
|
|
71
|
+
case "ArrayExpression":
|
|
72
|
+
n.elements.forEach((i) => t(i, s));
|
|
73
|
+
return;
|
|
74
|
+
case "CallExpression": {
|
|
75
|
+
const i = n.callee;
|
|
76
|
+
i.type === "MemberExpression" && t(i.object, s), n.arguments.forEach((c) => {
|
|
77
|
+
if (c.type === "ArrowFunctionExpression") {
|
|
78
|
+
const a = new Set(s);
|
|
79
|
+
c.params?.forEach((l) => {
|
|
80
|
+
l.type === "Identifier" && a.add(l.name);
|
|
81
|
+
}), t(c.body, a);
|
|
82
|
+
} else
|
|
83
|
+
t(c, s);
|
|
84
|
+
});
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
case "Compound":
|
|
88
|
+
n.body.forEach((i) => t(i, s));
|
|
89
|
+
return;
|
|
90
|
+
default:
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return t(r, /* @__PURE__ */ new Set()), Array.from(e);
|
|
95
|
+
}
|
|
96
|
+
const u = (r, e = 2) => String(r).padStart(e, "0");
|
|
97
|
+
function U(r) {
|
|
98
|
+
const e = r instanceof Date ? r : new Date(r);
|
|
99
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
100
|
+
}
|
|
101
|
+
function f(r) {
|
|
102
|
+
const e = typeof r == "number" ? r : parseFloat(r);
|
|
103
|
+
return Number.isNaN(e) ? 0 : e;
|
|
104
|
+
}
|
|
105
|
+
function y(r) {
|
|
106
|
+
return r.flat(1 / 0).map(f);
|
|
107
|
+
}
|
|
108
|
+
const D = {
|
|
109
|
+
// Uses UTC getters so SSR and client render the same calendar date regardless of local timezone.
|
|
110
|
+
formatDate(r, e = "YYYY-MM-DD") {
|
|
111
|
+
const t = U(r);
|
|
112
|
+
if (!t) return "";
|
|
113
|
+
if (e === "short" || e === "medium" || e === "long" || e === "full")
|
|
114
|
+
return new Intl.DateTimeFormat("en-US", { dateStyle: e, timeZone: "UTC" }).format(t);
|
|
115
|
+
const n = {
|
|
116
|
+
YYYY: String(t.getUTCFullYear()),
|
|
117
|
+
MM: u(t.getUTCMonth() + 1),
|
|
118
|
+
DD: u(t.getUTCDate()),
|
|
119
|
+
HH: u(t.getUTCHours()),
|
|
120
|
+
mm: u(t.getUTCMinutes()),
|
|
121
|
+
ss: u(t.getUTCSeconds())
|
|
122
|
+
};
|
|
123
|
+
return e.replace(/YYYY|MM|DD|HH|mm|ss/g, (s) => n[s]);
|
|
124
|
+
},
|
|
125
|
+
formatCurrency(r, e = "USD", t = "en-US") {
|
|
126
|
+
const n = f(r);
|
|
127
|
+
return new Intl.NumberFormat(t, { style: "currency", currency: e }).format(n);
|
|
128
|
+
},
|
|
129
|
+
upper(r) {
|
|
130
|
+
return String(r ?? "").toUpperCase();
|
|
131
|
+
},
|
|
132
|
+
lower(r) {
|
|
133
|
+
return String(r ?? "").toLowerCase();
|
|
134
|
+
},
|
|
135
|
+
trim(r) {
|
|
136
|
+
return String(r ?? "").trim();
|
|
137
|
+
},
|
|
138
|
+
concat(...r) {
|
|
139
|
+
return r.map((e) => e ?? "").join("");
|
|
140
|
+
},
|
|
141
|
+
join(r, e = ", ") {
|
|
142
|
+
return Array.isArray(r) ? r.join(e) : "";
|
|
143
|
+
},
|
|
144
|
+
default(r, e) {
|
|
145
|
+
return r == null || r === "" ? e : r;
|
|
146
|
+
},
|
|
147
|
+
length(r) {
|
|
148
|
+
return typeof r == "string" || Array.isArray(r) ? r.length : 0;
|
|
149
|
+
},
|
|
150
|
+
count(r) {
|
|
151
|
+
return Array.isArray(r) ? r.length : 0;
|
|
152
|
+
},
|
|
153
|
+
sum(r) {
|
|
154
|
+
return Array.isArray(r) ? r.reduce((e, t) => e + f(t), 0) : 0;
|
|
155
|
+
},
|
|
156
|
+
min(...r) {
|
|
157
|
+
const e = y(r);
|
|
158
|
+
return e.length ? Math.min(...e) : void 0;
|
|
159
|
+
},
|
|
160
|
+
max(...r) {
|
|
161
|
+
const e = y(r);
|
|
162
|
+
return e.length ? Math.max(...e) : void 0;
|
|
163
|
+
},
|
|
164
|
+
round(r, e = 0) {
|
|
165
|
+
const t = 10 ** e;
|
|
166
|
+
return Math.round(f(r) * t) / t;
|
|
167
|
+
}
|
|
168
|
+
}, Y = /* @__PURE__ */ new Set(["map", "filter", "some", "every", "find"]);
|
|
169
|
+
function b(r, e, t) {
|
|
170
|
+
const n = { ...t };
|
|
171
|
+
return (r.params ?? []).forEach((s, i) => {
|
|
172
|
+
s.type === "Identifier" && (n[s.name] = e[i]);
|
|
173
|
+
}), o(r.body, n);
|
|
174
|
+
}
|
|
175
|
+
function o(r, e) {
|
|
176
|
+
switch (r.type) {
|
|
177
|
+
case "Literal":
|
|
178
|
+
return r.value;
|
|
179
|
+
case "Identifier":
|
|
180
|
+
return m(e, r.name);
|
|
181
|
+
case "MemberExpression": {
|
|
182
|
+
const t = o(r.object, e), n = r.property, s = r.computed ? o(n, e) : n.name;
|
|
183
|
+
return m(t, s);
|
|
184
|
+
}
|
|
185
|
+
case "UnaryExpression": {
|
|
186
|
+
const t = o(r.argument, e);
|
|
187
|
+
switch (r.operator) {
|
|
188
|
+
case "!":
|
|
189
|
+
return !t;
|
|
190
|
+
case "-":
|
|
191
|
+
return -t;
|
|
192
|
+
case "+":
|
|
193
|
+
return +t;
|
|
194
|
+
case "~":
|
|
195
|
+
return ~t;
|
|
196
|
+
default:
|
|
197
|
+
throw new Error(`Unknown unary operator: ${r.operator}`);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
case "BinaryExpression": {
|
|
201
|
+
const t = r.operator;
|
|
202
|
+
if (t === "&&" || t === "||" || t === "??") {
|
|
203
|
+
const i = o(r.left, e);
|
|
204
|
+
return (t === "&&" ? !i : t === "||" ? !!i : i != null) ? i : o(r.right, e);
|
|
205
|
+
}
|
|
206
|
+
const n = o(r.left, e), s = o(r.right, e);
|
|
207
|
+
switch (t) {
|
|
208
|
+
case "===":
|
|
209
|
+
return n === s;
|
|
210
|
+
case "!==":
|
|
211
|
+
return n !== s;
|
|
212
|
+
case "==":
|
|
213
|
+
return n == s;
|
|
214
|
+
case "!=":
|
|
215
|
+
return n != s;
|
|
216
|
+
case "<":
|
|
217
|
+
return n < s;
|
|
218
|
+
case ">":
|
|
219
|
+
return n > s;
|
|
220
|
+
case "<=":
|
|
221
|
+
return n <= s;
|
|
222
|
+
case ">=":
|
|
223
|
+
return n >= s;
|
|
224
|
+
case "+":
|
|
225
|
+
return n + s;
|
|
226
|
+
case "-":
|
|
227
|
+
return n - s;
|
|
228
|
+
case "*":
|
|
229
|
+
return n * s;
|
|
230
|
+
case "/":
|
|
231
|
+
return n / s;
|
|
232
|
+
case "%":
|
|
233
|
+
return n % s;
|
|
234
|
+
case "**":
|
|
235
|
+
return n ** s;
|
|
236
|
+
case "&":
|
|
237
|
+
return n & s;
|
|
238
|
+
case "|":
|
|
239
|
+
return n | s;
|
|
240
|
+
case "^":
|
|
241
|
+
return n ^ s;
|
|
242
|
+
case "<<":
|
|
243
|
+
return n << s;
|
|
244
|
+
case ">>":
|
|
245
|
+
return n >> s;
|
|
246
|
+
case ">>>":
|
|
247
|
+
return n >>> s;
|
|
248
|
+
default:
|
|
249
|
+
throw new Error(`Unknown binary operator: ${t}`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
case "ConditionalExpression": {
|
|
253
|
+
const t = o(r.test, e);
|
|
254
|
+
return o(t ? r.consequent : r.alternate, e);
|
|
255
|
+
}
|
|
256
|
+
case "ArrayExpression":
|
|
257
|
+
return r.elements.map(
|
|
258
|
+
(t) => t ? o(t, e) : void 0
|
|
259
|
+
);
|
|
260
|
+
case "CallExpression": {
|
|
261
|
+
const t = r.callee, n = r.arguments;
|
|
262
|
+
if (t.type === "MemberExpression") {
|
|
263
|
+
if (t.computed || t.property.type !== "Identifier")
|
|
264
|
+
throw new Error(
|
|
265
|
+
"Method calls must use a fixed dot-notation method name"
|
|
266
|
+
);
|
|
267
|
+
const i = t.property.name;
|
|
268
|
+
if (!Y.has(i))
|
|
269
|
+
throw new Error(`Unknown array method: ${i}`);
|
|
270
|
+
const c = o(t.object, e);
|
|
271
|
+
if (!Array.isArray(c))
|
|
272
|
+
throw new Error(`.${i}() can only be called on an array`);
|
|
273
|
+
const [a] = n;
|
|
274
|
+
if (n.length !== 1 || a.type !== "ArrowFunctionExpression")
|
|
275
|
+
throw new Error(
|
|
276
|
+
`.${i}() requires a single arrow-function argument`
|
|
277
|
+
);
|
|
278
|
+
return c[i](
|
|
279
|
+
(l, S) => b(a, [l, S], e)
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
if (t.type !== "Identifier")
|
|
283
|
+
throw new Error(
|
|
284
|
+
"Function calls are only allowed via a bare helper name"
|
|
285
|
+
);
|
|
286
|
+
const s = D[t.name];
|
|
287
|
+
if (typeof s != "function")
|
|
288
|
+
throw new Error(`Unknown helper: ${t.name}`);
|
|
289
|
+
return s(...n.map((i) => o(i, e)));
|
|
290
|
+
}
|
|
291
|
+
default:
|
|
292
|
+
throw new Error(`Unsupported expression type: ${r.type}`);
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
const p = new A(250);
|
|
296
|
+
function h(r) {
|
|
297
|
+
let e = p.get(r);
|
|
298
|
+
return e || (e = w(r), p.set(r, e), e);
|
|
299
|
+
}
|
|
300
|
+
function $(r) {
|
|
301
|
+
if (!r || typeof r != "string")
|
|
302
|
+
return [];
|
|
303
|
+
if (!r.startsWith("{{") || !r.endsWith("}}"))
|
|
304
|
+
return [];
|
|
305
|
+
const e = r.slice(2, -2).trim();
|
|
306
|
+
if (!e)
|
|
307
|
+
return [];
|
|
308
|
+
try {
|
|
309
|
+
return E(h(e));
|
|
310
|
+
} catch (t) {
|
|
311
|
+
return console.error(`Error extracting variables from "${r}":`, t), [];
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
function T(r, e) {
|
|
315
|
+
if (!r || typeof r != "string" || !r.startsWith("{{") || !r.endsWith("}}"))
|
|
316
|
+
return r;
|
|
317
|
+
const t = r.slice(2, -2).trim();
|
|
318
|
+
if (t)
|
|
319
|
+
try {
|
|
320
|
+
return o(h(t), e);
|
|
321
|
+
} catch (n) {
|
|
322
|
+
console.error(`Error parsing expression "${r}":`, n);
|
|
323
|
+
return;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
function j() {
|
|
327
|
+
p.clear();
|
|
328
|
+
}
|
|
329
|
+
function d(r) {
|
|
330
|
+
return typeof r == "string" && r.startsWith("{{") && r.endsWith("}}");
|
|
331
|
+
}
|
|
332
|
+
function F(r) {
|
|
333
|
+
if (!d(r)) return null;
|
|
334
|
+
const e = r.slice(2, -2).trim();
|
|
335
|
+
if (!e)
|
|
336
|
+
return { source: r, content: e, ast: null, error: null, variables: [] };
|
|
337
|
+
try {
|
|
338
|
+
const t = h(e);
|
|
339
|
+
return {
|
|
340
|
+
source: r,
|
|
341
|
+
content: e,
|
|
342
|
+
ast: t,
|
|
343
|
+
error: null,
|
|
344
|
+
variables: E(t)
|
|
345
|
+
};
|
|
346
|
+
} catch (t) {
|
|
347
|
+
return { source: r, content: e, ast: null, error: t, variables: [] };
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
export {
|
|
351
|
+
A as L,
|
|
352
|
+
j as a,
|
|
353
|
+
F as c,
|
|
354
|
+
$ as e,
|
|
355
|
+
d as i,
|
|
356
|
+
T as p,
|
|
357
|
+
g as s
|
|
358
|
+
};
|
|
359
|
+
//# sourceMappingURL=index-DzpRdatr.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DzpRdatr.js","sources":["../../src/lib/ast/cache.ts","../../src/lib/ast/setup.ts","../../src/lib/ast/utils.ts","../../src/lib/ast/helpers.ts","../../src/lib/ast/evaluator.ts","../../src/lib/ast/index.ts"],"sourcesContent":["export class LRUCache<K, V> {\n private cache = new Map<K, V>();\n private maxSize: number;\n\n constructor(maxSize: number) {\n this.maxSize = maxSize;\n }\n\n get(key: K): V | undefined {\n const value = this.cache.get(key);\n if (value !== undefined) {\n this.cache.delete(key);\n this.cache.set(key, value);\n }\n return value;\n }\n\n set(key: K, value: V): void {\n this.cache.delete(key);\n this.cache.set(key, value);\n\n if (this.cache.size > this.maxSize) {\n const { value: firstKey, done } = this.cache.keys().next();\n if (!done) this.cache.delete(firstKey);\n }\n }\n\n clear(): void {\n this.cache.clear();\n }\n}\n","import jsep from \"jsep\";\nimport arrow from \"@jsep-plugin/arrow\";\n\n// Teaches jsep arrow syntax (`a => a.age >= 18`) — the body is still walked by our own evaluate(), never eval'd.\njsep.plugins.register(arrow);\n\nexport default jsep;\n","import type { ASTNode } from \"./types\";\n\n// Blocked even as a literal own-key, since a JSON.parse'd payload can carry one.\nconst FORBIDDEN_KEYS = new Set([\"__proto__\", \"constructor\", \"prototype\"]);\n\n// Null-safe, own-property-only read — blocks prototype-chain escapes from template expressions.\nexport function getOwn(obj: any, key: string | number): any {\n if (obj == null) return undefined;\n if (typeof key === \"string\" && FORBIDDEN_KEYS.has(key)) return undefined;\n if (!Object.prototype.hasOwnProperty.call(obj, key)) return undefined;\n return (obj as any)[key];\n}\n\n// Rebuilds a static dot/bracket path string; returns null for a non-literal computed key (e.g. `items[i].label`).\nexport function staticPath(node: ASTNode): string | null {\n if (node.type === \"Identifier\") return (node as any).name;\n\n if (node.type === \"MemberExpression\") {\n const objectPath = staticPath((node as any).object);\n if (objectPath == null) return null;\n\n const property = (node as any).property;\n if ((node as any).computed) {\n if (property.type !== \"Literal\") return null;\n return `${objectPath}[${JSON.stringify(property.value)}]`;\n }\n if (property.type !== \"Identifier\") return null;\n return `${objectPath}.${property.name}`;\n }\n\n return null;\n}\n\n// Extracts the leading identifier from a static path (\"a.age\" -> \"a\").\nfunction rootOf(path: string): string {\n const match = path.match(/^[^.[]+/);\n return match ? match[0] : path;\n}\n\n// Collects the data paths an expression reads (root identifiers + static member paths); arrow params are\n// tracked in `bound` so they're excluded as locally-scoped, while free variables inside the body still surface.\nexport function extractIdentifiers(node: ASTNode): string[] {\n const identifiers = new Set<string>();\n\n function traverse(n: ASTNode | null | undefined, bound: ReadonlySet<string>) {\n if (!n) return;\n\n switch (n.type) {\n case \"Identifier\": {\n const name = (n as any).name;\n if (!bound.has(name)) identifiers.add(name);\n return;\n }\n\n case \"MemberExpression\": {\n const path = staticPath(n);\n if (path != null) {\n if (!bound.has(rootOf(path))) identifiers.add(path);\n return;\n }\n traverse((n as any).object, bound);\n traverse((n as any).property, bound);\n return;\n }\n\n case \"UnaryExpression\":\n traverse((n as any).argument, bound);\n return;\n\n case \"BinaryExpression\":\n traverse((n as any).left, bound);\n traverse((n as any).right, bound);\n return;\n\n case \"ConditionalExpression\":\n traverse((n as any).test, bound);\n traverse((n as any).consequent, bound);\n traverse((n as any).alternate, bound);\n return;\n\n case \"ArrayExpression\":\n ((n as any).elements as ASTNode[]).forEach((el) => traverse(el, bound));\n return;\n\n case \"CallExpression\": {\n // The callee itself is never a data read; only a MemberExpression callee's object is.\n const callee = (n as any).callee;\n if (callee.type === \"MemberExpression\") {\n traverse(callee.object, bound);\n }\n ((n as any).arguments as ASTNode[]).forEach((arg) => {\n if (arg.type === \"ArrowFunctionExpression\") {\n const withParams = new Set(bound);\n ((arg as any).params as ASTNode[] | null)?.forEach((p) => {\n if (p.type === \"Identifier\") withParams.add((p as any).name);\n });\n traverse((arg as any).body, withParams);\n } else {\n traverse(arg, bound);\n }\n });\n return;\n }\n\n case \"Compound\":\n ((n as any).body as ASTNode[]).forEach((stmt) => traverse(stmt, bound));\n return;\n\n default:\n return;\n }\n }\n\n traverse(node, new Set());\n return Array.from(identifiers);\n}\n","// Formula-language helper registry. Helpers run in SSR/PDF too, so they must be pure and synchronous — no\n// fetch, no clock reads, no randomness — or SSR output stops being a pure function of (template, data).\n\nexport type Helper = (...args: any[]) => any;\n\nconst pad = (n: number, len = 2): string => String(n).padStart(len, \"0\");\n\nfunction toDate(value: any): Date | null {\n const date = value instanceof Date ? value : new Date(value);\n return Number.isNaN(date.getTime()) ? null : date;\n}\n\nfunction toNumber(value: any): number {\n const n = typeof value === \"number\" ? value : parseFloat(value);\n return Number.isNaN(n) ? 0 : n;\n}\n\nfunction flattenNumbers(args: any[]): number[] {\n return args.flat(Infinity).map(toNumber);\n}\n\nexport const helpers: Record<string, Helper> = {\n // Uses UTC getters so SSR and client render the same calendar date regardless of local timezone.\n formatDate(value: any, format: string = \"YYYY-MM-DD\"): string {\n const date = toDate(value);\n if (!date) return \"\";\n\n if (format === \"short\" || format === \"medium\" || format === \"long\" || format === \"full\") {\n return new Intl.DateTimeFormat(\"en-US\", { dateStyle: format, timeZone: \"UTC\" }).format(date);\n }\n\n const tokens: Record<string, string> = {\n YYYY: String(date.getUTCFullYear()),\n MM: pad(date.getUTCMonth() + 1),\n DD: pad(date.getUTCDate()),\n HH: pad(date.getUTCHours()),\n mm: pad(date.getUTCMinutes()),\n ss: pad(date.getUTCSeconds()),\n };\n return format.replace(/YYYY|MM|DD|HH|mm|ss/g, (token) => tokens[token]);\n },\n\n formatCurrency(value: any, currency: string = \"USD\", locale: string = \"en-US\"): string {\n const amount = toNumber(value);\n return new Intl.NumberFormat(locale, { style: \"currency\", currency }).format(amount);\n },\n\n upper(value: any): string {\n return String(value ?? \"\").toUpperCase();\n },\n\n lower(value: any): string {\n return String(value ?? \"\").toLowerCase();\n },\n\n trim(value: any): string {\n return String(value ?? \"\").trim();\n },\n\n concat(...args: any[]): string {\n return args.map((a) => (a ?? \"\")).join(\"\");\n },\n\n join(value: any, separator: string = \", \"): string {\n return Array.isArray(value) ? value.join(separator) : \"\";\n },\n\n default(value: any, fallback: any): any {\n return value == null || value === \"\" ? fallback : value;\n },\n\n length(value: any): number {\n if (typeof value === \"string\" || Array.isArray(value)) return value.length;\n return 0;\n },\n\n count(value: any): number {\n return Array.isArray(value) ? value.length : 0;\n },\n\n sum(value: any): number {\n return Array.isArray(value) ? value.reduce((acc: number, v: any) => acc + toNumber(v), 0) : 0;\n },\n\n min(...args: any[]): number | undefined {\n const nums = flattenNumbers(args);\n return nums.length ? Math.min(...nums) : undefined;\n },\n\n max(...args: any[]): number | undefined {\n const nums = flattenNumbers(args);\n return nums.length ? Math.max(...nums) : undefined;\n },\n\n round(value: any, digits: number = 0): number {\n const factor = 10 ** digits;\n return Math.round(toNumber(value) * factor) / factor;\n },\n};\n","import type { ASTNode } from \"./types\";\nimport { getOwn } from \"./utils\";\nimport { helpers } from \"./helpers\";\n\n// Only these array methods are callable via `.method(lambda)`; anything else is always an error.\nconst ALLOWED_ARRAY_METHODS = new Set([\"map\", \"filter\", \"some\", \"every\", \"find\"]);\n\n// Walks the arrow body with `evaluate()` itself — no real JS function is ever compiled from the lambda.\nfunction callArrow(\n arrow: any,\n args: any[],\n outerData: Record<string, any>,\n): any {\n const scope: Record<string, any> = { ...outerData };\n ((arrow.params as ASTNode[] | null) ?? []).forEach((param, i) => {\n if (param.type === \"Identifier\") scope[(param as any).name] = args[i];\n });\n return evaluate(arrow.body, scope);\n}\n\nexport function evaluate(node: ASTNode, data: Record<string, any>): any {\n switch (node.type) {\n case \"Literal\":\n return (node as any).value;\n\n case \"Identifier\":\n return getOwn(data, (node as any).name);\n\n case \"MemberExpression\": {\n const objectValue = evaluate((node as any).object, data);\n const property = (node as any).property;\n const key = (node as any).computed\n ? evaluate(property, data)\n : (property as any).name;\n return getOwn(objectValue, key);\n }\n\n case \"UnaryExpression\": {\n const argument = evaluate((node as any).argument, data);\n switch ((node as any).operator) {\n case \"!\":\n return !argument;\n case \"-\":\n return -argument;\n case \"+\":\n return +argument;\n case \"~\":\n return ~argument;\n default:\n throw new Error(`Unknown unary operator: ${(node as any).operator}`);\n }\n }\n\n case \"BinaryExpression\": {\n const operator = (node as any).operator as string;\n\n // Short-circuit: right side only evaluated when needed; returns the operand, not a boolean (JS semantics).\n if (operator === \"&&\" || operator === \"||\" || operator === \"??\") {\n const left = evaluate((node as any).left, data);\n const shortCircuits =\n operator === \"&&\"\n ? !left\n : operator === \"||\"\n ? !!left\n : left != null;\n return shortCircuits ? left : evaluate((node as any).right, data);\n }\n\n const left = evaluate((node as any).left, data);\n const right = evaluate((node as any).right, data);\n\n switch (operator) {\n case \"===\":\n return left === right;\n case \"!==\":\n return left !== right;\n case \"==\":\n return left == right;\n case \"!=\":\n return left != right;\n case \"<\":\n return left < right;\n case \">\":\n return left > right;\n case \"<=\":\n return left <= right;\n case \">=\":\n return left >= right;\n case \"+\":\n return left + right;\n case \"-\":\n return left - right;\n case \"*\":\n return left * right;\n case \"/\":\n return left / right;\n case \"%\":\n return left % right;\n case \"**\":\n return left ** right;\n case \"&\":\n return left & right;\n case \"|\":\n return left | right;\n case \"^\":\n return left ^ right;\n case \"<<\":\n return left << right;\n case \">>\":\n return left >> right;\n case \">>>\":\n return left >>> right;\n default:\n throw new Error(`Unknown binary operator: ${operator}`);\n }\n }\n\n case \"ConditionalExpression\": {\n const test = evaluate((node as any).test, data);\n return test\n ? evaluate((node as any).consequent, data)\n : evaluate((node as any).alternate, data);\n }\n\n case \"ArrayExpression\":\n return ((node as any).elements as (ASTNode | null)[]).map((el) =>\n el ? evaluate(el, data) : undefined,\n );\n\n case \"CallExpression\": {\n const callee = (node as any).callee;\n const argNodes = (node as any).arguments as ASTNode[];\n\n // Allowlisted array method + lambda; any other member-access call is rejected before the receiver is touched.\n if (callee.type === \"MemberExpression\") {\n if (callee.computed || callee.property.type !== \"Identifier\") {\n throw new Error(\n \"Method calls must use a fixed dot-notation method name\",\n );\n }\n const methodName = callee.property.name as string;\n if (!ALLOWED_ARRAY_METHODS.has(methodName)) {\n throw new Error(`Unknown array method: ${methodName}`);\n }\n\n const receiver = evaluate(callee.object, data);\n if (!Array.isArray(receiver)) {\n throw new Error(`.${methodName}() can only be called on an array`);\n }\n\n const [arg] = argNodes;\n if (argNodes.length !== 1 || arg.type !== \"ArrowFunctionExpression\") {\n throw new Error(\n `.${methodName}() requires a single arrow-function argument`,\n );\n }\n\n return (receiver as any[])[methodName]((item: any, index: number) =>\n callArrow(arg, [item, index], data),\n );\n }\n\n if (callee.type !== \"Identifier\") {\n throw new Error(\n \"Function calls are only allowed via a bare helper name\",\n );\n }\n\n const helper = helpers[(callee as any).name];\n if (typeof helper !== \"function\") {\n throw new Error(`Unknown helper: ${(callee as any).name}`);\n }\n\n return helper(...argNodes.map((a) => evaluate(a, data)));\n }\n\n default:\n throw new Error(`Unsupported expression type: ${node.type}`);\n }\n}\n","import jsep from \"./setup\";\nimport type { ASTNode } from \"./types\";\nimport { LRUCache } from \"./cache\";\nimport { evaluate } from \"./evaluator\";\nimport { extractIdentifiers } from \"./utils\";\n\nexport type { ASTNode } from \"./types\";\n\nconst astCache = new LRUCache<string, ASTNode>(250);\n\nfunction parseToAST(content: string): ASTNode {\n let ast = astCache.get(content);\n if (ast) {\n return ast;\n }\n\n ast = jsep(content) as ASTNode;\n astCache.set(content, ast);\n return ast;\n}\n\nexport function extractVariables(expr: string): string[] {\n if (!expr || typeof expr !== \"string\") {\n return [];\n }\n\n if (!expr.startsWith(\"{{\") || !expr.endsWith(\"}}\")) {\n return [];\n }\n\n const content = expr.slice(2, -2).trim();\n if (!content) {\n return [];\n }\n\n try {\n return extractIdentifiers(parseToAST(content));\n } catch (error) {\n console.error(`Error extracting variables from \"${expr}\":`, error);\n return [];\n }\n}\n\nexport function parseExpression(expr: string, data: Record<string, any>): any {\n if (!expr || typeof expr !== \"string\") {\n return expr;\n }\n\n if (!expr.startsWith(\"{{\") || !expr.endsWith(\"}}\")) {\n return expr;\n }\n\n const content = expr.slice(2, -2).trim();\n if (!content) {\n return undefined;\n }\n\n try {\n return evaluate(parseToAST(content), data);\n } catch (error) {\n console.error(`Error parsing expression \"${expr}\":`, error);\n return undefined;\n }\n}\n\nexport function clearExpressionCache(): void {\n astCache.clear();\n}\n\n/**\n * The single predicate that decides whether a value is a template expression.\n * `parseExpression` / `extractVariables` / the template compiler must all agree\n * on it — a divergence would silently stop evaluating a prop.\n */\nexport function isExpression(value: unknown): value is string {\n return (\n typeof value === \"string\" && value.startsWith(\"{{\") && value.endsWith(\"}}\")\n );\n}\n\nexport interface CompiledExpression {\n /** The original `{{...}}` source, i.e. what gets handed to `parseExpression`. */\n source: string;\n /** The trimmed inner content, i.e. the raw binding path for a plain path binding. */\n content: string;\n /** Parsed AST, or null for an empty expression or a parse failure. */\n ast: ASTNode | null;\n /** Parse failure, if any. Deferred to evaluation time so logging stays per-render. */\n error: unknown;\n /** Data paths the expression reads. Empty for literal-only expressions. */\n variables: string[];\n}\n\n/**\n * Parses an expression ahead of render. Returns null for anything that isn't a\n * `{{...}}` expression. Never throws: a malformed expression is captured in\n * `error` so the caller can keep `parseExpression`'s per-render error reporting.\n */\nexport function compileExpression(value: unknown): CompiledExpression | null {\n if (!isExpression(value)) return null;\n\n const content = value.slice(2, -2).trim();\n if (!content) {\n return { source: value, content, ast: null, error: null, variables: [] };\n }\n\n try {\n const ast = parseToAST(content);\n return {\n source: value,\n content,\n ast,\n error: null,\n variables: extractIdentifiers(ast),\n };\n } catch (error) {\n return { source: value, content, ast: null, error, variables: [] };\n }\n}\n"],"names":["LRUCache","maxSize","key","value","firstKey","done","jsep","arrow","FORBIDDEN_KEYS","getOwn","obj","staticPath","node","objectPath","property","rootOf","path","match","extractIdentifiers","identifiers","traverse","bound","name","el","callee","arg","withParams","p","stmt","pad","n","len","toDate","date","toNumber","flattenNumbers","args","helpers","format","tokens","token","currency","locale","amount","a","separator","fallback","acc","v","nums","digits","factor","ALLOWED_ARRAY_METHODS","callArrow","outerData","scope","param","evaluate","data","objectValue","argument","operator","left","right","test","argNodes","methodName","receiver","item","index","helper","astCache","parseToAST","content","ast","extractVariables","expr","error","parseExpression","clearExpressionCache","isExpression","compileExpression"],"mappings":";;AAAO,MAAMA,EAAe;AAAA,EAClB,4BAAY,IAAA;AAAA,EACZ;AAAA,EAER,YAAYC,GAAiB;AAC3B,SAAK,UAAUA;AAAA,EACjB;AAAA,EAEA,IAAIC,GAAuB;AACzB,UAAMC,IAAQ,KAAK,MAAM,IAAID,CAAG;AAChC,WAAIC,MAAU,WACZ,KAAK,MAAM,OAAOD,CAAG,GACrB,KAAK,MAAM,IAAIA,GAAKC,CAAK,IAEpBA;AAAA,EACT;AAAA,EAEA,IAAID,GAAQC,GAAgB;AAI1B,QAHA,KAAK,MAAM,OAAOD,CAAG,GACrB,KAAK,MAAM,IAAIA,GAAKC,CAAK,GAErB,KAAK,MAAM,OAAO,KAAK,SAAS;AAClC,YAAM,EAAE,OAAOC,GAAU,MAAAC,EAAA,IAAS,KAAK,MAAM,KAAA,EAAO,KAAA;AACpD,MAAKA,KAAM,KAAK,MAAM,OAAOD,CAAQ;AAAA,IACvC;AAAA,EACF;AAAA,EAEA,QAAc;AACZ,SAAK,MAAM,MAAA;AAAA,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