@rinzai/zen 0.5.0 → 0.6.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 (172) hide show
  1. package/README.md +2 -2
  2. package/dist/animated-number/index.js +33 -0
  3. package/dist/avatar/index.js +38 -0
  4. package/dist/backdrop/index.d.ts +7 -3
  5. package/dist/backdrop/index.d.ts.map +1 -1
  6. package/dist/backdrop/index.js +98 -0
  7. package/dist/badge/index.d.ts +1 -1
  8. package/dist/badge/index.js +24 -0
  9. package/dist/button/index.d.ts +10 -3
  10. package/dist/button/index.d.ts.map +1 -1
  11. package/dist/button/index.js +54 -0
  12. package/dist/calendar/index.d.ts +44 -0
  13. package/dist/calendar/index.d.ts.map +1 -0
  14. package/dist/calendar/index.js +161 -0
  15. package/dist/card/index.d.ts +15 -6
  16. package/dist/card/index.d.ts.map +1 -1
  17. package/dist/card/index.js +60 -0
  18. package/dist/chart/donut.d.ts +30 -0
  19. package/dist/chart/donut.d.ts.map +1 -0
  20. package/dist/chart/donut.js +96 -0
  21. package/dist/chart/index.d.ts +81 -0
  22. package/dist/chart/index.d.ts.map +1 -0
  23. package/dist/chart/index.js +362 -0
  24. package/dist/chart/tooltip.d.ts +25 -0
  25. package/dist/chart/tooltip.d.ts.map +1 -0
  26. package/dist/chart/tooltip.js +51 -0
  27. package/dist/checkbox/index.d.ts +20 -0
  28. package/dist/checkbox/index.d.ts.map +1 -0
  29. package/dist/checkbox/index.js +61 -0
  30. package/dist/chip/index.d.ts +12 -0
  31. package/dist/chip/index.d.ts.map +1 -0
  32. package/dist/chip/index.js +14 -0
  33. package/dist/code-block/index.js +36 -0
  34. package/dist/collapse/index.d.ts +17 -7
  35. package/dist/collapse/index.d.ts.map +1 -1
  36. package/dist/collapse/index.js +82 -0
  37. package/dist/combobox/index.d.ts +89 -0
  38. package/dist/combobox/index.d.ts.map +1 -0
  39. package/dist/combobox/index.js +262 -0
  40. package/dist/confirm-dialog/index.d.ts.map +1 -1
  41. package/dist/confirm-dialog/index.js +25 -0
  42. package/dist/date-picker/index.d.ts +48 -0
  43. package/dist/date-picker/index.d.ts.map +1 -0
  44. package/dist/date-picker/index.js +112 -0
  45. package/dist/dialog/index.d.ts +14 -2
  46. package/dist/dialog/index.d.ts.map +1 -1
  47. package/dist/dialog/index.js +77 -0
  48. package/dist/disclosure/index.d.ts +25 -0
  49. package/dist/disclosure/index.d.ts.map +1 -0
  50. package/dist/disclosure/index.js +66 -0
  51. package/dist/editable-cell/index.js +24 -0
  52. package/dist/field/index.d.ts +42 -3
  53. package/dist/field/index.d.ts.map +1 -1
  54. package/dist/field/index.js +66 -0
  55. package/dist/header/index.js +17 -0
  56. package/dist/icons/chevron-down.js +21 -0
  57. package/dist/icons/chevron-left.js +21 -0
  58. package/dist/icons/chevron-right.js +21 -0
  59. package/dist/icons/chevron-up.js +21 -0
  60. package/dist/icons/ellipsis.d.ts +4 -0
  61. package/dist/icons/ellipsis.d.ts.map +1 -0
  62. package/dist/icons/ellipsis.js +31 -0
  63. package/dist/icons/index.d.ts +1 -0
  64. package/dist/icons/index.d.ts.map +1 -1
  65. package/dist/icons/search.js +21 -0
  66. package/dist/icons/x-mark.js +21 -0
  67. package/dist/index.d.ts +22 -10
  68. package/dist/index.d.ts.map +1 -1
  69. package/dist/input/index.d.ts.map +1 -1
  70. package/dist/input/index.js +16 -0
  71. package/dist/input-group/index.d.ts.map +1 -1
  72. package/dist/input-group/index.js +36 -0
  73. package/dist/inset/index.d.ts +16 -0
  74. package/dist/inset/index.d.ts.map +1 -0
  75. package/dist/inset/index.js +23 -0
  76. package/dist/lib.js +74 -0
  77. package/dist/menu/index.d.ts +55 -0
  78. package/dist/menu/index.d.ts.map +1 -0
  79. package/dist/menu/index.js +118 -0
  80. package/dist/meter/index.js +41 -0
  81. package/dist/money-input/index.d.ts +77 -7
  82. package/dist/money-input/index.d.ts.map +1 -1
  83. package/dist/money-input/index.js +304 -0
  84. package/dist/month-picker/index.d.ts +4 -3
  85. package/dist/month-picker/index.d.ts.map +1 -1
  86. package/dist/month-picker/index.js +93 -0
  87. package/dist/page-header/index.js +26 -0
  88. package/dist/pills/index.d.ts +35 -0
  89. package/dist/pills/index.d.ts.map +1 -0
  90. package/dist/pills/index.js +50 -0
  91. package/dist/popover/index.d.ts +41 -22
  92. package/dist/popover/index.d.ts.map +1 -1
  93. package/dist/popover/index.js +75 -0
  94. package/dist/progress-ring/index.js +49 -0
  95. package/dist/radio-cards/index.d.ts +34 -0
  96. package/dist/radio-cards/index.d.ts.map +1 -0
  97. package/dist/radio-cards/index.js +48 -0
  98. package/dist/radio-group/index.d.ts +39 -0
  99. package/dist/radio-group/index.d.ts.map +1 -0
  100. package/dist/radio-group/index.js +63 -0
  101. package/dist/segmented/index.d.ts +16 -6
  102. package/dist/segmented/index.d.ts.map +1 -1
  103. package/dist/segmented/index.js +58 -0
  104. package/dist/select/index.d.ts +28 -14
  105. package/dist/select/index.d.ts.map +1 -1
  106. package/dist/select/index.js +187 -0
  107. package/dist/side-nav/index.js +37 -0
  108. package/dist/skeleton/index.js +12 -0
  109. package/dist/slider/index.js +34 -0
  110. package/dist/spinner/index.js +14 -0
  111. package/dist/tab-bar/index.d.ts +3 -0
  112. package/dist/tab-bar/index.d.ts.map +1 -1
  113. package/dist/tab-bar/index.js +34 -0
  114. package/dist/table/index.js +148 -0
  115. package/dist/table-of-contents/index.js +37 -0
  116. package/dist/tabs/index.d.ts +3 -2
  117. package/dist/tabs/index.d.ts.map +1 -1
  118. package/dist/tabs/index.js +114 -0
  119. package/dist/tailwind.css +1 -1
  120. package/dist/textarea/index.d.ts.map +1 -1
  121. package/dist/textarea/index.js +16 -0
  122. package/dist/theme-toggle/index.js +43 -0
  123. package/dist/theme.css +178 -13
  124. package/dist/toast/index.d.ts +6 -1
  125. package/dist/toast/index.d.ts.map +1 -1
  126. package/dist/toast/index.js +248 -0
  127. package/dist/toggle/index.d.ts.map +1 -1
  128. package/dist/toggle/index.js +26 -0
  129. package/dist/tooltip/index.d.ts +25 -0
  130. package/dist/tooltip/index.d.ts.map +1 -0
  131. package/dist/tooltip/index.js +108 -0
  132. package/dist/tree/index.d.ts.map +1 -1
  133. package/dist/tree/index.js +135 -0
  134. package/dist/utils/cva.js +25 -0
  135. package/dist/utils/cx.js +6 -0
  136. package/dist/utils/date.d.ts +37 -0
  137. package/dist/utils/date.d.ts.map +1 -0
  138. package/dist/utils/date.js +68 -0
  139. package/dist/utils/field-chevron.js +19 -0
  140. package/dist/utils/fx.d.ts +30 -0
  141. package/dist/utils/fx.d.ts.map +1 -0
  142. package/dist/utils/fx.js +21 -0
  143. package/dist/utils/graphics.js +33 -0
  144. package/dist/utils/indicator.d.ts +24 -0
  145. package/dist/utils/indicator.d.ts.map +1 -0
  146. package/dist/utils/indicator.js +37 -0
  147. package/dist/utils/merge.js +305 -0
  148. package/dist/utils/money.js +73 -0
  149. package/dist/utils/month.js +46 -0
  150. package/dist/utils/slot.d.ts +9 -5
  151. package/dist/utils/slot.d.ts.map +1 -1
  152. package/dist/utils/slot.js +25 -0
  153. package/dist/utils/status-icons.js +48 -0
  154. package/dist/utils/styles.d.ts +6 -6
  155. package/dist/utils/styles.d.ts.map +1 -1
  156. package/dist/utils/styles.js +6 -0
  157. package/dist/utils/theme.js +200 -0
  158. package/dist/utils/useAnchoredPopup.d.ts +8 -2
  159. package/dist/utils/useAnchoredPopup.d.ts.map +1 -1
  160. package/dist/utils/useAnchoredPopup.js +63 -0
  161. package/dist/utils/useHydrated.js +9 -0
  162. package/dist/utils/useVirtualList.js +45 -0
  163. package/dist/variables.css +22 -0
  164. package/dist/zen.css +1 -1
  165. package/package.json +9 -4
  166. package/dist/actions-menu/index.d.ts +0 -18
  167. package/dist/actions-menu/index.d.ts.map +0 -1
  168. package/dist/dropdown/index.d.ts +0 -28
  169. package/dist/dropdown/index.d.ts.map +0 -1
  170. package/dist/nav-pills/index.d.ts +0 -31
  171. package/dist/nav-pills/index.d.ts.map +0 -1
  172. package/dist/zen.js +0 -2970
