drizzle-cube 0.4.21 → 0.4.22

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 (86) hide show
  1. package/dist/client/charts.js +12 -12
  2. package/dist/client/chunks/{RetentionCombinedChart-CLq89aOJ.js → RetentionCombinedChart-BK3NPsHP.js} +2 -2
  3. package/dist/client/chunks/{RetentionCombinedChart-CLq89aOJ.js.map → RetentionCombinedChart-BK3NPsHP.js.map} +1 -1
  4. package/dist/client/chunks/{analysis-builder-3z9fHE2F.js → analysis-builder-DVrv9Q4n.js} +9 -9
  5. package/dist/client/chunks/{analysis-builder-3z9fHE2F.js.map → analysis-builder-DVrv9Q4n.js.map} +1 -1
  6. package/dist/client/chunks/{analysis-builder-shared-Da-vlQa_.js → analysis-builder-shared-CrENEvEk.js} +6 -6
  7. package/dist/client/chunks/{analysis-builder-shared-Da-vlQa_.js.map → analysis-builder-shared-CrENEvEk.js.map} +1 -1
  8. package/dist/client/chunks/{chart-activity-grid-CPGcTSuh.js → chart-activity-grid-OG6he4YS.js} +2 -2
  9. package/dist/client/chunks/{chart-activity-grid-CPGcTSuh.js.map → chart-activity-grid-OG6he4YS.js.map} +1 -1
  10. package/dist/client/chunks/{chart-area-ByJQ7NZd.js → chart-area-TawAd2k9.js} +3 -3
  11. package/dist/client/chunks/{chart-area-ByJQ7NZd.js.map → chart-area-TawAd2k9.js.map} +1 -1
  12. package/dist/client/chunks/{chart-bar-dj14frMt.js → chart-bar-D3vtCNQG.js} +2 -2
  13. package/dist/client/chunks/{chart-bar-dj14frMt.js.map → chart-bar-D3vtCNQG.js.map} +1 -1
  14. package/dist/client/chunks/{chart-box-plot-ZatBpatq.js → chart-box-plot-BXwN2rO5.js} +2 -2
  15. package/dist/client/chunks/{chart-box-plot-ZatBpatq.js.map → chart-box-plot-BXwN2rO5.js.map} +1 -1
  16. package/dist/client/chunks/{chart-bubble-CemotLx-.js → chart-bubble-ZfNe8t5k.js} +2 -2
  17. package/dist/client/chunks/{chart-bubble-CemotLx-.js.map → chart-bubble-ZfNe8t5k.js.map} +1 -1
  18. package/dist/client/chunks/{chart-candlestick-BIR4uGGt.js → chart-candlestick-DmF3haFu.js} +2 -2
  19. package/dist/client/chunks/{chart-candlestick-BIR4uGGt.js.map → chart-candlestick-DmF3haFu.js.map} +1 -1
  20. package/dist/client/chunks/{chart-data-table-BsAjHe7o.js → chart-data-table-DJZPkArt.js} +4 -4
  21. package/dist/client/chunks/{chart-data-table-BsAjHe7o.js.map → chart-data-table-DJZPkArt.js.map} +1 -1
  22. package/dist/client/chunks/{chart-funnel-dofnhD24.js → chart-funnel-CE9x0Io9.js} +2 -2
  23. package/dist/client/chunks/{chart-funnel-dofnhD24.js.map → chart-funnel-CE9x0Io9.js.map} +1 -1
  24. package/dist/client/chunks/{chart-gauge-CKJJ8m3b.js → chart-gauge-Djs5FWxB.js} +2 -2
  25. package/dist/client/chunks/{chart-gauge-CKJJ8m3b.js.map → chart-gauge-Djs5FWxB.js.map} +1 -1
  26. package/dist/client/chunks/{chart-heat-map-BVuPUKHT.js → chart-heat-map-CqtMkdxd.js} +2 -2
  27. package/dist/client/chunks/{chart-heat-map-BVuPUKHT.js.map → chart-heat-map-CqtMkdxd.js.map} +1 -1
  28. package/dist/client/chunks/{chart-kpi-delta-DUD3f8vL.js → chart-kpi-delta-DEzA74cL.js} +4 -4
  29. package/dist/client/chunks/{chart-kpi-delta-DUD3f8vL.js.map → chart-kpi-delta-DEzA74cL.js.map} +1 -1
  30. package/dist/client/chunks/{chart-kpi-number-iJh-PzsM.js → chart-kpi-number-Bab-BZtX.js} +3 -3
  31. package/dist/client/chunks/{chart-kpi-number-iJh-PzsM.js.map → chart-kpi-number-Bab-BZtX.js.map} +1 -1
  32. package/dist/client/chunks/{chart-kpi-text-x6pV9v9Q.js → chart-kpi-text-BkTgckDJ.js} +3 -3
  33. package/dist/client/chunks/{chart-kpi-text-x6pV9v9Q.js.map → chart-kpi-text-BkTgckDJ.js.map} +1 -1
  34. package/dist/client/chunks/{chart-line-DzyZkugh.js → chart-line-DhM-Hvu0.js} +3 -3
  35. package/dist/client/chunks/{chart-line-DzyZkugh.js.map → chart-line-DhM-Hvu0.js.map} +1 -1
  36. package/dist/client/chunks/{chart-measure-profile-C2IkBG3V.js → chart-measure-profile-4vQxFm69.js} +3 -3
  37. package/dist/client/chunks/{chart-measure-profile-C2IkBG3V.js.map → chart-measure-profile-4vQxFm69.js.map} +1 -1
  38. package/dist/client/chunks/{chart-pie-akbfRfb9.js → chart-pie-B86KRcHI.js} +2 -2
  39. package/dist/client/chunks/{chart-pie-akbfRfb9.js.map → chart-pie-B86KRcHI.js.map} +1 -1
  40. package/dist/client/chunks/{chart-radar-BaN-Kjww.js → chart-radar-BhDBmJRh.js} +2 -2
  41. package/dist/client/chunks/{chart-radar-BaN-Kjww.js.map → chart-radar-BhDBmJRh.js.map} +1 -1
  42. package/dist/client/chunks/{chart-radial-bar-DpptEL3s.js → chart-radial-bar-Brugya8X.js} +2 -2
  43. package/dist/client/chunks/{chart-radial-bar-DpptEL3s.js.map → chart-radial-bar-Brugya8X.js.map} +1 -1
  44. package/dist/client/chunks/{chart-sankey-CG-3hHmX.js → chart-sankey-D2L8ympI.js} +2 -2
  45. package/dist/client/chunks/{chart-sankey-CG-3hHmX.js.map → chart-sankey-D2L8ympI.js.map} +1 -1
  46. package/dist/client/chunks/{chart-scatter-l_yTVxF3.js → chart-scatter-CAkbBDkK.js} +2 -2
  47. package/dist/client/chunks/{chart-scatter-l_yTVxF3.js.map → chart-scatter-CAkbBDkK.js.map} +1 -1
  48. package/dist/client/chunks/{chart-sunburst-KhDcKhmZ.js → chart-sunburst-DaxJ-cob.js} +2 -2
  49. package/dist/client/chunks/{chart-sunburst-KhDcKhmZ.js.map → chart-sunburst-DaxJ-cob.js.map} +1 -1
  50. package/dist/client/chunks/{chart-tree-map-CBbiaBXV.js → chart-tree-map-CrDJAvZU.js} +2 -2
  51. package/dist/client/chunks/{chart-tree-map-CBbiaBXV.js.map → chart-tree-map-CrDJAvZU.js.map} +1 -1
  52. package/dist/client/chunks/{chart-waterfall-CX3vx_lI.js → chart-waterfall-BBwSfEKT.js} +3 -3
  53. package/dist/client/chunks/{chart-waterfall-CX3vx_lI.js.map → chart-waterfall-BBwSfEKT.js.map} +1 -1
  54. package/dist/client/chunks/{charts-core-CU9u_HtL.js → charts-core-B4Rbfdcn.js} +2 -2
  55. package/dist/client/chunks/{charts-core-CU9u_HtL.js.map → charts-core-B4Rbfdcn.js.map} +1 -1
  56. package/dist/client/chunks/{charts-loader-B3tt5oKG.js → charts-loader-DbrwgvCK.js} +25 -25
  57. package/dist/client/chunks/{charts-loader-B3tt5oKG.js.map → charts-loader-DbrwgvCK.js.map} +1 -1
  58. package/dist/client/chunks/{components-CMGGxqOB.js → components-GzooQM5J.js} +9 -9
  59. package/dist/client/chunks/{components-CMGGxqOB.js.map → components-GzooQM5J.js.map} +1 -1
  60. package/dist/client/chunks/{core-D_8mkGpQ.js → core-Y9e-sNfb.js} +2 -2
  61. package/dist/client/chunks/{core-D_8mkGpQ.js.map → core-Y9e-sNfb.js.map} +1 -1
  62. package/dist/client/chunks/{icons-M7shurcH.js → icons-DFJw-2HU.js} +6 -6
  63. package/dist/client/chunks/{icons-M7shurcH.js.map → icons-DFJw-2HU.js.map} +1 -1
  64. package/dist/client/chunks/{providers-CgxXm6Ll.js → providers-CCw8Kjlc.js} +2 -2
  65. package/dist/client/chunks/{providers-CgxXm6Ll.js.map → providers-CCw8Kjlc.js.map} +1 -1
  66. package/dist/client/chunks/{syntaxHighlighting-BQfjio-i.js → syntaxHighlighting-DAMSW_A6.js} +2 -2
  67. package/dist/client/chunks/{syntaxHighlighting-BQfjio-i.js.map → syntaxHighlighting-DAMSW_A6.js.map} +1 -1
  68. package/dist/client/chunks/{useDirtyStateTracking-Cu1HSjmo.js → useDirtyStateTracking-CjhwBXRw.js} +20 -20
  69. package/dist/client/chunks/{useDirtyStateTracking-Cu1HSjmo.js.map → useDirtyStateTracking-CjhwBXRw.js.map} +1 -1
  70. package/dist/client/chunks/useExplainAI-IiW55BaQ.js +182 -0
  71. package/dist/client/chunks/useExplainAI-IiW55BaQ.js.map +1 -0
  72. package/dist/client/chunks/{vendor-AVsJ2ni0.js → vendor-B2EH3V58.js} +7 -7
  73. package/dist/client/chunks/{vendor-AVsJ2ni0.js.map → vendor-B2EH3V58.js.map} +1 -1
  74. package/dist/client/components.js +1 -1
  75. package/dist/client/hooks/useNotebookLayout.d.ts +8 -0
  76. package/dist/client/hooks.d.ts +2 -0
  77. package/dist/client/hooks.js +51 -190
  78. package/dist/client/hooks.js.map +1 -1
  79. package/dist/client/icons.js +1 -1
  80. package/dist/client/index.js +871 -742
  81. package/dist/client/index.js.map +1 -1
  82. package/dist/client/providers.js +1 -1
  83. package/dist/client/styles.css +1 -1
  84. package/dist/client/utils.js +7 -7
  85. package/dist/client-bundle-stats.html +1 -1
  86. package/package.json +1 -1
