@jfrader/ui 0.4.0 → 0.5.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 (257) hide show
  1. package/README.md +2 -0
  2. package/dist/{accordion-Bd-j04hW.js → accordion-xCI_u0BV.js} +2 -2
  3. package/dist/accordion.js +1 -1
  4. package/dist/{alert-BBqaKI4k.js → alert-DS_einpy.js} +1 -1
  5. package/dist/alert.js +1 -1
  6. package/dist/announcement-bar-B58xempt.js +382 -0
  7. package/dist/announcement-bar.js +2 -0
  8. package/dist/avatar-group-DOQQuV51.js +138 -0
  9. package/dist/avatar-group.js +2 -0
  10. package/dist/bottom-sheet-DPJBFkie.js +673 -0
  11. package/dist/bottom-sheet.js +2 -0
  12. package/dist/{breadcrumbs-DVAOxfvL.js → breadcrumbs-Cfw_hgt2.js} +1 -1
  13. package/dist/breadcrumbs.js +1 -1
  14. package/dist/{button-P2e7_44z.js → button-C92uYFJW.js} +1 -1
  15. package/dist/button.js +1 -1
  16. package/dist/calendar-B3Svu0X2.js +447 -0
  17. package/dist/calendar.js +1 -1
  18. package/dist/carousel-IvPqN-oM.js +472 -0
  19. package/dist/carousel.js +2 -0
  20. package/dist/{checkbox-COYG6L7d.js → checkbox-cFquiSdy.js} +1 -1
  21. package/dist/checkbox.js +1 -1
  22. package/dist/chip-group-DTQd_M-G.js +289 -0
  23. package/dist/chip-group.js +2 -0
  24. package/dist/code-block/shiki.js +147 -0
  25. package/dist/code-block-ahnRi-g8.js +292 -0
  26. package/dist/code-block.js +2 -0
  27. package/dist/collection-registry-k6JcD3Jr.js +44 -0
  28. package/dist/combobox-Bhzvu9ma.js +334 -0
  29. package/dist/combobox.js +1 -1
  30. package/dist/command-palette-BQ5LleGb.js +384 -0
  31. package/dist/command-palette.js +1 -1
  32. package/dist/copy-button-ByiA6D3R.js +252 -0
  33. package/dist/copy-button.js +2 -0
  34. package/dist/countdown-Dp_TD1VP.js +293 -0
  35. package/dist/countdown.js +2 -0
  36. package/dist/date-picker-5zKSSuFF.js +255 -0
  37. package/dist/date-picker.js +1 -1
  38. package/dist/date-range-picker-B5uFWsm-.js +562 -0
  39. package/dist/date-range-picker.js +2 -0
  40. package/dist/{dialog-xaydbXl2.js → dialog-ciiv9H2b.js} +19 -19
  41. package/dist/dialog.js +1 -1
  42. package/dist/drawer-DsASTiP-.js +553 -0
  43. package/dist/drawer.js +2 -0
  44. package/dist/empty-state-CDgrjPPf.js +142 -0
  45. package/dist/empty-state.js +2 -0
  46. package/dist/expandable-card-C-qJcZ14.js +340 -0
  47. package/dist/expandable-card.js +2 -0
  48. package/dist/field-anatomy-COVdNpf5.js +84 -0
  49. package/dist/file-dropzone-pR4v7owg.js +457 -0
  50. package/dist/file-dropzone.js +2 -0
  51. package/dist/filter-toolbar-D5KEKTSe.js +312 -0
  52. package/dist/filter-toolbar.js +2 -0
  53. package/dist/hold-to-confirm-DjB2EVjM.js +294 -0
  54. package/dist/hold-to-confirm.js +2 -0
  55. package/dist/hover-card-B-nrCIy2.js +347 -0
  56. package/dist/hover-card.js +2 -0
  57. package/dist/image-compare-ciuhPtQZ.js +415 -0
  58. package/dist/image-compare.js +2 -0
  59. package/dist/index.js +79 -38
  60. package/dist/inline-edit-C0eeml65.js +535 -0
  61. package/dist/inline-edit.js +2 -0
  62. package/dist/input-control-DmMuAuPS.js +34 -0
  63. package/dist/json-viewer-BcySQfjZ.js +798 -0
  64. package/dist/json-viewer.js +2 -0
  65. package/dist/listbox-style-WX-RASp1.js +59 -0
  66. package/dist/{media-D_eA_I-e.js → media-8yrN85VT.js} +2 -2
  67. package/dist/mention-input-BcQKX2EJ.js +599 -0
  68. package/dist/mention-input.js +2 -0
  69. package/dist/menu-xwOOUtWP.js +275 -0
  70. package/dist/menu.js +1 -1
  71. package/dist/metric-card-Bh9K4fZs.js +118 -0
  72. package/dist/metric-card.js +2 -0
  73. package/dist/multi-select-Pce_IYnz.js +590 -0
  74. package/dist/multi-select.js +2 -0
  75. package/dist/{navigation-DhnKriOp.js → navigation-sP5fiuQS.js} +4 -4
  76. package/dist/navigation.js +1 -1
  77. package/dist/overlay-layer-SeUyyEPD.js +64 -0
  78. package/dist/overlay-portal-C4JZFq2M.js +15 -0
  79. package/dist/{pagination-DYdwsxwe.js → pagination-DmXZ8E85.js} +1 -1
  80. package/dist/pagination.js +1 -1
  81. package/dist/password-field-03pWRkuY.js +250 -0
  82. package/dist/password-field.js +2 -0
  83. package/dist/popover-QHcEvf9c.js +119 -0
  84. package/dist/popover.js +1 -1
  85. package/dist/{progress-BpJswTG4.js → progress-CbOWBUdA.js} +4 -4
  86. package/dist/progress.js +1 -1
  87. package/dist/radio-cards-D2QZENI_.js +455 -0
  88. package/dist/radio-cards.js +2 -0
  89. package/dist/{radio-group-Ce0_IWQr.js → radio-group-E6mMRgo7.js} +4 -4
  90. package/dist/radio-group.js +1 -1
  91. package/dist/resizable-panels-BhjUVXZZ.js +519 -0
  92. package/dist/resizable-panels.js +2 -0
  93. package/dist/scroll-area-CcZyiSOQ.js +371 -0
  94. package/dist/scroll-area.js +2 -0
  95. package/dist/search-field-IxF0IJXm.js +274 -0
  96. package/dist/search-field.js +2 -0
  97. package/dist/segmented-control-yO1K1nbi.js +326 -0
  98. package/dist/segmented-control.js +2 -0
  99. package/dist/select-n_H52W1Z.js +292 -0
  100. package/dist/select.js +1 -1
  101. package/dist/signature-pad-q2SAsrdD.js +640 -0
  102. package/dist/signature-pad.js +2 -0
  103. package/dist/{skeleton-OoFlOEXO.js → skeleton-XQQDkCHd.js} +1 -1
  104. package/dist/skeleton.js +1 -1
  105. package/dist/slider-t0B5cecO.js +477 -0
  106. package/dist/slider.js +2 -0
  107. package/dist/sortable-data-table-tirqlLY2.js +365 -0
  108. package/dist/sortable-data-table.js +2 -0
  109. package/dist/{spinner-C2YDoiMn.js → spinner-DtxvDPdM.js} +1 -1
  110. package/dist/spinner.js +1 -1
  111. package/dist/split-button-Cb3EHs64.js +268 -0
  112. package/dist/split-button.js +2 -0
  113. package/dist/stepper-CruHbXxX.js +480 -0
  114. package/dist/stepper.js +2 -0
  115. package/dist/swipe-actions-DiZC57-3.js +418 -0
  116. package/dist/swipe-actions.js +2 -0
  117. package/dist/{switch-Dr-qjmT4.js → switch-qwv8jQnR.js} +1 -1
  118. package/dist/switch.js +1 -1
  119. package/dist/{tabs-CK_g1RKa.js → tabs-CAVJndX1.js} +2 -2
  120. package/dist/tabs.js +1 -1
  121. package/dist/tag-input-DSRCyrX2.js +418 -0
  122. package/dist/tag-input.js +2 -0
  123. package/dist/{text-field-D60ok14S.js → text-field-C8TWG-tY.js} +6 -5
  124. package/dist/text-field.js +1 -1
  125. package/dist/{textarea-DyfjtP0A.js → textarea-BrW0XcG_.js} +6 -5
  126. package/dist/textarea.js +1 -1
  127. package/dist/time-picker-Db8D49cP.js +305 -0
  128. package/dist/time-picker.js +2 -0
  129. package/dist/timeline-k3nURuCP.js +618 -0
  130. package/dist/timeline.js +2 -0
  131. package/dist/toast-BHxI32ZA.js +352 -0
  132. package/dist/toast-stack-DqrAzdg5.js +183 -0
  133. package/dist/toast-stack.js +2 -0
  134. package/dist/toast.js +1 -1
  135. package/dist/{toggle-group-CI0e7hFm.js → toggle-group-fcjzpifI.js} +4 -4
  136. package/dist/toggle-group.js +1 -1
  137. package/dist/tooltip-CkeiW9C1.js +113 -0
  138. package/dist/tooltip.js +1 -1
  139. package/dist/tree-view-C2liIxqy.js +360 -0
  140. package/dist/tree-view.js +2 -0
  141. package/dist/types/components/announcement-bar/announcement-bar.d.ts +75 -0
  142. package/dist/types/components/announcement-bar/index.d.ts +2 -0
  143. package/dist/types/components/avatar-group/avatar-group.d.ts +43 -0
  144. package/dist/types/components/avatar-group/index.d.ts +2 -0
  145. package/dist/types/components/bottom-sheet/bottom-sheet.d.ts +60 -0
  146. package/dist/types/components/bottom-sheet/index.d.ts +2 -0
  147. package/dist/types/components/calendar/calendar.d.ts +25 -1
  148. package/dist/types/components/calendar/index.d.ts +1 -1
  149. package/dist/types/components/carousel/carousel.d.ts +73 -0
  150. package/dist/types/components/carousel/index.d.ts +2 -0
  151. package/dist/types/components/chip-group/chip-group.d.ts +54 -0
  152. package/dist/types/components/chip-group/index.d.ts +1 -0
  153. package/dist/types/components/code-block/code-block.d.ts +58 -0
  154. package/dist/types/components/code-block/index.d.ts +1 -0
  155. package/dist/types/components/code-block/shiki.d.ts +3 -0
  156. package/dist/types/components/combobox/combobox.d.ts +1 -1
  157. package/dist/types/components/command-palette/command-palette.d.ts +1 -1
  158. package/dist/types/components/copy-button/copy-button.d.ts +49 -0
  159. package/dist/types/components/copy-button/index.d.ts +2 -0
  160. package/dist/types/components/countdown/countdown.d.ts +37 -0
  161. package/dist/types/components/countdown/index.d.ts +1 -0
  162. package/dist/types/components/date-picker/date-picker.d.ts +1 -1
  163. package/dist/types/components/date-range-picker/date-range-picker.d.ts +103 -0
  164. package/dist/types/components/date-range-picker/index.d.ts +2 -0
  165. package/dist/types/components/drawer/drawer.d.ts +59 -0
  166. package/dist/types/components/drawer/index.d.ts +2 -0
  167. package/dist/types/components/empty-state/empty-state.d.ts +36 -0
  168. package/dist/types/components/empty-state/index.d.ts +2 -0
  169. package/dist/types/components/expandable-card/expandable-card.d.ts +28 -0
  170. package/dist/types/components/expandable-card/index.d.ts +2 -0
  171. package/dist/types/components/field/field-anatomy.d.ts +4 -2
  172. package/dist/types/components/file-dropzone/file-dropzone.d.ts +93 -0
  173. package/dist/types/components/file-dropzone/index.d.ts +2 -0
  174. package/dist/types/components/filter-toolbar/filter-toolbar.d.ts +70 -0
  175. package/dist/types/components/filter-toolbar/index.d.ts +1 -0
  176. package/dist/types/components/hold-to-confirm/hold-to-confirm.d.ts +32 -0
  177. package/dist/types/components/hold-to-confirm/index.d.ts +2 -0
  178. package/dist/types/components/hover-card/hover-card.d.ts +97 -0
  179. package/dist/types/components/hover-card/index.d.ts +2 -0
  180. package/dist/types/components/image-compare/image-compare.d.ts +54 -0
  181. package/dist/types/components/image-compare/index.d.ts +1 -0
  182. package/dist/types/components/inline-edit/index.d.ts +2 -0
  183. package/dist/types/components/inline-edit/inline-edit.d.ts +93 -0
  184. package/dist/types/components/json-viewer/index.d.ts +2 -0
  185. package/dist/types/components/json-viewer/json-viewer.d.ts +82 -0
  186. package/dist/types/components/mention-input/index.d.ts +2 -0
  187. package/dist/types/components/mention-input/mention-input.d.ts +87 -0
  188. package/dist/types/components/menu/menu.d.ts +23 -5
  189. package/dist/types/components/metric-card/index.d.ts +1 -0
  190. package/dist/types/components/metric-card/metric-card.d.ts +37 -0
  191. package/dist/types/components/multi-select/index.d.ts +2 -0
  192. package/dist/types/components/multi-select/multi-select.d.ts +73 -0
  193. package/dist/types/components/password-field/index.d.ts +2 -0
  194. package/dist/types/components/password-field/password-field.d.ts +34 -0
  195. package/dist/types/components/popover/popover.d.ts +1 -1
  196. package/dist/types/components/radio-cards/index.d.ts +1 -0
  197. package/dist/types/components/radio-cards/radio-cards.d.ts +42 -0
  198. package/dist/types/components/resizable-panels/index.d.ts +2 -0
  199. package/dist/types/components/resizable-panels/resizable-panels.d.ts +42 -0
  200. package/dist/types/components/scroll-area/index.d.ts +2 -0
  201. package/dist/types/components/scroll-area/scroll-area.d.ts +34 -0
  202. package/dist/types/components/search-field/index.d.ts +1 -0
  203. package/dist/types/components/search-field/search-field.d.ts +31 -0
  204. package/dist/types/components/segmented-control/index.d.ts +2 -0
  205. package/dist/types/components/segmented-control/segmented-control.d.ts +32 -0
  206. package/dist/types/components/select/select.d.ts +1 -1
  207. package/dist/types/components/signature-pad/index.d.ts +2 -0
  208. package/dist/types/components/signature-pad/signature-pad.d.ts +104 -0
  209. package/dist/types/components/slider/index.d.ts +1 -0
  210. package/dist/types/components/slider/slider.d.ts +70 -0
  211. package/dist/types/components/sortable-data-table/index.d.ts +1 -0
  212. package/dist/types/components/sortable-data-table/sortable-data-table.d.ts +76 -0
  213. package/dist/types/components/split-button/index.d.ts +2 -0
  214. package/dist/types/components/split-button/split-button.d.ts +55 -0
  215. package/dist/types/components/stepper/index.d.ts +2 -0
  216. package/dist/types/components/stepper/stepper.d.ts +85 -0
  217. package/dist/types/components/swipe-actions/index.d.ts +2 -0
  218. package/dist/types/components/swipe-actions/swipe-actions.d.ts +44 -0
  219. package/dist/types/components/tag-input/index.d.ts +2 -0
  220. package/dist/types/components/tag-input/tag-input.d.ts +66 -0
  221. package/dist/types/components/time-picker/index.d.ts +2 -0
  222. package/dist/types/components/time-picker/time-picker.d.ts +48 -0
  223. package/dist/types/components/timeline/index.d.ts +2 -0
  224. package/dist/types/components/timeline/timeline.d.ts +66 -0
  225. package/dist/types/components/toast/toast.d.ts +37 -2
  226. package/dist/types/components/toast-stack/index.d.ts +2 -0
  227. package/dist/types/components/toast-stack/toast-stack.d.ts +28 -0
  228. package/dist/types/components/tooltip/tooltip.d.ts +1 -1
  229. package/dist/types/components/tree-view/index.d.ts +1 -0
  230. package/dist/types/components/tree-view/tree-view.d.ts +47 -0
  231. package/dist/types/components/usage-meter/index.d.ts +2 -0
  232. package/dist/types/components/usage-meter/usage-meter.d.ts +83 -0
  233. package/dist/types/index.d.ts +40 -0
  234. package/dist/types/overlay/overlay-layer.d.ts +33 -0
  235. package/dist/types/overlay/use-overlay-floating.d.ts +11 -1
  236. package/dist/types/styling/media.d.ts +1 -0
  237. package/dist/types/styling/theme.d.ts +12 -0
  238. package/dist/types/utils/use-controlled-state.d.ts +2 -1
  239. package/dist/usage-meter-qyQ3rYVv.js +463 -0
  240. package/dist/usage-meter.js +2 -0
  241. package/dist/use-controlled-state-DpeVQZNR.js +20 -0
  242. package/dist/use-latest-callback-cj1OOQL6.js +11 -0
  243. package/dist/use-overlay-floating-DvJifLpF.js +31 -0
  244. package/package.json +175 -3
  245. package/dist/calendar-C9Yad_-w.js +0 -394
  246. package/dist/collection-registry-BTYi6zGh.js +0 -98
  247. package/dist/combobox-DiMC2g_u.js +0 -327
  248. package/dist/command-palette-V_2pEay7.js +0 -379
  249. package/dist/date-picker-C29Uo4Tx.js +0 -250
  250. package/dist/field-anatomy-D2ToMeRa.js +0 -109
  251. package/dist/menu-CGPTNRnF.js +0 -216
  252. package/dist/popover-CdRXjQqI.js +0 -113
  253. package/dist/select-BgG7WgSh.js +0 -286
  254. package/dist/toast-CjmELMZZ.js +0 -283
  255. package/dist/tooltip-CaL3rKbV.js +0 -108
  256. package/dist/use-controlled-state-CVXDa-qM.js +0 -21
  257. package/dist/use-overlay-floating-Bit-f0FU.js +0 -31
