drizzle-cube 0.4.4 → 0.4.7

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 (99) hide show
  1. package/dist/adapters/express/index.cjs +8 -4
  2. package/dist/adapters/express/index.d.ts +7 -0
  3. package/dist/adapters/express/index.js +189 -139
  4. package/dist/adapters/fastify/index.cjs +8 -4
  5. package/dist/adapters/fastify/index.d.ts +7 -0
  6. package/dist/adapters/fastify/index.js +209 -150
  7. package/dist/adapters/handler-D6l8AbJV.cjs +7 -0
  8. package/dist/adapters/handler-DsNgnIPK.js +458 -0
  9. package/dist/adapters/hono/index.cjs +8 -4
  10. package/dist/adapters/hono/index.d.ts +7 -0
  11. package/dist/adapters/hono/index.js +202 -144
  12. package/dist/adapters/{mcp-transport-BqLo4hKi.cjs → mcp-transport-BB998cy5.cjs} +21 -21
  13. package/dist/adapters/{mcp-transport-YHDZWKOi.js → mcp-transport-DFTCWene.js} +4 -0
  14. package/dist/adapters/nextjs/index.cjs +7 -3
  15. package/dist/adapters/nextjs/index.d.ts +14 -0
  16. package/dist/adapters/nextjs/index.js +220 -144
  17. package/dist/client/charts.js +13 -13
  18. package/dist/client/chunks/{RetentionCombinedChart-BK8N-MOQ.js → RetentionCombinedChart-CEI8KQ3t.js} +2 -2
  19. package/dist/client/chunks/{RetentionCombinedChart-BK8N-MOQ.js.map → RetentionCombinedChart-CEI8KQ3t.js.map} +1 -1
  20. package/dist/client/chunks/{analysis-builder-CNBmAGAO.js → analysis-builder-Dn8xpgPQ.js} +6 -6
  21. package/dist/client/chunks/{analysis-builder-CNBmAGAO.js.map → analysis-builder-Dn8xpgPQ.js.map} +1 -1
  22. package/dist/client/chunks/{analysis-builder-shared-INGGwyTG.js → analysis-builder-shared-D3xYzXlh.js} +2 -2
  23. package/dist/client/chunks/{analysis-builder-shared-INGGwyTG.js.map → analysis-builder-shared-D3xYzXlh.js.map} +1 -1
  24. package/dist/client/chunks/{chart-activity-grid-DvgTYQaE.js → chart-activity-grid-DStNr34n.js} +2 -2
  25. package/dist/client/chunks/{chart-activity-grid-DvgTYQaE.js.map → chart-activity-grid-DStNr34n.js.map} +1 -1
  26. package/dist/client/chunks/{chart-area-BKjd_STS.js → chart-area-QKKboTbq.js} +3 -3
  27. package/dist/client/chunks/{chart-area-BKjd_STS.js.map → chart-area-QKKboTbq.js.map} +1 -1
  28. package/dist/client/chunks/{chart-bar-DBI41w05.js → chart-bar-HpXF42H1.js} +2 -2
  29. package/dist/client/chunks/{chart-bar-DBI41w05.js.map → chart-bar-HpXF42H1.js.map} +1 -1
  30. package/dist/client/chunks/{chart-bubble-BD-1kneU.js → chart-bubble-Bf42A1-B.js} +2 -2
  31. package/dist/client/chunks/{chart-bubble-BD-1kneU.js.map → chart-bubble-Bf42A1-B.js.map} +1 -1
  32. package/dist/client/chunks/{chart-config-markdown-6fsr-U6_.js → chart-config-markdown-BXKL5TbQ.js} +8 -1
  33. package/dist/client/chunks/{chart-config-markdown-6fsr-U6_.js.map → chart-config-markdown-BXKL5TbQ.js.map} +1 -1
  34. package/dist/client/chunks/{chart-data-table-B74HLpAx.js → chart-data-table-Ch_1c1Zo.js} +2 -2
  35. package/dist/client/chunks/{chart-data-table-B74HLpAx.js.map → chart-data-table-Ch_1c1Zo.js.map} +1 -1
  36. package/dist/client/chunks/{chart-funnel-DQ9cW6j9.js → chart-funnel-C9kenCpp.js} +2 -2
  37. package/dist/client/chunks/{chart-funnel-DQ9cW6j9.js.map → chart-funnel-C9kenCpp.js.map} +1 -1
  38. package/dist/client/chunks/{chart-heat-map-CpIr4tbs.js → chart-heat-map-CYGemyPB.js} +2 -2
  39. package/dist/client/chunks/{chart-heat-map-CpIr4tbs.js.map → chart-heat-map-CYGemyPB.js.map} +1 -1
  40. package/dist/client/chunks/{chart-kpi-delta-DPcSazD3.js → chart-kpi-delta-CWCmi8vL.js} +3 -3
  41. package/dist/client/chunks/{chart-kpi-delta-DPcSazD3.js.map → chart-kpi-delta-CWCmi8vL.js.map} +1 -1
  42. package/dist/client/chunks/{chart-kpi-number-D62PzKZ1.js → chart-kpi-number-C-5m3qt5.js} +2 -2
  43. package/dist/client/chunks/{chart-kpi-number-D62PzKZ1.js.map → chart-kpi-number-C-5m3qt5.js.map} +1 -1
  44. package/dist/client/chunks/{chart-kpi-text-B6Z5tFV1.js → chart-kpi-text--t4ibPmx.js} +3 -3
  45. package/dist/client/chunks/{chart-kpi-text-B6Z5tFV1.js.map → chart-kpi-text--t4ibPmx.js.map} +1 -1
  46. package/dist/client/chunks/{chart-line-Ds4BYA0K.js → chart-line-C7YcMWBw.js} +3 -3
  47. package/dist/client/chunks/{chart-line-Ds4BYA0K.js.map → chart-line-C7YcMWBw.js.map} +1 -1
  48. package/dist/client/chunks/chart-markdown-Du4Z2iqK.js +2695 -0
  49. package/dist/client/chunks/chart-markdown-Du4Z2iqK.js.map +1 -0
  50. package/dist/client/chunks/{chart-pie-BBrLh0iU.js → chart-pie-C4SuxKSN.js} +2 -2
  51. package/dist/client/chunks/{chart-pie-BBrLh0iU.js.map → chart-pie-C4SuxKSN.js.map} +1 -1
  52. package/dist/client/chunks/{chart-radar-vr5FgjHT.js → chart-radar-BW3Z_-Ly.js} +2 -2
  53. package/dist/client/chunks/{chart-radar-vr5FgjHT.js.map → chart-radar-BW3Z_-Ly.js.map} +1 -1
  54. package/dist/client/chunks/{chart-radial-bar-BV_3Nm5P.js → chart-radial-bar-0Fa3aeP5.js} +2 -2
  55. package/dist/client/chunks/{chart-radial-bar-BV_3Nm5P.js.map → chart-radial-bar-0Fa3aeP5.js.map} +1 -1
  56. package/dist/client/chunks/{chart-sankey-CHROzr4S.js → chart-sankey-DBghfbg1.js} +2 -2
  57. package/dist/client/chunks/{chart-sankey-CHROzr4S.js.map → chart-sankey-DBghfbg1.js.map} +1 -1
  58. package/dist/client/chunks/{chart-scatter-DbRTU3FG.js → chart-scatter-DOVu1TNq.js} +2 -2
  59. package/dist/client/chunks/{chart-scatter-DbRTU3FG.js.map → chart-scatter-DOVu1TNq.js.map} +1 -1
  60. package/dist/client/chunks/{chart-sunburst-B-aPUzYL.js → chart-sunburst-LfNthFlZ.js} +2 -2
  61. package/dist/client/chunks/{chart-sunburst-B-aPUzYL.js.map → chart-sunburst-LfNthFlZ.js.map} +1 -1
  62. package/dist/client/chunks/{chart-tree-map-qY148fiC.js → chart-tree-map-DZtQPyWX.js} +2 -2
  63. package/dist/client/chunks/{chart-tree-map-qY148fiC.js.map → chart-tree-map-DZtQPyWX.js.map} +1 -1
  64. package/dist/client/chunks/{chartConfigRegistry-Di34paQH.js → chartConfigRegistry-C5dZm-ZK.js} +2 -2
  65. package/dist/client/chunks/{chartConfigRegistry-Di34paQH.js.map → chartConfigRegistry-C5dZm-ZK.js.map} +1 -1
  66. package/dist/client/chunks/{charts-core-T8UglYyq.js → charts-core-DmGfleFz.js} +199 -187
  67. package/dist/client/chunks/{charts-core-T8UglYyq.js.map → charts-core-DmGfleFz.js.map} +1 -1
  68. package/dist/client/chunks/{charts-loader-YnhJHubD.js → charts-loader-DcFWOUeV.js} +21 -21
  69. package/dist/client/chunks/{charts-loader-YnhJHubD.js.map → charts-loader-DcFWOUeV.js.map} +1 -1
  70. package/dist/client/chunks/{components-D0i1yQsk.js → components-Bdt1AmzS.js} +3521 -3369
  71. package/dist/client/chunks/components-Bdt1AmzS.js.map +1 -0
  72. package/dist/client/components/AgenticNotebook/AgentChatPanel.d.ts +8 -0
  73. package/dist/client/components/AgenticNotebook/ChatInput.d.ts +14 -0
  74. package/dist/client/components/AgenticNotebook/ChatMessage.d.ts +7 -0
  75. package/dist/client/components/AgenticNotebook/NotebookCanvas.d.ts +3 -0
  76. package/dist/client/components/AgenticNotebook/NotebookMarkdownBlock.d.ts +12 -0
  77. package/dist/client/components/AgenticNotebook/NotebookPortletBlock.d.ts +12 -0
  78. package/dist/client/components/AgenticNotebook/index.d.ts +34 -0
  79. package/dist/client/components/DashboardPortletCard.d.ts +3 -2
  80. package/dist/client/components.js +1 -1
  81. package/dist/client/hooks/dashboard/layoutUtils.d.ts +7 -0
  82. package/dist/client/hooks/dashboard/useDashboardController.d.ts +53 -0
  83. package/dist/client/hooks/dashboard/useGridLayoutEngine.d.ts +10 -0
  84. package/dist/client/hooks/dashboard/useRowLayoutEngine.d.ts +18 -0
  85. package/dist/client/hooks/useAgentChat.d.ts +36 -0
  86. package/dist/client/index.d.ts +6 -0
  87. package/dist/client/index.js +923 -187
  88. package/dist/client/index.js.map +1 -1
  89. package/dist/client/stores/notebookStore.d.ts +152 -0
  90. package/dist/client/styles.css +1 -1
  91. package/dist/client/utils.js +4 -4
  92. package/dist/client-bundle-stats.html +1 -1
  93. package/dist/server/index.cjs +101 -91
  94. package/dist/server/index.d.ts +155 -0
  95. package/dist/server/index.js +4423 -3609
  96. package/package.json +7 -1
  97. package/dist/client/chunks/chart-markdown-Rq6ORisB.js +0 -276
  98. package/dist/client/chunks/chart-markdown-Rq6ORisB.js.map +0 -1
  99. package/dist/client/chunks/components-D0i1yQsk.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { jsx as l, jsxs as p } from "react/jsx-runtime";
