@devalok/shilp-sutra 0.48.0 → 0.49.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/BREAKING.json +32 -0
  2. package/MIGRATION.md +891 -881
  3. package/dist/_chunks/badge-group.js +50 -63
  4. package/dist/_chunks/badge-group.js.map +1 -1
  5. package/dist/_chunks/chat.js +1 -1
  6. package/dist/_chunks/chat.js.map +1 -1
  7. package/dist/_chunks/field-state.js +8 -0
  8. package/dist/_chunks/field-state.js.map +1 -0
  9. package/dist/_chunks/popover.js +50 -47
  10. package/dist/_chunks/popover.js.map +1 -1
  11. package/dist/_chunks/primitives.js +155 -155
  12. package/dist/_chunks/primitives.js.map +1 -1
  13. package/dist/_chunks/shared.js +4 -4
  14. package/dist/_chunks/tiptap.js +10 -10
  15. package/dist/_chunks/use-calendar.js +1 -1
  16. package/dist/_chunks/use-calendar.js.map +1 -1
  17. package/dist/_chunks/use-controllable-open.js +15 -0
  18. package/dist/_chunks/use-controllable-open.js.map +1 -0
  19. package/dist/composed/command-palette.js +3 -3
  20. package/dist/composed/command-palette.js.map +1 -1
  21. package/dist/composed/confirm-dialog.js +3 -3
  22. package/dist/composed/confirm-dialog.js.map +1 -1
  23. package/dist/composed/date-picker/index.js +3 -3
  24. package/dist/composed/date-picker/index.js.map +1 -1
  25. package/dist/composed/error-boundary.js +1 -1
  26. package/dist/composed/error-boundary.js.map +1 -1
  27. package/dist/composed/index.d.ts +3 -1
  28. package/dist/composed/index.d.ts.map +1 -1
  29. package/dist/composed/index.js +4 -3
  30. package/dist/composed/loading-skeleton.js +15 -15
  31. package/dist/composed/loading-skeleton.js.map +1 -1
  32. package/dist/composed/page-header.d.ts.map +1 -1
  33. package/dist/composed/page-header.js +32 -45
  34. package/dist/composed/page-header.js.map +1 -1
  35. package/dist/composed/page-skeletons.js +19 -19
  36. package/dist/composed/page-skeletons.js.map +1 -1
  37. package/dist/composed/responsive-modal.d.ts +39 -0
  38. package/dist/composed/responsive-modal.d.ts.map +1 -0
  39. package/dist/composed/responsive-modal.js +212 -0
  40. package/dist/composed/responsive-modal.js.map +1 -0
  41. package/dist/composed/rich-chat-input.js +4 -4
  42. package/dist/composed/rich-text-editor.js +1 -1
  43. package/dist/composed/rich-text-editor.js.map +1 -1
  44. package/dist/composed/schedule-view.d.ts +1 -1
  45. package/dist/composed/schedule-view.d.ts.map +1 -1
  46. package/dist/composed/schedule-view.js +48 -54
  47. package/dist/composed/schedule-view.js.map +1 -1
  48. package/dist/composed/status-badge.d.ts +13 -11
  49. package/dist/composed/status-badge.d.ts.map +1 -1
  50. package/dist/composed/status-badge.js +54 -130
  51. package/dist/composed/status-badge.js.map +1 -1
  52. package/dist/shell/bottom-navbar.js +1 -1
  53. package/dist/shell/bottom-navbar.js.map +1 -1
  54. package/dist/shell/top-bar.js +1 -1
  55. package/dist/shell/top-bar.js.map +1 -1
  56. package/dist/tokens/semantic.css +8 -1
  57. package/dist/ui/accordion.js +9 -9
  58. package/dist/ui/alert-dialog.js +26 -26
  59. package/dist/ui/aspect-ratio.js +1 -1
  60. package/dist/ui/autocomplete.js +7 -7
  61. package/dist/ui/avatar.d.ts.map +1 -1
  62. package/dist/ui/avatar.js +87 -82
  63. package/dist/ui/avatar.js.map +1 -1
  64. package/dist/ui/badge.d.ts.map +1 -1
  65. package/dist/ui/breadcrumb.d.ts +0 -1
  66. package/dist/ui/breadcrumb.d.ts.map +1 -1
  67. package/dist/ui/breadcrumb.js +58 -35
  68. package/dist/ui/breadcrumb.js.map +1 -1
  69. package/dist/ui/button.js +3 -3
  70. package/dist/ui/checkbox.d.ts +4 -2
  71. package/dist/ui/checkbox.d.ts.map +1 -1
  72. package/dist/ui/checkbox.js +33 -28
  73. package/dist/ui/checkbox.js.map +1 -1
  74. package/dist/ui/collapsible.js +4 -4
  75. package/dist/ui/combobox.d.ts +3 -0
  76. package/dist/ui/combobox.d.ts.map +1 -1
  77. package/dist/ui/combobox.js +137 -132
  78. package/dist/ui/combobox.js.map +1 -1
  79. package/dist/ui/context-menu.js +46 -46
  80. package/dist/ui/dialog.d.ts.map +1 -1
  81. package/dist/ui/dialog.js +53 -50
  82. package/dist/ui/dialog.js.map +1 -1
  83. package/dist/ui/dot.d.ts +38 -0
  84. package/dist/ui/dot.d.ts.map +1 -0
  85. package/dist/ui/dot.js +92 -0
  86. package/dist/ui/dot.js.map +1 -0
  87. package/dist/ui/dropdown-menu.d.ts.map +1 -1
  88. package/dist/ui/dropdown-menu.js +70 -65
  89. package/dist/ui/dropdown-menu.js.map +1 -1
  90. package/dist/ui/hover-card.js +11 -11
  91. package/dist/ui/index.d.ts +3 -2
  92. package/dist/ui/index.d.ts.map +1 -1
  93. package/dist/ui/index.js +67 -67
  94. package/dist/ui/index.js.map +1 -1
  95. package/dist/ui/input-otp.js +1 -1
  96. package/dist/ui/input-otp.js.map +1 -1
  97. package/dist/ui/input.d.ts +4 -2
  98. package/dist/ui/input.d.ts.map +1 -1
  99. package/dist/ui/input.js +38 -37
  100. package/dist/ui/input.js.map +1 -1
  101. package/dist/ui/label.js +1 -1
  102. package/dist/ui/lib/field-state.d.ts +21 -0
  103. package/dist/ui/lib/field-state.d.ts.map +1 -0
  104. package/dist/ui/lib/use-controllable-open.d.ts +32 -0
  105. package/dist/ui/lib/use-controllable-open.d.ts.map +1 -0
  106. package/dist/ui/link.js +1 -1
  107. package/dist/ui/number-input.d.ts +4 -2
  108. package/dist/ui/number-input.d.ts.map +1 -1
  109. package/dist/ui/number-input.js +51 -50
  110. package/dist/ui/number-input.js.map +1 -1
  111. package/dist/ui/pagination.js +1 -1
  112. package/dist/ui/popover.d.ts.map +1 -1
  113. package/dist/ui/progress.d.ts +66 -42
  114. package/dist/ui/progress.d.ts.map +1 -1
  115. package/dist/ui/progress.js +144 -40
  116. package/dist/ui/progress.js.map +1 -1
  117. package/dist/ui/radio.d.ts +6 -2
  118. package/dist/ui/radio.d.ts.map +1 -1
  119. package/dist/ui/radio.js +44 -33
  120. package/dist/ui/radio.js.map +1 -1
  121. package/dist/ui/select.d.ts +1 -1
  122. package/dist/ui/select.d.ts.map +1 -1
  123. package/dist/ui/select.js +58 -57
  124. package/dist/ui/select.js.map +1 -1
  125. package/dist/ui/separator.js +2 -2
  126. package/dist/ui/separator.js.map +1 -1
  127. package/dist/ui/sheet.d.ts.map +1 -1
  128. package/dist/ui/sheet.js +59 -56
  129. package/dist/ui/sheet.js.map +1 -1
  130. package/dist/ui/sidebar.js +5 -5
  131. package/dist/ui/sidebar.js.map +1 -1
  132. package/dist/ui/slider.js +6 -6
  133. package/dist/ui/slider.js.map +1 -1
  134. package/dist/ui/stat-card.d.ts.map +1 -1
  135. package/dist/ui/stat-card.js +122 -125
  136. package/dist/ui/stat-card.js.map +1 -1
  137. package/dist/ui/surface.js +1 -1
  138. package/dist/ui/switch.d.ts +3 -1
  139. package/dist/ui/switch.d.ts.map +1 -1
  140. package/dist/ui/switch.js +32 -27
  141. package/dist/ui/switch.js.map +1 -1
  142. package/dist/ui/textarea.d.ts +3 -3
  143. package/dist/ui/textarea.d.ts.map +1 -1
  144. package/dist/ui/textarea.js +18 -17
  145. package/dist/ui/textarea.js.map +1 -1
  146. package/dist/ui/toast.js +2 -2
  147. package/dist/ui/toast.js.map +1 -1
  148. package/dist/ui/toggle-group.js +1 -1
  149. package/dist/ui/toggle.js +1 -1
  150. package/dist/ui/tooltip.d.ts.map +1 -1
  151. package/dist/ui/tooltip.js +36 -33
  152. package/dist/ui/tooltip.js.map +1 -1
  153. package/docs/components/ai/ai-command-provider.md +46 -0
  154. package/docs/components/ai/block-renderer.md +59 -0
  155. package/docs/components/ai/command-bar.md +78 -0
  156. package/docs/components/ai/conversation.md +59 -0
  157. package/docs/components/ai/devadoot-icon.md +41 -0
  158. package/docs/components/composed/page-header.md +1 -1
  159. package/docs/components/composed/responsive-modal.md +66 -0
  160. package/docs/components/composed/schedule-view.md +6 -2
  161. package/docs/components/ui/breadcrumb.md +1 -1
  162. package/docs/components/ui/checkbox.md +4 -1
  163. package/docs/components/ui/combobox.md +4 -0
  164. package/docs/components/ui/dot.md +61 -0
  165. package/docs/components/ui/progress.md +54 -16
  166. package/docs/components/ui/radio.md +6 -2
  167. package/docs/components/ui/select.md +9 -5
  168. package/docs/components/ui/switch.md +4 -1
  169. package/docs/components/ui/table.md +2 -1
  170. package/llms.txt +11 -3
  171. package/make-kit/components/form.md +2 -2
  172. package/make-kit/components/icon.md +2 -2
  173. package/make-kit/components/overview.md +2 -2
  174. package/make-kit/components/select.md +1 -1
  175. package/make-kit/components/table.md +1 -1
  176. package/mcp-manifest.json +2656 -1068
  177. package/mcp-manifest.schema.json +18 -0
  178. package/package.json +11 -6
  179. package/skill/SKILL.md +1 -1
  180. package/skill/references/components.md +11 -3
  181. package/dist/ui/status-dot.d.ts +0 -27
  182. package/dist/ui/status-dot.d.ts.map +0 -1
  183. package/dist/ui/status-dot.js +0 -68
  184. package/dist/ui/status-dot.js.map +0 -1
  185. package/docs/components/ui/status-dot.md +0 -35
