drizzle-cube 0.4.11 → 0.4.13

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.
@@ -1,24 +1,24 @@
1
1
  import { D as J, A as H, e as G, P as X } from "./chunks/components-ClQziOcT.js";
2
- import { i as He, a as Ge, C as Xe, h as Ye, g as Ze, b as et, j as tt, f as st, d as at, M as rt, c as ct, n as ot, T as nt, R as dt, Q as it, O as lt, S as ut, V as mt, I as pt, H as ht, K as ft, W as gt, G as bt, J as yt, X as xt, L as vt, N as Ct, U as kt, Y as Nt, Z as wt, z as St, q as At, x as Dt, t as Tt, s as Mt, w as It, p as Et, v as Bt, o as Lt, r as Rt, y as Pt, u as Qt, k as Ft, l as _t, m as Vt, F as jt, E as qt, B as Ut } from "./chunks/components-ClQziOcT.js";
3
- import { jsx as a, jsxs as b, Fragment as Y } from "react/jsx-runtime";
4
- import R, { useRef as N, createContext as Z, useContext as ee, useState as F, useCallback as p, useEffect as Q } from "react";
5
- import { c as te, d as se, e as ae, s as re, f as K } from "./chunks/vendor-AVsJ2ni0.js";
6
- import { a as _ } from "./chunks/icons-DAeqv1iX.js";
2
+ import { i as He, a as Ge, C as Xe, h as Ye, g as Ze, b as et, j as tt, f as st, d as rt, M as at, c as ct, n as nt, T as ot, R as dt, Q as it, O as lt, S as ut, V as mt, I as pt, H as ht, K as ft, W as gt, G as bt, J as yt, X as xt, L as vt, N as Ct, U as kt, Y as Nt, Z as wt, z as St, q as At, x as Dt, t as Tt, s as Mt, w as It, p as Et, v as Bt, o as Lt, r as Rt, y as Pt, u as Qt, k as Ft, l as _t, m as Vt, F as jt, E as qt, B as Ut } from "./chunks/components-ClQziOcT.js";
3
+ import { jsx as r, jsxs as y, Fragment as Y } from "react/jsx-runtime";
4
+ import R, { useRef as N, createContext as Z, useContext as ee, useState as _, useCallback as f, useEffect as P } from "react";
5
+ import { c as te, d as se, e as re, s as ae, f as K } from "./chunks/vendor-AVsJ2ni0.js";
6
+ import { a as V } from "./chunks/icons-DAeqv1iX.js";
7
7
  import { D as Ot, h as $t, i as zt, b as Wt, e as Jt, f as Ht, g as Gt, r as Xt, c as Yt, s as Zt } from "./chunks/icons-DAeqv1iX.js";
8
8
  import { Q as ce } from "./chunks/chart-markdown-Du4Z2iqK.js";
9
- import { f as oe } from "./chunks/providers-CgxXm6Ll.js";
10
- import { h as ts, a as ss, S as as, e as rs, d as cs, i as os, b as ns, g as ds, u as is, j as ls, c as us, w as ms } from "./chunks/providers-CgxXm6Ll.js";
9
+ import { f as ne } from "./chunks/providers-CgxXm6Ll.js";
10
+ import { h as ts, a as ss, S as rs, e as as, d as cs, i as ns, b as os, g as ds, u as is, j as ls, c as us, w as ms } from "./chunks/providers-CgxXm6Ll.js";
11
11
  import { L as hs, u as fs } from "./chunks/charts-core-DmGfleFz.js";
12
12
  import { L as bs, g as ys, c as xs, b as vs, i as Cs, p as ks, a as Ns } from "./chunks/charts-loader-CH0_S06T.js";
