@cloudflare/kumo 2.2.2 → 2.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (192) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/ai/component-registry.json +28 -5
  3. package/ai/component-registry.md +64 -7
  4. package/ai/schemas.ts +1 -0
  5. package/dist/.build-complete +1 -1
  6. package/dist/ai/schemas.d.ts +12 -4
  7. package/dist/ai/schemas.d.ts.map +1 -1
  8. package/dist/ai/schemas.js +2 -0
  9. package/dist/ai/schemas.js.map +1 -1
  10. package/dist/chunks/SankeyChart-krkvltewpn3bbupw.js +651 -0
  11. package/dist/chunks/{SankeyChart-dkq90770ad7hgzx3.js.map → SankeyChart-krkvltewpn3bbupw.js.map} +1 -1
  12. package/dist/chunks/{autocomplete-mhrvtq4y5n21vr0t.js → autocomplete-bdjo7k4zep86bwh8.js} +82 -68
  13. package/dist/chunks/autocomplete-bdjo7k4zep86bwh8.js.map +1 -0
  14. package/dist/chunks/{badge-kqox9toi0sygfbno.js → badge-e9w8qrjmeu9nocf6.js} +80 -19
  15. package/dist/chunks/badge-e9w8qrjmeu9nocf6.js.map +1 -0
  16. package/dist/chunks/{breadcrumbs-ohstavaqvycoremm.js → breadcrumbs-g4pyoikibpoxsgw4.js} +2 -2
  17. package/dist/chunks/{breadcrumbs-ohstavaqvycoremm.js.map → breadcrumbs-g4pyoikibpoxsgw4.js.map} +1 -1
  18. package/dist/chunks/{button-oevxukl0zmwoq4tb.js → button-fxdpoacmq5rv1adk.js} +2 -2
  19. package/dist/chunks/{button-oevxukl0zmwoq4tb.js.map → button-fxdpoacmq5rv1adk.js.map} +1 -1
  20. package/dist/chunks/{checkbox-h6vkv17lnq854z2c.js → checkbox-dtoq56ieijj9m6vr.js} +3 -3
  21. package/dist/chunks/{checkbox-h6vkv17lnq854z2c.js.map → checkbox-dtoq56ieijj9m6vr.js.map} +1 -1
  22. package/dist/chunks/{clipboard-text-kyy71jmx7umdh8k8.js → clipboard-text-nvdsloomefwgcxat.js} +4 -4
  23. package/dist/chunks/{clipboard-text-kyy71jmx7umdh8k8.js.map → clipboard-text-nvdsloomefwgcxat.js.map} +1 -1
  24. package/dist/chunks/{collapsible-ej6p2bq758sw30nk.js → collapsible-cnsxmp7dko87pgx0.js} +2 -2
  25. package/dist/chunks/{collapsible-ej6p2bq758sw30nk.js.map → collapsible-cnsxmp7dko87pgx0.js.map} +1 -1
  26. package/dist/chunks/{combobox-g3cudlfajecou4va.js → combobox-kjmt3aoy4sia7g0o.js} +124 -124
  27. package/dist/chunks/combobox-kjmt3aoy4sia7g0o.js.map +1 -0
  28. package/dist/chunks/{command-palette-eep807rf6iapoz8r.js → command-palette-jrq7p16tff6n46nj.js} +11 -11
  29. package/dist/chunks/{command-palette-eep807rf6iapoz8r.js.map → command-palette-jrq7p16tff6n46nj.js.map} +1 -1
  30. package/dist/chunks/dialog-gndju3sqg1lmpb3f.js +118 -0
  31. package/dist/chunks/{dialog-fo3qhv9fgiadq5gp.js.map → dialog-gndju3sqg1lmpb3f.js.map} +1 -1
  32. package/dist/chunks/{dropdown-cobpydatw4vlb3ov.js → dropdown-k6orz4j043xybf54.js} +2 -2
  33. package/dist/chunks/{dropdown-cobpydatw4vlb3ov.js.map → dropdown-k6orz4j043xybf54.js.map} +1 -1
  34. package/dist/chunks/{empty-n3r7xutkb9sxjaso.js → empty-ni12ufom1kkakbuc.js} +2 -2
  35. package/dist/chunks/{empty-n3r7xutkb9sxjaso.js.map → empty-ni12ufom1kkakbuc.js.map} +1 -1
  36. package/dist/chunks/{field-l1oapopp6kjnephi.js → field-n16udu32tpyq5udz.js} +3 -3
  37. package/dist/chunks/{field-l1oapopp6kjnephi.js.map → field-n16udu32tpyq5udz.js.map} +1 -1
  38. package/dist/chunks/{input-area-gudamx1ruz8rxiw2.js → input-area-hhhpgg0ev8bowtrk.js} +4 -4
  39. package/dist/chunks/{input-area-gudamx1ruz8rxiw2.js.map → input-area-hhhpgg0ev8bowtrk.js.map} +1 -1
  40. package/dist/chunks/{input-group-gy08vju7eoogil8k.js → input-group-kkw5j7rwzhj66h10.js} +70 -70
  41. package/dist/chunks/input-group-kkw5j7rwzhj66h10.js.map +1 -0
  42. package/dist/chunks/{input-i3os21puacqw4r75.js → input-mv7giprcc6hfkpq3.js} +3 -3
  43. package/dist/chunks/{input-i3os21puacqw4r75.js.map → input-mv7giprcc6hfkpq3.js.map} +1 -1
  44. package/dist/chunks/{label-i0bj94d43irz0k1x.js → label-f6yvqca8qhbpvkq8.js} +3 -3
  45. package/dist/chunks/{label-i0bj94d43irz0k1x.js.map → label-f6yvqca8qhbpvkq8.js.map} +1 -1
  46. package/dist/chunks/{layer-card-hyz8lfxceudt05pv.js → layer-card-gegkqhkjy65l1ueo.js} +2 -2
  47. package/dist/chunks/{layer-card-hyz8lfxceudt05pv.js.map → layer-card-gegkqhkjy65l1ueo.js.map} +1 -1
  48. package/dist/chunks/{link-lkzjiitte3l29q87.js → link-jjk7qolyol7s1jkk.js} +2 -2
  49. package/dist/chunks/{link-lkzjiitte3l29q87.js.map → link-jjk7qolyol7s1jkk.js.map} +1 -1
  50. package/dist/chunks/{menubar-jalggrag4utvdpey.js → menubar-d5s6h96nw8ggy04a.js} +2 -2
  51. package/dist/chunks/{menubar-jalggrag4utvdpey.js.map → menubar-d5s6h96nw8ggy04a.js.map} +1 -1
  52. package/dist/chunks/{meter-jbxkh6gfggx1kjna.js → meter-kxn34sy6l2mz5dwq.js} +2 -2
  53. package/dist/chunks/{meter-jbxkh6gfggx1kjna.js.map → meter-kxn34sy6l2mz5dwq.js.map} +1 -1
  54. package/dist/chunks/{pagination-ceetno8sc1rd0wr2.js → pagination-ixbq8ssuuo0jxaa4.js} +3 -3
  55. package/dist/chunks/{pagination-ceetno8sc1rd0wr2.js.map → pagination-ixbq8ssuuo0jxaa4.js.map} +1 -1
  56. package/dist/chunks/{popover-i4opvl9g0as52fyx.js → popover-js5ds3szd43kspja.js} +2 -2
  57. package/dist/chunks/{popover-i4opvl9g0as52fyx.js.map → popover-js5ds3szd43kspja.js.map} +1 -1
  58. package/dist/chunks/{radio-g56o5rftpu1qpxuv.js → radio-nyw89v4eafptepmz.js} +2 -2
  59. package/dist/chunks/{radio-g56o5rftpu1qpxuv.js.map → radio-nyw89v4eafptepmz.js.map} +1 -1
  60. package/dist/chunks/{select-g1xvti1k1hj7xe5t.js → select-o2i7aovnu8v1zv8t.js} +39 -38
  61. package/dist/chunks/{select-g1xvti1k1hj7xe5t.js.map → select-o2i7aovnu8v1zv8t.js.map} +1 -1
  62. package/dist/chunks/{sensitive-input-hokm527ollnz9dqc.js → sensitive-input-bjg6m791yz7g6bn3.js} +93 -90
  63. package/dist/chunks/sensitive-input-bjg6m791yz7g6bn3.js.map +1 -0
  64. package/dist/chunks/{sidebar-oan40ylmqkyui21w.js → sidebar-izcfqkrzt4vqn8ez.js} +37 -37
  65. package/dist/chunks/{sidebar-oan40ylmqkyui21w.js.map → sidebar-izcfqkrzt4vqn8ez.js.map} +1 -1
  66. package/dist/chunks/{surface-ck1nt2uqfzmod4sz.js → surface-lzwbh3f5t0gxc83t.js} +2 -2
  67. package/dist/chunks/{surface-ck1nt2uqfzmod4sz.js.map → surface-lzwbh3f5t0gxc83t.js.map} +1 -1
  68. package/dist/chunks/{switch-fv0ttj24uhocvuh8.js → switch-d9cs31oj4rjtg717.js} +3 -3
  69. package/dist/chunks/{switch-fv0ttj24uhocvuh8.js.map → switch-d9cs31oj4rjtg717.js.map} +1 -1
  70. package/dist/chunks/{table-nsfcgpo93gfetrhh.js → table-c6qemc2jmv22cv3p.js} +2 -2
  71. package/dist/chunks/{table-nsfcgpo93gfetrhh.js.map → table-c6qemc2jmv22cv3p.js.map} +1 -1
  72. package/dist/chunks/{tabs-g8ier5pehjpfxauf.js → tabs-f0ztlooi91ko9g04.js} +2 -2
  73. package/dist/chunks/{tabs-g8ier5pehjpfxauf.js.map → tabs-f0ztlooi91ko9g04.js.map} +1 -1
  74. package/dist/chunks/{toast-ofqlfmddcyka091n.js → toast-ejfm5cbt9yulqhol.js} +3 -3
  75. package/dist/chunks/{toast-ofqlfmddcyka091n.js.map → toast-ejfm5cbt9yulqhol.js.map} +1 -1
  76. package/dist/chunks/{tooltip-icvb67awe1zolz61.js → tooltip-o6xfw9jjclv9pxaj.js} +16 -16
  77. package/dist/chunks/{tooltip-icvb67awe1zolz61.js.map → tooltip-o6xfw9jjclv9pxaj.js.map} +1 -1
  78. package/dist/chunks/vendor-base-ui-mzjqwv5teijixz8h.js +24703 -0
  79. package/dist/chunks/vendor-base-ui-mzjqwv5teijixz8h.js.map +1 -0
  80. package/dist/chunks/{vendor-floating-ui-dwag5e88viikh2zs.js → vendor-floating-ui-c4mwmh0xmfzevy9l.js} +5 -5
  81. package/dist/chunks/{vendor-floating-ui-dwag5e88viikh2zs.js.map → vendor-floating-ui-c4mwmh0xmfzevy9l.js.map} +1 -1
  82. package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js +217 -0
  83. package/dist/chunks/vendor-utils-m5h2xu7s2rs3pgk5.js.map +1 -0
  84. package/dist/code.js +1 -1
  85. package/dist/components/autocomplete.js +1 -1
  86. package/dist/components/badge.js +1 -1
  87. package/dist/components/breadcrumbs.js +1 -1
  88. package/dist/components/button.js +1 -1
  89. package/dist/components/chart.js +1 -1
  90. package/dist/components/checkbox.js +1 -1
  91. package/dist/components/clipboard-text.js +1 -1
  92. package/dist/components/collapsible.js +1 -1
  93. package/dist/components/combobox.js +1 -1
  94. package/dist/components/command-palette.js +1 -1
  95. package/dist/components/dialog.js +1 -1
  96. package/dist/components/dropdown.js +1 -1
  97. package/dist/components/empty.js +1 -1
  98. package/dist/components/field.js +1 -1
  99. package/dist/components/input-group.js +1 -1
  100. package/dist/components/input.js +3 -3
  101. package/dist/components/label.js +1 -1
  102. package/dist/components/layer-card.js +1 -1
  103. package/dist/components/link.js +1 -1
  104. package/dist/components/menubar.js +1 -1
  105. package/dist/components/meter.js +1 -1
  106. package/dist/components/pagination.js +1 -1
  107. package/dist/components/popover.js +1 -1
  108. package/dist/components/radio.js +1 -1
  109. package/dist/components/select.js +1 -1
  110. package/dist/components/sensitive-input.js +1 -1
  111. package/dist/components/sidebar.js +1 -1
  112. package/dist/components/surface.js +1 -1
  113. package/dist/components/switch.js +1 -1
  114. package/dist/components/table.js +1 -1
  115. package/dist/components/tabs.js +1 -1
  116. package/dist/components/toast.js +2 -2
  117. package/dist/components/tooltip.js +1 -1
  118. package/dist/index.js +38 -38
  119. package/dist/primitives/accordion.js +1 -1
  120. package/dist/primitives/alert-dialog.js +1 -1
  121. package/dist/primitives/autocomplete.js +1 -1
  122. package/dist/primitives/avatar.js +1 -1
  123. package/dist/primitives/button.js +1 -1
  124. package/dist/primitives/checkbox-group.js +1 -1
  125. package/dist/primitives/checkbox.js +1 -1
  126. package/dist/primitives/collapsible.js +1 -1
  127. package/dist/primitives/combobox.js +1 -1
  128. package/dist/primitives/context-menu.js +1 -1
  129. package/dist/primitives/csp-provider.js +1 -1
  130. package/dist/primitives/dialog.js +1 -1
  131. package/dist/primitives/direction-provider.js +1 -1
  132. package/dist/primitives/drawer.js +1 -1
  133. package/dist/primitives/field.js +1 -1
  134. package/dist/primitives/fieldset.js +1 -1
  135. package/dist/primitives/form.js +1 -1
  136. package/dist/primitives/input.js +1 -1
  137. package/dist/primitives/menu.js +1 -1
  138. package/dist/primitives/menubar.js +1 -1
  139. package/dist/primitives/meter.js +1 -1
  140. package/dist/primitives/navigation-menu.js +1 -1
  141. package/dist/primitives/number-field.js +1 -1
  142. package/dist/primitives/otp-field.js +1 -1
  143. package/dist/primitives/popover.js +1 -1
  144. package/dist/primitives/preview-card.js +1 -1
  145. package/dist/primitives/progress.js +1 -1
  146. package/dist/primitives/radio-group.js +1 -1
  147. package/dist/primitives/radio.js +1 -1
  148. package/dist/primitives/scroll-area.js +1 -1
  149. package/dist/primitives/select.js +1 -1
  150. package/dist/primitives/separator.js +1 -1
  151. package/dist/primitives/slider.js +1 -1
  152. package/dist/primitives/switch.js +1 -1
  153. package/dist/primitives/tabs.js +1 -1
  154. package/dist/primitives/toast.js +1 -1
  155. package/dist/primitives/toggle-group.js +1 -1
  156. package/dist/primitives/toggle.js +1 -1
  157. package/dist/primitives/toolbar.js +1 -1
  158. package/dist/primitives/tooltip.js +1 -1
  159. package/dist/primitives.js +1 -1
  160. package/dist/scripts/theme-generator/config.js +3 -3
  161. package/dist/scripts/theme-generator/config.js.map +1 -1
  162. package/dist/src/components/autocomplete/autocomplete.d.ts.map +1 -1
  163. package/dist/src/components/badge/badge.d.ts +51 -3
  164. package/dist/src/components/badge/badge.d.ts.map +1 -1
  165. package/dist/src/components/chart/SankeyChart.d.ts +6 -1
  166. package/dist/src/components/chart/SankeyChart.d.ts.map +1 -1
  167. package/dist/src/components/combobox/combobox.d.ts.map +1 -1
  168. package/dist/src/components/dialog/dialog.d.ts +11 -4
  169. package/dist/src/components/dialog/dialog.d.ts.map +1 -1
  170. package/dist/src/components/input-group/input-group-button.d.ts.map +1 -1
  171. package/dist/src/components/input-group/input-group-input.d.ts.map +1 -1
  172. package/dist/src/components/input-group/input-group.d.ts.map +1 -1
  173. package/dist/src/components/select/select.d.ts.map +1 -1
  174. package/dist/src/components/sensitive-input/sensitive-input.d.ts.map +1 -1
  175. package/dist/src/components/toast/toast.d.ts.map +1 -1
  176. package/dist/styles/kumo-binding.css +0 -18
  177. package/dist/styles/kumo-standalone.css +1 -1
  178. package/dist/styles/theme-kumo.css +6 -6
  179. package/package.json +2 -2
  180. package/scripts/generate-primitives.ts +6 -1
  181. package/scripts/theme-generator/config.ts +3 -3
  182. package/dist/chunks/SankeyChart-dkq90770ad7hgzx3.js +0 -635
  183. package/dist/chunks/autocomplete-mhrvtq4y5n21vr0t.js.map +0 -1
  184. package/dist/chunks/badge-kqox9toi0sygfbno.js.map +0 -1
  185. package/dist/chunks/combobox-g3cudlfajecou4va.js.map +0 -1
  186. package/dist/chunks/dialog-fo3qhv9fgiadq5gp.js +0 -115
  187. package/dist/chunks/input-group-gy08vju7eoogil8k.js.map +0 -1
  188. package/dist/chunks/sensitive-input-hokm527ollnz9dqc.js.map +0 -1
  189. package/dist/chunks/vendor-base-ui-nbyiqqi138hcoz52.js +0 -24639
  190. package/dist/chunks/vendor-base-ui-nbyiqqi138hcoz52.js.map +0 -1
  191. package/dist/chunks/vendor-utils-ixnhxmehwihk5tr7.js +0 -534
  192. package/dist/chunks/vendor-utils-ixnhxmehwihk5tr7.js.map +0 -1