@@ -0,0 +1,798 @@
1
+ 'use client';
2
+ import { r as e, t } from "./sx-Dx9JUKp5.js";
3
+ import { t as n } from "./disclosure-caret-C5T3fcl6.js";
4
+ import { t as r } from "./focus-ring-BK5W5_NY.js";
5
+ import { n as i, r as a } from "./media-8yrN85VT.js";
6
+ import { t as o } from "./use-controlled-state-DpeVQZNR.js";
7
+ import { t as s } from "./button-C92uYFJW.js";
8
+ import { n as c } from "./surface-DZ4d-2aL.js";
9
+ import { t as l } from "./text-field-C8TWG-tY.js";
10
+ import { useId as ee, useLayoutEffect as te, useMemo as u, useRef as d, useState as f } from "react";
11
+ import { vars as p } from "@jfrader/tokens/vars";
12
+ import { Fragment as m, jsx as h, jsxs as g } from "@emotion/react/jsx-runtime";
13
+ //#region src/components/json-viewer/json-viewer.tsx
14
+ var ne = 500, re = {
15
+ object: {
16
+ one: "key",
17
+ other: "keys"
18
+ },
19
+ array: {
20
+ one: "item",
21
+ other: "items"
22
+ }
23
+ }, ie = 50, ae = 2e3, oe = (e, t) => Number.isInteger(e) && e > 0 ? e : t, _ = (e) => e.children.length > 0, se = (e, t, n) => n ? `${e}[${t}]` : /^[A-Za-z_$][\w$]*$/.test(t) ? `${e}.${t}` : `${e}[${JSON.stringify(t)}]`, ce = (e) => e.type === "null" ? "null" : String(e.value);
24
+ function le(e, t) {
25
+ let n = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), i = [{
26
+ value: e,
27
+ path: t,
28
+ key: t,
29
+ level: 1,
30
+ index: 0
31
+ }];
32
+ try {
33
+ for (; i.length;) {
34
+ let e = i.pop();
35
+ if ("exit" in e) {
36
+ r.delete(e.exit);
37
+ continue;
38
+ }
39
+ let { value: t } = e, a = t === null ? "null" : Array.isArray(t) ? "array" : typeof t;
40
+ if (![
41
+ "null",
42
+ "array",
43
+ "object",
44
+ "string",
45
+ "number",
46
+ "boolean"
47
+ ].includes(a) || a === "number" && !Number.isFinite(t)) return null;
48
+ let o = {
49
+ ...e,
50
+ value: t,
51
+ type: a,
52
+ children: []
53
+ };
54
+ if (n.set(o.path, o), typeof t != "object" || !t) continue;
55
+ if (r.has(t) || Object.getOwnPropertySymbols(t).length) return null;
56
+ let s = Array.isArray(t);
57
+ if (s && Object.getPrototypeOf(t) !== Array.prototype || !s && Object.getPrototypeOf(t) !== Object.prototype && Object.getPrototypeOf(t) !== null) return null;
58
+ let c = Object.getOwnPropertyDescriptors(t), l = Object.keys(c).filter((e) => !s || e !== "length");
59
+ if (s && (l.length !== t.length || l.some((e, t) => e !== String(t))) || l.some((e) => !("value" in c[e]) || !c[e].enumerable)) return null;
60
+ r.add(t), i.push({ exit: t }), o.children = l.map((e) => se(o.path, e, s));
61
+ for (let e = l.length - 1; e >= 0; e--) {
62
+ let t = l[e];
63
+ i.push({
64
+ value: c[t].value,
65
+ path: o.children[e],
66
+ key: t,
67
+ parent: o.path,
68
+ level: o.level + 1,
69
+ index: e
70
+ });
71
+ }
72
+ }
73
+ return n;
74
+ } catch {
75
+ return null;
76
+ }
77
+ }
78
+ var ue = "2px", de = {
79
+ scrollbarWidth: "thin",
80
+ scrollbarColor: `${p.color.borderStrong} transparent`
81
+ }, fe = e({
82
+ ...c,
83
+ minInlineSize: 0,
84
+ borderRadius: p.radius.lg,
85
+ boxShadow: p.shadow.raised,
86
+ fontSize: p.textSize.sm,
87
+ overflow: "hidden"
88
+ }), pe = e({
89
+ display: "flex",
90
+ flexWrap: "wrap",
91
+ alignItems: "center",
92
+ gap: p.space[1],
93
+ padding: p.space[2],
94
+ borderBlockEnd: `1px solid ${p.color.border}`
95
+ }), me = e({
96
+ position: "relative",
97
+ display: "flex",
98
+ alignItems: "center",
99
+ flex: "1 1 12rem",
100
+ minInlineSize: 0
101
+ }), he = e({
102
+ position: "absolute",
103
+ insetInlineStart: p.space[3],
104
+ display: "inline-flex",
105
+ color: p.color.textMuted,
106
+ pointerEvents: "none",
107
+ "& svg": {
108
+ inlineSize: p.space[4],
109
+ blockSize: p.space[4]
110
+ }
111
+ }), ge = e({
112
+ flex: 1,
113
+ minInlineSize: 0
114
+ }), _e = e({ paddingInlineStart: `calc(${p.space[3]} + ${p.space[4]} + ${p.space[2]})` }), ve = e({
115
+ color: p.color.textMuted,
116
+ fontSize: p.textSize.xs,
117
+ fontVariantNumeric: "tabular-nums",
118
+ whiteSpace: "nowrap",
119
+ paddingInline: p.space[1],
120
+ "&:empty": { paddingInline: 0 }
121
+ }), ye = e({
122
+ display: "flex",
123
+ alignItems: "center",
124
+ gap: p.space[1],
125
+ marginInlineStart: "auto"
126
+ }), be = e({
127
+ alignSelf: "center",
128
+ inlineSize: "1px",
129
+ blockSize: p.space[4],
130
+ marginInline: p.space[1],
131
+ background: p.color.border
132
+ }), xe = e({
133
+ inlineSize: p.space[8],
134
+ paddingInline: 0,
135
+ color: p.color.textMuted,
136
+ "&:hover:not(:disabled)": { color: p.color.text },
137
+ "& svg": {
138
+ inlineSize: p.space[4],
139
+ blockSize: p.space[4]
140
+ }
141
+ }), Se = e({
142
+ ...de,
143
+ overflow: "auto",
144
+ maxBlockSize: "var(--json-max-height)",
145
+ padding: p.space[2],
146
+ fontFamily: p.font.mono,
147
+ "--json-indent": p.space[5],
148
+ "--json-caret": p.space[4],
149
+ "@media (max-width: 40rem)": { "--json-indent": p.space[4] }
150
+ }), Ce = e({
151
+ outline: "none",
152
+ "&:focus-visible > [data-ui=\"json-viewer-row\"]": r
153
+ }), we = e({
154
+ display: "flex",
155
+ alignItems: "center",
156
+ gap: p.space[1],
157
+ minBlockSize: "var(--json-row-height)",
158
+ paddingInlineEnd: p.space[3],
159
+ paddingInlineStart: `calc(var(--json-depth) * var(--json-indent) + ${p.space[1]})`,
160
+ borderInlineStart: `${ue} solid transparent`,
161
+ borderRadius: p.radius.sm,
162
+ cursor: "pointer",
163
+ whiteSpace: "pre",
164
+ minInlineSize: "max-content",
165
+ transitionProperty: "background-color",
166
+ transitionDuration: p.motion.duration.fast,
167
+ transitionTimingFunction: p.motion.easeStandard,
168
+ "&:hover": { background: p.color.surfaceHover },
169
+ "[aria-selected=\"true\"] > &": {
170
+ borderInlineStartColor: p.color.accent,
171
+ background: p.color.accentSoft
172
+ },
173
+ [a]: { transitionDuration: "0s" },
174
+ [i]: {
175
+ color: "CanvasText",
176
+ "[aria-selected=\"true\"] > &": { borderInlineStartColor: "Highlight" }
177
+ }
178
+ }), Te = e({
179
+ position: "relative",
180
+ "&::before": {
181
+ content: "\"\"",
182
+ position: "absolute",
183
+ insetBlock: 0,
184
+ insetInlineStart: `calc(var(--json-depth) * var(--json-indent) + ${p.space[1]} + ${ue} + var(--json-caret) / 2)`,
185
+ inlineSize: "1px",
186
+ background: p.color.border,
187
+ pointerEvents: "none"
188
+ },
189
+ [i]: { "&::before": { background: "GrayText" } }
190
+ }), Ee = e({
191
+ display: "inline-flex",
192
+ alignItems: "center",
193
+ justifyContent: "center",
194
+ flexShrink: 0,
195
+ inlineSize: "var(--json-caret)",
196
+ color: p.color.textMuted,
197
+ "&[data-state]::after": n,
198
+ "&[data-state=\"open\"]::after": { transform: "rotate(90deg)" },
199
+ "&[data-state=\"open\"]:dir(rtl)::after": { transform: "rotate(-90deg)" },
200
+ [a]: { "&::after": { transitionDuration: "0s" } }
201
+ }), v = { unicodeBidi: "plaintext" }, De = e({
202
+ ...v,
203
+ color: p.color.text
204
+ }), Oe = e({ color: p.color.textMuted }), ke = e({
205
+ ...v,
206
+ "&[data-type=\"string\"]": { color: p.color.accentText },
207
+ "&[data-type=\"number\"]": {
208
+ color: p.color.textMuted,
209
+ fontVariantNumeric: "tabular-nums"
210
+ },
211
+ "&[data-type=\"boolean\"]": { color: p.color.warning },
212
+ "&[data-type=\"null\"]": {
213
+ color: p.color.textMuted,
214
+ fontStyle: "italic"
215
+ },
216
+ [i]: { color: "CanvasText" }
217
+ }), Ae = e({
218
+ ...v,
219
+ display: "inline-flex",
220
+ alignItems: "center",
221
+ paddingInline: p.space[2],
222
+ border: `1px solid ${p.color.border}`,
223
+ borderRadius: p.radius.full,
224
+ color: p.color.textMuted,
225
+ fontFamily: p.font.sans,
226
+ fontSize: p.textSize.xs,
227
+ fontVariantNumeric: "tabular-nums",
228
+ lineHeight: p.lineHeight.base
229
+ }), je = e({
230
+ color: p.color.accentText,
231
+ fontFamily: p.font.sans
232
+ }), Me = e({
233
+ color: p.color.text,
234
+ background: p.color.accentSoft,
235
+ borderRadius: `calc(${p.radius.sm} / 2)`,
236
+ textDecoration: "underline",
237
+ textDecorationColor: p.color.accentText,
238
+ textUnderlineOffset: "0.2em",
239
+ [i]: {
240
+ color: "Highlight",
241
+ background: "Canvas"
242
+ }
243
+ }), Ne = e({
244
+ display: "grid",
245
+ gap: p.space[2],
246
+ padding: p.space[3],
247
+ borderBlockStart: `1px solid ${p.color.border}`,
248
+ background: p.color.surface,
249
+ minInlineSize: 0
250
+ }), Pe = e({
251
+ display: "flex",
252
+ flexWrap: "wrap",
253
+ alignItems: "center",
254
+ gap: p.space[2],
255
+ minInlineSize: 0
256
+ }), Fe = e({
257
+ ...v,
258
+ fontFamily: p.font.mono,
259
+ fontWeight: p.fontWeight.medium,
260
+ overflowWrap: "anywhere",
261
+ minInlineSize: 0
262
+ }), Ie = e({
263
+ ...de,
264
+ margin: 0,
265
+ padding: p.space[3],
266
+ border: `1px solid ${p.color.borderSubtle}`,
267
+ borderRadius: p.radius.md,
268
+ background: p.color.surfaceInset,
269
+ whiteSpace: "pre-wrap",
270
+ overflowWrap: "anywhere",
271
+ fontFamily: p.font.mono,
272
+ fontSize: p.textSize.xs,
273
+ maxBlockSize: "var(--json-max-height)",
274
+ overflow: "auto",
275
+ "&:focus-visible": r
276
+ }), Le = e({
277
+ paddingInline: p.space[3],
278
+ paddingBlock: p.space[2],
279
+ borderBlockStart: `1px solid ${p.color.border}`,
280
+ color: p.color.textMuted,
281
+ fontSize: p.textSize.xs,
282
+ "&:empty": {
283
+ padding: 0,
284
+ borderBlockStart: 0
285
+ }
286
+ }), Re = e({
287
+ padding: p.space[4],
288
+ color: p.color.textMuted
289
+ }), y = (e) => /* @__PURE__ */ h("svg", {
290
+ viewBox: "0 0 24 24",
291
+ fill: "none",
292
+ stroke: "currentColor",
293
+ strokeWidth: 2,
294
+ strokeLinecap: "round",
295
+ strokeLinejoin: "round",
296
+ "aria-hidden": "true",
297
+ focusable: "false",
298
+ children: e
299
+ }), ze = y(/* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("circle", {
300
+ cx: "11",
301
+ cy: "11",
302
+ r: "7"
303
+ }), /* @__PURE__ */ h("path", { d: "m20 20-3.5-3.5" })] })), Be = y(/* @__PURE__ */ h("path", { d: "m18 15-6-6-6 6" })), Ve = y(/* @__PURE__ */ h("path", { d: "m6 9 6 6 6-6" })), He = y(/* @__PURE__ */ h("path", { d: "m7 15 5 5 5-5M7 9l5-5 5 5" })), Ue = y(/* @__PURE__ */ h("path", { d: "m7 20 5-5 5 5M7 4l5 5 5-5" })), We = y(/* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("rect", {
304
+ x: "9",
305
+ y: "9",
306
+ width: "12",
307
+ height: "12",
308
+ rx: "2"
309
+ }), /* @__PURE__ */ h("path", { d: "M5 15H4a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h10a1 1 0 0 1 1 1v1" })] })), Ge = y(/* @__PURE__ */ g(m, { children: [/* @__PURE__ */ h("path", { d: "M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7" }), /* @__PURE__ */ h("path", { d: "M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7" })] }));
310
+ function b({ data: e, rootName: n = "root", expandedValue: r, defaultExpandedValue: i, onExpandedValueChange: a, defaultExpandDepth: c = 1, query: se, defaultQuery: ue = "", onQueryChange: de, value: v, defaultValue: y, onValueChange: b, onNodeActivate: qe, searchable: x = !0, copyable: S = !0, showPath: Je = !0, pageSize: Ye = ie, maxMatches: Xe = ae, maxHeight: C = "26rem", size: Ze = "md", locale: w, labels: Qe, onCopy: $e, onCopyError: et, slotProps: T, ref: tt, className: nt, sx: rt, style: it, onKeyDown: at, onClick: ot, "aria-label": st, "aria-labelledby": E, "aria-describedby": ct, ...lt }) {
311
+ let D = d(null), O = d(null), k = d(/* @__PURE__ */ new Map()), A = d(null), j = d(!1), M = d({
312
+ text: "",
313
+ time: 0
314
+ }), ut = ee(), N = u(() => le(e, n), [e, n]), P = u(() => new Intl.NumberFormat(w), [w]), dt = u(() => new Intl.PluralRules(w), [w]), F = {
315
+ tree: "JSON",
316
+ search: "Search JSON",
317
+ expandAll: "Expand all",
318
+ collapseAll: "Collapse all",
319
+ previousMatch: "Previous match",
320
+ nextMatch: "Next match",
321
+ copyValue: "Copy value",
322
+ copyPath: "Copy path",
323
+ copied: "Copied",
324
+ copyFailed: "Copy failed",
325
+ invalidData: "Invalid JSON data",
326
+ count: (e, t) => `${P.format(e)} ${re[t][dt.select(e) === "one" ? "one" : "other"]}`,
327
+ match: (e, t, n) => `${P.format(e)} / ${P.format(t)}${n ? "+" : ""}`,
328
+ showMore: (e) => `Show more (${P.format(e)} remaining)`,
329
+ ...Qe
330
+ }, ft = oe(Ye, ie), pt = oe(Xe, ae), [mt] = f(() => i ?? [...N?.values() ?? []].filter((e) => _(e) && e.level <= Math.max(0, Math.floor(c))).map((e) => e.path)), [I = [], ht] = o(r, mt, (e) => a?.([...e])), [L = "", gt] = o(se, ue, de), [R = n, _t] = o(v, y ?? n, b), [vt, z] = f(v ?? y ?? n), [yt, bt] = f({
331
+ data: e,
332
+ pages: /* @__PURE__ */ new Map()
333
+ }), [xt, B] = f({
334
+ query: L,
335
+ closed: /* @__PURE__ */ new Set(),
336
+ opened: /* @__PURE__ */ new Set(),
337
+ pages: /* @__PURE__ */ new Map()
338
+ }), [St, Ct] = f(""), wt = Object.is(yt.data, e) ? yt.pages : /* @__PURE__ */ new Map(), V = xt.query === L ? xt : {
339
+ query: L,
340
+ closed: /* @__PURE__ */ new Set(),
341
+ opened: /* @__PURE__ */ new Set(),
342
+ pages: /* @__PURE__ */ new Map()
343
+ }, H = u(() => {
344
+ let e = [], t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Map(), r = L.toLowerCase(), i = !1;
345
+ if (L && N) for (let a of N.values()) {
346
+ if (!a.key.toLowerCase().includes(r) && (a.type === "object" || a.type === "array" || !ce(a).toLowerCase().includes(r))) continue;
347
+ if (e.length === pt) {
348
+ i = !0;
349
+ break;
350
+ }
351
+ e.push(a.path);
352
+ let o = a;
353
+ for (; o.parent !== void 0;) t.add(o.parent), n.set(o.parent, Math.max(n.get(o.parent) ?? 0, o.index + 1)), o = N.get(o.parent);
354
+ }
355
+ return {
356
+ matches: e,
357
+ ancestors: t,
358
+ limits: n,
359
+ truncated: i
360
+ };
361
+ }, [
362
+ N,
363
+ L,
364
+ pt
365
+ ]), U = (e) => !V.closed.has(e) && (I.includes(e) || H.ancestors.has(e) || V.opened.has(e)), W = [], G = /* @__PURE__ */ new Map();
366
+ if (N) {
367
+ let e = [{
368
+ path: n,
369
+ level: 1,
370
+ position: 1,
371
+ setSize: 1
372
+ }];
373
+ for (; e.length;) {
374
+ let t = e.pop();
375
+ if (W.push(t), t.more !== void 0) continue;
376
+ let n = N.get(t.path);
377
+ if (!U(t.path) || !_(n)) continue;
378
+ let r = Math.min(n.children.length, Math.max(wt.get(t.path) ?? ft, H.limits.get(t.path) ?? 0, L ? V.pages.get(t.path) ?? 0 : 0)), i = n.children.length - r, a = r + +!!i, o = n.children.slice(0, r).map((e, n) => ({
379
+ path: e,
380
+ parent: t.path,
381
+ level: t.level + 1,
382
+ position: n + 1,
383
+ setSize: a
384
+ }));
385
+ i && o.push({
386
+ path: `${t.path}\u0000more`,
387
+ parent: t.path,
388
+ level: t.level + 1,
389
+ position: a,
390
+ setSize: a,
391
+ more: i
392
+ }), G.set(t.path, o), e.push(...o.toReversed());
393
+ }
394
+ }
395
+ let [K, Tt] = f({
396
+ nodes: N,
397
+ previousNodes: N,
398
+ selected: R,
399
+ path: R
400
+ }), Et = Object.is(K.nodes, N) ? K.previousNodes : K.nodes, Dt = new Set(W.map((e) => e.path)), Ot = (e) => {
401
+ let t = e;
402
+ for (; t !== void 0;) {
403
+ if (Dt.has(t)) return t;
404
+ t = N?.get(t)?.parent ?? Et?.get(t)?.parent;
405
+ }
406
+ return n;
407
+ }, q = Ot(vt), J = N?.get(R) ?? N?.get(Ot(K.selected === R ? K.path : R)), kt = J?.path ?? n;
408
+ (!Object.is(K.nodes, N) || K.selected !== R || K.path !== kt) && Tt({
409
+ nodes: N,
410
+ previousNodes: Et,
411
+ selected: R,
412
+ path: kt
413
+ }), te(() => {
414
+ if (Object.is(yt.data, e) || (bt({
415
+ data: e,
416
+ pages: /* @__PURE__ */ new Map()
417
+ }), B({
418
+ query: L,
419
+ closed: /* @__PURE__ */ new Set(),
420
+ opened: /* @__PURE__ */ new Set(),
421
+ pages: /* @__PURE__ */ new Map()
422
+ })), vt === q) return;
423
+ let t = A.current, n = D.current?.ownerDocument, r = t && n && (n.activeElement === t || !t.isConnected && n.activeElement === n.body);
424
+ z(q), r && (j.current = !0, k.current.get(q)?.focus(), j.current = !1);
425
+ });
426
+ let Y = (e) => {
427
+ let t = k.current.get(e);
428
+ z(e), t?.focus(), t?.querySelector(":scope > [data-ui=\"json-viewer-row\"]")?.scrollIntoView({
429
+ block: "nearest",
430
+ inline: "nearest",
431
+ behavior: "instant"
432
+ });
433
+ }, X = (e) => {
434
+ let t = [...new Set(e)];
435
+ (t.length !== new Set(I).size || t.some((e) => !I.includes(e))) && ht(t);
436
+ }, At = (e) => {
437
+ if (L) {
438
+ let t = new Set(V.closed), n = new Set(V.opened);
439
+ U(e) ? (t.add(e), n.delete(e)) : (t.delete(e), n.add(e)), B({
440
+ ...V,
441
+ closed: t,
442
+ opened: n
443
+ });
444
+ } else X(U(e) ? I.filter((t) => t !== e) : [...I, e]);
445
+ }, jt = (t) => {
446
+ let n = t.parent, r = G.get(n).length - 1, i = Math.min(N.get(n).children.length, r + ft);
447
+ L ? B({
448
+ ...V,
449
+ pages: new Map(V.pages).set(n, i)
450
+ }) : bt({
451
+ data: e,
452
+ pages: new Map(wt).set(n, i)
453
+ });
454
+ let a = N.get(n).children[r];
455
+ _t(a), z(a), A.current = k.current.get(t.path) ?? null, Z.current = a;
456
+ }, Z = d(null);
457
+ te(() => {
458
+ Z.current !== null && (j.current = !0, k.current.get(Z.current)?.focus(), j.current = !1, Z.current = null);
459
+ });
460
+ let Mt = (e) => {
461
+ if (e.more !== void 0) {
462
+ jt(e);
463
+ return;
464
+ }
465
+ let t = N.get(e.path);
466
+ _(t) ? At(e.path) : qe?.({
467
+ path: t.path,
468
+ value: t.value,
469
+ type: t.type
470
+ });
471
+ }, Nt = async (e, t = J?.path) => {
472
+ if (S && t !== void 0 && N?.has(t)) try {
473
+ let n = e === "path" ? t : JSON.stringify(N.get(t).value, null, 2), r = D.current?.ownerDocument.defaultView?.navigator.clipboard;
474
+ if (!r) throw Error("Clipboard API unavailable");
475
+ await r.writeText(n), Ct(F.copied), $e?.({
476
+ kind: e,
477
+ path: t,
478
+ text: n
479
+ });
480
+ } catch (n) {
481
+ Ct(F.copyFailed), et?.({
482
+ kind: e,
483
+ path: t,
484
+ error: n
485
+ });
486
+ }
487
+ }, Pt = (e, t) => {
488
+ if (!H.matches.length) return;
489
+ let n = H.matches.indexOf(R), r = n < 0 ? e > 0 ? 0 : H.matches.length - 1 : (n + e + H.matches.length) % H.matches.length, i = H.matches[r];
490
+ B({
491
+ ...V,
492
+ closed: /* @__PURE__ */ new Set()
493
+ }), _t(i), t && (z(i), Z.current = i);
494
+ }, Ft = (e) => {
495
+ if (at?.(e), e.defaultPrevented) return;
496
+ if (e.target === O.current) {
497
+ e.key === "Enter" && (e.preventDefault(), Pt(e.shiftKey ? -1 : 1, !1)), e.key === "Escape" && (e.preventDefault(), gt("")), e.key === "ArrowDown" && (e.preventDefault(), Y(q));
498
+ return;
499
+ }
500
+ let t = e.target.closest("[role=\"treeitem\"]");
501
+ if (!t || !D.current?.contains(t) || e.target !== t) return;
502
+ let n = W.findIndex((e) => k.current.get(e.path) === t), r = W[n];
503
+ if (!r) return;
504
+ if ((e.ctrlKey || e.metaKey) && !e.altKey && e.key.toLowerCase() === "c") {
505
+ S && r.more === void 0 && !t.ownerDocument.getSelection()?.toString() && (e.preventDefault(), Nt(e.shiftKey ? "path" : "value", r.path));
506
+ return;
507
+ }
508
+ if (e.ctrlKey || e.metaKey || e.altKey || e.nativeEvent.isComposing) return;
509
+ let i = N?.get(r.path), a = {
510
+ ArrowDown: () => Y(W[Math.min(n + 1, W.length - 1)].path),
511
+ ArrowUp: () => Y(W[Math.max(n - 1, 0)].path),
512
+ Home: () => Y(W[0].path),
513
+ End: () => Y(W[W.length - 1].path),
514
+ ArrowRight: () => {
515
+ i && _(i) && (U(r.path) ? Y(G.get(r.path)[0].path) : At(r.path));
516
+ },
517
+ ArrowLeft: () => {
518
+ i && _(i) && U(r.path) ? At(r.path) : r.parent && Y(r.parent);
519
+ },
520
+ Enter: () => Mt(r),
521
+ " ": () => Mt(r),
522
+ "/": () => {
523
+ x && O.current?.focus();
524
+ }
525
+ };
526
+ if (a[e.key] && (e.key !== "/" || x)) e.preventDefault(), a[e.key]();
527
+ else if ([...e.key].length === 1) {
528
+ let t = Date.now(), r = t - M.current.time < ne ? M.current.text + e.key : e.key;
529
+ M.current = {
530
+ text: r,
531
+ time: t
532
+ };
533
+ let i = [...r].every((e) => e === r[0]) ? r[0] : r, a = [...W.slice(n + 1), ...W.slice(0, n + 1)].find((e) => N?.get(e.path)?.key.toLocaleLowerCase(w).startsWith(i.toLocaleLowerCase(w)));
534
+ a && (e.preventDefault(), Y(a.path));
535
+ }
536
+ }, It = (e, t = !1) => {
537
+ let n = L ? e.toLowerCase().indexOf(L.toLowerCase()) : -1, r = (e) => t ? JSON.stringify(e).slice(1, -1) : e;
538
+ return n < 0 ? t ? JSON.stringify(e) : e : /* @__PURE__ */ g(m, { children: [
539
+ t && "\"",
540
+ r(e.slice(0, n)),
541
+ /* @__PURE__ */ h("mark", {
542
+ "data-ui": "json-viewer-match",
543
+ css: Me,
544
+ children: r(e.slice(n, n + L.length))
545
+ }),
546
+ r(e.slice(n + L.length)),
547
+ t && "\""
548
+ ] });
549
+ }, Q = /* @__PURE__ */ new Map();
550
+ for (let [e, t] of W.toReversed().entries()) {
551
+ let n = N?.get(t.path), r = G.get(t.path), i = `${ut}-label-${e}`, a = r ? `${ut}-group-${e}` : void 0;
552
+ Q.set(t.path, /* @__PURE__ */ g("div", {
553
+ "data-ui": "json-viewer-node",
554
+ role: "none",
555
+ children: [/* @__PURE__ */ h("div", {
556
+ id: `${ut}-item-${e}`,
557
+ role: "treeitem",
558
+ "data-ui": "json-viewer-item",
559
+ "aria-labelledby": i,
560
+ "aria-owns": a,
561
+ "aria-level": t.level,
562
+ "aria-posinset": t.position,
563
+ "aria-setsize": t.setSize,
564
+ "aria-expanded": n && _(n) ? U(t.path) : void 0,
565
+ "aria-selected": n ? R === t.path : void 0,
566
+ tabIndex: q === t.path ? 0 : -1,
567
+ css: Ce,
568
+ ref: (e) => {
569
+ e ? k.current.set(t.path, e) : k.current.delete(t.path);
570
+ },
571
+ onFocus: (e) => {
572
+ e.target === e.currentTarget && (A.current = e.currentTarget, z(t.path), n && !j.current && _t(t.path));
573
+ },
574
+ onBlur: (e) => {
575
+ (!e.relatedTarget || !D.current?.contains(e.relatedTarget)) && (A.current = null);
576
+ },
577
+ children: /* @__PURE__ */ g("div", {
578
+ "data-ui": "json-viewer-row",
579
+ className: T?.row?.className,
580
+ css: [we, T?.row?.css],
581
+ style: { "--json-depth": t.level - 1 },
582
+ children: [/* @__PURE__ */ h("span", {
583
+ "data-ui": "json-viewer-caret",
584
+ "data-state": n && _(n) ? U(t.path) ? "open" : "closed" : void 0,
585
+ "aria-hidden": "true",
586
+ css: Ee
587
+ }), /* @__PURE__ */ h("span", {
588
+ "data-ui": "json-viewer-label",
589
+ id: i,
590
+ children: t.more === void 0 ? /* @__PURE__ */ g(m, { children: [
591
+ /* @__PURE__ */ h("span", {
592
+ "data-ui": "json-viewer-key",
593
+ css: De,
594
+ children: It(n.key)
595
+ }),
596
+ /* @__PURE__ */ h("span", {
597
+ css: Oe,
598
+ children: ":"
599
+ }),
600
+ " ",
601
+ n.type === "object" || n.type === "array" ? /* @__PURE__ */ h("span", {
602
+ "data-ui": "json-viewer-type",
603
+ className: T?.value?.className,
604
+ css: [Ae, T?.value?.css],
605
+ children: F.count(n.children.length, n.type)
606
+ }) : /* @__PURE__ */ h("span", {
607
+ "data-ui": "json-viewer-value",
608
+ "data-type": n.type,
609
+ className: T?.value?.className,
610
+ css: [ke, T?.value?.css],
611
+ children: n.type === "string" ? It(String(n.value), !0) : It(JSON.stringify(n.value))
612
+ })
613
+ ] }) : /* @__PURE__ */ h("span", {
614
+ css: je,
615
+ children: F.showMore(t.more)
616
+ })
617
+ })]
618
+ })
619
+ }), r && /* @__PURE__ */ h("div", {
620
+ id: a,
621
+ role: "group",
622
+ "data-ui": "json-viewer-group",
623
+ className: T?.group?.className,
624
+ css: [Te, T?.group?.css],
625
+ style: { "--json-depth": t.level - 1 },
626
+ children: r.map((e) => Q.get(e.path))
627
+ })]
628
+ }, t.path));
629
+ }
630
+ let $ = (e, t, n, r = !1) => /* @__PURE__ */ h(s, {
631
+ "data-ui": "json-viewer-action",
632
+ size: "sm",
633
+ variant: "ghost",
634
+ "aria-label": e,
635
+ title: e,
636
+ className: T?.action?.className,
637
+ css: [xe, T?.action?.css],
638
+ disabled: r,
639
+ onClick: n,
640
+ render: (e) => /* @__PURE__ */ h("button", {
641
+ ...e,
642
+ type: "button",
643
+ disabled: r
644
+ }),
645
+ children: t
646
+ }), Lt = /* @__PURE__ */ h("span", {
647
+ "aria-hidden": "true",
648
+ css: be
649
+ });
650
+ return /* @__PURE__ */ h(t, {
651
+ className: nt,
652
+ styles: fe,
653
+ sx: rt,
654
+ children: (e) => /* @__PURE__ */ g("div", {
655
+ ...lt,
656
+ ref: tt,
657
+ "data-ui": "json-viewer",
658
+ className: e,
659
+ style: {
660
+ "--json-max-height": typeof C == "number" ? `${C}px` : C,
661
+ "--json-row-height": Ze === "sm" ? p.space[8] : p.space[10],
662
+ ...it
663
+ },
664
+ onKeyDown: Ft,
665
+ onClick: (e) => {
666
+ if (ot?.(e), e.defaultPrevented) return;
667
+ let t = e.target.closest("[role=\"treeitem\"]");
668
+ if (!t || !D.current?.contains(t)) return;
669
+ let n = W.find((e) => k.current.get(e.path) === t);
670
+ n && (Y(n.path), Mt(n));
671
+ },
672
+ children: [N ? /* @__PURE__ */ g(m, { children: [
673
+ /* @__PURE__ */ g("div", {
674
+ "data-ui": "json-viewer-toolbar",
675
+ className: T?.toolbar?.className,
676
+ css: [pe, T?.toolbar?.css],
677
+ children: [x && /* @__PURE__ */ g("span", {
678
+ css: me,
679
+ children: [/* @__PURE__ */ h("span", {
680
+ css: he,
681
+ "aria-hidden": "true",
682
+ children: ze
683
+ }), /* @__PURE__ */ h(l, {
684
+ "data-ui": "json-viewer-search",
685
+ ref: O,
686
+ "aria-label": F.search,
687
+ placeholder: F.search,
688
+ value: L,
689
+ onValueChange: gt,
690
+ size: "sm",
691
+ className: T?.search?.className,
692
+ sx: [ge, T?.search?.css],
693
+ slotProps: { control: { css: _e } }
694
+ })]
695
+ }), /* @__PURE__ */ g("span", {
696
+ css: ye,
697
+ children: [
698
+ x && /* @__PURE__ */ g(m, { children: [
699
+ /* @__PURE__ */ h("span", {
700
+ "data-ui": "json-viewer-match-status",
701
+ role: "status",
702
+ "aria-live": "polite",
703
+ "aria-atomic": "true",
704
+ css: ve,
705
+ children: L ? F.match(Math.max(0, H.matches.indexOf(R) + 1), H.matches.length, H.truncated) : ""
706
+ }),
707
+ $(F.previousMatch, Be, () => Pt(-1, !0), !H.matches.length),
708
+ $(F.nextMatch, Ve, () => Pt(1, !0), !H.matches.length),
709
+ Lt
710
+ ] }),
711
+ $(F.expandAll, He, () => {
712
+ B({
713
+ ...V,
714
+ closed: /* @__PURE__ */ new Set()
715
+ }), X([...N.values()].filter(_).map((e) => e.path));
716
+ }),
717
+ $(F.collapseAll, Ue, () => {
718
+ B({
719
+ ...V,
720
+ closed: new Set(H.ancestors)
721
+ }), X(_(N.get(n)) ? [n] : []);
722
+ }),
723
+ S && /* @__PURE__ */ g(m, { children: [
724
+ Lt,
725
+ $(F.copyValue, We, () => {
726
+ Nt("value");
727
+ }),
728
+ $(F.copyPath, Ge, () => {
729
+ Nt("path");
730
+ })
731
+ ] })
732
+ ]
733
+ })]
734
+ }),
735
+ /* @__PURE__ */ h("div", {
736
+ ref: D,
737
+ role: "tree",
738
+ "data-ui": "json-viewer-tree",
739
+ "aria-label": st ?? (E ? void 0 : F.tree),
740
+ "aria-labelledby": E,
741
+ "aria-describedby": ct,
742
+ className: T?.tree?.className,
743
+ css: [Se, T?.tree?.css],
744
+ children: Q.get(n)
745
+ }),
746
+ Je && J && /* @__PURE__ */ g("div", {
747
+ "data-ui": "json-viewer-path-bar",
748
+ className: T?.pathBar?.className,
749
+ css: [Ne, T?.pathBar?.css],
750
+ children: [/* @__PURE__ */ g("span", {
751
+ css: Pe,
752
+ children: [/* @__PURE__ */ h("code", {
753
+ "data-ui": "json-viewer-path",
754
+ css: Fe,
755
+ children: J.path
756
+ }), /* @__PURE__ */ h("span", {
757
+ "data-ui": "json-viewer-current-type",
758
+ css: Ae,
759
+ children: J.type
760
+ })]
761
+ }), /* @__PURE__ */ h("pre", {
762
+ "data-ui": "json-viewer-details",
763
+ dir: "ltr",
764
+ tabIndex: 0,
765
+ css: Ie,
766
+ children: Ke(J.value)
767
+ })]
768
+ })
769
+ ] }) : /* @__PURE__ */ h("div", {
770
+ role: "group",
771
+ "data-ui": "json-viewer-invalid",
772
+ "aria-label": st ?? F.tree,
773
+ "aria-labelledby": E,
774
+ "aria-describedby": ct,
775
+ css: Re,
776
+ children: F.invalidData
777
+ }), /* @__PURE__ */ h("div", {
778
+ role: "status",
779
+ "aria-live": "polite",
780
+ "aria-atomic": "true",
781
+ "data-ui": "json-viewer-status",
782
+ className: T?.status?.className,
783
+ css: [Le, T?.status?.css],
784
+ children: St
785
+ })]
786
+ })
787
+ });
788
+ }
789
+ b.displayName = "JsonViewer";
790
+ function Ke(e) {
791
+ try {
792
+ return JSON.stringify(e, null, 2);
793
+ } catch {
794
+ return "…";
795
+ }
796
+ }
797
+ //#endregion
798
+ export { b as t };