package/dist/zen.js DELETED
@@ -1,2970 +0,0 @@
1
- "use client";
2
- import { Children as e, cloneElement as t, createContext as n, isValidElement as r, useCallback as i, useContext as a, useEffect as o, useId as s, useLayoutEffect as c, useMemo as l, useRef as u, useState as d, useSyncExternalStore as f } from "react";
3
- import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
4
- import { createPortal as g } from "react-dom";
5
- //#region packages/utils/merge.ts
6
- function _(e) {
7
- let t = v.get(e);
8
- if (t !== void 0) return t;
9
- let n = e.split(/\s+/).filter(Boolean), r = /* @__PURE__ */ new Set(), i = [];
10
- for (let e = n.length - 1; e >= 0; e--) {
11
- let t = n[e], a = y(t);
12
- if (!a) {
13
- i.push(t);
14
- continue;
15
- }
16
- let o = a.scope;
17
- if (!r.has(o + a.group)) {
18
- r.add(o + a.group);
19
- for (let e of ie[a.group] ?? []) r.add(o + e);
20
- i.push(t);
21
- }
22
- }
23
- let a = i.reverse().join(" ");
24
- return v.size >= 1e3 && v.clear(), v.set(e, a), a;
25
- }
26
- var v = /* @__PURE__ */ new Map();
27
- function y(e) {
28
- let t = b(e), n = t.pop(), r = !1;
29
- n.startsWith("!") ? [r, n] = [!0, n.slice(1)] : n.endsWith("!") && ([r, n] = [!0, n.slice(0, -1)]), n.startsWith("-") && (n = n.slice(1));
30
- let i = re(n);
31
- return i ? {
32
- group: i,
33
- scope: t.sort().join(":") + (r ? "!" : "") + "|"
34
- } : null;
35
- }
36
- function b(e) {
37
- let t = [], n = 0, r = 0;
38
- for (let i = 0; i < e.length; i++) {
39
- let a = e[i];
40
- a === "[" || a === "(" ? n++ : a === "]" || a === ")" ? n-- : a === ":" && n === 0 && (t.push(e.slice(r, i)), r = i + 1);
41
- }
42
- return t.push(e.slice(r)), t;
43
- }
44
- var x = /^\d+(\.\d+)?$/, S = /^(\d?xs|sm|md|lg|\d?xl|base|none|full)$/, C = /^[[(](length:|size:|percentage:|number:)?(-?[\d.]+[a-z%]*|calc\(|min\(|max\(|clamp\(|var\(--[\w-]*(size|width|radius|spacing|length)[\w-]*\))/, w = (e) => e.replace(/\/[^/[\]()]*$/, ""), T = (e) => e === "" || x.test(e) || C.test(e), E = [
45
- "x",
46
- "y",
47
- "t",
48
- "r",
49
- "b",
50
- "l",
51
- "s",
52
- "e"
53
- ], D = [
54
- "t",
55
- "r",
56
- "b",
57
- "l",
58
- "s",
59
- "e",
60
- "tl",
61
- "tr",
62
- "br",
63
- "bl",
64
- "ss",
65
- "se",
66
- "es",
67
- "ee"
68
- ], ee = {}, O = (e, t) => t.split(" ").forEach((t) => ee[t] = e);
69
- O("display", "block inline-block inline flex inline-flex grid inline-grid contents hidden flow-root list-item table inline-table table-row table-cell table-caption table-column table-row-group table-header-group table-footer-group"), O("position", "static fixed absolute relative sticky"), O("visibility", "visible invisible collapse"), O("isolation", "isolate isolation-auto"), O("text-overflow", "truncate text-ellipsis text-clip"), O("text-transform", "uppercase lowercase capitalize normal-case"), O("font-style", "italic not-italic"), O("text-decoration-line", "underline overline line-through no-underline"), O("font-smoothing", "antialiased subpixel-antialiased"), O("sr", "sr-only not-sr-only"), O("flex-direction", "flex-row flex-row-reverse flex-col flex-col-reverse"), O("flex-wrap", "flex-wrap flex-wrap-reverse flex-nowrap"), O("border-style", "border-solid border-dashed border-dotted border-double border-hidden border-none"), O("border-collapse", "border-collapse border-separate"), O("table-layout", "table-auto table-fixed"), O("box-sizing", "box-border box-content"), O("grow", "grow"), O("shrink", "shrink"), O("transition", "transition"), O("shadow", "shadow"), O("ring-w", "ring"), O("ring-inset", "ring-inset"), O("outline-w", "outline"), O("border-w", "border"), O("rounded", "rounded");
70
- for (let e of E) O(`border-w-${e}`, `border-${e}`);
71
- for (let e of D) O(`rounded-${e}`, `rounded-${e}`);
72
- var k = {
73
- inset: "inset",
74
- "inset-x": "inset-x",
75
- "inset-y": "inset-y",
76
- top: "top",
77
- right: "right",
78
- bottom: "bottom",
79
- left: "left",
80
- start: "start",
81
- end: "end",
82
- z: "z",
83
- order: "order",
84
- basis: "basis",
85
- grow: "grow",
86
- shrink: "shrink",
87
- flex: "flex",
88
- "grid-cols": "grid-cols",
89
- "grid-rows": "grid-rows",
90
- "grid-flow": "grid-flow",
91
- "auto-cols": "auto-cols",
92
- "auto-rows": "auto-rows",
93
- col: "col",
94
- "col-span": "col-span",
95
- "col-start": "col-start",
96
- "col-end": "col-end",
97
- row: "row",
98
- "row-span": "row-span",
99
- "row-start": "row-start",
100
- "row-end": "row-end",
101
- gap: "gap",
102
- "gap-x": "gap-x",
103
- "gap-y": "gap-y",
104
- "space-x": "space-x",
105
- "space-y": "space-y",
106
- w: "w",
107
- "min-w": "min-w",
108
- "max-w": "max-w",
109
- h: "h",
110
- "min-h": "min-h",
111
- "max-h": "max-h",
112
- size: "size",
113
- justify: "justify-content",
114
- "justify-items": "justify-items",
115
- "justify-self": "justify-self",
116
- items: "align-items",
117
- self: "align-self",
118
- content: (e) => e === "none" || e.startsWith("[") || e.startsWith("(") ? "content" : "align-content",
119
- "place-content": "place-content",
120
- "place-items": "place-items",
121
- "place-self": "place-self",
122
- overflow: "overflow",
123
- "overflow-x": "overflow-x",
124
- "overflow-y": "overflow-y",
125
- "border-spacing": "border-spacing",
126
- "border-spacing-x": "border-spacing-x",
127
- "border-spacing-y": "border-spacing-y",
128
- bg: (e) => {
129
- let t = w(e);
130
- return [
131
- "fixed",
132
- "local",
133
- "scroll"
134
- ].includes(t) ? "bg-attachment" : /^(clip|origin)-/.test(t) ? "bg-" + t.split("-")[0] : /^(repeat|no-repeat)/.test(t) ? "bg-repeat" : [
135
- "auto",
136
- "cover",
137
- "contain"
138
- ].includes(t) ? "bg-size" : /^(top|bottom|left|right|center)/.test(t) ? "bg-position" : t === "none" || /^(linear|radial|conic|gradient)-/.test(t) || /^\[(url|image:|(repeating-)?(linear|radial|conic)-gradient)/.test(t) ? "bg-image" : "bg-color";
139
- },
140
- text: (e) => {
141
- let t = w(e);
142
- return [
143
- "left",
144
- "center",
145
- "right",
146
- "justify",
147
- "start",
148
- "end"
149
- ].includes(t) ? "text-align" : [
150
- "wrap",
151
- "nowrap",
152
- "balance",
153
- "pretty"
154
- ].includes(t) ? "text-wrap" : S.test(t) || C.test(t) ? "font-size" : "text-color";
155
- },
156
- font: (e) => /^(thin|extralight|light|normal|medium|semibold|bold|extrabold|black)$/.test(e) || /^[[(](number:|\d)/.test(e) ? "font-weight" : "font-family",
157
- leading: "leading",
158
- tracking: "tracking",
159
- whitespace: "whitespace",
160
- break: (e) => [
161
- "normal",
162
- "words",
163
- "all",
164
- "keep"
165
- ].includes(e) ? "word-break" : null,
166
- "line-clamp": "line-clamp",
167
- align: "vertical-align",
168
- opacity: "opacity",
169
- shadow: (e) => e === "" || S.test(w(e)) || e === "inner" || /^\[(?!color:)/.test(e) ? "shadow" : "shadow-color",
170
- ring: (e) => T(e) ? "ring-w" : "ring-color",
171
- "ring-offset": (e) => T(e) ? "ring-offset-w" : "ring-offset-color",
172
- outline: (e) => [
173
- "none",
174
- "hidden",
175
- "solid",
176
- "dashed",
177
- "dotted",
178
- "double"
179
- ].includes(e) ? "outline-style" : T(e) ? "outline-w" : "outline-color",
180
- "outline-offset": "outline-offset",
181
- cursor: "cursor",
182
- "pointer-events": "pointer-events",
183
- select: "user-select",
184
- resize: "resize",
185
- transition: "transition",
186
- duration: "duration",
187
- ease: "ease",
188
- delay: "delay",
189
- animate: "animate",
190
- scale: "scale",
191
- "scale-x": "scale-x",
192
- "scale-y": "scale-y",
193
- rotate: "rotate",
194
- translate: "translate",
195
- "translate-x": "translate-x",
196
- "translate-y": "translate-y",
197
- origin: "transform-origin",
198
- fill: "fill",
199
- stroke: (e) => x.test(e) ? "stroke-w" : "stroke-color",
200
- aspect: "aspect",
201
- object: (e) => [
202
- "contain",
203
- "cover",
204
- "fill",
205
- "none",
206
- "scale-down"
207
- ].includes(e) ? "object-fit" : "object-position",
208
- blur: "blur",
209
- "backdrop-blur": "backdrop-blur",
210
- "mix-blend": "mix-blend",
211
- appearance: "appearance",
212
- "will-change": "will-change",
213
- "underline-offset": "underline-offset",
214
- accent: "accent-color",
215
- caret: "caret-color",
216
- float: "float",
217
- clear: "clear",
218
- columns: "columns",
219
- rounded: "rounded",
220
- border: (e) => T(e) ? "border-w" : "border-color"
221
- };
222
- for (let e of ["p", "m"]) {
223
- k[e] = e;
224
- for (let t of E) k[e + t] = e + t;
225
- }
226
- for (let e of E) k[`border-${e}`] = (t) => T(t) ? `border-w-${e}` : `border-color-${e}`;
227
- for (let e of D) k[`rounded-${e}`] = `rounded-${e}`;
228
- var te = /* @__PURE__ */ new Set(["text-glow", "text-aurora"]), ne = Object.keys(k).sort((e, t) => t.length - e.length);
229
- function re(e) {
230
- if (te.has(e)) return null;
231
- if (ee[e]) return ee[e];
232
- if (e.startsWith("[")) {
233
- let t = e.indexOf(":");
234
- return t > 1 ? "prop:" + e.slice(1, t) : null;
235
- }
236
- for (let t of ne) {
237
- if (!e.startsWith(t + "-")) continue;
238
- let n = k[t];
239
- return typeof n == "string" ? n : n(e.slice(t.length + 1));
240
- }
241
- return null;
242
- }
243
- var ie = {
244
- p: E.map((e) => "p" + e),
245
- m: E.map((e) => "m" + e),
246
- px: [
247
- "pl",
248
- "pr",
249
- "ps",
250
- "pe"
251
- ],
252
- py: ["pt", "pb"],
253
- mx: [
254
- "ml",
255
- "mr",
256
- "ms",
257
- "me"
258
- ],
259
- my: ["mt", "mb"],
260
- inset: [
261
- "inset-x",
262
- "inset-y",
263
- "top",
264
- "right",
265
- "bottom",
266
- "left",
267
- "start",
268
- "end"
269
- ],
270
- "inset-x": ["left", "right"],
271
- "inset-y": ["top", "bottom"],
272
- size: ["w", "h"],
273
- gap: ["gap-x", "gap-y"],
274
- overflow: ["overflow-x", "overflow-y"],
275
- "border-spacing": ["border-spacing-x", "border-spacing-y"],
276
- "border-w": E.map((e) => "border-w-" + e),
277
- "border-w-x": [
278
- "border-w-l",
279
- "border-w-r",
280
- "border-w-s",
281
- "border-w-e"
282
- ],
283
- "border-w-y": ["border-w-t", "border-w-b"],
284
- "border-color": E.map((e) => "border-color-" + e),
285
- "border-color-x": [
286
- "border-color-l",
287
- "border-color-r",
288
- "border-color-s",
289
- "border-color-e"
290
- ],
291
- "border-color-y": ["border-color-t", "border-color-b"],
292
- rounded: D.map((e) => "rounded-" + e),
293
- "rounded-t": ["rounded-tl", "rounded-tr"],
294
- "rounded-r": ["rounded-tr", "rounded-br"],
295
- "rounded-b": ["rounded-br", "rounded-bl"],
296
- "rounded-l": ["rounded-tl", "rounded-bl"],
297
- "rounded-s": ["rounded-ss", "rounded-es"],
298
- "rounded-e": ["rounded-se", "rounded-ee"],
299
- translate: ["translate-x", "translate-y"],
300
- scale: ["scale-x", "scale-y"],
301
- flex: [
302
- "grow",
303
- "shrink",
304
- "basis"
305
- ]
306
- }, A = (...e) => _(ae(e)), ae = (e) => e.reduce((e, t) => t == null || t === !1 ? e : typeof t == "string" || typeof t == "number" ? e + " " + t : Array.isArray(t) ? e + " " + ae(t) : typeof t == "object" ? e + " " + Object.entries(t).reduce((e, [t, n]) => n == null || n === !1 ? e : typeof n == "string" || typeof n == "number" ? e + " " + t + "-" + n : typeof n == "boolean" && n ? e + " " + t : e, "") : e, ""), oe = "data-zen-graphics", se = /swiftshader|llvmpipe|softpipe|software|basic render driver|mesa offscreen/i, j;
307
- function ce() {
308
- if (j) return j;
309
- if (typeof document > "u") return "full";
310
- try {
311
- let e = document.createElement("canvas"), t = e.getContext("webgl", { failIfMajorPerformanceCaveat: !0 }) ?? e.getContext("experimental-webgl", { failIfMajorPerformanceCaveat: !0 });
312
- if (!t) j = "lite";
313
- else {
314
- let e = t.getExtension("WEBGL_debug_renderer_info"), n = String(t.getParameter(e ? e.UNMASKED_RENDERER_WEBGL : t.RENDERER) ?? "");
315
- j = se.test(n) ? "lite" : "full", t.getExtension("WEBGL_lose_context")?.loseContext();
316
- }
317
- } catch {
318
- j = "lite";
319
- }
320
- return j;
321
- }
322
- function M() {
323
- if (typeof document > "u") return "full";
324
- let e = document.documentElement, t = e.getAttribute(oe);
325
- if (t === "full" || t === "lite") return t;
326
- let n = ce();
327
- return e.setAttribute(oe, n), n;
328
- }
329
- function N() {
330
- o(() => {
331
- M();
332
- }, []);
333
- }
334
- //#endregion
335
- //#region packages/utils/useAnchoredPopup.ts
336
- function P({ align: e = "start", offset: t = 4, matchWidth: n = !1, onOpenChange: r } = {}) {
337
- let a = `zen__popup-${s().replace(/[^\w-]/g, "")}`, c = u(null), [l, f] = d(!1), p = u(r);
338
- p.current = r;
339
- let m = u(!1), h = i((e) => {
340
- f(e), m.current !== e && (m.current = e, p.current?.(e));
341
- }, []), g = i((e) => {
342
- let t = c.current;
343
- if (t) {
344
- try {
345
- e ? t.showPopover?.() : t.hidePopover?.();
346
- } catch {}
347
- h(e);
348
- }
349
- }, [h]);
350
- return o(() => {
351
- let e = c.current;
352
- if (!e) return;
353
- let t = (e) => h(e.newState === "open");
354
- return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
355
- }, [h]), {
356
- id: a,
357
- open: l,
358
- setOpen: g,
359
- triggerProps: {
360
- popoverTarget: a,
361
- "aria-expanded": l,
362
- "aria-controls": a,
363
- "data-popup-open": l || void 0,
364
- style: { anchorName: `--${a}` }
365
- },
366
- popupProps: {
367
- ref: c,
368
- id: a,
369
- popover: "auto",
370
- style: {
371
- positionAnchor: `--${a}`,
372
- positionArea: e === "start" ? "block-end span-inline-end" : "block-end span-inline-start",
373
- positionTryFallbacks: "flip-block",
374
- inset: "auto",
375
- margin: `${t}px 0`,
376
- ...n && { minWidth: "anchor-size(width)" }
377
- }
378
- },
379
- popupRef: c
380
- };
381
- }
382
- //#endregion
383
- //#region packages/actions-menu/index.tsx
384
- var le = "flex w-full cursor-default items-center rounded-lg px-3 py-2 text-sm outline-hidden select-none hover:bg-tint/[0.07] focus:bg-tint/[0.07]";
385
- function ue({ label: e, actions: t, className: n }) {
386
- N();
387
- let r = P({
388
- align: "end",
389
- offset: 6,
390
- onOpenChange: (e) => e && r.popupRef.current?.focus()
391
- }), i = r.popupRef, a = t.filter((e) => !!e), o = (e) => {
392
- let t = Array.from(i.current?.querySelectorAll("[role=\"menuitem\"]") ?? []), n = t.indexOf(document.activeElement), r = t.length - 1, a = {
393
- ArrowDown: n + 1,
394
- ArrowUp: n === -1 ? r : n - 1,
395
- Home: 0,
396
- End: r
397
- }[e.key];
398
- a !== void 0 && (e.preventDefault(), t[(a + t.length) % t.length]?.focus());
399
- };
400
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("button", {
401
- type: "button",
402
- "aria-label": e,
403
- "aria-haspopup": "menu",
404
- ...r.triggerProps,
405
- className: A("text-muted-foreground grid size-9 shrink-0 place-items-center rounded-lg outline-hidden", "hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "data-popup-open:bg-tint/[0.06]", n),
406
- children: /* @__PURE__ */ h("svg", {
407
- viewBox: "0 0 16 16",
408
- fill: "currentColor",
409
- className: "size-4",
410
- "aria-hidden": !0,
411
- children: [
412
- /* @__PURE__ */ m("circle", {
413
- cx: "3",
414
- cy: "8",
415
- r: "1.4"
416
- }),
417
- /* @__PURE__ */ m("circle", {
418
- cx: "8",
419
- cy: "8",
420
- r: "1.4"
421
- }),
422
- /* @__PURE__ */ m("circle", {
423
- cx: "13",
424
- cy: "8",
425
- r: "1.4"
426
- })
427
- ]
428
- })
429
- }), /* @__PURE__ */ m("div", {
430
- ...r.popupProps,
431
- role: "menu",
432
- "aria-label": e,
433
- tabIndex: -1,
434
- onKeyDown: o,
435
- className: "zen__popover glass glass-blur text-foreground min-w-44 rounded-xl p-1.5 outline-hidden",
436
- children: a.map((e) => /* @__PURE__ */ m("button", {
437
- type: "button",
438
- role: "menuitem",
439
- tabIndex: -1,
440
- className: A(le, e.destructive && "text-destructive hover:bg-destructive/10 focus:bg-destructive/10"),
441
- onClick: () => {
442
- r.setOpen(!1), e.onClick();
443
- },
444
- children: e.label
445
- }, e.label))
446
- })] });
447
- }
448
- //#endregion
449
- //#region packages/utils/money.ts
450
- function F(e) {
451
- return new Intl.NumberFormat("en", {
452
- style: "currency",
453
- currency: e
454
- }).resolvedOptions().maximumFractionDigits ?? 2;
455
- }
456
- function de(e, t, n, { showDecimals: r = !0 } = {}) {
457
- let i = F(t);
458
- return new Intl.NumberFormat(n, {
459
- style: "currency",
460
- currency: t,
461
- minimumFractionDigits: r ? i : 0,
462
- maximumFractionDigits: r ? i : 0
463
- }).format(e / 10 ** i);
464
- }
465
- function fe(e, t, n) {
466
- let r = F(t), i = e % 10 ** r != 0;
467
- return new Intl.NumberFormat(n, {
468
- minimumFractionDigits: i ? r : 0,
469
- maximumFractionDigits: r
470
- }).format(e / 10 ** r);
471
- }
472
- function pe(e, t) {
473
- return new Intl.NumberFormat(t, {
474
- style: "currency",
475
- currency: e
476
- }).formatToParts(0).find((e) => e.type === "currency")?.value ?? e;
477
- }
478
- var I = class extends Error {
479
- constructor(e) {
480
- super(`Not an amount: ${e}`), this.name = "MoneyParseError";
481
- }
482
- };
483
- function me(e, t) {
484
- let n = F(t), r = e.trim().replace(/[\s,_]/g, "").replace(/^([+-]?)[^\d.+-]+/, "$1"), i = /^([+-]?)(\d*)(?:\.(\d*))?$/.exec(r);
485
- if (!i || i[2] === "" && (i[3] ?? "") === "") throw new I(e);
486
- let [, a, o, s = ""] = i;
487
- if (s.length > n) throw new I(e);
488
- let c = Number((o || "0") + s.padEnd(n, "0"));
489
- if (!Number.isSafeInteger(c)) throw new I(e);
490
- return a === "-" ? -c : c;
491
- }
492
- var he = {
493
- k: 3,
494
- thousand: 3,
495
- l: 5,
496
- lac: 5,
497
- lakh: 5,
498
- lakhs: 5,
499
- cr: 7,
500
- crore: 7,
501
- crores: 7,
502
- m: 6,
503
- mn: 6,
504
- million: 6
505
- };
506
- function L(e, t) {
507
- let n = /^\s*(.*?)\s*([a-z]+)\s*$/i.exec(e), r = he[n ? n[2].toLowerCase() : ""];
508
- if (!n || r === void 0) return me(e, t);
509
- let i = F(t), a = /^([+-]?)[^\d.+-]*([\d,\s_]*)(?:\.(\d*))?$/.exec(n[1]);
510
- if (!a) throw new I(e);
511
- let o = a[2].replace(/[,\s_]/g, ""), s = a[3] ?? "";
512
- if (o === "" && s === "") throw new I(e);
513
- let c = r + i;
514
- if (s.length > c) throw new I(e);
515
- let l = Number((o || "0") + s.padEnd(c, "0"));
516
- if (!Number.isSafeInteger(l)) throw new I(e);
517
- return a[1] === "-" ? -l : l;
518
- }
519
- //#endregion
520
- //#region packages/animated-number/index.tsx
521
- var ge = typeof window > "u" ? o : c, _e = (e) => 1 - (1 - e) ** 3;
522
- function ve({ value: e, format: t = String, duration: n = 650, fromZero: r = !0, className: i }) {
523
- let [a, o] = d(r ? 0 : e), s = u(r ? 0 : e);
524
- return ge(() => {
525
- if (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion") || n <= 0) {
526
- s.current = e, o(e);
527
- return;
528
- }
529
- let t = s.current, r = performance.now(), i = requestAnimationFrame(function a(c) {
530
- let l = Math.min(1, (c - r) / n), u = Math.round(t + (e - t) * _e(l));
531
- s.current = u, o(u), l < 1 && (i = requestAnimationFrame(a));
532
- });
533
- return () => cancelAnimationFrame(i);
534
- }, [e, n]), /* @__PURE__ */ m("span", {
535
- className: A("zen__animated-number tabular-nums", i),
536
- children: t(a)
537
- });
538
- }
539
- function ye({ value: e, currency: t, locale: n, showDecimals: r = !1, ...i }) {
540
- return /* @__PURE__ */ m(ve, {
541
- value: e,
542
- format: (e) => de(e, t, n, { showDecimals: r }),
543
- ...i
544
- });
545
- }
546
- //#endregion
547
- //#region packages/avatar/index.tsx
548
- function be({ src: e, name: t, alt: n, className: r }) {
549
- let i = (t.trim()[0] ?? "?").toUpperCase();
550
- return /* @__PURE__ */ m("span", {
551
- role: n ? "img" : void 0,
552
- "aria-label": n,
553
- "aria-hidden": !n || void 0,
554
- className: A("zen__avatar relative inline-grid shrink-0 place-items-center overflow-hidden rounded-full font-semibold select-none", "size-9 text-sm", "text-primary-foreground bg-[radial-gradient(circle_at_30%_25%,oklch(var(--glow)/0.9),oklch(var(--primary)/0.55))]", "shadow-[0_0_0_1px_oklch(var(--tint)/0.12),0_0_18px_-6px_oklch(var(--glow)/calc(0.9*var(--glow-strength)))]", r),
555
- children: e ? /* @__PURE__ */ m("img", {
556
- src: e,
557
- alt: "",
558
- className: "size-full object-cover",
559
- draggable: !1
560
- }) : i
561
- });
562
- }
563
- var R = class extends Error {};
564
- async function xe(e, t = 160, n = .85) {
565
- if (!e.type.startsWith("image/")) throw new R("Choose an image file.");
566
- if (e.size > 20971520) throw new R("That image is too large (over 20 MB).");
567
- let r;
568
- try {
569
- r = await createImageBitmap(e);
570
- } catch {
571
- throw new R("That image couldn't be read.");
572
- }
573
- let i = Math.min(r.width, r.height), a = document.createElement("canvas");
574
- a.width = a.height = t;
575
- let o = a.getContext("2d");
576
- o.imageSmoothingQuality = "high", o.drawImage(r, (r.width - i) / 2, (r.height - i) / 2, i, i, 0, 0, t, t), r.close();
577
- let s = a.toDataURL("image/webp", n);
578
- return s.startsWith("data:image/webp") ? s : a.toDataURL("image/jpeg", n);
579
- }
580
- //#endregion
581
- //#region packages/backdrop/index.tsx
582
- function Se({ pattern: e, topoSrc: t }) {
583
- let n = e ?? (t ? "contours" : "dots"), r = u(null);
584
- return o(() => {
585
- let e = document.documentElement, t = r.current, n = 0, i = -9999, a = -9999, o = /* @__PURE__ */ new WeakSet(), s = !0, c = /* @__PURE__ */ new WeakMap(), l = (e, t, n, r = "--gx", i = "--gy") => {
586
- let a = t + " " + n;
587
- c.get(e) !== a && (c.set(e, a), e.style.setProperty(r, t), e.style.setProperty(i, n));
588
- }, u = () => {
589
- n = 0;
590
- let e = Array.from(document.querySelectorAll(".glow-edge")), r = e.map((e) => e.getBoundingClientRect()), c = t?.getBoundingClientRect();
591
- if (t && c) {
592
- let e = s ? "out" : "in";
593
- t.dataset.pointer !== e && (t.dataset.pointer = e);
594
- let n = t.querySelector(".zen-light");
595
- n && !s && l(n, `${Math.round(i - c.left)}px`, `${Math.round(a - c.top)}px`, "left", "top");
596
- }
597
- e.forEach((e, t) => {
598
- let n = r[t];
599
- i > n.left - 400 && i < n.right + 400 && a > n.top - 400 && a < n.bottom + 400 ? (l(e, `${Math.round(i - n.left)}px`, `${Math.round(a - n.top)}px`), o.delete(e)) : o.has(e) || (l(e, "-9999px", "-9999px"), o.add(e));
600
- });
601
- }, d = () => {
602
- n ||= requestAnimationFrame(u);
603
- }, f = (e) => {
604
- i = e.clientX, a = e.clientY, s = !1, d();
605
- }, p = () => {
606
- i = a = -9999, s = !0, d();
607
- };
608
- if (window.matchMedia?.("(hover: none), (pointer: coarse)").matches || M() === "lite") return;
609
- window.addEventListener("pointermove", f, { passive: !0 }), e.addEventListener("pointerleave", p);
610
- let m = 0, h = () => {
611
- clearTimeout(m), m = window.setTimeout(d, 120);
612
- };
613
- return window.addEventListener("scroll", h, {
614
- passive: !0,
615
- capture: !0
616
- }), window.addEventListener("resize", d, { passive: !0 }), () => {
617
- window.removeEventListener("pointermove", f), e.removeEventListener("pointerleave", p), window.removeEventListener("scroll", h, { capture: !0 }), clearTimeout(m), window.removeEventListener("resize", d), cancelAnimationFrame(n);
618
- };
619
- }, []), o(() => {
620
- let e = r.current;
621
- if (!t || !e || typeof document > "u") return;
622
- let n = "", i = !1, a = 0, o = new Image();
623
- o.src = t;
624
- let s = async () => {
625
- try {
626
- await o.decode();
627
- let t = window.devicePixelRatio || 1, r = Math.round(e.clientWidth * t), a = Math.round(e.clientHeight * t);
628
- if (!r || !a) return;
629
- let s = document.createElement("canvas");
630
- s.width = r, s.height = a;
631
- let c = o.naturalWidth || r, l = o.naturalHeight || a, u = Math.max(r / c, a / l);
632
- s.getContext("2d")?.drawImage(o, (r - c * u) / 2, (a - l * u) / 2, c * u, l * u);
633
- let d = await new Promise((e) => s.toBlob(e));
634
- if (i || !d) return;
635
- let f = URL.createObjectURL(d);
636
- e.style.setProperty("--zen-topo", `url("${f}")`), n && URL.revokeObjectURL(n), n = f;
637
- } catch {}
638
- };
639
- s();
640
- let c = typeof ResizeObserver > "u" ? null : new ResizeObserver(() => {
641
- clearTimeout(a), a = window.setTimeout(s, 200);
642
- });
643
- return c?.observe(e), () => {
644
- i = !0, clearTimeout(a), c?.disconnect(), n && URL.revokeObjectURL(n), e.style.setProperty("--zen-topo", `url("${t}")`);
645
- };
646
- }, [t]), /* @__PURE__ */ h("div", {
647
- ref: r,
648
- className: "zen-backdrop",
649
- "aria-hidden": !0,
650
- style: t ? { "--zen-topo": `url("${t}")` } : void 0,
651
- children: [
652
- /* @__PURE__ */ m("div", { className: "zen-aurora" }),
653
- n === "contours" ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("div", { className: "zen-topo" }), /* @__PURE__ */ m("div", {
654
- className: "zen-topo zen-topo--lit",
655
- children: /* @__PURE__ */ m("div", { className: "zen-light" })
656
- })] }) : /* @__PURE__ */ h(p, { children: [
657
- /* @__PURE__ */ m("div", { className: "zen-dots" }),
658
- /* @__PURE__ */ m("div", { className: "zen-dots zen-dots--ambient" }),
659
- /* @__PURE__ */ m("div", {
660
- className: "zen-dots zen-dots--lit",
661
- children: /* @__PURE__ */ m("div", { className: "zen-light" })
662
- })
663
- ] }),
664
- /* @__PURE__ */ m("div", { className: "zen-vignette" })
665
- ]
666
- });
667
- }
668
- //#endregion
669
- //#region packages/utils/cva.ts
670
- var Ce = (e) => typeof e == "boolean" ? `${e}` : e === 0 ? "0" : e, z = (e, t) => (n) => {
671
- if (t?.variants == null) return A(e, n?.class, n?.className);
672
- let { variants: r, defaultVariants: i } = t, a = Object.keys(r).map((e) => {
673
- let t = n?.[e], a = i?.[e];
674
- if (t === null) return null;
675
- let o = Ce(t) || Ce(a);
676
- return r[e][o];
677
- }), o = n && Object.entries(n).reduce((e, [t, n]) => (n === void 0 || (e[t] = n), e), {}), s = t?.compoundVariants?.reduce((e, { class: t, className: n, ...r }) => Object.entries(r).every(([e, t]) => Array.isArray(t) ? t.includes({
678
- ...i,
679
- ...o
680
- }[e]) : {
681
- ...i,
682
- ...o
683
- }[e] === t) ? [
684
- ...e,
685
- t,
686
- n
687
- ] : e, []);
688
- return A(e, a, s, n?.class, n?.className);
689
- };
690
- //#endregion
691
- //#region packages/badge/index.tsx
692
- function B({ variant: e, className: t, ...n }) {
693
- return /* @__PURE__ */ m("span", {
694
- ...n,
695
- className: we({
696
- variant: e,
697
- className: t
698
- })
699
- });
700
- }
701
- var we = z("zen__badge inline-flex items-center rounded-md border px-1.5 py-0.5 text-[0.65rem] font-semibold tracking-wider uppercase whitespace-nowrap focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-glow/50", {
702
- variants: { variant: {
703
- default: "border-glow/30 bg-glow/10 text-primary",
704
- secondary: "border-tint/10 bg-tint/[0.06] text-foreground",
705
- destructive: "border-destructive/40 bg-destructive/15 text-destructive",
706
- outline: "border-tint/10 text-foreground"
707
- } },
708
- defaultVariants: { variant: "default" }
709
- });
710
- //#endregion
711
- //#region packages/spinner/index.tsx
712
- function Te({ label: e, className: t }) {
713
- return /* @__PURE__ */ m("span", {
714
- role: e ? "status" : void 0,
715
- "aria-label": e,
716
- "aria-hidden": !e || void 0,
717
- className: A("zen__spinner inline-block size-4 shrink-0 animate-spin rounded-full border-2 border-current border-t-transparent", t)
718
- });
719
- }
720
- //#endregion
721
- //#region packages/button/index.tsx
722
- function V({ className: e, variant: t, size: n, loading: r = !1, disabled: i, type: a = "button", children: o, ...s }) {
723
- return /* @__PURE__ */ h("button", {
724
- type: a,
725
- disabled: i || r,
726
- "aria-busy": r || void 0,
727
- className: Ee({
728
- variant: t,
729
- size: n,
730
- className: e
731
- }),
732
- ...s,
733
- children: [r && /* @__PURE__ */ m(Te, {}), o]
734
- });
735
- }
736
- var Ee = z("zen__button inline-flex items-center justify-center gap-2 rounded-lg text-sm font-medium whitespace-nowrap outline-hidden select-none transition-[background-color,border-color,box-shadow,color,transform] duration-200 ease-out active:scale-[0.97] focus-visible:ring-2 focus-visible:ring-glow/50 disabled:pointer-events-none disabled:opacity-50", {
737
- variants: {
738
- variant: {
739
- default: "bg-primary bg-[linear-gradient(to_bottom,oklch(1_0_0/0.16),transparent)] text-primary-foreground shadow-[0_0_0_1px_oklch(var(--glow)/0.55),0_0_22px_-6px_oklch(var(--glow)/0.7),inset_0_1px_0_hsl(0_0%_100%/0.3)] hover:shadow-[0_0_0_1px_oklch(var(--glow)/0.8),0_0_28px_-4px_oklch(var(--glow)/0.85),inset_0_1px_0_hsl(0_0%_100%/0.35)]",
740
- secondary: "bg-primary/15 text-foreground shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.25)] hover:bg-primary/25",
741
- outline: "glow-edge border border-tint/10 bg-tint/[0.03] text-foreground hover:border-tint/20 hover:bg-tint/[0.07]",
742
- ghost: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground",
743
- destructive: "bg-destructive/90 text-destructive-foreground shadow-[0_0_0_1px_oklch(var(--destructive)/0.6),0_0_22px_-8px_oklch(var(--destructive)/0.7)] hover:bg-destructive",
744
- link: "h-auto! px-0! text-primary underline-offset-4 hover:underline",
745
- icon: "text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground"
746
- },
747
- size: {
748
- default: "h-10 px-4",
749
- sm: "h-8 px-3 text-xs",
750
- lg: "h-11 px-6",
751
- icon: "size-9"
752
- }
753
- },
754
- defaultVariants: {
755
- variant: "default",
756
- size: "default"
757
- }
758
- });
759
- //#endregion
760
- //#region packages/card/index.tsx
761
- function De({ title: e, action: t, children: n, className: r, ...i }) {
762
- return /* @__PURE__ */ h("section", {
763
- className: A("zen__card glass glow-edge text-card-foreground rounded-xl p-4 md:p-5", r),
764
- ...i,
765
- children: [(e || t) && /* @__PURE__ */ h("header", {
766
- className: "mb-4 flex items-center justify-between gap-4",
767
- children: [e && /* @__PURE__ */ m("h4", {
768
- className: "text-base font-semibold tracking-tight",
769
- children: e
770
- }), t]
771
- }), n]
772
- });
773
- }
774
- function Oe({ label: e, value: t, hint: n, tone: r = "default", className: i }) {
775
- return /* @__PURE__ */ h("div", {
776
- className: A("zen__stat glass glow-edge flex flex-col gap-1 rounded-xl p-3.5 md:p-4", i),
777
- children: [
778
- /* @__PURE__ */ m("span", {
779
- className: "text-muted-foreground truncate text-[0.68rem] tracking-[0.1em] uppercase sm:text-xs",
780
- children: e
781
- }),
782
- /* @__PURE__ */ m("span", {
783
- className: A("truncate text-lg font-semibold tracking-tight tabular-nums sm:text-xl md:text-2xl", r === "positive" && "text-primary text-glow", r === "negative" && "text-destructive"),
784
- children: t
785
- }),
786
- n && /* @__PURE__ */ m("span", {
787
- className: "text-muted-foreground text-xs",
788
- children: n
789
- })
790
- ]
791
- });
792
- }
793
- function ke({ children: e, className: t }) {
794
- return /* @__PURE__ */ m("div", {
795
- className: A("grid grid-cols-2 gap-3 sm:grid-cols-3 md:gap-4 [&>*]:min-w-0", "[&>*:last-child:nth-child(odd)]:col-span-2 sm:[&>*:last-child:nth-child(odd)]:col-span-1", t),
796
- children: e
797
- });
798
- }
799
- //#endregion
800
- //#region packages/code-block/index.tsx
801
- function Ae({ code: e, language: t, highlight: n, copyable: r = !0, variant: i = "glass", className: a, ...s }) {
802
- let c = e.trim(), [l, u] = d(!1);
803
- return o(() => {
804
- if (!l) return;
805
- let e = setTimeout(() => u(!1), 1500);
806
- return () => clearTimeout(e);
807
- }, [l]), /* @__PURE__ */ h("div", {
808
- className: A("zen__code-block group relative", i === "glass" && "glass glow-edge overflow-hidden rounded-xl", a),
809
- "data-language": t,
810
- ...s,
811
- children: [/* @__PURE__ */ m("pre", {
812
- className: "text-foreground m-0! overflow-x-auto rounded-none! bg-transparent! p-5! font-mono text-[13px]! leading-6 font-normal!",
813
- children: n ? /* @__PURE__ */ m("code", {
814
- className: "bg-transparent! p-0! text-inherit!",
815
- dangerouslySetInnerHTML: { __html: n(c, t) }
816
- }) : /* @__PURE__ */ m("code", {
817
- className: "bg-transparent! p-0! text-inherit!",
818
- children: c
819
- })
820
- }), r && /* @__PURE__ */ m("button", {
821
- type: "button",
822
- onClick: async () => {
823
- await navigator.clipboard?.writeText(c), u(!0);
824
- },
825
- className: A("text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 rounded-lg px-2.5 py-1 text-xs font-medium outline-hidden transition-[opacity,background-color,color] focus-visible:ring-2", "opacity-0 group-hover:opacity-100 focus-visible:opacity-100", l && "text-primary opacity-100"),
826
- children: l ? "Copied" : "Copy"
827
- })]
828
- });
829
- }
830
- //#endregion
831
- //#region packages/utils/styles.ts
832
- var H = "h-10 rounded-lg border border-tint/10 bg-tint/[0.035] px-3 text-sm text-foreground shadow-[inset_0_1px_0_hsl(0_0%_100%/0.04)] transition-[border-color,background-color,box-shadow] duration-200 placeholder:text-muted-foreground hover:border-tint/20 focus-visible:border-glow/60 focus-visible:bg-tint/[0.05] focus-visible:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-visible:outline-hidden disabled:cursor-not-allowed disabled:opacity-50", U = A(H, "inline-flex items-center justify-between gap-2 whitespace-nowrap"), W = "glass glass-blur rounded-xl text-foreground shadow-[var(--popup-shadow),0_0_40px_-20px_oklch(var(--glow)/0.5)] outline-hidden", je = "relative flex w-fit items-center gap-1 rounded-full border border-tint/5 bg-tint/[0.03] p-1", Me = "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]", Ne = "relative z-10 rounded-full px-3.5 py-1.5 text-sm whitespace-nowrap outline-hidden transition-colors duration-300 select-none focus-visible:ring-2 focus-visible:ring-ring/40", Pe = "flex w-full items-center gap-1.5 h-10 rounded-lg border border-tint/10 bg-tint/[0.035] px-3 text-sm text-foreground shadow-[inset_0_1px_0_hsl(0_0%_100%/0.04)] transition-[border-color,background-color,box-shadow] duration-200 placeholder:text-muted-foreground hover:border-tint/20 focus-within:border-glow/60 focus-within:bg-tint/[0.05] focus-within:shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)] focus-within:outline-hidden disabled:cursor-not-allowed disabled:opacity-50";
833
- //#endregion
834
- //#region packages/popover/index.tsx
835
- function G(e) {
836
- let { className: t, content: n, children: r, role: i = "tooltip", triggerType: a = "auto", trigger: c = "click", gap: l = "5px", triggerClassName: f, show: p, setShow: g, style: _, onOpen: v, onClose: y, ...b } = e, x = s().replace(/[^\w-]/g, "");
837
- N();
838
- let [S, C] = d(!1), w = u(null);
839
- return o(() => {
840
- let e = w.current;
841
- if (!e) return;
842
- let t = (e) => {
843
- let t = e.newState === "open";
844
- C(t), t ? v?.() : y?.();
845
- };
846
- return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
847
- }, [v, y]), o(() => {
848
- a === "manual" && (p ? w.current?.showPopover?.() : w.current?.hidePopover?.());
849
- }, [p, a]), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("div", {
850
- "aria-expanded": S,
851
- className: A("max-w-fit min-w-fit", f),
852
- style: { anchorName: `--zen-popover-anchor-${x}` },
853
- popoverTarget: `zen__popover-${x}`,
854
- popoverTargetAction: "toggle",
855
- onClick: c === "click" ? (e) => {
856
- switch (e.stopPropagation(), e.nativeEvent.stopImmediatePropagation(), a) {
857
- case "auto":
858
- w.current?.togglePopover?.();
859
- break;
860
- case "manual": g?.(!p);
861
- }
862
- } : void 0,
863
- onMouseEnter: c === "hover" ? (e) => {
864
- e.stopPropagation(), w.current?.showPopover?.();
865
- } : void 0,
866
- onMouseLeave: c === "hover" ? (e) => {
867
- e.stopPropagation(), w.current?.hidePopover?.();
868
- } : void 0,
869
- children: r
870
- }), /* @__PURE__ */ m("div", {
871
- ...b,
872
- ref: w,
873
- role: i,
874
- popover: a,
875
- id: `zen__popover-${x}`,
876
- className: A("zen__popover fixed z-50 w-[anchor-size(width)] min-w-max [justify-self:anchor-center] overflow-visible p-0 [position-area:block-end_center]", W, t),
877
- style: {
878
- ..._,
879
- "--gap": l,
880
- top: "calc(anchor(bottom) + var(--gap))",
881
- left: "calc(anchor(center) - 50%)",
882
- positionAnchor: `--zen-popover-anchor-${x}`
883
- },
884
- children: n
885
- })] });
886
- }
887
- //#endregion
888
- //#region packages/collapse/index.tsx
889
- function Fe(e) {
890
- let { items: t = [], children: n, moreItemsLabel: r = "", parentRef: i, data: a, estimator: s = (e, t) => t + 30, font: c = "12px Inter", badgeVariant: u = "secondary", badgeStyles: f } = e, [g, _] = d({
891
- visible: t,
892
- hidden: []
893
- }), v = l(() => {
894
- if (typeof document > "u") return null;
895
- let e = document.createElement("canvas").getContext("2d");
896
- return e && (e.font = c), e;
897
- }, []), y = () => {
898
- let e = i?.current;
899
- if (!e) return;
900
- let n = e.offsetWidth;
901
- if (b.reduce((e, t) => e + t, 0) <= n - 20) {
902
- _({
903
- visible: t,
904
- hidden: []
905
- });
906
- return;
907
- }
908
- let a = [], o = [], c = s(r, (v?.measureText(r).width ?? 0) + 10);
909
- b?.reduce((e, r, i) => (e + r + c > n - 20 ? o.push(t[i]) : a.push(t[i]), e + r), 0), _({
910
- visible: a,
911
- hidden: o
912
- });
913
- }, b = l(() => t?.map((e) => s(e, v?.measureText(e).width ?? 0)) ?? [], [t]);
914
- return o(() => {
915
- y();
916
- }, [t]), o(() => {
917
- if (!i?.current) return;
918
- let e = new ResizeObserver(() => {
919
- y();
920
- });
921
- return e.observe(i.current), () => {
922
- e.disconnect();
923
- };
924
- }, [t]), /* @__PURE__ */ h(p, { children: [g.visible?.map((e, t) => n(e, t, a?.[t])), g.hidden?.length > 0 && /* @__PURE__ */ m(G, {
925
- trigger: "click",
926
- triggerClassName: "flex rounded-md",
927
- content: /* @__PURE__ */ m("div", {
928
- className: "grid max-h-60 grid-flow-row grid-cols-2 gap-3 overflow-auto p-2",
929
- children: g.hidden.map((e, t) => n(e, g.visible.length + t, a?.[g.visible.length + t]))
930
- }),
931
- children: /* @__PURE__ */ m(B, {
932
- className: A("cursor-pointer", f),
933
- variant: u,
934
- "aria-label": `Show ${g.hidden.length} more ${r}`,
935
- children: /* @__PURE__ */ m("span", { children: `+${g.hidden.length} ${r}` })
936
- }, "more_items_button")
937
- })] });
938
- }
939
- //#endregion
940
- //#region packages/utils/status-icons.tsx
941
- function K({ className: e }) {
942
- return /* @__PURE__ */ m("svg", {
943
- viewBox: "0 0 16 16",
944
- fill: "none",
945
- stroke: "currentColor",
946
- strokeWidth: "2",
947
- strokeLinecap: "round",
948
- strokeLinejoin: "round",
949
- className: A("size-3.5", e),
950
- "aria-hidden": !0,
951
- children: /* @__PURE__ */ m("path", { d: "m3.5 8.5 3 3 6-7" })
952
- });
953
- }
954
- function q({ className: e }) {
955
- return /* @__PURE__ */ h("svg", {
956
- viewBox: "0 0 16 16",
957
- fill: "none",
958
- stroke: "currentColor",
959
- strokeWidth: "1.8",
960
- strokeLinecap: "round",
961
- strokeLinejoin: "round",
962
- className: A("size-3.5", e),
963
- "aria-hidden": !0,
964
- children: [/* @__PURE__ */ m("path", { d: "M8 2.2 1.6 13.3h12.8L8 2.2Z" }), /* @__PURE__ */ m("path", { d: "M8 6.5v3M8 11.6v.1" })]
965
- });
966
- }
967
- function J({ className: e }) {
968
- return /* @__PURE__ */ h("svg", {
969
- viewBox: "0 0 16 16",
970
- fill: "none",
971
- stroke: "currentColor",
972
- strokeWidth: "1.8",
973
- strokeLinecap: "round",
974
- className: A("size-3.5", e),
975
- "aria-hidden": !0,
976
- children: [/* @__PURE__ */ m("circle", {
977
- cx: "8",
978
- cy: "8",
979
- r: "6.3"
980
- }), /* @__PURE__ */ m("path", { d: "M8 7.3v3.8M8 4.9v.1" })]
981
- });
982
- }
983
- //#endregion
984
- //#region packages/toast/index.tsx
985
- var Ie = 5e3, Le = 300, Re = n(null), ze = n(null);
986
- function Be({ children: e, offset: t, viewportClassName: n }) {
987
- N();
988
- let [r, a] = d([]), s = u(0), c = u(/* @__PURE__ */ new Map()), l = u(/* @__PURE__ */ new Set()), [f, p] = d([]), [_, v] = d(!1);
989
- o(() => v(!0), []);
990
- let y = i((e) => (p((t) => [...t, e]), () => p((t) => t.filter((t) => t !== e))), []), b = f.at(-1) ?? (_ ? document.body : null), x = i((e) => {
991
- a((t) => t.map((t) => t.id === e ? {
992
- ...t,
993
- leaving: !0
994
- } : t)), setTimeout(() => {
995
- a((t) => t.filter((t) => t.id !== e)), c.current.delete(e), l.current.delete(e);
996
- }, Le);
997
- }, []), S = i((e, { description: t, tone: n = "info", action: r, timeout: i } = {}) => {
998
- let o = s.current++, c = {
999
- id: o,
1000
- title: e,
1001
- description: t,
1002
- tone: n,
1003
- action: r,
1004
- timeout: i ?? (r ? 1e4 : Ie)
1005
- };
1006
- return a((e) => [...e, c]), o;
1007
- }, []), C = r.slice(-3);
1008
- return /* @__PURE__ */ h(Re.Provider, {
1009
- value: S,
1010
- children: [/* @__PURE__ */ m(ze.Provider, {
1011
- value: y,
1012
- children: e
1013
- }), b && g(/* @__PURE__ */ m("section", {
1014
- ref: He,
1015
- popover: "manual",
1016
- "aria-label": "Notifications",
1017
- className: A("zen__toast-viewport fixed top-auto right-4 bottom-[calc(var(--zen-toast-offset,1rem)+env(safe-area-inset-bottom))] left-auto z-50 m-0 flex w-[calc(100vw-2rem)] flex-col-reverse gap-2.5 overflow-visible border-0 bg-transparent p-0 text-inherit md:bottom-5 md:w-[24rem]", n),
1018
- style: t ? { "--zen-toast-offset": t } : void 0,
1019
- children: C.map((e) => /* @__PURE__ */ m(Ge, {
1020
- toast: e,
1021
- onDismiss: () => x(e.id),
1022
- clocks: c.current,
1023
- entered: l.current
1024
- }, e.id))
1025
- }), b)]
1026
- });
1027
- }
1028
- function Ve(e, t) {
1029
- let n = a(ze);
1030
- o(() => {
1031
- let r = e.current;
1032
- if (n && t && r) return n(r);
1033
- }, [
1034
- n,
1035
- t,
1036
- e
1037
- ]);
1038
- }
1039
- function He(e) {
1040
- if (e?.showPopover) try {
1041
- e.showPopover();
1042
- } catch {}
1043
- }
1044
- function Ue() {
1045
- let e = a(Re);
1046
- if (!e) throw Error("useToast() needs a <ToastProvider> above it");
1047
- return e;
1048
- }
1049
- var We = {
1050
- success: {
1051
- icon: K,
1052
- ring: "border-primary/30",
1053
- badge: "bg-primary/15 text-primary",
1054
- bar: "bg-primary",
1055
- glow: "shadow-[0_18px_50px_-18px_oklch(var(--glow)/0.55)]"
1056
- },
1057
- error: {
1058
- icon: q,
1059
- ring: "border-destructive/40",
1060
- badge: "bg-destructive/15 text-destructive",
1061
- bar: "bg-destructive",
1062
- glow: "shadow-[0_18px_50px_-18px_oklch(var(--destructive)/0.55)]"
1063
- },
1064
- info: {
1065
- icon: J,
1066
- ring: "border-tint/10",
1067
- badge: "bg-tint/[0.08] text-foreground",
1068
- bar: "bg-muted-foreground",
1069
- glow: "shadow-[var(--toast-shadow)]"
1070
- }
1071
- };
1072
- function Ge({ toast: e, onDismiss: t, clocks: n, entered: r }) {
1073
- let i = We[e.tone] ?? We.info, a = i.icon, [s, c] = d(!1), l = u(null), [f] = d(() => !r.has(e.id));
1074
- o(() => {
1075
- l.current?.isConnected && r.add(e.id);
1076
- }, [r, e.id]), n.has(e.id) || n.set(e.id, {
1077
- spent: 0,
1078
- since: null
1079
- });
1080
- let p = n.get(e.id), g = p.spent + (p.since === null ? 0 : Date.now() - p.since);
1081
- return o(() => {
1082
- if (!e.timeout || s || e.leaving) return;
1083
- p.since = Date.now();
1084
- let n = setTimeout(t, Math.max(0, e.timeout - p.spent));
1085
- return () => {
1086
- clearTimeout(n), p.since !== null && (p.spent += Date.now() - p.since), p.since = null;
1087
- };
1088
- }, [
1089
- s,
1090
- e.timeout,
1091
- e.leaving,
1092
- t,
1093
- p
1094
- ]), /* @__PURE__ */ h("div", {
1095
- ref: l,
1096
- role: e.tone === "error" ? "alert" : "status",
1097
- "aria-atomic": "true",
1098
- onMouseEnter: () => c(!0),
1099
- onMouseLeave: () => c(!1),
1100
- className: A("zen__toast group glass glass-blur text-card-foreground relative flex items-start gap-3 overflow-hidden rounded-2xl border p-3.5 pr-10 select-none", "transition-[transform,opacity] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]", f && "starting:translate-y-3 starting:scale-[0.97] starting:opacity-0", e.leaving && "translate-x-6 opacity-0", i.ring, i.glow),
1101
- children: [
1102
- /* @__PURE__ */ m("span", {
1103
- className: A("mt-0.5 grid size-8 shrink-0 place-items-center rounded-full", i.badge),
1104
- "aria-hidden": !0,
1105
- children: /* @__PURE__ */ m(a, { className: "size-4" })
1106
- }),
1107
- /* @__PURE__ */ h("div", {
1108
- className: "flex min-w-0 flex-1 flex-col gap-0.5 pt-0.5",
1109
- children: [
1110
- /* @__PURE__ */ m("div", {
1111
- className: "text-sm font-semibold",
1112
- children: e.title
1113
- }),
1114
- e.description && /* @__PURE__ */ m("div", {
1115
- className: "text-muted-foreground text-sm leading-5",
1116
- children: e.description
1117
- }),
1118
- e.action && /* @__PURE__ */ m("button", {
1119
- type: "button",
1120
- onClick: () => {
1121
- e.action?.onClick(), t();
1122
- },
1123
- className: "border-tint/10 bg-tint/[0.06] hover:bg-tint/[0.12] focus-visible:ring-ring/50 mt-2 self-start rounded-lg border px-3 py-1 text-xs font-medium outline-hidden transition-colors focus-visible:ring-2",
1124
- children: e.action.label
1125
- })
1126
- ]
1127
- }),
1128
- /* @__PURE__ */ m("button", {
1129
- type: "button",
1130
- "aria-label": "Dismiss",
1131
- onClick: t,
1132
- className: "text-muted-foreground hover:bg-tint/[0.07] hover:text-foreground focus-visible:ring-ring/50 absolute top-2.5 right-2.5 grid size-7 place-items-center rounded-lg outline-hidden transition-colors focus-visible:ring-2",
1133
- children: /* @__PURE__ */ m("svg", {
1134
- viewBox: "0 0 16 16",
1135
- fill: "none",
1136
- stroke: "currentColor",
1137
- strokeWidth: "1.8",
1138
- strokeLinecap: "round",
1139
- className: "size-3.5",
1140
- "aria-hidden": !0,
1141
- children: /* @__PURE__ */ m("path", { d: "m4 4 8 8M12 4l-8 8" })
1142
- })
1143
- }),
1144
- e.timeout > 0 && /* @__PURE__ */ m("span", {
1145
- "aria-hidden": !0,
1146
- className: A("zen__toast-timer absolute bottom-0 left-0 h-0.5 w-full origin-left opacity-60 group-hover:[animation-play-state:paused]", i.bar),
1147
- style: {
1148
- animationDuration: `${e.timeout}ms`,
1149
- animationDelay: `${-g}ms`
1150
- }
1151
- })
1152
- ]
1153
- });
1154
- }
1155
- //#endregion
1156
- //#region packages/dialog/index.tsx
1157
- function Ke({ open: e, onOpenChange: t, title: n, description: r, children: i, dismissible: a = !0, initialFocus: c, size: l = "md", className: d, role: f }) {
1158
- N();
1159
- let p = u(null), g = s(), _ = s();
1160
- return o(() => {
1161
- let t = p.current;
1162
- if (t) {
1163
- if (e && !t.open) {
1164
- let e = document.documentElement;
1165
- e.toggleAttribute("data-zen-scrollbar", window.innerWidth > e.clientWidth), t.showModal(), c?.current?.focus();
1166
- } else !e && t.open && t.close();
1167
- }
1168
- }, [e, c]), Ve(p, e), /* @__PURE__ */ m("dialog", {
1169
- ref: p,
1170
- role: f,
1171
- "aria-labelledby": g,
1172
- "aria-describedby": r ? _ : void 0,
1173
- className: A("zen__dialog glass glass-blur glow-edge text-card-foreground", "bg-card/90! m-auto max-h-[calc(100dvh-2rem)] max-w-[calc(100vw-2rem)] overflow-visible rounded-xl p-0", l === "lg" ? "w-[60rem]" : "w-[28rem]", "backdrop:bg-black/50 backdrop:backdrop-blur-sm pointer-coarse:backdrop:backdrop-blur-none", d),
1174
- onCancel: (e) => {
1175
- e.preventDefault(), a && t?.(!1);
1176
- },
1177
- onClick: (e) => {
1178
- e.target === e.currentTarget && a && t?.(!1);
1179
- },
1180
- children: /* @__PURE__ */ h("div", {
1181
- className: "flex max-h-[calc(100dvh-2rem)] flex-col gap-4 overflow-x-hidden overflow-y-auto p-6",
1182
- children: [/* @__PURE__ */ h("div", {
1183
- className: "flex flex-col gap-2",
1184
- children: [/* @__PURE__ */ m("h2", {
1185
- id: g,
1186
- className: "text-lg font-semibold tracking-tight",
1187
- children: n
1188
- }), r && /* @__PURE__ */ m("p", {
1189
- id: _,
1190
- className: "text-muted-foreground mt-0! text-sm leading-5",
1191
- children: r
1192
- })]
1193
- }), i]
1194
- })
1195
- });
1196
- }
1197
- //#endregion
1198
- //#region packages/confirm-dialog/index.tsx
1199
- function qe({ open: e, onOpenChange: t, title: n, description: r, confirmLabel: i, cancelLabel: a = "Cancel", destructive: o = !1, onConfirm: s }) {
1200
- return /* @__PURE__ */ m(Ke, {
1201
- role: "alertdialog",
1202
- open: e,
1203
- onOpenChange: t,
1204
- title: n,
1205
- description: r,
1206
- className: "w-[26rem]",
1207
- children: /* @__PURE__ */ h("div", {
1208
- className: "flex justify-end gap-2",
1209
- children: [/* @__PURE__ */ m(V, {
1210
- variant: "outline",
1211
- autoFocus: !0,
1212
- onClick: () => t(!1),
1213
- children: a
1214
- }), /* @__PURE__ */ m(V, {
1215
- variant: o ? "destructive" : "default",
1216
- onClick: () => {
1217
- s(), t(!1);
1218
- },
1219
- children: i
1220
- })]
1221
- })
1222
- });
1223
- }
1224
- //#endregion
1225
- //#region packages/editable-cell/index.tsx
1226
- function Je({ children: e, editor: t, label: n, readOnly: r = !1, editing: i, onEditingChange: a, title: o, className: s }) {
1227
- let [c, l] = d(!1), u = i ?? c, f = (e) => {
1228
- i === void 0 && l(e), a?.(e);
1229
- };
1230
- return r ? /* @__PURE__ */ m("span", {
1231
- title: o,
1232
- className: A("zen__editable-cell block px-1 text-right tabular-nums", s),
1233
- children: e
1234
- }) : u ? /* @__PURE__ */ m(p, { children: t(() => f(!1)) }) : /* @__PURE__ */ m("button", {
1235
- type: "button",
1236
- title: o,
1237
- "aria-label": n ? `${n}. Edit` : void 0,
1238
- onClick: () => f(!0),
1239
- className: A("zen__editable-cell hover:bg-primary/10 focus-visible:ring-ring/50 w-full rounded-md px-1.5 py-0.5 text-right tabular-nums transition-colors focus-visible:ring-2 focus-visible:outline-hidden", s),
1240
- children: e
1241
- });
1242
- }
1243
- //#endregion
1244
- //#region packages/field/index.tsx
1245
- function Ye({ label: e, hint: n, error: i, children: a, className: o }) {
1246
- let c = s(), l = r(a) ? a : null, u = l?.props.id ?? `${c}-control`, d = n ? `${c}-hint` : void 0, f = i ? `${c}-error` : void 0, p = A(l?.props["aria-describedby"], d, f).trim() || void 0;
1247
- return /* @__PURE__ */ h("div", {
1248
- className: A("zen__field flex flex-col gap-2", o),
1249
- children: [
1250
- /* @__PURE__ */ m("label", {
1251
- htmlFor: u,
1252
- className: "text-sm leading-none font-medium",
1253
- children: e
1254
- }),
1255
- l ? t(l, {
1256
- id: u,
1257
- "aria-describedby": p,
1258
- "aria-invalid": i ? !0 : l.props["aria-invalid"]
1259
- }) : a,
1260
- n && /* @__PURE__ */ m("p", {
1261
- id: d,
1262
- className: "text-muted-foreground mt-0! text-xs",
1263
- children: n
1264
- }),
1265
- i && /* @__PURE__ */ h("p", {
1266
- id: f,
1267
- role: "alert",
1268
- className: "text-destructive mt-0! flex items-center gap-1.5 text-xs font-medium",
1269
- children: [/* @__PURE__ */ m(q, { className: "shrink-0" }), i]
1270
- })
1271
- ]
1272
- });
1273
- }
1274
- function Xe({ tone: e = "info", children: t, className: n }) {
1275
- let r = e === "error" ? q : e === "success" ? K : J;
1276
- return /* @__PURE__ */ h("p", {
1277
- role: e === "error" ? "alert" : "status",
1278
- className: A("mt-0! flex items-start gap-2 text-sm", e === "error" && "border-destructive/35 bg-destructive/10 text-destructive rounded-lg border px-3 py-2", e === "success" && "border-primary/30 bg-primary/10 text-primary rounded-lg border px-3 py-2", e === "info" && "text-muted-foreground", n),
1279
- children: [/* @__PURE__ */ m(r, { className: "mt-0.5 shrink-0" }), /* @__PURE__ */ m("span", { children: t })]
1280
- });
1281
- }
1282
- //#endregion
1283
- //#region packages/icons/search.tsx
1284
- function Ze(e) {
1285
- return /* @__PURE__ */ m("svg", {
1286
- xmlns: "http://www.w3.org/2000/svg",
1287
- fill: "none",
1288
- viewBox: "0 0 24 24",
1289
- strokeWidth: 1.5,
1290
- stroke: "currentColor",
1291
- className: "h-6 w-6",
1292
- ...e,
1293
- children: /* @__PURE__ */ m("path", {
1294
- strokeLinecap: "round",
1295
- strokeLinejoin: "round",
1296
- d: "m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"
1297
- })
1298
- });
1299
- }
1300
- //#endregion
1301
- //#region packages/icons/x-mark.tsx
1302
- function Qe(e) {
1303
- return /* @__PURE__ */ m("svg", {
1304
- xmlns: "http://www.w3.org/2000/svg",
1305
- fill: "none",
1306
- viewBox: "0 0 24 24",
1307
- strokeWidth: 1.5,
1308
- stroke: "currentColor",
1309
- className: "h-6 w-6",
1310
- ...e,
1311
- children: /* @__PURE__ */ m("path", {
1312
- strokeLinecap: "round",
1313
- strokeLinejoin: "round",
1314
- d: "M6 18 18 6M6 6l12 12"
1315
- })
1316
- });
1317
- }
1318
- //#endregion
1319
- //#region packages/input-group/index.tsx
1320
- function $e({ invalid: e, className: t, onMouseDown: n, ...r }) {
1321
- return /* @__PURE__ */ m("div", {
1322
- "data-invalid": e || void 0,
1323
- className: A("zen__input-group cursor-text", Pe, "has-disabled:bg-muted! has-disabled:text-muted-foreground has-disabled:cursor-not-allowed", e && "border-destructive! focus-within:shadow-[0_0_0_3px_oklch(var(--destructive)/0.16)]!", t),
1324
- onMouseDown: (e) => {
1325
- n?.(e);
1326
- let t = e.target;
1327
- if (e.defaultPrevented || t.closest("input, textarea, button, a, select, [tabindex]")) return;
1328
- let r = e.currentTarget.querySelector("input:not(:disabled)");
1329
- r && (e.preventDefault(), r.focus());
1330
- },
1331
- ...r
1332
- });
1333
- }
1334
- function Y({ className: e, ...t }) {
1335
- return /* @__PURE__ */ m("input", {
1336
- className: A("placeholder:text-muted-foreground h-full w-full min-w-0 flex-1 bg-transparent text-sm outline-hidden disabled:cursor-not-allowed", e),
1337
- ...t
1338
- });
1339
- }
1340
- function X({ className: e, ...t }) {
1341
- return /* @__PURE__ */ m("span", {
1342
- className: A("text-muted-foreground flex shrink-0 items-center gap-1 text-sm select-none [&_svg]:size-4", e),
1343
- ...t
1344
- });
1345
- }
1346
- //#endregion
1347
- //#region packages/utils/field-chevron.tsx
1348
- function Z({ open: e, className: t }) {
1349
- return /* @__PURE__ */ m("svg", {
1350
- viewBox: "0 0 16 16",
1351
- fill: "none",
1352
- stroke: "currentColor",
1353
- strokeWidth: "1.6",
1354
- strokeLinecap: "round",
1355
- strokeLinejoin: "round",
1356
- "aria-hidden": !0,
1357
- className: A("text-muted-foreground size-4 shrink-0 transition-transform duration-300", e && "rotate-180", t),
1358
- children: /* @__PURE__ */ m("path", { d: "m4 6 4 4 4-4" })
1359
- });
1360
- }
1361
- //#endregion
1362
- //#region packages/utils/useVirtualList.ts
1363
- function et({ count: e, itemHeight: t, scrollRef: n, overscan: r = 6 }) {
1364
- let i = (n, i) => {
1365
- let a = i || t * 10;
1366
- return {
1367
- first: Math.max(0, Math.floor(n / t) - r),
1368
- last: Math.min(e, Math.ceil((n + a) / t) + r)
1369
- };
1370
- }, [a, o] = d(() => i(0, 0));
1371
- c(() => {
1372
- let e = n.current;
1373
- if (!e) return;
1374
- let t = () => {
1375
- let t = i(e.scrollTop, e.clientHeight);
1376
- o((e) => e.first === t.first && e.last === t.last ? e : t);
1377
- };
1378
- t(), e.addEventListener("scroll", t, { passive: !0 });
1379
- let r = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
1380
- return r?.observe(e), () => {
1381
- e.removeEventListener("scroll", t), r?.disconnect();
1382
- };
1383
- }, [
1384
- n,
1385
- e,
1386
- t,
1387
- r
1388
- ]);
1389
- let s = Math.min(a.first, e), l = Math.min(a.last, e), u = [];
1390
- for (let e = s; e < l; e++) u.push({
1391
- index: e,
1392
- start: e * t,
1393
- size: t
1394
- });
1395
- let f = e * t;
1396
- return {
1397
- items: u,
1398
- totalSize: f,
1399
- paddingTop: u.length ? u[0].start : 0,
1400
- paddingBottom: u.length ? f - (u[u.length - 1].start + t) : 0
1401
- };
1402
- }
1403
- //#endregion
1404
- //#region packages/dropdown/index.tsx
1405
- function tt(e) {
1406
- let { items: t, selected: n, className: r, onChange: i, disabled: a, placeholder: o = "Select an Item", multiple: s, mutable: c, onAdd: l } = e, f = u(null), [p, g] = d(!1), _ = !!r && /(^|\s)w-full(\s|$)/.test(r);
1407
- return /* @__PURE__ */ m(G, {
1408
- triggerClassName: _ ? "w-full max-w-none" : void 0,
1409
- className: "min-w-0",
1410
- content: /* @__PURE__ */ m(nt, {
1411
- ...c ? {
1412
- mutable: c,
1413
- onAdd: l
1414
- } : { mutable: c },
1415
- ...s ? {
1416
- multiple: s,
1417
- items: t,
1418
- onChange: i,
1419
- selected: n
1420
- } : {
1421
- items: t,
1422
- onChange: i,
1423
- selected: n
1424
- }
1425
- }),
1426
- onOpen: () => g(!0),
1427
- onClose: () => g(!1),
1428
- children: /* @__PURE__ */ h("div", {
1429
- role: "combobox",
1430
- "aria-expanded": p,
1431
- "aria-haspopup": "listbox",
1432
- onClick: (e) => e.preventDefault(),
1433
- className: A(U, "w-56", "grow", a ? "cursor-not-allowed opacity-50" : "cursor-pointer", p && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", r),
1434
- children: [/* @__PURE__ */ m("div", {
1435
- className: A("flex min-w-0 flex-1 items-center gap-1 overflow-hidden text-sm", a ? "text-muted-foreground" : "text-foreground"),
1436
- ref: f,
1437
- children: s && !n.length ? /* @__PURE__ */ m("span", {
1438
- className: "text-muted-foreground",
1439
- children: o
1440
- }) : s ? /* @__PURE__ */ m(Fe, {
1441
- items: n.map((e) => e.text),
1442
- data: n,
1443
- parentRef: f,
1444
- estimator: (e, t) => t + 40,
1445
- badgeVariant: "secondary",
1446
- badgeStyles: "h-6 min-w-min gap-2",
1447
- children: (e, t, r) => /* @__PURE__ */ h(B, {
1448
- className: "flex h-6 min-w-min gap-2 pr-1",
1449
- variant: "secondary",
1450
- children: [e, /* @__PURE__ */ m(V, {
1451
- onClick: () => {
1452
- i(n.filter((e) => e.key !== r?.key));
1453
- },
1454
- variant: "icon",
1455
- size: "icon",
1456
- className: "group relative -top-px size-4 rounded-sm p-0.5",
1457
- children: /* @__PURE__ */ m(Qe, { className: "size-3 transition duration-300 group-hover:rotate-90" })
1458
- })]
1459
- }, `collapsed_item_${r?.key ?? t}`)
1460
- }) : n.text ?? o
1461
- }), /* @__PURE__ */ m(Z, { open: p })]
1462
- })
1463
- });
1464
- }
1465
- function nt(e) {
1466
- let { items: t, multiple: n, selected: r, onChange: i, mutable: a, onAdd: s } = e, [c, f] = d(""), p = u(null), g = l(() => t.reduce((e, t) => ((!c.length || t.text.toLowerCase().includes(c.toLowerCase())) && e.push(t), e), []), [t, c]), _ = et({
1467
- count: g.length,
1468
- itemHeight: 35,
1469
- scrollRef: p
1470
- });
1471
- o(() => {
1472
- p.current && (p.current.scrollTop = 0);
1473
- }, [c]);
1474
- let v = r instanceof Array ? r.map((e) => e.key) : [r.key];
1475
- return /* @__PURE__ */ h("div", {
1476
- className: "divide-tint/10 flex w-full flex-col divide-y overflow-hidden rounded-xl",
1477
- children: [/* @__PURE__ */ h("div", {
1478
- className: "flex h-10 grow items-center gap-2 px-3",
1479
- children: [/* @__PURE__ */ m(X, { children: /* @__PURE__ */ m(Ze, {}) }), /* @__PURE__ */ m(Y, {
1480
- placeholder: "Search",
1481
- "aria-label": "Search options",
1482
- value: c,
1483
- onChange: (e) => f(e.target.value)
1484
- })]
1485
- }), /* @__PURE__ */ h("ul", {
1486
- role: "listbox",
1487
- className: A("max-h-72 grow overflow-y-auto py-1", "focus:ring-0 focus:outline-hidden"),
1488
- ref: p,
1489
- children: [/* @__PURE__ */ m("div", {
1490
- style: {
1491
- height: `${_.totalSize}px`,
1492
- width: "100%",
1493
- position: "relative"
1494
- },
1495
- children: _.items.map((e) => /* @__PURE__ */ h("li", {
1496
- role: "option",
1497
- "aria-selected": v.includes(g[e.index].key),
1498
- style: {
1499
- height: `${e.size}px`,
1500
- transform: `translateY(${e.start}px)`
1501
- },
1502
- className: A("hover:bg-muted absolute top-0 left-0 grid w-full cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none"),
1503
- onClick: () => {
1504
- n ? v.includes(g[e.index].key) ? i(structuredClone(r.filter((t) => t.key !== g[e.index].key))) : i(structuredClone([...r, g[e.index]])) : i(g[e.index]);
1505
- },
1506
- children: [/* @__PURE__ */ m("span", {
1507
- className: "text-primary col-start-1",
1508
- "aria-hidden": !0,
1509
- children: v.includes(g[e.index].key) && /* @__PURE__ */ m(K, {})
1510
- }), /* @__PURE__ */ m("span", {
1511
- className: "col-start-2 truncate",
1512
- children: g[e.index].text
1513
- })]
1514
- }, e.index))
1515
- }), c.length > 0 && g.length === 0 && (a ? /* @__PURE__ */ h("li", {
1516
- role: "option",
1517
- "aria-selected": !1,
1518
- className: A("hover:bg-muted cursor-pointer px-3 py-2 text-sm select-none"),
1519
- onClick: () => {
1520
- s({
1521
- text: c,
1522
- key: c
1523
- }), f("");
1524
- },
1525
- children: ["Add ", c]
1526
- }) : /* @__PURE__ */ m("li", {
1527
- role: "option",
1528
- "aria-selected": !1,
1529
- className: A("text-muted-foreground cursor-not-allowed px-3 py-2 text-sm"),
1530
- children: "No results found"
1531
- }))]
1532
- })]
1533
- });
1534
- }
1535
- //#endregion
1536
- //#region packages/header/index.tsx
1537
- function rt({ className: e, children: t, ...n }) {
1538
- return N(), /* @__PURE__ */ m("header", {
1539
- className: A("zen__header border-tint/5 bg-background/60 sticky top-0 z-40 border-b pt-[env(safe-area-inset-top)] backdrop-blur-xl", "pointer-coarse:bg-background/95 pointer-coarse:backdrop-blur-none", e),
1540
- ...n,
1541
- children: /* @__PURE__ */ m("div", {
1542
- className: "flex items-center justify-between gap-4 px-4 py-2.5 md:gap-6 md:px-6 md:py-3",
1543
- children: t
1544
- })
1545
- });
1546
- }
1547
- //#endregion
1548
- //#region packages/icons/chevron-down.tsx
1549
- function it(e) {
1550
- return /* @__PURE__ */ m("svg", {
1551
- xmlns: "http://www.w3.org/2000/svg",
1552
- fill: "none",
1553
- viewBox: "0 0 24 24",
1554
- strokeWidth: 1.5,
1555
- stroke: "currentColor",
1556
- className: "h-6 w-6",
1557
- ...e,
1558
- children: /* @__PURE__ */ m("path", {
1559
- strokeLinecap: "round",
1560
- strokeLinejoin: "round",
1561
- d: "m19.5 8.25-7.5 7.5-7.5-7.5"
1562
- })
1563
- });
1564
- }
1565
- //#endregion
1566
- //#region packages/icons/chevron-left.tsx
1567
- function at(e) {
1568
- return /* @__PURE__ */ m("svg", {
1569
- xmlns: "http://www.w3.org/2000/svg",
1570
- fill: "none",
1571
- viewBox: "0 0 24 24",
1572
- strokeWidth: 1.5,
1573
- stroke: "currentColor",
1574
- className: "h-6 w-6",
1575
- ...e,
1576
- children: /* @__PURE__ */ m("path", {
1577
- strokeLinecap: "round",
1578
- strokeLinejoin: "round",
1579
- d: "M15.75 19.5 8.25 12l7.5-7.5"
1580
- })
1581
- });
1582
- }
1583
- //#endregion
1584
- //#region packages/icons/chevron-right.tsx
1585
- function ot(e) {
1586
- return /* @__PURE__ */ m("svg", {
1587
- xmlns: "http://www.w3.org/2000/svg",
1588
- fill: "none",
1589
- viewBox: "0 0 24 24",
1590
- strokeWidth: 1.5,
1591
- stroke: "currentColor",
1592
- className: "h-6 w-6",
1593
- ...e,
1594
- children: /* @__PURE__ */ m("path", {
1595
- strokeLinecap: "round",
1596
- strokeLinejoin: "round",
1597
- d: "m8.25 4.5 7.5 7.5-7.5 7.5"
1598
- })
1599
- });
1600
- }
1601
- //#endregion
1602
- //#region packages/icons/chevron-up.tsx
1603
- function st(e) {
1604
- return /* @__PURE__ */ m("svg", {
1605
- xmlns: "http://www.w3.org/2000/svg",
1606
- fill: "none",
1607
- viewBox: "0 0 24 24",
1608
- strokeWidth: 1.5,
1609
- stroke: "currentColor",
1610
- className: "h-6 w-6",
1611
- ...e,
1612
- children: /* @__PURE__ */ m("path", {
1613
- strokeLinecap: "round",
1614
- strokeLinejoin: "round",
1615
- d: "m4.5 15.75 7.5-7.5 7.5 7.5"
1616
- })
1617
- });
1618
- }
1619
- //#endregion
1620
- //#region packages/input/index.tsx
1621
- function ct(e) {
1622
- let { className: t, ...n } = e;
1623
- return /* @__PURE__ */ m("input", {
1624
- className: A(H, "w-full", "read-only:text-foreground read-only:cursor-default read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", "file:text-foreground file:border-0 file:bg-transparent file:text-sm file:font-medium", "[[type=\"checkbox\"]]:accent-primary [[type=\"checkbox\"]]:h-4 [[type=\"checkbox\"]]:w-4 [[type=\"checkbox\"]]:rounded-sm", "[[type=\"radio\"]]:accent-primary [[type=\"radio\"]]:h-4 [[type=\"radio\"]]:w-4", t),
1625
- ...n
1626
- });
1627
- }
1628
- //#endregion
1629
- //#region packages/meter/index.tsx
1630
- function lt({ value: e, max: t = 100, label: n, detail: r, hint: i, valueText: a, tone: o = "auto", warnAt: c = .85, className: l }) {
1631
- let u = s(), d = e > t, f = t > 0 ? e / t : +(e > 0), p = Math.min(100, Math.max(0, Math.round(f * 100))), g = o === "auto" ? d ? "danger" : f >= c ? "warning" : "default" : o;
1632
- return /* @__PURE__ */ h("div", {
1633
- role: "meter",
1634
- "aria-labelledby": n ? u : void 0,
1635
- "aria-valuemin": 0,
1636
- "aria-valuemax": t,
1637
- "aria-valuenow": Math.min(e, t),
1638
- "aria-valuetext": a,
1639
- className: A("zen__meter grid grid-cols-2 gap-y-1.5", l),
1640
- children: [
1641
- n && /* @__PURE__ */ m("span", {
1642
- id: u,
1643
- className: "text-sm font-medium",
1644
- children: n
1645
- }),
1646
- r && /* @__PURE__ */ m("span", {
1647
- className: A("col-start-2 text-right text-sm tabular-nums", g === "danger" ? "text-destructive" : "text-muted-foreground"),
1648
- children: r
1649
- }),
1650
- /* @__PURE__ */ m("div", {
1651
- className: "bg-muted col-span-2 h-2 overflow-hidden rounded-full",
1652
- children: /* @__PURE__ */ m("div", {
1653
- className: A("h-full rounded-full transition-[width] duration-700 ease-[cubic-bezier(0.2,0.8,0.2,1)]", g === "danger" ? "bg-destructive shadow-[0_0_12px_oklch(var(--destructive)/0.7)]" : g === "warning" ? "bg-accent-foreground shadow-[0_0_12px_oklch(var(--accent-foreground)/0.6)]" : "from-primary to-glow-2 bg-gradient-to-r shadow-[0_0_12px_oklch(var(--glow)/0.6)]"),
1654
- style: { width: `${p}%` }
1655
- })
1656
- }),
1657
- i && /* @__PURE__ */ m("span", {
1658
- className: A("col-span-2 text-xs", g === "danger" ? "text-destructive" : "text-muted-foreground"),
1659
- children: i
1660
- })
1661
- ]
1662
- });
1663
- }
1664
- //#endregion
1665
- //#region packages/utils/month.ts
1666
- var ut = /^(\d{4})-(0[1-9]|1[0-2])$/;
1667
- function dt(e) {
1668
- return typeof e == "string" && ut.test(e);
1669
- }
1670
- function Q(e) {
1671
- let t = ut.exec(e);
1672
- if (!t) throw Error(`Invalid month: ${e}`);
1673
- return Number(t[1]) * 12 + Number(t[2]) - 1;
1674
- }
1675
- function ft(e) {
1676
- let t = Math.floor(e / 12);
1677
- return `${String(t).padStart(4, "0")}-${String(e % 12 + 1).padStart(2, "0")}`;
1678
- }
1679
- function pt(e, t) {
1680
- return ft(Q(e) + t);
1681
- }
1682
- function mt(e, t) {
1683
- let n = [];
1684
- for (let r = Q(e); r <= Q(t); r++) n.push(ft(r));
1685
- return n;
1686
- }
1687
- function ht(e, t) {
1688
- return Q(t) - Q(e);
1689
- }
1690
- function gt(e = /* @__PURE__ */ new Date()) {
1691
- return `${e.getFullYear()}-${String(e.getMonth() + 1).padStart(2, "0")}`;
1692
- }
1693
- function _t(e, t, n = "short") {
1694
- let [r, i] = e.split("-").map(Number);
1695
- return new Intl.DateTimeFormat(t, {
1696
- month: n,
1697
- year: "numeric",
1698
- timeZone: "UTC"
1699
- }).format(Date.UTC(r, i - 1, 1));
1700
- }
1701
- function vt(e) {
1702
- let t = new Intl.DateTimeFormat(e, {
1703
- month: "short",
1704
- timeZone: "UTC"
1705
- });
1706
- return Array.from({ length: 12 }, (e, n) => t.format(Date.UTC(2e3, n, 1)));
1707
- }
1708
- //#endregion
1709
- //#region packages/month-picker/index.tsx
1710
- function yt({ value: e, onChange: t, locale: n, min: r, max: i, id: a, className: o, disabled: s = !1, placeholder: c = "Pick a month", onClear: l, clearLabel: u = "Clear", "aria-label": f }) {
1711
- let [g, _] = d(() => Number((e ?? (/* @__PURE__ */ new Date()).toISOString()).slice(0, 4))), v = P({ onOpenChange: (t) => t && e && _(Number(e.slice(0, 4))) }), y = vt(n), b = (e) => (!r || e >= r) && (!i || e <= i);
1712
- return /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("button", {
1713
- type: "button",
1714
- id: a,
1715
- disabled: s,
1716
- "aria-label": f,
1717
- ...v.triggerProps,
1718
- className: A("zen__month-picker group", U, "w-full", v.open && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", o),
1719
- children: [/* @__PURE__ */ m("span", {
1720
- className: e ? void 0 : "text-muted-foreground",
1721
- children: e ? _t(e, n) : c
1722
- }), /* @__PURE__ */ m(Z, { open: v.open })]
1723
- }), /* @__PURE__ */ h("div", {
1724
- ...v.popupProps,
1725
- role: "dialog",
1726
- "aria-label": "Choose month",
1727
- className: A("zen__popover", W, "w-64 p-3"),
1728
- children: [
1729
- /* @__PURE__ */ h("div", {
1730
- className: "mb-2 flex items-center justify-between",
1731
- children: [
1732
- /* @__PURE__ */ m("button", {
1733
- type: "button",
1734
- "aria-label": "Previous year",
1735
- onClick: () => _((e) => e - 1),
1736
- className: "hover:bg-muted rounded p-1.5",
1737
- children: /* @__PURE__ */ m(at, { className: "size-4" })
1738
- }),
1739
- /* @__PURE__ */ m("span", {
1740
- className: "text-sm font-semibold tabular-nums",
1741
- "aria-live": "polite",
1742
- children: g
1743
- }),
1744
- /* @__PURE__ */ m("button", {
1745
- type: "button",
1746
- "aria-label": "Next year",
1747
- onClick: () => _((e) => e + 1),
1748
- className: "hover:bg-muted rounded p-1.5",
1749
- children: /* @__PURE__ */ m(ot, { className: "size-4" })
1750
- })
1751
- ]
1752
- }),
1753
- /* @__PURE__ */ m("div", {
1754
- className: "grid grid-cols-3 gap-1",
1755
- children: y.map((r, i) => {
1756
- let a = `${g}-${String(i + 1).padStart(2, "0")}`, o = a === e;
1757
- return /* @__PURE__ */ m("button", {
1758
- type: "button",
1759
- disabled: !b(a),
1760
- "aria-pressed": o,
1761
- "aria-label": _t(a, n, "long"),
1762
- onClick: () => {
1763
- t(a), v.setOpen(!1);
1764
- },
1765
- className: A("rounded-sm py-2 text-sm disabled:cursor-not-allowed disabled:opacity-40", o ? "bg-primary text-primary-foreground" : "hover:bg-muted"),
1766
- children: r
1767
- }, a);
1768
- })
1769
- }),
1770
- l && e && /* @__PURE__ */ m("button", {
1771
- type: "button",
1772
- onClick: () => {
1773
- l(), v.setOpen(!1);
1774
- },
1775
- className: "border-tint/[0.06] text-muted-foreground hover:text-foreground focus-visible:ring-ring/40 mt-2 w-full rounded-lg border-t px-2 pt-2.5 pb-1.5 text-sm outline-hidden focus-visible:ring-2",
1776
- children: u
1777
- })
1778
- ]
1779
- })] });
1780
- }
1781
- //#endregion
1782
- //#region packages/money-input/index.tsx
1783
- function bt({ start: e, end: t, compact: n = !1, disabled: r = !1, id: i, autoFocus: a, className: o, "aria-label": s, ...c }) {
1784
- let l = xt(c);
1785
- return /* @__PURE__ */ h("div", {
1786
- className: A("zen__money-input flex flex-col gap-1", o),
1787
- children: [/* @__PURE__ */ h($e, {
1788
- invalid: !!l.error,
1789
- className: A(n && "h-7! border!"),
1790
- children: [
1791
- e ?? /* @__PURE__ */ m(X, {
1792
- "aria-hidden": !0,
1793
- "data-slot": "symbol",
1794
- children: l.symbol
1795
- }),
1796
- /* @__PURE__ */ m(Y, {
1797
- ...l.inputProps,
1798
- id: i,
1799
- autoFocus: a,
1800
- disabled: r,
1801
- "aria-label": s,
1802
- className: A("tabular-nums", n ? "text-right" : "text-left")
1803
- }),
1804
- t
1805
- ]
1806
- }), l.error && /* @__PURE__ */ h("p", {
1807
- id: l.errorId,
1808
- role: "alert",
1809
- className: "text-destructive mt-0! flex items-center gap-1.5 text-xs font-medium",
1810
- children: [/* @__PURE__ */ m(q, { className: "shrink-0" }), l.error]
1811
- })]
1812
- });
1813
- }
1814
- function xt({ value: e, onChange: t, currency: n, locale: r, allowNegative: i = !1, allowEmpty: a = !1, live: c = !1, onCancel: l }) {
1815
- let u = (e) => e === null ? "" : fe(e, n, r), [f, p] = d(() => u(e)), [m, h] = d(null), [g, _] = d(!1), [v, y] = d(!1), b = s();
1816
- o(() => {
1817
- !g && !(c && v) && p(u(e));
1818
- }, [
1819
- e,
1820
- n,
1821
- r
1822
- ]);
1823
- let x = `Not an amount. Try ${fe(3274e3, n, r)} or ${r.endsWith("-IN") ? "1.5L" : "10k"}.`;
1824
- function S(e) {
1825
- let t = e.trim();
1826
- if (t === "") {
1827
- if (a) return null;
1828
- h("Enter an amount.");
1829
- return;
1830
- }
1831
- let r;
1832
- try {
1833
- r = L(t, n);
1834
- } catch {
1835
- h(x);
1836
- return;
1837
- }
1838
- if (!i && r < 0) {
1839
- h("Amount can't be negative.");
1840
- return;
1841
- }
1842
- return h(null), r;
1843
- }
1844
- function C() {
1845
- let e = S(f);
1846
- return e !== void 0 && (p(u(e)), t(e), !0);
1847
- }
1848
- function w() {
1849
- let e = S(f);
1850
- e !== void 0 && p(u(e));
1851
- }
1852
- return {
1853
- inputProps: {
1854
- type: "text",
1855
- inputMode: "decimal",
1856
- autoComplete: "off",
1857
- spellCheck: !1,
1858
- value: f,
1859
- "aria-invalid": m ? !0 : void 0,
1860
- "aria-describedby": m ? b : void 0,
1861
- onChange: (e) => {
1862
- if (p(e.target.value), c) {
1863
- y(!0);
1864
- try {
1865
- let r = e.target.value.trim();
1866
- t(r === "" ? null : L(r, n));
1867
- } catch {
1868
- t(null);
1869
- }
1870
- }
1871
- },
1872
- onFocus: () => _(!0),
1873
- onBlur: () => {
1874
- _(!1), c ? w() : C();
1875
- },
1876
- onKeyDown: (t) => {
1877
- t.key === "Enter" ? (t.preventDefault(), c ? w() : C()) : t.key === "Escape" && (t.preventDefault(), p(u(e)), h(null), l?.());
1878
- }
1879
- },
1880
- symbol: pe(n, r),
1881
- error: m,
1882
- errorId: b,
1883
- text: f,
1884
- setText: p,
1885
- commit: C,
1886
- formatted: e === null ? "" : de(e, n, r)
1887
- };
1888
- }
1889
- //#endregion
1890
- //#region packages/utils/slot.tsx
1891
- function St({ children: e, className: n, ...i }) {
1892
- if (!r(e)) return null;
1893
- let a = e;
1894
- return t(a, {
1895
- ...i,
1896
- className: A(n, a.props.className)
1897
- });
1898
- }
1899
- //#endregion
1900
- //#region packages/nav-pills/index.tsx
1901
- var Ct = n(null);
1902
- function wt({ className: e, children: t, ...n }) {
1903
- let r = u(null), [i, a] = d(null);
1904
- return c(() => {
1905
- let e = r.current;
1906
- if (!e) return;
1907
- let t = () => {
1908
- let t = e.querySelector("[aria-current=\"page\"]");
1909
- a(t ? {
1910
- x: t.offsetLeft,
1911
- w: t.offsetWidth
1912
- } : null);
1913
- };
1914
- t();
1915
- let n = new MutationObserver(t);
1916
- n.observe(e, {
1917
- subtree: !0,
1918
- childList: !0,
1919
- attributes: !0,
1920
- attributeFilter: ["aria-current"]
1921
- });
1922
- let i = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
1923
- return i?.observe(e), () => {
1924
- n.disconnect(), i?.disconnect();
1925
- };
1926
- }, []), /* @__PURE__ */ m("nav", {
1927
- className: A("zen__nav-pills", e),
1928
- ...n,
1929
- children: /* @__PURE__ */ m("div", {
1930
- ref: r,
1931
- className: je,
1932
- children: /* @__PURE__ */ m(Ct.Provider, {
1933
- value: i,
1934
- children: t
1935
- })
1936
- })
1937
- });
1938
- }
1939
- function Tt({ className: e }) {
1940
- let t = a(Ct);
1941
- return t ? /* @__PURE__ */ m("span", {
1942
- "aria-hidden": !0,
1943
- className: A(Me, e),
1944
- style: {
1945
- translate: `${t.x}px 0`,
1946
- width: t.w
1947
- }
1948
- }) : null;
1949
- }
1950
- var Et = A(Ne, "text-muted-foreground hover:text-foreground aria-[current=page]:text-foreground aria-[current=page]:hover:text-foreground");
1951
- function Dt({ active: e, asChild: t, className: n, children: r, ...i }) {
1952
- let a = {
1953
- ...i,
1954
- "aria-current": e ? "page" : void 0,
1955
- className: A(Et, n)
1956
- };
1957
- return t ? (e || delete a["aria-current"], /* @__PURE__ */ m(St, {
1958
- ...a,
1959
- children: r
1960
- })) : /* @__PURE__ */ m("a", {
1961
- ...a,
1962
- children: r
1963
- });
1964
- }
1965
- //#endregion
1966
- //#region packages/page-header/index.tsx
1967
- function Ot({ eyebrow: e, title: t, lead: n, children: r, className: i }) {
1968
- return /* @__PURE__ */ h("header", {
1969
- className: A("zen__page-header flex flex-col gap-3", i),
1970
- children: [
1971
- e && /* @__PURE__ */ m("p", {
1972
- className: "text-muted-foreground mt-0! text-xs tracking-[0.1em] uppercase",
1973
- children: e
1974
- }),
1975
- /* @__PURE__ */ m("h1", {
1976
- className: "text-aurora text-4xl font-semibold tracking-tight lg:text-5xl",
1977
- children: t
1978
- }),
1979
- n && /* @__PURE__ */ m("p", {
1980
- className: "text-muted-foreground mt-0! max-w-2xl text-lg leading-relaxed",
1981
- children: n
1982
- }),
1983
- r
1984
- ]
1985
- });
1986
- }
1987
- //#endregion
1988
- //#region packages/progress-ring/index.tsx
1989
- function kt({ value: e, size: t = 84, stroke: n = 7, label: r, children: i, className: a }) {
1990
- let o = (t - n) / 2, s = 2 * Math.PI * o, c = Math.min(Math.max(e, 0), 1);
1991
- return /* @__PURE__ */ h("div", {
1992
- role: "progressbar",
1993
- "aria-label": r,
1994
- "aria-valuemin": 0,
1995
- "aria-valuemax": 100,
1996
- "aria-valuenow": Math.round(c * 100),
1997
- className: A("zen__progress-ring relative grid shrink-0 place-items-center", a),
1998
- style: {
1999
- width: t,
2000
- height: t
2001
- },
2002
- children: [/* @__PURE__ */ h("svg", {
2003
- width: t,
2004
- height: t,
2005
- viewBox: `0 0 ${t} ${t}`,
2006
- className: "-rotate-90",
2007
- "aria-hidden": !0,
2008
- children: [/* @__PURE__ */ m("circle", {
2009
- cx: t / 2,
2010
- cy: t / 2,
2011
- r: o,
2012
- fill: "none",
2013
- strokeWidth: n,
2014
- className: "stroke-tint/[0.07]"
2015
- }), /* @__PURE__ */ m("circle", {
2016
- cx: t / 2,
2017
- cy: t / 2,
2018
- r: o,
2019
- fill: "none",
2020
- strokeWidth: n,
2021
- strokeLinecap: "round",
2022
- strokeDasharray: s,
2023
- strokeDashoffset: s * (1 - c),
2024
- className: "stroke-primary [filter:drop-shadow(0_0_6px_oklch(var(--glow)/0.45))] transition-[stroke-dashoffset] duration-700 ease-out"
2025
- })]
2026
- }), /* @__PURE__ */ m("div", {
2027
- className: "absolute inset-0 grid place-items-center text-center",
2028
- children: i
2029
- })]
2030
- });
2031
- }
2032
- //#endregion
2033
- //#region packages/segmented/index.tsx
2034
- function At({ label: e, value: t, options: n, onChange: r, name: i, className: a }) {
2035
- let o = s(), l = u(null), [f, p] = d(null);
2036
- return c(() => {
2037
- let e = l.current;
2038
- if (!e) return;
2039
- let t = () => {
2040
- let t = e.querySelector("label:has(input:checked)");
2041
- p(t ? {
2042
- x: t.offsetLeft,
2043
- y: t.offsetTop,
2044
- w: t.offsetWidth,
2045
- h: t.offsetHeight
2046
- } : null);
2047
- };
2048
- t();
2049
- let n = typeof ResizeObserver > "u" ? null : new ResizeObserver(t);
2050
- return n?.observe(e), () => n?.disconnect();
2051
- }, [t, n]), /* @__PURE__ */ h("div", {
2052
- className: A("zen__segmented flex flex-col gap-2", a),
2053
- children: [/* @__PURE__ */ m("span", {
2054
- id: o,
2055
- className: "text-sm font-medium",
2056
- children: e
2057
- }), /* @__PURE__ */ h("div", {
2058
- ref: l,
2059
- role: "radiogroup",
2060
- "aria-labelledby": o,
2061
- className: "border-tint/10 bg-tint/[0.03] relative inline-flex w-fit flex-wrap gap-1 rounded-xl border p-1",
2062
- children: [f && /* @__PURE__ */ m("span", {
2063
- "aria-hidden": !0,
2064
- className: "bg-primary/15 absolute top-0 left-0 rounded-lg shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.4)] transition-[translate,width,height] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
2065
- style: {
2066
- translate: `${f.x}px ${f.y}px`,
2067
- width: f.w,
2068
- height: f.h
2069
- }
2070
- }), n.map((e) => /* @__PURE__ */ h("label", {
2071
- className: A("text-muted-foreground relative cursor-pointer rounded-lg px-3 py-1.5 text-sm transition-colors duration-300", "hover:text-foreground has-checked:text-foreground has-focus-visible:ring-ring/50 has-focus-visible:ring-2", !f && "has-checked:bg-primary/15 has-checked:shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.4)]"),
2072
- children: [/* @__PURE__ */ m("input", {
2073
- type: "radio",
2074
- className: "sr-only",
2075
- name: i ?? o,
2076
- value: e.value,
2077
- checked: t === e.value,
2078
- onChange: () => r(e.value)
2079
- }), e.label]
2080
- }, e.value))]
2081
- })]
2082
- });
2083
- }
2084
- //#endregion
2085
- //#region packages/select/index.tsx
2086
- function jt({ value: e, options: t, onChange: n, placeholder: r = "Select…", disabled: i = !1, renderOption: a, name: s, id: c, className: l, listClassName: f, "aria-label": g }) {
2087
- let _ = u(null), [v, y] = d(-1), b = u({
2088
- text: "",
2089
- at: 0
2090
- }), x = P({
2091
- matchWidth: !0,
2092
- onOpenChange: (n) => {
2093
- n && y(Math.max(0, t.findIndex((t) => t.value === e)));
2094
- }
2095
- });
2096
- o(() => {
2097
- x.open && _.current?.focus();
2098
- }, [x.open]);
2099
- let S = t.find((t) => t.value === e), C = (e) => `${x.id}-option-${e}`, w = (e) => {
2100
- let r = t[e];
2101
- r && !r.disabled && (n(r.value), x.setOpen(!1));
2102
- }, T = (e, n) => {
2103
- for (let r = 1; r <= t.length; r++) {
2104
- let i = (e + n * r + t.length * 2) % t.length;
2105
- if (!t[i].disabled) return i;
2106
- }
2107
- return e;
2108
- }, E = (e) => {
2109
- let n = {
2110
- ArrowDown: () => y((e) => T(e, 1)),
2111
- ArrowUp: () => y((e) => T(e, -1)),
2112
- Home: () => y(T(-1, 1)),
2113
- End: () => y(T(t.length, -1)),
2114
- Enter: () => w(v),
2115
- " ": () => w(v),
2116
- Tab: () => x.setOpen(!1)
2117
- };
2118
- if (n[e.key]) {
2119
- e.key !== "Tab" && e.preventDefault(), n[e.key]();
2120
- return;
2121
- }
2122
- if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {
2123
- let n = Date.now(), r = (n - b.current.at < 700 ? b.current.text : "") + e.key.toLowerCase();
2124
- b.current = {
2125
- text: r,
2126
- at: n
2127
- };
2128
- let i = t.findIndex((e) => !e.disabled && e.label.toLowerCase().startsWith(r));
2129
- i >= 0 && y(i);
2130
- }
2131
- };
2132
- return /* @__PURE__ */ h(p, { children: [
2133
- /* @__PURE__ */ h("button", {
2134
- type: "button",
2135
- id: c,
2136
- disabled: i,
2137
- "aria-haspopup": "listbox",
2138
- "aria-label": g,
2139
- ...x.triggerProps,
2140
- onKeyDown: (e) => {
2141
- ["ArrowDown", "ArrowUp"].includes(e.key) && !x.open && (e.preventDefault(), x.setOpen(!0));
2142
- },
2143
- className: A("zen__select group", U, "w-full", x.open && "border-glow/60 shadow-[0_0_0_3px_oklch(var(--glow)/0.16),0_0_24px_-6px_oklch(var(--glow)/0.6)]", l),
2144
- children: [/* @__PURE__ */ m("span", {
2145
- className: A("truncate", !S && "text-muted-foreground"),
2146
- children: S ? S.label : r
2147
- }), /* @__PURE__ */ m(Z, { open: x.open })]
2148
- }),
2149
- s && /* @__PURE__ */ m("input", {
2150
- type: "hidden",
2151
- name: s,
2152
- value: e ?? ""
2153
- }),
2154
- /* @__PURE__ */ m("div", {
2155
- ...x.popupProps,
2156
- className: A("zen__popover", W, "overflow-visible py-1", f),
2157
- children: /* @__PURE__ */ m("div", {
2158
- ref: _,
2159
- role: "listbox",
2160
- tabIndex: -1,
2161
- "aria-label": g,
2162
- "aria-activedescendant": v >= 0 ? C(v) : void 0,
2163
- onKeyDown: E,
2164
- className: "max-h-72 overflow-y-auto outline-hidden",
2165
- children: t.map((t, n) => /* @__PURE__ */ h("div", {
2166
- id: C(n),
2167
- role: "option",
2168
- "aria-selected": t.value === e,
2169
- "aria-disabled": t.disabled || void 0,
2170
- "data-highlighted": n === v || void 0,
2171
- onMouseMove: () => !t.disabled && y(n),
2172
- onClick: () => w(n),
2173
- className: A("grid cursor-pointer grid-cols-[1rem_1fr] items-center gap-2 px-3 py-2 text-sm outline-hidden select-none", "data-highlighted:bg-muted aria-disabled:cursor-not-allowed aria-disabled:opacity-50"),
2174
- children: [/* @__PURE__ */ m("span", {
2175
- className: "text-primary col-start-1",
2176
- "aria-hidden": !0,
2177
- children: t.value === e && /* @__PURE__ */ m(K, {})
2178
- }), /* @__PURE__ */ m("span", {
2179
- className: "col-start-2 truncate",
2180
- children: a ? a(t) : t.label
2181
- })]
2182
- }, t.value))
2183
- })
2184
- })
2185
- ] });
2186
- }
2187
- //#endregion
2188
- //#region packages/side-nav/index.tsx
2189
- function Mt({ className: e, ...t }) {
2190
- return /* @__PURE__ */ m("nav", {
2191
- className: A("zen__side-nav flex flex-col gap-6", e),
2192
- ...t
2193
- });
2194
- }
2195
- function Nt({ title: e, children: t, className: n }) {
2196
- return /* @__PURE__ */ h("div", {
2197
- className: A("flex flex-col gap-1", n),
2198
- children: [e && /* @__PURE__ */ m("span", {
2199
- className: "text-muted-foreground px-3 pb-1 text-[0.68rem] tracking-[0.1em] uppercase",
2200
- children: e
2201
- }), t]
2202
- });
2203
- }
2204
- var Pt = A("rounded-lg px-3 py-1.5 text-sm outline-hidden transition-[background-color,color,box-shadow] duration-200", "text-muted-foreground hover:bg-tint/[0.05] hover:text-foreground focus-visible:ring-ring/50 focus-visible:ring-2", "aria-[current=page]:bg-primary/15 aria-[current=page]:text-foreground aria-[current=page]:shadow-[inset_0_0_0_1px_oklch(var(--primary)/0.25)]");
2205
- function Ft({ active: e, asChild: t, className: n, children: r, ...i }) {
2206
- let a = {
2207
- ...i,
2208
- "aria-current": e ? "page" : void 0,
2209
- className: A(Pt, n)
2210
- };
2211
- return t ? (e || delete a["aria-current"], /* @__PURE__ */ m(St, {
2212
- ...a,
2213
- children: r
2214
- })) : /* @__PURE__ */ m("a", {
2215
- ...a,
2216
- children: r
2217
- });
2218
- }
2219
- //#endregion
2220
- //#region packages/skeleton/index.tsx
2221
- function It({ className: e }) {
2222
- return /* @__PURE__ */ m("span", {
2223
- "aria-hidden": !0,
2224
- className: A("zen__skeleton block rounded-md", e)
2225
- });
2226
- }
2227
- //#endregion
2228
- //#region packages/slider/index.tsx
2229
- function Lt({ value: e, min: t = 0, max: n = 100, step: r = 1, onValueChange: i, onValueCommit: a, trackBackground: s, thumbColor: c, valueText: l, className: d, style: f, ...p }) {
2230
- let h = u(null), g = u(a);
2231
- g.current = a, o(() => {
2232
- let e = h.current;
2233
- if (!e) return;
2234
- let t = () => g.current?.(Number(e.value));
2235
- return e.addEventListener("change", t), () => e.removeEventListener("change", t);
2236
- }, []);
2237
- let _ = n > t ? (e - t) / (n - t) * 100 : 0, v = s ?? `linear-gradient(to right, oklch(var(--primary)) ${_}%, oklch(var(--muted)) ${_}%)`;
2238
- return /* @__PURE__ */ m("input", {
2239
- ref: h,
2240
- type: "range",
2241
- min: t,
2242
- max: n,
2243
- step: r,
2244
- value: e,
2245
- "aria-valuetext": l?.(e),
2246
- onChange: (e) => i?.(Number(e.target.value)),
2247
- style: {
2248
- ...f,
2249
- "--zen-track": v,
2250
- "--zen-thumb": c ?? "oklch(var(--primary))"
2251
- },
2252
- className: A("zen__slider h-5 w-full cursor-pointer appearance-none bg-transparent outline-hidden disabled:cursor-not-allowed disabled:opacity-50", "[&::-webkit-slider-runnable-track]:h-2.5 [&::-webkit-slider-runnable-track]:rounded-full [&::-webkit-slider-runnable-track]:[background:var(--zen-track)]", "[&::-moz-range-track]:h-2.5 [&::-moz-range-track]:rounded-full [&::-moz-range-track]:[background:var(--zen-track)]", "[&::-webkit-slider-thumb]:-mt-[5px] [&::-webkit-slider-thumb]:size-5 [&::-webkit-slider-thumb]:appearance-none [&::-webkit-slider-thumb]:rounded-full [&::-webkit-slider-thumb]:border-2 [&::-webkit-slider-thumb]:border-white [&::-webkit-slider-thumb]:shadow-[0_0_0_1px_oklch(0_0_0/0.3),0_0_16px_oklch(var(--glow)/0.8)] [&::-webkit-slider-thumb]:[background:var(--zen-thumb)]", "[&::-moz-range-thumb]:size-5 [&::-moz-range-thumb]:rounded-full [&::-moz-range-thumb]:border-2 [&::-moz-range-thumb]:border-white [&::-moz-range-thumb]:shadow-[0_0_0_1px_oklch(0_0_0/0.3),0_0_16px_oklch(var(--glow)/0.8)] [&::-moz-range-thumb]:[background:var(--zen-thumb)]", "focus-visible:[&::-webkit-slider-thumb]:ring-ring/40 focus-visible:[&::-webkit-slider-thumb]:ring-4", d),
2253
- ...p
2254
- });
2255
- }
2256
- //#endregion
2257
- //#region packages/tab-bar/index.tsx
2258
- function Rt({ hideFrom: t = "md", className: n, children: r, ...i }) {
2259
- return /* @__PURE__ */ m("nav", {
2260
- className: A("zen__tab-bar glass glass-blur fixed inset-x-0 bottom-0 z-40 rounded-none! border-x-0! border-b-0! pb-[env(safe-area-inset-bottom)]", t === "sm" && "sm:hidden", t === "md" && "md:hidden", t === "lg" && "lg:hidden", n),
2261
- ...i,
2262
- children: /* @__PURE__ */ m("div", {
2263
- className: "grid",
2264
- style: { gridTemplateColumns: `repeat(${e.count(r)}, 1fr)` },
2265
- children: r
2266
- })
2267
- });
2268
- }
2269
- var zt = A("flex flex-col items-center gap-1 py-2.5 text-[0.7rem] outline-hidden transition-colors duration-200 focus-visible:bg-tint/5", "text-muted-foreground aria-[current=page]:text-primary [&_svg]:size-5 aria-[current=page]:[&_svg]:drop-shadow-[0_0_8px_oklch(var(--glow)/0.8)]");
2270
- function Bt({ icon: e, active: t, asChild: n, className: r, children: i, ...a }) {
2271
- let o = {
2272
- ...a,
2273
- "aria-current": t ? "page" : void 0,
2274
- className: A(zt, r)
2275
- };
2276
- return n ? (t || delete o["aria-current"], /* @__PURE__ */ m(St, {
2277
- ...o,
2278
- children: i
2279
- })) : /* @__PURE__ */ h("a", {
2280
- ...o,
2281
- children: [e, i]
2282
- });
2283
- }
2284
- //#endregion
2285
- //#region packages/table/index.tsx
2286
- function Vt({ label: e, className: t, ref: n, onScroll: r, ...a }) {
2287
- let s = u(null), c = i(() => {
2288
- let e = s.current;
2289
- if (!e) return;
2290
- let t = (t, n) => n !== e.hasAttribute(t) && e.toggleAttribute(t, n);
2291
- t("data-under-top", e.scrollTop > 0), t("data-under-left", e.scrollLeft > 0), t("data-under-bottom", e.scrollTop + e.clientHeight < e.scrollHeight - 1);
2292
- }, []);
2293
- return o(() => {
2294
- let e = s.current;
2295
- if (!e) return;
2296
- c();
2297
- let t = typeof ResizeObserver > "u" ? null : new ResizeObserver(c);
2298
- return t?.observe(e), e.firstElementChild && t?.observe(e.firstElementChild), () => t?.disconnect();
2299
- }, [c]), /* @__PURE__ */ m("div", {
2300
- className: A("zen__table-panel glass glow-edge isolate flex flex-col overflow-hidden rounded-xl", t),
2301
- children: /* @__PURE__ */ m("div", {
2302
- ref: (e) => {
2303
- s.current = e, typeof n == "function" ? n(e) : n && (n.current = e);
2304
- },
2305
- onScroll: (e) => {
2306
- c(), r?.(e);
2307
- },
2308
- role: e ? "region" : void 0,
2309
- "aria-label": e,
2310
- tabIndex: e ? 0 : void 0,
2311
- className: "zen__table-container focus-visible:ring-ring/30 min-h-0 overflow-auto rounded-[inherit] outline-hidden will-change-scroll focus-visible:ring-2 focus-visible:ring-inset",
2312
- ...a
2313
- })
2314
- });
2315
- }
2316
- function Ht({ className: e, ...t }) {
2317
- return /* @__PURE__ */ m("table", {
2318
- className: A("zen__table w-full border-separate border-spacing-0 text-sm", e),
2319
- ...t
2320
- });
2321
- }
2322
- function Ut({ className: e, ...t }) {
2323
- return /* @__PURE__ */ m("thead", {
2324
- className: A("zen__sticky-top sticky top-0 z-20", e),
2325
- ...t
2326
- });
2327
- }
2328
- function Wt(e) {
2329
- return /* @__PURE__ */ m("tbody", { ...e });
2330
- }
2331
- function Gt({ className: e, ...t }) {
2332
- return /* @__PURE__ */ m("tfoot", {
2333
- className: A("zen__sticky-bottom sticky bottom-0 z-20", e),
2334
- ...t
2335
- });
2336
- }
2337
- function Kt({ className: e, ...t }) {
2338
- return /* @__PURE__ */ m("tr", {
2339
- className: A("group", e),
2340
- ...t
2341
- });
2342
- }
2343
- function qt({ numeric: e, sticky: t, sortDirection: n, onSort: r, scope: i = "col", className: a, children: o, ...s }) {
2344
- return /* @__PURE__ */ m("th", {
2345
- scope: i,
2346
- "aria-sort": n === "asc" ? "ascending" : n === "desc" ? "descending" : void 0,
2347
- className: A("border-tint/[0.07] text-muted-foreground border-b px-3 py-2.5 align-middle text-xs leading-5 font-medium tracking-wider whitespace-nowrap uppercase", t === "left" && "zen__sticky-left sticky left-0 z-10", e ? "text-right" : "text-left", a),
2348
- ...s,
2349
- children: r ? /* @__PURE__ */ h("button", {
2350
- type: "button",
2351
- onClick: r,
2352
- className: A("hover:text-foreground inline-flex items-center gap-1 align-middle leading-5 tracking-wider uppercase", e && "flex-row-reverse"),
2353
- children: [o, /* @__PURE__ */ m("span", {
2354
- "aria-hidden": !0,
2355
- className: "inline-flex w-3",
2356
- children: n === "asc" ? /* @__PURE__ */ m(st, {
2357
- className: "size-3",
2358
- strokeWidth: 2.5
2359
- }) : n === "desc" ? /* @__PURE__ */ m(it, {
2360
- className: "size-3",
2361
- strokeWidth: 2.5
2362
- }) : null
2363
- })]
2364
- }) : o
2365
- });
2366
- }
2367
- function Jt({ numeric: e, sticky: t, className: n, ...r }) {
2368
- return /* @__PURE__ */ m("td", {
2369
- className: A("border-tint/[0.045] border-b px-3 py-2.5 transition-colors duration-150", "group-hover:[background-image:linear-gradient(oklch(var(--tint)/0.035),oklch(var(--tint)/0.035))]", t === "left" && "zen__sticky-left sticky left-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)]", e && "text-right tabular-nums", n),
2370
- ...r
2371
- });
2372
- }
2373
- function Yt({ numeric: e, sticky: t, className: n, ...r }) {
2374
- return /* @__PURE__ */ m("td", {
2375
- className: A("border-tint/[0.07] h-9 border-t px-3 font-medium whitespace-nowrap", t === "left" && "zen__sticky-left sticky left-0 z-10 shadow-[inset_-1px_0_0_oklch(var(--tint)/0.06)]", e && "text-right tabular-nums", n),
2376
- ...r
2377
- });
2378
- }
2379
- function Xt({ height: e, colSpan: t }) {
2380
- return e <= 0 ? null : /* @__PURE__ */ m("tr", {
2381
- "aria-hidden": !0,
2382
- children: /* @__PURE__ */ m("td", {
2383
- colSpan: t,
2384
- style: {
2385
- height: e,
2386
- padding: 0,
2387
- border: 0
2388
- }
2389
- })
2390
- });
2391
- }
2392
- function Zt({ colSpan: e, children: t = "Nothing here yet." }) {
2393
- return /* @__PURE__ */ m("tr", { children: /* @__PURE__ */ m("td", {
2394
- colSpan: e,
2395
- className: "text-muted-foreground px-3 py-8 text-center",
2396
- children: t
2397
- }) });
2398
- }
2399
- function Qt(e, t, n) {
2400
- let [r, i] = d(n ?? null);
2401
- return {
2402
- rows: l(() => {
2403
- if (!r) return e;
2404
- let n = t[r.key], i = [...e].sort(n);
2405
- return r.direction === "desc" ? i.reverse() : i;
2406
- }, [
2407
- e,
2408
- r,
2409
- t
2410
- ]),
2411
- sort: r,
2412
- setSort: i,
2413
- headProps: (e) => ({
2414
- sortDirection: r?.key === e ? r.direction : void 0,
2415
- onSort: () => i((t) => t?.key === e ? t.direction === "asc" ? {
2416
- key: e,
2417
- direction: "desc"
2418
- } : null : {
2419
- key: e,
2420
- direction: "asc"
2421
- })
2422
- })
2423
- };
2424
- }
2425
- //#endregion
2426
- //#region packages/table-of-contents/index.tsx
2427
- function $t({ items: e, title: t = "On this page", className: n }) {
2428
- let [r, i] = d();
2429
- return o(() => {
2430
- if (typeof IntersectionObserver > "u") return;
2431
- let t = e.map((e) => document.getElementById(e.id)).filter((e) => !!e), n = /* @__PURE__ */ new Set(), r = new IntersectionObserver((t) => {
2432
- for (let e of t) e.isIntersecting ? n.add(e.target.id) : n.delete(e.target.id);
2433
- let r = e.find((e) => n.has(e.id));
2434
- r && i(r.id);
2435
- }, { rootMargin: "0px 0px -65% 0px" });
2436
- return t.forEach((e) => r.observe(e)), () => r.disconnect();
2437
- }, [e]), e.length ? /* @__PURE__ */ h("nav", {
2438
- "aria-label": t,
2439
- className: A("zen__toc flex flex-col gap-3", n),
2440
- children: [/* @__PURE__ */ m("p", {
2441
- className: "text-muted-foreground mt-0! text-[0.68rem] tracking-[0.1em] uppercase",
2442
- children: t
2443
- }), /* @__PURE__ */ m("ul", {
2444
- className: "border-tint/[0.07] flex flex-col gap-2 border-l text-sm",
2445
- children: e.map((e) => /* @__PURE__ */ m("li", {
2446
- className: A("-ml-px", e.depth === 2 && "pl-3"),
2447
- children: /* @__PURE__ */ m("a", {
2448
- href: `#${e.id}`,
2449
- "aria-current": e.id === r ? "location" : void 0,
2450
- className: A("text-muted-foreground hover:text-foreground block border-l border-transparent pl-3 transition-colors", "aria-[current=location]:border-primary aria-[current=location]:text-foreground"),
2451
- children: e.label
2452
- })
2453
- }, e.id))
2454
- })]
2455
- }) : null;
2456
- }
2457
- //#endregion
2458
- //#region packages/tabs/index.tsx
2459
- var en = n(null);
2460
- function tn(e) {
2461
- let t = a(en);
2462
- if (!t) throw Error(`<${e}> must be inside <Tabs>`);
2463
- return t;
2464
- }
2465
- function nn({ value: e, defaultValue: t = "", onValueChange: n, className: r, ...i }) {
2466
- let [a, o] = d(t), c = e ?? a, l = s();
2467
- return /* @__PURE__ */ m(en.Provider, {
2468
- value: {
2469
- value: c,
2470
- select: (t) => {
2471
- e === void 0 && o(t), n?.(t);
2472
- },
2473
- idFor: (e, t) => `${l}-${e}-${t.replace(/\s+/g, "-")}`
2474
- },
2475
- children: /* @__PURE__ */ m("div", {
2476
- className: A("zen__tabs flex flex-col gap-4", r),
2477
- ...i
2478
- })
2479
- });
2480
- }
2481
- var rn = n("underline");
2482
- function an({ variant: e = "underline", className: t, children: n, ...r }) {
2483
- let { value: i } = tn("TabList"), a = e === "pills", o = u(null), [s, l] = d({
2484
- left: 0,
2485
- width: 0
2486
- });
2487
- return c(() => {
2488
- let e = o.current;
2489
- if (!e) return;
2490
- let t = () => {
2491
- let t = e.querySelector("[role=\"tab\"][aria-selected=\"true\"]");
2492
- l(t ? {
2493
- left: t.offsetLeft,
2494
- width: t.offsetWidth
2495
- } : {
2496
- left: 0,
2497
- width: 0
2498
- });
2499
- };
2500
- if (t(), typeof ResizeObserver > "u") return;
2501
- let n = new ResizeObserver(t);
2502
- return n.observe(e), () => n.disconnect();
2503
- }, [i]), /* @__PURE__ */ h("div", {
2504
- ref: o,
2505
- role: "tablist",
2506
- onKeyDown: (e) => {
2507
- let t = Array.from(o.current?.querySelectorAll("[role=\"tab\"]:not(:disabled)") ?? []), n = t.indexOf(document.activeElement);
2508
- if (n === -1) return;
2509
- let r = {
2510
- ArrowRight: n + 1,
2511
- ArrowLeft: n - 1,
2512
- Home: 0,
2513
- End: t.length - 1
2514
- }[e.key];
2515
- if (r === void 0) return;
2516
- e.preventDefault();
2517
- let i = t[(r + t.length) % t.length];
2518
- i.focus(), i.click();
2519
- },
2520
- className: A(a ? je : "border-border relative flex gap-1 border-b", t),
2521
- ...r,
2522
- children: [/* @__PURE__ */ m(rn.Provider, {
2523
- value: e,
2524
- children: n
2525
- }), a ? s.width > 0 && /* @__PURE__ */ m("span", {
2526
- "aria-hidden": !0,
2527
- className: "absolute top-1 bottom-1 left-0 rounded-full bg-primary/15 shadow-[inset_0_0_0_1px_oklch(var(--glow)/0.35),0_0_24px_-4px_oklch(var(--glow)/0.6)] transition-[translate,width] duration-500 ease-[cubic-bezier(0.2,0.8,0.2,1)]",
2528
- style: {
2529
- width: s.width,
2530
- translate: `${s.left}px 0`
2531
- }
2532
- }) : /* @__PURE__ */ m("span", {
2533
- "aria-hidden": !0,
2534
- className: "bg-primary absolute bottom-[-1px] left-0 h-0.5 transition-[translate,width] duration-150 ease-in-out",
2535
- style: {
2536
- width: s.width,
2537
- translate: `${s.left}px 0`
2538
- }
2539
- })]
2540
- });
2541
- }
2542
- function on({ value: e, className: t, onClick: n, ...r }) {
2543
- let { value: i, select: o, idFor: s } = tn("Tab"), c = a(rn), l = i === e;
2544
- return /* @__PURE__ */ m("button", {
2545
- type: "button",
2546
- role: "tab",
2547
- id: s("tab", e),
2548
- "aria-selected": l,
2549
- "aria-controls": s("panel", e),
2550
- tabIndex: l ? 0 : -1,
2551
- "data-active": l || void 0,
2552
- onClick: (t) => {
2553
- o(e), n?.(t);
2554
- },
2555
- className: A(c === "pills" ? Ne : "focus-visible:ring-ring px-3 py-2 text-sm whitespace-nowrap outline-hidden select-none focus-visible:ring-1", "text-muted-foreground hover:text-foreground data-active:text-foreground", t),
2556
- ...r
2557
- });
2558
- }
2559
- function sn({ value: e, className: t, ...n }) {
2560
- let { value: r, idFor: i } = tn("TabPanel");
2561
- return r === e ? /* @__PURE__ */ m("div", {
2562
- role: "tabpanel",
2563
- id: i("panel", e),
2564
- "aria-labelledby": i("tab", e),
2565
- tabIndex: 0,
2566
- className: A("outline-hidden", t),
2567
- ...n
2568
- }) : null;
2569
- }
2570
- //#endregion
2571
- //#region packages/tree/index.tsx
2572
- function cn({ items: e, getKey: t, getChildren: n, defaultExpanded: r = !0, rowHeight: a = 36 }) {
2573
- let [o, s] = d(() => /* @__PURE__ */ new Set()), [c, f] = d(null), [p, m] = d(null), h = u(null), g = i((e) => o.has(e) !== r, [o, r]), _ = l(() => {
2574
- let r = [], i = (e, a, o) => {
2575
- for (let s of e) {
2576
- let e = t(s), c = n(s), l = !!c?.length, u = l && g(e);
2577
- r.push({
2578
- item: s,
2579
- key: e,
2580
- depth: a,
2581
- parentKey: o,
2582
- hasChildren: l,
2583
- expanded: u
2584
- }), u && i(c, a + 1, e);
2585
- }
2586
- };
2587
- return i(e, 0, null), r;
2588
- }, [
2589
- e,
2590
- t,
2591
- n,
2592
- g
2593
- ]), v = () => {
2594
- let r = [], i = (e) => {
2595
- for (let a of e) {
2596
- let e = n(a);
2597
- e?.length && (r.push(t(a)), i(e));
2598
- }
2599
- };
2600
- return i(e), r;
2601
- }, y = i((e, t) => s((n) => {
2602
- let i = new Set(n);
2603
- return t === r ? i.delete(e) : i.add(e), i;
2604
- }), [r]), b = () => typeof window < "u" && (window.matchMedia?.("(prefers-reduced-motion: reduce)").matches || document.documentElement.classList.contains("reduce-motion")), x = (e) => {
2605
- if (!g(e)) {
2606
- let t = Date.now();
2607
- f({
2608
- key: e,
2609
- at: t
2610
- }), y(e, !0), setTimeout(() => f((e) => e?.at === t ? null : e), 320);
2611
- } else if (b()) y(e, !1);
2612
- else {
2613
- m(e);
2614
- let t = () => {
2615
- y(e, !1), m((t) => t === e ? null : t), h.current = null;
2616
- };
2617
- h.current = t, setTimeout(t, 500);
2618
- }
2619
- };
2620
- return {
2621
- rows: _,
2622
- toggle: x,
2623
- isExpanded: g,
2624
- expand: (e) => y(e, !0),
2625
- collapse: (e) => y(e, !1),
2626
- expandAll: () => s(r ? /* @__PURE__ */ new Set() : new Set(v())),
2627
- collapseAll: () => s(r ? new Set(v()) : /* @__PURE__ */ new Set()),
2628
- rowProps: (e) => ({
2629
- "aria-level": e.depth + 1,
2630
- "aria-expanded": e.hasChildren ? e.expanded : void 0,
2631
- "data-depth": e.depth,
2632
- className: A(c && e.parentKey === c.key && "zen__tree-row-enter", p && e.parentKey === p && "zen__tree-row-exit"),
2633
- style: { "--row-h": `${a - 1}px` },
2634
- onAnimationEnd: (t) => {
2635
- t.animationName === "zen-row-close" && p && e.parentKey === p && h.current?.();
2636
- }
2637
- }),
2638
- toggleProps: (e) => ({
2639
- expanded: e.expanded && p !== e.key,
2640
- onToggle: () => x(e.key)
2641
- }),
2642
- rowHeight: a
2643
- };
2644
- }
2645
- function ln({ row: e, tree: t, className: n, style: r, ...i }) {
2646
- let a = t.rowProps(e);
2647
- return /* @__PURE__ */ m(Kt, {
2648
- ...i,
2649
- ...a,
2650
- className: A(a.className, n),
2651
- style: {
2652
- ...a.style,
2653
- ...r
2654
- }
2655
- });
2656
- }
2657
- function un({ numeric: e, className: t, children: n, ...r }) {
2658
- return /* @__PURE__ */ m(Jt, {
2659
- numeric: e,
2660
- className: A("py-0 whitespace-nowrap", t),
2661
- ...r,
2662
- children: /* @__PURE__ */ m("div", {
2663
- className: A("zen__tree-cell flex h-[var(--row-h)] items-center", e && "justify-end"),
2664
- children: n
2665
- })
2666
- });
2667
- }
2668
- function dn({ row: e, tree: t, indent: n = 20, children: r, className: i }) {
2669
- return /* @__PURE__ */ h("div", {
2670
- className: A("flex min-w-0 flex-1 items-center gap-1", i),
2671
- style: { paddingLeft: e.depth * n },
2672
- children: [e.hasChildren ? /* @__PURE__ */ m(fn, { ...t.toggleProps(e) }) : /* @__PURE__ */ m("span", { className: "-ml-1 w-6 shrink-0" }), r]
2673
- });
2674
- }
2675
- function fn({ expanded: e, onToggle: t, className: n, ...r }) {
2676
- return /* @__PURE__ */ m("button", {
2677
- type: "button",
2678
- onClick: t,
2679
- "aria-label": e ? "Collapse" : "Expand",
2680
- "aria-expanded": e,
2681
- className: A("text-muted-foreground hover:bg-tint/[0.08] hover:text-foreground focus-visible:ring-ring/50 -ml-1 grid size-6 shrink-0 place-items-center rounded-md outline-hidden transition-colors focus-visible:ring-2", n),
2682
- ...r,
2683
- children: /* @__PURE__ */ m("svg", {
2684
- viewBox: "0 0 16 16",
2685
- fill: "none",
2686
- stroke: "currentColor",
2687
- strokeWidth: "2",
2688
- strokeLinecap: "round",
2689
- strokeLinejoin: "round",
2690
- "aria-hidden": !0,
2691
- className: A("size-4 transition-transform duration-200 ease-out", e && "rotate-90"),
2692
- children: /* @__PURE__ */ m("path", { d: "m6 3.5 4.5 4.5L6 12.5" })
2693
- })
2694
- });
2695
- }
2696
- //#endregion
2697
- //#region packages/textarea/index.tsx
2698
- function pn(e) {
2699
- let { className: t, ...n } = e;
2700
- return /* @__PURE__ */ m("textarea", {
2701
- className: A(H.replace("h-10", ""), "h-32 w-full resize-y py-2", "read-only:text-foreground read-only:cursor-default read-only:border-none! read-only:bg-transparent read-only:shadow-none! read-only:outline-hidden!", t),
2702
- ...n
2703
- });
2704
- }
2705
- //#endregion
2706
- //#region packages/toggle/index.tsx
2707
- function mn(e) {
2708
- let { className: t, onChange: n, onKeyDown: r, disabled: i, ...a } = e;
2709
- return /* @__PURE__ */ h("label", {
2710
- className: A("zen__toggle border-tint/10 bg-tint/[0.06] relative inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border p-0.5", "has-focus-visible:ring-glow/50 transition-[background-color,box-shadow,border-color] duration-300 has-focus-visible:ring-2", "has-checked:border-glow/60 has-checked:bg-glow/40 has-checked:shadow-[0_0_18px_-2px_oklch(var(--glow)/0.8)]", "has-disabled:cursor-not-allowed has-disabled:opacity-50", t),
2711
- children: [/* @__PURE__ */ m("input", {
2712
- type: "checkbox",
2713
- role: "switch",
2714
- className: "peer sr-only",
2715
- disabled: i,
2716
- onChange: (e) => n?.(e.target.checked),
2717
- onKeyDown: (e) => {
2718
- r?.(e), e.key === "Enter" && !e.defaultPrevented && (e.preventDefault(), e.currentTarget.click());
2719
- },
2720
- ...a
2721
- }), /* @__PURE__ */ m("span", {
2722
- "aria-hidden": !0,
2723
- className: A("size-[1.125rem] rounded-full bg-white/70 shadow-md", "transition-[translate,background-color] duration-300 ease-[cubic-bezier(0.2,0.8,0.2,1)]", "peer-checked:translate-x-5 peer-checked:bg-white")
2724
- })]
2725
- });
2726
- }
2727
- //#endregion
2728
- //#region packages/theme-toggle/index.tsx
2729
- var hn = (e = "theme") => `try{var t=localStorage.getItem(${JSON.stringify(e)}),r=document.documentElement;if(t==='light'||t==='dark'){r.classList.remove('light','dark');r.classList.add(t)}}catch(e){}`;
2730
- function gn({ storageKey: e = "theme" }) {
2731
- return /* @__PURE__ */ m("script", { dangerouslySetInnerHTML: { __html: hn(e) } });
2732
- }
2733
- function _n({ storageKey: e = "theme", className: t }) {
2734
- let [n, r] = d("dark");
2735
- o(() => r(document.documentElement.classList.contains("light") ? "light" : "dark"), []);
2736
- let i = n === "dark" ? "light" : "dark";
2737
- return /* @__PURE__ */ m("button", {
2738
- type: "button",
2739
- "aria-label": `Switch to ${i} theme`,
2740
- onClick: () => {
2741
- let t = document.documentElement;
2742
- t.classList.remove("dark", "light"), t.classList.add(i);
2743
- try {
2744
- localStorage.setItem(e, i);
2745
- } catch {}
2746
- r(i);
2747
- },
2748
- className: A("zen__theme-toggle text-muted-foreground hover:bg-tint/[0.06] hover:text-foreground focus-visible:ring-ring/50 grid size-9 place-items-center rounded-lg outline-hidden focus-visible:ring-2", t),
2749
- children: /* @__PURE__ */ m("svg", {
2750
- viewBox: "0 0 16 16",
2751
- fill: "none",
2752
- stroke: "currentColor",
2753
- strokeWidth: "1.5",
2754
- strokeLinecap: "round",
2755
- className: "size-4",
2756
- "aria-hidden": !0,
2757
- children: n === "dark" ? /* @__PURE__ */ m("path", { d: "M13.5 9.5A5.5 5.5 0 0 1 6.5 2.5a5.5 5.5 0 1 0 7 7Z" }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m("circle", {
2758
- cx: "8",
2759
- cy: "8",
2760
- r: "3"
2761
- }), /* @__PURE__ */ m("path", { d: "M8 1v1.5M8 13.5V15M1 8h1.5M13.5 8H15M3.05 3.05l1.06 1.06M11.89 11.89l1.06 1.06M3.05 12.95l1.06-1.06M11.89 4.11l1.06-1.06" })] })
2762
- })
2763
- });
2764
- }
2765
- //#endregion
2766
- //#region packages/utils/theme.ts
2767
- var vn = [
2768
- "mono",
2769
- "muted",
2770
- "balanced",
2771
- "vivid"
2772
- ], yn = [
2773
- {
2774
- id: "violet",
2775
- label: "Violet",
2776
- hue: 295,
2777
- intensity: "balanced",
2778
- tint: "tinted"
2779
- },
2780
- {
2781
- id: "ocean",
2782
- label: "Ocean",
2783
- hue: 250,
2784
- intensity: "balanced",
2785
- tint: "tinted"
2786
- },
2787
- {
2788
- id: "teal",
2789
- label: "Teal",
2790
- hue: 195,
2791
- intensity: "balanced",
2792
- tint: "tinted"
2793
- },
2794
- {
2795
- id: "forest",
2796
- label: "Forest",
2797
- hue: 150,
2798
- intensity: "muted",
2799
- tint: "tinted"
2800
- },
2801
- {
2802
- id: "amber",
2803
- label: "Amber",
2804
- hue: 75,
2805
- intensity: "balanced",
2806
- tint: "neutral"
2807
- },
2808
- {
2809
- id: "rose",
2810
- label: "Rose",
2811
- hue: 15,
2812
- intensity: "muted",
2813
- tint: "neutral"
2814
- },
2815
- {
2816
- id: "graphite",
2817
- label: "Graphite",
2818
- hue: 270,
2819
- intensity: "mono",
2820
- tint: "neutral"
2821
- }
2822
- ], bn = {
2823
- preset: "violet",
2824
- hue: 295,
2825
- intensity: "balanced",
2826
- tint: "tinted",
2827
- contrast: "standard",
2828
- glow: "soft",
2829
- topography: "subtle"
2830
- };
2831
- function xn(e, t) {
2832
- let n = yn.find((e) => e.id === t);
2833
- return {
2834
- ...e,
2835
- preset: n.id,
2836
- hue: n.hue,
2837
- intensity: n.intensity,
2838
- tint: n.tint
2839
- };
2840
- }
2841
- function Sn(e, t) {
2842
- return {
2843
- ...e,
2844
- ...t,
2845
- preset: "custom"
2846
- };
2847
- }
2848
- var Cn = {
2849
- mono: .012,
2850
- muted: .07,
2851
- balanced: .13,
2852
- vivid: .19
2853
- }, $ = (e, t, n) => `${wn(e, 3)} ${wn(t, 3)} ${wn((n % 360 + 360) % 360, 1)}`, wn = (e, t) => Math.round(e * 10 ** t) / 10 ** t;
2854
- function Tn(e, t = "dark") {
2855
- let n = e.hue, r = Cn[e.intensity], i = e.contrast === "high", a = e.tint === "tinted" ? Math.min(.014, r * .12) : .003, o = e.intensity === "mono", s = (e, t = 1) => $(e, a * t, n), c = { "topo-strength": String({
2856
- off: 0,
2857
- subtle: .55,
2858
- visible: 1
2859
- }[e.topography]) };
2860
- return t === "light" ? {
2861
- background: s(i ? .995 : .985, .4),
2862
- foreground: $(i ? .16 : .21, .02, n),
2863
- card: $(1, 0, 0),
2864
- "card-foreground": $(i ? .16 : .21, .02, n),
2865
- popover: $(1, 0, 0),
2866
- "popover-foreground": $(i ? .16 : .21, .02, n),
2867
- secondary: s(.955, .6),
2868
- "secondary-foreground": $(.21, .02, n),
2869
- muted: s(.96, .5),
2870
- "muted-foreground": s(i ? .42 : .5, 1.5),
2871
- border: s(i ? .78 : .91, .8),
2872
- input: s(i ? .78 : .91, .8),
2873
- primary: $(o ? .3 : .48, o ? .02 : Math.min(.22, r * 1.5), n),
2874
- "primary-foreground": $(.985, 0, 0),
2875
- accent: $(.95, o ? .005 : r * .25, n),
2876
- "accent-foreground": $(.42, o ? .02 : Math.min(.16, r * .9), n),
2877
- ring: $(o ? .3 : .48, o ? .02 : Math.min(.22, r * 1.5), n),
2878
- destructive: $(.55, .22, 25),
2879
- "destructive-foreground": $(.985, 0, 0),
2880
- glow: $(.62, o ? .02 : Math.min(.2, r * 1.4), n),
2881
- "glow-2": $(.65, o ? .02 : r * 1.05, n + 30),
2882
- tint: $(.21, .02, n),
2883
- "glow-strength": String({
2884
- off: 0,
2885
- soft: .4,
2886
- bright: .8
2887
- }[e.glow]),
2888
- ...c
2889
- } : {
2890
- background: s(i ? .13 : .155),
2891
- foreground: $(.97, .004, n),
2892
- card: s(i ? .17 : .195),
2893
- "card-foreground": $(.97, .004, n),
2894
- popover: s(i ? .18 : .21),
2895
- "popover-foreground": $(.97, .004, n),
2896
- secondary: s(.25),
2897
- "secondary-foreground": $(.97, .004, n),
2898
- muted: s(.235),
2899
- "muted-foreground": s(i ? .84 : .72, 1.5),
2900
- border: s(i ? .4 : .28, 1.5),
2901
- input: s(i ? .4 : .28, 1.5),
2902
- primary: $(o ? .88 : .72, r, n),
2903
- "primary-foreground": $(o ? .2 : .17, o ? .01 : .03, n),
2904
- accent: $(.3, r * .35, n),
2905
- "accent-foreground": $(.88, r * .5, n),
2906
- ring: $(.72, r, n),
2907
- destructive: $(.64, .2, 25),
2908
- "destructive-foreground": $(.985, 0, 0),
2909
- glow: $(.7, o ? .02 : r, n),
2910
- "glow-2": $(.72, o ? .02 : r * .75, n + 30),
2911
- tint: $(1, 0, 0),
2912
- "glow-strength": String({
2913
- off: 0,
2914
- soft: .55,
2915
- bright: 1
2916
- }[e.glow]),
2917
- ...c
2918
- };
2919
- }
2920
- function En(e, { appearance: t = "dark", target: n } = {}) {
2921
- let r = n ?? document.documentElement;
2922
- for (let [n, i] of Object.entries(Tn(e, t))) r.style.setProperty(`--${n}`, i);
2923
- }
2924
- function Dn(e) {
2925
- let t = e ?? document.documentElement;
2926
- for (let e of Object.keys(Tn(bn))) t.style.removeProperty(`--${e}`);
2927
- }
2928
- function On(e) {
2929
- let t = typeof e == "object" && e ? e : {}, n = (e, t, n) => t.includes(e) ? e : n, r = bn, i = yn.map((e) => e.id);
2930
- return {
2931
- preset: typeof t.preset == "string" && (t.preset === "custom" || i.includes(t.preset)) ? t.preset : r.preset,
2932
- hue: typeof t.hue == "number" && Number.isFinite(t.hue) ? (Math.round(t.hue) % 360 + 360) % 360 : r.hue,
2933
- intensity: n(t.intensity, vn, r.intensity),
2934
- tint: n(t.tint, ["neutral", "tinted"], r.tint),
2935
- contrast: n(t.contrast, ["standard", "high"], r.contrast),
2936
- glow: n(t.glow, [
2937
- "off",
2938
- "soft",
2939
- "bright"
2940
- ], r.glow),
2941
- topography: n(t.topography, [
2942
- "off",
2943
- "subtle",
2944
- "visible"
2945
- ], r.topography)
2946
- };
2947
- }
2948
- function kn(e) {
2949
- let [t, n, r] = e.split(" ").map(Number), i = n * Math.cos(r * Math.PI / 180), a = n * Math.sin(r * Math.PI / 180), o = (t + .3963377774 * i + .2158037573 * a) ** 3, s = (t - .1055613458 * i - .0638541728 * a) ** 3, c = (t - .0894841775 * i - 1.291485548 * a) ** 3, l = (e) => Math.min(1, Math.max(0, e));
2950
- return [
2951
- l(4.0767416621 * o - 3.3077115913 * s + .2309699292 * c),
2952
- l(-1.2684380046 * o + 2.6097574011 * s - .3413193965 * c),
2953
- l(-.0041960863 * o - .7034186147 * s + 1.707614701 * c)
2954
- ];
2955
- }
2956
- function An(e, t) {
2957
- let n = (e) => {
2958
- let [t, n, r] = kn(e);
2959
- return .2126 * t + .7152 * n + .0722 * r;
2960
- }, [r, i] = [n(e), n(t)].sort((e, t) => t - e);
2961
- return (r + .05) / (i + .05);
2962
- }
2963
- //#endregion
2964
- //#region packages/utils/useHydrated.ts
2965
- var jn = () => () => {};
2966
- function Mn() {
2967
- return f(jn, () => !0, () => !1);
2968
- }
2969
- //#endregion
2970
- export { ue as ActionsMenu, q as AlertTriangle, ye as AnimatedMoney, ve as AnimatedNumber, be as Avatar, Se as Backdrop, B as Badge, V as Button, De as Card, K as Check, it as ChevronDown, at as ChevronLeft, ot as ChevronRight, st as ChevronUp, Ae as CodeBlock, Fe as Collapse, qe as ConfirmDialog, bn as DEFAULT_THEME, Ke as Dialog, tt as Dropdown, Je as EditableCell, Ye as Field, Z as FieldChevron, Xe as FormMessage, rt as Header, vn as INTENSITIES, R as ImageCropError, J as InfoCircle, ct as Input, $e as InputGroup, X as InputGroupAddon, Y as InputGroupInput, lt as Meter, bt as MoneyInput, I as MoneyParseError, yt as MonthPicker, Dt as NavPill, Tt as NavPillIndicator, wt as NavPills, yn as PRESETS, Ot as PageHeader, G as Popover, kt as ProgressRing, Ze as Search, At as Segmented, jt as Select, Mt as SideNav, Nt as SideNavGroup, Ft as SideNavLink, It as Skeleton, Lt as Slider, Te as Spinner, Oe as Stat, ke as StatRow, on as Tab, Rt as TabBar, Bt as TabBarItem, an as TabList, sn as TabPanel, Ht as Table, Wt as TableBody, Jt as TableCell, Vt as TableContainer, Zt as TableEmpty, Gt as TableFooter, Yt as TableFooterCell, qt as TableHead, Ut as TableHeader, $t as TableOfContents, Kt as TableRow, Xt as TableSpacerRow, nn as Tabs, pn as TextArea, gn as ThemeScript, _n as ThemeToggle, Be as ToastProvider, mn as Toggle, un as TreeCell, dn as TreeLabel, ln as TreeRow, fn as TreeToggle, Qe as XMark, pt as addMonths, M as applyGraphicsMode, xn as applyPreset, En as applyTheme, Ee as buttonVariants, An as contrastRatio, xe as cropImageToSquare, pe as currencySymbol, gt as currentMonth, Sn as customize, z as cva, A as cx, ce as detectGraphicsMode, fe as formatAmount, de as formatMoney, _t as formatMonth, ft as fromMonthIndex, dt as isMonth, F as minorDigits, Q as monthIndex, vt as monthNames, mt as monthRange, ht as monthsBetween, On as normalizeTheme, kn as oklchToLinearRgb, me as parseMoney, L as parseMoneyInput, Dn as resetTheme, hn as themeScript, Tn as themeVars, P as useAnchoredPopup, Mn as useHydrated, xt as useMoneyInput, Qt as useSort, Ue as useToast, Ve as useToastHost, cn as useTree, et as useVirtualList };