@lilt-ui/charts 0.11.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,17 +1,38 @@
1
1
  import { createContext as e, useContext as t, useEffect as n, useId as r, useLayoutEffect as i, useMemo as a, useRef as o, useState as s } from "react";
2
- import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
3
- import { AnimatePresence as d, animate as f, motion as p, useMotionValue as m, useMotionValueEvent as h, useReducedMotion as g, useTransform as _ } from "motion/react";
4
- import { extent as v, min as y } from "d3-array";
5
- import { animate as b } from "motion";
6
- import x from "@number-flow/react";
2
+ import { AnimatePresence as c, LazyMotion as l, animate as u, domAnimation as d, m as f, useMotionValue as p, useMotionValueEvent as m, useReducedMotion as h, useTransform as g } from "motion/react";
3
+ import { Fragment as _, jsx as v, jsxs as y } from "react/jsx-runtime";
4
+ import { extent as b, min as x } from "d3-array";
5
+ import { animate as S } from "motion";
6
+ import C from "@number-flow/react";
7
+ //#region src/motion/motion-scope.tsx
8
+ var w, T;
9
+ function E() {
10
+ return T ??= import("./motion-layout-features-CJq3xh5t.js").then((e) => (w = e.domMax, e.domMax)), T;
11
+ }
12
+ function D({ children: e, layout: t = !1 }) {
13
+ let [r, i] = s(w);
14
+ return n(() => {
15
+ if (!t || r) return;
16
+ let e = !0;
17
+ return E().then((t) => {
18
+ e && i(t);
19
+ }), () => {
20
+ e = !1;
21
+ };
22
+ }, [t, r]), /* @__PURE__ */ v(l, {
23
+ features: t && r ? r : d,
24
+ children: e
25
+ });
26
+ }
27
+ //#endregion
7
28
  //#region src/motion/use-chart-motion.ts