@@ -1,221 +1,222 @@
1
- import { D as xe, A as ve, e as Ce, P as ke } from "./chunks/components-CMGGxqOB.js";
2
- import { i as At, a as It, C as Mt, h as Et, g as Rt, b as Bt, j as Lt, f as Pt, d as Qt, M as Ft, c as _t, n as Vt, T as jt, R as Ut, Q as $t, O as qt, S as Ot, V as Kt, I as zt, H as Wt, K as Jt, W as Xt, G as Yt, J as Gt, X as Ht, L as Zt, N as es, U as ts, Y as ss, Z as rs, z as cs, q as as, x as ns, t as os, s as ds, w as is, p as ls, v as us, o as ms, r as hs, y as ps, u as fs, k as gs, l as bs, m as ys, F as xs, E as vs, B as Cs } from "./chunks/components-CMGGxqOB.js";
3
- import { jsx as t, jsxs as m, Fragment as ne } from "react/jsx-runtime";
4
- import q, { useRef as v, createContext as Ne, useContext as we, useState as V, useCallback as p, useEffect as j } from "react";
5
- import { c as Se, d as Te, e as De, s as Ae, f as Y } from "./chunks/vendor-AVsJ2ni0.js";
6
- import { a as B } from "./chunks/icons-M7shurcH.js";
7
- import { D as Ns, h as ws, i as Ss, b as Ts, e as Ds, f as As, g as Is, r as Ms, c as Es, s as Rs } from "./chunks/icons-M7shurcH.js";
8
- import { Q as Ie } from "./chunks/chart-markdown-Du4Z2iqK.js";
9
- import { f as Me } from "./chunks/providers-CgxXm6Ll.js";
10
- import { h as Ls, a as Ps, S as Qs, e as Fs, d as _s, i as Vs, b as js, g as Us, u as $s, j as qs, c as Os, w as Ks } from "./chunks/providers-CgxXm6Ll.js";
11
- import { L as oe } from "./chunks/charts-core-CU9u_HtL.js";
12
- import { u as Ws } from "./chunks/charts-core-CU9u_HtL.js";
13
- import { L as Xs, g as Ys, c as Gs, b as Hs, i as Zs, p as er, a as tr } from "./chunks/charts-loader-B3tt5oKG.js";
14
- import { E as rr, a as cr, p as ar, q as nr, m as or, l as dr, r as ir, C as lr, D as ur, o as mr, B as hr, n as pr, w as fr, t as gr, d as br, f as yr, s as xr, e as vr, i as Cr, c as kr, h as Nr, g as wr, u as Sr, b as Tr, y as Dr, A as Ar, x as Ir, k as Mr, v as Er, z as Rr, j as Br } from "./chunks/analysis-builder-shared-Da-vlQa_.js";
15
- import { u as Pr } from "./chunks/chart-bubble-CemotLx-.js";
16
- import { c as Fr, f as _r } from "./chunks/index-CApFCBF9.js";
17
- import { e as jr, c as Ur, l as $r, h as qr, k as Or, j as Kr, i as zr, m as Wr, g as Jr, f as Xr, u as Yr, u as Gr, d as Hr, b as Zr, a as ec, v as tc } from "./chunks/useDirtyStateTracking-Cu1HSjmo.js";
18
- import { c as rc, b as cc, f as ac, g as nc, a as oc, i as dc, t as ic } from "./chunks/funnel-utils-CyonoNeC.js";
19
- import { T as uc, c as mc, g as hc, a as pc, i as fc, r as gc, s as bc, b as yc, w as xc } from "./chunks/theme-Dp3hFed1.js";
20
- import { createExplainQueryKey as Cc, useDryRunQueries as kc, useDryRunQuery as Nc, useExplainAI as wc, useExplainQuery as Sc, useMultiDryRunQueries as Tc } from "./hooks.js";
21
- import { i as Ac, a as Ic } from "./chunks/flow-utils-CjQZG5qq.js";
22
- import { h as Ec } from "./chunks/syntaxHighlighting-BQfjio-i.js";
23
- const de = () => ({
1
+ import { D as ve, A as Ce, e as we, P as Ne } from "./chunks/components-GzooQM5J.js";
2
+ import { i as Lt, a as Pt, C as Qt, h as Ft, g as _t, b as Vt, j as jt, f as Ut, d as Ot, M as $t, c as qt, n as Kt, T as zt, R as Wt, Q as Jt, O as Xt, S as Yt, V as Gt, I as Ht, H as Zt, K as es, W as ts, G as ss, J as cs, X as rs, L as ns, N as as, U as os, Y as ds, Z as ls, z as is, q as us, x as ms, t as hs, s as fs, w as ps, p as gs, v as bs, o as xs, r as ys, y as vs, u as Cs, k as ws, l as Ns, m as ks, F as Ss, E as Ts, B as Ds } from "./chunks/components-GzooQM5J.js";
3
+ import { jsx as e, jsxs as u, Fragment as ne } from "react/jsx-runtime";
4
+ import Y, { useRef as g, createContext as ke, useContext as Se, useState as j, useCallback as f, useEffect as V } from "react";
5
+ import { e as Te, f as De, h as Ae, s as Ie, i as de } from "./chunks/vendor-B2EH3V58.js";
6
+ import { a as B, b as Me } from "./chunks/icons-DFJw-2HU.js";
7
+ import { D as Is, i as Ms, c as Es, f as Rs, h as Bs, g as Ls, r as Ps, e as Qs, s as Fs } from "./chunks/icons-DFJw-2HU.js";
8
+ import { Q as Ee } from "./chunks/chart-markdown-Du4Z2iqK.js";
9
+ import { f as Re } from "./chunks/providers-CCw8Kjlc.js";
10
+ import { h as Vs, a as js, S as Us, e as Os, d as $s, i as qs, b as Ks, g as zs, u as Ws, j as Js, c as Xs, w as Ys } from "./chunks/providers-CCw8Kjlc.js";
11
+ import { L as me } from "./chunks/charts-core-B4Rbfdcn.js";
12
+ import { u as Hs } from "./chunks/charts-core-B4Rbfdcn.js";
13
+ import { useNotebookLayout as Be } from "./hooks.js";
14
+ import { L as ec, g as tc, c as sc, b as cc, i as rc, p as nc, a as ac } from "./chunks/charts-loader-DbrwgvCK.js";
15
+ import { E as dc, a as lc, p as ic, q as uc, m as mc, l as hc, r as fc, C as pc, D as gc, o as bc, B as xc, n as yc, w as vc, t as Cc, d as wc, f as Nc, s as kc, e as Sc, i as Tc, c as Dc, h as Ac, g as Ic, u as Mc, b as Ec, y as Rc, A as Bc, x as Lc, k as Pc, v as Qc, z as Fc, j as _c } from "./chunks/analysis-builder-shared-CrENEvEk.js";
16
+ import { u as jc } from "./chunks/chart-bubble-ZfNe8t5k.js";
17
+ import { c as Oc, f as $c } from "./chunks/index-CApFCBF9.js";
18
+ import { f as Kc, d as zc, n as Wc, j as Jc, l as Xc, k as Yc, i as Gc, m as Hc, h as Zc, g as er, u as tr, u as sr, e as cr, b as rr, a as nr, v as ar } from "./chunks/useDirtyStateTracking-CjhwBXRw.js";
19
+ import { c as dr, b as lr, f as ir, g as ur, a as mr, i as hr, t as fr } from "./chunks/funnel-utils-CyonoNeC.js";
20
+ import { T as gr, c as br, g as xr, a as yr, i as vr, r as Cr, s as wr, b as Nr, w as kr } from "./chunks/theme-Dp3hFed1.js";
21
+ import { d as Tr, b as Dr, u as Ar, e as Ir, c as Mr, a as Er } from "./chunks/useExplainAI-IiW55BaQ.js";
22
+ import { i as Br, a as Lr } from "./chunks/flow-utils-CjQZG5qq.js";
23
+ import { h as Qr } from "./chunks/syntaxHighlighting-DAMSW_A6.js";
24
+ const he = () => ({
24
25
  blocks: [],
25
26
  messages: [],
26
27
  isStreaming: !1,
27
28
  sessionId: null,
28
29
  inputValue: ""
29
30
  });
30
- function Ee(e, s) {
31
+ function Le(t, s) {
31
32
  return {
32
33
  // Block actions
33
- addBlock: (r) => e((n) => ({
34
- blocks: [...n.blocks, r]
34
+ addBlock: (c) => t((a) => ({
35
+ blocks: [...a.blocks, c]
35
36
  })),
36
- removeBlock: (r) => e((n) => ({
37
- blocks: n.blocks.filter((a) => a.id !== r)
37
+ removeBlock: (c) => t((a) => ({
38
+ blocks: a.blocks.filter((n) => n.id !== c)
38
39
  })),
39
- moveBlock: (r, n) => e((a) => {
40
- const c = a.blocks.findIndex((i) => i.id === r);
41
- if (c === -1) return {};
42
- if (n === "up" && c === 0) return {};
43
- if (n === "down" && c === a.blocks.length - 1) return {};
44
- const o = [...a.blocks], d = n === "up" ? c - 1 : c + 1;
45
- return [o[c], o[d]] = [o[d], o[c]], { blocks: o };
40
+ moveBlock: (c, a) => t((n) => {
41
+ const r = n.blocks.findIndex((d) => d.id === c);
42
+ if (r === -1) return {};
43
+ if (a === "up" && r === 0) return {};
44
+ if (a === "down" && r === n.blocks.length - 1) return {};
45
+ const o = [...n.blocks], l = a === "up" ? r - 1 : r + 1;
46
+ return [o[r], o[l]] = [o[l], o[r]], { blocks: o };
46
47
  }),
47
- updateBlock: (r, n) => e((a) => ({
48
- blocks: a.blocks.map(
49
- (c) => c.id === r && c.type === "portlet" ? { ...c, ...n } : c
48
+ updateBlock: (c, a) => t((n) => ({
49
+ blocks: n.blocks.map(
50
+ (r) => r.id === c && r.type === "portlet" ? { ...r, ...a } : r
50
51
  )
51
52
  })),
52
53
  // Chat actions
53
- addMessage: (r) => e((n) => ({
54
- messages: [...n.messages, r]
54
+ addMessage: (c) => t((a) => ({
55
+ messages: [...a.messages, c]
55
56
  })),
56
- appendToLastAssistantMessage: (r) => e((n) => {
57
- const a = [...n.messages], c = a[a.length - 1];
58
- return c && c.role === "assistant" && (a[a.length - 1] = {
59
- ...c,
60
- content: c.content + r
61
- }), { messages: a };
57
+ appendToLastAssistantMessage: (c) => t((a) => {
58
+ const n = [...a.messages], r = n[n.length - 1];
59
+ return r && r.role === "assistant" && (n[n.length - 1] = {
60
+ ...r,
61
+ content: r.content + c
62
+ }), { messages: n };
62
63
  }),
63
- setLastAssistantError: (r) => e((n) => {
64
- const a = [...n.messages], c = a[a.length - 1];
65
- return c && c.role === "assistant" && (a[a.length - 1] = { ...c, error: r }), { messages: a };
64
+ setLastAssistantError: (c) => t((a) => {
65
+ const n = [...a.messages], r = n[n.length - 1];
66
+ return r && r.role === "assistant" && (n[n.length - 1] = { ...r, error: c }), { messages: n };
66
67
  }),
67
- addToolCallToLastAssistant: (r) => e((n) => {
68
- const a = [...n.messages], c = a[a.length - 1];
69
- return c && c.role === "assistant" && (a[a.length - 1] = {
70
- ...c,
71
- toolCalls: [...c.toolCalls || [], r]
72
- }), { messages: a };
68
+ addToolCallToLastAssistant: (c) => t((a) => {
69
+ const n = [...a.messages], r = n[n.length - 1];
70
+ return r && r.role === "assistant" && (n[n.length - 1] = {
71
+ ...r,
72
+ toolCalls: [...r.toolCalls || [], c]
73
+ }), { messages: n };
73
74
  }),
74
- updateLastToolCall: (r) => e((n) => {
75
- const a = [...n.messages], c = a[a.length - 1];
76
- if (c?.role === "assistant" && c.toolCalls?.length) {
77
- const o = [...c.toolCalls], d = r.id ? o.findIndex((i) => i.id === r.id) : o.length - 1;
78
- d !== -1 && (o[d] = { ...o[d], ...r }, a[a.length - 1] = { ...c, toolCalls: o });
75
+ updateLastToolCall: (c) => t((a) => {
76
+ const n = [...a.messages], r = n[n.length - 1];
77
+ if (r?.role === "assistant" && r.toolCalls?.length) {
78
+ const o = [...r.toolCalls], l = c.id ? o.findIndex((d) => d.id === c.id) : o.length - 1;
79
+ l !== -1 && (o[l] = { ...o[l], ...c }, n[n.length - 1] = { ...r, toolCalls: o });
79
80
  }
80
- return { messages: a };
81
+ return { messages: n };
81
82
  }),
82
83
  // Session/UI actions
83
- setIsStreaming: (r) => e({ isStreaming: r }),
84
- setSessionId: (r) => e({ sessionId: r }),
85
- setInputValue: (r) => e({ inputValue: r }),
84
+ setIsStreaming: (c) => t({ isStreaming: c }),
85
+ setSessionId: (c) => t({ sessionId: c }),
86
+ setInputValue: (c) => t({ inputValue: c }),
86
87
  // Persistence
87
88
  save: () => {
88
- const r = s();
89
+ const c = s();
89
90
  return {
90
- blocks: r.blocks,
91
- messages: r.messages
91
+ blocks: c.blocks,
92
+ messages: c.messages
92
93
  };
93
94
  },
94
- load: (r) => e({
95
- blocks: r.blocks || [],
96
- messages: r.messages || []
95
+ load: (c) => t({
96
+ blocks: c.blocks || [],
97
+ messages: c.messages || []
97
98
  }),
98
99
  // Reset
99
- reset: () => e(de())
100
+ reset: () => t(he())
100
101
  };
101
102
  }
102
- function Re() {
103
- const e = de();
104
- return Te()(
105
- De(
106
- Ae((s, r) => ({
107
- ...e,
108
- ...Ee(s, r)
103
+ function Pe() {
104
+ const t = he();
105
+ return De()(
106
+ Ae(
107
+ Ie((s, c) => ({
108
+ ...t,
109
+ ...Le(s, c)
109
110
  })),
110
111
  { name: "NotebookStore" }
111
112
  )
112
113
  );
113
114
  }
114
- const ie = Ne(null);
115
- function Be({
116
- children: e,
115
+ const fe = ke(null);
116
+ function Qe({
117
+ children: t,
117
118
  initialConfig: s
118
119
  }) {
119
- const r = v(null);
120
- if (!r.current) {
121
- const n = Re();
122
- s && n.getState().load(s), r.current = n;
120
+ const c = g(null);
121
+ if (!c.current) {
122
+ const a = Pe();
123
+ s && a.getState().load(s), c.current = a;
123
124
  }
124
- return /* @__PURE__ */ t(ie.Provider, { value: r.current, children: e });
125
+ return /* @__PURE__ */ e(fe.Provider, { value: c.current, children: t });
125
126
  }
126
- function E(e) {
127
- const s = we(ie);
127
+ function P(t) {
128
+ const s = Se(fe);
128
129
  if (!s)
129
130
  throw new Error("useNotebookStore must be used within NotebookStoreProvider");
130
- return Se(s, e);
131
+ return Te(s, t);
131
132
  }
132
- const Le = (e) => e.blocks, xt = (e) => e.messages, vt = (e) => e.isStreaming, Ct = (e) => e.sessionId, kt = (e) => e.inputValue, Pe = (e) => ({
133
- messages: e.messages,
134
- isStreaming: e.isStreaming,
135
- inputValue: e.inputValue
136
- }), Qe = (e) => ({
137
- addMessage: e.addMessage,
138
- appendToLastAssistantMessage: e.appendToLastAssistantMessage,
139
- setLastAssistantError: e.setLastAssistantError,
140
- addToolCallToLastAssistant: e.addToolCallToLastAssistant,
141
- updateLastToolCall: e.updateLastToolCall,
142
- setIsStreaming: e.setIsStreaming,
143
- setInputValue: e.setInputValue,
144
- setSessionId: e.setSessionId
145
- }), Fe = (e) => ({
146
- addBlock: e.addBlock,
147
- removeBlock: e.removeBlock,
148
- moveBlock: e.moveBlock,
149
- updateBlock: e.updateBlock
150
- }), J = { width: "16px", height: "16px", color: "currentColor" }, _e = B("chevronUp"), Ve = B("chevronDown"), je = B("edit"), Ue = B("delete"), $e = q.memo(function({
133
+ const Fe = (t) => t.blocks, St = (t) => t.messages, Tt = (t) => t.isStreaming, Dt = (t) => t.sessionId, At = (t) => t.inputValue, _e = (t) => ({
134
+ messages: t.messages,
135
+ isStreaming: t.isStreaming,
136
+ inputValue: t.inputValue
137
+ }), Ve = (t) => ({
138
+ addMessage: t.addMessage,
139
+ appendToLastAssistantMessage: t.appendToLastAssistantMessage,
140
+ setLastAssistantError: t.setLastAssistantError,
141
+ addToolCallToLastAssistant: t.addToolCallToLastAssistant,
142
+ updateLastToolCall: t.updateLastToolCall,
143
+ setIsStreaming: t.setIsStreaming,
144
+ setInputValue: t.setInputValue,
145
+ setSessionId: t.setSessionId
146
+ }), je = (t) => ({
147
+ addBlock: t.addBlock,
148
+ removeBlock: t.removeBlock,
149
+ moveBlock: t.moveBlock,
150
+ updateBlock: t.updateBlock
151
+ }), ce = { width: "16px", height: "16px", color: "currentColor" }, Ue = B("chevronUp"), Oe = B("chevronDown"), $e = B("edit"), qe = B("delete"), Ke = Y.memo(function({
151
152
  block: s,
152
- onRemove: r,
153
- onMoveUp: n,
154
- onMoveDown: a,
155
- onEdit: c,
153
+ onRemove: c,
154
+ onMoveUp: a,
155
+ onMoveDown: n,
156
+ onEdit: r,
156
157
  isFirst: o,
157
- isLast: d
158
+ isLast: l
158
159
  }) {
159
- const [i, w] = V(null), N = p((A) => {
160
- w(A);
160
+ const [d, T] = j(null), w = f((A) => {
161
+ T(A);
161
162
  }, []);
162
- return /* @__PURE__ */ m("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
163
- /* @__PURE__ */ m("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: [
164
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
165
- /* @__PURE__ */ t("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: s.title || "Untitled" }),
166
- i && /* @__PURE__ */ t(
167
- xe,
163
+ return /* @__PURE__ */ u("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
164
+ /* @__PURE__ */ u("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: [
165
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
166
+ /* @__PURE__ */ e("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: s.title || "Untitled" }),
167
+ d && /* @__PURE__ */ e(
168
+ ve,
168
169
  {
169
- chartConfig: i.chartConfig,
170
- displayConfig: i.displayConfig,
171
- queryObject: i.queryObject,
172
- data: i.data,
173
- chartType: i.chartType,
174
- cacheInfo: i.cacheInfo ?? void 0
170
+ chartConfig: d.chartConfig,
171
+ displayConfig: d.displayConfig,
172
+ queryObject: d.queryObject,
173
+ data: d.data,
174
+ chartType: d.chartType,
175
+ cacheInfo: d.cacheInfo ?? void 0
175
176
  }
176
177
  )
177
178
  ] }),
178
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
179
- !o && /* @__PURE__ */ t(
179
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
180
+ !o && /* @__PURE__ */ e(
180
181
  "button",
181
182
  {
182
- onClick: () => n(s.id),
183
+ onClick: () => a(s.id),
183
184
  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",
184
185
  title: "Move up",
185
- children: /* @__PURE__ */ t(_e, { style: J })
186
+ children: /* @__PURE__ */ e(Ue, { style: ce })
186
187
  }
187
188
  ),
188
- !d && /* @__PURE__ */ t(
189
+ !l && /* @__PURE__ */ e(
189
190
  "button",
190
191
  {
191
- onClick: () => a(s.id),
192
+ onClick: () => n(s.id),
192
193
  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",
193
194
  title: "Move down",
194
- children: /* @__PURE__ */ t(Ve, { style: J })
195
+ children: /* @__PURE__ */ e(Oe, { style: ce })
195
196
  }
196
197
  ),
197
- /* @__PURE__ */ t(
198
+ /* @__PURE__ */ e(
198
199
  "button",
199
200
  {
200
- onClick: () => c(s),
201
+ onClick: () => r(s),
201
202
  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",
202
203
  title: "Edit visualization",
203
- children: /* @__PURE__ */ t(je, { style: J })
204
+ children: /* @__PURE__ */ e($e, { style: ce })
204
205
  }
205
206
  ),
206
- /* @__PURE__ */ t(
207
+ /* @__PURE__ */ e(
207
208
  "button",
208
209
  {
209
- onClick: () => r(s.id),
210
+ onClick: () => c(s.id),
210
211
  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",
211
212
  title: "Remove",
212
- children: /* @__PURE__ */ t(Ue, { style: J })
213
+ children: /* @__PURE__ */ e(qe, { style: ce })
213
214
  }
214
215
  )
215
216
  ] })
216
217
  ] }),
217
- /* @__PURE__ */ t("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ t(
218
- ve,
218
+ /* @__PURE__ */ e("div", { className: "dc:flex-1 dc:min-h-0", children: /* @__PURE__ */ e(
219
+ Ce,
219
220
  {
220
221
  query: s.query,
221
222
  chartType: s.chartType,
@@ -223,11 +224,15 @@ const Le = (e) => e.blocks, xt = (e) => e.messages, vt = (e) => e.isStreaming, C
223
224
  displayConfig: s.displayConfig,
224
225
  height: 400,
225
226
  eagerLoad: !0,
226
- onDebugDataReady: N
227
+ onDebugDataReady: w
227
228
  }
228
229
  ) })
229
230
  ] });
230
- }), X = { width: "16px", height: "16px", color: "currentColor" }, qe = B("documentText"), Oe = B("chevronUp"), Ke = B("chevronDown"), ze = B("delete"), We = {
231
+ }), re = { width: "16px", height: "16px", color: "currentColor" }, ze = B("documentText"), We = B("chevronUp"), Je = B("chevronDown"), Xe = B("delete");
232
+ function Ye({ children: t, ...s }) {
233
+ return /* @__PURE__ */ e("div", { className: "dc:overflow-x-auto dc:my-2", children: /* @__PURE__ */ e("table", { ...s, children: t }) });
234
+ }
235
+ const Ge = {
231
236
  overrides: {
232
237
  h1: { props: { className: "dc:text-lg dc:font-bold text-dc-text dc:mb-2 dc:mt-3" } },
233
238
  h2: { props: { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2 dc:mt-3" } },
@@ -242,115 +247,115 @@ const Le = (e) => e.blocks, xt = (e) => e.messages, vt = (e) => e.isStreaming, C
242
247
  li: { props: { className: "dc:text-sm text-dc-text" } },
243
248
  hr: { props: { className: "dc:my-3 border-dc-border" } },
244
249
  blockquote: { props: { className: "dc:border-l-4 border-dc-accent dc:pl-3 dc:my-2 dc:italic text-dc-text-secondary dc:text-sm" } },
245
- table: { props: { className: "dc:w-full dc:border-collapse dc:my-2 dc:text-sm" } },
250
+ table: { component: Ye, props: { className: "dc:w-full dc:border-collapse dc:text-sm" } },
246
251
  thead: { props: { className: "bg-dc-surface-secondary" } },
247
252
  th: { props: { className: "dc:px-3 dc:py-2 dc:text-left dc:font-semibold dc:text-xs text-dc-text-secondary dc:uppercase dc:tracking-wider border-dc-border dc:border-b" } },
248
253
  td: { props: { className: "dc:px-3 dc:py-2 dc:text-sm text-dc-text border-dc-border dc:border-b" } },
249
254
  tr: { props: { className: "dc:hover:opacity-80" } }
250
255
  }
251
- }, Je = q.memo(function({
256
+ }, He = Y.memo(function({
252
257
  block: s,
253
- onRemove: r,
254
- onMoveUp: n,
255
- onMoveDown: a,
256
- isFirst: c,
258
+ onRemove: c,
259
+ onMoveUp: a,
260
+ onMoveDown: n,
261
+ isFirst: r,
257
262
  isLast: o
258
263
  }) {
259
- return /* @__PURE__ */ m("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
260
- /* @__PURE__ */ m("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: [
261
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
262
- /* @__PURE__ */ t(qe, { style: X }),
263
- /* @__PURE__ */ t("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: s.title || "Markdown" })
264
+ return /* @__PURE__ */ u("div", { className: "dc:relative dc:mb-4 bg-dc-surface dc:border border-dc-border dc:rounded-lg dc:flex dc:flex-col", children: [
265
+ /* @__PURE__ */ u("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: [
266
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-2 dc:flex-1 dc:min-w-0", children: [
267
+ /* @__PURE__ */ e(ze, { style: re }),
268
+ /* @__PURE__ */ e("h3", { className: "dc:font-semibold dc:text-sm text-dc-text dc:truncate", children: s.title || "Markdown" })
264
269
  ] }),
265
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
266
- !c && /* @__PURE__ */ t(
270
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-1 dc:shrink-0 dc:ml-4 dc:-mr-2", children: [
271
+ !r && /* @__PURE__ */ e(
267
272
  "button",
268
273
  {
269
- onClick: () => n(s.id),
274
+ onClick: () => a(s.id),
270
275
  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",
271
276
  title: "Move up",
272
- children: /* @__PURE__ */ t(Oe, { style: X })
277
+ children: /* @__PURE__ */ e(We, { style: re })
273
278
  }
274
279
  ),
275
- !o && /* @__PURE__ */ t(
280
+ !o && /* @__PURE__ */ e(
276
281
  "button",
277
282
  {
278
- onClick: () => a(s.id),
283
+ onClick: () => n(s.id),
279
284
  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",
280
285
  title: "Move down",
281
- children: /* @__PURE__ */ t(Ke, { style: X })
286
+ children: /* @__PURE__ */ e(Je, { style: re })
282
287
  }
283
288
  ),
284
- /* @__PURE__ */ t(
289
+ /* @__PURE__ */ e(
285
290
  "button",
286
291
  {
287
- onClick: () => r(s.id),
292
+ onClick: () => c(s.id),
288
293
  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",
289
294
  title: "Remove",
290
- children: /* @__PURE__ */ t(ze, { style: X })
295
+ children: /* @__PURE__ */ e(Xe, { style: re })
291
296
  }
292
297
  )
293
298
  ] })
294
299
  ] }),
295
- /* @__PURE__ */ t("div", { className: "dc:p-4", children: /* @__PURE__ */ t(Ie, { options: We, children: s.content }) })
300
+ /* @__PURE__ */ e("div", { className: "dc:p-4 dc:min-w-0 dc:overflow-hidden", children: /* @__PURE__ */ e(Ee, { options: Ge, children: s.content }) })
296
301
  ] });
297
- }), Xe = q.memo(function() {
298
- const s = E(Le), { removeBlock: r, moveBlock: n, updateBlock: a } = E(Y(Fe)), c = v(null), [o, d] = V(null), i = v(s.length);
299
- j(() => {
300
- s.length > i.current && c.current?.scrollIntoView({ behavior: "smooth" }), i.current = s.length;
302
+ }), ue = Y.memo(function() {
303
+ const s = P(Fe), { removeBlock: c, moveBlock: a, updateBlock: n } = P(de(je)), r = g(null), [o, l] = j(null), d = g(s.length);
304
+ V(() => {
305
+ s.length > d.current && r.current?.scrollIntoView({ behavior: "smooth" }), d.current = s.length;
301
306
  }, [s.length]);
302
- const w = p((h) => r(h), [r]), N = p((h) => n(h, "up"), [n]), A = p((h) => n(h, "down"), [n]), x = p((h) => d(h), []), I = p((h) => {
307
+ const T = f((p) => c(p), [c]), w = f((p) => a(p, "up"), [a]), A = f((p) => a(p, "down"), [a]), v = f((p) => l(p), []), I = f((p) => {
303
308
  if (!o) return;
304
- const S = Ce(h), { analysisConfig: C } = S;
305
- if (C) {
306
- const k = C.charts[C.analysisType];
307
- a(o.id, {
308
- title: h.title,
309
- query: JSON.stringify(C.query),
310
- chartType: k?.chartType || "bar",
311
- chartConfig: k?.chartConfig,
312
- displayConfig: k?.displayConfig
309
+ const D = we(p), { analysisConfig: k } = D;
310
+ if (k) {
311
+ const b = k.charts[k.analysisType];
312
+ n(o.id, {
313
+ title: p.title,
314
+ query: JSON.stringify(k.query),
315
+ chartType: b?.chartType || "bar",
316
+ chartConfig: b?.chartConfig,
317
+ displayConfig: b?.displayConfig
313
318
  });
314
319
  }
315
- d(null);
316
- }, [o, a]);
317
- return s.length === 0 ? /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ m("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
318
- /* @__PURE__ */ t("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
319
- /* @__PURE__ */ t("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." })
320
- ] }) }) : /* @__PURE__ */ m("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
321
- s.map((h, S) => {
322
- const C = S === 0, k = S === s.length - 1;
323
- return h.type === "portlet" ? /* @__PURE__ */ t(
324
- $e,
320
+ l(null);
321
+ }, [o, n]);
322
+ return s.length === 0 ? /* @__PURE__ */ e("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ u("div", { className: "dc:text-center dc:max-w-sm dc:px-6", children: [
323
+ /* @__PURE__ */ e("h3", { className: "dc:text-base dc:font-semibold text-dc-text dc:mb-2", children: "Your notebook is empty" }),
324
+ /* @__PURE__ */ e("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." })
325
+ ] }) }) : /* @__PURE__ */ u("div", { className: "dc:h-full dc:overflow-y-auto dc:p-4", children: [
326
+ s.map((p, D) => {
327
+ const k = D === 0, b = D === s.length - 1;
328
+ return p.type === "portlet" ? /* @__PURE__ */ e(
329
+ Ke,
325
330
  {
326
- block: h,
327
- onRemove: w,
328
- onMoveUp: N,
331
+ block: p,
332
+ onRemove: T,
333
+ onMoveUp: w,
329
334
  onMoveDown: A,
330
- onEdit: x,
331
- isFirst: C,
332
- isLast: k
335
+ onEdit: v,
336
+ isFirst: k,
337
+ isLast: b
333
338
  },
334
- h.id
335
- ) : h.type === "markdown" ? /* @__PURE__ */ t(
336
- Je,
339
+ p.id
340
+ ) : p.type === "markdown" ? /* @__PURE__ */ e(
341
+ He,
337
342
  {
338
- block: h,
339
- onRemove: w,
340
- onMoveUp: N,
343
+ block: p,
344
+ onRemove: T,
345
+ onMoveUp: w,
341
346
  onMoveDown: A,
342
- isFirst: C,
343
- isLast: k
347
+ isFirst: k,
348
+ isLast: b
344
349
  },
345
- h.id
350
+ p.id
346
351
  ) : null;
347
352
  }),
348
- /* @__PURE__ */ t("div", { ref: c }),
349
- /* @__PURE__ */ t(
350
- ke,
353
+ /* @__PURE__ */ e("div", { ref: r }),
354
+ /* @__PURE__ */ e(
355
+ Ne,
351
356
  {
352
357
  isOpen: !!o,
353
- onClose: () => d(null),
358
+ onClose: () => l(null),
354
359
  onSave: I,
355
360
  portlet: o ? {
356
361
  id: o.id,
@@ -370,421 +375,421 @@ const Le = (e) => e.blocks, xt = (e) => e.messages, vt = (e) => e.isStreaming, C
370
375
  )
371
376
  ] });
372
377
  });
373
- function Ye(e) {
374
- if (e.startsWith("{") || e.includes('"type":"error"'))
378
+ function Ze(t) {
379
+ if (t.startsWith("{") || t.includes('"type":"error"'))
375
380
  try {
376
- const s = JSON.parse(e.replace(/^Error:\s*/, "")), r = s.error?.type || s.type || "";
381
+ const s = JSON.parse(t.replace(/^Error:\s*/, "")), c = s.error?.type || s.type || "";
377
382
  return {
378
383
  overloaded_error: "The AI service is temporarily busy. Please try again in a moment.",
379
384
  rate_limit_error: "Too many requests. Please wait a moment and try again.",
380
385
  api_error: "The AI service encountered an error. Please try again.",
381
386
  authentication_error: "Authentication failed. Please check your configuration."
382
- }[r] || "The AI service encountered an error. Please try again.";
387
+ }[c] || "The AI service encountered an error. Please try again.";
383
388
  } catch {
384
389
  return "The AI service encountered an error. Please try again.";
385
390
  }
386
- if (e.startsWith("Agent request failed:")) {
387
- const s = e.match(/\d+/)?.[0];
391
+ if (t.startsWith("Agent request failed:")) {
392
+ const s = t.match(/\d+/)?.[0];
388
393
  return s === "429" ? "Too many requests. Please wait a moment and try again." : s === "503" || s === "529" ? "The AI service is temporarily busy. Please try again in a moment." : "The AI service is temporarily unavailable. Please try again.";
389
394
  }
390
- return e;
395
+ return t;
391
396
  }
392
- function Ge(e) {
393
- const { agentEndpoint: s, agentApiKey: r, agentProvider: n, agentModel: a, agentProviderEndpoint: c } = e, { cubeApi: o } = Me(), d = v(null), [i, w] = V(!1), N = v(e);
394
- N.current = e;
395
- const A = p(async (I, h, S) => {
396
- function C(l) {
397
- const g = N.current;
398
- switch (l.type) {
397
+ function et(t) {
398
+ const { agentEndpoint: s, agentApiKey: c, agentProvider: a, agentModel: n, agentProviderEndpoint: r } = t, { cubeApi: o } = Re(), l = g(null), [d, T] = j(!1), w = g(t);
399
+ w.current = t;
400
+ const A = f(async (I, p, D) => {
401
+ function k(i) {
402
+ const x = w.current;
403
+ switch (i.type) {
399
404
  case "text_delta":
400
- g.onTextDelta(l.data);
405
+ x.onTextDelta(i.data);
401
406
  break;
402
407
  case "tool_use_start":
403
- g.onToolStart(l.data.id, l.data.name, l.data.input);
408
+ x.onToolStart(i.data.id, i.data.name, i.data.input);
404
409
  break;
405
410
  case "tool_use_result":
406
- g.onToolResult(l.data.id, l.data.name, l.data.result, l.data.isError);
411
+ x.onToolResult(i.data.id, i.data.name, i.data.result, i.data.isError);
407
412
  break;
408
413
  case "add_portlet":
409
- g.onAddPortlet({
410
- ...l.data,
414
+ x.onAddPortlet({
415
+ ...i.data,
411
416
  type: "portlet"
412
417
  });
413
418
  break;
414
419
  case "add_markdown":
415
- g.onAddMarkdown({
416
- ...l.data,
420
+ x.onAddMarkdown({
421
+ ...i.data,
417
422
  type: "markdown"
418
423
  });
419
424
  break;
420
425
  case "dashboard_saved":
421
- g.onDashboardSaved?.(l.data);
426
+ x.onDashboardSaved?.(i.data);
422
427
  break;
423
428
  case "turn_complete":
424
- g.onTurnComplete?.();
429
+ x.onTurnComplete?.();
425
430
  break;
426
431
  case "done":
427
- g.onDone(l.data.sessionId, l.data.traceId);
432
+ x.onDone(i.data.sessionId, i.data.traceId);
428
433
  break;
429
434
  case "error":
430
- g.onError(l.data.message);
435
+ x.onError(i.data.message);
431
436
  break;
432
437
  }
433
438
  }
434
- d.current && d.current.abort();
435
- const k = new AbortController();
436
- d.current = k, w(!0);
439
+ l.current && l.current.abort();
440
+ const b = new AbortController();
441
+ l.current = b, T(!0);
437
442
  try {
438
- const l = o.apiUrl || "/cubejs-api/v1", g = s || `${l}/agent/chat`, b = {
443
+ const i = o.apiUrl || "/cubejs-api/v1", x = s || `${i}/agent/chat`, y = {
439
444
  "Content-Type": "application/json",
440
445
  ...o.headers
441
446
  };
442
- r && (b["X-Agent-Api-Key"] = r), n && (b["X-Agent-Provider"] = n), a && (b["X-Agent-Model"] = a), c && (b["X-Agent-Provider-Endpoint"] = c);
443
- const f = await fetch(g, {
447
+ c && (y["X-Agent-Api-Key"] = c), a && (y["X-Agent-Provider"] = a), n && (y["X-Agent-Model"] = n), r && (y["X-Agent-Provider-Endpoint"] = r);
448
+ const S = await fetch(x, {
444
449
  method: "POST",
445
- headers: b,
450
+ headers: y,
446
451
  credentials: o.credentials ?? "include",
447
452
  body: JSON.stringify({
448
453
  message: I,
449
- ...h ? { sessionId: h } : {},
450
- ...S && S.length > 0 ? { history: S } : {}
454
+ ...p ? { sessionId: p } : {},
455
+ ...D && D.length > 0 ? { history: D } : {}
451
456
  }),
452
- signal: k.signal
457
+ signal: b.signal
453
458
  });
454
- if (!f.ok) {
455
- const P = await f.json().catch(() => ({}));
456
- throw new Error(P.error || `Agent request failed: ${f.status}`);
459
+ if (!S.ok) {
460
+ const M = await S.json().catch(() => ({}));
461
+ throw new Error(M.error || `Agent request failed: ${S.status}`);
457
462
  }
458
- if (!f.body)
463
+ if (!S.body)
459
464
  throw new Error("No response body received");
460
- const L = f.body.getReader(), T = new TextDecoder();
461
- let M = "";
465
+ const W = S.body.getReader(), U = new TextDecoder();
466
+ let Q = "";
462
467
  for (; ; ) {
463
- const { done: P, value: F } = await L.read();
464
- if (P) break;
465
- M += T.decode(F, { stream: !0 });
466
- const y = M.split(`
468
+ const { done: M, value: C } = await W.read();
469
+ if (M) break;
470
+ Q += U.decode(C, { stream: !0 });
471
+ const E = Q.split(`
467
472
 
468
473
  `);
469
- M = y.pop() || "";
470
- for (const D of y) {
471
- const Q = D.trim().split(`
474
+ Q = E.pop() || "";
475
+ for (const N of E) {
476
+ const L = N.trim().split(`
472
477
  `);
473
- for (const U of Q)
474
- if (U.startsWith("data: "))
478
+ for (const q of L)
479
+ if (q.startsWith("data: "))
475
480
  try {
476
- const $ = JSON.parse(U.slice(6));
477
- C($);
481
+ const K = JSON.parse(q.slice(6));
482
+ k(K);
478
483
  } catch {
479
484
  }
480
485
  }
481
486
  }
482
- if (M.trim()) {
483
- const P = M.trim().split(`
487
+ if (Q.trim()) {
488
+ const M = Q.trim().split(`
484
489
  `);
485
- for (const F of P)
486
- if (F.startsWith("data: "))
490
+ for (const C of M)
491
+ if (C.startsWith("data: "))
487
492
  try {
488
- const y = JSON.parse(F.slice(6));
489
- C(y);
493
+ const E = JSON.parse(C.slice(6));
494
+ k(E);
490
495
  } catch {
491
496
  }
492
497
  }
493
- } catch (l) {
494
- if (l.name !== "AbortError") {
495
- const g = l instanceof Error ? l.message : "Stream failed";
496
- N.current.onError(Ye(g));
498
+ } catch (i) {
499
+ if (i.name !== "AbortError") {
500
+ const x = i instanceof Error ? i.message : "Stream failed";
501
+ w.current.onError(Ze(x));
497
502
  }
498
503
  } finally {
499
- w(!1), d.current = null;
504
+ T(!1), l.current = null;
500
505
  }
501
- }, [o, s, r, n, a, c]), x = p(() => {
502
- d.current && (d.current.abort(), d.current = null, w(!1));
506
+ }, [o, s, c, a, n, r]), v = f(() => {
507
+ l.current && (l.current.abort(), l.current = null, T(!1));
503
508
  }, []);
504
509
  return {
505
510
  sendMessage: A,
506
- isStreaming: i,
507
- abort: x
511
+ isStreaming: d,
512
+ abort: v
508
513
  };
509
514
  }
510
- function He(e) {
515
+ function tt(t) {
511
516
  const s = [];
512
- let r = e, n = 0;
513
- for (; r; ) {
514
- const a = r.match(/^(.*?)`([^`]+)`(.*)$/);
515
- if (a) {
516
- const [, o, d, i] = a;
517
- o && s.push(/* @__PURE__ */ t("span", { children: o }, n++)), s.push(
518
- /* @__PURE__ */ t("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: d }, n++)
519
- ), r = i;
517
+ let c = t, a = 0;
518
+ for (; c; ) {
519
+ const n = c.match(/^(.*?)`([^`]+)`(.*)$/);
520
+ if (n) {
521
+ const [, o, l, d] = n;
522
+ o && s.push(/* @__PURE__ */ e("span", { children: o }, a++)), s.push(
523
+ /* @__PURE__ */ e("code", { className: "dc:px-1 dc:py-0.5 dc:rounded dc:text-xs bg-dc-surface dc:font-mono", children: l }, a++)
524
+ ), c = d;
520
525
  continue;
521
526
  }
522
- const c = r.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
523
- if (c) {
524
- const [, o, d, i] = c;
525
- o && s.push(/* @__PURE__ */ t("span", { children: o }, n++)), s.push(/* @__PURE__ */ t("strong", { className: "dc:font-semibold", children: d }, n++)), r = i;
527
+ const r = c.match(/^(.*?)\*\*([^*]+)\*\*(.*)$/);
528
+ if (r) {
529
+ const [, o, l, d] = r;
530
+ o && s.push(/* @__PURE__ */ e("span", { children: o }, a++)), s.push(/* @__PURE__ */ e("strong", { className: "dc:font-semibold", children: l }, a++)), c = d;
526
531
  continue;
527
532
  }
528
- s.push(/* @__PURE__ */ t("span", { children: r }, n));
533
+ s.push(/* @__PURE__ */ e("span", { children: c }, a));
529
534
  break;
530
535
  }
531
536
  return s;
532
537
  }
533
- const Ze = {
538
+ const st = {
534
539
  discover_cubes: "Discovering cubes",
535
540
  get_cube_metadata: "Reading metadata",
536
541
  execute_query: "Executing query",
537
542
  add_portlet: "Adding visualization",
538
543
  add_markdown: "Adding explanation"
539
544
  };
540
- function et({ toolCall: e, loadingComponent: s }) {
541
- const [r, n] = V(!1), a = Ze[e.name] || e.name, c = e.status === "running";
542
- return /* @__PURE__ */ m("div", { className: "dc:my-1 dc:text-xs", children: [
543
- /* @__PURE__ */ m(
545
+ function ct({ toolCall: t, loadingComponent: s }) {
546
+ const [c, a] = j(!1), n = st[t.name] || t.name, r = t.status === "running";
547
+ return /* @__PURE__ */ u("div", { className: "dc:my-1 dc:text-xs", children: [
548
+ /* @__PURE__ */ u(
544
549
  "button",
545
550
  {
546
- onClick: () => n(!r),
551
+ onClick: () => a(!c),
547
552
  className: "dc:flex dc:items-center dc:gap-1.5 text-dc-text-secondary dc:hover:opacity-80 dc:transition-opacity",
548
553
  children: [
549
- c ? s ? /* @__PURE__ */ t("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-3 dc:w-3", children: s }) : /* @__PURE__ */ t(oe, { size: "xs" }) : /* @__PURE__ */ t("span", { className: "dc:text-xs", children: e.status === "error" ? "✗" : "✓" }),
550
- /* @__PURE__ */ m("span", { children: [
551
- a,
552
- c ? "..." : ""
554
+ r ? s ? /* @__PURE__ */ e("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-3 dc:w-3", children: s }) : /* @__PURE__ */ e(me, { size: "xs" }) : /* @__PURE__ */ e("span", { className: "dc:text-xs", children: t.status === "error" ? "✗" : "✓" }),
555
+ /* @__PURE__ */ u("span", { children: [
556
+ n,
557
+ r ? "..." : ""
553
558
  ] }),
554
- !c && /* @__PURE__ */ t("span", { className: "dc:text-[10px] dc:opacity-60", children: r ? "▲" : "▼" })
559
+ !r && /* @__PURE__ */ e("span", { className: "dc:text-[10px] dc:opacity-60", children: c ? "▲" : "▼" })
555
560
  ]
556
561
  }
557
562
  ),
558
- r && e.result != null && /* @__PURE__ */ t("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) })
563
+ c && t.result != null && /* @__PURE__ */ e("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 t.result == "string" ? t.result : JSON.stringify(t.result, null, 2) })
559
564
  ] });
560
565
  }
561
- const tt = {
566
+ const rt = {
562
567
  animation: "dc-msg-in 100ms ease-out"
563
- }, st = q.memo(function({ message: s, loadingComponent: r }) {
564
- const n = s.role === "user", a = !!s.content?.trim(), c = !!s.error, o = s.toolCalls && s.toolCalls.length > 0;
565
- return !n && !a && !c && !o ? null : /* @__PURE__ */ t(
568
+ }, nt = Y.memo(function({ message: s, loadingComponent: c }) {
569
+ const a = s.role === "user", n = !!s.content?.trim(), r = !!s.error, o = s.toolCalls && s.toolCalls.length > 0;
570
+ return !a && !n && !r && !o ? null : /* @__PURE__ */ e(
566
571
  "div",
567
572
  {
568
- className: `dc:flex dc:mb-3 ${n ? "dc:justify-end" : "dc:justify-start"}`,
569
- style: tt,
570
- children: /* @__PURE__ */ m(
573
+ className: `dc:flex dc:mb-3 ${a ? "dc:justify-end" : "dc:justify-start"}`,
574
+ style: rt,
575
+ children: /* @__PURE__ */ u(
571
576
  "div",
572
577
  {
573
- className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${n ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : c && !a ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
578
+ className: `dc:max-w-[85%] dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm ${a ? "bg-dc-accent text-dc-accent-text dc:rounded-br-sm" : r && !n ? "bg-dc-warning-bg text-dc-text dc:rounded-bl-sm" : "bg-dc-surface-secondary text-dc-text dc:rounded-bl-sm"}`,
574
579
  children: [
575
- a && /* @__PURE__ */ t("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: n ? s.content : He(s.content) }),
576
- c && /* @__PURE__ */ m("div", { className: `dc:flex dc:items-start dc:gap-2 ${a ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
577
- /* @__PURE__ */ t("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
578
- /* @__PURE__ */ t("span", { className: "text-dc-text-secondary", children: s.error })
580
+ n && /* @__PURE__ */ e("div", { className: "dc:whitespace-pre-wrap dc:break-words", children: a ? s.content : tt(s.content) }),
581
+ r && /* @__PURE__ */ u("div", { className: `dc:flex dc:items-start dc:gap-2 ${n ? "dc:mt-2 dc:pt-2 dc:border-t dc:border-current dc:border-opacity-10" : ""}`, children: [
582
+ /* @__PURE__ */ e("span", { className: "dc:text-base dc:leading-none dc:mt-0.5 text-dc-warning dc:flex-shrink-0", children: "⚠" }),
583
+ /* @__PURE__ */ e("span", { className: "text-dc-text-secondary", children: s.error })
579
584
  ] }),
580
- o && /* @__PURE__ */ t("div", { className: a || c ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: s.toolCalls.map((d, i) => /* @__PURE__ */ t(et, { toolCall: d, loadingComponent: r }, d.id || i)) })
585
+ o && /* @__PURE__ */ e("div", { className: n || r ? "dc:mt-1 dc:border-t dc:border-current dc:border-opacity-10 dc:pt-1" : "", children: s.toolCalls.map((l, d) => /* @__PURE__ */ e(ct, { toolCall: l, loadingComponent: c }, l.id || d)) })
581
586
  ]
582
587
  }
583
588
  )
584
589
  }
585
590
  );
586
- }), rt = q.memo(function({
591
+ }), at = Y.memo(function({
587
592
  value: s,
588
- onChange: r,
589
- onSend: n,
590
- onStop: a,
591
- onContinue: c,
593
+ onChange: c,
594
+ onSend: a,
595
+ onStop: n,
596
+ onContinue: r,
592
597
  isStreaming: o = !1,
593
- showContinue: d = !1,
594
- disabled: i = !1,
595
- placeholder: w = "Ask about your data..."
598
+ showContinue: l = !1,
599
+ disabled: d = !1,
600
+ placeholder: T = "Ask about your data..."
596
601
  }) {
597
- const N = v(null);
598
- j(() => {
599
- const x = N.current;
600
- x && (x.style.height = "auto", x.style.height = `${Math.min(x.scrollHeight, 150)}px`);
602
+ const w = g(null);
603
+ V(() => {
604
+ const v = w.current;
605
+ v && (v.style.height = "auto", v.style.height = `${Math.min(v.scrollHeight, 150)}px`);
601
606
  }, [s]);
602
- const A = p(
603
- (x) => {
604
- x.key === "Enter" && !x.shiftKey && (x.preventDefault(), !i && s.trim() && n());
607
+ const A = f(
608
+ (v) => {
609
+ v.key === "Enter" && !v.shiftKey && (v.preventDefault(), !d && s.trim() && a());
605
610
  },
606
- [i, s, n]
611
+ [d, s, a]
607
612
  );
608
- return /* @__PURE__ */ m("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
609
- /* @__PURE__ */ t(
613
+ return /* @__PURE__ */ u("div", { className: "dc:flex dc:gap-2 dc:items-end dc:p-3 border-dc-border dc:border-t", children: [
614
+ /* @__PURE__ */ e(
610
615
  "textarea",
611
616
  {
612
- ref: N,
617
+ ref: w,
613
618
  value: s,
614
- onChange: (x) => r(x.target.value),
619
+ onChange: (v) => c(v.target.value),
615
620
  onKeyDown: A,
616
- placeholder: w,
617
- disabled: i,
621
+ placeholder: T,
622
+ disabled: d,
618
623
  rows: 1,
619
624
  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"
620
625
  }
621
626
  ),
622
- o ? /* @__PURE__ */ t(
627
+ o ? /* @__PURE__ */ e(
623
628
  "button",
624
629
  {
625
- onClick: a,
630
+ onClick: n,
626
631
  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",
627
632
  children: "Stop"
628
633
  }
629
- ) : /* @__PURE__ */ m(ne, { children: [
630
- d && !s.trim() && /* @__PURE__ */ t(
634
+ ) : /* @__PURE__ */ u(ne, { children: [
635
+ l && !s.trim() && /* @__PURE__ */ e(
631
636
  "button",
632
637
  {
633
638
  onClick: () => {
634
- c?.(), N.current?.focus();
639
+ r?.(), w.current?.focus();
635
640
  },
636
641
  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",
637
642
  children: "Continue"
638
643
  }
639
644
  ),
640
- /* @__PURE__ */ t(
645
+ /* @__PURE__ */ e(
641
646
  "button",
642
647
  {
643
- onClick: n,
644
- disabled: i || !s.trim(),
648
+ onClick: a,
649
+ disabled: d || !s.trim(),
645
650
  className: "dc:px-4 dc:py-2 dc:rounded-lg dc:text-sm dc:font-medium dc:transition-colors bg-dc-accent text-dc-accent-text dc:hover:opacity-90 dc:disabled:opacity-40 dc:disabled:cursor-not-allowed dc:shrink-0",
646
651
  children: "Send"
647
652
  }
648
653
  )
649
654
  ] })
650
655
  ] });
651
- }), ct = B("thumbUp"), at = B("thumbDown"), nt = q.memo(function({
656
+ }), ot = B("thumbUp"), dt = B("thumbDown"), lt = Y.memo(function({
652
657
  agentEndpoint: s,
653
- agentApiKey: r,
654
- agentProvider: n,
655
- agentModel: a,
656
- agentProviderEndpoint: c,
658
+ agentApiKey: c,
659
+ agentProvider: a,
660
+ agentModel: n,
661
+ agentProviderEndpoint: r,
657
662
  onClear: o,
658
- onDashboardSaved: d,
659
- onScore: i,
660
- loadingComponent: w,
661
- initialPrompt: N
663
+ onDashboardSaved: l,
664
+ onScore: d,
665
+ loadingComponent: T,
666
+ initialPrompt: w
662
667
  }) {
663
- const A = v(null), x = v(!1), [I, h] = V(null), [S, C] = V(/* @__PURE__ */ new Set()), [k, l] = V(!1), g = v(!1), { messages: b, isStreaming: f, inputValue: L } = E(Y(Pe)), {
664
- addMessage: T,
665
- appendToLastAssistantMessage: M,
666
- setLastAssistantError: P,
667
- addToolCallToLastAssistant: F,
668
- updateLastToolCall: y,
669
- setIsStreaming: D,
670
- setInputValue: Q,
671
- setSessionId: U
672
- } = E(Y(Qe)), $ = E((u) => u.sessionId), O = E((u) => u.addBlock), G = E((u) => u.reset), le = E((u) => u.blocks.filter((R) => R.type === "portlet").length), H = v(b);
673
- H.current = b;
674
- const Z = v(f);
675
- Z.current = f;
676
- const ee = v($);
677
- ee.current = $;
678
- const K = p(() => {
679
- g.current && (g.current = !1, T({
668
+ const A = g(null), v = g(!1), [I, p] = j(null), [D, k] = j(/* @__PURE__ */ new Set()), [b, i] = j(!1), x = g(!1), { messages: y, isStreaming: S, inputValue: W } = P(de(_e)), {
669
+ addMessage: U,
670
+ appendToLastAssistantMessage: Q,
671
+ setLastAssistantError: M,
672
+ addToolCallToLastAssistant: C,
673
+ updateLastToolCall: E,
674
+ setIsStreaming: N,
675
+ setInputValue: L,
676
+ setSessionId: q
677
+ } = P(de(Ve)), K = P((m) => m.sessionId), J = P((m) => m.addBlock), H = P((m) => m.reset), R = P((m) => m.blocks.filter((_) => _.type === "portlet").length), X = g(y);
678
+ X.current = y;
679
+ const O = g(S);
680
+ O.current = S;
681
+ const G = g(K);
682
+ G.current = K;
683
+ const z = f(() => {
684
+ x.current && (x.current = !1, U({
680
685
  id: `msg-${Date.now()}`,
681
686
  role: "assistant",
682
687
  content: "",
683
688
  toolCalls: [],
684
689
  timestamp: Date.now()
685
690
  }));
686
- }, [T]), te = v(b.length);
687
- j(() => {
688
- b.length > te.current && A.current?.scrollIntoView({ behavior: "smooth" }), te.current = b.length;
689
- }, [b]), j(() => {
690
- k && A.current?.scrollIntoView({ behavior: "smooth" });
691
- }, [k]);
692
- const { sendMessage: se, abort: W } = Ge({
691
+ }, [U]), te = g(y.length);
692
+ V(() => {
693
+ y.length > te.current && A.current?.scrollIntoView({ behavior: "smooth" }), te.current = y.length;
694
+ }, [y]), V(() => {
695
+ b && A.current?.scrollIntoView({ behavior: "smooth" });
696
+ }, [b]);
697
+ const { sendMessage: Z, abort: h } = et({
693
698
  agentEndpoint: s,
694
- agentApiKey: r,
695
- agentProvider: n,
696
- agentModel: a,
697
- agentProviderEndpoint: c,
698
- onTextDelta: p((u) => {
699
- l(!1), K(), M(u);
700
- }, [K, M]),
701
- onToolStart: p((u, R, _) => {
702
- l(!1), K(), F({ id: u, name: R, input: _, status: "running" });
703
- }, [K, F]),
704
- onToolResult: p((u, R, _, ye) => {
705
- y({ id: u, status: ye ? "error" : "complete", result: _ });
706
- }, [y]),
707
- onAddPortlet: p((u) => {
708
- O(u);
709
- }, [O]),
710
- onAddMarkdown: p((u) => {
711
- O(u);
712
- }, [O]),
713
- onDashboardSaved: d,
714
- onTurnComplete: p(() => {
715
- g.current = !0, l(!0);
699
+ agentApiKey: c,
700
+ agentProvider: a,
701
+ agentModel: n,
702
+ agentProviderEndpoint: r,
703
+ onTextDelta: f((m) => {
704
+ i(!1), z(), Q(m);
705
+ }, [z, Q]),
706
+ onToolStart: f((m, _, $) => {
707
+ i(!1), z(), C({ id: m, name: _, input: $, status: "running" });
708
+ }, [z, C]),
709
+ onToolResult: f((m, _, $, ye) => {
710
+ E({ id: m, status: ye ? "error" : "complete", result: $ });
711
+ }, [E]),
712
+ onAddPortlet: f((m) => {
713
+ J(m);
714
+ }, [J]),
715
+ onAddMarkdown: f((m) => {
716
+ J(m);
717
+ }, [J]),
718
+ onDashboardSaved: l,
719
+ onTurnComplete: f(() => {
720
+ x.current = !0, i(!0);
716
721
  }, []),
717
- onDone: p((u, R) => {
718
- g.current = !1, U(u), D(!1), l(!1), R && h(R);
719
- }, [U, D]),
720
- onError: p((u) => {
721
- l(!1), K(), P(u), D(!1);
722
- }, [K, P, D])
723
- }), z = p((u) => {
724
- if (!u || Z.current) return;
725
- g.current = !1;
726
- const R = H.current.map((_) => ({
727
- role: _.role,
728
- content: _.content,
729
- ..._.toolCalls && _.toolCalls.length > 0 ? { toolCalls: _.toolCalls } : {}
722
+ onDone: f((m, _) => {
723
+ x.current = !1, q(m), N(!1), i(!1), _ && p(_);
724
+ }, [q, N]),
725
+ onError: f((m) => {
726
+ i(!1), z(), M(m), N(!1);
727
+ }, [z, M, N])
728
+ }), F = f((m) => {
729
+ if (!m || O.current) return;
730
+ x.current = !1;
731
+ const _ = X.current.map(($) => ({
732
+ role: $.role,
733
+ content: $.content,
734
+ ...$.toolCalls && $.toolCalls.length > 0 ? { toolCalls: $.toolCalls } : {}
730
735
  }));
731
- T({
736
+ U({
732
737
  id: `msg-${Date.now()}`,
733
738
  role: "user",
734
- content: u,
739
+ content: m,
735
740
  timestamp: Date.now()
736
- }), T({
741
+ }), U({
737
742
  id: `msg-${Date.now() + 1}`,
738
743
  role: "assistant",
739
744
  content: "",
740
745
  toolCalls: [],
741
746
  timestamp: Date.now()
742
- }), Q(""), D(!0), l(!0), se(u, ee.current, R);
743
- }, [T, Q, D, se]);
744
- j(() => {
745
- if (N && !x.current && b.length === 0) {
746
- x.current = !0;
747
- const u = setTimeout(() => z(N), 100);
747
+ }), L(""), N(!0), i(!0), Z(m, G.current, _);
748
+ }, [U, L, N, Z]);
749
+ V(() => {
750
+ if (w && !v.current && y.length === 0) {
751
+ v.current = !0;
752
+ const m = setTimeout(() => F(w), 100);
748
753
  return () => {
749
- clearTimeout(u), x.current = !1;
754
+ clearTimeout(m), v.current = !1;
750
755
  };
751
756
  }
752
- }, [N, b.length, z]);
753
- const re = v(L);
754
- re.current = L;
755
- const ue = p(() => {
756
- z(re.current.trim());
757
- }, [z]), me = p(() => {
758
- W(), D(!1);
759
- }, [W, D]), he = p(() => {
760
- Q("");
761
- }, [Q]), pe = p(() => {
762
- W(), D(!1), l(!1), G(), h(null), C(/* @__PURE__ */ new Set()), o?.();
763
- }, [W, D, G, o]), fe = p(() => {
764
- z(
757
+ }, [w, y.length, F]);
758
+ const ee = g(W);
759
+ ee.current = W;
760
+ const ae = f(() => {
761
+ F(ee.current.trim());
762
+ }, [F]), se = f(() => {
763
+ h(), N(!1);
764
+ }, [h, N]), oe = f(() => {
765
+ L("");
766
+ }, [L]), pe = f(() => {
767
+ h(), N(!1), i(!1), H(), p(null), k(/* @__PURE__ */ new Set()), o?.();
768
+ }, [h, N, H, o]), ge = f(() => {
769
+ F(
765
770
  "Save the current notebook as a dashboard with a professional layout, section headers, and appropriate filters."
766
771
  );
767
- }, [z]), ce = p((u) => {
768
- !I || !i || (i({ traceId: I, value: u }), C((R) => new Set(R).add(I)));
769
- }, [I, i]), ge = !!d && !f && le > 0 && b.length > 0, be = !!i && !f && I && b.length > 0 && !S.has(I), ae = I ? S.has(I) : !1;
770
- return /* @__PURE__ */ m("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
771
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
772
- /* @__PURE__ */ t("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
773
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-1", children: [
774
- ge && /* @__PURE__ */ t(
772
+ }, [F]), le = f((m) => {
773
+ !I || !d || (d({ traceId: I, value: m }), k((_) => new Set(_).add(I)));
774
+ }, [I, d]), be = !!l && !S && R > 0 && y.length > 0, xe = !!d && !S && I && y.length > 0 && !D.has(I), ie = I ? D.has(I) : !1;
775
+ return /* @__PURE__ */ u("div", { className: "dc:flex dc:flex-col dc:h-full bg-dc-surface", children: [
776
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:justify-between dc:px-4 dc:py-3 border-dc-border dc:border-b", children: [
777
+ /* @__PURE__ */ e("h3", { className: "dc:text-sm dc:font-semibold text-dc-text", children: "AI Assistant" }),
778
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-1", children: [
779
+ be && /* @__PURE__ */ e(
775
780
  "button",
776
781
  {
777
- onClick: fe,
782
+ onClick: ge,
778
783
  className: "dc:text-xs dc:px-2 dc:py-1 dc:rounded text-dc-accent dc:hover:opacity-80",
779
784
  title: "Save notebook as a dashboard",
780
785
  children: "Save as Dashboard"
781
786
  }
782
787
  ),
783
- b.length > 0 && /* @__PURE__ */ t(
788
+ y.length > 0 && /* @__PURE__ */ e(
784
789
  "button",
785
790
  {
786
791
  onClick: pe,
787
- disabled: f,
792
+ disabled: S,
788
793
  className: "dc:text-xs dc:px-2 dc:py-1 dc:rounded text-dc-text-secondary dc:hover:opacity-80 dc:disabled:opacity-40",
789
794
  title: "Clear notebook and chat",
790
795
  children: "Clear"
@@ -792,388 +797,512 @@ const tt = {
792
797
  )
793
798
  ] })
794
799
  ] }),
795
- /* @__PURE__ */ m("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
796
- b.length === 0 ? /* @__PURE__ */ t(dt, {}) : b.map((u) => /* @__PURE__ */ t(
797
- st,
800
+ /* @__PURE__ */ u("div", { className: "dc:flex-1 dc:overflow-y-auto dc:px-4 dc:py-3", children: [
801
+ y.length === 0 ? /* @__PURE__ */ e(ut, {}) : y.map((m) => /* @__PURE__ */ e(
802
+ nt,
798
803
  {
799
- message: u,
800
- loadingComponent: w
804
+ message: m,
805
+ loadingComponent: T
801
806
  },
802
- u.id
807
+ m.id
803
808
  )),
804
- k && /* @__PURE__ */ t(ot, { loadingComponent: w }),
805
- (be || ae) && /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center dc:justify-center dc:gap-3 dc:py-4 dc:mt-2", children: ae ? /* @__PURE__ */ t("span", { className: "dc:text-sm text-dc-text-secondary", children: "Thanks for your feedback!" }) : /* @__PURE__ */ m(ne, { children: [
806
- /* @__PURE__ */ t("span", { className: "dc:text-sm text-dc-text-secondary", children: "Was this helpful?" }),
807
- /* @__PURE__ */ m("div", { className: "dc:flex dc:items-center dc:gap-2", children: [
808
- /* @__PURE__ */ m(
809
+ b && /* @__PURE__ */ e(it, { loadingComponent: T }),
810
+ (xe || ie) && /* @__PURE__ */ e("div", { className: "dc:flex dc:items-center dc:justify-center dc:gap-3 dc:py-4 dc:mt-2", children: ie ? /* @__PURE__ */ e("span", { className: "dc:text-sm text-dc-text-secondary", children: "Thanks for your feedback!" }) : /* @__PURE__ */ u(ne, { children: [
811
+ /* @__PURE__ */ e("span", { className: "dc:text-sm text-dc-text-secondary", children: "Was this helpful?" }),
812
+ /* @__PURE__ */ u("div", { className: "dc:flex dc:items-center dc:gap-2", children: [
813
+ /* @__PURE__ */ u(
809
814
  "button",
810
815
  {
811
- onClick: () => ce(1),
816
+ onClick: () => le(1),
812
817
  className: "dc:flex dc:items-center dc:gap-1.5 dc:px-3 dc:py-1.5 dc:rounded-lg dc:text-sm dc:font-medium border-dc-border dc:border text-dc-success hover:bg-dc-success-bg dc:transition-colors bg-dc-surface dc:cursor-pointer",
813
818
  children: [
814
- /* @__PURE__ */ t(ct, { className: "dc:w-4 dc:h-4" }),
819
+ /* @__PURE__ */ e(ot, { className: "dc:w-4 dc:h-4" }),
815
820
  "Yes"
816
821
  ]
817
822
  }
818
823
  ),
819
- /* @__PURE__ */ m(
824
+ /* @__PURE__ */ u(
820
825
  "button",
821
826
  {
822
- onClick: () => ce(0),
827
+ onClick: () => le(0),
823
828
  className: "dc:flex dc:items-center dc:gap-1.5 dc:px-3 dc:py-1.5 dc:rounded-lg dc:text-sm dc:font-medium border-dc-border dc:border text-dc-error hover:bg-dc-danger-bg dc:transition-colors bg-dc-surface dc:cursor-pointer",
824
829
  children: [
825
- /* @__PURE__ */ t(at, { className: "dc:w-4 dc:h-4" }),
830
+ /* @__PURE__ */ e(dt, { className: "dc:w-4 dc:h-4" }),
826
831
  "No"
827
832
  ]
828
833
  }
829
834
  )
830
835
  ] })
831
836
  ] }) }),
832
- /* @__PURE__ */ t("div", { ref: A })
837
+ /* @__PURE__ */ e("div", { ref: A })
833
838
  ] }),
834
- /* @__PURE__ */ t(
835
- rt,
839
+ /* @__PURE__ */ e(
840
+ at,
836
841
  {
837
- value: L,
838
- onChange: Q,
839
- onSend: ue,
840
- onStop: me,
841
- onContinue: he,
842
- isStreaming: f,
843
- showContinue: !f && b.length > 0
842
+ value: W,
843
+ onChange: L,
844
+ onSend: ae,
845
+ onStop: se,
846
+ onContinue: oe,
847
+ isStreaming: S,
848
+ showContinue: !S && y.length > 0
844
849
  }
845
850
  )
846
851
  ] });
847
852
  });
848
- function ot({ loadingComponent: e }) {
849
- return /* @__PURE__ */ t(
853
+ function it({ loadingComponent: t }) {
854
+ return /* @__PURE__ */ e(
850
855
  "div",
851
856
  {
852
857
  className: "dc:flex dc:mb-3 dc:justify-start",
853
858
  style: { animation: "dc-msg-in 100ms ease-out" },
854
- children: /* @__PURE__ */ m("div", { className: "dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm bg-dc-surface-secondary text-dc-text-secondary dc:rounded-bl-sm dc:flex dc:items-center dc:gap-2", children: [
855
- e ? /* @__PURE__ */ t("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-4 dc:w-4", children: e }) : /* @__PURE__ */ t(oe, { size: "xs" }),
856
- /* @__PURE__ */ t("span", { children: "Thinking..." })
859
+ children: /* @__PURE__ */ u("div", { className: "dc:rounded-lg dc:px-3 dc:py-2 dc:text-sm bg-dc-surface-secondary text-dc-text-secondary dc:rounded-bl-sm dc:flex dc:items-center dc:gap-2", children: [
860
+ t ? /* @__PURE__ */ e("span", { className: "dc:inline-flex dc:items-center dc:justify-center dc:h-4 dc:w-4", children: t }) : /* @__PURE__ */ e(me, { size: "xs" }),
861
+ /* @__PURE__ */ e("span", { children: "Thinking..." })
857
862
  ] })
858
863
  }
859
864
  );
860
865
  }
861
- function dt() {
862
- return /* @__PURE__ */ t("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ m("div", { className: "dc:text-center dc:max-w-xs", children: [
863
- /* @__PURE__ */ t("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
864
- /* @__PURE__ */ t("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." }),
865
- /* @__PURE__ */ m("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
866
- /* @__PURE__ */ t("p", { children: '"Show me employee productivity trends"' }),
867
- /* @__PURE__ */ t("p", { children: '"What are the top departments by headcount?"' }),
868
- /* @__PURE__ */ t("p", { children: '"Compare revenue across product categories"' })
866
+ function ut() {
867
+ return /* @__PURE__ */ e("div", { className: "dc:flex dc:items-center dc:justify-center dc:h-full", children: /* @__PURE__ */ u("div", { className: "dc:text-center dc:max-w-xs", children: [
868
+ /* @__PURE__ */ e("div", { className: "dc:text-lg dc:font-semibold text-dc-text dc:mb-2", children: "Data Analysis Assistant" }),
869
+ /* @__PURE__ */ e("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." }),
870
+ /* @__PURE__ */ u("div", { className: "dc:space-y-2 dc:text-xs text-dc-text-muted", children: [
871
+ /* @__PURE__ */ e("p", { children: '"Show me employee productivity trends"' }),
872
+ /* @__PURE__ */ e("p", { children: '"What are the top departments by headcount?"' }),
873
+ /* @__PURE__ */ e("p", { children: '"Compare revenue across product categories"' })
869
874
  ] })
870
875
  ] }) });
871
876
  }
872
- function it({
873
- agentEndpoint: e,
877
+ function mt({
878
+ blocks: t,
879
+ pulsingBlockId: s,
880
+ nudge: c,
881
+ onExpand: a
882
+ }) {
883
+ const n = B("bookOpen"), r = B("documentText");
884
+ return /* @__PURE__ */ u(
885
+ "button",
886
+ {
887
+ type: "button",
888
+ onClick: a,
889
+ className: "dc:h-full dc:flex-shrink-0 dc:flex dc:flex-col dc:items-center dc:pt-3 dc:gap-2 bg-dc-surface border-dc-border dc:border-r dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
890
+ style: c ? { animation: "dc-strip-nudge 0.8s ease-in-out 2", width: 48 } : { width: 48 },
891
+ title: "Expand notebook",
892
+ children: [
893
+ /* @__PURE__ */ e(n, { className: "dc:w-5 dc:h-5 text-dc-text-muted" }),
894
+ /* @__PURE__ */ e(
895
+ "div",
896
+ {
897
+ className: "dc:flex dc:flex-col dc:items-center dc:gap-1.5 dc:flex-1 dc:overflow-y-auto dc:py-1",
898
+ style: { scrollbarWidth: "none" },
899
+ children: t.length === 0 ? /* @__PURE__ */ e(
900
+ "span",
901
+ {
902
+ className: "dc:text-[9px] text-dc-text-disabled dc:writing-vertical-lr dc:mt-2",
903
+ style: { writingMode: "vertical-lr" },
904
+ children: "No blocks"
905
+ }
906
+ ) : t.map((o) => {
907
+ const l = o.id === s;
908
+ let d;
909
+ return o.type === "portlet" ? d = Me(o.chartType) : d = r, /* @__PURE__ */ e(
910
+ "div",
911
+ {
912
+ className: "dc:w-6 dc:h-6 dc:flex dc:items-center dc:justify-center dc:rounded",
913
+ style: l ? { animation: "dc-icon-pulse 0.6s ease-in-out 3" } : void 0,
914
+ title: o.type === "portlet" ? o.title : o.title || "Markdown",
915
+ children: /* @__PURE__ */ e(d, { className: "dc:w-4 dc:h-4 text-dc-text-muted" })
916
+ },
917
+ o.id
918
+ );
919
+ })
920
+ }
921
+ )
922
+ ]
923
+ }
924
+ );
925
+ }
926
+ function ht({ onExpand: t }) {
927
+ const s = B("sparkles");
928
+ return /* @__PURE__ */ u(
929
+ "button",
930
+ {
931
+ type: "button",
932
+ onClick: t,
933
+ className: "dc:w-12 dc:h-full dc:flex-shrink-0 dc:flex dc:flex-col dc:items-center dc:pt-3 dc:gap-2 bg-dc-surface border-dc-border dc:border-l dc:cursor-pointer dc:hover:bg-dc-surface-hover dc:transition-colors",
934
+ title: "Expand AI chat",
935
+ children: [
936
+ /* @__PURE__ */ e(s, { className: "dc:w-5 dc:h-5 text-dc-accent" }),
937
+ /* @__PURE__ */ e(
938
+ "span",
939
+ {
940
+ className: "dc:text-[10px] dc:font-medium text-dc-text-muted",
941
+ style: { writingMode: "vertical-lr" },
942
+ children: "AI Chat"
943
+ }
944
+ )
945
+ ]
946
+ }
947
+ );
948
+ }
949
+ function ft({
950
+ agentEndpoint: t,
874
951
  agentApiKey: s,
875
- agentProvider: r,
876
- agentModel: n,
877
- agentProviderEndpoint: a,
878
- onSave: c,
952
+ agentProvider: c,
953
+ agentModel: a,
954
+ agentProviderEndpoint: n,
955
+ onSave: r,
879
956
  onDirtyStateChange: o,
880
- onDashboardSaved: d,
881
- onScore: i,
882
- loadingComponent: w,
883
- className: N,
957
+ onDashboardSaved: l,
958
+ onScore: d,
959
+ loadingComponent: T,
960
+ className: w,
884
961
  initialPrompt: A
885
962
  }) {
886
- const [x, I] = V(60), h = v(null), S = v(!1), C = E((y) => y.blocks.length), k = E((y) => y.messages.length), l = E((y) => y.isStreaming), g = E((y) => y.save), b = v({ blockCount: C, msgCount: k });
887
- j(() => {
888
- const y = C !== b.current.blockCount || k !== b.current.msgCount;
889
- o?.(y);
890
- }, [C, k, o]);
891
- const f = v(), L = v(!1), T = v(c);
892
- T.current = c;
893
- const M = v(C > 0 || k > 0);
894
- j(() => {
895
- if ((C > 0 || k > 0) && (M.current = !0), !(!T.current || !M.current)) {
896
- if (l) {
897
- L.current = !0, f.current && clearTimeout(f.current);
963
+ const [v, I] = j(60), p = g(null), D = g(!1), { containerRef: k, layoutMode: b } = Be(), [i, x] = j("chat"), [y, S] = j(null), [W, U] = j(!1), Q = g(b), M = P((h) => h.blocks), C = M.length, E = P((h) => h.messages.length), N = P((h) => h.isStreaming), L = P((h) => h.save);
964
+ V(() => {
965
+ Q.current === "narrow" && b === "wide" && x("chat"), Q.current = b;
966
+ }, [b]);
967
+ const q = g(C);
968
+ V(() => {
969
+ if (b === "narrow" && i === "chat" && C > q.current) {
970
+ const h = M[M.length - 1];
971
+ if (h) {
972
+ S(h.id);
973
+ const F = setTimeout(() => S(null), 2e3);
974
+ return () => clearTimeout(F);
975
+ }
976
+ }
977
+ q.current = C;
978
+ }, [C, M, b, i]);
979
+ const K = g(!1);
980
+ V(() => {
981
+ if (N)
982
+ K.current = !0;
983
+ else if (K.current && b === "narrow" && i === "chat" && C > 0) {
984
+ K.current = !1, U(!0);
985
+ const h = setTimeout(() => U(!1), 1700);
986
+ return () => clearTimeout(h);
987
+ }
988
+ }, [N, b, i, C]);
989
+ const J = f(
990
+ (h) => {
991
+ k(h), p.current = h;
992
+ },
993
+ [k]
994
+ ), H = g({ blockCount: C, msgCount: E });
995
+ V(() => {
996
+ const h = C !== H.current.blockCount || E !== H.current.msgCount;
997
+ o?.(h);
998
+ }, [C, E, o]);
999
+ const R = g(), X = g(!1), O = g(r);
1000
+ O.current = r;
1001
+ const G = g(C > 0 || E > 0);
1002
+ V(() => {
1003
+ if ((C > 0 || E > 0) && (G.current = !0), !(!O.current || !G.current)) {
1004
+ if (N) {
1005
+ X.current = !0, R.current && clearTimeout(R.current);
898
1006
  return;
899
1007
  }
900
- return f.current && clearTimeout(f.current), f.current = setTimeout(() => {
901
- L.current = !1;
902
- const y = g();
903
- T.current?.(y);
1008
+ return R.current && clearTimeout(R.current), R.current = setTimeout(() => {
1009
+ X.current = !1;
1010
+ const h = L();
1011
+ O.current?.(h);
904
1012
  }, 1e3), () => {
905
- f.current && clearTimeout(f.current);
1013
+ R.current && clearTimeout(R.current);
906
1014
  };
907
1015
  }
908
- }, [C, k, l, g]), j(() => {
909
- !l && L.current && T.current && M.current && (f.current && clearTimeout(f.current), f.current = setTimeout(() => {
910
- L.current = !1;
911
- const y = g();
912
- T.current?.(y);
1016
+ }, [C, E, N, L]), V(() => {
1017
+ !N && X.current && O.current && G.current && (R.current && clearTimeout(R.current), R.current = setTimeout(() => {
1018
+ X.current = !1;
1019
+ const h = L();
1020
+ O.current?.(h);
913
1021
  }, 1e3));
914
- }, [l, g]);
915
- const P = p(() => {
916
- T.current && (f.current && clearTimeout(f.current), T.current({ blocks: [], messages: [] }));
917
- }, []), F = p((y) => {
918
- y.preventDefault(), S.current = !0;
919
- const D = (U) => {
920
- if (!S.current || !h.current) return;
921
- const $ = h.current.getBoundingClientRect(), O = (U.clientX - $.left) / $.width * 100;
922
- I(Math.min(Math.max(O, 30), 80));
923
- }, Q = () => {
924
- S.current = !1, document.removeEventListener("mousemove", D), document.removeEventListener("mouseup", Q);
1022
+ }, [N, L]);
1023
+ const z = f(() => {
1024
+ O.current && (R.current && clearTimeout(R.current), O.current({ blocks: [], messages: [] }));
1025
+ }, []), te = f((h) => {
1026
+ h.preventDefault(), D.current = !0;
1027
+ const F = (ae) => {
1028
+ if (!D.current || !p.current) return;
1029
+ const se = p.current.getBoundingClientRect(), oe = (ae.clientX - se.left) / se.width * 100;
1030
+ I(Math.min(Math.max(oe, 30), 80));
1031
+ }, ee = () => {
1032
+ D.current = !1, document.removeEventListener("mousemove", F), document.removeEventListener("mouseup", ee);
925
1033
  };
926
- document.addEventListener("mousemove", D), document.addEventListener("mouseup", Q);
927
- }, []);
928
- return /* @__PURE__ */ m(
1034
+ document.addEventListener("mousemove", F), document.addEventListener("mouseup", ee);
1035
+ }, []), Z = /* @__PURE__ */ e(
1036
+ lt,
1037
+ {
1038
+ agentEndpoint: t,
1039
+ agentApiKey: s,
1040
+ agentProvider: c,
1041
+ agentModel: a,
1042
+ agentProviderEndpoint: n,
1043
+ onClear: z,
1044
+ onDashboardSaved: l,
1045
+ onScore: d,
1046
+ loadingComponent: T,
1047
+ initialPrompt: A
1048
+ }
1049
+ );
1050
+ return b === "narrow" ? /* @__PURE__ */ e(
929
1051
  "div",
930
1052
  {
931
- ref: h,
932
- className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${N || ""}`,
1053
+ ref: J,
1054
+ className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${w || ""}`,
1055
+ children: i === "chat" ? /* @__PURE__ */ u(ne, { children: [
1056
+ /* @__PURE__ */ e(
1057
+ mt,
1058
+ {
1059
+ blocks: M,
1060
+ pulsingBlockId: y,
1061
+ nudge: W,
1062
+ onExpand: () => x("notebook")
1063
+ }
1064
+ ),
1065
+ /* @__PURE__ */ e("div", { className: "dc:h-full dc:overflow-hidden dc:flex-1", children: Z })
1066
+ ] }) : /* @__PURE__ */ u(ne, { children: [
1067
+ /* @__PURE__ */ e("div", { className: "dc:h-full dc:overflow-hidden dc:flex-1", children: /* @__PURE__ */ e(ue, {}) }),
1068
+ /* @__PURE__ */ e(ht, { onExpand: () => x("chat") })
1069
+ ] })
1070
+ }
1071
+ ) : /* @__PURE__ */ u(
1072
+ "div",
1073
+ {
1074
+ ref: J,
1075
+ className: `dc:flex dc:h-full dc:w-full dc:overflow-hidden bg-dc-surface-secondary ${w || ""}`,
933
1076
  children: [
934
- /* @__PURE__ */ t(
1077
+ /* @__PURE__ */ e(
935
1078
  "div",
936
1079
  {
937
1080
  className: "dc:h-full dc:overflow-hidden",
938
- style: { width: `${x}%` },
939
- children: /* @__PURE__ */ t(Xe, {})
1081
+ style: { width: `${v}%` },
1082
+ children: /* @__PURE__ */ e(ue, {})
940
1083
  }
941
1084
  ),
942
- /* @__PURE__ */ t(
1085
+ /* @__PURE__ */ e(
943
1086
  "div",
944
1087
  {
945
1088
  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",
946
- onMouseDown: F
1089
+ onMouseDown: te
947
1090
  }
948
1091
  ),
949
- /* @__PURE__ */ t(
1092
+ /* @__PURE__ */ e(
950
1093
  "div",
951
1094
  {
952
1095
  className: "dc:h-full dc:overflow-hidden",
953
- style: { width: `${100 - x}%` },
954
- children: /* @__PURE__ */ t(
955
- nt,
956
- {
957
- agentEndpoint: e,
958
- agentApiKey: s,
959
- agentProvider: r,
960
- agentModel: n,
961
- agentProviderEndpoint: a,
962
- onClear: P,
963
- onDashboardSaved: d,
964
- onScore: i,
965
- loadingComponent: w,
966
- initialPrompt: A
967
- }
968
- )
1096
+ style: { width: `${100 - v}%` },
1097
+ children: Z
969
1098
  }
970
1099
  )
971
1100
  ]
972
1101
  }
973
1102
  );
974
1103
  }
975
- const Nt = q.memo(function({
1104
+ const It = Y.memo(function({
976
1105
  config: s,
977
- ...r
1106
+ ...c
978
1107
  }) {
979
- return /* @__PURE__ */ t(Be, { initialConfig: s, children: /* @__PURE__ */ t(it, { ...r }) });
1108
+ return /* @__PURE__ */ e(Qe, { initialConfig: s, children: /* @__PURE__ */ e(ft, { ...c }) });
980
1109
  });
981
- function wt() {
982
- return /* @__PURE__ */ t("div", { children: "Analytics Page - Coming in Phase 4" });
1110
+ function Mt() {
1111
+ return /* @__PURE__ */ e("div", { children: "Analytics Page - Coming in Phase 4" });
983
1112
  }
984
- const lt = B("segment");
985
- function St({
986
- className: e = ""
1113
+ const pt = B("segment");
1114
+ function Et({
1115
+ className: t = ""
987
1116
  }) {
988
- return /* @__PURE__ */ t(
1117
+ return /* @__PURE__ */ e(
989
1118
  "div",
990
1119
  {
991
- className: `dc:flex dc:items-center dc:justify-center bg-dc-bg-secondary ${e}`,
992
- children: /* @__PURE__ */ m("div", { className: "dc:text-center", children: [
993
- /* @__PURE__ */ t(
994
- lt,
1120
+ className: `dc:flex dc:items-center dc:justify-center bg-dc-bg-secondary ${t}`,
1121
+ children: /* @__PURE__ */ u("div", { className: "dc:text-center", children: [
1122
+ /* @__PURE__ */ e(
1123
+ pt,
995
1124
  {
996
1125
  className: "dc:w-8 dc:h-8 dc:mx-auto dc:mb-2 text-dc-text-muted dc:opacity-50"
997
1126
  }
998
1127
  ),
999
- /* @__PURE__ */ t("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
1128
+ /* @__PURE__ */ e("span", { className: "dc:text-xs text-dc-text-muted", children: "No preview" })
1000
1129
  ] })
1001
1130
  }
1002
1131
  );
1003
1132
  }
1004
1133
  export {
1005
- Nt as AgenticNotebook,
1006
- At as AnalysisBuilder,
1007
- It as AnalyticsDashboard,
1008
- wt as AnalyticsPage,
1009
- ve as AnalyticsPortlet,
1010
- Mt as ChartErrorBoundary,
1011
- Et as ConfirmModal,
1012
- Ls as CubeClient,
1013
- Ps as CubeProvider,
1014
- Ns as DEFAULT_ICONS,
1015
- Rt as DashboardEditModal,
1016
- Bt as DashboardGrid,
1017
- Lt as DashboardStoreProvider,
1018
- St as DashboardThumbnailPlaceholder,
1019
- Pt as DrillBreadcrumb,
1020
- Qt as DrillMenu,
1021
- rr as ExecutionPlanPanel,
1022
- cr as ExplainAIPanel,
1023
- Xs as LazyChart,
1024
- oe as LoadingIndicator,
1025
- Ft as Modal,
1026
- Be as NotebookStoreProvider,
1027
- ke as PortletAnalysisModal,
1028
- _t as PortletContainer,
1029
- Qs as ScrollContainerProvider,
1030
- uc as THEME_PRESETS,
1031
- mc as applyTheme,
1032
- rc as buildFunnelConfigFromQueries,
1033
- cc as buildServerFunnelQuery,
1034
- Fs as captureThumbnail,
1035
- ar as compressAndEncode,
1036
- _s as createCubeClient,
1037
- Fr as createDashboardLayout,
1038
- Vt as createDashboardStore,
1039
- jt as createDefaultConfig,
1040
- Ut as createDefaultFlowConfig,
1041
- $t as createDefaultFunnelConfig,
1042
- qt as createDefaultQueryConfig,
1043
- Ot as createDefaultRetentionConfig,
1044
- Kt as createDefaultWorkspace,
1045
- Cc as createExplainQueryKey,
1046
- jr as createFlowQueryKey,
1047
- Ur as createFunnelQueryKey,
1048
- Re as createNotebookStore,
1049
- nr as decodeAndDecompress,
1050
- or as detectAsymmetricDateRanges,
1051
- dr as detectMeasureCollisions,
1052
- _r as formatChartData,
1053
- ac as formatDuration,
1054
- $r as generateQueryLabel,
1055
- ir as generateShareUrl,
1056
- lr as getAvailableBindingKeyDimensions,
1057
- Ys as getAvailableChartTypes,
1058
- nc as getBindingKeyField,
1059
- ur as getBindingKeyLabel,
1060
- ws as getChartTypeIcon,
1061
- qr as getCombinedFields,
1062
- oc as getCubeNameFromQuery,
1063
- Ss as getFieldTypeIcon,
1134
+ It as AgenticNotebook,
1135
+ Lt as AnalysisBuilder,
1136
+ Pt as AnalyticsDashboard,
1137
+ Mt as AnalyticsPage,
1138
+ Ce as AnalyticsPortlet,
1139
+ Qt as ChartErrorBoundary,
1140
+ Ft as ConfirmModal,
1141
+ Vs as CubeClient,
1142
+ js as CubeProvider,
1143
+ Is as DEFAULT_ICONS,
1144
+ _t as DashboardEditModal,
1145
+ Vt as DashboardGrid,
1146
+ jt as DashboardStoreProvider,
1147
+ Et as DashboardThumbnailPlaceholder,
1148
+ Ut as DrillBreadcrumb,
1149
+ Ot as DrillMenu,
1150
+ dc as ExecutionPlanPanel,
1151
+ lc as ExplainAIPanel,
1152
+ ec as LazyChart,
1153
+ me as LoadingIndicator,
1154
+ $t as Modal,
1155
+ Qe as NotebookStoreProvider,
1156
+ Ne as PortletAnalysisModal,
1157
+ qt as PortletContainer,
1158
+ Us as ScrollContainerProvider,
1159
+ gr as THEME_PRESETS,
1160
+ br as applyTheme,
1161
+ dr as buildFunnelConfigFromQueries,
1162
+ lr as buildServerFunnelQuery,
1163
+ Os as captureThumbnail,
1164
+ ic as compressAndEncode,
1165
+ $s as createCubeClient,
1166
+ Oc as createDashboardLayout,
1167
+ Kt as createDashboardStore,
1168
+ zt as createDefaultConfig,
1169
+ Wt as createDefaultFlowConfig,
1170
+ Jt as createDefaultFunnelConfig,
1171
+ Xt as createDefaultQueryConfig,
1172
+ Yt as createDefaultRetentionConfig,
1173
+ Gt as createDefaultWorkspace,
1174
+ Tr as createExplainQueryKey,
1175
+ Kc as createFlowQueryKey,
1176
+ zc as createFunnelQueryKey,
1177
+ Pe as createNotebookStore,
1178
+ uc as decodeAndDecompress,
1179
+ mc as detectAsymmetricDateRanges,
1180
+ hc as detectMeasureCollisions,
1181
+ $c as formatChartData,
1182
+ ir as formatDuration,
1183
+ Wc as generateQueryLabel,
1184
+ fc as generateShareUrl,
1185
+ pc as getAvailableBindingKeyDimensions,
1186
+ tc as getAvailableChartTypes,
1187
+ ur as getBindingKeyField,
1188
+ gc as getBindingKeyLabel,
1189
+ Me as getChartTypeIcon,
1190
+ Jc as getCombinedFields,
1191
+ mr as getCubeNameFromQuery,
1192
+ Ms as getFieldTypeIcon,
1064
1193
  B as getIcon,
1065
- Ts as getIconData,
1066
- Ds as getIconRegistry,
1067
- As as getIconsByCategory,
1068
- Is as getMeasureTypeIcon,
1069
- Or as getQueryIndices,
1070
- Kr as getQueryLabels,
1071
- hc as getTheme,
1072
- pc as getThemeVariable,
1073
- Gs as getUnavailableChartTypes,
1074
- mr as getValidationSummary,
1075
- Ec as highlightCodeBlocks,
1076
- Hs as isChartTypeAvailable,
1077
- fc as isDarkMode,
1078
- zt as isFlowConfig,
1079
- Wt as isFunnelConfig,
1080
- dc as isFunnelData,
1081
- hr as isMinimumFunnelConfigValid,
1082
- Jt as isMultiQuery,
1083
- Xt as isMultiQueryConfig,
1084
- zr as isMultiQueryData,
1085
- pr as isMultiQueryValid,
1086
- Yt as isQueryConfig,
1087
- Gt as isRetentionConfig,
1088
- Ac as isSankeyData,
1089
- Ic as isServerFlowQuery,
1090
- Ht as isServerFunnelQuery,
1091
- fr as isShareableSize,
1092
- Zt as isSingleQuery,
1093
- Vs as isThumbnailCaptureAvailable,
1094
- es as isValidAnalysisConfig,
1095
- ts as isValidAnalysisWorkspace,
1096
- Zs as isValidChartType,
1097
- Wr as mergeQueryResults,
1098
- Jr as mergeResultsByKey,
1099
- Xr as mergeResultsConcat,
1100
- ss as migrateConfig,
1101
- rs as migrateLegacyPortlet,
1102
- gr as parseShareUrl,
1103
- er as preloadChart,
1104
- tr as preloadCharts,
1105
- Ms as registerIcons,
1106
- Es as resetIcons,
1107
- gc as resetTheme,
1108
- cs as selectAllActions,
1109
- Fe as selectBlockActions,
1110
- Le as selectBlocks,
1111
- br as selectBreakdowns,
1112
- yr as selectChartConfig,
1113
- Qe as selectChatActions,
1114
- Pe as selectChatState,
1115
- xr as selectCurrentState,
1116
- as as selectDebugData,
1117
- ns as selectDebugDataActions,
1118
- os as selectEditModeActions,
1119
- ds as selectEditModeState,
1120
- vr as selectFilters,
1121
- Cr as selectFunnelState,
1122
- kt as selectInputValue,
1123
- vt as selectIsStreaming,
1124
- is as selectLayoutActions,
1125
- ls as selectLayoutState,
1126
- xt as selectMessages,
1127
- kr as selectMetrics,
1128
- us as selectModalActions,
1129
- ms as selectModalState,
1130
- Nr as selectMultiQueryState,
1131
- hs as selectPortletDebugData,
1132
- Ct as selectSessionId,
1133
- ps as selectThumbnailDirty,
1134
- wr as selectUIState,
1135
- Rs as setIcon,
1136
- bc as setTheme,
1137
- yc as setThemeVariable,
1138
- ic as transformServerFunnelResult,
1139
- Ge as useAgentChat,
1140
- Sr as useAnalysisBuilder,
1141
- Tr as useAnalysisBuilderStore,
1142
- Me as useCubeApi,
1143
- js as useCubeContext,
1144
- Us as useCubeFeatures,
1145
- Ws as useCubeFieldLabel,
1146
- Yr as useCubeLoadQuery,
1147
- $s as useCubeMeta,
1148
- qs as useCubeMetaQuery,
1149
- Gr as useCubeQuery,
1150
- fs as useDashboard,
1151
- gs as useDashboardStore,
1152
- bs as useDashboardStoreApi,
1153
- ys as useDashboardStoreOptional,
1154
- xs as useDrillInteraction,
1155
- kc as useDryRunQueries,
1156
- Nc as useDryRunQuery,
1157
- vs as useElementVisibility,
1158
- wc as useExplainAI,
1159
- Sc as useExplainQuery,
1160
- Hr as useFlowQuery,
1161
- Zr as useFunnelQuery,
1162
- ec as useMultiCubeLoadQuery,
1163
- Tc as useMultiDryRunQueries,
1164
- E as useNotebookStore,
1165
- Os as useScrollContainer,
1166
- Cs as useScrollDetection,
1167
- Pr as useTheme,
1168
- Dr as validateBindingKeyExists,
1169
- Ar as validateBindingKeyForSteps,
1170
- Ir as validateFunnelConfig,
1171
- tc as validateMergeKey,
1172
- Mr as validateMergeKeys,
1173
- Er as validateMultiQueryConfig,
1174
- Rr as validateStepQueries,
1175
- Br as validateTimeDimensionAlignment,
1176
- Ks as warnIfScreenshotLibMissing,
1177
- xc as watchThemeChanges
1194
+ Es as getIconData,
1195
+ Rs as getIconRegistry,
1196
+ Bs as getIconsByCategory,
1197
+ Ls as getMeasureTypeIcon,
1198
+ Xc as getQueryIndices,
1199
+ Yc as getQueryLabels,
1200
+ xr as getTheme,
1201
+ yr as getThemeVariable,
1202
+ sc as getUnavailableChartTypes,
1203
+ bc as getValidationSummary,
1204
+ Qr as highlightCodeBlocks,
1205
+ cc as isChartTypeAvailable,
1206
+ vr as isDarkMode,
1207
+ Ht as isFlowConfig,
1208
+ Zt as isFunnelConfig,
1209
+ hr as isFunnelData,
1210
+ xc as isMinimumFunnelConfigValid,
1211
+ es as isMultiQuery,
1212
+ ts as isMultiQueryConfig,
1213
+ Gc as isMultiQueryData,
1214
+ yc as isMultiQueryValid,
1215
+ ss as isQueryConfig,
1216
+ cs as isRetentionConfig,
1217
+ Br as isSankeyData,
1218
+ Lr as isServerFlowQuery,
1219
+ rs as isServerFunnelQuery,
1220
+ vc as isShareableSize,
1221
+ ns as isSingleQuery,
1222
+ qs as isThumbnailCaptureAvailable,
1223
+ as as isValidAnalysisConfig,
1224
+ os as isValidAnalysisWorkspace,
1225
+ rc as isValidChartType,
1226
+ Hc as mergeQueryResults,
1227
+ Zc as mergeResultsByKey,
1228
+ er as mergeResultsConcat,
1229
+ ds as migrateConfig,
1230
+ ls as migrateLegacyPortlet,
1231
+ Cc as parseShareUrl,
1232
+ nc as preloadChart,
1233
+ ac as preloadCharts,
1234
+ Ps as registerIcons,
1235
+ Qs as resetIcons,
1236
+ Cr as resetTheme,
1237
+ is as selectAllActions,
1238
+ je as selectBlockActions,
1239
+ Fe as selectBlocks,
1240
+ wc as selectBreakdowns,
1241
+ Nc as selectChartConfig,
1242
+ Ve as selectChatActions,
1243
+ _e as selectChatState,
1244
+ kc as selectCurrentState,
1245
+ us as selectDebugData,
1246
+ ms as selectDebugDataActions,
1247
+ hs as selectEditModeActions,
1248
+ fs as selectEditModeState,
1249
+ Sc as selectFilters,
1250
+ Tc as selectFunnelState,
1251
+ At as selectInputValue,
1252
+ Tt as selectIsStreaming,
1253
+ ps as selectLayoutActions,
1254
+ gs as selectLayoutState,
1255
+ St as selectMessages,
1256
+ Dc as selectMetrics,
1257
+ bs as selectModalActions,
1258
+ xs as selectModalState,
1259
+ Ac as selectMultiQueryState,
1260
+ ys as selectPortletDebugData,
1261
+ Dt as selectSessionId,
1262
+ vs as selectThumbnailDirty,
1263
+ Ic as selectUIState,
1264
+ Fs as setIcon,
1265
+ wr as setTheme,
1266
+ Nr as setThemeVariable,
1267
+ fr as transformServerFunnelResult,
1268
+ et as useAgentChat,
1269
+ Mc as useAnalysisBuilder,
1270
+ Ec as useAnalysisBuilderStore,
1271
+ Re as useCubeApi,
1272
+ Ks as useCubeContext,
1273
+ zs as useCubeFeatures,
1274
+ Hs as useCubeFieldLabel,
1275
+ tr as useCubeLoadQuery,
1276
+ Ws as useCubeMeta,
1277
+ Js as useCubeMetaQuery,
1278
+ sr as useCubeQuery,
1279
+ Cs as useDashboard,
1280
+ ws as useDashboardStore,
1281
+ Ns as useDashboardStoreApi,
1282
+ ks as useDashboardStoreOptional,
1283
+ Ss as useDrillInteraction,
1284
+ Dr as useDryRunQueries,
1285
+ Ar as useDryRunQuery,
1286
+ Ts as useElementVisibility,
1287
+ Ir as useExplainAI,
1288
+ Mr as useExplainQuery,
1289
+ cr as useFlowQuery,
1290
+ rr as useFunnelQuery,
1291
+ nr as useMultiCubeLoadQuery,
1292
+ Er as useMultiDryRunQueries,
1293
+ P as useNotebookStore,
1294
+ Xs as useScrollContainer,
1295
+ Ds as useScrollDetection,
1296
+ jc as useTheme,
1297
+ Rc as validateBindingKeyExists,
1298
+ Bc as validateBindingKeyForSteps,
1299
+ Lc as validateFunnelConfig,
1300
+ ar as validateMergeKey,
1301
+ Pc as validateMergeKeys,
1302
+ Qc as validateMultiQueryConfig,
1303
+ Fc as validateStepQueries,
1304
+ _c as validateTimeDimensionAlignment,
1305
+ Ys as warnIfScreenshotLibMissing,
1306
+ kr as watchThemeChanges
1178
1307
  };
1179
1308
  //# sourceMappingURL=index.js.map