2
- import { useMemo as U, useContext as L, useRef as H, useState as E, useLayoutEffect as K } from "react";
3
- import { C as V } from "./providers-CgxXm6Ll.js";
4
- import { ResponsiveContainer as T, Tooltip as B } from "recharts";
1
+ import { jsx as l, jsxs as x } from "react/jsx-runtime";
2
+ import { useMemo as U, useContext as H, useRef as D, useState as T, useLayoutEffect as K, startTransition as V } from "react";
3
+ import { C as B } from "./providers-CgxXm6Ll.js";
4
+ import { ResponsiveContainer as I, Tooltip as z } from "recharts";
5
5
  const G = {
6
6
  sm: "dc:h-6 dc:w-6",
7
7
  md: "dc:h-8 dc:w-8",
8
8
  lg: "dc:h-12 dc:w-12"
9
9
  };
10
- function I({
10
+ function A({
11
11
  size: e = "md",
12
12
  className: t = ""
13
13
  }) {
@@ -24,20 +24,20 @@ function I({
24
24
  function k({ children: e, className: t = "" }) {
25
25
  return /* @__PURE__ */ l("h3", { className: `dc:text-sm dc:font-semibold text-dc-primary dc:uppercase dc:tracking-wide ${t}`, children: e });
26
26
  }
27
- function Q(e) {
27
+ function ee(e) {
28
28
  return e != null && !isNaN(Number(e));
29
29
  }
30
- function $(e) {
30
+ function E(e) {
31
31
  if (e == null) return null;
32
32
  const t = typeof e == "string" ? parseFloat(e) : Number(e);
33
33
  return isNaN(t) ? null : t;
34
34
  }
35
- function A(e) {
35
+ function F(e) {
36
36
  if (e == null) return "No data";
37
37
  const t = typeof e == "number" ? e : parseFloat(e);
38
38
  return isNaN(t) ? String(e) : Number.isInteger(t) ? t.toLocaleString() : parseFloat(t.toFixed(2)).toLocaleString();
39
39
  }
40
- function F(e, t, c) {
40
+ function M(e, t, c) {
41
41
  if (e == null)
42
42
  return "No data";
43
43
  const n = typeof e == "number" ? e : parseFloat(String(e));
@@ -47,55 +47,55 @@ function F(e, t, c) {
47
47
  return n > 0 ? "∞" : "-∞";
48
48
  const r = c || (typeof navigator < "u" ? navigator.language : "en-US");
49
49
  if (!t)
50
- return A(e);
51
- const { unit: i, abbreviate: s = !0, decimals: a, customPrefix: m, customSuffix: d } = t;
52
- let u = n, h = "";
50
+ return F(e);
51
+ const { unit: i, abbreviate: s = !0, decimals: d, customPrefix: h, customSuffix: o } = t;
52
+ let u = n, f = "";
53
53
  if (s) {
54
- const o = Math.abs(n);
55
- o >= 1e9 ? (u = n / 1e9, h = "B") : o >= 1e6 ? (u = n / 1e6, h = "M") : o >= 1e3 && (u = n / 1e3, h = "K");
54
+ const a = Math.abs(n);
55
+ a >= 1e9 ? (u = n / 1e9, f = "B") : a >= 1e6 ? (u = n / 1e6, f = "M") : a >= 1e3 && (u = n / 1e3, f = "K");
56
56
  }
57
- const f = a !== void 0 ? a : Number.isInteger(u) ? 0 : 2;
57
+ const p = d !== void 0 ? d : Number.isInteger(u) ? 0 : 2;
58
58
  switch (i) {
59
59
  case "currency": {
60
- const o = O(r);
61
- if (s && h) {
60
+ const a = O(r);
61
+ if (s && f) {
62
62
  const N = new Intl.NumberFormat(r, {
63
63
  style: "currency",
64
- currency: o,
65
- minimumFractionDigits: f,
66
- maximumFractionDigits: f
67
- }).format(u), C = new Intl.NumberFormat(r, {
64
+ currency: a,
65
+ minimumFractionDigits: p,
66
+ maximumFractionDigits: p
67
+ }).format(u), R = new Intl.NumberFormat(r, {
68
68
  style: "currency",
69
- currency: o
69
+ currency: a
70
70
  }).formatToParts(u);
71
- return C[C.length - 1]?.type === "currency" ? N.replace(/(\s*[^\d\s]+)$/, h + "$1") : N + h;
71
+ return R[R.length - 1]?.type === "currency" ? N.replace(/(\s*[^\d\s]+)$/, f + "$1") : N + f;
72
72
  }
73
73
  return new Intl.NumberFormat(r, {
74
74
  style: "currency",
75
- currency: o,
76
- minimumFractionDigits: f,
77
- maximumFractionDigits: f
75
+ currency: a,
76
+ minimumFractionDigits: p,
77
+ maximumFractionDigits: p
78
78
  }).format(u);
79
79
  }
80
80
  case "percent": {
81
- const o = Math.abs(u) <= 1 && !s ? u * 100 : u;
81
+ const a = Math.abs(u) <= 1 && !s ? u * 100 : u;
82
82
  return new Intl.NumberFormat(r, {
83
- minimumFractionDigits: f,
84
- maximumFractionDigits: f
85
- }).format(o) + h + "%";
83
+ minimumFractionDigits: p,
84
+ maximumFractionDigits: p
85
+ }).format(a) + f + "%";
86
86
  }
87
87
  case "custom": {
88
- const o = m || "", N = d || "", C = new Intl.NumberFormat(r, {
89
- minimumFractionDigits: f,
90
- maximumFractionDigits: f
88
+ const a = h || "", N = o || "", R = new Intl.NumberFormat(r, {
89
+ minimumFractionDigits: p,
90
+ maximumFractionDigits: p
91
91
  }).format(u);
92
- return o + C + h + N;
92
+ return a + R + f + N;
93
93
  }
94
94
  default:
95
95
  return new Intl.NumberFormat(r, {
96
- minimumFractionDigits: f,
97
- maximumFractionDigits: f
98
- }).format(u) + h;
96
+ minimumFractionDigits: p,
97
+ maximumFractionDigits: p
98
+ }).format(u) + f;
99
99
  }
100
100
  }
101
101
  function O(e) {
@@ -145,16 +145,16 @@ function O(e) {
145
145
  TR: "TRY"
146
146
  }[c] || "USD";
147
147
  }
148
- function ee(e) {
149
- return (t) => F(t, e);
148
+ function te(e) {
149
+ return (t) => M(t, e);
150
150
  }
151
151
  function W(e, t) {
152
152
  return t[e] || e;
153
153
  }
154
- function te(e, t) {
154
+ function re(e, t) {
155
155
  return e.map((c) => W(c, t));
156
156
  }
157
- function M(e, t) {
157
+ function P(e, t) {
158
158
  if (!e) return String(e || "Unknown");
159
159
  const c = String(e);
160
160
  if (c.match(/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}:\d{2}/)) {
@@ -163,39 +163,39 @@ function M(e, t) {
163
163
  const r = new Date(n);
164
164
  if (isNaN(r.getTime()))
165
165
  return c;
166
- const i = r.getUTCFullYear(), s = String(r.getUTCMonth() + 1).padStart(2, "0"), a = String(r.getUTCDate()).padStart(2, "0"), m = r.getUTCHours(), d = r.getUTCMinutes();
166
+ const i = r.getUTCFullYear(), s = String(r.getUTCMonth() + 1).padStart(2, "0"), d = String(r.getUTCDate()).padStart(2, "0"), h = r.getUTCHours(), o = r.getUTCMinutes();
167
167
  if (t)
168
168
  switch (t.toLowerCase()) {
169
169
  case "year":
170
170
  return `${i}`;
171
171
  case "quarter": {
172
- const f = Math.floor(r.getUTCMonth() / 3) + 1;
173
- return `${i}-Q${f}`;
172
+ const p = Math.floor(r.getUTCMonth() / 3) + 1;
173
+ return `${i}-Q${p}`;
174
174
  }
175
175
  case "month":
176
176
  return `${i}-${s}`;
177
177
  case "week":
178
- return `${i}-${s}-${a}`;
178
+ return `${i}-${s}-${d}`;
179
179
  case "day":
180
- return `${i}-${s}-${a}`;
180
+ return `${i}-${s}-${d}`;
181
181
  case "hour":
182
- return `${i}-${s}-${a} ${String(m).padStart(2, "0")}:00`;
182
+ return `${i}-${s}-${d} ${String(h).padStart(2, "0")}:00`;
183
183
  case "minute":
184
- return `${i}-${s}-${a} ${String(m).padStart(2, "0")}:${String(d).padStart(2, "0")}`;
184
+ return `${i}-${s}-${d} ${String(h).padStart(2, "0")}:${String(o).padStart(2, "0")}`;
185
185
  }
186
- const u = r.getUTCSeconds(), h = r.getUTCMilliseconds();
187
- if (a === "01" && m === 0 && d === 0 && u === 0 && h === 0) {
186
+ const u = r.getUTCSeconds(), f = r.getUTCMilliseconds();
187
+ if (d === "01" && h === 0 && o === 0 && u === 0 && f === 0) {
188
188
  if (s === "01" || s === "04" || s === "07" || s === "10") {
189
- const f = Math.floor(r.getUTCMonth() / 3) + 1;
190
- return `${i}-Q${f}`;
189
+ const p = Math.floor(r.getUTCMonth() / 3) + 1;
190
+ return `${i}-Q${p}`;
191
191
  }
192
192
  return `${i}-${s}`;
193
193
  }
194
- return m === 0 && d === 0 && u === 0 && h === 0 ? `${i}-${s}-${a}` : d === 0 && u === 0 && h === 0 ? `${i}-${s}-${a} ${String(m).padStart(2, "0")}:00` : `${i}-${s}-${a} ${String(m).padStart(2, "0")}:${String(d).padStart(2, "0")}`;
194
+ return h === 0 && o === 0 && u === 0 && f === 0 ? `${i}-${s}-${d}` : o === 0 && u === 0 && f === 0 ? `${i}-${s}-${d} ${String(h).padStart(2, "0")}:00` : `${i}-${s}-${d} ${String(h).padStart(2, "0")}:${String(o).padStart(2, "0")}`;
195
195
  }
196
196
  return c;
197
197
  }
198
- function P(e, t) {
198
+ function L(e, t) {
199
199
  try {
200
200
  if (e?.timeDimensions) {
201
201
  const n = e.timeDimensions.find((r) => t === r.dimension || t.startsWith(r.dimension.replace(".", "_")) || t === `${r.dimension}_${r.granularity}`);
@@ -215,68 +215,68 @@ function P(e, t) {
215
215
  }
216
216
  function Y(e, t, c, n, r = (i) => i) {
217
217
  if (!e || e.length === 0) return [];
218
- const i = P(n, t);
218
+ const i = L(n, t);
219
219
  return e.map((s) => {
220
- const a = {
221
- name: M(s[t], i) || s[t] || "Unknown"
220
+ const d = {
221
+ name: P(s[t], i) || s[t] || "Unknown"
222
222
  };
223
- return c.forEach((m) => {
224
- const d = r(m);
225
- a[d] = $(s[m]);
226
- }), a;
223
+ return c.forEach((h) => {
224
+ const o = r(h);
225
+ d[o] = E(s[h]);
226
+ }), d;
227
227
  });
228
228
  }
229
- function re(e, t, c, n, r, i = (s) => s) {
229
+ function ne(e, t, c, n, r, i = (s) => s) {
230
230
  if (!e || e.length === 0)
231
231
  return { data: [], seriesKeys: [], hasDimensions: !1 };
232
- const s = n || {}, a = [
232
+ const s = n || {}, d = [
233
233
  ...s.dimensions || [],
234
- ...s.timeDimensions?.map((o) => o.dimension) || []
235
- ], m = s.measures || [], d = c.filter((o) => m.includes(o)), u = (r || []).filter((o) => a.includes(o));
234
+ ...s.timeDimensions?.map((a) => a.dimension) || []
235
+ ], h = s.measures || [], o = c.filter((a) => h.includes(a)), u = (r || []).filter((a) => d.includes(a));
236
236
  if (u.length > 0) {
237
- const o = {};
238
- e.forEach((x) => {
239
- const v = P(n, t), b = M(x[t], v) || x[t] || "Unknown";
240
- o[b] || (o[b] = { name: String(b) }), d.forEach((D) => {
241
- const g = i(D), y = $(x[D]);
242
- if (y !== null) {
243
- const R = o[b][g];
244
- o[b][g] = R == null ? y : R + y;
245
- } else g in o[b] || (o[b][g] = null);
246
- }), u.forEach((D) => {
247
- const g = x[D];
248
- if (g != null) {
249
- const y = String(g), R = d[0] || m.find(
250
- (S) => S.includes("totalCost") || S.includes("count") || S.includes("sum")
251
- ) || m[0];
252
- if (R) {
253
- const S = $(x[R]);
254
- if (S !== null) {
255
- const w = o[b][y];
256
- o[b][y] = w == null ? S : w + S;
257
- } else y in o[b] || (o[b][y] = null);
237
+ const a = {};
238
+ e.forEach((b) => {
239
+ const g = L(n, t), m = P(b[t], g) || b[t] || "Unknown";
240
+ a[m] || (a[m] = { name: String(m) }), o.forEach((S) => {
241
+ const y = i(S), C = E(b[S]);
242
+ if (C !== null) {
243
+ const w = a[m][y];
244
+ a[m][y] = w == null ? C : w + C;
245
+ } else y in a[m] || (a[m][y] = null);
246
+ }), u.forEach((S) => {
247
+ const y = b[S];
248
+ if (y != null) {
249
+ const C = String(y), w = o[0] || h.find(
250
+ (v) => v.includes("totalCost") || v.includes("count") || v.includes("sum")
251
+ ) || h[0];
252
+ if (w) {
253
+ const v = E(b[w]);
254
+ if (v !== null) {
255
+ const $ = a[m][C];
256
+ a[m][C] = $ == null ? v : $ + v;
257
+ } else C in a[m] || (a[m][C] = null);
258
258
  }
259
259
  }
260
260
  });
261
261
  });
262
- const N = Object.values(o), C = Array.from(new Set(
262
+ const N = Object.values(a), R = Array.from(new Set(
263
263
  e.flatMap(
264
- (x) => u.map((v) => {
265
- const b = x[v];
266
- return b != null ? String(b) : null;
267
- }).filter((v) => v !== null)
264
+ (b) => u.map((g) => {
265
+ const m = b[g];
266
+ return m != null ? String(m) : null;
267
+ }).filter((g) => g !== null)
268
268
  )
269
269
  ));
270
270
  return {
271
271
  data: N,
272
- seriesKeys: C,
272
+ seriesKeys: R,
273
273
  hasDimensions: !0
274
274
  };
275
275
  }
276
- const h = Y(e, t, c, n, i), f = c.map((o) => i(o));
276
+ const f = Y(e, t, c, n, i), p = c.map((a) => i(a));
277
277
  return {
278
- data: h,
279
- seriesKeys: f,
278
+ data: f,
279
+ seriesKeys: p,
280
280
  hasDimensions: !1
281
281
  };
282
282
  }
@@ -284,11 +284,11 @@ function Z() {
284
284
  const e = typeof navigator < "u" ? navigator.language : "en-US";
285
285
  return new Intl.NumberFormat(e, {
286
286
  style: "currency",
287
- currency: z(e),
287
+ currency: _(e),
288
288
  currencyDisplay: "narrowSymbol"
289
289
  }).format(0).replace(/[\d.,\s]/g, "").trim() || "$";
290
290
  }
291
- function z(e) {
291
+ function _(e) {
292
292
  const c = e.split("-")[1]?.toUpperCase();
293
293
  return {
294
294
  US: "USD",
@@ -335,84 +335,84 @@ function z(e) {
335
335
  TR: "TRY"
336
336
  }[c] || "USD";
337
337
  }
338
- function ne({
338
+ function ce({
339
339
  value: e,
340
340
  onChange: t,
341
341
  axisLabel: c,
342
342
  previewValue: n = 125e4
343
343
  }) {
344
- const r = U(() => e || {}, [e]), i = U(() => Z(), []), s = U(() => F(n, r), [n, r]), a = (d) => {
345
- t({ ...r, ...d });
346
- }, m = [
344
+ const r = U(() => e || {}, [e]), i = U(() => Z(), []), s = U(() => M(n, r), [n, r]), d = (o) => {
345
+ t({ ...r, ...o });
346
+ }, h = [
347
347
  { value: "currency", label: i },
348
348
  { value: "percent", label: "%" },
349
349
  { value: "number", label: "#" },
350
350
  { value: "custom", label: "Custom" }
351
351
  ];
352
- return /* @__PURE__ */ p("div", { className: "dc:space-y-3 dc:pb-4", children: [
352
+ return /* @__PURE__ */ x("div", { className: "dc:space-y-3 dc:pb-4", children: [
353
353
  /* @__PURE__ */ l(k, { children: c }),
354
- /* @__PURE__ */ p("div", { className: "dc:space-y-1", children: [
354
+ /* @__PURE__ */ x("div", { className: "dc:space-y-1", children: [
355
355
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Label" }),
356
356
  /* @__PURE__ */ l(
357
357
  "input",
358
358
  {
359
359
  type: "text",
360
360
  value: r.label || "",
361
- onChange: (d) => a({ label: d.target.value || void 0 }),
361
+ onChange: (o) => d({ label: o.target.value || void 0 }),
362
362
  placeholder: "Auto-generated label",
363
363
  className: "dc:w-full dc:px-2 dc:py-1 dc:text-sm dc:border border-dc-border dc:rounded-sm focus:ring-dc-accent focus:border-dc-accent bg-dc-surface text-dc-text"
364
364
  }
365
365
  )
366
366
  ] }),
367
- /* @__PURE__ */ p("div", { className: "dc:space-y-1", children: [
367
+ /* @__PURE__ */ x("div", { className: "dc:space-y-1", children: [
368
368
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Unit" }),
369
- /* @__PURE__ */ l("div", { className: "dc:flex dc:border border-dc-border dc:rounded-sm dc:overflow-hidden", children: m.map((d) => /* @__PURE__ */ l(
369
+ /* @__PURE__ */ l("div", { className: "dc:flex dc:border border-dc-border dc:rounded-sm dc:overflow-hidden", children: h.map((o) => /* @__PURE__ */ l(
370
370
  "button",
371
371
  {
372
372
  type: "button",
373
- onClick: () => a({ unit: d.value }),
374
- className: `dc:flex-1 dc:px-2 dc:py-1.5 dc:text-sm dc:font-medium dc:transition-colors ${r.unit === d.value ? "bg-dc-primary text-white" : "bg-dc-surface text-dc-text hover:bg-dc-border"}`,
375
- children: d.label
373
+ onClick: () => d({ unit: o.value }),
374
+ className: `dc:flex-1 dc:px-2 dc:py-1.5 dc:text-sm dc:font-medium dc:transition-colors ${r.unit === o.value ? "bg-dc-primary text-white" : "bg-dc-surface text-dc-text hover:bg-dc-border"}`,
375
+ children: o.label
376
376
  },
377
- d.value
377
+ o.value
378
378
  )) })
379
379
  ] }),
380
- r.unit === "custom" && /* @__PURE__ */ p("div", { className: "dc:flex dc:gap-2", children: [
381
- /* @__PURE__ */ p("div", { className: "dc:flex-1 dc:space-y-1", children: [
380
+ r.unit === "custom" && /* @__PURE__ */ x("div", { className: "dc:flex dc:gap-2", children: [
381
+ /* @__PURE__ */ x("div", { className: "dc:flex-1 dc:space-y-1", children: [
382
382
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Prefix" }),
383
383
  /* @__PURE__ */ l(
384
384
  "input",
385
385
  {
386
386
  type: "text",
387
387
  value: r.customPrefix || "",
388
- onChange: (d) => a({ customPrefix: d.target.value || void 0 }),
388
+ onChange: (o) => d({ customPrefix: o.target.value || void 0 }),
389
389
  placeholder: "e.g., $",
390
390
  className: "dc:w-full dc:px-2 dc:py-1 dc:text-sm dc:border border-dc-border dc:rounded-sm focus:ring-dc-accent focus:border-dc-accent bg-dc-surface text-dc-text"
391
391
  }
392
392
  )
393
393
  ] }),
394
- /* @__PURE__ */ p("div", { className: "dc:flex-1 dc:space-y-1", children: [
394
+ /* @__PURE__ */ x("div", { className: "dc:flex-1 dc:space-y-1", children: [
395
395
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Suffix" }),
396
396
  /* @__PURE__ */ l(
397
397
  "input",
398
398
  {
399
399
  type: "text",
400
400
  value: r.customSuffix || "",
401
- onChange: (d) => a({ customSuffix: d.target.value || void 0 }),
401
+ onChange: (o) => d({ customSuffix: o.target.value || void 0 }),
402
402
  placeholder: "e.g., units",
403
403
  className: "dc:w-full dc:px-2 dc:py-1 dc:text-sm dc:border border-dc-border dc:rounded-sm focus:ring-dc-accent focus:border-dc-accent bg-dc-surface text-dc-text"
404
404
  }
405
405
  )
406
406
  ] })
407
407
  ] }),
408
- /* @__PURE__ */ p("div", { className: "dc:space-y-1", children: [
408
+ /* @__PURE__ */ x("div", { className: "dc:space-y-1", children: [
409
409
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Abbreviation" }),
410
- /* @__PURE__ */ p("div", { className: "dc:flex dc:border border-dc-border dc:rounded-sm dc:overflow-hidden", children: [
410
+ /* @__PURE__ */ x("div", { className: "dc:flex dc:border border-dc-border dc:rounded-sm dc:overflow-hidden", children: [
411
411
  /* @__PURE__ */ l(
412
412
  "button",
413
413
  {
414
414
  type: "button",
415
- onClick: () => a({ abbreviate: !0 }),
415
+ onClick: () => d({ abbreviate: !0 }),
416
416
  className: `dc:flex-1 dc:px-3 dc:py-1.5 dc:text-sm dc:font-medium dc:transition-colors ${r.abbreviate !== !1 ? "bg-dc-primary text-white" : "bg-dc-surface text-dc-text hover:bg-dc-border"}`,
417
417
  children: "Yes"
418
418
  }
@@ -421,23 +421,23 @@ function ne({
421
421
  "button",
422
422
  {
423
423
  type: "button",
424
- onClick: () => a({ abbreviate: !1 }),
424
+ onClick: () => d({ abbreviate: !1 }),
425
425
  className: `dc:flex-1 dc:px-3 dc:py-1.5 dc:text-sm dc:font-medium dc:transition-colors ${r.abbreviate === !1 ? "bg-dc-primary text-white" : "bg-dc-surface text-dc-text hover:bg-dc-border"}`,
426
426
  children: "No"
427
427
  }
428
428
  )
429
429
  ] })
430
430
  ] }),
431
- /* @__PURE__ */ p("div", { className: "dc:space-y-1", children: [
431
+ /* @__PURE__ */ x("div", { className: "dc:space-y-1", children: [
432
432
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Decimals" }),
433
- /* @__PURE__ */ p("div", { className: "dc:flex dc:gap-2", children: [
433
+ /* @__PURE__ */ x("div", { className: "dc:flex dc:gap-2", children: [
434
434
  /* @__PURE__ */ l(
435
435
  "button",
436
436
  {
437
437
  type: "button",
438
438
  onClick: () => {
439
- const d = r.decimals ?? 2;
440
- d > 0 && a({ decimals: d - 1 });
439
+ const o = r.decimals ?? 2;
440
+ o > 0 && d({ decimals: o - 1 });
441
441
  },
442
442
  disabled: (r.decimals ?? 2) <= 0,
443
443
  className: "dc:flex-1 dc:px-3 dc:py-2 dc:text-sm dc:border border-dc-border dc:rounded-sm bg-dc-surface text-dc-text hover:bg-dc-border dc:disabled:opacity-40 dc:disabled:cursor-not-allowed dc:transition-colors",
@@ -449,8 +449,8 @@ function ne({
449
449
  {
450
450
  type: "button",
451
451
  onClick: () => {
452
- const d = r.decimals ?? 2;
453
- d < 4 && a({ decimals: d + 1 });
452
+ const o = r.decimals ?? 2;
453
+ o < 4 && d({ decimals: o + 1 });
454
454
  },
455
455
  disabled: (r.decimals ?? 2) >= 4,
456
456
  className: "dc:flex-1 dc:px-3 dc:py-2 dc:text-sm dc:border border-dc-border dc:rounded-sm bg-dc-surface text-dc-text hover:bg-dc-border dc:disabled:opacity-40 dc:disabled:cursor-not-allowed dc:transition-colors",
@@ -459,19 +459,19 @@ function ne({
459
459
  )
460
460
  ] })
461
461
  ] }),
462
- /* @__PURE__ */ p("div", { className: "dc:space-y-1", children: [
462
+ /* @__PURE__ */ x("div", { className: "dc:space-y-1", children: [
463
463
  /* @__PURE__ */ l("label", { className: "dc:text-xs text-dc-text-secondary", children: "Preview" }),
464
464
  /* @__PURE__ */ l("div", { className: "dc:text-sm dc:font-mono text-dc-text", children: s })
465
465
  ] })
466
466
  ] });
467
467
  }
468
- function ce() {
469
- const e = L(V);
468
+ function se() {
469
+ const e = H(B);
470
470
  if (!e)
471
471
  throw new Error("useCubeFieldLabel must be used within CubeProvider");
472
472
  return U(() => e.getFieldLabel, [e.getFieldLabel]);
473
473
  }
474
- const se = [
474
+ const ie = [
475
475
  "#3b82f6",
476
476
  // blue
477
477
  "#10b981",
@@ -488,7 +488,7 @@ const se = [
488
488
  // cyan
489
489
  "#84cc16"
490
490
  // lime
491
- ], ie = [
491
+ ], oe = [
492
492
  "#440154",
493
493
  // dark purple
494
494
  "#414487",
@@ -501,36 +501,48 @@ const se = [
501
501
  // green
502
502
  "#fde725"
503
503
  // yellow
504
- ], ae = "#10b981", oe = "#ef4444", de = {
504
+ ], ae = "#10b981", de = "#ef4444", le = {
505
505
  top: 5,
506
506
  right: 30,
507
507
  left: 20,
508
508
  bottom: 5
509
- }, le = {
509
+ }, ue = {
510
510
  top: 5,
511
511
  right: 30,
512
512
  left: 20,
513
513
  bottom: 60
514
514
  // Extra space for rotated labels
515
515
  };
516
- function ue({ children: e, height: t = "100%" }) {
517
- const c = H(null), [n, r] = E(!1), [i, s] = E({ width: 0, height: 0 });
516
+ function me({ children: e, height: t = "100%" }) {
517
+ const c = D(null), [n, r] = T(!1), [i, s] = T({ width: 0, height: 0 }), d = D({ width: 0, height: 0 }), h = D(!1), o = D(null), u = D(null);
518
518
  K(() => {
519
- let a = !0, m = null;
520
- const d = () => {
521
- if (!a || !c.current) return;
522
- const u = c.current.getBoundingClientRect(), h = Math.max(c.current.clientWidth, u.width), f = Math.max(c.current.clientHeight, u.height);
523
- h > 0 && f > 0 && (s({ width: h, height: f }), r(!0));
519
+ let f = !0, p = null;
520
+ const a = () => {
521
+ if (u.current = null, !f) return;
522
+ const b = o.current;
523
+ if (o.current = null, !b) return;
524
+ const g = Math.round(b.width), m = Math.round(b.height);
525
+ if (g <= 0 || m <= 0) return;
526
+ const S = d.current.width !== g || d.current.height !== m, y = !h.current;
527
+ !S && !y || (d.current = { width: g, height: m }, h.current = !0, V(() => {
528
+ S && s({ width: g, height: m }), y && r(!0);
529
+ }));
530
+ }, N = (b, g) => {
531
+ o.current = { width: b, height: g }, u.current === null && (u.current = requestAnimationFrame(a));
532
+ }, R = () => {
533
+ if (!f || !c.current) return;
534
+ const b = c.current.getBoundingClientRect(), g = Math.max(c.current.clientWidth, b.width), m = Math.max(c.current.clientHeight, b.height);
535
+ g > 0 && m > 0 && N(g, m);
524
536
  };
525
- return m = new ResizeObserver((u) => {
526
- for (const h of u) {
527
- const { width: f, height: o } = h.contentRect;
528
- f > 0 && o > 0 && (s({ width: f, height: o }), n || r(!0));
537
+ return p = new ResizeObserver((b) => {
538
+ for (const g of b) {
539
+ const { width: m, height: S } = g.contentRect;
540
+ m > 0 && S > 0 && N(m, S);
529
541
  }
530
- }), c.current && (m.observe(c.current), d()), () => {
531
- a = !1, m?.disconnect();
542
+ }), c.current && (p.observe(c.current), R()), () => {
543
+ f = !1, u.current !== null && (cancelAnimationFrame(u.current), u.current = null), p?.disconnect();
532
544
  };
533
- }, [n]);
545
+ }, []);
534
546
  try {
535
547
  if (t === "100%")
536
548
  return /* @__PURE__ */ l(
@@ -540,7 +552,7 @@ function ue({ children: e, height: t = "100%" }) {
540
552
  className: "dc:w-full dc:h-full dc:flex-1 dc:flex dc:flex-col dc:relative",
541
553
  style: { minHeight: "250px", minWidth: "100px", overflow: "hidden", userSelect: "none" },
542
554
  children: n && i.width > 0 && i.height > 0 ? /* @__PURE__ */ l(
543
- T,
555
+ I,
544
556
  {
545
557
  width: i.width,
546
558
  height: i.height - 16,
@@ -548,10 +560,10 @@ function ue({ children: e, height: t = "100%" }) {
548
560
  style: { marginTop: "16px" },
549
561
  children: e
550
562
  }
551
- ) : /* @__PURE__ */ l("div", { className: "dc:flex dc:items-center dc:justify-center dc:w-full dc:h-full", children: /* @__PURE__ */ l(I, { size: "sm" }) })
563
+ ) : /* @__PURE__ */ l("div", { className: "dc:flex dc:items-center dc:justify-center dc:w-full dc:h-full", children: /* @__PURE__ */ l(A, { size: "sm" }) })
552
564
  }
553
565
  );
554
- const a = {
566
+ const f = {
555
567
  height: typeof t == "number" ? `${t}px` : t,
556
568
  width: "100%",
557
569
  minHeight: "200px",
@@ -563,9 +575,9 @@ function ue({ children: e, height: t = "100%" }) {
563
575
  {
564
576
  ref: c,
565
577
  className: "dc:w-full dc:flex dc:flex-col dc:relative",
566
- style: { ...a, overflow: "hidden" },
578
+ style: { ...f, overflow: "hidden" },
567
579
  children: n && i.width > 0 && i.height > 0 ? /* @__PURE__ */ l(
568
- T,
580
+ I,
569
581
  {
570
582
  width: i.width,
571
583
  height: i.height - 16,
@@ -573,29 +585,29 @@ function ue({ children: e, height: t = "100%" }) {
573
585
  style: { marginTop: "16px" },
574
586
  children: e
575
587
  }
576
- ) : /* @__PURE__ */ l("div", { className: "dc:flex dc:items-center dc:justify-center dc:w-full dc:h-full", children: /* @__PURE__ */ l(I, { size: "sm" }) })
588
+ ) : /* @__PURE__ */ l("div", { className: "dc:flex dc:items-center dc:justify-center dc:w-full dc:h-full", children: /* @__PURE__ */ l(A, { size: "sm" }) })
577
589
  }
578
590
  );
579
- } catch (a) {
580
- return /* @__PURE__ */ p(
591
+ } catch (f) {
592
+ return /* @__PURE__ */ x(
581
593
  "div",
582
594
  {
583
595
  className: "dc:flex dc:flex-col dc:items-center dc:justify-center dc:w-full dc:h-full dc:p-4 dc:text-center dc:border dc:border-dashed dc:rounded-lg",
584
596
  style: { height: t, borderColor: "var(--dc-border)", backgroundColor: "var(--dc-surface)" },
585
597
  children: [
586
598
  /* @__PURE__ */ l("div", { className: "dc:text-sm dc:font-semibold dc:mb-1 text-dc-text-muted", children: "Unable to display chart" }),
587
- /* @__PURE__ */ l("div", { className: "dc:text-xs text-dc-text-secondary", children: a instanceof Error ? a.message : "Failed to create responsive container" })
599
+ /* @__PURE__ */ l("div", { className: "dc:text-xs text-dc-text-secondary", children: f instanceof Error ? f.message : "Failed to create responsive container" })
588
600
  ]
589
601
  }
590
602
  );
591
603
  }
592
604
  }
593
- const _ = (e, t) => e == null ? ["No data", t] : [A(e), t];
594
- function me({ formatter: e, labelFormatter: t }) {
605
+ const j = (e, t) => e == null ? ["No data", t] : [F(e), t];
606
+ function fe({ formatter: e, labelFormatter: t }) {
595
607
  return /* @__PURE__ */ l(
596
- B,
608
+ z,
597
609
  {
598
- formatter: e || _,
610
+ formatter: e || j,
599
611
  labelFormatter: t,
600
612
  contentStyle: {
601
613
  backgroundColor: "white",
@@ -609,7 +621,7 @@ function me({ formatter: e, labelFormatter: t }) {
609
621
  }
610
622
  );
611
623
  }
612
- function fe(e) {
624
+ function he(e) {
613
625
  if (!e || typeof e != "string")
614
626
  return [];
615
627
  const t = e.trim();
@@ -627,7 +639,7 @@ function fe(e) {
627
639
  return console.warn("Failed to parse target values:", c), [];
628
640
  }
629
641
  }
630
- function he(e, t) {
642
+ function pe(e, t) {
631
643
  if (e.length === 0 || t <= 0)
632
644
  return [];
633
645
  if (e.length === 1)
@@ -635,8 +647,8 @@ function he(e, t) {
635
647
  const c = [], n = Math.floor(t / e.length), r = t % e.length;
636
648
  let i = 0;
637
649
  for (let s = 0; s < e.length; s++) {
638
- const a = n + (s < r ? 1 : 0);
639
- for (let m = 0; m < a; m++)
650
+ const d = n + (s < r ? 1 : 0);
651
+ for (let h = 0; h < d; h++)
640
652
  c[i++] = e[s];
641
653
  }
642
654
  return c;
@@ -644,36 +656,36 @@ function he(e, t) {
644
656
  function be(e, t) {
645
657
  return t === 0 ? e === 0 ? 0 : e > 0 ? 100 : -100 : (e - t) / t * 100;
646
658
  }
647
- function pe(e, t = 1) {
659
+ function ge(e, t = 1) {
648
660
  return `${e >= 0 ? "+" : ""}${e.toFixed(t)}%`;
649
661
  }
650
662
  export {
651
- ne as A,
652
- de as C,
653
- I as L,
654
- oe as N,
663
+ ce as A,
664
+ le as C,
665
+ A as L,
666
+ de as N,
655
667
  ae as P,
656
- le as R,
668
+ ue as R,
657
669
  k as S,
658
- ue as a,
659
- me as b,
660
- se as c,
661
- M as d,
662
- $ as e,
663
- F as f,
664
- P as g,
665
- ie as h,
666
- Q as i,
670
+ me as a,
671
+ fe as b,
672
+ ie as c,
673
+ P as d,
674
+ E as e,
675
+ M as f,
676
+ L as g,
677
+ oe as h,
678
+ ee as i,
667
679
  be as j,
668
- pe as k,
669
- A as l,
670
- ee as m,
680
+ ge as k,
681
+ F as l,
682
+ te as m,
671
683
  W as n,
672
- te as o,
673
- fe as p,
684
+ re as o,
685
+ he as p,
674
686
  Y as q,
675
- he as s,
676
- re as t,
677
- ce as u
687
+ pe as s,
688
+ ne as t,
689
+ se as u
678
690
  };
679
- //# sourceMappingURL=charts-core-T8UglYyq.js.map
691
+ //# sourceMappingURL=charts-core-DmGfleFz.js.map