8
- var S = [
29
+ var O = [
9
30
  .22,
10
31
  1,
11
32
  .36,
12
33
  1
13
34
  ];
14
- function C(e) {
35
+ function k(e) {
15
36
  let [t, r] = s(!1);
16
37
  return n(() => {
17
38
  if (typeof window > "u" || !window.matchMedia) return;
@@ -19,7 +40,7 @@ function C(e) {
19
40
  return t(), e.addEventListener?.("change", t), () => e.removeEventListener?.("change", t);
20
41
  }, []), e === "none" || t;
21
42
  }
22
- function w(e, t) {
43
+ function ee(e, t) {
23
44
  let [n, r] = s(e.active ? +!!t : 1), a = o(e.key), c = e.active && e.key !== a.current;
24
45
  return i(() => {
25
46
  if (a.current = e.key, !e.active || t) {
@@ -27,14 +48,14 @@ function w(e, t) {
27
48
  return;
28
49
  }
29
50
  r(0);
30
- let n = b(0, 1, {
51
+ let n = S(0, 1, {
31
52
  ...e.spring ? {
32
53
  type: "spring",
33
54
  duration: e.duration / 1e3,
34
55
  bounce: .18
35
56
  } : {
36
57
  duration: e.duration / 1e3,
37
- ease: S
58
+ ease: O
38
59
  },
39
60
  onUpdate: (e) => r(e),
40
61
  onComplete: () => r(1)
@@ -50,15 +71,15 @@ function w(e, t) {
50
71
  }
51
72
  //#endregion
52
73
  //#region src/interaction/pin-glyphs.tsx
53
- var T = "M9 4.5h6l-1 5 3 3v2H7v-2l3-3-1-5ZM12 14.5v7";
54
- function E({ release: e }) {
55
- return /* @__PURE__ */ l("svg", {
74
+ var A = "M9 4.5h6l-1 5 3 3v2H7v-2l3-3-1-5ZM12 14.5v7";
75
+ function j({ release: e }) {
76
+ return /* @__PURE__ */ v("svg", {
56
77
  className: e ? "lilt-chart__pin-glyph lilt-chart__pin-glyph--release" : "lilt-chart__pin-glyph",
57
78
  viewBox: "0 0 24 24",
58
79
  fill: "none",
59
80
  "aria-hidden": "true",
60
- children: /* @__PURE__ */ l("path", {
61
- d: e ? `${T}M4.5 5.5l15 15` : T,
81
+ children: /* @__PURE__ */ v("path", {
82
+ d: e ? `${A}M4.5 5.5l15 15` : A,
62
83
  stroke: "currentColor",
63
84
  strokeLinecap: "round",
64
85
  strokeLinejoin: "round",
@@ -66,22 +87,22 @@ function E({ release: e }) {
66
87
  })
67
88
  });
68
89
  }
69
- function D({ release: e = !1 }) {
70
- return /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l(E, {}), e ? /* @__PURE__ */ l(E, { release: !0 }) : null] });
90
+ function te({ release: e = !1 }) {
91
+ return /* @__PURE__ */ y(_, { children: [/* @__PURE__ */ v(j, {}), e ? /* @__PURE__ */ v(j, { release: !0 }) : null] });
71
92
  }
72
93
  //#endregion
73
94
  //#region src/motion/number-format.ts
74
- var O = /* @__PURE__ */ new WeakMap();
75
- function k(e) {
95
+ var M = /* @__PURE__ */ new WeakMap();
96
+ function ne(e) {
76
97
  let t = (t) => e.format(t);
77
- return O.set(t, e), t;
98
+ return M.set(t, e), t;
78
99
  }
79
- function ee(e) {
80
- return e instanceof Intl.NumberFormat ? e : O.get(e);
100
+ function re(e) {
101
+ return e instanceof Intl.NumberFormat ? e : M.get(e);
81
102
  }
82
103
  //#endregion
83
104
  //#region src/motion/animated-number.tsx
84
- var A = /\p{Decimal_Number}/u, j = /* @__PURE__ */ new Set([
105
+ var N = /\p{Decimal_Number}/u, P = /* @__PURE__ */ new Set([
85
106
  "integer",
86
107
  "group",
87
108
  "decimal",
@@ -89,10 +110,10 @@ var A = /\p{Decimal_Number}/u, j = /* @__PURE__ */ new Set([
89
110
  "nan",
90
111
  "infinity"
91
112
  ]);
92
- function te(e, t) {
113
+ function ie(e, t) {
93
114
  let n = [];
94
115
  if (t?.length && t.map((e) => e.value).join("") === e) {
95
- let e = t.findIndex((e) => j.has(e.type)), r = t.length - 1 - [...t].reverse().findIndex((e) => j.has(e.type)), i = t.filter((e) => e.type === "integer").reduce((e, t) => e + Array.from(t.value).length, 0), a = 0, o = /* @__PURE__ */ new Map();
116
+ let e = t.findIndex((e) => P.has(e.type)), r = t.length - 1 - [...t].reverse().findIndex((e) => P.has(e.type)), i = t.filter((e) => e.type === "integer").reduce((e, t) => e + Array.from(t.value).length, 0), a = 0, o = /* @__PURE__ */ new Map();
96
117
  t.forEach((t, s) => {
97
118
  let c = e < 0 || s < e ? "prefix" : s > r ? "suffix" : "number";
98
119
  for (let e of Array.from(t.value)) {
@@ -108,15 +129,15 @@ function te(e, t) {
108
129
  n.push({
109
130
  key: r,
110
131
  char: e,
111
- digit: A.test(e),
132
+ digit: N.test(e),
112
133
  role: c
113
134
  });
114
135
  }
115
136
  });
116
137
  } else {
117
- let t = Array.from(e), r = t.findIndex((e) => A.test(e)), i = t.length - 1 - [...t].reverse().findIndex((e) => A.test(e));
138
+ let t = Array.from(e), r = t.findIndex((e) => N.test(e)), i = t.length - 1 - [...t].reverse().findIndex((e) => N.test(e));
118
139
  t.forEach((e, a) => {
119
- let o = A.test(e);
140
+ let o = N.test(e);
120
141
  r < 0 || a < r ? n.push({
121
142
  key: `prefix-${a}`,
122
143
  char: e,
@@ -140,37 +161,37 @@ function te(e, t) {
140
161
  place: n.length - 1 - t
141
162
  }));
142
163
  }
143
- function ne(e, t) {
164
+ function ae(e, t) {
144
165
  let [n, r] = String(t).toLowerCase().split("e"), i = n.split(".")[1]?.length ?? 0, a = Number(r ?? 0), o = Math.min(10, Math.max(0, i - a)), s = Number(e.toFixed(o));
145
166
  return Object.is(s, -0) ? 0 : s;
146
167
  }
147
- function re(e, t, n) {
168
+ function oe(e, t, n) {
148
169
  let r = ((t - e) % 10 + 10) % 10;
149
170
  return r === 0 ? e : n > 0 ? e + r : e - (10 - r);
150
171
  }
151
- var ie = 240, M = .16, N = {
172
+ var se = 240, F = .16, I = {
152
173
  duration: .1,
153
174
  ease: "easeOut"
154
- }, P = [
175
+ }, L = [
155
176
  .16,
156
177
  1,
157
178
  .3,
158
179
  1
159
- ], ae = {
180
+ ], ce = {
160
181
  type: "spring",
161
182
  stiffness: 420,
162
183
  damping: 34,
163
184
  mass: .7
164
- }, F = (e) => Math.min(e, 6) * .024;
165
- function I({ cell: e, change: t, style: n }) {
185
+ }, R = (e) => Math.min(e, 6) * .024;
186
+ function z({ cell: e, change: t, style: n }) {
166
187
  let r = n === "slide" ? .72 : 0;
167
- return /* @__PURE__ */ l("span", {
188
+ return /* @__PURE__ */ v("span", {
168
189
  className: "lilt-number__cell",
169
190
  "data-digit": e.digit || void 0,
170
- children: /* @__PURE__ */ l(d, {
191
+ children: /* @__PURE__ */ v(c, {
171
192
  initial: !1,
172
193
  custom: t,
173
- children: /* @__PURE__ */ l(p.span, {
194
+ children: /* @__PURE__ */ v(f.span, {
174
195
  className: "lilt-number__glyph",
175
196
  custom: t,
176
197
  variants: {
@@ -194,7 +215,7 @@ function I({ cell: e, change: t, style: n }) {
194
215
  leave: ({ direction: e, live: t }) => t ? {
195
216
  y: `${-e * r * 55}%`,
196
217
  opacity: 0,
197
- transition: N
218
+ transition: I
198
219
  } : {
199
220
  y: `${-e * r * 100}%`,
200
221
  opacity: 0,
@@ -206,14 +227,14 @@ function I({ cell: e, change: t, style: n }) {
206
227
  animate: "rest",
207
228
  exit: "leave",
208
229
  transition: t.live ? {
209
- duration: M,
210
- ease: P
230
+ duration: F,
231
+ ease: L
211
232
  } : {
212
- delay: F(e.place),
213
- y: ae,
233
+ delay: R(e.place),
234
+ y: ce,
214
235
  default: {
215
236
  duration: .26,
216
- ease: P
237
+ ease: L
217
238
  }
218
239
  },
219
240
  children: e.char
@@ -221,20 +242,20 @@ function I({ cell: e, change: t, style: n }) {
221
242
  })
222
243
  });
223
244
  }
224
- var L = Array.from({ length: 30 }, (e, t) => String(t % 10));
225
- function oe({ cell: e, change: t }) {
226
- let r = Number(e.char), i = m(10 + r), a = o(t);
245
+ var B = Array.from({ length: 30 }, (e, t) => String(t % 10));
246
+ function le({ cell: e, change: t }) {
247
+ let r = Number(e.char), i = p(10 + r), a = o(t);
227
248
  a.current = t, n(() => {
228
249
  let t = i.get();
229
250
  (t < 5 || t >= 25) && (t = 10 + (t % 10 + 10) % 10, i.jump(t));
230
- let { direction: n, live: o } = a.current, s = re(t, r, n);
251
+ let { direction: n, live: o } = a.current, s = oe(t, r, n);
231
252
  if (s === t) return;
232
- let c = f(i, s, {
253
+ let c = u(i, s, {
233
254
  type: "spring",
234
255
  stiffness: o ? 320 : 190,
235
256
  damping: o ? 32 : 26,
236
257
  mass: .9,
237
- delay: o ? 0 : F(e.place),
258
+ delay: o ? 0 : R(e.place),
238
259
  onComplete: () => i.jump(10 + r)
239
260
  });
240
261
  return () => c.stop();
@@ -243,59 +264,59 @@ function oe({ cell: e, change: t }) {
243
264
  r,
244
265
  i
245
266
  ]);
246
- let s = _(i, (e) => `${-e / L.length * 100}%`);
247
- return /* @__PURE__ */ u("span", {
267
+ let s = g(i, (e) => `${-e / B.length * 100}%`);
268
+ return /* @__PURE__ */ y("span", {
248
269
  className: "lilt-number__cell lilt-number__cell--reel",
249
270
  "data-digit": !0,
250
- children: [/* @__PURE__ */ l("span", {
271
+ children: [/* @__PURE__ */ v("span", {
251
272
  className: "lilt-number__glyph lilt-number__sizer",
252
273
  "aria-hidden": "true",
253
274
  children: e.char
254
- }), /* @__PURE__ */ l(p.span, {
275
+ }), /* @__PURE__ */ v(f.span, {
255
276
  className: "lilt-number__reel",
256
277
  style: { y: s },
257
- children: L.map((e, t) => /* @__PURE__ */ l("span", { children: e }, t))
278
+ children: B.map((e, t) => /* @__PURE__ */ v("span", { children: e }, t))
258
279
  })]
259
280
  });
260
281
  }
261
- var se = "0123456789";
262
- function ce({ cell: e, live: t }) {
282
+ var ue = "0123456789";
283
+ function de({ cell: e, live: t }) {
263
284
  let [r, i] = s(null), a = o(e.char), c = o(t);
264
285
  return c.current = t, n(() => {
265
286
  if (a.current === e.char) return;
266
287
  a.current = e.char;
267
288
  let t = 0, n = c.current ? 2 : 5 + Math.min(e.place, 6), r = window.setInterval(() => {
268
- t += 1, i(t >= n ? null : se[Math.floor(Math.random() * 10)]), t >= n && window.clearInterval(r);
289
+ t += 1, i(t >= n ? null : ue[Math.floor(Math.random() * 10)]), t >= n && window.clearInterval(r);
269
290
  }, 36);
270
291
  return () => {
271
292
  window.clearInterval(r), i(null);
272
293
  };
273
- }, [e.char, e.place]), /* @__PURE__ */ l("span", {
294
+ }, [e.char, e.place]), /* @__PURE__ */ v("span", {
274
295
  className: "lilt-number__cell",
275
296
  "data-digit": e.digit || void 0,
276
297
  "data-scrambling": r !== null || void 0,
277
- children: /* @__PURE__ */ l("span", {
298
+ children: /* @__PURE__ */ v("span", {
278
299
  className: "lilt-number__glyph",
279
300
  children: r ?? e.char
280
301
  })
281
302
  });
282
303
  }
283
- function R({ cell: e }) {
284
- return /* @__PURE__ */ l("span", {
304
+ function V({ cell: e }) {
305
+ return /* @__PURE__ */ v("span", {
285
306
  className: "lilt-number__cell",
286
307
  "data-digit": e.digit || void 0,
287
- children: /* @__PURE__ */ l("span", {
308
+ children: /* @__PURE__ */ v("span", {
288
309
  className: "lilt-number__glyph",
289
310
  children: e.char
290
311
  })
291
312
  });
292
313
  }
293
- var z = [
314
+ var H = [
294
315
  .34,
295
316
  1.45,
296
317
  .64,
297
318
  1
298
- ], le = {
319
+ ], fe = {
299
320
  enter: (e) => e ? {
300
321
  y: "16%",
301
322
  opacity: .4,
@@ -310,44 +331,44 @@ var z = [
310
331
  opacity: 1,
311
332
  filter: "blur(0px)"
312
333
  }
313
- }, ue = { leave: (e) => e ? {
334
+ }, pe = { leave: (e) => e ? {
314
335
  y: "-16%",
315
336
  opacity: 0,
316
- transition: N
337
+ transition: I
317
338
  } : {
318
339
  y: "-32%",
319
340
  opacity: 0,
320
341
  filter: "blur(2px)",
321
342
  transition: {
322
343
  duration: .3,
323
- ease: P
344
+ ease: L
324
345
  }
325
346
  } };
326
- function de({ cells: e, live: t }) {
347
+ function me({ cells: e, live: t }) {
327
348
  let n = e.map((e) => e.char).join("");
328
- return /* @__PURE__ */ l("span", {
349
+ return /* @__PURE__ */ v("span", {
329
350
  className: "lilt-number__pop-host",
330
- children: /* @__PURE__ */ l(d, {
351
+ children: /* @__PURE__ */ v(c, {
331
352
  mode: "popLayout",
332
353
  initial: !1,
333
354
  custom: t,
334
- children: /* @__PURE__ */ l(p.span, {
355
+ children: /* @__PURE__ */ v(f.span, {
335
356
  className: "lilt-number__pop",
336
- variants: ue,
357
+ variants: pe,
337
358
  initial: "enter",
338
359
  animate: "visible",
339
360
  exit: "leave",
340
- children: e.map((e, n) => /* @__PURE__ */ l(p.span, {
361
+ children: e.map((e, n) => /* @__PURE__ */ v(f.span, {
341
362
  className: "lilt-number__pop-char",
342
363
  custom: t,
343
- variants: le,
364
+ variants: fe,
344
365
  transition: t ? {
345
366
  duration: .22,
346
- ease: z
367
+ ease: H
347
368
  } : {
348
369
  duration: .5,
349
370
  delay: Math.min(n, 2) * .07,
350
- ease: z
371
+ ease: H
351
372
  },
352
373
  children: e.char
353
374
  }, n))
@@ -355,27 +376,27 @@ function de({ cells: e, live: t }) {
355
376
  })
356
377
  });
357
378
  }
358
- function fe(e, t, r) {
359
- let i = m(e), a = o(r);
379
+ function he(e, t, r) {
380
+ let i = p(e), a = o(r);
360
381
  a.current = r;
361
382
  let [c, l] = s(e);
362
- return h(i, "change", l), n(() => {
383
+ return m(i, "change", l), n(() => {
363
384
  if (!t) {
364
385
  i.jump(e);
365
386
  return;
366
387
  }
367
- let n = f(i, e, {
388
+ let n = u(i, e, {
368
389
  duration: a.current ? .24 : .62,
369
- ease: P
390
+ ease: L
370
391
  });
371
392
  return () => n.stop();
372
393
  }, [
373
394
  t,
374
395
  i,
375
396
  e
376
- ]), t ? ne(c, e) : e;
397
+ ]), t ? ae(c, e) : e;
377
398
  }
378
- function pe(e) {
399
+ function ge(e) {
379
400
  let [t, n] = s({
380
401
  value: e,
381
402
  at: 0,
@@ -388,7 +409,7 @@ function pe(e) {
388
409
  value: e,
389
410
  at: r,
390
411
  direction: e >= t.value ? 1 : -1,
391
- live: r - t.at < ie
412
+ live: r - t.at < se
392
413
  });
393
414
  }
394
415
  return {
@@ -396,58 +417,58 @@ function pe(e) {
396
417
  live: t.live
397
418
  };
398
419
  }
399
- function B({ value: e, format: t = String, className: n, motion: r = "auto", variant: i = "count" }) {
400
- let o = !g() && r !== "none", s = ee(t), f = (e) => t instanceof Intl.NumberFormat ? t.format(e) : t(e), m = (e) => te(f(e), s?.formatToParts(e)), h = i === "flow" && !s ? "slide" : i, _ = a(() => {
420
+ function _e({ value: e, format: t = String, className: n, motion: r = "auto", variant: i = "count" }) {
421
+ let o = !h() && r !== "none", s = re(t), l = (e) => t instanceof Intl.NumberFormat ? t.format(e) : t(e), u = (e) => ie(l(e), s?.formatToParts(e)), d = i === "flow" && !s ? "slide" : i, p = a(() => {
401
422
  if (!s) return;
402
423
  let { locale: e, ...t } = s.resolvedOptions();
403
424
  return {
404
425
  locale: e,
405
426
  options: t
406
427
  };
407
- }, [s]), v = f(e), y = pe(e), b = fe(e, o && h === "count", y.live), S = ["lilt-number", n].filter(Boolean).join(" ");
408
- if (h === "flow" && _) return /* @__PURE__ */ u("span", {
409
- className: S,
428
+ }, [s]), m = l(e), g = ge(e), b = he(e, o && d === "count", g.live), x = ["lilt-number", n].filter(Boolean).join(" ");
429
+ if (d === "flow" && p) return /* @__PURE__ */ y("span", {
430
+ className: x,
410
431
  "data-variant": "flow",
411
- children: [/* @__PURE__ */ l("span", {
432
+ children: [/* @__PURE__ */ v("span", {
412
433
  className: "lilt-chart__sr-only",
413
- children: v
414
- }), /* @__PURE__ */ l("span", {
434
+ children: m
435
+ }), /* @__PURE__ */ v("span", {
415
436
  "aria-hidden": "true",
416
437
  className: "lilt-number__flow",
417
- children: /* @__PURE__ */ l(x, {
438
+ children: /* @__PURE__ */ v(C, {
418
439
  value: e,
419
- locales: _.locale,
420
- format: _.options,
440
+ locales: p.locale,
441
+ format: p.options,
421
442
  animated: o,
422
443
  willChange: !0
423
444
  })
424
445
  })]
425
446
  });
426
- let C = m(h === "count" ? b : e), w = (e) => o ? e.role === "number" ? h === "count" ? /* @__PURE__ */ l(R, { cell: e }) : h === "roll" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ l(oe, {
447
+ let S = u(d === "count" ? b : e), w = (e) => o ? e.role === "number" ? d === "count" ? /* @__PURE__ */ v(V, { cell: e }) : d === "roll" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ v(le, {
427
448
  cell: e,
428
- change: y
429
- }) : /* @__PURE__ */ l(I, {
449
+ change: g
450
+ }) : /* @__PURE__ */ v(z, {
430
451
  cell: e,
431
- change: y,
452
+ change: g,
432
453
  style: "fade"
433
- }) : h === "scramble" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ l(ce, {
454
+ }) : d === "scramble" ? /[0-9]/.test(e.char) ? /* @__PURE__ */ v(de, {
434
455
  cell: e,
435
- live: y.live
436
- }) : /* @__PURE__ */ l(I, {
456
+ live: g.live
457
+ }) : /* @__PURE__ */ v(z, {
437
458
  cell: e,
438
- change: y,
459
+ change: g,
439
460
  style: "fade"
440
- }) : /* @__PURE__ */ l(I, {
461
+ }) : /* @__PURE__ */ v(z, {
441
462
  cell: e,
442
- change: y,
463
+ change: g,
443
464
  style: "slide"
444
- }) : /* @__PURE__ */ l(I, {
465
+ }) : /* @__PURE__ */ v(z, {
445
466
  cell: e,
446
- change: y,
467
+ change: g,
447
468
  style: "fade"
448
- }) : /* @__PURE__ */ l(R, { cell: e }), T = (e) => /* @__PURE__ */ l(p.span, {
469
+ }) : /* @__PURE__ */ v(V, { cell: e }), T = (e) => /* @__PURE__ */ v(f.span, {
449
470
  className: "lilt-number__place",
450
- custom: y.live,
471
+ custom: g.live,
451
472
  initial: o ? {
452
473
  width: 0,
453
474
  opacity: 0
@@ -461,98 +482,101 @@ function B({ value: e, format: t = String, className: n, motion: r = "auto", var
461
482
  opacity: 0
462
483
  } : void 0,
463
484
  transition: {
464
- duration: y.live ? M : .32,
465
- ease: P
485
+ duration: g.live ? F : .32,
486
+ ease: L
466
487
  },
467
488
  children: w(e)
468
- }, e.key), E = h === "pop" && o, D = C.filter((e) => e.role === "prefix"), O = C.filter((e) => e.role === "number"), k = C.filter((e) => e.role === "suffix");
469
- return /* @__PURE__ */ u("span", {
470
- className: S,
489
+ }, e.key), E = d === "pop" && o, D = S.filter((e) => e.role === "prefix"), O = S.filter((e) => e.role === "number"), k = S.filter((e) => e.role === "suffix");
490
+ return /* @__PURE__ */ y("span", {
491
+ className: x,
471
492
  "data-variant": i,
472
- children: [/* @__PURE__ */ l("span", {
493
+ children: [/* @__PURE__ */ v("span", {
473
494
  className: "lilt-chart__sr-only",
474
- children: v
475
- }), /* @__PURE__ */ l("span", {
495
+ children: m
496
+ }), /* @__PURE__ */ v("span", {
476
497
  "aria-hidden": "true",
477
498
  className: "lilt-number__characters",
478
- children: E ? /* @__PURE__ */ u(c, { children: [
479
- /* @__PURE__ */ l(d, {
499
+ children: E ? /* @__PURE__ */ y(_, { children: [
500
+ /* @__PURE__ */ v(c, {
480
501
  initial: !1,
481
502
  children: D.map(T)
482
503
  }),
483
- /* @__PURE__ */ l(de, {
504
+ /* @__PURE__ */ v(me, {
484
505
  cells: O,
485
- live: y.live
506
+ live: g.live
486
507
  }),
487
- /* @__PURE__ */ l(d, {
508
+ /* @__PURE__ */ v(c, {
488
509
  initial: !1,
489
510
  children: k.map(T)
490
511
  })
491
- ] }) : /* @__PURE__ */ l(d, {
512
+ ] }) : /* @__PURE__ */ v(c, {
492
513
  initial: !1,
493
- children: C.map(T)
514
+ children: S.map(T)
494
515
  })
495
516
  })]
496
517
  });
497
518
  }
519
+ function U(e) {
520
+ return /* @__PURE__ */ v(D, { children: /* @__PURE__ */ v(_e, { ...e }) });
521
+ }
498
522
  //#endregion
499
523
  //#region src/cards/range-select.tsx
500
- var V = e(null);
501
- function me({ rangeSelect: e, children: t }) {
502
- return /* @__PURE__ */ l(V.Provider, {
524
+ var W = e(null);
525
+ function ve({ rangeSelect: e, children: t }) {
526
+ return /* @__PURE__ */ v(W.Provider, {
503
527
  value: e ?? null,
504
528
  children: t
505
529
  });
506
530
  }
507
- function he() {
508
- return t(V);
531
+ function ye() {
532
+ return t(W);
509
533
  }
510
- var H = [
534
+ var G = [
511
535
  .23,
512
536
  1,
513
537
  .32,
514
538
  1
515
- ];
516
- function ge({ value: e, options: t, onValueChange: i, "aria-label": a }) {
517
- let c = r(), f = g(), [m, h] = s(!1), _ = Math.max(0, t.findIndex((t) => t.id === e)), [v, y] = s(_), b = o(null), x = o(null), S = o(null), C = t[_], w = (e = _) => {
518
- y(e), h(!0);
539
+ ], be = 30;
540
+ function xe({ value: e, options: t, onValueChange: i, "aria-label": a }) {
541
+ let l = r(), u = h(), [d, p] = s(!1), m = Math.max(0, t.findIndex((t) => t.id === e)), [g, _] = s(m), b = o(null), x = o(null), S = o(null), C = t[m], w = (e = m) => {
542
+ _(e), p(!0);
519
543
  }, T = (e = !0) => {
520
- h(!1), e && x.current?.focus();
544
+ p(!1), e && x.current?.focus();
521
545
  }, E = (n) => {
522
546
  let r = t[n];
523
547
  r && r.id !== e && i(r.id), T();
524
548
  };
525
549
  return n(() => {
526
- if (!m) return;
550
+ if (!d) return;
527
551
  S.current?.focus();
528
552
  let e = (e) => {
529
553
  b.current?.contains(e.target) || T(!1);
530
554
  };
531
555
  return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
532
- }, [m]), /* @__PURE__ */ u("span", {
556
+ }, [d]), /* @__PURE__ */ y("span", {
533
557
  ref: b,
534
558
  className: "lilt-card__range lilt-card__range--select",
535
559
  "data-value": C?.id,
536
- "data-open": m || void 0,
537
- children: [/* @__PURE__ */ u("button", {
560
+ "data-open": d || void 0,
561
+ children: [/* @__PURE__ */ y("button", {
538
562
  ref: x,
539
563
  type: "button",
540
564
  className: "lilt-range-select__trigger",
541
565
  "aria-haspopup": "listbox",
542
- "aria-expanded": m,
543
- "aria-controls": m ? `${c}-list` : void 0,
566
+ "aria-expanded": d,
567
+ "aria-controls": d ? `${l}-list` : void 0,
544
568
  "aria-label": `${a}: ${C?.label ?? ""}`,
545
- onClick: () => m ? T() : w(),
569
+ onClick: () => d ? T() : w(),
546
570
  onKeyDown: (e) => {
547
- (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), w(e.key === "ArrowDown" ? Math.min(t.length - 1, _ + 1) : Math.max(0, _ - 1)));
571
+ (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), w(e.key === "ArrowDown" ? Math.min(t.length - 1, m + 1) : Math.max(0, m - 1)));
548
572
  },
549
- children: [/* @__PURE__ */ l("span", {
573
+ children: [/* @__PURE__ */ v("span", {
550
574
  className: "lilt-range-select__value",
551
- children: /* @__PURE__ */ l(d, {
575
+ children: /* @__PURE__ */ v(c, {
552
576
  mode: "popLayout",
553
577
  initial: !1,
554
- children: /* @__PURE__ */ l(p.span, {
555
- initial: f ? { opacity: 0 } : {
578
+ children: /* @__PURE__ */ v(f.span, {
579
+ initial: u ? { opacity: 0 } : {
556
580
  opacity: 0,
557
581
  y: 4,
558
582
  filter: "blur(3px)"
@@ -562,55 +586,55 @@ function ge({ value: e, options: t, onValueChange: i, "aria-label": a }) {
562
586
  y: 0,
563
587
  filter: "blur(0px)"
564
588
  },
565
- exit: f ? { opacity: 0 } : {
589
+ exit: u ? { opacity: 0 } : {
566
590
  opacity: 0,
567
591
  y: -4,
568
592
  filter: "blur(3px)"
569
593
  },
570
594
  transition: {
571
595
  duration: .2,
572
- ease: H
596
+ ease: G
573
597
  },
574
598
  children: C?.label
575
599
  }, C?.id)
576
600
  })
577
- }), /* @__PURE__ */ l("svg", {
601
+ }), /* @__PURE__ */ v("svg", {
578
602
  "aria-hidden": "true",
579
603
  viewBox: "0 0 12 12",
580
604
  width: "12",
581
605
  height: "12",
582
- children: /* @__PURE__ */ l("path", {
606
+ children: /* @__PURE__ */ v("path", {
583
607
  d: "M3 4.5 6 7.5 9 4.5",
584
608
  fill: "none",
585
609
  stroke: "currentColor",
586
610
  strokeWidth: "1.5"
587
611
  })
588
612
  })]
589
- }), /* @__PURE__ */ l(d, { children: m ? /* @__PURE__ */ l(p.ul, {
613
+ }), /* @__PURE__ */ v(c, { children: d ? /* @__PURE__ */ y(f.ul, {
590
614
  ref: S,
591
- id: `${c}-list`,
615
+ id: `${l}-list`,
592
616
  role: "listbox",
593
617
  tabIndex: -1,
594
618
  "aria-label": a,
595
- "aria-activedescendant": `${c}-option-${v}`,
619
+ "aria-activedescendant": `${l}-option-${g}`,
596
620
  className: "lilt-range-select__list",
597
621
  onKeyDown: (e) => {
598
622
  let n = (n) => {
599
- e.preventDefault(), y(Math.max(0, Math.min(t.length - 1, n)));
623
+ e.preventDefault(), _(Math.max(0, Math.min(t.length - 1, n)));
600
624
  };
601
- if (e.key === "ArrowDown") n(v + 1);
602
- else if (e.key === "ArrowUp") n(v - 1);
625
+ if (e.key === "ArrowDown") n(g + 1);
626
+ else if (e.key === "ArrowUp") n(g - 1);
603
627
  else if (e.key === "Home") n(0);
604
628
  else if (e.key === "End") n(t.length - 1);
605
- else if (e.key === "Enter" || e.key === " ") e.preventDefault(), E(v);
629
+ else if (e.key === "Enter" || e.key === " ") e.preventDefault(), E(g);
606
630
  else if (e.key === "Escape") e.preventDefault(), T();
607
631
  else if (e.key === "Tab") T(!1);
608
632
  else if (e.key.length === 1) {
609
- let r = e.key.toLowerCase(), i = t.findIndex((e, t) => t > v && e.label.toLowerCase().startsWith(r)), a = i >= 0 ? i : t.findIndex((e) => e.label.toLowerCase().startsWith(r));
633
+ let r = e.key.toLowerCase(), i = t.findIndex((e, t) => t > g && e.label.toLowerCase().startsWith(r)), a = i >= 0 ? i : t.findIndex((e) => e.label.toLowerCase().startsWith(r));
610
634
  a >= 0 && n(a);
611
635
  }
612
636
  },
613
- initial: f ? { opacity: 0 } : {
637
+ initial: u ? { opacity: 0 } : {
614
638
  opacity: 0,
615
639
  scale: .96,
616
640
  y: -4,
@@ -622,7 +646,7 @@ function ge({ value: e, options: t, onValueChange: i, "aria-label": a }) {
622
646
  y: 0,
623
647
  filter: "blur(0px)"
624
648
  },
625
- exit: f ? {
649
+ exit: u ? {
626
650
  opacity: 0,
627
651
  transition: { duration: .1 }
628
652
  } : {
@@ -633,124 +657,126 @@ function ge({ value: e, options: t, onValueChange: i, "aria-label": a }) {
633
657
  },
634
658
  transition: {
635
659
  duration: .18,
636
- ease: H
660
+ ease: G
637
661
  },
638
- children: t.map((e, t) => /* @__PURE__ */ u("li", {
639
- id: `${c}-option-${t}`,
662
+ children: [/* @__PURE__ */ v(f.li, {
663
+ role: "presentation",
664
+ "aria-hidden": "true",
665
+ className: "lilt-range-select__highlight",
666
+ initial: !1,
667
+ animate: { y: g * be },
668
+ transition: u ? { duration: 0 } : {
669
+ type: "spring",
670
+ duration: .28,
671
+ bounce: 0
672
+ }
673
+ }), t.map((e, t) => /* @__PURE__ */ y("li", {
674
+ id: `${l}-option-${t}`,
640
675
  role: "option",
641
676
  "data-value": e.id,
642
- "aria-selected": t === _,
677
+ "aria-selected": t === m,
643
678
  className: "lilt-range-select__option",
644
- "data-active": t === v || void 0,
645
- onPointerMove: () => y(t),
679
+ "data-active": t === g || void 0,
680
+ onPointerMove: () => _(t),
646
681
  onClick: () => E(t),
647
- children: [
648
- t === v ? /* @__PURE__ */ l(p.span, {
649
- layoutId: f ? void 0 : `${c}-highlight`,
650
- className: "lilt-range-select__highlight",
651
- transition: {
652
- type: "spring",
653
- duration: .3,
654
- bounce: 0
655
- }
656
- }) : null,
657
- /* @__PURE__ */ l("span", {
658
- className: "lilt-range-select__label",
659
- children: e.label
660
- }),
661
- t === _ ? /* @__PURE__ */ l("svg", {
662
- "aria-hidden": "true",
663
- className: "lilt-range-select__check",
664
- viewBox: "0 0 12 12",
665
- width: "12",
666
- height: "12",
667
- children: /* @__PURE__ */ l("path", {
668
- d: "M2.5 6.5 5 9l4.5-6",
669
- fill: "none",
670
- stroke: "currentColor",
671
- strokeWidth: "1.6"
672
- })
673
- }) : null
674
- ]
675
- }, e.id))
682
+ children: [/* @__PURE__ */ v("span", {
683
+ className: "lilt-range-select__label",
684
+ children: e.label
685
+ }), t === m ? /* @__PURE__ */ v("svg", {
686
+ "aria-hidden": "true",
687
+ className: "lilt-range-select__check",
688
+ viewBox: "0 0 12 12",
689
+ width: "12",
690
+ height: "12",
691
+ children: /* @__PURE__ */ v("path", {
692
+ d: "M2.5 6.5 5 9l4.5-6",
693
+ fill: "none",
694
+ stroke: "currentColor",
695
+ strokeWidth: "1.6"
696
+ })
697
+ }) : null]
698
+ }, e.id))]
676
699
  }) : null })]
677
700
  });
678
701
  }
702
+ function Se(e) {
703
+ return /* @__PURE__ */ v(D, { children: /* @__PURE__ */ v(xe, { ...e }) });
704
+ }
679
705
  //#endregion
680
706
  //#region src/cards/chart-card.tsx
681
- var U = e("count");
682
- function W(...e) {
707
+ var K = e("count");
708
+ function q(...e) {
683
709
  return e.filter(Boolean).join(" ");
684
710
  }
685
- var G = e(null);
686
- function _e({ children: e, surface: n = "elevated", palette: r, motion: i, numberStyle: a = "count", badge: o, className: s, style: c, "aria-label": d, onKeyDown: f }) {
687
- let p = t(G), m = p?.badge ?? o, h = m != null && m !== !1, g = h || p !== null, _ = {
711
+ var J = e(null);
712
+ function Ce({ children: e, surface: n = "elevated", palette: r, motion: i, numberStyle: a = "count", badge: o, className: s, style: c, "aria-label": l, onKeyDown: u }) {
713
+ let d = t(J), f = d?.badge ?? o, p = f != null && f !== !1, m = p || d !== null, h = {
688
714
  "data-lilt-chart": "",
689
715
  "data-lilt-palette": r,
690
716
  "data-motion": i === "none" ? "none" : void 0,
691
717
  style: c
692
- }, v = /* @__PURE__ */ l("section", {
693
- ...g ? { "data-lilt-chart": "" } : _,
718
+ }, g = /* @__PURE__ */ v("section", {
719
+ ...m ? { "data-lilt-chart": "" } : h,
694
720
  "data-surface": n,
695
- "data-tone": p?.tone ?? void 0,
696
- className: W("lilt-card", !g && s),
697
- "aria-label": d,
698
- onKeyDown: f,
699
- children: /* @__PURE__ */ l(G.Provider, {
721
+ "data-tone": d?.tone ?? void 0,
722
+ className: q("lilt-card", !m && s),
723
+ "aria-label": l,
724
+ onKeyDown: u,
725
+ children: /* @__PURE__ */ v(J.Provider, {
700
726
  value: null,
701
727
  children: e
702
728
  })
703
729
  });
704
- return /* @__PURE__ */ l(U.Provider, {
730
+ return /* @__PURE__ */ v(K.Provider, {
705
731
  value: a,
706
- children: g ? /* @__PURE__ */ u("div", {
707
- ..._,
708
- className: W("lilt-card-frame", s),
709
- "data-tabbed": h || void 0,
732
+ children: /* @__PURE__ */ v(D, { children: m ? /* @__PURE__ */ y("div", {
733
+ ...h,
734
+ className: q("lilt-card-frame", s),
735
+ "data-tabbed": p || void 0,
710
736
  children: [
711
- h ? /* @__PURE__ */ l(K, { children: m }) : null,
712
- p?.handle,
713
- v
737
+ p ? /* @__PURE__ */ v(Y, { children: f }) : null,
738
+ d?.handle,
739
+ g
714
740
  ]
715
- }) : v
741
+ }) : g })
716
742
  });
717
743
  }
718
- function K({ children: e, className: t }) {
719
- return /* @__PURE__ */ l("div", {
744
+ function Y({ children: e, className: t }) {
745
+ return /* @__PURE__ */ v("div", {
720
746
  "data-lilt-chart": "",
721
- className: W("lilt-card-badge", t),
747
+ className: q("lilt-card-badge", t),
722
748
  children: e
723
749
  });
724
750
  }
725
- function ve({ children: e, aside: t, className: n }) {
726
- return /* @__PURE__ */ u("header", {
727
- className: W("lilt-card__header", n),
728
- children: [/* @__PURE__ */ l("div", {
751
+ function we({ children: e, aside: t, className: n }) {
752
+ return /* @__PURE__ */ y("header", {
753
+ className: q("lilt-card__header", n),
754
+ children: [/* @__PURE__ */ v("div", {
729
755
  className: "lilt-card__heading",
730
756
  children: e
731
- }), t ? /* @__PURE__ */ l("div", {
757
+ }), t ? /* @__PURE__ */ v("div", {
732
758
  className: "lilt-card__aside",
733
759
  children: t
734
760
  }) : null]
735
761
  });
736
762
  }
737
- function ye({ children: e }) {
738
- return /* @__PURE__ */ l("p", {
763
+ function Te({ children: e }) {
764
+ return /* @__PURE__ */ v("p", {
739
765
  className: "lilt-card__title",
740
766
  children: e
741
767
  });
742
768
  }
743
- function be({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
744
- let o = t(U);
745
- return /* @__PURE__ */ u("div", {
769
+ function Ee({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
770
+ let o = t(K);
771
+ return /* @__PURE__ */ y("div", {
746
772
  className: "lilt-card__value-row",
747
- children: [/* @__PURE__ */ l("strong", {
773
+ children: [/* @__PURE__ */ v("strong", {
748
774
  className: "lilt-card__value",
749
775
  "data-loading": i || void 0,
750
- children: i ? /* @__PURE__ */ l("span", {
776
+ children: i ? /* @__PURE__ */ v("span", {
751
777
  className: "lilt-card__skeleton",
752
778
  "aria-label": "Loading"
753
- }) : e === null ? "—" : /* @__PURE__ */ l(B, {
779
+ }) : e === null ? "—" : /* @__PURE__ */ v(U, {
754
780
  value: e,
755
781
  format: n,
756
782
  variant: o,
@@ -759,24 +785,24 @@ function be({ value: e, format: n, children: r, loading: i = !1, motion: a }) {
759
785
  }), r]
760
786
  });
761
787
  }
762
- var xe = (e) => `${e >= 0 ? "+" : ""}${(e * 100).toFixed(1)}%`;
763
- function Se({ value: e, tone: t = "default", format: n = xe }) {
788
+ var De = (e) => `${e >= 0 ? "+" : ""}${(e * 100).toFixed(1)}%`;
789
+ function Oe({ value: e, tone: t = "default", format: n = De }) {
764
790
  let r = e > 0 ? "up" : e < 0 ? "down" : "flat";
765
- return /* @__PURE__ */ l("span", {
791
+ return /* @__PURE__ */ v("span", {
766
792
  className: "lilt-card__delta",
767
793
  "data-tone": t === "neutral" || r === "flat" ? "neutral" : r === "up" == (t === "default") ? "positive" : "negative",
768
794
  children: n(e)
769
795
  });
770
796
  }
771
- function Ce({ children: e }) {
772
- return /* @__PURE__ */ l("span", {
797
+ function ke({ children: e }) {
798
+ return /* @__PURE__ */ v("span", {
773
799
  className: "lilt-card__caption",
774
800
  children: e
775
801
  });
776
802
  }
777
- function we({ label: e, options: t, value: n, onValueChange: r }) {
778
- let i = he();
779
- if (!t || t.length < 2) return /* @__PURE__ */ l("span", {
803
+ function Ae({ label: e, options: t, value: n, onValueChange: r }) {
804
+ let i = ye();
805
+ if (!t || t.length < 2) return /* @__PURE__ */ v("span", {
780
806
  className: "lilt-card__range",
781
807
  children: e ?? t?.[0]?.label
782
808
  });
@@ -786,33 +812,33 @@ function we({ label: e, options: t, value: n, onValueChange: r }) {
786
812
  onValueChange: (e) => r?.(e),
787
813
  "aria-label": "Period"
788
814
  };
789
- return i ? /* @__PURE__ */ l("span", {
815
+ return i ? /* @__PURE__ */ v("span", {
790
816
  className: "lilt-card__range-slot",
791
- children: /* @__PURE__ */ l(i, { ...a })
792
- }) : /* @__PURE__ */ l(ge, { ...a });
817
+ children: /* @__PURE__ */ v(i, { ...a })
818
+ }) : /* @__PURE__ */ v(Se, { ...a });
793
819
  }
794
820
  //#endregion
795
821
  //#region src/watch/engine/robust.ts
796
- function q(e) {
822
+ function X(e) {
797
823
  if (e.length === 0) return null;
798
824
  let t = [...e].sort((e, t) => e - t), n = t.length >> 1;
799
825
  return t.length % 2 == 1 ? t[n] : (t[n - 1] + t[n]) / 2;
800
826
  }
801
- function Te(e, t) {
802
- let n = q(e.map((e) => Math.abs(e - t)));
827
+ function je(e, t) {
828
+ let n = X(e.map((e) => Math.abs(e - t)));
803
829
  return n === null ? 0 : n * 1.4826;
804
830
  }
805
831
  //#endregion
806
832
  //#region src/watch/engine/normal.ts
807
- var J = 1440, Ee = 256, De = 12;
808
- function Oe({ data: e, x: t, value: n, normal: r }) {
833
+ var Z = 1440, Me = 256, Ne = 12;
834
+ function Pe({ data: e, x: t, value: n, normal: r }) {
809
835
  let i = (e, t) => {
810
836
  let n = e[t];
811
837
  return typeof n == "number" && Number.isFinite(n) ? n : null;
812
838
  }, a = e.map((e) => i(e, n));
813
839
  if (r.around !== void 0 && r.tolerance === void 0) throw Error("Lilt Charts: `normal.around` needs a `tolerance`.");
814
840
  if (r.given !== void 0 && r.learn === void 0) throw Error("Lilt Charts: `normal.given` needs `learn`.");
815
- let o = r.learn === void 0 ? null : Me(r.learn), s = o ? Ne(e, t, o) : null, c = r.given === void 0 ? null : Fe(r.given, e, i), l = /* @__PURE__ */ new Map(), u = [], d = Object.entries(r.rules ?? {}).map(([e, t]) => typeof t == "function" ? {
841
+ let o = r.learn === void 0 ? null : Be(r.learn), s = o ? Ve(e, t, o) : null, c = r.given === void 0 ? null : Ue(r.given, e, i), l = /* @__PURE__ */ new Map(), u = [], d = Object.entries(r.rules ?? {}).map(([e, t]) => typeof t == "function" ? {
816
842
  id: e,
817
843
  test: t
818
844
  } : {
@@ -829,36 +855,36 @@ function Oe({ data: e, x: t, value: n, normal: r }) {
829
855
  h = {
830
856
  lower: e ?? null,
831
857
  upper: t ?? null
832
- }, p && f !== null && (t !== void 0 && f > t && m.push(Y("limit", "max", n, "above", t, f, X(t))), e !== void 0 && f < e && m.push(Y("limit", "min", n, "below", e, f, X(e))));
858
+ }, p && f !== null && (t !== void 0 && f > t && m.push(Q("limit", "max", n, "above", t, f, Fe(t))), e !== void 0 && f < e && m.push(Q("limit", "min", n, "below", e, f, Fe(e))));
833
859
  }
834
860
  if (r.around !== void 0 && r.tolerance !== void 0) {
835
861
  let e = i(t, r.around);
836
862
  if (e !== null) {
837
- let t = ke(r.tolerance, e), n = {
863
+ let t = Ie(r.tolerance, e), n = {
838
864
  lower: e - t,
839
865
  upper: e + t
840
866
  };
841
- if (h = Z(h, n), g = e, p && f !== null) {
867
+ if (h = Le(h, n), g = e, p && f !== null) {
842
868
  let e = r.aroundSeverity ?? "warning";
843
- f > n.upper ? m.push(Y("around", "around", e, "above", n.upper, f, t)) : f < n.lower && m.push(Y("around", "around", e, "below", n.lower, f, t));
869
+ f > n.upper ? m.push(Q("around", "around", e, "above", n.upper, f, t)) : f < n.lower && m.push(Q("around", "around", e, "below", n.lower, f, t));
844
870
  }
845
871
  }
846
872
  }
847
873
  if (o && s) {
848
- let e = Ie(s(t), c ? c(t) : ""), r = e === null ? void 0 : l.get(e), i = r?.values;
874
+ let e = We(s(t), c ? c(t) : ""), r = e === null ? void 0 : l.get(e), i = r?.values;
849
875
  if (r && i && i.length >= o.minSamples) {
850
- let e = q(i);
876
+ let e = X(i);
851
877
  _ = [...r.rows];
852
- let t = u.length >= De ? q(u) * 1.4826 : 0, n = Math.max(Te(i, e), Math.abs(e) * Math.max(t, .02), 1e-9) * o.width, a = {
878
+ let t = u.length >= Ne ? X(u) * 1.4826 : 0, n = Math.max(je(i, e), Math.abs(e) * Math.max(t, .02), 1e-9) * o.width, a = {
853
879
  lower: e - n,
854
880
  upper: e + n
855
881
  };
856
- h = Z(h, a), g = e, p && f !== null && (f > a.upper ? m.push(Y("learned", "learned", o.severity, "above", a.upper, f, n)) : f < a.lower && m.push(Y("learned", "learned", o.severity, "below", a.lower, f, n)));
882
+ h = Le(h, a), g = e, p && f !== null && (f > a.upper ? m.push(Q("learned", "learned", o.severity, "above", a.upper, f, n)) : f < a.lower && m.push(Q("learned", "learned", o.severity, "below", a.lower, f, n)));
857
883
  }
858
884
  if (e !== null && p && f !== null) {
859
885
  if (g !== null && i && i.length >= o.minSamples) {
860
- let e = q(i);
861
- e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length > Ee && u.shift());
886
+ let e = X(i);
887
+ e !== 0 && (u.push(Math.abs(f - e) / Math.abs(e)), u.length > Me && u.shift());
862
888
  }
863
889
  let t = l.get(e) ?? {
864
890
  values: [],
@@ -894,7 +920,7 @@ function Oe({ data: e, x: t, value: n, normal: r }) {
894
920
  };
895
921
  });
896
922
  }
897
- function Y(e, t, n, r, i, a, o) {
923
+ function Q(e, t, n, r, i, a, o) {
898
924
  return {
899
925
  source: e,
900
926
  id: t,
@@ -904,19 +930,19 @@ function Y(e, t, n, r, i, a, o) {
904
930
  score: 1 + Math.abs(a - i) / Math.max(o, 1e-9)
905
931
  };
906
932
  }
907
- var X = (e) => e === 0 ? 1 : Math.abs(e) * .1;
908
- function ke(e, t) {
933
+ var Fe = (e) => e === 0 ? 1 : Math.abs(e) * .1;
934
+ function Ie(e, t) {
909
935
  return typeof e == "number" ? Math.abs(e) : Math.abs(t) * Math.abs(Number.parseFloat(e)) / 100;
910
936
  }
911
- function Z(e, t) {
912
- let n = Ae(e.lower, t.lower), r = je(e.upper, t.upper);
937
+ function Le(e, t) {
938
+ let n = Re(e.lower, t.lower), r = ze(e.upper, t.upper);
913
939
  return n !== null && r !== null && n > r ? e : {
914
940
  lower: n,
915
941
  upper: r
916
942
  };
917
943
  }
918
- var Ae = (e, t) => e === null ? t : t === null ? e : Math.max(e, t), je = (e, t) => e === null ? t : t === null ? e : Math.min(e, t);
919
- function Me(e) {
944
+ var Re = (e, t) => e === null ? t : t === null ? e : Math.max(e, t), ze = (e, t) => e === null ? t : t === null ? e : Math.min(e, t);
945
+ function Be(e) {
920
946
  return {
921
947
  width: 3,
922
948
  history: 8,
@@ -926,7 +952,7 @@ function Me(e) {
926
952
  ...typeof e == "string" ? { period: e } : e
927
953
  };
928
954
  }
929
- function Ne(e, t, n) {
955
+ function Ve(e, t, n) {
930
956
  if (n.period === "all") return () => "all";
931
957
  let r = (e) => {
932
958
  let r = e[t];
@@ -934,7 +960,7 @@ function Ne(e, t, n) {
934
960
  if (typeof r == "number" && Number.isFinite(r)) return r;
935
961
  if (r == null) return null;
936
962
  throw Error(`Lilt Charts: learning by '${n.period}' needs dates or epoch milliseconds in '${t}'.`);
937
- }, i = n.slotMinutes ?? Pe(e.map(r));
963
+ }, i = n.slotMinutes ?? He(e.map(r));
938
964
  return (e) => {
939
965
  let t = r(e);
940
966
  if (t === null) return null;
@@ -942,22 +968,22 @@ function Ne(e, t, n) {
942
968
  return n.period === "week" ? `${a.getUTCDay()}:${s}` : String(s);
943
969
  };
944
970
  }
945
- function Pe(e) {
971
+ function He(e) {
946
972
  let t = e.filter((e) => e !== null), n = [];
947
973
  for (let e = 1; e < t.length; e += 1) {
948
974
  let r = t[e] - t[e - 1];
949
975
  r > 0 && n.push(r);
950
976
  }
951
- let r = q(n);
952
- return r === null ? J : Math.min(J, Math.max(1, Math.round(r / 6e4)));
977
+ let r = X(n);
978
+ return r === null ? Z : Math.min(Z, Math.max(1, Math.round(r / 6e4)));
953
979
  }
954
- function Fe(e, t, n) {
980
+ function Ue(e, t, n) {
955
981
  let { key: r, step: i } = typeof e == "string" ? {
956
982
  key: e,
957
983
  step: void 0
958
984
  } : e, a = i;
959
985
  if (a === void 0) {
960
- let e = t.map((e) => n(e, r)).filter((e) => e !== null), [i, o] = v(e), s = i === void 0 || o === void 0 ? 0 : o - i;
986
+ let e = t.map((e) => n(e, r)).filter((e) => e !== null), [i, o] = b(e), s = i === void 0 || o === void 0 ? 0 : o - i;
961
987
  a = s > 0 ? s / 8 : 1;
962
988
  }
963
989
  return (e) => {
@@ -965,16 +991,16 @@ function Fe(e, t, n) {
965
991
  return t === null ? null : String(Math.floor(t / a));
966
992
  };
967
993
  }
968
- function Ie(e, t) {
994
+ function We(e, t) {
969
995
  return e === null || t === null ? null : t === "" ? e : `${e}|${t}`;
970
996
  }
971
997
  //#endregion
972
998
  //#region src/watch/engine/status.ts
973
- function Le(e, { enter: t = 2, exit: n = 3 } = {}) {
999
+ function Ge(e, { enter: t = 2, exit: n = 3 } = {}) {
974
1000
  let r = [], i = !1, a = null, o = null, s = [], c = 0, l = 0, u = 0, d = 0, f = [];
975
1001
  for (let p of e) {
976
1002
  let e = p.flags.length > 0;
977
- p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a = Re(f), c = Math.max(...f.map((e) => e.score)), s = p.flags, r.push({
1003
+ p.judged && (e || p.value !== null) && (e ? (d = 0, l === 0 && (u = p.index, f = []), l += 1, f.push(p), !i && l >= t ? (i = !0, o = u, a = Ke(f), c = Math.max(...f.map((e) => e.score)), s = p.flags, r.push({
978
1004
  type: "activated",
979
1005
  index: p.index,
980
1006
  severity: a,
@@ -998,10 +1024,10 @@ function Le(e, { enter: t = 2, exit: n = 3 } = {}) {
998
1024
  events: r
999
1025
  };
1000
1026
  }
1001
- var Re = (e) => e.some((e) => e.severity === "critical") ? "critical" : "warning";
1027
+ var Ke = (e) => e.some((e) => e.severity === "critical") ? "critical" : "warning";
1002
1028
  //#endregion
1003
1029
  //#region src/watch/engine/describe.ts
1004
- function ze(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
1030
+ function qe(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
1005
1031
  let r = e.direction === "above";
1006
1032
  switch (e.source) {
1007
1033
  case "limit": return `${r ? "Above max" : "Below min"} ${t(e.bound)}`;
@@ -1012,7 +1038,7 @@ function ze(e, { formatValue: t = String, aroundLabel: n = "reference" } = {}) {
1012
1038
  }
1013
1039
  //#endregion
1014
1040
  //#region src/watch/engine/explain.ts
1015
- function Q(e, t) {
1041
+ function Je(e, t) {
1016
1042
  let n = [.../* @__PURE__ */ new Set([...Object.keys(e), ...Object.keys(t)])], r = [], i = [];
1017
1043
  for (let a of n) {
1018
1044
  let n = e[a], o = t[a];
@@ -1040,11 +1066,11 @@ function Q(e, t) {
1040
1066
  };
1041
1067
  }
1042
1068
  var $ = (e) => typeof e == "number" && Number.isFinite(e);
1043
- function Be({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
1069
+ function Ye({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
1044
1070
  if (!n.length) return null;
1045
1071
  let a = {}, o = {}, s = (e, t, n) => {
1046
1072
  e[t] !== null && (e[t] = n === null ? null : (e[t] ?? 0) + n);
1047
- }, c = y(n) ?? Infinity, l = [];
1073
+ }, c = x(n) ?? Infinity, l = [];
1048
1074
  for (let e = c - 1; e >= 0 && l.length < i; --e) {
1049
1075
  let n = t[e];
1050
1076
  n?.judged && n.value !== null && n.flags.length === 0 && l.push(e);
@@ -1055,12 +1081,12 @@ function Be({ data: e, points: t, indices: n, breakdown: r, fallback: i = 6 }) {
1055
1081
  let c = r(n), u = (t[i]?.basis?.length ? t[i].basis : l).map((t) => r(e[t])), d = /* @__PURE__ */ new Set([...Object.keys(c), ...u.flatMap(Object.keys)]);
1056
1082
  for (let e of d) {
1057
1083
  let t = c[e];
1058
- s(a, e, $(t) ? t : null), s(o, e, q(u.map((t) => t[e]).filter($)));
1084
+ s(a, e, $(t) ? t : null), s(o, e, X(u.map((t) => t[e]).filter($)));
1059
1085
  }
1060
1086
  }
1061
- return Q(a, o);
1087
+ return Je(a, o);
1062
1088
  }
1063
- function Ve(e, { lead: t = .5 } = {}) {
1089
+ function Xe(e, { lead: t = .5 } = {}) {
1064
1090
  if (!e || e.delta === 0) return null;
1065
1091
  let [n, r] = e.parts;
1066
1092
  if (!n || n.share <= 0) return null;
@@ -1069,6 +1095,6 @@ function Ve(e, { lead: t = .5 } = {}) {
1069
1095
  }
1070
1096
  //#endregion
1071
1097
  //#region src/watch/board/report-context.ts
1072
- var He = e(null);
1098
+ var Ze = e(null);
1073
1099
  //#endregion
1074
- export { C, w as S, me as _, ze as a, D as b, K as c, Ce as d, Se as f, be as g, ye as h, Be as i, G as l, we as m, Ve as n, Le as o, ve as p, Q as r, Oe as s, He as t, _e as u, B as v, S as x, k as y };
1100
+ export { k as C, ee as S, ve as _, qe as a, te as b, Y as c, ke as d, Oe as f, Ee as g, Te as h, Ye as i, J as l, Ae as m, Xe as n, Ge as o, we as p, Je as r, Pe as s, Ze as t, Ce as u, U as v, D as w, O as x, ne as y };