13
- import { E as Ss, a as As, p as Ds, q as Ts, m as Ms, l as Is, r as Es, C as Bs, D as Ls, o as Rs, B as Ps, n as Qs, w as Fs, t as _s, d as Vs, f as js, s as qs, e as Us, i as Ks, c as Os, h as $s, g as zs, u as Ws, b as Js, y as Hs, A as Gs, x as Xs, k as Ys, v as Zs, z as ea, j as ta } from "./chunks/analysis-builder-shared-D56zYeV0.js";
14
- import { u as aa } from "./chunks/chart-bubble-Bf42A1-B.js";
15
- import { c as ca, f as oa } from "./chunks/index-CApFCBF9.js";
16
- import { e as da, c as ia, l as la, h as ua, k as ma, j as pa, i as ha, m as fa, g as ga, f as ba, u as ya, u as xa, d as va, b as Ca, a as ka, v as Na } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
17
- import { c as Sa, b as Aa, f as Da, g as Ta, a as Ma, i as Ia, t as Ea } from "./chunks/funnel-utils-CyonoNeC.js";
18
- import { T as La, c as Ra, g as Pa, a as Qa, i as Fa, r as _a, s as Va, b as ja, w as qa } from "./chunks/theme-Dp3hFed1.js";
19
- import { createExplainQueryKey as Ka, useDryRunQueries as Oa, useDryRunQuery as $a, useExplainAI as za, useExplainQuery as Wa, useMultiDryRunQueries as Ja } from "./hooks.js";
20
- import { i as Ga, a as Xa } from "./chunks/flow-utils-CjQZG5qq.js";
21
- import { h as Za } from "./chunks/syntaxHighlighting-BQfjio-i.js";
13
+ import { E as Ss, a as As, p as Ds, q as Ts, m as Ms, l as Is, r as Es, C as Bs, D as Ls, o as Rs, B as Ps, n as Qs, w as Fs, t as _s, d as Vs, f as js, s as qs, e as Us, i as Ks, c as Os, h as $s, g as zs, u as Ws, b as Js, y as Hs, A as Gs, x as Xs, k as Ys, v as Zs, z as er, j as tr } from "./chunks/analysis-builder-shared-D56zYeV0.js";
14
+ import { u as rr } from "./chunks/chart-bubble-Bf42A1-B.js";
15
+ import { c as cr, f as nr } from "./chunks/index-CApFCBF9.js";
16
+ import { e as dr, c as ir, l as lr, h as ur, k as mr, j as pr, i as hr, m as fr, g as gr, f as br, u as yr, u as xr, d as vr, b as Cr, a as kr, v as Nr } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
17
+ import { c as Sr, b as Ar, f as Dr, g as Tr, a as Mr, i as Ir, t as Er } from "./chunks/funnel-utils-CyonoNeC.js";
18
+ import { T as Lr, c as Rr, g as Pr, a as Qr, i as Fr, r as _r, s as Vr, b as jr, w as qr } from "./chunks/theme-Dp3hFed1.js";
19
+ import { createExplainQueryKey as Kr, useDryRunQueries as Or, useDryRunQuery as $r, useExplainAI as zr, useExplainQuery as Wr, useMultiDryRunQueries as Jr } from "./hooks.js";
20
+ import { i as Gr, a as Xr } from "./chunks/flow-utils-CjQZG5qq.js";
21
+ import { h as Zr } from "./chunks/syntaxHighlighting-BQfjio-i.js";
22
22
  const $ = () => ({
23
23
  blocks: [],
24
24
  messages: [],
@@ -26,26 +26,26 @@ const $ = () => ({
26
26
  sessionId: null,
27
27
  inputValue: ""
28
28
  });
29
- function ne(e, t) {
29
+ function oe(e, t) {
30
30
  return {
31
31
  // Block actions
32
32
  addBlock: (s) => e((c) => ({
33
33
  blocks: [...c.blocks, s]
34
34
  })),
35
35
  removeBlock: (s) => e((c) => ({
36
- blocks: c.blocks.filter((r) => r.id !== s)
36
+ blocks: c.blocks.filter((a) => a.id !== s)
37
37
  })),
38
- moveBlock: (s, c) => e((r) => {
39
- const o = r.blocks.findIndex((i) => i.id === s);
40
- if (o === -1) return {};
41
- if (c === "up" && o === 0) return {};
42
- if (c === "down" && o === r.blocks.length - 1) return {};
43
- const n = [...r.blocks], l = c === "up" ? o - 1 : o + 1;
44
- return [n[o], n[l]] = [n[l], n[o]], { blocks: n };
38
+ moveBlock: (s, c) => e((a) => {
39
+ const n = a.blocks.findIndex((i) => i.id === s);
40
+ if (n === -1) return {};
41
+ if (c === "up" && n === 0) return {};
42
+ if (c === "down" && n === a.blocks.length - 1) return {};
43
+ const o = [...a.blocks], l = c === "up" ? n - 1 : n + 1;
44
+ return [o[n], o[l]] = [o[l], o[n]], { blocks: o };
45
45
  }),
46
- updateBlock: (s, c) => e((r) => ({
47
- blocks: r.blocks.map(
48
- (o) => o.id === s && o.type === "portlet" ? { ...o, ...c } : o
46
+ updateBlock: (s, c) => e((a) => ({
47
+ blocks: a.blocks.map(
48
+ (n) => n.id === s && n.type === "portlet" ? { ...n, ...c } : n
49
49
  )
50
50
  })),
51
51
  // Chat actions
@@ -53,30 +53,30 @@ function ne(e, t) {
53
53
  messages: [...c.messages, s]
54
54
  })),
55
55
  appendToLastAssistantMessage: (s) => e((c) => {
56
- const r = [...c.messages], o = r[r.length - 1];
57
- return o && o.role === "assistant" && (r[r.length - 1] = {
58
- ...o,
59
- content: o.content + s
60
- }), { messages: r };
56
+ const a = [...c.messages], n = a[a.length - 1];
57
+ return n && n.role === "assistant" && (a[a.length - 1] = {
58
+ ...n,
59
+ content: n.content + s
60
+ }), { messages: a };
61
61
  }),
62
62
  setLastAssistantError: (s) => e((c) => {
63
- const r = [...c.messages], o = r[r.length - 1];
64
- return o && o.role === "assistant" && (r[r.length - 1] = { ...o, error: s }), { messages: r };
63
+ const a = [...c.messages], n = a[a.length - 1];
64
+ return n && n.role === "assistant" && (a[a.length - 1] = { ...n, error: s }), { messages: a };
65
65
  }),
66
66
  addToolCallToLastAssistant: (s) => e((c) => {
67
- const r = [...c.messages], o = r[r.length - 1];
68
- return o && o.role === "assistant" && (r[r.length - 1] = {
69
- ...o,
70
- toolCalls: [...o.toolCalls || [], s]
71
- }), { messages: r };
67
+ const a = [...c.messages], n = a[a.length - 1];
68
+ return n && n.role === "assistant" && (a[a.length - 1] = {
69
+ ...n,
70
+ toolCalls: [...n.toolCalls || [], s]
71
+ }), { messages: a };
72
72
  }),
73
73
  updateLastToolCall: (s) => e((c) => {
74
- const r = [...c.messages], o = r[r.length - 1];
75
- if (o?.role === "assistant" && o.toolCalls?.length) {
76
- const n = [...o.toolCalls], l = s.id ? n.findIndex((i) => i.id === s.id) : n.length - 1;
77
- l !== -1 && (n[l] = { ...n[l], ...s }, r[r.length - 1] = { ...o, toolCalls: n });
74
+ const a = [...c.messages], n = a[a.length - 1];
75
+ if (n?.role === "assistant" && n.toolCalls?.length) {
76
+ const o = [...n.toolCalls], l = s.id ? o.findIndex((i) => i.id === s.id) : o.length - 1;
77
+ l !== -1 && (o[l] = { ...o[l], ...s }, a[a.length - 1] = { ...n, toolCalls: o });
78
78
  }
79
- return { messages: r };
79
+ return { messages: a };
80
80
  }),
81
81
  // Session/UI actions
82
82
  setIsStreaming: (s) => e({ isStreaming: s }),
@@ -101,10 +101,10 @@ function ne(e, t) {
101
101
  function de() {
102
102
  const e = $();
103
103
  return se()(
104
- ae(
105
- re((t, s) => ({
104
+ re(
105
+ ae((t, s) => ({
106
106
  ...e,
107
- ...ne(t, s)
107
+ ...oe(t, s)
108
108
  })),
109
109
  { name: "NotebookStore" }
110
110
  )
@@ -120,9 +120,9 @@ function ie({
120
120
  const c = de();
121
121
  t && c.getState().load(t), s.current = c;
122
122
  }
123
- return /* @__PURE__ */ a(z.Provider, { value: s.current, children: e });
123
+ return /* @__PURE__ */ r(z.Provider, { value: s.current, children: e });
124
124
  }
125
- function A(e) {
125
+ function S(e) {
126
126
  const t = ee(z);
127
127
  if (!t)
128
128
  throw new Error("useNotebookStore must be used within NotebookStoreProvider");
@@ -146,23 +146,23 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
146
146
  removeBlock: e.removeBlock,
147
147
  moveBlock: e.moveBlock,
148
148
  updateBlock: e.updateBlock
149
- }), V = { width: "16px", height: "16px", color: "currentColor" }, he = _("chevronUp"), fe = _("chevronDown"), ge = _("edit"), be = _("delete"), ye = R.memo(function({
149
+ }), j = { width: "16px", height: "16px", color: "currentColor" }, he = V("chevronUp"), fe = V("chevronDown"), ge = V("edit"), be = V("delete"), ye = R.memo(function({
150
150
  block: t,
151
151
  onRemove: s,
152
152
  onMoveUp: c,
153
- onMoveDown: r,
154
- onEdit: o,
155
- isFirst: n,
153
+ onMoveDown: a,
154
+ onEdit: n,
155
+ isFirst: o,
156
156
  isLast: l
157
157
  }) {
158
- const [i, f] = F(null), g = p((x) => {
159
- f(x);
158
+ const [i, g] = _(null), b = f((v) => {
159
+ g(v);
160
160
  }, []);
161
- return /* @__PURE__ */ b("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
162
- /* @__PURE__ */ b("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-3 dc:py-1.5 dc:border-b border-dc-border dc:shrink-0 bg-dc-surface-secondary dc:rounded-t-lg", children: [
163
- /* @__PURE__ */ b("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
164
- /* @__PURE__ */ a("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: t.title || "Untitled" }),
165
- i && /* @__PURE__ */ a(
161
+ return /* @__PURE__ */ y("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
162
+ /* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-3 dc:py-1.5 dc:border-b border-dc-border dc:shrink-0 bg-dc-surface-secondary dc:rounded-t-lg", children: [
163
+ /* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
164
+ /* @__PURE__ */ r("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: t.title || "Untitled" }),
165
+ i && /* @__PURE__ */ r(
166
166
  J,
167
167
  {
168
168
  chartConfig: i.chartConfig,
@@ -174,46 +174,46 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
174
174
  }
175
175
  )
176
176
  ] }),
177
- /* @__PURE__ */ b("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
178
- !n && /* @__PURE__ */ a(
177
+ /* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
178
+ !o && /* @__PURE__ */ r(
179
179
  "button",
180
180
  {
181
181
  onClick: () => c(t.id),
182
182
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
183
183
  title: "Move up",
184
- children: /* @__PURE__ */ a(he, { style: V })
184
+ children: /* @__PURE__ */ r(he, { style: j })
185
185
  }
186
186
  ),
187
- !l && /* @__PURE__ */ a(
187
+ !l && /* @__PURE__ */ r(
188
188
  "button",
189
189
  {
190
- onClick: () => r(t.id),
190
+ onClick: () => a(t.id),
191
191
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
192
192
  title: "Move down",
193
- children: /* @__PURE__ */ a(fe, { style: V })
193
+ children: /* @__PURE__ */ r(fe, { style: j })
194
194
  }
195
195
  ),
196
- /* @__PURE__ */ a(
196
+ /* @__PURE__ */ r(
197
197
  "button",
198
198
  {
199
- onClick: () => o(t),
199
+ onClick: () => n(t),
200
200
  className: "dc:p-1 dc:bg-transparent dc:border-none dc:rounded-sm text-dc-text-secondary dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
201
201
  title: "Edit visualization",
202
- children: /* @__PURE__ */ a(ge, { style: V })
202
+ children: /* @__PURE__ */ r(ge, { style: j })
203
203
  }
204
204
  ),
205
- /* @__PURE__ */ a(
205
+ /* @__PURE__ */ r(
206
206
  "button",
207
207
  {
208
208
  onClick: () => s(t.id),
209
209
  className: "dc:p-1 dc:mr-0.5 dc:bg-transparent dc:border-none dc:rounded-sm dc:cursor-pointer dc:hover:bg-dc-danger-bg text-dc-danger dc:transition-colors",
210
210
  title: "Remove",
211
- children: /* @__PURE__ */ a(be, { style: V })
211
+ children: /* @__PURE__ */ r(be, { style: j })
212
212
  }
213
213
  )
214
214
  ] })
215
215
  ] }),
216
- /* @__PURE__ */ a("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ a(
216
+ /* @__PURE__ */ r("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ r(
217
217
  H,
218
218
  {
219
219
  query: t.query,
@@ -222,7 +222,7 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
222
222
  displayConfig: t.displayConfig,
223
223
  height: 400,
224
224
  eagerLoad: !0,
225
- onDebugDataReady: g
225
+ onDebugDataReady: b
226
226
  }
227
227
  ) })
228
228
  ] });
@@ -251,13 +251,13 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
251
251
  block: t,
252
252
  onRemove: s,
253
253
  onMoveUp: c,
254
- onMoveDown: r,
255
- isFirst: o,
256
- isLast: n
254
+ onMoveDown: a,
255
+ isFirst: n,
256
+ isLast: o
257
257
  }) {
258
- return /* @__PURE__ */ b("div", { className: "dc:group dc:relative dc:mb-4", children: [
259
- /* @__PURE__ */ b("div", { className: "dc:absolute dc:right-2 dc:top-2 dc:z-10 dc:flex dc:gap-1 dc:opacity-0 dc:group-hover:opacity-100 dc:transition-opacity", children: [
260
- !o && /* @__PURE__ */ a(
258
+ return /* @__PURE__ */ y("div", { className: "dc:group dc:relative dc:mb-4", children: [
259
+ /* @__PURE__ */ y("div", { className: "dc:absolute dc:right-2 dc:top-2 dc:z-10 dc:flex dc:gap-1 dc:opacity-0 dc:group-hover:opacity-100 dc:transition-opacity", children: [
260
+ !n && /* @__PURE__ */ r(
261
261
  "button",
262
262
  {
263
263
  onClick: () => c(t.id),
@@ -266,16 +266,16 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
266
266
  children: "▲"
267
267
  }
268
268
  ),
269
- !n && /* @__PURE__ */ a(
269
+ !o && /* @__PURE__ */ r(
270
270
  "button",
271
271
  {
272
- onClick: () => r(t.id),
272
+ onClick: () => a(t.id),
273
273
  className: "dc:p-1 dc:rounded dc:text-xs bg-dc-surface text-dc-text-secondary dc:hover:opacity-80 border-dc-border dc:border",
274
274
  title: "Move down",
275
275
  children: "▼"
276
276
  }
277
277
  ),
278
- /* @__PURE__ */ a(
278
+ /* @__PURE__ */ r(
279
279
  "button",
280
280
  {
281
281
  onClick: () => s(t.id),
@@ -285,74 +285,74 @@ const le = (e) => e.blocks, je = (e) => e.messages, qe = (e) => e.isStreaming, U
285
285
  }
286
286
  )
287
287
  ] }),
288
- t.title && /* @__PURE__ */ a("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2 dc:px-1", children: t.title }),
289
- /* @__PURE__ */ a("div", { className: "dc:rounded-lg dc:p-4 bg-dc-surface border-dc-border dc:border", children: /* @__PURE__ */ a(ce, { options: xe, children: t.content }) })
288
+ t.title && /* @__PURE__ */ r("h4", { className: "dc:text-sm dc:font-semibold text-dc-text dc:mb-2 dc:px-1", children: t.title }),
289
+ /* @__PURE__ */ r("div", { className: "dc:rounded-lg dc:p-4 bg-dc-surface border-dc-border dc:border", children: /* @__PURE__ */ r(ce, { options: xe, children: t.content }) })
290
290
  ] });
291
291
  }), Ce = R.memo(function() {
292
- const t = A(le), { removeBlock: s, moveBlock: c, updateBlock: r } = A(K(pe)), o = N(null), [n, l] = F(null), i = N(t.length);
293
- Q(() => {
294
- t.length > i.current && o.current?.scrollIntoView({ behavior: "smooth" }), i.current = t.length;
292
+ const t = S(le), { removeBlock: s, moveBlock: c, updateBlock: a } = S(K(pe)), n = N(null), [o, l] = _(null), i = N(t.length);
293
+ P(() => {
294
+ t.length > i.current && n.current?.scrollIntoView({ behavior: "smooth" }), i.current = t.length;
295
295
  }, [t.length]);
296
- const f = p((d) => s(d), [s]), g = p((d) => c(d, "up"), [c]), x = p((d) => c(d, "down"), [c]), m = p((d) => l(d), []), C = p((d) => {
297
- if (!n) return;
298
- const v = G(d), { analysisConfig: k } = v;
299
- if (k) {
300
- const w = k.charts[k.analysisType];
301
- r(n.id, {
296
+ const g = f((d) => s(d), [s]), b = f((d) => c(d, "up"), [c]), v = f((d) => c(d, "down"), [c]), m = f((d) => l(d), []), A = f((d) => {
297
+ if (!o) return;
298
+ const C = G(d), { analysisConfig: x } = C;
299
+ if (x) {
300
+ const k = x.charts[x.analysisType];
301
+ a(o.id, {
302
302
  title: d.title,
303
- query: JSON.stringify(k.query),
304
- chartType: w?.chartType || "bar",
305
- chartConfig: w?.chartConfig,
306
- displayConfig: w?.displayConfig
303
+ query: JSON.stringify(x.query),
304
+ chartType: k?.chartType || "bar",
305
+ chartConfig: k?.chartConfig,
306
+ displayConfig: k?.displayConfig
307
307
  });
308
308
  }
309
309
  l(null);
310
- }, [n, r]);
311
- return t.length === 0 ? /* @__PURE__ */ a("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ b("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
312
- /* @__PURE__ */ a("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
313
- /* @__PURE__ */ a("p", { className: "dc:text-sm text-dc-text-secondary", children: "Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data." })
314
- ] }) }) : /* @__PURE__ */ b("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
315
- t.map((d, v) => {
316
- const k = v === 0, w = v === t.length - 1;
317
- return d.type === "portlet" ? /* @__PURE__ */ a(
310
+ }, [o, a]);
311
+ return t.length === 0 ? /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ y("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
312
+ /* @__PURE__ */ r("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
313
+ /* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary", children: "Ask the AI assistant a question about your data. Charts and insights will appear here as the assistant analyzes your data." })
314
+ ] }) }) : /* @__PURE__ */ y("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
315
+ t.map((d, C) => {
316
+ const x = C === 0, k = C === t.length - 1;
317
+ return d.type === "portlet" ? /* @__PURE__ */ r(
318
318
  ye,
319
319
  {
320
320
  block: d,
321
- onRemove: f,
322
- onMoveUp: g,
323
- onMoveDown: x,
321
+ onRemove: g,
322
+ onMoveUp: b,
323
+ onMoveDown: v,
324
324
  onEdit: m,
325
- isFirst: k,
326
- isLast: w
325
+ isFirst: x,
326
+ isLast: k
327
327
  },
328
328
  d.id
329
- ) : d.type === "markdown" ? /* @__PURE__ */ a(
329
+ ) : d.type === "markdown" ? /* @__PURE__ */ r(
330
330
  ve,
331
331
  {
332
332
  block: d,
333
- onRemove: f,
334
- onMoveUp: g,
335
- onMoveDown: x,
336
- isFirst: k,
337
- isLast: w
333
+ onRemove: g,
334
+ onMoveUp: b,
335
+ onMoveDown: v,
336
+ isFirst: x,
337
+ isLast: k
338
338
  },
339
339
  d.id
340
340
  ) : null;
341
341
  }),
342
- /* @__PURE__ */ a("div", { ref: o }),
343
- /* @__PURE__ */ a(
342
+ /* @__PURE__ */ r("div", { ref: n }),
343
+ /* @__PURE__ */ r(
344
344
  X,
345
345
  {
346
- isOpen: !!n,
346
+ isOpen: !!o,
347
347
  onClose: () => l(null),
348
- onSave: C,
349
- portlet: n ? {
350
- id: n.id,
351
- title: n.title,
352
- query: n.query,
353
- chartType: n.chartType,
354
- chartConfig: n.chartConfig,
355
- displayConfig: n.displayConfig,
348
+ onSave: A,
349
+ portlet: o ? {
350
+ id: o.id,
351
+ title: o.title,
352
+ query: o.query,
353
+ chartType: o.chartType,
354
+ chartConfig: o.chartConfig,
355
+ displayConfig: o.displayConfig,
356
356
  w: 5,
357
357
  h: 4,
358
358
  x: 0,
@@ -388,21 +388,21 @@ function Ne(e) {
388
388
  agentEndpoint: t,
389
389
  agentApiKey: s,
390
390
  onAddPortlet: c,
391
- onAddMarkdown: r,
392
- onTextDelta: o,
393
- onToolStart: n,
391
+ onAddMarkdown: a,
392
+ onTextDelta: n,
393
+ onToolStart: o,
394
394
  onToolResult: l,
395
395
  onTurnComplete: i,
396
- onDone: f,
397
- onError: g
398
- } = e, { cubeApi: x } = oe(), m = N(null), [C, d] = F(!1), v = p(async (w, y) => {
399
- function M(h) {
396
+ onDone: g,
397
+ onError: b
398
+ } = e, { cubeApi: v } = ne(), m = N(null), [A, d] = _(!1), C = f(async (k, D) => {
399
+ function I(h) {
400
400
  switch (h.type) {
401
401
  case "text_delta":
402
- o(h.data);
402
+ n(h.data);
403
403
  break;
404
404
  case "tool_use_start":
405
- n(h.data.id, h.data.name, h.data.input);
405
+ o(h.data.id, h.data.name, h.data.input);
406
406
  break;
407
407
  case "tool_use_result":
408
408
  l(h.data.id, h.data.name, h.data.result, h.data.isError);
@@ -414,7 +414,7 @@ function Ne(e) {
414
414
  });
415
415
  break;
416
416
  case "add_markdown":
417
- r({
417
+ a({
418
418
  ...h.data,
419
419
  type: "markdown"
420
420
  });
@@ -423,56 +423,56 @@ function Ne(e) {
423
423
  i?.();
424
424
  break;
425
425
  case "done":
426
- f(h.data.sessionId);
426
+ g(h.data.sessionId);
427
427
  break;
428
428
  case "error":
429
- g(h.data.message);
429
+ b(h.data.message);
430
430
  break;
431
431
  }
432
432
  }
433
433
  m.current && m.current.abort();
434
- const S = new AbortController();
435
- m.current = S, d(!0);
434
+ const p = new AbortController();
435
+ m.current = p, d(!0);
436
436
  try {
437
- const h = x.apiUrl || "/cubejs-api/v1", D = t || `${h}/agent/chat`, T = {
437
+ const h = v.apiUrl || "/cubejs-api/v1", T = t || `${h}/agent/chat`, M = {
438
438
  "Content-Type": "application/json",
439
- ...x.headers
439
+ ...v.headers
440
440
  };
441
- s && (T["X-Agent-Api-Key"] = s);
442
- const I = await fetch(D, {
441
+ s && (M["X-Agent-Api-Key"] = s);
442
+ const w = await fetch(T, {
443
443
  method: "POST",
444
- headers: T,
445
- credentials: x.credentials ?? "include",
444
+ headers: M,
445
+ credentials: v.credentials ?? "include",
446
446
  body: JSON.stringify({
447
- message: w,
448
- ...y ? { sessionId: y } : {}
447
+ message: k,
448
+ ...D ? { sessionId: D } : {}
449
449
  }),
450
- signal: S.signal
450
+ signal: p.signal
451
451
  });
452
- if (!I.ok) {
453
- const B = await I.json().catch(() => ({}));
454
- throw new Error(B.error || `Agent request failed: ${I.status}`);
452
+ if (!w.ok) {
453
+ const B = await w.json().catch(() => ({}));
454
+ throw new Error(B.error || `Agent request failed: ${w.status}`);
455
455
  }
456
- if (!I.body)
456
+ if (!w.body)
457
457
  throw new Error("No response body received");
458
- const j = I.body.getReader(), q = new TextDecoder();
458
+ const Q = w.body.getReader(), q = new TextDecoder();
459
459
  let E = "";
460
460
  for (; ; ) {
461
- const { done: B, value: u } = await j.read();
461
+ const { done: B, value: u } = await Q.read();
462
462
  if (B) break;
463
463
  E += q.decode(u, { stream: !0 });
464
464
  const L = E.split(`
465
465
 
466
466
  `);
467
467
  E = L.pop() || "";
468
- for (const P of L) {
469
- const U = P.trim().split(`
468
+ for (const F of L) {
469
+ const U = F.trim().split(`
470
470
  `);
471
471
  for (const O of U)
472
472
  if (O.startsWith("data: "))
473
473
  try {
474
474
  const W = JSON.parse(O.slice(6));
475
- M(W);
475
+ I(W);
476
476
  } catch {
477
477
  }
478
478
  }
@@ -484,46 +484,46 @@ function Ne(e) {
484
484
  if (u.startsWith("data: "))
485
485
  try {
486
486
  const L = JSON.parse(u.slice(6));
487
- M(L);
487
+ I(L);
488
488
  } catch {
489
489
  }
490
490
  }
491
491
  } catch (h) {
492
492
  if (h.name !== "AbortError") {
493
- const D = h instanceof Error ? h.message : "Stream failed";
494
- g(ke(D));
493
+ const T = h instanceof Error ? h.message : "Stream failed";
494
+ b(ke(T));
495
495
  }
496
496
  } finally {
497
497
  d(!1), m.current = null;
498
498
  }
499
- }, [x, t, s, c, r, o, n, l, i, f, g]), k = p(() => {
499
+ }, [v, t, s, c, a, n, o, l, i, g, b]), x = f(() => {
500
500
  m.current && (m.current.abort(), m.current = null, d(!1));
501
501
  }, []);
502
502
  return {
503
- sendMessage: v,
504
- isStreaming: C,
505
- abort: k
503
+ sendMessage: C,
504
+ isStreaming: A,
505
+ abort: x
506
506
  };
507
507
  }
508
508
  function we(e) {
509
509
  const t = [];
510
510
  let s = e, c = 0;
511
511
  for (; s; ) {
512
- const r = s.match(/^(.*?)`([^`]+)`(.*)$/);
513
- if (r) {
514
- const [, n, l, i] = r;
515
- n && t.push(/* @__PURE__ */ a("span", { children: n }, c++)), t.push(
516
- /* @__PURE__ */ a("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: l }, c++)
512
+ const a = s.match(/^(.*?)`([^`]+)`(.*)$/);
513
+ if (a) {
514
+ const [, o, l, i] = a;
515
+ o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(
516
+ /* @__PURE__ */ r("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: l }, c++)
517
517
  ), s = i;
518
518
  continue;
519
519
  }
520
- const o = s.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
521
- if (o) {
522
- const [, n, l, i] = o;
523
- n && t.push(/* @__PURE__ */ a("span", { children: n }, c++)), t.push(/* @__PURE__ */ a("strong", { className: "dc:font-semibold", children: l }, c++)), s = i;
520
+ const n = s.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
521
+ if (n) {
522
+ const [, o, l, i] = n;
523
+ o && t.push(/* @__PURE__ */ r("span", { children: o }, c++)), t.push(/* @__PURE__ */ r("strong", { className: "dc:font-semibold", children: l }, c++)), s = i;
524
524
  continue;
525
525
  }
526
- t.push(/* @__PURE__ */ a("span", { children: s }, c));
526
+ t.push(/* @__PURE__ */ r("span", { children: s }, c));
527
527
  break;
528
528
  }
529
529
  return t;
@@ -536,39 +536,39 @@ const Se = {
536
536
  add_markdown: "Adding explanation"
537
537
  };
538
538
  function Ae({ toolCall: e }) {
539
- const [t, s] = F(!1), c = Se[e.name] || e.name, r = e.status === "running";
540
- return /* @__PURE__ */ b("div", { className: "dc:my-1 dc:text-xs", children: [
541
- /* @__PURE__ */ b(
539
+ const [t, s] = _(!1), c = Se[e.name] || e.name, a = e.status === "running";
540
+ return /* @__PURE__ */ y("div", { className: "dc:my-1 dc:text-xs", children: [
541
+ /* @__PURE__ */ y(
542
542
  "button",
543
543
  {
544
544
  onClick: () => s(!t),
545
545
  className: "dc:flex dc:items-center dc:gap-1.5 text-dc-text-secondary dc:hover:opacity-80 dc:transition-opacity",
546
546
  children: [
547
- r ? /* @__PURE__ */ a("span", { className: "dc:inline-block dc:w-3 dc:h-3 dc:border-2 border-dc-accent dc:border-t-transparent dc:rounded-full dc:animate-spin" }) : /* @__PURE__ */ a("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
548
- /* @__PURE__ */ b("span", { children: [
547
+ a ? /* @__PURE__ */ r("span", { className: "dc:inline-block dc:w-3 dc:h-3 dc:border-2 border-dc-accent dc:border-t-transparent dc:rounded-full dc:animate-spin" }) : /* @__PURE__ */ r("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
548
+ /* @__PURE__ */ y("span", { children: [
549
549
  c,
550
- r ? "..." : ""
550
+ a ? "..." : ""
551
551
  ] }),
552
- !r && /* @__PURE__ */ a("span", { className: "dc:text-[10px] dc:opacity-60", children: t ? "▲" : "▼" })
552
+ !a && /* @__PURE__ */ r("span", { className: "dc:text-[10px] dc:opacity-60", children: t ? "▲" : "▼" })
553
553
  ]
554
554
  }
555
555
  ),
556
- t && e.result != null && /* @__PURE__ */ a("pre", { className: "dc:mt-1 dc:p-2 dc:rounded dc:text-[11px] dc:overflow-x-auto dc:max-h-32 dc:overflow-y-auto bg-dc-surface-secondary text-dc-text-secondary", children: typeof e.result == "string" ? e.result : JSON.stringify(e.result, null, 2) })
556
+ t && e.result != null && /* @__PURE__ */ r("pre", { className: "dc:mt-1 dc:p-2 dc:rounded dc:text-[11px] dc:overflow-x-auto dc:max-h-32 dc:overflow-y-auto bg-dc-surface-secondary text-dc-text-secondary", children: typeof e.result == "string" ? e.result : JSON.stringify(e.result, null, 2) })
557
557
  ] });
558
558
  }
559
559
  const De = R.memo(function({ message: t }) {
560
- const s = t.role === "user", c = !!t.content?.trim(), r = !!t.error, o = t.toolCalls && t.toolCalls.length > 0;
561
- return !s && !c && !r && !o ? null : /* @__PURE__ */ a("div", { className: `dc:flex dc:mb-3 ${s ? "dc:justify-end" : "dc:justify-start"}`, children: /* @__PURE__ */ b(
560
+ const s = t.role === "user", c = !!t.content?.trim(), a = !!t.error, n = t.toolCalls && t.toolCalls.length > 0;
561
+ return !s && !c && !a && !n ? null : /* @__PURE__ */ r("div", { className: `dc:flex dc:mb-3 ${s ? "dc:justify-end" : "dc:justify-start"}`, children: /* @__PURE__ */ y(
562
562
  "div",
563
563
  {
564
- className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${s ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : r && !c ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
564
+ className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${s ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : a && !c ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
565
565
  children: [
566
- c && /* @__PURE__ */ a("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: s ? t.content : we(t.content) }),
567
- r && /* @__PURE__ */ b("div", { className: `dc:flex dc:items-start dc:gap-2 ${c ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
568
- /* @__PURE__ */ a("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
569
- /* @__PURE__ */ a("span", { className: "text-dc-text-secondary", children: t.error })
566
+ c && /* @__PURE__ */ r("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: s ? t.content : we(t.content) }),
567
+ a && /* @__PURE__ */ y("div", { className: `dc:flex dc:items-start dc:gap-2 ${c ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
568
+ /* @__PURE__ */ r("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
569
+ /* @__PURE__ */ r("span", { className: "text-dc-text-secondary", children: t.error })
570
570
  ] }),
571
- o && /* @__PURE__ */ a("div", { className: c || r ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: t.toolCalls.map((n, l) => /* @__PURE__ */ a(Ae, { toolCall: n }, n.id || l)) })
571
+ n && /* @__PURE__ */ r("div", { className: c || a ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: t.toolCalls.map((o, l) => /* @__PURE__ */ r(Ae, { toolCall: o }, o.id || l)) })
572
572
  ]
573
573
  }
574
574
  ) });
@@ -576,57 +576,57 @@ const De = R.memo(function({ message: t }) {
576
576
  value: t,
577
577
  onChange: s,
578
578
  onSend: c,
579
- onStop: r,
580
- onContinue: o,
581
- isStreaming: n = !1,
579
+ onStop: a,
580
+ onContinue: n,
581
+ isStreaming: o = !1,
582
582
  showContinue: l = !1,
583
583
  disabled: i = !1,
584
- placeholder: f = "Ask about your data..."
584
+ placeholder: g = "Ask about your data..."
585
585
  }) {
586
- const g = N(null);
587
- Q(() => {
588
- const m = g.current;
586
+ const b = N(null);
587
+ P(() => {
588
+ const m = b.current;
589
589
  m && (m.style.height = "auto", m.style.height = `${Math.min(m.scrollHeight, 150)}px`);
590
590
  }, [t]);
591
- const x = p(
591
+ const v = f(
592
592
  (m) => {
593
593
  m.key === "Enter" && !m.shiftKey && (m.preventDefault(), !i && t.trim() && c());
594
594
  },
595
595
  [i, t, c]
596
596
  );
597
- return /* @__PURE__ */ b("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
598
- /* @__PURE__ */ a(
597
+ return /* @__PURE__ */ y("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
598
+ /* @__PURE__ */ r(
599
599
  "textarea",
600
600
  {
601
- ref: g,
601
+ ref: b,
602
602
  value: t,
603
603
  onChange: (m) => s(m.target.value),
604
- onKeyDown: x,
605
- placeholder: f,
604
+ onKeyDown: v,
605
+ placeholder: g,
606
606
  disabled: i,
607
607
  rows: 1,
608
608
  className: "dc:flex-1 dc:resize-none dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm bg-dc-surface-secondary text-dc-text border-dc-border dc:border dc:outline-none dc:focus:ring-1 focus:ring-dc-accent dc:disabled:opacity-50"
609
609
  }
610
610
  ),
611
- n ? /* @__PURE__ */ a(
611
+ o ? /* @__PURE__ */ r(
612
612
  "button",
613
613
  {
614
- onClick: r,
614
+ onClick: a,
615
615
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors text-dc-error border-dc-border dc:border dc:hover:opacity-80 dc:shrink-0",
616
616
  children: "Stop"
617
617
  }
618
- ) : /* @__PURE__ */ b(Y, { children: [
619
- l && !t.trim() && /* @__PURE__ */ a(
618
+ ) : /* @__PURE__ */ y(Y, { children: [
619
+ l && !t.trim() && /* @__PURE__ */ r(
620
620
  "button",
621
621
  {
622
622
  onClick: () => {
623
- o?.(), g.current?.focus();
623
+ n?.(), b.current?.focus();
624
624
  },
625
625
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors border-dc-border dc:border text-dc-text-secondary dc:hover:opacity-80 dc:shrink-0",
626
626
  children: "Continue"
627
627
  }
628
628
  ),
629
- /* @__PURE__ */ a(
629
+ /* @__PURE__ */ r(
630
630
  "button",
631
631
  {
632
632
  onClick: c,
@@ -642,80 +642,80 @@ const De = R.memo(function({ message: t }) {
642
642
  agentApiKey: s,
643
643
  onClear: c
644
644
  }) {
645
- const r = N(null), o = N(!1), { messages: n, isStreaming: l, inputValue: i } = A(K(ue)), {
646
- addMessage: f,
647
- appendToLastAssistantMessage: g,
648
- setLastAssistantError: x,
645
+ const a = N(null), n = N(!1), { messages: o, isStreaming: l, inputValue: i } = S(K(ue)), {
646
+ addMessage: g,
647
+ appendToLastAssistantMessage: b,
648
+ setLastAssistantError: v,
649
649
  addToolCallToLastAssistant: m,
650
- updateLastToolCall: C,
650
+ updateLastToolCall: A,
651
651
  setIsStreaming: d,
652
- setInputValue: v,
653
- setSessionId: k
654
- } = A(K(me)), w = A((u) => u.sessionId), y = A((u) => u.addBlock), M = A((u) => u.reset), S = p(() => {
655
- o.current && (o.current = !1, f({
652
+ setInputValue: C,
653
+ setSessionId: x
654
+ } = S(K(me)), k = S((u) => u.sessionId), D = S((u) => u.addBlock), I = S((u) => u.reset), p = f(() => {
655
+ n.current && (n.current = !1, g({
656
656
  id: `msg-${Date.now()}`,
657
657
  role: "assistant",
658
658
  content: "",
659
659
  toolCalls: [],
660
660
  timestamp: Date.now()
661
661
  }));
662
- }, [f]), h = N(n.length);
663
- Q(() => {
664
- n.length > h.current && r.current?.scrollIntoView({ behavior: "smooth" }), h.current = n.length;
665
- }, [n]);
666
- const { sendMessage: D, abort: T } = Ne({
662
+ }, [g]), h = N(o.length);
663
+ P(() => {
664
+ o.length > h.current && a.current?.scrollIntoView({ behavior: "smooth" }), h.current = o.length;
665
+ }, [o]);
666
+ const { sendMessage: T, abort: M } = Ne({
667
667
  agentEndpoint: t,
668
668
  agentApiKey: s,
669
- onTextDelta: p((u) => {
670
- S(), g(u);
671
- }, [S, g]),
672
- onToolStart: p((u, L, P) => {
673
- S(), m({ id: u, name: L, input: P, status: "running" });
674
- }, [S, m]),
675
- onToolResult: p((u, L, P, U) => {
676
- C({ id: u, status: U ? "error" : "complete", result: P });
677
- }, [C]),
678
- onAddPortlet: p((u) => {
679
- y(u);
680
- }, [y]),
681
- onAddMarkdown: p((u) => {
682
- y(u);
683
- }, [y]),
684
- onTurnComplete: p(() => {
685
- o.current = !0;
669
+ onTextDelta: f((u) => {
670
+ p(), b(u);
671
+ }, [p, b]),
672
+ onToolStart: f((u, L, F) => {
673
+ p(), m({ id: u, name: L, input: F, status: "running" });
674
+ }, [p, m]),
675
+ onToolResult: f((u, L, F, U) => {
676
+ A({ id: u, status: U ? "error" : "complete", result: F });
677
+ }, [A]),
678
+ onAddPortlet: f((u) => {
679
+ D(u);
680
+ }, [D]),
681
+ onAddMarkdown: f((u) => {
682
+ D(u);
683
+ }, [D]),
684
+ onTurnComplete: f(() => {
685
+ n.current = !0;
686
686
  }, []),
687
- onDone: p((u) => {
688
- o.current = !1, k(u), d(!1);
689
- }, [k, d]),
690
- onError: p((u) => {
691
- S(), x(u), d(!1);
692
- }, [S, x, d])
693
- }), I = p((u) => {
694
- !u || l || (o.current = !1, f({
687
+ onDone: f((u) => {
688
+ n.current = !1, x(u), d(!1);
689
+ }, [x, d]),
690
+ onError: f((u) => {
691
+ p(), v(u), d(!1);
692
+ }, [p, v, d])
693
+ }), w = f((u) => {
694
+ !u || l || (n.current = !1, g({
695
695
  id: `msg-${Date.now()}`,
696
696
  role: "user",
697
697
  content: u,
698
698
  timestamp: Date.now()
699
- }), f({
699
+ }), g({
700
700
  id: `msg-${Date.now() + 1}`,
701
701
  role: "assistant",
702
702
  content: "",
703
703
  toolCalls: [],
704
704
  timestamp: Date.now()
705
- }), v(""), d(!0), D(u, w));
706
- }, [l, f, v, d, D, w]), j = p(() => {
707
- I(i.trim());
708
- }, [i, I]), q = p(() => {
709
- T(), d(!1);
710
- }, [T, d]), E = p(() => {
711
- v("");
712
- }, [v]), B = p(() => {
713
- T(), d(!1), M(), c?.();
714
- }, [T, d, M, c]);
715
- return /* @__PURE__ */ b("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
716
- /* @__PURE__ */ b("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
717
- /* @__PURE__ */ a("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
718
- n.length > 0 && /* @__PURE__ */ a(
705
+ }), C(""), d(!0), T(u, k));
706
+ }, [l, g, C, d, T, k]), Q = f(() => {
707
+ w(i.trim());
708
+ }, [i, w]), q = f(() => {
709
+ M(), d(!1);
710
+ }, [M, d]), E = f(() => {
711
+ C("");
712
+ }, [C]), B = f(() => {
713
+ M(), d(!1), I(), c?.();
714
+ }, [M, d, I, c]);
715
+ return /* @__PURE__ */ y("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
716
+ /* @__PURE__ */ y("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
717
+ /* @__PURE__ */ r("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
718
+ o.length > 0 && /* @__PURE__ */ r(
719
719
  "button",
720
720
  {
721
721
  onClick: B,
@@ -726,32 +726,32 @@ const De = R.memo(function({ message: t }) {
726
726
  }
727
727
  )
728
728
  ] }),
729
- /* @__PURE__ */ b("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
730
- n.length === 0 ? /* @__PURE__ */ a(Ie, {}) : n.map((u) => /* @__PURE__ */ a(De, { message: u }, u.id)),
731
- /* @__PURE__ */ a("div", { ref: r })
729
+ /* @__PURE__ */ y("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
730
+ o.length === 0 ? /* @__PURE__ */ r(Ie, {}) : o.map((u) => /* @__PURE__ */ r(De, { message: u }, u.id)),
731
+ /* @__PURE__ */ r("div", { ref: a })
732
732
  ] }),
733
- /* @__PURE__ */ a(
733
+ /* @__PURE__ */ r(
734
734
  Te,
735
735
  {
736
736
  value: i,
737
- onChange: v,
738
- onSend: j,
737
+ onChange: C,
738
+ onSend: Q,
739
739
  onStop: q,
740
740
  onContinue: E,
741
741
  isStreaming: l,
742
- showContinue: !l && n.length > 0
742
+ showContinue: !l && o.length > 0
743
743
  }
744
744
  )
745
745
  ] });
746
746
  });
747
747
  function Ie() {
748
- return /* @__PURE__ */ a("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ b("div", { className: "dc:text-center dc:max-w-xs", children: [
749
- /* @__PURE__ */ a("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
750
- /* @__PURE__ */ a("p", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "Ask me about your data and I'll create visualizations and insights." }),
751
- /* @__PURE__ */ b("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
752
- /* @__PURE__ */ a("p", { children: '"Show me employee productivity trends"' }),
753
- /* @__PURE__ */ a("p", { children: '"What are the top departments by headcount?"' }),
754
- /* @__PURE__ */ a("p", { children: '"Compare revenue across product categories"' })
748
+ return /* @__PURE__ */ r("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ y("div", { className: "dc:text-center dc:max-w-xs", children: [
749
+ /* @__PURE__ */ r("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
750
+ /* @__PURE__ */ r("p", { className: "dc:text-sm text-dc-text-secondary dc:mb-4", children: "Ask me about your data and I'll create visualizations and insights." }),
751
+ /* @__PURE__ */ y("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
752
+ /* @__PURE__ */ r("p", { children: '"Show me employee productivity trends"' }),
753
+ /* @__PURE__ */ r("p", { children: '"What are the top departments by headcount?"' }),
754
+ /* @__PURE__ */ r("p", { children: '"Compare revenue across product categories"' })
755
755
  ] })
756
756
  ] }) });
757
757
  }
@@ -760,70 +760,82 @@ function Ee({
760
760
  agentApiKey: t,
761
761
  onSave: s,
762
762
  onDirtyStateChange: c,
763
- className: r
763
+ className: a
764
764
  }) {
765
- const [o, n] = F(60), l = N(null), i = N(!1), f = A((y) => y.blocks.length), g = A((y) => y.messages.length), x = A((y) => y.save), m = N({ blockCount: f, msgCount: g });
766
- Q(() => {
767
- const y = f !== m.current.blockCount || g !== m.current.msgCount;
768
- c?.(y);
769
- }, [f, g, c]);
770
- const C = N(), d = N(s);
771
- d.current = s;
772
- const v = N(f > 0 || g > 0);
773
- Q(() => {
774
- if ((f > 0 || g > 0) && (v.current = !0), !(!d.current || !v.current))
775
- return C.current && clearTimeout(C.current), C.current = setTimeout(() => {
776
- const y = x();
777
- d.current?.(y);
765
+ const [n, o] = _(60), l = N(null), i = N(!1), g = S((p) => p.blocks.length), b = S((p) => p.messages.length), v = S((p) => p.isStreaming), m = S((p) => p.save), A = N({ blockCount: g, msgCount: b });
766
+ P(() => {
767
+ const p = g !== A.current.blockCount || b !== A.current.msgCount;
768
+ c?.(p);
769
+ }, [g, b, c]);
770
+ const d = N(), C = N(!1), x = N(s);
771
+ x.current = s;
772
+ const k = N(g > 0 || b > 0);
773
+ P(() => {
774
+ if ((g > 0 || b > 0) && (k.current = !0), !(!x.current || !k.current)) {
775
+ if (v) {
776
+ C.current = !0, d.current && clearTimeout(d.current);
777
+ return;
778
+ }
779
+ return d.current && clearTimeout(d.current), d.current = setTimeout(() => {
780
+ C.current = !1;
781
+ const p = m();
782
+ x.current?.(p);
778
783
  }, 1e3), () => {
779
- C.current && clearTimeout(C.current);
784
+ d.current && clearTimeout(d.current);
780
785
  };
781
- }, [f, g, x]);
782
- const k = p(() => {
783
- d.current && (C.current && clearTimeout(C.current), d.current({ blocks: [], messages: [] }));
784
- }, []), w = p((y) => {
785
- y.preventDefault(), i.current = !0;
786
- const M = (h) => {
786
+ }
787
+ }, [g, b, v, m]), P(() => {
788
+ !v && C.current && x.current && k.current && (d.current && clearTimeout(d.current), d.current = setTimeout(() => {
789
+ C.current = !1;
790
+ const p = m();
791
+ x.current?.(p);
792
+ }, 1e3));
793
+ }, [v, m]);
794
+ const D = f(() => {
795
+ x.current && (d.current && clearTimeout(d.current), x.current({ blocks: [], messages: [] }));
796
+ }, []), I = f((p) => {
797
+ p.preventDefault(), i.current = !0;
798
+ const h = (M) => {
787
799
  if (!i.current || !l.current) return;
788
- const D = l.current.getBoundingClientRect(), T = (h.clientX - D.left) / D.width * 100;
789
- n(Math.min(Math.max(T, 30), 80));
790
- }, S = () => {
791
- i.current = !1, document.removeEventListener("mousemove", M), document.removeEventListener("mouseup", S);
800
+ const w = l.current.getBoundingClientRect(), Q = (M.clientX - w.left) / w.width * 100;
801
+ o(Math.min(Math.max(Q, 30), 80));
802
+ }, T = () => {
803
+ i.current = !1, document.removeEventListener("mousemove", h), document.removeEventListener("mouseup", T);
792
804
  };
793
- document.addEventListener("mousemove", M), document.addEventListener("mouseup", S);
805
+ document.addEventListener("mousemove", h), document.addEventListener("mouseup", T);
794
806
  }, []);
795
- return /* @__PURE__ */ b(
807
+ return /* @__PURE__ */ y(
796
808
  "div",
797
809
  {
798
810
  ref: l,
799
- className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${r || ""}`,
811
+ className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${a || ""}`,
800
812
  children: [
801
- /* @__PURE__ */ a(
813
+ /* @__PURE__ */ r(
802
814
  "div",
803
815
  {
804
816
  className: "dc:h-full dc:overflow-hidden",
805
- style: { width: `${o}%` },
806
- children: /* @__PURE__ */ a(Ce, {})
817
+ style: { width: `${n}%` },
818
+ children: /* @__PURE__ */ r(Ce, {})
807
819
  }
808
820
  ),
809
- /* @__PURE__ */ a(
821
+ /* @__PURE__ */ r(
810
822
  "div",
811
823
  {
812
824
  className: "dc:w-1 dc:h-full dc:cursor-col-resize dc:flex-shrink-0 dc:transition-colors bg-dc-border dc:hover:bg-dc-accent",
813
- onMouseDown: w
825
+ onMouseDown: I
814
826
  }
815
827
  ),
816
- /* @__PURE__ */ a(
828
+ /* @__PURE__ */ r(
817
829
  "div",
818
830
  {
819
831
  className: "dc:h-full dc:overflow-hidden",
820
- style: { width: `${100 - o}%` },
821
- children: /* @__PURE__ */ a(
832
+ style: { width: `${100 - n}%` },
833
+ children: /* @__PURE__ */ r(
822
834
  Me,
823
835
  {
824
836
  agentEndpoint: e,
825
837
  agentApiKey: t,
826
- onClear: k
838
+ onClear: D
827
839
  }
828
840
  )
829
841
  }
@@ -836,27 +848,27 @@ const Oe = R.memo(function({
836
848
  config: t,
837
849
  ...s
838
850
  }) {
839
- return /* @__PURE__ */ a(ie, { initialConfig: t, children: /* @__PURE__ */ a(Ee, { ...s }) });
851
+ return /* @__PURE__ */ r(ie, { initialConfig: t, children: /* @__PURE__ */ r(Ee, { ...s }) });
840
852
  });
841
853
  function $e() {
842
- return /* @__PURE__ */ a("div", { children: "Analytics Page - Coming in Phase 4" });
854
+ return /* @__PURE__ */ r("div", { children: "Analytics Page - Coming in Phase 4" });
843
855
  }
844
- const Be = _("segment");
856
+ const Be = V("segment");
845
857
  function ze({
846
858
  className: e = ""
847
859
  }) {
848
- return /* @__PURE__ */ a(
860
+ return /* @__PURE__ */ r(
849
861
  "div",
850
862
  {
851
863
  className: `dc:flex dc:items-center dc:justify-center bg-dc-bg-secondary ${e}`,
852
- children: /* @__PURE__ */ b("div", { className: "dc:text-center", children: [
853
- /* @__PURE__ */ a(
864
+ children: /* @__PURE__ */ y("div", { className: "dc:text-center", children: [
865
+ /* @__PURE__ */ r(
854
866
  Be,
855
867
  {
856
868
  className: "dc:w-8 dc:h-8 dc:mx-auto dc:mb-2 text-dc-text-muted dc:opacity-50"
857
869
  }
858
870
  ),
859
- /* @__PURE__ */ a("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
871
+ /* @__PURE__ */ r("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
860
872
  ] })
861
873
  }
862
874
  );
@@ -877,86 +889,86 @@ export {
877
889
  tt as DashboardStoreProvider,
878
890
  ze as DashboardThumbnailPlaceholder,
879
891
  st as DrillBreadcrumb,
880
- at as DrillMenu,
892
+ rt as DrillMenu,
881
893
  Ss as ExecutionPlanPanel,
882
894
  As as ExplainAIPanel,
883
895
  bs as LazyChart,
884
896
  hs as LoadingIndicator,
885
- rt as Modal,
897
+ at as Modal,
886
898
  ie as NotebookStoreProvider,
887
899
  X as PortletAnalysisModal,
888
900
  ct as PortletContainer,
889
- as as ScrollContainerProvider,
890
- La as THEME_PRESETS,
891
- Ra as applyTheme,
892
- Sa as buildFunnelConfigFromQueries,
893
- Aa as buildServerFunnelQuery,
894
- rs as captureThumbnail,
901
+ rs as ScrollContainerProvider,
902
+ Lr as THEME_PRESETS,
903
+ Rr as applyTheme,
904
+ Sr as buildFunnelConfigFromQueries,
905
+ Ar as buildServerFunnelQuery,
906
+ as as captureThumbnail,
895
907
  Ds as compressAndEncode,
896
908
  cs as createCubeClient,
897
- ca as createDashboardLayout,
898
- ot as createDashboardStore,
899
- nt as createDefaultConfig,
909
+ cr as createDashboardLayout,
910
+ nt as createDashboardStore,
911
+ ot as createDefaultConfig,
900
912
  dt as createDefaultFlowConfig,
901
913
  it as createDefaultFunnelConfig,
902
914
  lt as createDefaultQueryConfig,
903
915
  ut as createDefaultRetentionConfig,
904
916
  mt as createDefaultWorkspace,
905
- Ka as createExplainQueryKey,
906
- da as createFlowQueryKey,
907
- ia as createFunnelQueryKey,
917
+ Kr as createExplainQueryKey,
918
+ dr as createFlowQueryKey,
919
+ ir as createFunnelQueryKey,
908
920
  de as createNotebookStore,
909
921
  Ts as decodeAndDecompress,
910
922
  Ms as detectAsymmetricDateRanges,
911
923
  Is as detectMeasureCollisions,
912
- oa as formatChartData,
913
- Da as formatDuration,
914
- la as generateQueryLabel,
924
+ nr as formatChartData,
925
+ Dr as formatDuration,
926
+ lr as generateQueryLabel,
915
927
  Es as generateShareUrl,
916
928
  Bs as getAvailableBindingKeyDimensions,
917
929
  ys as getAvailableChartTypes,
918
- Ta as getBindingKeyField,
930
+ Tr as getBindingKeyField,
919
931
  Ls as getBindingKeyLabel,
920
932
  $t as getChartTypeIcon,
921
- ua as getCombinedFields,
922
- Ma as getCubeNameFromQuery,
933
+ ur as getCombinedFields,
934
+ Mr as getCubeNameFromQuery,
923
935
  zt as getFieldTypeIcon,
924
- _ as getIcon,
936
+ V as getIcon,
925
937
  Wt as getIconData,
926
938
  Jt as getIconRegistry,
927
939
  Ht as getIconsByCategory,
928
940
  Gt as getMeasureTypeIcon,
929
- ma as getQueryIndices,
930
- pa as getQueryLabels,
931
- Pa as getTheme,
932
- Qa as getThemeVariable,
941
+ mr as getQueryIndices,
942
+ pr as getQueryLabels,
943
+ Pr as getTheme,
944
+ Qr as getThemeVariable,
933
945
  xs as getUnavailableChartTypes,
934
946
  Rs as getValidationSummary,
935
- Za as highlightCodeBlocks,
947
+ Zr as highlightCodeBlocks,
936
948
  vs as isChartTypeAvailable,
937
- Fa as isDarkMode,
949
+ Fr as isDarkMode,
938
950
  pt as isFlowConfig,
939
951
  ht as isFunnelConfig,
940
- Ia as isFunnelData,
952
+ Ir as isFunnelData,
941
953
  Ps as isMinimumFunnelConfigValid,
942
954
  ft as isMultiQuery,
943
955
  gt as isMultiQueryConfig,
944
- ha as isMultiQueryData,
956
+ hr as isMultiQueryData,
945
957
  Qs as isMultiQueryValid,
946
958
  bt as isQueryConfig,
947
959
  yt as isRetentionConfig,
948
- Ga as isSankeyData,
949
- Xa as isServerFlowQuery,
960
+ Gr as isSankeyData,
961
+ Xr as isServerFlowQuery,
950
962
  xt as isServerFunnelQuery,
951
963
  Fs as isShareableSize,
952
964
  vt as isSingleQuery,
953
- os as isThumbnailCaptureAvailable,
965
+ ns as isThumbnailCaptureAvailable,
954
966
  Ct as isValidAnalysisConfig,
955
967
  kt as isValidAnalysisWorkspace,
956
968
  Cs as isValidChartType,
957
- fa as mergeQueryResults,
958
- ga as mergeResultsByKey,
959
- ba as mergeResultsConcat,
969
+ fr as mergeQueryResults,
970
+ gr as mergeResultsByKey,
971
+ br as mergeResultsConcat,
960
972
  Nt as migrateConfig,
961
973
  wt as migrateLegacyPortlet,
962
974
  _s as parseShareUrl,
@@ -964,7 +976,7 @@ export {
964
976
  Ns as preloadCharts,
965
977
  Xt as registerIcons,
966
978
  Yt as resetIcons,
967
- _a as resetTheme,
979
+ _r as resetTheme,
968
980
  St as selectAllActions,
969
981
  pe as selectBlockActions,
970
982
  le as selectBlocks,
@@ -993,47 +1005,47 @@ export {
993
1005
  Pt as selectThumbnailDirty,
994
1006
  zs as selectUIState,
995
1007
  Zt as setIcon,
996
- Va as setTheme,
997
- ja as setThemeVariable,
998
- Ea as transformServerFunnelResult,
1008
+ Vr as setTheme,
1009
+ jr as setThemeVariable,
1010
+ Er as transformServerFunnelResult,
999
1011
  Ne as useAgentChat,
1000
1012
  Ws as useAnalysisBuilder,
1001
1013
  Js as useAnalysisBuilderStore,
1002
- oe as useCubeApi,
1003
- ns as useCubeContext,
1014
+ ne as useCubeApi,
1015
+ os as useCubeContext,
1004
1016
  ds as useCubeFeatures,
1005
1017
  fs as useCubeFieldLabel,
1006
- ya as useCubeLoadQuery,
1018
+ yr as useCubeLoadQuery,
1007
1019
  is as useCubeMeta,
1008
1020
  ls as useCubeMetaQuery,
1009
- xa as useCubeQuery,
1021
+ xr as useCubeQuery,
1010
1022
  Qt as useDashboard,
1011
1023
  Ft as useDashboardStore,
1012
1024
  _t as useDashboardStoreApi,
1013
1025
  Vt as useDashboardStoreOptional,
1014
1026
  jt as useDrillInteraction,
1015
- Oa as useDryRunQueries,
1016
- $a as useDryRunQuery,
1027
+ Or as useDryRunQueries,
1028
+ $r as useDryRunQuery,
1017
1029
  qt as useElementVisibility,
1018
- za as useExplainAI,
1019
- Wa as useExplainQuery,
1020
- va as useFlowQuery,
1021
- Ca as useFunnelQuery,
1022
- ka as useMultiCubeLoadQuery,
1023
- Ja as useMultiDryRunQueries,
1024
- A as useNotebookStore,
1030
+ zr as useExplainAI,
1031
+ Wr as useExplainQuery,
1032
+ vr as useFlowQuery,
1033
+ Cr as useFunnelQuery,
1034
+ kr as useMultiCubeLoadQuery,
1035
+ Jr as useMultiDryRunQueries,
1036
+ S as useNotebookStore,
1025
1037
  us as useScrollContainer,
1026
1038
  Ut as useScrollDetection,
1027
- aa as useTheme,
1039
+ rr as useTheme,
1028
1040
  Hs as validateBindingKeyExists,
1029
1041
  Gs as validateBindingKeyForSteps,
1030
1042
  Xs as validateFunnelConfig,
1031
- Na as validateMergeKey,
1043
+ Nr as validateMergeKey,
1032
1044
  Ys as validateMergeKeys,
1033
1045
  Zs as validateMultiQueryConfig,
1034
- ea as validateStepQueries,
1035
- ta as validateTimeDimensionAlignment,
1046
+ er as validateStepQueries,
1047
+ tr as validateTimeDimensionAlignment,
1036
1048
  ms as warnIfScreenshotLibMissing,
1037
- qa as watchThemeChanges
1049
+ qr as watchThemeChanges
1038
1050
  };
1039
1051
  //# sourceMappingURL=index.js.map