@@ -5,15 +5,16 @@ import { cn as r } from "./lib/utils.js";
5
5
  import { Icon as i } from "./icon.js";
6
6
  import { Skeleton as a } from "./skeleton.js";
7
7
  import { t as o } from "../_chunks/normalize-icon.js";
8
- import { Card as s, CardContent as c, CardFooter as ee } from "./card.js";
9
- import { n as l } from "../_chunks/link-context.js";
10
- import { StatFlash as u } from "./stat-flash.js";
11
- import * as d from "react";
12
- import { Fragment as f, jsx as p, jsxs as m } from "react/jsx-runtime";
13
- import { IconMinus as h, IconTrendingDown as g, IconTrendingUp as _ } from "@tabler/icons-react";
14
- import { motion as v } from "framer-motion";
8
+ import { Card as s, CardContent as c, CardFooter as l } from "./card.js";
9
+ import { Progress as u } from "./progress.js";
10
+ import { n as d } from "../_chunks/link-context.js";
11
+ import { StatFlash as f } from "./stat-flash.js";
12
+ import * as p from "react";
13
+ import { Fragment as m, jsx as h, jsxs as g } from "react/jsx-runtime";
14
+ import { IconMinus as _, IconTrendingDown as v, IconTrendingUp as y } from "@tabler/icons-react";
15
+ import { motion as b } from "framer-motion";
15
16
  //#region src/ui/stat-card.tsx
16
- function y(e, t, n) {
17
+ function x(e, t, n) {
17
18
  let r = e.filter((e) => Number.isFinite(e));
18
19
  if (r.length < 2) return "";
19
20
  let i = Math.min(...r), a = Math.max(...r) - i || 1, o = t / (r.length - 1);
@@ -22,41 +23,41 @@ function y(e, t, n) {
22
23
  return `${t === 0 ? "M" : "L"}${r.toFixed(1)},${s.toFixed(1)}`;
23
24
  }).join(" ");
24
25
  }