@@ -0,0 +1,651 @@
1
+ "use client";
2
+ import { jsx as w, jsxs as G } from "react/jsx-runtime";
3
+ import { forwardRef as ae, useRef as H, useEffect as M, useMemo as V, useCallback as ce } from "react";
4
+ import { c as L } from "./cn-ct4n7r74mh8y0f48.js";
5
+ var te = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#B9D6FF", e.Disabled = "#CBCBCB", e.Skeleton = "#DDDDDD", e))(te || {}), ne = /* @__PURE__ */ ((e) => (e.Attention = "#FC574A", e.Warning = "#F8A054", e.Success = "#00A63E", e.Neutral = "#8EC5FF", e.Disabled = "#878787", e.Skeleton = "#5C5C5C", e))(ne || {});
6
+ const le = {
7
+ blues: ["#E1EAF4", "#8EBCF6", "#4290F0", "#0E58B4", "#03254F"]
8
+ }, ie = {
9
+ blues: ["#03254F", "#0E58B4", "#4290F0", "#A6BFDD", "#E1EAF4"]
10
+ }, K = [
11
+ "#4290F0",
12
+ "#F5B647",
13
+ "#E8649D",
14
+ "#8D58EE",
15
+ "#50C3B6",
16
+ "#D37536"
17
+ /* Orange */
18
+ ], Y = [
19
+ "#4290F0",
20
+ "#EEB720",
21
+ "#E8649D",
22
+ "#8D58EE",
23
+ "#50C3B6",
24
+ "#D37536"
25
+ /* Orange */
26
+ ];
27
+ var W;
28
+ ((e) => {
29
+ function t(o, f = !1) {
30
+ return f ? ne[o] : te[o];
31
+ }
32
+ e.semantic = t;
33
+ function a(o, f = !1) {
34
+ return f ? Y[o % Y.length] : K[o % K.length];
35
+ }
36
+ e.categorical = a;
37
+ function c(o, f = !1) {
38
+ return f ? [...ie[o]] : [...le[o]];
39
+ }
40
+ e.sequential = c;
41
+ function r(o, f = !1) {
42
+ const h = {
43
+ light: { primary: "#6B7280", secondary: "#9CA3AF" },
44
+ dark: { primary: "#9CA3AF", secondary: "#6B7280" }
45
+ };
46
+ return f ? h.dark[o] : h.light[o];
47
+ }
48
+ e.text = r;
49
+ })(W || (W = {}));
50
+ const Q = (e) => {
51
+ const { dangerousHtmlFormatter: t, ...a } = e;
52
+ return {
53
+ ...a,
54
+ formatter: t
55
+ };
56
+ }, ue = (e) => e.tooltip ? {
57
+ ...e,
58
+ tooltip: Array.isArray(e.tooltip) ? e.tooltip.map(Q) : Q(e.tooltip)
59
+ } : e, J = ae(function({
60
+ echarts: t,
61
+ options: a,
62
+ optionUpdateBehavior: c,
63
+ className: r,
64
+ isDarkMode: o,
65
+ height: f = 350,
66
+ onEvents: h
67
+ }, b) {
68
+ const m = H(null), y = H(null), S = H({}), N = H({}), A = H(/* @__PURE__ */ new Set());
69
+ return M(() => {
70
+ if (!m.current) return;
71
+ const d = t.init(
72
+ m.current,
73
+ o ? "dark" : {
74
+ color: o ? Y : K
75
+ }
76
+ );
77
+ return y.current = d, typeof b == "function" ? b(d) : b && (b.current = d), () => {
78
+ for (const x of A.current) {
79
+ const i = N.current[x];
80
+ i && d.off(x, i);
81
+ }
82
+ A.current.clear(), typeof b == "function" ? b(null) : b && (b.current = null), y.current = null, d.dispose();
83
+ };
84
+ }, [m, o]), M(() => {
85
+ const d = y.current;
86
+ d && d.setOption(ue(a), {
87
+ notMerge: !1,
88
+ lazyUpdate: !0,
89
+ ...c
90
+ });
91
+ }, [o, c, a]), M(() => {
92
+ S.current = h ?? {};
93
+ }, [h]), M(() => {
94
+ const d = y.current;
95
+ if (!d) return;
96
+ const x = /* @__PURE__ */ new Set();
97
+ for (const [i, g] of Object.entries(h ?? {}))
98
+ typeof g == "function" && (x.add(i), N.current[i] || (N.current[i] = (T) => {
99
+ S.current[i]?.(T);
100
+ }), A.current.has(i) || d.on(i, N.current[i]));
101
+ for (const i of A.current) {
102
+ if (x.has(i)) continue;
103
+ const g = N.current[i];
104
+ g && d.off(i, g);
105
+ }
106
+ A.current = x;
107
+ }, [t, o, h]), M(() => {
108
+ const d = y.current, x = m.current;
109
+ if (!d || !x) return;
110
+ let i = !0;
111
+ const g = new ResizeObserver(() => {
112
+ if (i) {
113
+ i = !1;
114
+ return;
115
+ }
116
+ d.resize();
117
+ });
118
+ return g.observe(x), () => g.disconnect();
119
+ }, []), /* @__PURE__ */ w(
120
+ "div",
121
+ {
122
+ ref: m,
123
+ className: L("w-full", r),
124
+ style: { height: f },
125
+ tabIndex: a.aria?.enabled ? 0 : void 0,
126
+ role: a.aria?.enabled ? "img" : void 0
127
+ }
128
+ );
129
+ });
130
+ J.displayName = "Chart";
131
+ function $e({
132
+ echarts: e,
133
+ type: t = "line",
134
+ data: a,
135
+ xAxisName: c,
136
+ xAxisTickCount: r,
137
+ xAxisTickFormat: o,
138
+ yAxisTickFormat: f,
139
+ yAxisTickLabelFormat: h,
140
+ yAxisName: b,
141
+ yAxisTickCount: m,
142
+ tooltipValueFormat: y,
143
+ onTimeRangeChange: S,
144
+ height: N = 350,
145
+ incomplete: A,
146
+ isDarkMode: d,
147
+ gradient: x,
148
+ loading: i,
149
+ ariaDescription: g,
150
+ optionUpdateBehavior: T
151
+ }) {
152
+ const C = H(null), D = A?.before, O = A?.after, z = V(() => {
153
+ const E = [], p = t === "bar" ? { type: "bar", stack: "total" } : { type: "line", showSymbol: !1 };
154
+ for (const s of a) {
155
+ const F = D && t === "line" ? s.data.filter((l) => l[0] <= D) : [], v = O && t === "line" ? s.data.filter((l) => l[0] >= O) : [], B = F.length > 0 || v.length > 0 ? s.data.slice(
156
+ Math.max(0, F.length - 1),
157
+ Math.max(0, s.data.length - v.length + 1)
158
+ ) : s.data, I = x && t === "line" ? {
159
+ color: new e.graphic.LinearGradient(0, 0, 0, 1, [
160
+ { offset: 0, color: Z(s.color, 0.4) },
161
+ { offset: 1, color: Z(s.color, 0) }
162
+ ])
163
+ } : void 0;
164
+ E.push({
165
+ data: B,
166
+ color: s.color,
167
+ name: s.name,
168
+ emphasis: { focus: "series" },
169
+ ...I ? { areaStyle: I } : {},
170
+ ...p
171
+ });
172
+ const n = {
173
+ color: s.color,
174
+ name: s.name,
175
+ type: "line",
176
+ lineStyle: { type: "dashed" },
177
+ showSymbol: !1,
178
+ emphasis: { focus: "series" }
179
+ };
180
+ F.length > 0 && E.push({
181
+ ...n,
182
+ data: F
183
+ }), v.length > 0 && E.push({
184
+ ...n,
185
+ data: v
186
+ });
187
+ }
188
+ return {
189
+ aria: {
190
+ enabled: !0,
191
+ ...g && { label: { description: g } }
192
+ },
193
+ brush: {
194
+ xAxisIndex: "all",
195
+ brushType: "lineX",
196
+ brushMode: "single",
197
+ outOfBrush: {
198
+ colorAlpha: 0.3
199
+ },
200
+ brushStyle: {
201
+ borderWidth: 1,
202
+ color: "rgba(120,140,180,0.3)",
203
+ borderColor: "rgba(120,140,180,0.8)"
204
+ }
205
+ },
206
+ tooltip: {
207
+ trigger: "axis",
208
+ appendTo: "body",
209
+ axisPointer: { type: "shadow" },
210
+ dangerousHtmlFormatter: (s) => {
211
+ const F = Array.isArray(s) ? s : [s], v = /* @__PURE__ */ new Set(), B = F.filter((u) => v.has(u.seriesName) ? !1 : (v.add(u.seriesName), !0)), I = B[0], n = I?.value?.[0] ?? I?.axisValue, l = n != null ? `<div style="font-weight:600;margin-bottom:4px;">${e.format.encodeHTML(fe(n))}</div>` : "", $ = B.map((u) => {
212
+ const R = u?.value?.[1], q = y ?? h, U = q ? e.format.encodeHTML(String(q(R))) : e.format.encodeHTML(String(R));
213
+ return `${u.marker} ${e.format.encodeHTML(u.seriesName)}: <strong>${U}</strong>`;
214
+ }).join("<br/>");
215
+ return `${l}${$}`;
216
+ }
217
+ },
218
+ backgroundColor: "transparent",
219
+ toolbox: { show: !1 },
220
+ xAxis: {
221
+ name: c,
222
+ nameLocation: "middle",
223
+ nameGap: 30,
224
+ type: "time",
225
+ splitLine: {
226
+ show: !1
227
+ },
228
+ axisLine: { show: !1 },
229
+ splitNumber: r ?? 5,
230
+ ...o && {
231
+ axisLabel: {
232
+ formatter: (s) => o(s)
233
+ }
234
+ }
235
+ },
236
+ yAxis: {
237
+ name: b,
238
+ nameLocation: "middle",
239
+ nameGap: 40,
240
+ type: "value",
241
+ axisTick: { show: !0 },
242
+ axisLabel: {
243
+ margin: 15,
244
+ ...f && {
245
+ formatter: (s) => f(s)
246
+ }
247
+ },
248
+ splitLine: {
249
+ show: !0,
250
+ lineStyle: { type: "dashed", width: 1 }
251
+ },
252
+ splitNumber: m
253
+ },
254
+ grid: {
255
+ left: b ? 30 : 24,
256
+ right: 24,
257
+ top: 24,
258
+ bottom: c ? 30 : 24
259
+ },
260
+ series: E
261
+ };
262
+ }, [
263
+ a,
264
+ c,
265
+ r,
266
+ o,
267
+ f,
268
+ h,
269
+ b,
270
+ m,
271
+ y,
272
+ D,
273
+ O,
274
+ t,
275
+ x,
276
+ e,
277
+ g
278
+ ]), _ = V(() => S ? {
279
+ brushend: (E) => {
280
+ const p = E.areas[0].coordRange;
281
+ S(p[0], p[1]), C.current?.dispatchAction({ type: "brush", areas: [] });
282
+ }
283
+ } : {}, [S]), j = !!S;
284
+ return M(() => {
285
+ const E = C.current;
286
+ if (E && j)
287
+ return E.dispatchAction({
288
+ type: "takeGlobalCursor",
289
+ key: "brush",
290
+ brushOption: {
291
+ brushType: "lineX",
292
+ brushMode: "single"
293
+ }
294
+ }), () => {
295
+ E.dispatchAction({
296
+ type: "takeGlobalCursor",
297
+ key: "brush",
298
+ brushOption: {
299
+ brushType: !1
300
+ }
301
+ });
302
+ };
303
+ }, [C, j, i]), /* @__PURE__ */ G("div", { className: "relative w-full", style: { height: N }, children: [
304
+ i && /* @__PURE__ */ w(de, { height: N, isDarkMode: d }),
305
+ !i && /* @__PURE__ */ w(
306
+ J,
307
+ {
308
+ echarts: e,
309
+ ref: C,
310
+ options: z,
311
+ height: N,
312
+ isDarkMode: d,
313
+ onEvents: _,
314
+ optionUpdateBehavior: T
315
+ }
316
+ )
317
+ ] });
318
+ }
319
+ function de({
320
+ height: e,
321
+ isDarkMode: t
322
+ }) {
323
+ const a = e / 2, c = Math.min(e * 0.12, 28), r = 400, o = 120, f = [];
324
+ for (let m = 0; m <= o; m++) {
325
+ const y = -r + m / o * r * 3, S = a + Math.sin(m / o * 2 * Math.PI * 3) * c;
326
+ f.push(`${m === 0 ? "M" : "L"}${y.toFixed(2)},${S.toFixed(2)}`);
327
+ }
328
+ const h = f.join(" "), b = t ? "rgba(255,255,255,0.5)" : "rgba(0,0,0,0.2)";
329
+ return /* @__PURE__ */ w(
330
+ "div",
331
+ {
332
+ "aria-hidden": "true",
333
+ className: "absolute inset-0 overflow-hidden",
334
+ style: { height: e },
335
+ children: /* @__PURE__ */ w(
336
+ "svg",
337
+ {
338
+ width: "100%",
339
+ height: e,
340
+ viewBox: `0 0 ${r} ${e}`,
341
+ preserveAspectRatio: "none",
342
+ className: "w-full animate-pulse",
343
+ children: /* @__PURE__ */ w(
344
+ "path",
345
+ {
346
+ d: h,
347
+ fill: "none",
348
+ stroke: b,
349
+ strokeWidth: "2",
350
+ style: {
351
+ animation: "kumo-chart-wave 2.4s linear infinite",
352
+ transformOrigin: "0 0"
353
+ }
354
+ }
355
+ )
356
+ }
357
+ )
358
+ }
359
+ );
360
+ }
361
+ function Z(e, t) {
362
+ const a = Math.max(0, Math.min(1, t)), c = e.match(
363
+ /rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)/i
364
+ );
365
+ if (c)
366
+ return `rgba(${c[1]}, ${c[2]}, ${c[3]}, ${a})`;
367
+ let r = e.replace(/^#/, "");
368
+ r.length === 3 && (r = r[0] + r[0] + r[1] + r[1] + r[2] + r[2]), r.length === 8 && (r = r.slice(0, 6));
369
+ const o = parseInt(r.slice(0, 2), 16), f = parseInt(r.slice(2, 4), 16), h = parseInt(r.slice(4, 6), 16);
370
+ return `rgba(${o}, ${f}, ${h}, ${a})`;
371
+ }
372
+ function k(e) {
373
+ return e.toString().padStart(2, "0");
374
+ }
375
+ function fe(e) {
376
+ const t = new Date(e);
377
+ return `${t.getFullYear()}-${k(t.getMonth() + 1)}-${k(t.getDate())} ${k(t.getHours())}:${k(t.getMinutes())}:${k(t.getSeconds())}`;
378
+ }
379
+ function pe({ color: e, value: t, name: a, unit: c, inactive: r }) {
380
+ return /* @__PURE__ */ G("div", { className: "inline-flex flex-col gap-2 min-w-42 py-2", children: [
381
+ /* @__PURE__ */ G("div", { className: "flex items-center gap-2", children: [
382
+ /* @__PURE__ */ w(
383
+ "span",
384
+ {
385
+ className: L("size-2 rounded-full inline-block", {
386
+ "opacity-50": r
387
+ }),
388
+ style: { backgroundColor: e }
389
+ }
390
+ ),
391
+ /* @__PURE__ */ w("span", { className: L("text-xs", { "opacity-50": r }), children: a })
392
+ ] }),
393
+ /* @__PURE__ */ G("div", { className: "flex items-baseline gap-0.5", children: [
394
+ /* @__PURE__ */ w(
395
+ "span",
396
+ {
397
+ className: L("text-lg font-medium leading-none", {
398
+ "opacity-50": r
399
+ }),
400
+ children: t
401
+ }
402
+ ),
403
+ c && /* @__PURE__ */ w(
404
+ "span",
405
+ {
406
+ className: L("text-xs text-kumo-subtle leading-none", {
407
+ "opacity-50": r
408
+ }),
409
+ children: c
410
+ }
411
+ )
412
+ ] })
413
+ ] });
414
+ }
415
+ function me({ color: e, value: t, name: a, inactive: c }) {
416
+ return /* @__PURE__ */ G("div", { className: "inline-flex items-center gap-2", children: [
417
+ /* @__PURE__ */ w(
418
+ "span",
419
+ {
420
+ className: L("size-2 rounded-full inline-block", {
421
+ "opacity-50": c
422
+ }),
423
+ style: { backgroundColor: e }
424
+ }
425
+ ),
426
+ /* @__PURE__ */ w("span", { className: L("text-xs", { "opacity-50": c }), children: a }),
427
+ /* @__PURE__ */ w("span", { className: L("text-xs font-medium", { "opacity-50": c }), children: t })
428
+ ] });
429
+ }
430
+ const we = {
431
+ SmallItem: me,
432
+ LargeItem: pe
433
+ }, ge = (e) => e.toLocaleString();
434
+ function he(e) {
435
+ return typeof e == "object" && e !== null;
436
+ }
437
+ const P = (e) => e.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), ee = (e) => e.replace(/[{}|]/g, (t) => `\\${t}`), X = (e) => {
438
+ const t = "#666";
439
+ return !e || typeof e != "string" ? t : /^#(?:[0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})$/i.test(e) || /^rgba?\(\s*\d{1,3}\s*,\s*\d{1,3}\s*,\s*\d{1,3}\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
440
+ e
441
+ ) || /^hsla?\(\s*\d{1,3}\s*,\s*\d{1,3}%\s*,\s*\d{1,3}%\s*(?:,\s*[\d.]+\s*)?\)$/i.test(
442
+ e
443
+ ) || /^[a-z]{3,20}$/i.test(e) ? e : t;
444
+ };
445
+ function be({
446
+ echarts: e,
447
+ nodes: t,
448
+ links: a,
449
+ height: c = 400,
450
+ nodeWidth: r = 8,
451
+ nodePadding: o = 10,
452
+ showTooltip: f = !0,
453
+ showNodeValues: h,
454
+ nodeLabelLayout: b = "stacked",
455
+ formatValue: m = ge,
456
+ tooltipFormatter: y,
457
+ defaultNodeColor: S,
458
+ left: N,
459
+ right: A,
460
+ linkColor: d = "gradient",
461
+ linkOpacity: x = 0.5,
462
+ className: i,
463
+ isDarkMode: g,
464
+ onNodeClick: T,
465
+ onLinkClick: C
466
+ }) {
467
+ const D = t.some((p) => p.value !== void 0), O = h ?? D, z = b === "inline", _ = V(() => {
468
+ const p = W.text("primary", g), s = W.text("secondary", g), F = t.map(
469
+ (n, l) => n.color ?? S ?? W.categorical(l, g)
470
+ ), v = new Map(
471
+ t.map((n, l) => [n.name, { ...n, computedColor: F[l] }])
472
+ ), B = t.map((n, l) => ({
473
+ name: n.name,
474
+ value: n.value,
475
+ itemStyle: {
476
+ color: F[l]
477
+ }
478
+ })), I = a.map((n) => ({
479
+ source: t[n.source]?.name ?? "",
480
+ target: t[n.target]?.name ?? "",
481
+ value: n.value
482
+ }));
483
+ return {
484
+ backgroundColor: "transparent",
485
+ animation: !0,
486
+ animationDuration: 500,
487
+ animationDurationUpdate: 300,
488
+ animationEasingUpdate: "cubicInOut",
489
+ tooltip: f ? {
490
+ trigger: "item",
491
+ triggerOn: "mousemove",
492
+ dangerousHtmlFormatter: (n) => {
493
+ if (!he(n)) return "";
494
+ if (n.dataType === "node" && n.name) {
495
+ const l = v.get(n.name), $ = X(
496
+ l?.computedColor ?? n.color ?? "#666"
497
+ );
498
+ if (y)
499
+ return y({
500
+ type: "node",
501
+ name: n.name,
502
+ node: l,
503
+ color: $
504
+ });
505
+ const u = P(n.name);
506
+ return `<div style="display:flex;align-items:center;gap:6px;"><span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${$}"></span><strong>${u}</strong></div>`;
507
+ }
508
+ if (n.dataType === "edge" && n.data) {
509
+ const { source: l, target: $, value: u } = n.data;
510
+ if (y)
511
+ return y({
512
+ type: "link",
513
+ name: `${l} → ${$}`,
514
+ link: {
515
+ source: l ?? "",
516
+ target: $ ?? "",
517
+ value: u ?? 0
518
+ }
519
+ });
520
+ const R = v.get(l ?? ""), q = v.get($ ?? ""), U = X(
521
+ R?.computedColor ?? "#666"
522
+ ), re = X(
523
+ q?.computedColor ?? "#666"
524
+ ), se = P(l ?? ""), oe = P($ ?? "");
525
+ return `<div style="display:flex;align-items:center;gap:6px;margin-bottom:4px;">
526
+ <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${U}"></span>
527
+ <strong>${se}</strong>
528
+ <span style="color:${s}">→</span>
529
+ <span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:${re}"></span>
530
+ <strong>${oe}</strong>
531
+ </div>
532
+ <strong>${u !== void 0 ? P(m(u)) : ""}</strong>`;
533
+ }
534
+ return "";
535
+ }
536
+ } : void 0,
537
+ series: [
538
+ {
539
+ type: "sankey",
540
+ ...N !== void 0 && { left: N },
541
+ ...A !== void 0 && { right: A },
542
+ data: B,
543
+ links: I,
544
+ draggable: !1,
545
+ emphasis: {
546
+ focus: "adjacency"
547
+ },
548
+ nodeWidth: r,
549
+ nodeGap: o,
550
+ lineStyle: {
551
+ color: d === "gradient" ? "source" : "#d1d5db",
552
+ opacity: d === "gradient" ? x : 0.4,
553
+ curveness: 0.5
554
+ },
555
+ label: {
556
+ show: !0,
557
+ color: p,
558
+ fontSize: 12,
559
+ formatter: O ? (n) => {
560
+ const l = n.name ?? "", $ = v.get(l), u = ee(l);
561
+ if ($?.value !== void 0) {
562
+ const R = ee(
563
+ m($.value)
564
+ );
565
+ return z ? `{name|${u}} {value|${R}}` : `{value|${R}}
566
+ {name|${u}}`;
567
+ }
568
+ return u;
569
+ } : void 0,
570
+ rich: O ? {
571
+ value: {
572
+ fontSize: 11,
573
+ color: p,
574
+ lineHeight: z ? void 0 : 16
575
+ },
576
+ name: {
577
+ fontSize: 12,
578
+ color: p,
579
+ fontWeight: 700
580
+ }
581
+ } : void 0
582
+ }
583
+ }
584
+ ]
585
+ };
586
+ }, [
587
+ t,
588
+ a,
589
+ f,
590
+ r,
591
+ o,
592
+ S,
593
+ N,
594
+ A,
595
+ g,
596
+ d,
597
+ x,
598
+ O,
599
+ z,
600
+ m,
601
+ y
602
+ ]), j = ce(
603
+ (p) => {
604
+ if (p.dataType === "node" && T && p.name) {
605
+ const s = t.findIndex((B) => B.name === p.name), v = {
606
+ ...s >= 0 ? t[s] : null,
607
+ name: p.name
608
+ };
609
+ T(v);
610
+ } else if (p.dataType === "edge" && C && p.data) {
611
+ const s = p.data, F = typeof s == "object" && s !== null && "source" in s ? String(s.source) : "", v = typeof s == "object" && s !== null && "target" in s ? String(s.target) : "", B = t.findIndex((u) => u.name === F), I = t.findIndex((u) => u.name === v);
612
+ if (B === -1 || I === -1) return;
613
+ const n = p.value, l = typeof n == "number" ? n : Array.isArray(n) && typeof n[0] == "number" ? n[0] : 0, $ = a.find(
614
+ (u) => u.source === B && u.target === I
615
+ );
616
+ C({
617
+ ...$,
618
+ source: B,
619
+ target: I,
620
+ value: l
621
+ });
622
+ }
623
+ },
624
+ [t, a, T, C]
625
+ ), E = V(
626
+ () => ({
627
+ click: j
628
+ }),
629
+ [j]
630
+ );
631
+ return /* @__PURE__ */ w(
632
+ J,
633
+ {
634
+ echarts: e,
635
+ options: _,
636
+ className: i,
637
+ isDarkMode: g,
638
+ height: c,
639
+ onEvents: E
640
+ }
641
+ );
642
+ }
643
+ be.displayName = "SankeyChart";
644
+ export {
645
+ J as C,
646
+ be as S,
647
+ $e as T,
648
+ we as a,
649
+ W as b
650
+ };
651
+ //# sourceMappingURL=SankeyChart-krkvltewpn3bbupw.js.map