25
- function b({ data: e, colorClass: t }) {
26
- let n = d.useId(), i = d.useRef(null), [a, o] = d.useState(0), s = y(e, 80, 32);
27
- if (d.useEffect(() => {
26
+ function S({ data: e, colorClass: t }) {
27
+ let n = p.useId(), i = p.useRef(null), [a, o] = p.useState(0), s = x(e, 80, 32);
28
+ if (p.useEffect(() => {
28
29
  i.current && o(i.current.getTotalLength());
29
30
  }, [s]), !s) return null;
30
31
  let c = `${s} L${80 .toFixed(1)},${32 .toFixed(1)} L0,${32 .toFixed(1)} Z`;
31
- return /* @__PURE__ */ m("div", {
32
+ return /* @__PURE__ */ g("div", {
32
33
  className: r("w-20 h-8", t),
33
34
  "aria-hidden": "true",
34
- children: [/* @__PURE__ */ m("svg", {
35
+ children: [/* @__PURE__ */ g("svg", {
35
36
  viewBox: "0 0 80 32",
36
37
  className: "w-full h-full overflow-visible",
37
38
  preserveAspectRatio: "none",
38
39
  children: [
39
- /* @__PURE__ */ p("defs", { children: /* @__PURE__ */ m("linearGradient", {
40
+ /* @__PURE__ */ h("defs", { children: /* @__PURE__ */ g("linearGradient", {
40
41
  id: `sparkline-fill-${n}`,
41
42
  x1: "0",
42
43
  y1: "0",
43
44
  x2: "0",
44
45
  y2: "1",
45
- children: [/* @__PURE__ */ p("stop", {
46
+ children: [/* @__PURE__ */ h("stop", {
46
47
  offset: "0%",
47
48
  stopColor: "currentColor",
48
49
  stopOpacity: "0.1"
49
- }), /* @__PURE__ */ p("stop", {
50
+ }), /* @__PURE__ */ h("stop", {
50
51
  offset: "100%",
51
52
  stopColor: "currentColor",
52
53
  stopOpacity: "0"
53
54
  })]
54
55
  }) }),
55
- /* @__PURE__ */ p("path", {
56
+ /* @__PURE__ */ h("path", {
56
57
  d: c,
57
58
  fill: `url(#sparkline-fill-${n})`
58
59
  }),
59
- /* @__PURE__ */ p("path", {
60
+ /* @__PURE__ */ h("path", {
60
61
  ref: i,
61
62
  d: s,
62
63
  fill: "none",
@@ -72,44 +73,40 @@ function b({ data: e, colorClass: t }) {
72
73
  }
73
74
  })
74
75
  ]
75
- }), a > 0 && /* @__PURE__ */ p("style", { children: `@keyframes sparkline-draw-${n.replace(/:/g, "")} { to { stroke-dashoffset: 0; } }` })]
76
+ }), a > 0 && /* @__PURE__ */ h("style", { children: `@keyframes sparkline-draw-${n.replace(/:/g, "")} { to { stroke-dashoffset: 0; } }` })]
76
77
  });
77
78
  }
78
- function x({ progress: e, label: t }) {
79
- let n = Math.max(0, Math.min(100, e)), i = n >= 90 ? "bg-success-9" : n >= 70 ? "bg-warning-9" : "bg-accent-9";
80
- return /* @__PURE__ */ p("div", {
81
- className: "h-1 w-full rounded-pill bg-surface-raised",
82
- role: "progressbar",
83
- "aria-label": `${t} progress`,
84
- "aria-valuenow": n,
85
- "aria-valuemin": 0,
86
- "aria-valuemax": 100,
87
- children: /* @__PURE__ */ p("div", {
88
- className: r("h-full rounded-pill transition-[width] duration-moderate-02 ease-productive-standard", i),
89
- style: { width: `${n}%` }
79
+ function C({ progress: e, label: t }) {
80
+ let n = Math.max(0, Math.min(100, e)), r = n >= 90 ? "success" : n >= 70 ? "warning" : "accent";
81
+ return /* @__PURE__ */ h(u.Root, {
82
+ value: n,
83
+ size: "sm",
84
+ children: /* @__PURE__ */ h(u.Track, {
85
+ "aria-label": `${t} progress`,
86
+ children: /* @__PURE__ */ h(u.Indicator, { color: r })
90
87
  })
91
88
  });
92
89
  }
93
- var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, suffix: T, delta: E, deltaPlacement: D = "block", icon: O, loading: te, comparisonLabel: k, secondaryLabel: A, progress: j, variant: M = "default", size: N = "md", accentStyle: P = "none", iconFill: F = "soft", flash: I, flashSpeed: L, sparkline: R, onClick: z, href: B, footer: V, ...H }, U) => {
94
- let W = l(), G = S ?? y ?? "", K = (z || B) && !H["aria-label"] ? `View ${G}` : H["aria-label"];
95
- if (te) return /* @__PURE__ */ p(s, {
96
- ref: U,
97
- variant: M,
98
- size: N,
99
- className: d,
90
+ var w = p.forwardRef(({ className: u, label: p, title: x, value: w, prefix: T, suffix: E, delta: D, deltaPlacement: O = "block", icon: k, loading: ee, comparisonLabel: A, secondaryLabel: j, progress: M, variant: N = "default", size: P = "md", accentStyle: F = "none", iconFill: I = "soft", flash: L, flashSpeed: R, sparkline: z, onClick: B, href: V, footer: H, ...U }, W) => {
91
+ let G = d(), K = x ?? p ?? "", q = (B || V) && !U["aria-label"] ? `View ${K}` : U["aria-label"];
92
+ if (ee) return /* @__PURE__ */ h(s, {
93
+ ref: W,
94
+ variant: N,
95
+ size: P,
96
+ className: u,
100
97
  "aria-busy": "true",
101
- ...H,
102
- children: /* @__PURE__ */ m(c, {
98
+ ...U,
99
+ children: /* @__PURE__ */ g(c, {
103
100
  className: "flex flex-col gap-ds-03",
104
101
  children: [
105
- /* @__PURE__ */ p(a, { className: "h-ds-04 w-24 rounded-control-inner" }),
106
- /* @__PURE__ */ p(a, { className: "h-ds-sm w-32" }),
107
- /* @__PURE__ */ p(a, { className: "h-3 w-16 rounded-control-inner" })
102
+ /* @__PURE__ */ h(a, { className: "h-ds-04 w-24 rounded-control-inner" }),
103
+ /* @__PURE__ */ h(a, { className: "h-ds-sm w-32" }),
104
+ /* @__PURE__ */ h(a, { className: "h-3 w-16 rounded-control-inner" })
108
105
  ]
109
106
  })
110
107
  });
111
- let q = E?.direction === "up" ? _ : E?.direction === "down" ? g : h, J = E?.direction === "up" ? "text-success-11" : E?.direction === "down" ? "text-error-11" : "text-surface-fg-muted", Y = E?.direction === "up" ? "text-success-11" : E?.direction === "down" ? "text-error-11" : "text-accent-11", X = E ? /* @__PURE__ */ m(v.div, {
112
- className: r("flex items-center gap-ds-02 text-ds-sm font-medium", J),
108
+ let J = D?.direction === "up" ? y : D?.direction === "down" ? v : _, Y = D?.direction === "up" ? "text-success-11" : D?.direction === "down" ? "text-error-11" : "text-surface-fg-muted", X = D?.direction === "up" ? "text-success-11" : D?.direction === "down" ? "text-error-11" : "text-accent-11", Z = D ? /* @__PURE__ */ g(b.div, {
109
+ className: r("flex items-center gap-ds-02 text-ds-sm font-medium", Y),
113
110
  initial: {
114
111
  opacity: 0,
115
112
  y: 8
@@ -123,7 +120,7 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
123
120
  delay: .2
124
121
  },
125
122
  children: [
126
- /* @__PURE__ */ p(v.span, {
123
+ /* @__PURE__ */ h(b.span, {
127
124
  className: "inline-flex",
128
125
  initial: {
129
126
  opacity: .5,
@@ -134,38 +131,38 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
134
131
  scale: 1
135
132
  },
136
133
  transition: t.smooth,
137
- children: /* @__PURE__ */ p(i, {
138
- icon: q,
134
+ children: /* @__PURE__ */ h(i, {
135
+ icon: J,
139
136
  size: "sm"
140
137
  })
141
138
  }),
142
- /* @__PURE__ */ p("span", { children: E.value }),
143
- k && /* @__PURE__ */ p("span", {
139
+ /* @__PURE__ */ h("span", { children: D.value }),
140
+ A && /* @__PURE__ */ h("span", {
144
141
  className: "text-surface-fg-subtle font-normal",
145
- children: k
142
+ children: A
146
143
  })
147
144
  ]
148
- }) : null, Z = /* @__PURE__ */ m(f, { children: [
149
- /* @__PURE__ */ m("div", {
145
+ }) : null, te = /* @__PURE__ */ g(m, { children: [
146
+ /* @__PURE__ */ g("div", {
150
147
  className: "flex items-center justify-between",
151
- children: [/* @__PURE__ */ p(v.p, {
148
+ children: [/* @__PURE__ */ h(b.p, {
152
149
  className: "text-ds-md font-medium text-surface-fg-muted",
153
150
  initial: { opacity: 0 },
154
151
  animate: { opacity: 1 },
155
152
  transition: n.fade,
156
- children: G
157
- }), /* @__PURE__ */ m("div", {
153
+ children: K
154
+ }), /* @__PURE__ */ g("div", {
158
155
  className: "flex items-center gap-ds-03",
159
- children: [R && R.length >= 2 && /* @__PURE__ */ p(b, {
160
- data: R,
161
- colorClass: Y
162
- }), O && I ? /* @__PURE__ */ p(u, {
163
- icon: O,
164
- flash: I,
165
- fill: F,
166
- speed: L
167
- }) : O ? P === "icon" ? /* @__PURE__ */ p(v.span, {
168
- className: r("inline-flex items-center justify-center rounded-control p-ds-02", F === "solid" ? "bg-accent-9 text-accent-fg" : "bg-accent-3 text-accent-11"),
156
+ children: [z && z.length >= 2 && /* @__PURE__ */ h(S, {
157
+ data: z,
158
+ colorClass: X
159
+ }), k && L ? /* @__PURE__ */ h(f, {
160
+ icon: k,
161
+ flash: L,
162
+ fill: I,
163
+ speed: R
164
+ }) : k ? F === "icon" ? /* @__PURE__ */ h(b.span, {
165
+ className: r("inline-flex items-center justify-center rounded-control p-ds-02", I === "solid" ? "bg-accent-9 text-accent-fg" : "bg-accent-3 text-accent-11"),
169
166
  initial: {
170
167
  opacity: 0,
171
168
  scale: .96
@@ -176,11 +173,11 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
176
173
  },
177
174
  transition: t.snappy,
178
175
  "aria-hidden": "true",
179
- children: /* @__PURE__ */ p(e, {
176
+ children: /* @__PURE__ */ h(e, {
180
177
  size: "md",
181
- children: o(O, "md")
178
+ children: o(k, "md")
182
179
  })
183
- }) : /* @__PURE__ */ p(v.span, {
180
+ }) : /* @__PURE__ */ h(b.span, {
184
181
  className: "text-surface-fg-muted",
185
182
  initial: {
186
183
  opacity: 0,
@@ -192,21 +189,21 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
192
189
  },
193
190
  transition: t.snappy,
194
191
  "aria-hidden": "true",
195
- children: /* @__PURE__ */ p(e, {
192
+ children: /* @__PURE__ */ h(e, {
196
193
  size: "lg",
197
- children: o(O, "lg")
194
+ children: o(k, "lg")
198
195
  })
199
196
  }) : null]
200
197
  })]
201
198
  }),
202
- /* @__PURE__ */ m("div", {
199
+ /* @__PURE__ */ g("div", {
203
200
  className: "flex flex-col gap-ds-01",
204
- children: [/* @__PURE__ */ m("div", {
205
- className: r(D === "inline" && E && "flex items-baseline gap-ds-03"),
206
- children: [/* @__PURE__ */ p("div", {
201
+ children: [/* @__PURE__ */ g("div", {
202
+ className: r(O === "inline" && D && "flex items-baseline gap-ds-03"),
203
+ children: [/* @__PURE__ */ h("div", {
207
204
  className: "overflow-hidden",
208
- children: /* @__PURE__ */ m(v.p, {
209
- className: r("inline-block font-semibold", N === "sm" ? "text-ds-2xl" : "text-ds-3xl", P === "tint" ? "text-accent-11" : "text-surface-fg"),
205
+ children: /* @__PURE__ */ g(b.p, {
206
+ className: r("inline-block font-semibold", P === "sm" ? "text-ds-2xl" : "text-ds-3xl", F === "tint" ? "text-accent-11" : "text-surface-fg"),
210
207
  initial: {
211
208
  opacity: 0,
212
209
  y: "100%"
@@ -217,22 +214,22 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
217
214
  },
218
215
  transition: t.smooth,
219
216
  children: [
220
- w && /* @__PURE__ */ p("span", {
221
- className: r("text-surface-fg-muted", N === "sm" ? "text-ds-md" : "text-ds-lg"),
222
- children: w
217
+ T && /* @__PURE__ */ h("span", {
218
+ className: r("text-surface-fg-muted", P === "sm" ? "text-ds-md" : "text-ds-lg"),
219
+ children: T
223
220
  }),
224
- /* @__PURE__ */ p("span", {
221
+ /* @__PURE__ */ h("span", {
225
222
  className: "tabular-nums",
226
- children: C
223
+ children: w
227
224
  }),
228
- T && /* @__PURE__ */ p("span", {
229
- className: r("text-surface-fg-muted", N === "sm" ? "text-ds-md" : "text-ds-lg"),
230
- children: T
225
+ E && /* @__PURE__ */ h("span", {
226
+ className: r("text-surface-fg-muted", P === "sm" ? "text-ds-md" : "text-ds-lg"),
227
+ children: E
231
228
  })
232
229
  ]
233
230
  })
234
- }), D === "inline" && X]
235
- }), A && /* @__PURE__ */ p(v.p, {
231
+ }), O === "inline" && Z]
232
+ }), j && /* @__PURE__ */ h(b.p, {
236
233
  className: "text-ds-sm text-surface-fg-subtle",
237
234
  initial: { opacity: 0 },
238
235
  animate: { opacity: 1 },
@@ -240,31 +237,31 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
240
237
  ...n.fade,
241
238
  delay: .1
242
239
  },
243
- children: A
240
+ children: j
244
241
  })]
245
242
  }),
246
- j != null && /* @__PURE__ */ p(v.div, {
243
+ M != null && /* @__PURE__ */ h(b.div, {
247
244
  initial: { opacity: 0 },
248
245
  animate: { opacity: 1 },
249
246
  transition: {
250
247
  ...n.fade,
251
248
  delay: .15
252
249
  },
253
- children: /* @__PURE__ */ p(x, {
254
- progress: j,
255
- label: G
250
+ children: /* @__PURE__ */ h(C, {
251
+ progress: M,
252
+ label: K
256
253
  })
257
254
  }),
258
- D === "block" && X
259
- ] }), Q = P === "tint" ? "bg-linear-to-t from-accent-2 to-surface-raised" : void 0, $ = /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p(c, {
255
+ O === "block" && Z
256
+ ] }), Q = F === "tint" ? "bg-linear-to-t from-accent-2 to-surface-raised" : void 0, $ = /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h(c, {
260
257
  className: "flex flex-col gap-ds-03",
261
- children: Z
262
- }), V && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
258
+ children: te
259
+ }), H && /* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("div", {
263
260
  "aria-hidden": "true",
264
261
  className: "h-px w-full bg-surface-border-subtle"
265
- }), /* @__PURE__ */ p(ee, {
262
+ }), /* @__PURE__ */ h(l, {
266
263
  className: "text-ds-sm",
267
- children: /* @__PURE__ */ p(v.div, {
264
+ children: /* @__PURE__ */ h(b.div, {
268
265
  className: "w-full",
269
266
  initial: { opacity: 0 },
270
267
  animate: { opacity: 1 },
@@ -272,47 +269,47 @@ var S = d.forwardRef(({ className: d, label: y, title: S, value: C, prefix: w, s
272
269
  ...n.fade,
273
270
  delay: .25
274
271
  },
275
- children: V
272
+ children: H
276
273
  })
277
274
  })] })] });
278
- return B ? /* @__PURE__ */ p(W, {
279
- ref: U,
280
- href: B,
281
- onClick: z,
275
+ return V ? /* @__PURE__ */ h(G, {
276
+ ref: W,
277
+ href: V,
278
+ onClick: B,
282
279
  className: "block no-underline",
283
- "aria-label": K,
284
- ...H,
285
- children: /* @__PURE__ */ p(s, {
286
- variant: M,
287
- size: N,
280
+ "aria-label": q,
281
+ ...U,
282
+ children: /* @__PURE__ */ h(s, {
283
+ variant: N,
284
+ size: P,
288
285
  interactive: !0,
289
286
  className: Q,
290
287
  children: $
291
288
  })
292
- }) : z ? /* @__PURE__ */ p(s, {
293
- ref: U,
294
- variant: M,
295
- size: N,
289
+ }) : B ? /* @__PURE__ */ h(s, {
290
+ ref: W,
291
+ variant: N,
292
+ size: P,
296
293
  interactive: !0,
297
- className: r(Q, d),
294
+ className: r(Q, u),
298
295
  role: "button",
299
296
  tabIndex: 0,
300
- "aria-label": K,
301
- onClick: z,
297
+ "aria-label": q,
298
+ onClick: B,
302
299
  onKeyDown: (e) => {
303
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), z());
300
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), B());
304
301
  },
305
- ...H,
302
+ ...U,
306
303
  children: $
307
- }) : /* @__PURE__ */ p(s, {
308
- ref: U,
309
- variant: M,
310
- size: N,
311
- className: r(Q, d),
312
- ...H,
304
+ }) : /* @__PURE__ */ h(s, {
305
+ ref: W,
306
+ variant: N,
307
+ size: P,
308
+ className: r(Q, u),
309
+ ...U,
313
310
  children: $
314
311
  });
315
312
  });
316
- S.displayName = "StatCard";
313
+ w.displayName = "StatCard";
317
314
  //#endregion
318
- export { S as StatCard };
315
+ export { w as StatCard };
@@ -1 +1 @@
1
- {"version":3,"file":"stat-card.js","names":[],"sources":["../../src/ui/stat-card.tsx"],"sourcesContent":["'use client'\n\nimport { IconMinus, IconTrendingDown, IconTrendingUp } from '@tabler/icons-react'\nimport { motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { Card, CardContent, CardFooter, type CardSize } from './card'\nimport { Icon } from './icon'\nimport { IconProvider } from './icon-context'\nimport type { IconInput } from './lib/icon-input'\nimport { useLink } from './lib/link-context'\nimport { springs, tweens } from './lib/motion'\nimport { normalizeIcon } from './lib/normalize-icon'\nimport { cn } from './lib/utils'\nimport { Skeleton } from './skeleton'\nimport { type FlashPreset, type FlashSpec, type FlashSpeed,StatFlash } from './stat-flash'\n\n/**\n * Props for StatCard — a dashboard metric tile displaying a label, a large numeric value,\n * an optional trend delta (with directional arrow icon), and an optional header icon.\n *\n * **Surface:** delegated to `Card` via `variant` — `default` (ring-in-shadow, no border) |\n * `elevated` | `outline` (border, no shadow) | `flat`. StatCard composes `<Card>`, so the surface,\n * padding (gap model), and elevation all live in one place.\n *\n * **Accent:** `accentStyle=\"none\"` (default) is neutral; `\"icon\"` wraps `icon` in an accent chip\n * (`iconFill=\"soft\" | \"solid\"`); `\"tint\"` applies a subtle accent surface wash + accent value.\n * (Replaces the removed `accent` left-rail prop — see CHANGELOG migration.)\n *\n * **Delta direction:** `'up'` renders a green trending-up arrow, `'down'` renders a red\n * trending-down arrow, `'neutral'` renders a grey dash. The `delta.value` is a formatted\n * string (e.g. `\"+8%\"` or `\"−120\"`).\n *\n * **Loading state:** Pass `loading={true}` to render a pulse-skeleton placeholder instead of data.\n *\n * @example\n * // Revenue metric with a positive trend:\n * <StatCard\n * label=\"Monthly Revenue\"\n * value=\"$48,200\"\n * delta={{ value: \"+12%\", direction: \"up\" }}\n * icon={<IconCurrencyDollar />}\n * />\n *\n * @example\n * // Open ticket count with a downward trend (good for support queues):\n * <StatCard\n * label=\"Open Tickets\"\n * value={142}\n * delta={{ value: \"−18\", direction: \"down\" }}\n * />\n *\n * @example\n * // Loading skeleton while data is fetching:\n * <StatCard label=\"Users\" value={0} loading={isFetching} />\n *\n * @example\n * // Simple metric with no trend (stable, neutral):\n * <StatCard\n * label=\"Storage Used\"\n * value=\"4.2 GB\"\n * delta={{ value: \"No change\", direction: \"neutral\" }}\n * />\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Heading text for the metric. `title` is an alias for `label`. */\n label?: string\n /** Alias for `label` — use whichever feels natural. */\n title?: string\n value: string | number\n /** Prefix before value, e.g. \"$\" */\n prefix?: string\n /** Suffix after value, e.g. \"users\" */\n suffix?: string\n delta?: {\n value: string\n direction: 'up' | 'down' | 'neutral'\n }\n /** Where the delta sits relative to the value: `block` (below — default) or `inline` (on the value's baseline, to its right). @default 'block' */\n deltaPlacement?: 'block' | 'inline'\n icon?: IconInput\n loading?: boolean\n /** Comparison period label shown after delta, e.g. \"vs last month\" */\n comparisonLabel?: string\n /** Secondary metric below main value, e.g. \"of $50,000 target\" */\n secondaryLabel?: string\n /** Progress toward a target (0-100). Renders a thin progress bar below the value. */\n progress?: number\n /** Surface variant, delegated to Card: `default` (ring-in-shadow) | `elevated` | `outline` (border, no shadow) | `flat`. @default 'default' */\n variant?: 'default' | 'elevated' | 'outline' | 'flat'\n /**\n * Tile density, delegated to Card's size axis. `sm` tightens padding to 16px and steps\n * the value down to `text-ds-2xl` — use it for dense KPI rows and narrow stat grids\n * (e.g. stat-row's 140px tiles). @default 'md'\n */\n size?: CardSize\n /** How the brand accent reads: `none` (neutral — default), `icon` (accent chip around `icon`), or `tint` (subtle accent surface wash + accent value). */\n accentStyle?: 'none' | 'icon' | 'tint'\n /** When `accentStyle=\"icon\"`: `soft` (tinted chip) or `solid` (filled accent chip). @default 'soft' */\n iconFill?: 'soft' | 'solid'\n /**\n * Opt-in entrance flash: the icon chip mounts showing a transient state (e.g. a green up-arrow)\n * then settles to `icon`. A preset (`'up' | 'down' | 'goal' | 'record' | 'alert' | 'live'`) or an\n * explicit `{ tone, icon }`. Requires `icon`; implies the icon chip. Off by default.\n */\n flash?: FlashPreset | FlashSpec\n /** Speed of the entrance flash: `fast` | `normal` | `slow`. @default 'normal' */\n flashSpeed?: FlashSpeed\n /** Sparkline data points. Renders a mini SVG line chart in the card. */\n sparkline?: number[]\n /** Make the card clickable with hover state */\n onClick?: () => void\n /** Href — makes the card a link (uses the LinkContext Link component) */\n href?: string\n /** Footer content rendered below the card body, e.g. \"View details →\" */\n footer?: React.ReactNode\n}\n\nfunction buildSparklinePath(raw: number[], width: number, height: number): string {\n const data = raw.filter((v) => Number.isFinite(v))\n if (data.length < 2) return ''\n const min = Math.min(...data)\n const max = Math.max(...data)\n const range = max - min || 1\n const stepX = width / (data.length - 1)\n return data\n .map((v, i) => {\n const x = i * stepX\n const y = height - ((v - min) / range) * height\n return `${i === 0 ? 'M' : 'L'}${x.toFixed(1)},${y.toFixed(1)}`\n })\n .join(' ')\n}\n\nfunction Sparkline({\n data,\n colorClass,\n}: {\n data: number[]\n colorClass: string\n}) {\n const id = React.useId()\n const pathRef = React.useRef<SVGPathElement>(null)\n const [pathLength, setPathLength] = React.useState(0)\n const svgWidth = 80\n const svgHeight = 32\n const path = buildSparklinePath(data, svgWidth, svgHeight)\n\n React.useEffect(() => {\n if (pathRef.current) {\n setPathLength(pathRef.current.getTotalLength())\n }\n }, [path])\n\n if (!path) return null\n\n // Build area fill path (close to bottom-right then bottom-left)\n const areaPath = `${path} L${svgWidth.toFixed(1)},${svgHeight.toFixed(1)} L0,${svgHeight.toFixed(1)} Z`\n\n return (\n <div className={cn('w-20 h-8', colorClass)} aria-hidden=\"true\">\n <svg\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"w-full h-full overflow-visible\"\n preserveAspectRatio=\"none\"\n >\n <defs>\n <linearGradient id={`sparkline-fill-${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"currentColor\" stopOpacity=\"0.1\" />\n <stop offset=\"100%\" stopColor=\"currentColor\" stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n <path d={areaPath} fill={`url(#sparkline-fill-${id})`} />\n <path\n ref={pathRef}\n d={path}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{\n opacity: pathLength === 0 ? 0 : 1,\n strokeDasharray: pathLength,\n strokeDashoffset: pathLength,\n animation: pathLength > 0 ? `sparkline-draw-${id.replace(/:/g, '')} 1s ease-out forwards` : 'none',\n }}\n />\n </svg>\n {pathLength > 0 && (\n <style>{`@keyframes sparkline-draw-${id.replace(/:/g, '')} { to { stroke-dashoffset: 0; } }`}</style>\n )}\n </div>\n )\n}\n\nfunction ProgressBar({ progress, label }: { progress: number; label: string }) {\n const clamped = Math.max(0, Math.min(100, progress))\n const barColor =\n clamped >= 90 ? 'bg-success-9' : clamped >= 70 ? 'bg-warning-9' : 'bg-accent-9'\n\n return (\n <div className=\"h-1 w-full rounded-pill bg-surface-raised\" role=\"progressbar\" aria-label={`${label} progress`} aria-valuenow={clamped} aria-valuemin={0} aria-valuemax={100}>\n <div\n className={cn('h-full rounded-pill transition-[width] duration-moderate-02 ease-productive-standard', barColor)}\n style={{ width: `${clamped}%` }}\n />\n </div>\n )\n}\n\nconst StatCard = React.forwardRef<HTMLDivElement, StatCardProps>(\n (\n {\n className,\n label,\n title,\n value,\n prefix,\n suffix,\n delta,\n deltaPlacement = 'block',\n icon,\n loading,\n comparisonLabel,\n secondaryLabel,\n progress,\n variant = 'default',\n size = 'md',\n accentStyle = 'none',\n iconFill = 'soft',\n flash,\n flashSpeed,\n sparkline,\n onClick,\n href,\n footer,\n ...props\n },\n ref,\n ) => {\n const Link = useLink()\n const resolvedLabel = title ?? label ?? ''\n const isClickable = !!(onClick || href)\n const computedAriaLabel =\n isClickable && !props['aria-label'] ? `View ${resolvedLabel}` : props['aria-label']\n\n if (loading) {\n return (\n <Card ref={ref} variant={variant} size={size} className={className} aria-busy=\"true\" {...props}>\n <CardContent className=\"flex flex-col gap-ds-03\">\n <Skeleton className=\"h-ds-04 w-24 rounded-control-inner\" />\n <Skeleton className=\"h-ds-sm w-32\" />\n <Skeleton className=\"h-3 w-16 rounded-control-inner\" />\n </CardContent>\n </Card>\n )\n }\n\n const DeltaIcon =\n delta?.direction === 'up'\n ? IconTrendingUp\n : delta?.direction === 'down'\n ? IconTrendingDown\n : IconMinus\n\n const deltaColour =\n delta?.direction === 'up'\n ? 'text-success-11'\n : delta?.direction === 'down'\n ? 'text-error-11'\n : 'text-surface-fg-muted'\n\n const sparklineColor =\n delta?.direction === 'up'\n ? 'text-success-11'\n : delta?.direction === 'down'\n ? 'text-error-11'\n : 'text-accent-11'\n\n const deltaNode = delta ? (\n <motion.div\n className={cn(\n // Rhythm comes from CardContent's flex gap — no placement margins.\n 'flex items-center gap-ds-02 text-ds-sm font-medium',\n deltaColour,\n )}\n initial={{ opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ ...springs.smooth, delay: 0.2 }}\n >\n <motion.span\n className=\"inline-flex\"\n initial={{ opacity: 0.5, scale: 1.4 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.smooth}\n >\n <Icon icon={DeltaIcon} size=\"sm\" />\n </motion.span>\n <span>{delta.value}</span>\n {comparisonLabel && (\n <span className=\"text-surface-fg-subtle font-normal\">{comparisonLabel}</span>\n )}\n </motion.div>\n ) : null\n\n const cardContent = (\n <>\n <div className=\"flex items-center justify-between\">\n <motion.p\n className=\"text-ds-md font-medium text-surface-fg-muted\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={tweens.fade}\n >\n {resolvedLabel}\n </motion.p>\n <div className=\"flex items-center gap-ds-03\">\n {sparkline && sparkline.length >= 2 && (\n <Sparkline data={sparkline} colorClass={sparklineColor} />\n )}\n {icon && flash ? (\n <StatFlash icon={icon} flash={flash} fill={iconFill} speed={flashSpeed} />\n ) : icon ? (\n accentStyle === 'icon' ? (\n <motion.span\n className={cn(\n 'inline-flex items-center justify-center rounded-control p-ds-02',\n iconFill === 'solid'\n ? 'bg-accent-9 text-accent-fg'\n : 'bg-accent-3 text-accent-11',\n )}\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.snappy}\n aria-hidden=\"true\"\n >\n <IconProvider size=\"md\">{normalizeIcon(icon, 'md')}</IconProvider>\n </motion.span>\n ) : (\n <motion.span\n className=\"text-surface-fg-muted\"\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.snappy}\n aria-hidden=\"true\"\n >\n <IconProvider size=\"lg\">{normalizeIcon(icon, 'lg')}</IconProvider>\n </motion.span>\n )\n ) : null}\n </div>\n </div>\n <div className=\"flex flex-col gap-ds-01\">\n <div className={cn(deltaPlacement === 'inline' && delta && 'flex items-baseline gap-ds-03')}>\n <div className=\"overflow-hidden\">\n <motion.p\n className={cn(\n 'inline-block font-semibold',\n size === 'sm' ? 'text-ds-2xl' : 'text-ds-3xl',\n accentStyle === 'tint' ? 'text-accent-11' : 'text-surface-fg',\n )}\n initial={{ opacity: 0, y: '100%' }}\n animate={{ opacity: 1, y: 0 }}\n transition={springs.smooth}\n >\n {prefix && (\n <span className={cn('text-surface-fg-muted', size === 'sm' ? 'text-ds-md' : 'text-ds-lg')}>{prefix}</span>\n )}\n <span className=\"tabular-nums\">{value}</span>\n {suffix && (\n <span className={cn('text-surface-fg-muted', size === 'sm' ? 'text-ds-md' : 'text-ds-lg')}>{suffix}</span>\n )}\n </motion.p>\n </div>\n {deltaPlacement === 'inline' && deltaNode}\n </div>\n {secondaryLabel && (\n <motion.p\n className=\"text-ds-sm text-surface-fg-subtle\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.1 }}\n >\n {secondaryLabel}\n </motion.p>\n )}\n </div>\n {progress != null && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.15 }}\n >\n <ProgressBar progress={progress} label={resolvedLabel} />\n </motion.div>\n )}\n {deltaPlacement === 'block' && deltaNode}\n </>\n )\n\n // accentStyle=\"tint\" → a subtle accent gradient wash over Card's surface.\n const tintClass =\n accentStyle === 'tint' ? 'bg-linear-to-t from-accent-2 to-surface-raised' : undefined\n // Footer sits outside CardContent behind a full-width divider (both are direct\n // children of Card, so the rule spans edge-to-edge — no inset border-t).\n const body = (\n <>\n <CardContent className=\"flex flex-col gap-ds-03\">{cardContent}</CardContent>\n {footer && (\n <>\n <div aria-hidden=\"true\" className=\"h-px w-full bg-surface-border-subtle\" />\n <CardFooter className=\"text-ds-sm\">\n <motion.div\n className=\"w-full\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.25 }}\n >\n {footer}\n </motion.div>\n </CardFooter>\n </>\n )}\n </>\n )\n\n // href → wrap Card in the framework Link (Card stays the shell; hover-lift inside).\n if (href) {\n return (\n <Link\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n onClick={onClick}\n className=\"block no-underline\"\n aria-label={computedAriaLabel}\n {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n <Card variant={variant} size={size} interactive className={tintClass}>\n {body}\n </Card>\n </Link>\n )\n }\n\n // onClick → interactive Card with button semantics + keyboard activation.\n if (onClick) {\n return (\n <Card\n ref={ref}\n variant={variant}\n size={size}\n interactive\n className={cn(tintClass, className)}\n role=\"button\"\n tabIndex={0}\n aria-label={computedAriaLabel}\n onClick={onClick}\n onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClick()\n }\n }}\n {...props}\n >\n {body}\n </Card>\n )\n }\n\n return (\n <Card ref={ref} variant={variant} size={size} className={c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W;aACxD;GACI,CAAA;EACF,CAAA,GAKP,IAEA,kBAAC,GAAD;EACO;EACI;EACH;EACN,aAAA;EACA,WAAW,EAAG,GAAW,EAAU;EACnC,MAAK;EACL,UAAU;EACV,cAAY;EACH;EACT,YAAY,MAA2B;AACrC,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,GAAS;;EAGb,GAAI;YAEH;EACI,CAAA,GAKT,kBAAC,GAAD;EAAW;EAAc;EAAe;EAAM,WAAW,EAAG,GAAW,EAAU;EAAE,GAAI;YACpF;EACI,CAAA;EAGZ;AAED,EAAS,cAAc"}
1
+ {"version":3,"file":"stat-card.js","names":[],"sources":["../../src/ui/stat-card.tsx"],"sourcesContent":["'use client'\n\nimport { IconMinus, IconTrendingDown, IconTrendingUp } from '@tabler/icons-react'\nimport { motion } from 'framer-motion'\nimport * as React from 'react'\n\nimport { Card, CardContent, CardFooter, type CardSize } from './card'\nimport { Icon } from './icon'\nimport { IconProvider } from './icon-context'\nimport type { IconInput } from './lib/icon-input'\nimport { useLink } from './lib/link-context'\nimport { springs, tweens } from './lib/motion'\nimport { normalizeIcon } from './lib/normalize-icon'\nimport { cn } from './lib/utils'\nimport { Progress, type ProgressColor } from './progress'\nimport { Skeleton } from './skeleton'\nimport { type FlashPreset, type FlashSpec, type FlashSpeed,StatFlash } from './stat-flash'\n\n/**\n * Props for StatCard — a dashboard metric tile displaying a label, a large numeric value,\n * an optional trend delta (with directional arrow icon), and an optional header icon.\n *\n * **Surface:** delegated to `Card` via `variant` — `default` (ring-in-shadow, no border) |\n * `elevated` | `outline` (border, no shadow) | `flat`. StatCard composes `<Card>`, so the surface,\n * padding (gap model), and elevation all live in one place.\n *\n * **Accent:** `accentStyle=\"none\"` (default) is neutral; `\"icon\"` wraps `icon` in an accent chip\n * (`iconFill=\"soft\" | \"solid\"`); `\"tint\"` applies a subtle accent surface wash + accent value.\n * (Replaces the removed `accent` left-rail prop — see CHANGELOG migration.)\n *\n * **Delta direction:** `'up'` renders a green trending-up arrow, `'down'` renders a red\n * trending-down arrow, `'neutral'` renders a grey dash. The `delta.value` is a formatted\n * string (e.g. `\"+8%\"` or `\"−120\"`).\n *\n * **Loading state:** Pass `loading={true}` to render a pulse-skeleton placeholder instead of data.\n *\n * @example\n * // Revenue metric with a positive trend:\n * <StatCard\n * label=\"Monthly Revenue\"\n * value=\"$48,200\"\n * delta={{ value: \"+12%\", direction: \"up\" }}\n * icon={<IconCurrencyDollar />}\n * />\n *\n * @example\n * // Open ticket count with a downward trend (good for support queues):\n * <StatCard\n * label=\"Open Tickets\"\n * value={142}\n * delta={{ value: \"−18\", direction: \"down\" }}\n * />\n *\n * @example\n * // Loading skeleton while data is fetching:\n * <StatCard label=\"Users\" value={0} loading={isFetching} />\n *\n * @example\n * // Simple metric with no trend (stable, neutral):\n * <StatCard\n * label=\"Storage Used\"\n * value=\"4.2 GB\"\n * delta={{ value: \"No change\", direction: \"neutral\" }}\n * />\n * // These are just a few ways — feel free to combine props creatively!\n */\nexport interface StatCardProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'color'> {\n /** Heading text for the metric. `title` is an alias for `label`. */\n label?: string\n /** Alias for `label` — use whichever feels natural. */\n title?: string\n value: string | number\n /** Prefix before value, e.g. \"$\" */\n prefix?: string\n /** Suffix after value, e.g. \"users\" */\n suffix?: string\n delta?: {\n value: string\n direction: 'up' | 'down' | 'neutral'\n }\n /** Where the delta sits relative to the value: `block` (below — default) or `inline` (on the value's baseline, to its right). @default 'block' */\n deltaPlacement?: 'block' | 'inline'\n icon?: IconInput\n loading?: boolean\n /** Comparison period label shown after delta, e.g. \"vs last month\" */\n comparisonLabel?: string\n /** Secondary metric below main value, e.g. \"of $50,000 target\" */\n secondaryLabel?: string\n /** Progress toward a target (0-100). Renders a thin progress bar below the value. */\n progress?: number\n /** Surface variant, delegated to Card: `default` (ring-in-shadow) | `elevated` | `outline` (border, no shadow) | `flat`. @default 'default' */\n variant?: 'default' | 'elevated' | 'outline' | 'flat'\n /**\n * Tile density, delegated to Card's size axis. `sm` tightens padding to 16px and steps\n * the value down to `text-ds-2xl` — use it for dense KPI rows and narrow stat grids\n * (e.g. stat-row's 140px tiles). @default 'md'\n */\n size?: CardSize\n /** How the brand accent reads: `none` (neutral — default), `icon` (accent chip around `icon`), or `tint` (subtle accent surface wash + accent value). */\n accentStyle?: 'none' | 'icon' | 'tint'\n /** When `accentStyle=\"icon\"`: `soft` (tinted chip) or `solid` (filled accent chip). @default 'soft' */\n iconFill?: 'soft' | 'solid'\n /**\n * Opt-in entrance flash: the icon chip mounts showing a transient state (e.g. a green up-arrow)\n * then settles to `icon`. A preset (`'up' | 'down' | 'goal' | 'record' | 'alert' | 'live'`) or an\n * explicit `{ tone, icon }`. Requires `icon`; implies the icon chip. Off by default.\n */\n flash?: FlashPreset | FlashSpec\n /** Speed of the entrance flash: `fast` | `normal` | `slow`. @default 'normal' */\n flashSpeed?: FlashSpeed\n /** Sparkline data points. Renders a mini SVG line chart in the card. */\n sparkline?: number[]\n /** Make the card clickable with hover state */\n onClick?: () => void\n /** Href — makes the card a link (uses the LinkContext Link component) */\n href?: string\n /** Footer content rendered below the card body, e.g. \"View details →\" */\n footer?: React.ReactNode\n}\n\nfunction buildSparklinePath(raw: number[], width: number, height: number): string {\n const data = raw.filter((v) => Number.isFinite(v))\n if (data.length < 2) return ''\n const min = Math.min(...data)\n const max = Math.max(...data)\n const range = max - min || 1\n const stepX = width / (data.length - 1)\n return data\n .map((v, i) => {\n const x = i * stepX\n const y = height - ((v - min) / range) * height\n return `${i === 0 ? 'M' : 'L'}${x.toFixed(1)},${y.toFixed(1)}`\n })\n .join(' ')\n}\n\nfunction Sparkline({\n data,\n colorClass,\n}: {\n data: number[]\n colorClass: string\n}) {\n const id = React.useId()\n const pathRef = React.useRef<SVGPathElement>(null)\n const [pathLength, setPathLength] = React.useState(0)\n const svgWidth = 80\n const svgHeight = 32\n const path = buildSparklinePath(data, svgWidth, svgHeight)\n\n React.useEffect(() => {\n if (pathRef.current) {\n setPathLength(pathRef.current.getTotalLength())\n }\n }, [path])\n\n if (!path) return null\n\n // Build area fill path (close to bottom-right then bottom-left)\n const areaPath = `${path} L${svgWidth.toFixed(1)},${svgHeight.toFixed(1)} L0,${svgHeight.toFixed(1)} Z`\n\n return (\n <div className={cn('w-20 h-8', colorClass)} aria-hidden=\"true\">\n <svg\n viewBox={`0 0 ${svgWidth} ${svgHeight}`}\n className=\"w-full h-full overflow-visible\"\n preserveAspectRatio=\"none\"\n >\n <defs>\n <linearGradient id={`sparkline-fill-${id}`} x1=\"0\" y1=\"0\" x2=\"0\" y2=\"1\">\n <stop offset=\"0%\" stopColor=\"currentColor\" stopOpacity=\"0.1\" />\n <stop offset=\"100%\" stopColor=\"currentColor\" stopOpacity=\"0\" />\n </linearGradient>\n </defs>\n <path d={areaPath} fill={`url(#sparkline-fill-${id})`} />\n <path\n ref={pathRef}\n d={path}\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n style={{\n opacity: pathLength === 0 ? 0 : 1,\n strokeDasharray: pathLength,\n strokeDashoffset: pathLength,\n animation: pathLength > 0 ? `sparkline-draw-${id.replace(/:/g, '')} 1s ease-out forwards` : 'none',\n }}\n />\n </svg>\n {pathLength > 0 && (\n <style>{`@keyframes sparkline-draw-${id.replace(/:/g, '')} { to { stroke-dashoffset: 0; } }`}</style>\n )}\n </div>\n )\n}\n\nfunction ProgressBar({ progress, label }: { progress: number; label: string }) {\n const clamped = Math.max(0, Math.min(100, progress))\n // StatCard's own thresholds (90 = success, 70 = warning) — deliberately distinct\n // from Progress's autoColor (85/60), so we pass an explicit color.\n const barColor: ProgressColor =\n clamped >= 90 ? 'success' : clamped >= 70 ? 'warning' : 'accent'\n\n return (\n <Progress.Root value={clamped} size=\"sm\">\n <Progress.Track aria-label={`${label} progress`}>\n <Progress.Indicator color={barColor} />\n </Progress.Track>\n </Progress.Root>\n )\n}\n\nconst StatCard = React.forwardRef<HTMLDivElement, StatCardProps>(\n (\n {\n className,\n label,\n title,\n value,\n prefix,\n suffix,\n delta,\n deltaPlacement = 'block',\n icon,\n loading,\n comparisonLabel,\n secondaryLabel,\n progress,\n variant = 'default',\n size = 'md',\n accentStyle = 'none',\n iconFill = 'soft',\n flash,\n flashSpeed,\n sparkline,\n onClick,\n href,\n footer,\n ...props\n },\n ref,\n ) => {\n const Link = useLink()\n const resolvedLabel = title ?? label ?? ''\n const isClickable = !!(onClick || href)\n const computedAriaLabel =\n isClickable && !props['aria-label'] ? `View ${resolvedLabel}` : props['aria-label']\n\n if (loading) {\n return (\n <Card ref={ref} variant={variant} size={size} className={className} aria-busy=\"true\" {...props}>\n <CardContent className=\"flex flex-col gap-ds-03\">\n <Skeleton className=\"h-ds-04 w-24 rounded-control-inner\" />\n <Skeleton className=\"h-ds-sm w-32\" />\n <Skeleton className=\"h-3 w-16 rounded-control-inner\" />\n </CardContent>\n </Card>\n )\n }\n\n const DeltaIcon =\n delta?.direction === 'up'\n ? IconTrendingUp\n : delta?.direction === 'down'\n ? IconTrendingDown\n : IconMinus\n\n const deltaColour =\n delta?.direction === 'up'\n ? 'text-success-11'\n : delta?.direction === 'down'\n ? 'text-error-11'\n : 'text-surface-fg-muted'\n\n const sparklineColor =\n delta?.direction === 'up'\n ? 'text-success-11'\n : delta?.direction === 'down'\n ? 'text-error-11'\n : 'text-accent-11'\n\n const deltaNode = delta ? (\n <motion.div\n className={cn(\n // Rhythm comes from CardContent's flex gap — no placement margins.\n 'flex items-center gap-ds-02 text-ds-sm font-medium',\n deltaColour,\n )}\n initial={{ opacity: 0, y: 8 }}\n animate={{ opacity: 1, y: 0 }}\n transition={{ ...springs.smooth, delay: 0.2 }}\n >\n <motion.span\n className=\"inline-flex\"\n initial={{ opacity: 0.5, scale: 1.4 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.smooth}\n >\n <Icon icon={DeltaIcon} size=\"sm\" />\n </motion.span>\n <span>{delta.value}</span>\n {comparisonLabel && (\n <span className=\"text-surface-fg-subtle font-normal\">{comparisonLabel}</span>\n )}\n </motion.div>\n ) : null\n\n const cardContent = (\n <>\n <div className=\"flex items-center justify-between\">\n <motion.p\n className=\"text-ds-md font-medium text-surface-fg-muted\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={tweens.fade}\n >\n {resolvedLabel}\n </motion.p>\n <div className=\"flex items-center gap-ds-03\">\n {sparkline && sparkline.length >= 2 && (\n <Sparkline data={sparkline} colorClass={sparklineColor} />\n )}\n {icon && flash ? (\n <StatFlash icon={icon} flash={flash} fill={iconFill} speed={flashSpeed} />\n ) : icon ? (\n accentStyle === 'icon' ? (\n <motion.span\n className={cn(\n 'inline-flex items-center justify-center rounded-control p-ds-02',\n iconFill === 'solid'\n ? 'bg-accent-9 text-accent-fg'\n : 'bg-accent-3 text-accent-11',\n )}\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.snappy}\n aria-hidden=\"true\"\n >\n <IconProvider size=\"md\">{normalizeIcon(icon, 'md')}</IconProvider>\n </motion.span>\n ) : (\n <motion.span\n className=\"text-surface-fg-muted\"\n initial={{ opacity: 0, scale: 0.96 }}\n animate={{ opacity: 1, scale: 1 }}\n transition={springs.snappy}\n aria-hidden=\"true\"\n >\n <IconProvider size=\"lg\">{normalizeIcon(icon, 'lg')}</IconProvider>\n </motion.span>\n )\n ) : null}\n </div>\n </div>\n <div className=\"flex flex-col gap-ds-01\">\n <div className={cn(deltaPlacement === 'inline' && delta && 'flex items-baseline gap-ds-03')}>\n <div className=\"overflow-hidden\">\n <motion.p\n className={cn(\n 'inline-block font-semibold',\n size === 'sm' ? 'text-ds-2xl' : 'text-ds-3xl',\n accentStyle === 'tint' ? 'text-accent-11' : 'text-surface-fg',\n )}\n initial={{ opacity: 0, y: '100%' }}\n animate={{ opacity: 1, y: 0 }}\n transition={springs.smooth}\n >\n {prefix && (\n <span className={cn('text-surface-fg-muted', size === 'sm' ? 'text-ds-md' : 'text-ds-lg')}>{prefix}</span>\n )}\n <span className=\"tabular-nums\">{value}</span>\n {suffix && (\n <span className={cn('text-surface-fg-muted', size === 'sm' ? 'text-ds-md' : 'text-ds-lg')}>{suffix}</span>\n )}\n </motion.p>\n </div>\n {deltaPlacement === 'inline' && deltaNode}\n </div>\n {secondaryLabel && (\n <motion.p\n className=\"text-ds-sm text-surface-fg-subtle\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.1 }}\n >\n {secondaryLabel}\n </motion.p>\n )}\n </div>\n {progress != null && (\n <motion.div\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.15 }}\n >\n <ProgressBar progress={progress} label={resolvedLabel} />\n </motion.div>\n )}\n {deltaPlacement === 'block' && deltaNode}\n </>\n )\n\n // accentStyle=\"tint\" → a subtle accent gradient wash over Card's surface.\n const tintClass =\n accentStyle === 'tint' ? 'bg-linear-to-t from-accent-2 to-surface-raised' : undefined\n // Footer sits outside CardContent behind a full-width divider (both are direct\n // children of Card, so the rule spans edge-to-edge — no inset border-t).\n const body = (\n <>\n <CardContent className=\"flex flex-col gap-ds-03\">{cardContent}</CardContent>\n {footer && (\n <>\n <div aria-hidden=\"true\" className=\"h-px w-full bg-surface-border-subtle\" />\n <CardFooter className=\"text-ds-sm\">\n <motion.div\n className=\"w-full\"\n initial={{ opacity: 0 }}\n animate={{ opacity: 1 }}\n transition={{ ...tweens.fade, delay: 0.25 }}\n >\n {footer}\n </motion.div>\n </CardFooter>\n </>\n )}\n </>\n )\n\n // href → wrap Card in the framework Link (Card stays the shell; hover-lift inside).\n if (href) {\n return (\n <Link\n ref={ref as React.Ref<HTMLAnchorElement>}\n href={href}\n onClick={onClick}\n className=\"block no-underline\"\n aria-label={computedAriaLabel}\n {...(props as React.AnchorHTMLAttributes<HTMLAnchorElement>)}\n >\n <Card variant={variant} size={size} interactive className={tintClass}>\n {body}\n </Card>\n </Link>\n )\n }\n\n // onClick → interactive Card with button semantics + keyboard activation.\n if (onClick) {\n return (\n <Card\n ref={ref}\n variant={variant}\n size={size}\n interactive\n className={cn(tintClass, className)}\n role=\"button\"\n tabIndex={0}\n aria-label={computedAriaLabel}\n onClick={onClick}\n onKeyDown={(e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n onClick()\n }\n }}\n {...props}\n >\n {body}\n </Card>\n )\n }\n\n return (\n <Card ref={ref} variant={variant} size={size} className={cn(tintClass, className)} {...props}>\n {body}\n </Card>\n )\n },\n)\n\nStatCard.displayName = 'StatCard'\n\nexport { StatCard }\n"],"mappings":";;;;;;;;;;;;;;;;AAwHA,SAAS,EAAmB,GAAe,GAAe,GAAwB;CAChF,IAAM,IAAO,EAAI,QAAQ,MAAM,OAAO,SAAS,EAAE,CAAC;AAClD,KAAI,EAAK,SAAS,EAAG,QAAO;CAC5B,IAAM,IAAM,KAAK,IAAI,GAAG,EAAK,EAEvB,IADM,KAAK,IAAI,GAAG,EAAK,GACT,KAAO,GACrB,IAAQ,KAAS,EAAK,SAAS;AACrC,QAAO,EACJ,KAAK,GAAG,MAAM;EACb,IAAM,IAAI,IAAI,GACR,IAAI,KAAW,IAAI,KAAO,IAAS;AACzC,SAAO,GAAG,MAAM,IAAI,MAAM,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,EAAE,QAAQ,EAAE;GAC5D,CACD,KAAK,IAAI;;AAGd,SAAS,EAAU,EACjB,SACA,iBAIC;CACD,IAAM,IAAK,EAAM,OAAO,EAClB,IAAU,EAAM,OAAuB,KAAK,EAC5C,CAAC,GAAY,KAAiB,EAAM,SAAS,EAAE,EAG/C,IAAO,EAAmB,GAAM,IAAU,GAAU;AAQ1D,KANA,EAAM,gBAAgB;AACpB,EAAI,EAAQ,WACV,EAAc,EAAQ,QAAQ,gBAAgB,CAAC;IAEhD,CAAC,EAAK,CAAC,EAEN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,EAAE,SAAS,GAAG;GACvB,SAAS,EAAE,SAAS,GAAG;GACvB,YAAY;IAAE,GAAG,EAAO;IAAM,OAAO;IAAM;aAE1C;GACU,CAAA;EACF,CAAA,CACZ,EAAA,CAAA,CAEJ,EAAA,CAAA;AA+CL,QA3CI,IAEA,kBAAC,GAAD;EACO;EACC;EACG;EACT,WAAU;EACV,cAAY;EACZ,GAAK;YAEL,kBAAC,GAAD;GAAe;GAAe;GAAM,aAAA;GAAY,WAAW;aACxD;GACI,CAAA;EACF,CAAA,GAKP,IAEA,kBAAC,GAAD;EACO;EACI;EACH;EACN,aAAA;EACA,WAAW,EAAG,GAAW,EAAU;EACnC,MAAK;EACL,UAAU;EACV,cAAY;EACH;EACT,YAAY,MAA2B;AACrC,IAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,SACjC,EAAE,gBAAgB,EAClB,GAAS;;EAGb,GAAI;YAEH;EACI,CAAA,GAKT,kBAAC,GAAD;EAAW;EAAc;EAAe;EAAM,WAAW,EAAG,GAAW,EAAU;EAAE,GAAI;YACpF;EACI,CAAA;EAGZ;AAED,EAAS,cAAc"}
@@ -1,4 +1,4 @@
1
- import { Hn as e } from "../_chunks/primitives.js";
1
+ import { Vn as e } from "../_chunks/primitives.js";
2
2
  import { t } from "../_chunks/vendor-utils.js";
3
3
  import { cn as n } from "./lib/utils.js";
4
4
  import * as r from "react";
@@ -1,8 +1,10 @@
1
1
  "use client";
2
+ import { FieldState } from './lib/field-state';
2
3
  import * as SwitchPrimitives from "../primitives/react-switch";
3
4
  import * as React from "react";
4
5
  export interface SwitchProps extends React.ComponentPropsWithoutRef<typeof SwitchPrimitives.Root> {
5
- error?: boolean;
6
+ /** Validation/feedback state. `'error'` also sets `aria-invalid`. Inherited from `FormField` when omitted. Distinct from `color` (the ON-track tint). */
7
+ state?: FieldState;
6
8
  size?: 'sm' | 'md' | 'lg';
7
9
  color?: 'accent' | 'success' | 'warning';
8
10
  thumbIcon?: React.ReactNode;
@@ -1 +1 @@
1
- {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAkB9B,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC/F,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,QAAA,MAAM,MAAM,uFAyDV,CAAA;AAGF,OAAO,EAAE,MAAM,EAAE,CAAA"}
1
+ {"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../src/ui/switch.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,gBAAgB,MAAM,0BAA0B,CAAA;AAE5D,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAG9B,OAAO,EAAE,KAAK,UAAU,EAAqB,MAAM,mBAAmB,CAAA;AAuBtE,MAAM,WAAW,WAAY,SAAQ,KAAK,CAAC,wBAAwB,CAAC,OAAO,gBAAgB,CAAC,IAAI,CAAC;IAC/F,yJAAyJ;IACzJ,KAAK,CAAC,EAAE,UAAU,CAAA;IAClB,IAAI,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAA;IACzB,KAAK,CAAC,EAAE,QAAQ,GAAG,SAAS,GAAG,SAAS,CAAA;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAC5B;AAED,QAAA,MAAM,MAAM,uFAyDV,CAAA;AAGF,OAAO,EAAE,MAAM,EAAE,CAAA"}