@databrainhq/plugin 0.17.9-beta.87 → 0.17.9-beta.88

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 (40) hide show
  1. package/dist/{Accordion-BchG2sqH.mjs → Accordion-KS0wm76w.mjs} +1 -1
  2. package/dist/{CardChartSlot-BJI1-6Fi.mjs → CardChartSlot-f36Se2zp.mjs} +1037 -1136
  3. package/dist/{Chart-BPRIOdLy.mjs → Chart-Rc4bVXrP.mjs} +7 -7
  4. package/dist/{ChartTypePanel-C2dzGV9H.mjs → ChartTypePanel-DRtj1nYv.mjs} +8 -8
  5. package/dist/{CreateGlobalFilter-BW71NQ4I.mjs → CreateGlobalFilter-De08sbdM.mjs} +2 -2
  6. package/dist/{CreateMetricV2-zuJNx7dP.mjs → CreateMetricV2-JfzDCkrS.mjs} +114 -114
  7. package/dist/{HorizontalStackTable-KXmRc_vp.mjs → HorizontalStackTable-H35irNPp.mjs} +3 -3
  8. package/dist/{ManageMetricsV2-BFMvfYql.mjs → ManageMetricsV2-CW_ECoXq.mjs} +3 -3
  9. package/dist/{MetricCardV2-D3x8ndnd.mjs → MetricCardV2-Cc4BRMDI.mjs} +9 -9
  10. package/dist/{NoDataFound-CLh9t6Js.mjs → NoDataFound-ChRnPe__.mjs} +1 -1
  11. package/dist/{Panel-Boz3oznI.mjs → Panel-CPSFzQky.mjs} +1 -1
  12. package/dist/{PivotTableV2-Mv7SFrij.mjs → PivotTableV2-Dmju8J9j.mjs} +2 -2
  13. package/dist/{PivotTableV3-CKhiTUTm.mjs → PivotTableV3-BqxRB0lY.mjs} +4 -4
  14. package/dist/{Portal-BMZrD27q.mjs → Portal-CxaQIVhn.mjs} +16 -9
  15. package/dist/{RadioButton-BBuNPcbg.mjs → RadioButton-CEWeXTaM.mjs} +1 -1
  16. package/dist/{ScheduleEmail-BRQ_GGMS.mjs → ScheduleEmail-BUOR5Ndf.mjs} +6 -6
  17. package/dist/{SearchMetricData-Bp7RKjl3.mjs → SearchMetricData-QMT2fQYp.mjs} +13 -13
  18. package/dist/{SortPanel-DtAP__1J.mjs → SortPanel-g3-c65fe.mjs} +8 -8
  19. package/dist/{Table-Crhhoyf_.mjs → Table-Ug97LMpx.mjs} +508 -507
  20. package/dist/{TagInputField-SMeh_vdJ.mjs → TagInputField-dF1i5J37.mjs} +4 -4
  21. package/dist/{TextAreaField-osj4rqjy.mjs → TextAreaField-BGzFYxSp.mjs} +2 -2
  22. package/dist/{TimeSeriesSettings-B1vlydJ7.mjs → TimeSeriesSettings-C_aQh55Q.mjs} +2 -2
  23. package/dist/{clickActions-CYOdHxbd.mjs → clickActions-CXvfV7tl.mjs} +20 -20
  24. package/dist/{conditionalFormatting-9rsy1Jg2.mjs → conditionalFormatting-Di6YiWwV.mjs} +1 -1
  25. package/dist/{createGlobalFilter.module-5pE0s-Qa.mjs → createGlobalFilter.module-D0_y_Apc.mjs} +1 -1
  26. package/dist/{crossPointer-Ct4DXJEx.mjs → crossPointer-C8z2bN7w.mjs} +3 -3
  27. package/dist/data.cjs +1 -1
  28. package/dist/data.mjs +1 -1
  29. package/dist/{metric.mutation-ZNTU8Fds.mjs → metric.mutation-7Ng2k216.mjs} +1 -1
  30. package/dist/{pluginV3Request-B0e7_2OA.mjs → pluginV3Request-CobM2ThT.mjs} +1 -1
  31. package/dist/{renderer-CqawuMjq.mjs → renderer-BCjoR_9v.mjs} +1 -1
  32. package/dist/{timeseries-D7495x32.mjs → timeseries-DI-9AaNe.mjs} +1 -1
  33. package/dist/{useGuesTokenUsageLog-zvPUY22Q.mjs → useGuesTokenUsageLog-D2Uirt1W.mjs} +1 -1
  34. package/dist/{useLoadingDeadline-BZ90HIjy.mjs → useLoadingDeadline-CUtZ9eIH.mjs} +569 -458
  35. package/dist/{usePublishArchivedMetrics-CnxDtwAz.mjs → usePublishArchivedMetrics-DpS4nzrY.mjs} +2 -2
  36. package/dist/{useQuery-BCy3fWon.mjs → useQuery-BEqCyDgw.mjs} +1 -1
  37. package/dist/webcomponents-styles.es.js +1 -1
  38. package/dist/webcomponents.es.js +1592 -1578
  39. package/dist/webcomponents.umd.js +28 -28
  40. package/package.json +1 -1
@@ -2,44 +2,45 @@ import * as e from "react";
2
2
  import "react-dom";
3
3
  import "react-dom/client";
4
4
  import { d as t, o as n, p as r, s as i } from "./cardStates-C6q56mQy.mjs";
5
- import { _t as a, p as o, vt as s } from "./pluginV3Request-B0e7_2OA.mjs";
6
- import { K as c, et as l, it as u, l as d, ot as f } from "./metric.mutation-ZNTU8Fds.mjs";
7
- import { Cn as p, Dn as m, Ei as h, Gr as g, Hr as ee, Ht as te, Ji as _, Jr as ne, Nn as re, Oi as ie, Qr as ae, Ti as oe, Ua as v, Ur as se, Vi as ce, Wr as y, Xi as le, Xt as ue, Ya as de, Yn as fe, Yt as pe, Zt as me, _n as he, _o as b, an as ge, at as _e, bn as ve, dn as x, ea as ye, ei as be, fi as S, fn as xe, gn as C, ia as Se, io as Ce, jn as we, ni as Te, nn as Ee, oi as De, qt as Oe, tn as w, xn as ke } from "./Portal-BMZrD27q.mjs";
8
- import { a as Ae } from "./timeseries-D7495x32.mjs";
9
- import { c as je, h as Me, l as Ne, n as Pe, s as Fe, u as Ie } from "./RadioButton-BBuNPcbg.mjs";
10
- import { n as T } from "./safeNavigation-LZKioSSE.mjs";
11
- import { t as Le } from "./shadowContainer-CigTOXz8.mjs";
12
- import { t as E } from "./createLucideIcon-B89xLYvS.mjs";
13
- import D, { useCallback as O, useContext as k, useEffect as Re, useLayoutEffect as ze, useMemo as A, useRef as Be, useState as j } from "react";
14
- import { jsx as M } from "react/jsx-runtime";
5
+ import { _t as a, p as o, vt as s } from "./pluginV3Request-CobM2ThT.mjs";
6
+ import { K as c, et as l, it as u, l as d, ot as f } from "./metric.mutation-7Ng2k216.mjs";
7
+ import { Cn as p, Dn as m, Ei as h, Gr as g, Hr as ee, Ht as te, Ji as _, Jr as ne, Nn as re, Oi as ie, Qr as ae, Ti as oe, Ua as v, Ur as se, Vi as ce, Wr as y, Xi as le, Xt as ue, Ya as de, Yn as fe, Yt as pe, Zt as me, _n as he, _o as b, an as ge, at as _e, bn as ve, dn as x, ea as ye, ei as be, fi as S, fn as xe, gn as C, ia as Se, io as Ce, jn as we, ni as Te, nn as Ee, oi as De, qt as Oe, tn as w, xn as ke } from "./Portal-CxaQIVhn.mjs";
8
+ import { a as Ae } from "./timeseries-DI-9AaNe.mjs";
9
+ import { _ as T } from "./crossPointer-C8z2bN7w.mjs";
10
+ import { c as je, h as Me, l as Ne, n as Pe, s as Fe, u as Ie } from "./RadioButton-CEWeXTaM.mjs";
11
+ import { n as Le } from "./safeNavigation-LZKioSSE.mjs";
12
+ import { t as E } from "./shadowContainer-CigTOXz8.mjs";
13
+ import { t as D } from "./createLucideIcon-B89xLYvS.mjs";
14
+ import O, { useCallback as k, useContext as Re, useEffect as ze, useLayoutEffect as A, useMemo as j, useRef as Be, useState as M } from "react";
15
+ import { jsx as Ve } from "react/jsx-runtime";
15
16
  // src/helpers/chartDisplayValue.ts
16
- var Ve = (e, t = /* @__PURE__ */ new WeakSet()) => {
17
+ var N = (e, t = /* @__PURE__ */ new WeakSet()) => {
17
18
  if (typeof e != "object" || !e) return e;
18
19
  if (e instanceof Date) return e.toJSON();
19
20
  if (t.has(e)) return "[Circular]";
20
21
  if (t.add(e), Array.isArray(e)) {
21
- let n = e.map((e) => Ve(e, t));
22
+ let n = e.map((e) => N(e, t));
22
23
  return t.delete(e), n;
23
24
  }
24
- let n = Object.keys(e).sort().reduce((n, r) => (n[r] = Ve(e[r], t), n), {});
25
+ let n = Object.keys(e).sort().reduce((n, r) => (n[r] = N(e[r], t), n), {});
25
26
  return t.delete(e), n;
26
- }, N = (e) => {
27
+ }, He = (e) => {
27
28
  if (e == null) return "";
28
29
  if (typeof e != "object") return `${e}`;
29
30
  try {
30
- return JSON.stringify(Ve(e));
31
+ return JSON.stringify(N(e));
31
32
  } catch {
32
33
  return `${e}`;
33
34
  }
34
- }, He = (e) => !e || typeof e != "object" || Array.isArray(e) ? e : Object.keys(e).reduce((t, n) => {
35
+ }, Ue = (e) => !e || typeof e != "object" || Array.isArray(e) ? e : Object.keys(e).reduce((t, n) => {
35
36
  let r = e[n];
36
- return t[n] = typeof r == "object" && r ? N(r) : r, t;
37
- }, {}), Ue = (e) => Array.isArray(e) ? e.map(He) : e, We = (e, t) => e?.label || t || e?.tableName || "", Ge = [
37
+ return t[n] = typeof r == "object" && r ? He(r) : r, t;
38
+ }, {}), We = (e) => Array.isArray(e) ? e.map(Ue) : e, Ge = (e, t) => e?.label || t || e?.tableName || "", Ke = [
38
39
  "backend-cap",
39
40
  "metric-limit",
40
41
  "client-window",
41
42
  "chart-coverage"
42
- ], Ke = (e) => typeof e == "string" && Ge.includes(e), qe = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, Je = (e) => e.of === null ? Infinity : Math.max(0, e.of - e.at), Ye = (e) => {
43
+ ], qe = (e) => typeof e == "string" && Ke.includes(e), P = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, Je = (e) => e.of === null ? Infinity : Math.max(0, e.of - e.at), Ye = (e) => {
43
44
  let t = e[0], n = Je(t);
44
45
  for (let r = 1; r < e.length; r += 1) {
45
46
  let i = Je(e[r]);
@@ -55,7 +56,7 @@ var Ve = (e, t = /* @__PURE__ */ new WeakSet()) => {
55
56
  rows: e,
56
57
  truncated: null
57
58
  });
58
- function Ze(e, t, n) {
59
+ function F(e, t, n) {
59
60
  let r = e.rows.length, i = n.length;
60
61
  if (i >= r) return e;
61
62
  let a = {
@@ -68,27 +69,27 @@ function Ze(e, t, n) {
68
69
  truncated: Ye(e.truncated ? [...e.truncated.stages, a] : [a])
69
70
  };
70
71
  }
71
- function P(e, t) {
72
+ function Ze(e, t) {
72
73
  if (!e || typeof e != "object") return null;
73
74
  let n = e, r = Array.isArray(n.stages) ? n.stages : [], i = [];
74
75
  for (let e of r) {
75
76
  if (!e || typeof e != "object") continue;
76
77
  let { by: t, at: n, of: r } = e;
77
- Ke(t) && qe(n) && i.push({
78
+ qe(t) && P(n) && i.push({
78
79
  by: t,
79
80
  at: n,
80
- of: qe(r) ? r : null
81
+ of: P(r) ? r : null
81
82
  });
82
83
  }
83
84
  if (!i.length) {
84
- if (!Ke(n.by) || !qe(n.at)) return null;
85
+ if (!qe(n.by) || !P(n.at)) return null;
85
86
  i.push({
86
87
  by: n.by,
87
88
  at: n.at,
88
- of: qe(n.of) ? n.of : null
89
+ of: P(n.of) ? n.of : null
89
90
  });
90
91
  }
91
- if (qe(t)) {
92
+ if (P(t)) {
92
93
  let e = i[i.length - 1];
93
94
  e.at !== t && (i[i.length - 1] = {
94
95
  ...e,
@@ -97,31 +98,31 @@ function P(e, t) {
97
98
  }
98
99
  return Ye(i);
99
100
  }
100
- function Qe(e, t = (e) => e.toLocaleString()) {
101
+ function I(e, t = (e) => e.toLocaleString()) {
101
102
  return e ? e.of === null ? `Displaying the first ${t(e.at)} rows` : `Displaying ${t(e.at)} of ${t(e.of)}` : null;
102
103
  }
103
104
  // src/helpers/filterDuplicateMeasures.ts
104
- var F = (e) => {
105
+ var Qe = (e) => {
105
106
  let t = /* @__PURE__ */ new Set();
106
107
  return e.filter((e) => {
107
108
  let n = JSON.stringify(e?.measures?.sort());
108
109
  return !t.has(n) && (t.add(n), !0);
109
110
  });
110
- }, $e = (e) => e?.dataMartColumnAlias || e?.name || "", et = ({ configuration: e, savedConfiguration: t }) => e.table?.name?.trim() ? e : t?.table?.name?.trim() ? t : e, tt = (e) => e.type === "custom", I = (e) => [...tt(e) ? [] : [{
111
+ }, $e = (e) => e?.dataMartColumnAlias || e?.name || "", et = ({ configuration: e, savedConfiguration: t }) => e.table?.name?.trim() ? e : t?.table?.name?.trim() ? t : e, L = (e) => e.type === "custom", tt = (e) => [...L(e) ? [] : [{
111
112
  name: e.name,
112
113
  alias: e.alias
113
114
  }], ...(e.joins || []).filter((e) => e.tableType !== "custom").map((e) => ({
114
115
  name: e.name,
115
116
  alias: e.alias
116
- }))], nt = (e, t) => e.parentTableName === t || e.childTableName === t, L = (e, t) => {
117
- let n = I(e), r = /* @__PURE__ */ new Set([e.name, ...(e.joins || []).map((e) => e.name)]);
118
- for (let e of n) for (let n of t) nt(n, e.name) && (r.add(n.parentTableName), r.add(n.childTableName));
117
+ }))], R = (e, t) => e.parentTableName === t || e.childTableName === t, nt = (e, t) => {
118
+ let n = tt(e), r = /* @__PURE__ */ new Set([e.name, ...(e.joins || []).map((e) => e.name)]);
119
+ for (let e of n) for (let n of t) R(n, e.name) && (r.add(n.parentTableName), r.add(n.childTableName));
119
120
  return r;
120
121
  }, rt = (e, t, n) => {
121
- let r = L(t, n);
122
+ let r = nt(t, n);
122
123
  return e.filter((e) => r.has(e.tableName));
123
124
  }, it = (e) => /^\s*left\b/i.test(e) ? e.replace(/left/i, "RIGHT") : /^\s*right\b/i.test(e) ? e.replace(/right/i, "LEFT") : e, at = (e, t, n) => {
124
- let r = I(e);
125
+ let r = tt(e);
125
126
  if (r.some((e) => e.name === t.name)) return e;
126
127
  for (let i of r) {
127
128
  let r = n.find((e) => e.parentTableName === i.name && e.childTableName === t.name || e.childTableName === i.name && e.parentTableName === t.name);
@@ -168,14 +169,14 @@ var F = (e) => {
168
169
  function ft(e) {
169
170
  return lt.includes(e);
170
171
  }
171
- function pt(e) {
172
+ function z(e) {
172
173
  if (!e || typeof e != "object") return {};
173
174
  let t = {};
174
175
  return Object.entries(e).forEach(([e, n]) => {
175
176
  ft(e) && typeof n == "boolean" && (t[e] = n);
176
177
  }), t;
177
178
  }
178
- function R() {
179
+ function pt() {
179
180
  return typeof window > "u" ? void 0 : window;
180
181
  }
181
182
  function mt() {
@@ -185,26 +186,26 @@ function mt() {
185
186
  return;
186
187
  }
187
188
  }
188
- function ht(e) {
189
- return e ? pt(e.__DBN_EMBED_UI_FLAGS__) : {};
189
+ function B(e) {
190
+ return e ? z(e.__DBN_EMBED_UI_FLAGS__) : {};
190
191
  }
191
- function z(e) {
192
+ function ht(e) {
192
193
  try {
193
194
  let t = e?.VITE_DBN_EMBED_UI_FLAGS;
194
- return typeof t != "string" || !t.trim() ? {} : pt(JSON.parse(t));
195
+ return typeof t != "string" || !t.trim() ? {} : z(JSON.parse(t));
195
196
  } catch {
196
197
  return {};
197
198
  }
198
199
  }
199
- function gt(e = {}) {
200
- let t = e.windowGlobal ?? R(), n = z(e.env ?? mt()), r = ht(t);
200
+ function V(e = {}) {
201
+ let t = e.windowGlobal ?? pt(), n = ht(e.env ?? mt()), r = B(t);
201
202
  return {
202
203
  ...n,
203
204
  ...r
204
205
  };
205
206
  }
206
207
  // src/core/flags/resolve.ts
207
- function B(e) {
208
+ function gt(e) {
208
209
  if (!e) return {};
209
210
  let t = {}, n = e[ct];
210
211
  return typeof n == "boolean" && st.forEach((e) => {
@@ -217,7 +218,7 @@ function B(e) {
217
218
  function _t(e, t) {
218
219
  return {
219
220
  ...e,
220
- ...B(t)
221
+ ...gt(t)
221
222
  };
222
223
  }
223
224
  function vt(e) {
@@ -232,7 +233,7 @@ function vt(e) {
232
233
  return t;
233
234
  }
234
235
  function yt(e = {}) {
235
- let { explicit: t, serverFlags: n, postHogResolver: r, staticConfig: i } = e, a = i ?? gt(), o;
236
+ let { explicit: t, serverFlags: n, postHogResolver: r, staticConfig: i } = e, a = i ?? V(), o;
236
237
  try {
237
238
  o = r?.();
238
239
  } catch {
@@ -254,30 +255,30 @@ var xt = {
254
255
  uiVersion: "legacy",
255
256
  flags: dt,
256
257
  isSectionActive: () => !1
257
- }, St = D.createContext(xt), Ct = ({ children: e, resolutionInput: t, uiVersion: n = "legacy" }) => {
258
- let r = A(() => yt(t), [t]), i = A(() => ({
258
+ }, St = O.createContext(xt), H = ({ children: e, resolutionInput: t, uiVersion: n = "legacy" }) => {
259
+ let r = j(() => yt(t), [t]), i = j(() => ({
259
260
  uiVersion: n,
260
261
  flags: r,
261
262
  isSectionActive: (e) => bt(n, r, e)
262
- }), [r, n]), a = /* @__PURE__ */ M(St.Provider, {
263
+ }), [r, n]), a = /* @__PURE__ */ Ve(St.Provider, {
263
264
  value: i,
264
265
  children: e
265
266
  });
266
- return n === "v2" ? /* @__PURE__ */ M(Le, { children: a }) : a;
267
- }, wt = () => k(St), V = (e) => {
267
+ return n === "v2" ? /* @__PURE__ */ Ve(E, { children: a }) : a;
268
+ }, Ct = () => Re(St), U = (e) => {
268
269
  let t = /* @__PURE__ */ new Map();
269
270
  e.alias && e.name && t.set(e.alias, e.name);
270
271
  for (let n of e.joins || []) n.alias && n.name && t.set(n.alias, n.name);
271
272
  return t;
272
- }, H = (e, t, n) => {
273
+ }, W = (e, t, n) => {
273
274
  let r = e.firstOperand, i = e.secondOperand, a = r?.parentAlias ? t.get(r.parentAlias) : void 0, o = i?.parentAlias ? t.get(i.parentAlias) : void 0;
274
275
  return !a || !o || !r?.columnName || !i?.columnName ? !1 : n.some((e) => e.parentTableName === a && e.parentColumnName === r.columnName && e.childTableName === o && e.childColumnName === i.columnName || e.parentTableName === o && e.parentColumnName === i.columnName && e.childTableName === a && e.childColumnName === r.columnName);
275
- }, Tt = (e, t) => {
276
+ }, wt = (e, t) => {
276
277
  let n = e.table, r = n?.joins || [];
277
278
  if (!r.length || !t.length) return e;
278
- let i = V(n), a = !1, o = r.map((e) => {
279
+ let i = U(n), a = !1, o = r.map((e) => {
279
280
  let n = e.conditions || [], r = n.filter((e) => {
280
- let n = H(e, i, t);
281
+ let n = W(e, i, t);
281
282
  return a ||= n, !n;
282
283
  });
283
284
  return r.length === n.length ? e : {
@@ -292,7 +293,7 @@ var xt = {
292
293
  joins: o
293
294
  }
294
295
  } : e;
295
- }, U = (e, t, n) => H(e, V(t), n), Et = (e) => !!e && e.operandType === "number", Dt = (e) => e.configType === "AGGREGATE" ? "number" : e.helperFunction ? "string" : e.cast?.value && e?.cast?.value !== "NONE" ? e?.cast?.value : e.datatype, W = (e, t = []) => {
296
+ }, G = (e, t, n) => W(e, U(t), n), Tt = (e) => !!e && e.operandType === "number", Et = (e) => e.configType === "AGGREGATE" ? "number" : e.helperFunction ? "string" : e.cast?.value && e?.cast?.value !== "NONE" ? e?.cast?.value : e.datatype, K = (e, t = []) => {
296
297
  let n = new Set(t.filter((e) => e?.name).map((e) => e.name));
297
298
  return e.filter((e) => ["ASC", "DESC"].includes(e?.defaultSort || "")).map((e) => {
298
299
  let t = ne.includes(e?.helperFunction || ""), n = w([e])?.dimensions?.[0];
@@ -308,16 +309,16 @@ var xt = {
308
309
  formattedColumn: t && e ? n : void 0
309
310
  };
310
311
  }).filter((e) => e?.name && !n.has(e.name));
311
- }, Ot = (e = [], t = []) => e.filter((e) => e?.type !== "selected_column" || t.some((t) => t?.alias === e?.name)), G = (e = [], t = []) => {
312
- let n = Ot(e, t);
313
- return [...n, ...W(t, n)];
314
- }, K = "This metric could not run. Change a field or filter and try again.", kt = (e, n, i) => {
312
+ }, Dt = (e = [], t = []) => e.filter((e) => e?.type !== "selected_column" || t.some((t) => t?.alias === e?.name)), q = (e = [], t = []) => {
313
+ let n = Dt(e, t);
314
+ return [...n, ...K(t, n)];
315
+ }, J = "This metric could not run. Change a field or filter and try again.", Ot = (e, n, i) => {
315
316
  let a = t(e), o = r(e, {
316
- fallback: K,
317
+ fallback: J,
317
318
  surface: "builder"
318
319
  });
319
320
  return n("builder", o, a?.details?.legacyCode, { metricId: i }), o;
320
- }, q = (e, t) => t && typeof e == "string" && e && n(t) === e ? t : void 0, J = (e) => `'${e}'`, At = (e, t, n, r = []) => {
321
+ }, kt = (e, t) => t && typeof e == "string" && e && n(t) === e ? t : void 0, At = (e) => `'${e}'`, jt = (e, t, n, r = []) => {
321
322
  let i = t?.table, a = i?.joins || [], o = (e, t) => n.find((n) => n?.tableName === e && (!t || !n?.schemaName || n.schemaName === t)), s = (e) => {
322
323
  let t = o(e?.name, e?.schema);
323
324
  return t ? t.label || t.tableName : void 0;
@@ -336,7 +337,7 @@ var xt = {
336
337
  let e = s(i), t = s(a[0]);
337
338
  return {
338
339
  code: "JOIN_PATH_MISSING",
339
- message: e && t ? `Tables ${J(e)} and ${J(t)} are not linked in the datamart.` : "The tables in this metric are not linked in the datamart.",
340
+ message: e && t ? `Tables ${At(e)} and ${At(t)} are not linked in the datamart.` : "The tables in this metric are not linked in the datamart.",
340
341
  hint: "Ask your admin to add a relationship, or pick fields from one table."
341
342
  };
342
343
  }
@@ -349,8 +350,8 @@ var xt = {
349
350
  return n ? !new Set((n.columns?.length ? n.columns : (n.columnsWithDataType || []).map((e) => e?.name)).filter(Boolean)).has(e.columnName) : !1;
350
351
  }, u = (e) => {
351
352
  let t = s(c[e.parentAlias]);
352
- return t ? ` in table ${J(t)}` : "";
353
- }, d = a.flatMap((e) => (e?.conditions || []).flatMap((e) => U(e, i, r) ? [] : [e?.firstOperand, e?.secondOperand])).find(l);
353
+ return t ? ` in table ${At(t)}` : "";
354
+ }, d = a.flatMap((e) => (e?.conditions || []).flatMap((e) => G(e, i, r) ? [] : [e?.firstOperand, e?.secondOperand])).find(l);
354
355
  if (d) return {
355
356
  code: "JOIN_COLUMN_HIDDEN",
356
357
  message: `A column${u(d)} is hidden from viewers, but this join needs it.`,
@@ -362,42 +363,42 @@ var xt = {
362
363
  message: `A column${f ? u(f) : ""} is hidden from viewers, but this metric uses it.`,
363
364
  hint: "Ask your admin to unhide it in the datamart, or pick another column."
364
365
  };
365
- }, jt = ({ type: e, firstOperand: t, secondOperand: n }) => e === "METRIC" || _.includes(t?.helperFunction || "") || _.includes(n?.helperFunction || "") ? "AGGREGATE" : "DIMENSION", Mt = ({ clientId: e, shouldApplyClientDataScope: t, clientSubsetData: _, setChartSettings: T, setError: Le, dbName: E = "", chartSettings: D, setData: k, setQuery: ze, setLoading: M, setGroupByList: Ve, data: N, limit: He, setDatasetSettings: Ge, token: Ke, workspaceId: qe, isDatabaseTenancy: Je, companyTenancyType: Ye, clientColumnType: Xe, setDrillDownSettings: Ze, drillDownSettings: P, datasourceId: Qe, datasetSettings: F, dashboardId: tt, id: I, companyId: nt, isIncrementalJoin: L, onServerEvent: it, metricEncryptedQuery: ot, rlsConditions: st, isFrontendApp: ct, encryptedClientId: lt }) => {
366
- let { mutate: ut } = d(), dt = b(), [ft, pt] = j(null), R = O((e) => {
367
- let t = typeof e == "string" && e && i() === "viewer" ? kt(e, dt, I) : e;
368
- typeof t == "string" || t == null ? (pt(null), Le(t)) : (pt(t), Le(n(t)));
366
+ }, Mt = ({ type: e, firstOperand: t, secondOperand: n }) => e === "METRIC" || _.includes(t?.helperFunction || "") || _.includes(n?.helperFunction || "") ? "AGGREGATE" : "DIMENSION", Nt = ({ clientId: e, shouldApplyClientDataScope: t, clientSubsetData: _, setChartSettings: T, setError: Le, dbName: E = "", chartSettings: D, setData: O, setQuery: Re, setLoading: A, setGroupByList: Ve, data: N, limit: He, setDatasetSettings: Ue, token: Ke, workspaceId: qe, isDatabaseTenancy: P, companyTenancyType: Je, clientColumnType: Ye, setDrillDownSettings: Xe, drillDownSettings: F, datasourceId: Ze, datasetSettings: I, dashboardId: Qe, id: L, companyId: tt, isIncrementalJoin: R, onServerEvent: nt, metricEncryptedQuery: it, rlsConditions: ot, isFrontendApp: st, encryptedClientId: ct }) => {
367
+ let { mutate: lt } = d(), ut = b(), [dt, ft] = M(null), z = k((e) => {
368
+ let t = typeof e == "string" && e && i() === "viewer" ? Ot(e, ut, L) : e;
369
+ typeof t == "string" || t == null ? (ft(null), Le(t)) : (ft(t), Le(n(t)));
369
370
  }, [
370
371
  Le,
371
- dt,
372
- I
373
- ]), [mt, ht] = j(!0), [z, gt] = j(), [B, _t] = j([]), [vt, yt] = j([]), [bt, xt] = j([]), [St, Ct] = j({
372
+ ut,
373
+ L
374
+ ]), [pt, mt] = M(!0), [B, ht] = M(), [V, gt] = M([]), [_t, vt] = M([]), [yt, bt] = M([]), [xt, St] = M({
374
375
  data: [],
375
376
  error: "",
376
377
  isLoading: !1,
377
378
  currentValue: ""
378
- }), [V, H] = j(be), [U, W] = j([]), [K, q] = j([]), [J, Mt] = j({
379
+ }), [H, U] = M(be), [W, G] = M([]), [K, J] = M([]), [kt, At] = M({
379
380
  value: "",
380
381
  label: ""
381
- }), [Nt, Pt] = j([]), [Ft, It] = j([]), [Lt, Rt] = j([]), { data: zt } = Ce(), Bt = !!wt().flags.embed_multi_hop_joins, Y = Ye || (Je ? "DATABASE" : "TABLE"), Vt = Ye || zt?.companyTenancyType || (Je ? "DATABASE" : void 0), Ht = !!Je || Pe(Vt), { mutate: Ut, error: Wt } = _e(), X = A(() => {
382
- if (L) {
383
- if (V?.table?.name && z?.tableName) {
384
- if (V?.table?.joins?.length) return Bt ? rt(B, V.table, bt || []) : B?.filter((e) => e.tableName === V?.table?.name || V?.table?.joins?.[0]?.name === e.tableName);
382
+ }), [Nt, Pt] = M([]), [Y, Ft] = M([]), [It, Lt] = M([]), { data: Rt } = Ce(), zt = !!Ct().flags.embed_multi_hop_joins, Bt = Je || (P ? "DATABASE" : "TABLE"), Vt = Je || Rt?.companyTenancyType || (P ? "DATABASE" : void 0), Ht = !!P || Pe(Vt), { mutate: Ut, error: Wt } = _e(), X = j(() => {
383
+ if (R) {
384
+ if (H?.table?.name && B?.tableName) {
385
+ if (H?.table?.joins?.length) return zt ? rt(V, H.table, yt || []) : V?.filter((e) => e.tableName === H?.table?.name || H?.table?.joins?.[0]?.name === e.tableName);
385
386
  {
386
- let e = bt?.filter((e) => e?.parentTableName === V?.table?.name || e?.childTableName === V?.table?.name);
387
- return B?.filter((t) => t.tableName === V?.table?.name || e?.flatMap((e) => [e?.parentTableName, e?.childTableName]).includes(t.tableName));
387
+ let e = yt?.filter((e) => e?.parentTableName === H?.table?.name || e?.childTableName === H?.table?.name);
388
+ return V?.filter((t) => t.tableName === H?.table?.name || e?.flatMap((e) => [e?.parentTableName, e?.childTableName]).includes(t.tableName));
388
389
  }
389
390
  }
390
- return B;
391
+ return V;
391
392
  }
392
- return B;
393
+ return V;
393
394
  }, [
394
- B,
395
- z,
396
395
  V,
397
- L,
398
- Bt,
399
- bt
400
- ]), Gt = A(() => V.dimensions.length > 1 && !!V.aggregates.length, [V.dimensions, V.aggregates]), Kt = A(() => [
396
+ B,
397
+ H,
398
+ R,
399
+ zt,
400
+ yt
401
+ ]), Gt = j(() => H.dimensions.length > 1 && !!H.aggregates.length, [H.dimensions, H.aggregates]), Kt = j(() => [
401
402
  v.boxplot,
402
403
  v.funnel,
403
404
  v.funnelV2,
@@ -413,32 +414,32 @@ var xt = {
413
414
  v.singleValue,
414
415
  v.timeSeries,
415
416
  v.treeMap
416
- ].includes(D.chartType), [D.chartType]), Z = A(() => U.length + K.length === 0, [U, K]), qt = A(() => [De, h].includes(E?.toLowerCase() || ""), [E]), Jt = A(() => ({ sorting: {
417
+ ].includes(D.chartType), [D.chartType]), Z = j(() => W.length + K.length === 0, [W, K]), qt = j(() => [De, h].includes(E?.toLowerCase() || ""), [E]), Jt = j(() => ({ sorting: {
417
418
  isEnabled: !0,
418
419
  isEnabledAutoSort: !1,
419
420
  sortingType: "both-axis",
420
- list: U,
421
- setList: W
422
- } }), [U]), Yt = A(() => ({ sorting: {
421
+ list: W,
422
+ setList: G
423
+ } }), [W]), Yt = j(() => ({ sorting: {
423
424
  isEnabled: !0,
424
425
  isEnabledAutoSort: !1,
425
426
  sortingType: "both-axis",
426
427
  list: K,
427
- setList: q
428
- } }), [K]), Xt = A(() => D.chartType === v.timeSeries, [D.chartType]), Zt = Be(null), Qt = A(() => z ? z?.type === "custom" ? {
429
- value: `none^^^^^^${z?.sql}^^^^^^${z?.alias || "dbn_sql_table"}^^^^^^custom`,
430
- label: z?.alias || "dbn_sql_table",
428
+ setList: J
429
+ } }), [K]), Xt = j(() => D.chartType === v.timeSeries, [D.chartType]), Zt = Be(null), Qt = j(() => B ? B?.type === "custom" ? {
430
+ value: `none^^^^^^${B?.sql}^^^^^^${B?.alias || "dbn_sql_table"}^^^^^^custom`,
431
+ label: B?.alias || "dbn_sql_table",
431
432
  icon: "table"
432
433
  } : {
433
- value: `${z?.schemaName}^^^^^^${z?.tableName}`,
434
- label: `${z?.schemaName}.${z?.tableName}`,
434
+ value: `${B?.schemaName}^^^^^^${B?.tableName}`,
435
+ label: `${B?.schemaName}.${B?.tableName}`,
435
436
  icon: "table"
436
437
  } : {
437
438
  value: "",
438
439
  label: "",
439
440
  icon: "table"
440
- }, [z]), $t = A(() => {
441
- let [e, t, n, r] = J.value?.split("^^^^^^"), i = r === "custom" ? n || "dbn_sql_table" : `${x(e, E)}_${t?.replaceAll(" ", "_")?.replace("*", "_")}`;
441
+ }, [B]), $t = j(() => {
442
+ let [e, t, n, r] = kt.value?.split("^^^^^^"), i = r === "custom" ? n || "dbn_sql_table" : `${x(e, E)}_${t?.replaceAll(" ", "_")?.replace("*", "_")}`;
442
443
  return r === "custom" ? (X?.find((e) => e.tableName === n)?.columnsWithDataType || [])?.map((e) => ({
443
444
  value: `${n}^^^^^^${e.name}^^^^^^${e.dataType || ""}^^^^^^none^^^^^^${n}`,
444
445
  label: `${e?.label || e.dataMartColumnAlias || e.name}`,
@@ -464,19 +465,19 @@ var xt = {
464
465
  })) || [];
465
466
  }, [
466
467
  X,
467
- J.value,
468
+ kt.value,
468
469
  E
469
- ]), en = A(() => {
470
- let e = V?.table?.joins?.map((e) => X?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], t = X?.find((e) => e?.schemaName === V?.table?.schema && e?.tableName === V?.table?.name);
470
+ ]), en = j(() => {
471
+ let e = H?.table?.joins?.map((e) => X?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], t = X?.find((e) => e?.schemaName === H?.table?.schema && e?.tableName === H?.table?.name);
471
472
  return (t ? [t, ...e?.filter((e) => e?.tableName !== t?.tableName) || []] : e || [])?.map((e) => ({
472
473
  value: `${e.schemaName}^^^^^^${e.tableName}`,
473
- label: We(e),
474
+ label: Ge(e),
474
475
  table: e
475
476
  })) || [];
476
- }, [V, X]), tn = A(() => {
477
+ }, [H, X]), tn = j(() => {
477
478
  D?.pivotTableSettings2;
478
- let e = D?.chartType === v.timeSeries, [t, n, r] = J?.value?.split("^^^^^^");
479
- return [...K, ...U?.filter((t) => !(C(t.cast?.value?.toLowerCase() || t.datatype?.toLowerCase()) && e))].filter((e) => e.table?.type === "custom" ? e.table?.alias === r : e.table?.tableName === n && e.table?.schemaName === t)?.map((e) => ({
479
+ let e = D?.chartType === v.timeSeries, [t, n, r] = kt?.value?.split("^^^^^^");
480
+ return [...K, ...W?.filter((t) => !(C(t.cast?.value?.toLowerCase() || t.datatype?.toLowerCase()) && e))].filter((e) => e.table?.type === "custom" ? e.table?.alias === r : e.table?.tableName === n && e.table?.schemaName === t)?.map((e) => ({
480
481
  value: `${e.parentAlias}^^^^^^${e.name || e.alias}^^^^^^${e.datatype}^^^^^^${e?.table?.schemaName}^^^^^^${e.table?.tableName}^^^^^^new`,
481
482
  label: `${Ee(e) || e?.alias}`,
482
483
  badge: "New",
@@ -485,14 +486,14 @@ var xt = {
485
486
  }, [
486
487
  D?.pivotTableSettings2,
487
488
  D.chartType,
488
- J?.value,
489
+ kt?.value,
489
490
  K,
490
- U
491
- ]), nn = A(() => {
492
- if (!z) return [];
493
- let e = V?.table?.joins?.map((e) => X?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], t = X?.find((e) => Je ? e?.tableName === V?.table?.name : e?.tableName === V?.table?.name && e?.schemaName === V?.table?.schema);
491
+ W
492
+ ]), nn = j(() => {
493
+ if (!B) return [];
494
+ let e = H?.table?.joins?.map((e) => X?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], t = X?.find((e) => P ? e?.tableName === H?.table?.name : e?.tableName === H?.table?.name && e?.schemaName === H?.table?.schema);
494
495
  return (t ? [...e, t] : [...e]).flatMap((e) => {
495
- let t = X?.find((t) => Je ? t?.tableName === e?.tableName : t?.tableName === e?.tableName && t?.schemaName === e?.schemaName) || e, n = t?.type === "custom" ? t?.alias || "dbn_sql_table" : `${x(t?.schemaName, E)}_${t?.tableName?.replaceAll(" ", "_")?.replace("*", "_")}`;
496
+ let t = X?.find((t) => P ? t?.tableName === e?.tableName : t?.tableName === e?.tableName && t?.schemaName === e?.schemaName) || e, n = t?.type === "custom" ? t?.alias || "dbn_sql_table" : `${x(t?.schemaName, E)}_${t?.tableName?.replaceAll(" ", "_")?.replace("*", "_")}`;
496
497
  return t?.columnsWithDataType?.map((e) => ({
497
498
  alias: $e(e),
498
499
  label: e?.label || e?.dataMartColumnAlias || e?.name,
@@ -516,17 +517,17 @@ var xt = {
516
517
  });
517
518
  }, [
518
519
  E,
519
- V?.table,
520
+ H?.table,
520
521
  X
521
- ]), rn = A(() => {
522
- let [e, t, n, r] = J?.value?.split("^^^^^^"), i = r === "custom" ? n || "dbn_sql_table" : `${x(e, E)}_${t?.replaceAll(" ", "_")?.replace("*", "_")}`, a = $t?.filter((e) => {
522
+ ]), rn = j(() => {
523
+ let [e, t, n, r] = kt?.value?.split("^^^^^^"), i = r === "custom" ? n || "dbn_sql_table" : `${x(e, E)}_${t?.replaceAll(" ", "_")?.replace("*", "_")}`, a = $t?.filter((e) => {
523
524
  let [t, n] = e?.value?.split("^^^^^^");
524
- return ![...U, ...K].some((e) => t === e?.parentAlias && n === e?.name && !e?.helperFunction);
525
+ return ![...W, ...K].some((e) => t === e?.parentAlias && n === e?.name && !e?.helperFunction);
525
526
  })?.map((e) => ({
526
527
  ...e,
527
528
  badge: "Default"
528
- })), o = [...K, ...U].filter((r) => r?.table?.type === "custom" ? r?.table?.alias === n : r?.table?.tableName === t && r?.table?.schemaName === e)?.map((e) => {
529
- let t = Dt(e);
529
+ })), o = [...K, ...W].filter((r) => r?.table?.type === "custom" ? r?.table?.alias === n : r?.table?.tableName === t && r?.table?.schemaName === e)?.map((e) => {
530
+ let t = Et(e);
530
531
  return {
531
532
  value: `${e?.parentAlias}^^^^^^${e?.name || e?.alias}^^^^^^${t}^^^^^^${e?.table?.schemaName}^^^^^^${e?.table?.tableName}^^^^^^${e?.helperFunction}^^^^^^${e?.alias}^^^^^^${e?.configType}^^^^^^${e?.isApplyTimezone}`,
532
533
  label: `${Ee(e)}`,
@@ -545,9 +546,9 @@ var xt = {
545
546
  return [...a, ...o];
546
547
  }, [
547
548
  K,
548
- U,
549
+ W,
549
550
  $t,
550
- J
551
+ kt
551
552
  ]), an = (e, t) => {
552
553
  let n = e?.cast?.value === "NONE" ? void 0 : e?.cast?.value, r = t || n || e?.datatype;
553
554
  if (r) {
@@ -565,7 +566,7 @@ var xt = {
565
566
  }, Q = (e) => {
566
567
  let t = /* @__PURE__ */ new Map();
567
568
  return [
568
- ...U,
569
+ ...W,
569
570
  ...K,
570
571
  ...e || []
571
572
  ].forEach((e) => {
@@ -588,38 +589,38 @@ var xt = {
588
589
  ].includes(t), l = oe.includes(n) || n?.startsWith("decimal") || n?.startsWith("numeric");
589
590
  return r ? "NULL" : t === "BETWEEN" ? "DATE_RANGE" : o ? "INPUT_TEXT_FIELD" : s && (a && !i || c) ? "TIME_FILTER" : l && !r ? i ? "MULTI_FILTER_DROPDOWN" : "INPUT_NUMBER_FIELD" : i ? "MULTI_FILTER_DROPDOWN" : "FILTER_DROPDOWN";
590
591
  }, un = (e) => {
591
- if (e) return B?.find((t) => e?.type === "custom" || t?.type === "custom" ? t?.alias === e?.alias : t?.schemaName === e?.schemaName && t?.tableName === e?.tableName);
592
+ if (e) return V?.find((t) => e?.type === "custom" || t?.type === "custom" ? t?.alias === e?.alias : t?.schemaName === e?.schemaName && t?.tableName === e?.tableName);
592
593
  }, dn = (e) => {
593
594
  let t = (e) => e?.schema ? `${e.schema}.${e.name}` : e?.name || "", n = (e) => e?.schemaName ? `${e.schemaName}.${e.tableName}` : e?.tableName || "", r = e?.table?.type === "custom" || !!Fe({
594
- candidates: B || [],
595
+ candidates: V || [],
595
596
  getName: n,
596
597
  target: t(e?.table),
597
- companyTenancyType: Y,
598
+ companyTenancyType: Bt,
598
599
  dbName: E
599
600
  }), i = (e?.table?.joins || []).every((e) => !!Fe({
600
- candidates: B || [],
601
+ candidates: V || [],
601
602
  getName: n,
602
603
  target: t(e),
603
- companyTenancyType: Y,
604
+ companyTenancyType: Bt,
604
605
  dbName: E
605
- })), a = _?.relationships || [], o = Ne(e?.table?.joins || [], a, !0, Y, E, e?.table), s = je(Tt(e, a), _?.tableList || [], !0, Y, E);
606
+ })), a = _?.relationships || [], o = Ne(e?.table?.joins || [], a, !0, Bt, E, e?.table), s = je(wt(e, a), _?.tableList || [], !0, Bt, E);
606
607
  return {
607
608
  isValid: r && i && o && s,
608
609
  tableExists: r,
609
610
  joinsExist: i,
610
611
  relationshipPresent: o,
611
612
  columnPresent: s,
612
- tenancyType: Y
613
+ tenancyType: Bt
613
614
  };
614
615
  }, fn = () => {
615
- ze(""), M(!1), B?.length ? gt(B?.[0]) : gt(void 0), k([]), Pt([]), It([]), W([]), q([]), H(be), T((e) => ({
616
+ Re(""), A(!1), V?.length ? ht(V?.[0]) : ht(void 0), O([]), Pt([]), Ft([]), G([]), J([]), U(be), T((e) => ({
616
617
  ...e,
617
618
  isDynamicSeries: !1,
618
619
  seriesField: "ungrouped",
619
620
  seriesOptions: []
620
621
  }));
621
622
  }, pn = ({ chartType: e, chartDimensions: t, chartMetrics: n, chartAggregateColumns: r, resultData: i, configAggregates: a, pivotHeaderColumns: o, chartTimeColumns: s, seriesName: c, isRemoveGroupBy: l }) => {
622
- let u = t ?? cn(Q(U), i || N), d = n ?? cn(Q(K), i || N), f = r ?? cn(Q(K.filter((e) => e.configType === "AGGREGATE")), i || N), p = ae;
623
+ let u = t ?? cn(Q(W), i || N), d = n ?? cn(Q(K), i || N), f = r ?? cn(Q(K.filter((e) => e.configType === "AGGREGATE")), i || N), p = ae;
623
624
  if ([
624
625
  v.progressBar,
625
626
  v.linearGauge,
@@ -680,8 +681,8 @@ var xt = {
680
681
  dimensions: u,
681
682
  headers: o || [],
682
683
  measures: f,
683
- dims: t || Q(U) || [],
684
- aggregates: a || V.aggregates || []
684
+ dims: t || Q(W) || [],
685
+ aggregates: a || H.aggregates || []
685
686
  },
686
687
  dateColumns: s
687
688
  })), p = {
@@ -692,8 +693,8 @@ var xt = {
692
693
  dimensions: u,
693
694
  headers: o || [],
694
695
  measures: f,
695
- dims: t || Q(U) || [],
696
- aggregates: a || V.aggregates || []
696
+ dims: t || Q(W) || [],
697
+ aggregates: a || H.aggregates || []
697
698
  },
698
699
  dateColumns: s
699
700
  };
@@ -704,8 +705,8 @@ var xt = {
704
705
  ...D.pivotTableSettings3,
705
706
  columns: [...u, ...d],
706
707
  rows: o || [],
707
- dims: t || Q(U) || [],
708
- aggregates: a || V.aggregates || []
708
+ dims: t || Q(W) || [],
709
+ aggregates: a || H.aggregates || []
709
710
  },
710
711
  dateColumns: s
711
712
  })), p = {
@@ -715,8 +716,8 @@ var xt = {
715
716
  ...D.pivotTableSettings3,
716
717
  columns: [...u, ...d],
717
718
  rows: o || [],
718
- dims: t || Q(U) || [],
719
- aggregates: a || V.aggregates || []
719
+ dims: t || Q(W) || [],
720
+ aggregates: a || H.aggregates || []
720
721
  },
721
722
  dateColumns: s
722
723
  };
@@ -853,8 +854,8 @@ var xt = {
853
854
  isMultiDimension: !l && !!(c || e?.seriesField && e?.seriesField !== "ungrouped")
854
855
  }));
855
856
  }, mn = () => {
856
- if (!P?.isEnableGroupBy || !P?.configV2?.isEnable) return;
857
- let e = P.configV2.levels?.find((e) => e?.isEnable) || P.configV2.levels?.[0], t = [...e?.dimensions || [], ...e?.measures || []];
857
+ if (!F?.isEnableGroupBy || !F?.configV2?.isEnable) return;
858
+ let e = F.configV2.levels?.find((e) => e?.isEnable) || F.configV2.levels?.[0], t = [...e?.dimensions || [], ...e?.measures || []];
858
859
  return t.length ? t : void 0;
859
860
  }, hn = (e) => {
860
861
  let t = mn();
@@ -864,14 +865,14 @@ var xt = {
864
865
  ...e,
865
866
  dimensions: n,
866
867
  aggregates: r,
867
- orders: Ot(e?.orders || [], t)
868
+ orders: Dt(e?.orders || [], t)
868
869
  };
869
870
  }, $ = ({ prevConfiguration: n, onSuccess: i, prevLimit: a, chartFieldParams: o, updatedDims: s, updatedMetrics: d, selectedMainTable: p, isTimeseriesAction: h, isPivotAction: g, isGroupByAction: ee, isAddComparisonAction: ne, sqlChartType: re, updatedSqlColumnList: ie, updatedTable: ae, isRemoveGroupBy: oe, queryConfiguration: se }) => {
870
- let ce = !!se, y = P?.isEnableGroupBy && P?.configV2?.isEnable ? m({
871
- config: P.configV2,
872
- selectedDims: s || U,
871
+ let ce = !!se, y = F?.isEnableGroupBy && F?.configV2?.isEnable ? m({
872
+ config: F.configV2,
873
+ selectedDims: s || W,
873
874
  selectedMetrics: d || K,
874
- previousSelectedDims: U,
875
+ previousSelectedDims: W,
875
876
  previousSelectedMetrics: K
876
877
  }) : !1;
877
878
  ne || T((e) => ({
@@ -885,7 +886,7 @@ var xt = {
885
886
  v.row,
886
887
  v.horizontalStack
887
888
  ].includes(ue);
888
- fe && Ct({
889
+ fe && St({
889
890
  data: [],
890
891
  error: "",
891
892
  isLoading: !1,
@@ -898,12 +899,12 @@ var xt = {
898
899
  ...se,
899
900
  isAllClient: !1
900
901
  } : void 0;
901
- b && H(b);
902
+ b && U(b);
902
903
  let ye = {
903
904
  selectedTable: ae || Qt,
904
905
  selectedJoins: [],
905
906
  configuration: {
906
- ...b || V,
907
+ ...b || H,
907
908
  limit: a || He
908
909
  },
909
910
  clientColumn: {
@@ -929,30 +930,30 @@ var xt = {
929
930
  selectedManageColumns: [],
930
931
  selectedNewManageColumns: [],
931
932
  createdFilters: Nt,
932
- createdSorts: Ft,
933
+ createdSorts: Y,
933
934
  comparisonLagSettings: Se,
934
935
  selectedCustomGroups: [],
935
936
  selectedGroupColumns: [],
936
- metrics: (b || V).aggregates?.map((e) => ({
937
+ metrics: (b || H).aggregates?.map((e) => ({
937
938
  as: e.alias,
938
939
  value: e.columnName
939
940
  })) || [],
940
- selectedDimensions: (b || V).aggregates.length && (b || V).dimensions?.map((e) => e.alias) || [],
941
+ selectedDimensions: (b || H).aggregates.length && (b || H).dimensions?.map((e) => e.alias) || [],
941
942
  newDatasetSettings: {
942
943
  configuration: {
943
- ...b || V,
944
+ ...b || H,
944
945
  limit: a || He
945
946
  },
946
- metrics: (b || V).aggregates?.map((e) => ({
947
+ metrics: (b || H).aggregates?.map((e) => ({
947
948
  as: e.alias,
948
949
  value: e.columnName
949
950
  })) || [],
950
- selectedDimensions: (b || V).dimensions?.map((e) => e.alias) || [],
951
+ selectedDimensions: (b || H).dimensions?.map((e) => e.alias) || [],
951
952
  selectedGroupBy: [],
952
- selectedDims: s || U,
953
+ selectedDims: s || W,
953
954
  selectedMetrics: d || K,
954
955
  selectedAutoCompleteColumns: [],
955
- selectedMainTable: p || z,
956
+ selectedMainTable: p || B,
956
957
  type: "NEW",
957
958
  sqlColumnList: ie || [],
958
959
  isSqlMode: !1,
@@ -962,17 +963,17 @@ var xt = {
962
963
  isAutoCompleteMode: !1,
963
964
  isDataMartQuery: !1
964
965
  }
965
- }, be = P?.isEnableGroupBy && P?.configV2?.isEnable && !y ? ve({
966
- config: P.configV2,
966
+ }, be = F?.isEnableGroupBy && F?.configV2?.isEnable && !y ? ve({
967
+ config: F.configV2,
967
968
  selectedDims: ye.newDatasetSettings?.selectedDims,
968
969
  selectedMetrics: ye.newDatasetSettings?.selectedMetrics,
969
- previousSelectedDims: U,
970
+ previousSelectedDims: W,
970
971
  previousSelectedMetrics: K
971
972
  }) : void 0;
972
- if (Ge(ye), R(""), M(!0), k([]), be && Ze((e) => ({
973
+ if (Ue(ye), z(""), A(!0), O([]), be && Xe((e) => ({
973
974
  ...e,
974
975
  configV2: be
975
- })), y && Ze((e) => ({
976
+ })), y && Xe((e) => ({
976
977
  ...e,
977
978
  isEnableGroupBy: !1,
978
979
  isEnableCrossFilter: !1,
@@ -983,9 +984,9 @@ var xt = {
983
984
  fn();
984
985
  return;
985
986
  }
986
- let S = _e || b || V, xe = [], Ce = [], we = [];
987
+ let S = _e || b || H, xe = [], Ce = [], we = [];
987
988
  if (fe) {
988
- let e = D.pivotTableSettings2?.headers || [], { headerColumns: t, nonHeaderColumns: n } = (s || U).reduce((t, n) => (e.some((e) => on(n, e)) ? t.headerColumns.push(n) : t.nonHeaderColumns.push(n), t), {
989
+ let e = D.pivotTableSettings2?.headers || [], { headerColumns: t, nonHeaderColumns: n } = (s || W).reduce((t, n) => (e.some((e) => on(n, e)) ? t.headerColumns.push(n) : t.nonHeaderColumns.push(n), t), {
989
990
  headerColumns: [],
990
991
  nonHeaderColumns: []
991
992
  });
@@ -999,8 +1000,8 @@ var xt = {
999
1000
  ...S,
1000
1001
  dimensions: a,
1001
1002
  aggregates: i,
1002
- orders: G(S?.orders || [], r)
1003
- }, H(S);
1003
+ orders: q(S?.orders || [], r)
1004
+ }, U(S);
1004
1005
  }
1005
1006
  let Ee = {
1006
1007
  chartDimensions: o?.chartDimensions,
@@ -1009,12 +1010,12 @@ var xt = {
1009
1010
  pivotHeaderColumns: Q(we)
1010
1011
  }, De = [], Oe = [];
1011
1012
  if (pe) {
1012
- let e = D?.seriesField || "", t = D?.timeSeriesSettings?.groupBySettings?.value || "montly", n = e && e !== "ungrouped", r = (s || U).find((e) => {
1013
+ let e = D?.seriesField || "", t = D?.timeSeriesSettings?.groupBySettings?.value || "montly", n = e && e !== "ungrouped", r = (s || W).find((e) => {
1013
1014
  let t = e.cast?.value && e?.cast?.value !== "NONE" ? e.cast.value : e.datatype || "";
1014
1015
  return C(t);
1015
1016
  });
1016
1017
  if (!r) {
1017
- R("Date column is not found for Timeseries chart"), M(!1), k([]), ze("");
1018
+ z("Date column is not found for Timeseries chart"), A(!1), O([]), Re("");
1018
1019
  return;
1019
1020
  }
1020
1021
  let i = {
@@ -1025,8 +1026,8 @@ var xt = {
1025
1026
  value: t
1026
1027
  }, E) }
1027
1028
  };
1028
- W((e) => e?.map((e) => e.alias === r.alias ? i : e));
1029
- let a = n ? sn(s || U, e) : void 0, o = a ? [i, a] : [i];
1029
+ G((e) => e?.map((e) => e.alias === r.alias ? i : e));
1030
+ let a = n ? sn(s || W, e) : void 0, o = a ? [i, a] : [i];
1030
1031
  De = o, Oe = d || K;
1031
1032
  let c = [...o, ...Oe], { aggregates: l, dimensions: u } = w(c), f = [{
1032
1033
  method: "ASC",
@@ -1037,8 +1038,8 @@ var xt = {
1037
1038
  ...S,
1038
1039
  dimensions: u,
1039
1040
  aggregates: l,
1040
- orders: G([...f, ...Ot(S?.orders || [], c).filter((e) => e?.name !== r?.alias && !f.some((t) => t?.name === e?.name))], c)
1041
- }, H(S);
1041
+ orders: q([...f, ...Dt(S?.orders || [], c).filter((e) => e?.name !== r?.alias && !f.some((t) => t?.name === e?.name))], c)
1042
+ }, U(S);
1042
1043
  }
1043
1044
  let ke = {
1044
1045
  chartDimensions: Q(De),
@@ -1046,23 +1047,23 @@ var xt = {
1046
1047
  chartAggregateColumns: Q(Oe.filter((e) => e.configType === "AGGREGATE"))
1047
1048
  }, je = [], Me = [];
1048
1049
  if (me) {
1049
- let e = D?.seriesField || "", t = e && e !== "ungrouped" ? sn(s || U, e) : void 0, n = (s || U)?.[0], r = t && t !== n ? [n, t] : [n];
1050
+ let e = D?.seriesField || "", t = e && e !== "ungrouped" ? sn(s || W, e) : void 0, n = (s || W)?.[0], r = t && t !== n ? [n, t] : [n];
1050
1051
  Me = d || K, je = r;
1051
1052
  let i = [...r, ...Me], { aggregates: a, dimensions: o } = w(i);
1052
1053
  S = {
1053
1054
  ...S,
1054
1055
  dimensions: o,
1055
1056
  aggregates: a,
1056
- orders: G(S?.orders || [], i),
1057
+ orders: q(S?.orders || [], i),
1057
1058
  isApplyMetricFilter: !0,
1058
- rlsConditions: (b || V)?.rlsConditions || []
1059
- }, H(S);
1059
+ rlsConditions: (b || H)?.rlsConditions || []
1060
+ }, U(S);
1060
1061
  }
1061
1062
  let Ne = {
1062
1063
  chartDimensions: Q(je),
1063
1064
  chartMetrics: Q(Me),
1064
1065
  chartAggregateColumns: Q(Me.filter((e) => e.configType === "AGGREGATE"))
1065
- }, Pe = B?.find((e) => e.tableName === S?.table?.name && e.schemaName === S?.table?.schema), Fe = S?.table?.joins?.map((e) => B?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], Ie = (Pe ? [...Fe || [], Pe] : Fe)?.map((e) => ({
1066
+ }, Pe = V?.find((e) => e.tableName === S?.table?.name && e.schemaName === S?.table?.schema), Fe = S?.table?.joins?.map((e) => V?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter((e) => e) || [], Ie = (Pe ? [...Fe || [], Pe] : Fe)?.map((e) => ({
1066
1067
  name: e?.clientColumn || "",
1067
1068
  datatype: e?.columnsWithDataType?.find((t) => t.name === e?.clientColumn)?.dataType || "",
1068
1069
  table: e
@@ -1073,7 +1074,7 @@ var xt = {
1073
1074
  method: "=",
1074
1075
  parentAlias: `${x(t?.table?.schemaName || "", E)}_${t?.table?.tableName}`,
1075
1076
  type: "client",
1076
- value: Xe === "NUMBER" ? Number(e) : e,
1077
+ value: Ye === "NUMBER" ? Number(e) : e,
1077
1078
  relationOperator: "AND",
1078
1079
  isApplyTimezone: !1
1079
1080
  })) || [];
@@ -1083,34 +1084,34 @@ var xt = {
1083
1084
  dbName: E,
1084
1085
  orderCount: S?.orders?.length || 0,
1085
1086
  dimensionCount: S?.dimensions?.length || 0
1086
- }), R("Error: Select list must be in order by clause if distinct is used"), k([]), M(!1);
1087
+ }), z("Error: Select list must be in order by clause if distinct is used"), O([]), A(!1);
1087
1088
  return;
1088
1089
  }
1089
- let O = dn(S);
1090
- if (!O.isValid) {
1090
+ let k = dn(S);
1091
+ if (!k.isValid) {
1091
1092
  l("generate-metric-blocked", {
1092
1093
  reason: "INVALID_DATASET_CONFIG",
1093
- tableExists: O.tableExists,
1094
- joinsExist: O.joinsExist,
1095
- relationshipPresent: O.relationshipPresent,
1096
- columnPresent: O.columnPresent,
1097
- tenancyType: O.tenancyType,
1098
- subsetTableCount: B?.length || 0,
1094
+ tableExists: k.tableExists,
1095
+ joinsExist: k.joinsExist,
1096
+ relationshipPresent: k.relationshipPresent,
1097
+ columnPresent: k.columnPresent,
1098
+ tenancyType: k.tenancyType,
1099
+ subsetTableCount: V?.length || 0,
1099
1100
  ...u(S)
1100
1101
  });
1101
- let e = r(At(O, S, _?.tableList || [], _?.relationships || []), { surface: "builder" });
1102
- c("metric.builder_validation_failed", { error_code: e.code }), dt("builder", e, void 0, { metricId: I }), R(e), k([]), ze(""), M(!1);
1102
+ let e = r(jt(k, S, _?.tableList || [], _?.relationships || []), { surface: "builder" });
1103
+ c("metric.builder_validation_failed", { error_code: e.code }), ut("builder", e, void 0, { metricId: L }), z(e), O([]), Re(""), A(!1);
1103
1104
  return;
1104
1105
  }
1105
- let Re = Date.now();
1106
+ let ze = Date.now();
1106
1107
  l("generate-metric-start", {
1107
1108
  hasWorkspaceId: !!qe,
1108
- hasDatasourceId: !!Qe,
1109
+ hasDatasourceId: !!Ze,
1109
1110
  hasToken: !!Ke,
1110
1111
  chartType: ue,
1111
1112
  limit: a || He,
1112
1113
  clientColumnFilterCount: Le?.length || 0,
1113
- isDatabaseTenancy: !!Je,
1114
+ isDatabaseTenancy: !!P,
1114
1115
  ...u(S)
1115
1116
  }), Ut({
1116
1117
  data: {
@@ -1121,38 +1122,38 @@ var xt = {
1121
1122
  limit: a || He
1122
1123
  },
1123
1124
  id: qe,
1124
- datasourceId: Qe,
1125
- dashboardId: tt,
1125
+ datasourceId: Ze,
1126
+ dashboardId: Qe,
1126
1127
  isCreateMetric: !0
1127
1128
  },
1128
1129
  token: Ke
1129
1130
  }, {
1130
1131
  onSuccess(e) {
1131
1132
  let t = e?.error, n = e?.data, r = e?.query;
1132
- r &&= de(r, nt || "");
1133
+ r &&= de(r, tt || "");
1133
1134
  let a = e?.metaData;
1134
1135
  if (t || Wt) l("generate-metric-failed", {
1135
1136
  source: "response-error",
1136
- durationMs: Date.now() - Re,
1137
+ durationMs: Date.now() - ze,
1137
1138
  hasGenerateError: !!Wt,
1138
1139
  ...f(t || Wt)
1139
- }), R(kt(t || Wt, dt, I)), M(!1), k([]), ze("");
1140
+ }), z(Ot(t || Wt, ut, L)), A(!1), O([]), Re("");
1140
1141
  else {
1141
1142
  if (n && r || l("generate-metric-indeterminate", {
1142
- durationMs: Date.now() - Re,
1143
+ durationMs: Date.now() - ze,
1143
1144
  hasResult: !!n,
1144
1145
  hasOutputQuery: !!r,
1145
1146
  hasMetaData: !!a
1146
1147
  }), n && r) {
1147
1148
  l("generate-metric-success", {
1148
- durationMs: Date.now() - Re,
1149
+ durationMs: Date.now() - ze,
1149
1150
  rowCount: Array.isArray(n) ? n.length : 0,
1150
1151
  columnCount: Object.keys(n?.[0] || {}).length,
1151
1152
  queryLength: r?.length || 0,
1152
1153
  chartType: ue
1153
- }), R(""), M(!1);
1154
- let e = [...S?.aggregates?.map((e) => e?.alias), ...S?.dimensions?.map((e) => e?.alias)], t = (t) => Array.isArray(t) ? E?.toLowerCase() === "redshift" ? he(e, t) : t : [], i = te(n, s || U, d || K);
1155
- i = t(i), i = Ue(i), k(() => i), pn(fe ? {
1154
+ }), z(""), A(!1);
1155
+ let e = [...S?.aggregates?.map((e) => e?.alias), ...S?.dimensions?.map((e) => e?.alias)], t = (t) => Array.isArray(t) ? E?.toLowerCase() === "redshift" ? he(e, t) : t : [], i = te(n, s || W, d || K);
1156
+ i = t(i), i = We(i), O(() => i), pn(fe ? {
1156
1157
  ...Ee,
1157
1158
  resultData: i,
1158
1159
  configAggregates: b?.aggregates,
@@ -1171,7 +1172,7 @@ var xt = {
1171
1172
  chartTimeColumns: o?.chartTimeColumns,
1172
1173
  seriesName: o?.seriesName,
1173
1174
  isRemoveGroupBy: oe
1174
- }), ne || ze(r), Ve?.(ge(a?.groupbyColumnList));
1175
+ }), ne || Re(r), Ve?.(ge(a?.groupbyColumnList));
1175
1176
  }
1176
1177
  i?.();
1177
1178
  }
@@ -1179,13 +1180,13 @@ var xt = {
1179
1180
  onError(e) {
1180
1181
  l("generate-metric-failed", {
1181
1182
  source: "network",
1182
- durationMs: Date.now() - Re,
1183
+ durationMs: Date.now() - ze,
1183
1184
  ...f(e)
1184
- }), R(kt(e, dt, I)), M(!1), k([]), ze("");
1185
+ }), z(Ot(e, ut, L)), A(!1), O([]), Re("");
1185
1186
  }
1186
1187
  });
1187
1188
  }, gn = (e, t) => {
1188
- let n = (e) => B?.find((t) => t.tableName === e), r = (t) => {
1189
+ let n = (e) => V?.find((t) => t.tableName === e), r = (t) => {
1189
1190
  let r = n(t)?.schemaName || e.schemaName;
1190
1191
  return `${x(r, E)}_${t.replaceAll(" ", "_")?.replace("*", "_")}`;
1191
1192
  }, i = /* @__PURE__ */ new Map();
@@ -1249,7 +1250,7 @@ var xt = {
1249
1250
  type: o ? e.type === "custom" ? "custom" : "default" : t.type === "custom" ? "custom" : "default"
1250
1251
  };
1251
1252
  }, vn = ({ column: e, table: t, sorting: n, type: r, identifier: i }) => {
1252
- let o = [...U], c = [...K], l = t.type === "custom" ? t.alias || "dbn_sql_table" : `${x(t?.schemaName, E)}_${t.tableName.replaceAll(" ", "_")?.replace("*", "_")}`;
1253
+ let o = [...W], c = [...K], l = t.type === "custom" ? t.alias || "dbn_sql_table" : `${x(t?.schemaName, E)}_${t.tableName.replaceAll(" ", "_")?.replace("*", "_")}`;
1253
1254
  if (Z) {
1254
1255
  let e = t.type === "custom" ? {
1255
1256
  value: `none^^^^^^${t.sql}^^^^^^${l}^^^^^^custom`,
@@ -1260,18 +1261,18 @@ var xt = {
1260
1261
  label: `${t.schemaName}.${t.tableName}`,
1261
1262
  icon: "table"
1262
1263
  };
1263
- Mt(e), gt(t), W([]), q([]), Pt([]), It([]);
1264
+ At(e), ht(t), G([]), J([]), Pt([]), Ft([]);
1264
1265
  }
1265
- let u = L ? [] : gn(t, bt || []), d = e?.alias || e?.dataMartColumnAlias || e?.name, f = [
1266
+ let u = R ? [] : gn(t, yt || []), d = e?.alias || e?.dataMartColumnAlias || e?.name, f = [
1266
1267
  "dimensions",
1267
1268
  "metrics",
1268
1269
  "aggregate_dimensions",
1269
1270
  "aggregate_metrics"
1270
- ].includes(i?.type || ""), p = f ? [...U, ...K].find((e) => e?.alias === i?.id) : void 0, m = r === "METRIC" ? me({
1271
+ ].includes(i?.type || ""), p = f ? [...W, ...K].find((e) => e?.alias === i?.id) : void 0, m = r === "METRIC" ? me({
1271
1272
  allowAggregate: e?.allowAggregate,
1272
1273
  defaultAggregation: e?.defaultAggregation
1273
1274
  }) : void 0, h = r === "METRIC" && m && !f ? `${re(`${m.toLowerCase()} of`, E || "")} ${e?.dataMartColumnAlias || e?.name}` : d;
1274
- i?.type === "column" && [...U, ...K].some((e) => h === e?.alias) && (h = `${h}_${pe(4)?.toLowerCase()}`), h = E?.toLowerCase() === "opensearch" ? h.replaceAll(" ", "_")?.replace("*", "_") : h;
1275
+ i?.type === "column" && [...W, ...K].some((e) => h === e?.alias) && (h = `${h}_${pe(4)?.toLowerCase()}`), h = E?.toLowerCase() === "opensearch" ? h.replaceAll(" ", "_")?.replace("*", "_") : h;
1275
1276
  let g = {
1276
1277
  uniqueId: pe(10),
1277
1278
  alias: h,
@@ -1279,7 +1280,7 @@ var xt = {
1279
1280
  isApplyTimezone: e.isApplyTimezone,
1280
1281
  datatype: e.dataType,
1281
1282
  dropType: r,
1282
- index: r === "DIMENSION" ? U.length : K.length,
1283
+ index: r === "DIMENSION" ? W.length : K.length,
1283
1284
  name: e?.type === "custom" && E?.toLowerCase() === "opensearch" ? e?.name?.replaceAll(" ", "_")?.replace("*", "_") : e?.name,
1284
1285
  parentAlias: l,
1285
1286
  table: t,
@@ -1302,28 +1303,28 @@ var xt = {
1302
1303
  };
1303
1304
  switch (r) {
1304
1305
  case "DIMENSION":
1305
- W((t) => {
1306
+ G((t) => {
1306
1307
  let r = t.findIndex((e) => e.alias === h);
1307
- i?.type === "metrics" && q((t) => (c = [...t.filter((t) => t.alias !== h && t.alias !== e.dataMartColumnAlias)], c));
1308
+ i?.type === "metrics" && J((t) => (c = [...t.filter((t) => t.alias !== h && t.alias !== e.dataMartColumnAlias)], c));
1308
1309
  let a = Z ? [g] : r === -1 ? [...t, g] : t;
1309
1310
  if (n) {
1310
1311
  let { before: e, after: t } = n.sortingIndexes;
1311
1312
  return o = [...n.ArrayElementSwap(e, t, a)], o;
1312
1313
  }
1313
1314
  return o = [...a], a;
1314
- }), it?.(a, h);
1315
+ }), nt?.(a, h);
1315
1316
  break;
1316
1317
  case "METRIC":
1317
- q((t) => {
1318
+ J((t) => {
1318
1319
  let r = t.findIndex((e) => e.alias === h);
1319
- i?.type === "dimensions" && W((t) => (o = [...t.filter((t) => t.alias !== h && t.alias !== e.dataMartColumnAlias)], o));
1320
+ i?.type === "dimensions" && G((t) => (o = [...t.filter((t) => t.alias !== h && t.alias !== e.dataMartColumnAlias)], o));
1320
1321
  let a = Z ? [g] : r === -1 ? [...t, g] : t;
1321
1322
  if (n) {
1322
1323
  let { before: e, after: t } = n.sortingIndexes;
1323
1324
  return c = [...n.ArrayElementSwap(e, t, a)], c;
1324
1325
  }
1325
1326
  return c = [...a], a;
1326
- }), it?.(s, h);
1327
+ }), nt?.(s, h);
1327
1328
  break;
1328
1329
  default: console.warn("Invalid Drop");
1329
1330
  }
@@ -1335,39 +1336,39 @@ var xt = {
1335
1336
  v.horizontalStack
1336
1337
  ].includes(D?.chartType), te = Z ? r === "DIMENSION" ? [g] : [] : o, _ = Z ? r === "METRIC" ? [g] : [] : c, ne, ie = !1;
1337
1338
  ee && (te.length === 2 && _.length === 1 ? ne = Q([te[1]])?.[0] : ie = !0);
1338
- let ae = Z ? [g] : [...o, ...c], { aggregates: oe, dimensions: se } = w(ae), ce = !Z && L && V?.table?.name !== t.tableName, y = {
1339
- ...V,
1339
+ let ae = Z ? [g] : [...o, ...c], { aggregates: oe, dimensions: se } = w(ae), ce = !Z && R && H?.table?.name !== t.tableName, y = {
1340
+ ...H,
1340
1341
  dimensions: se,
1341
1342
  aggregates: oe,
1342
- orders: G(V?.orders || [], ae),
1343
+ orders: q(H?.orders || [], ae),
1343
1344
  table: Z ? {
1344
1345
  alias: l,
1345
1346
  id: t.id,
1346
- joins: Z ? u : V.table.joins,
1347
+ joins: Z ? u : H.table.joins,
1347
1348
  name: t.type === "custom" ? t.sql || "" : t.tableName,
1348
1349
  schema: t.schemaName,
1349
1350
  type: t.type === "custom" ? "custom" : "default"
1350
- } : V.table
1351
- }, le = B?.find((e) => e.tableName === V?.table?.name);
1352
- if (ce && le && !V?.table?.joins?.length) y = {
1351
+ } : H.table
1352
+ }, le = V?.find((e) => e.tableName === H?.table?.name);
1353
+ if (ce && le && !H?.table?.joins?.length) y = {
1353
1354
  ...y,
1354
- table: _n(le, t, bt || [])
1355
+ table: _n(le, t, yt || [])
1355
1356
  };
1356
- else if (Bt && ce && V?.table?.joins?.length && t.type !== "custom") {
1357
- let e = at(V.table, {
1357
+ else if (zt && ce && H?.table?.joins?.length && t.type !== "custom") {
1358
+ let e = at(H.table, {
1358
1359
  name: t.tableName,
1359
1360
  schema: t.schemaName,
1360
1361
  alias: l
1361
- }, bt || []);
1362
+ }, yt || []);
1362
1363
  e && (y = {
1363
1364
  ...y,
1364
1365
  table: {
1365
- ...V.table,
1366
+ ...H.table,
1366
1367
  joins: e.joins
1367
1368
  }
1368
1369
  });
1369
1370
  }
1370
- H(y), $({
1371
+ U(y), $({
1371
1372
  prevConfiguration: y,
1372
1373
  chartFieldParams: {
1373
1374
  chartDimensions: Q(ae.filter((e) => e.dropType === "DIMENSION")),
@@ -1389,14 +1390,14 @@ var xt = {
1389
1390
  generatedAlias: r ? n : void 0
1390
1391
  };
1391
1392
  }, bn = ({ alias: e, column: t, type: n, cast: r, isColumnCasted: i }) => {
1392
- let a = E?.toLowerCase() === "opensearch" ? e.replaceAll(" ", "_")?.replace("*", "_") : e, o = [...U, ...K].filter((e) => e?.alias !== t?.alias).map((e) => e?.alias).filter((e) => !!e), s = xe(a, o, () => pe(4)?.toLowerCase(), { caseInsensitive: E?.toLowerCase() === ie }), c = n === "DIMENSION" ? U?.map((e) => e.alias === t.alias ? {
1393
+ let a = E?.toLowerCase() === "opensearch" ? e.replaceAll(" ", "_")?.replace("*", "_") : e, o = [...W, ...K].filter((e) => e?.alias !== t?.alias).map((e) => e?.alias).filter((e) => !!e), s = xe(a, o, () => pe(4)?.toLowerCase(), { caseInsensitive: E?.toLowerCase() === ie }), c = n === "DIMENSION" ? W?.map((e) => e.alias === t.alias ? {
1393
1394
  ...e,
1394
1395
  alias: s,
1395
1396
  ...yn(e, s),
1396
1397
  cast: r,
1397
1398
  helperFunction: i ? void 0 : e.helperFunction,
1398
1399
  type: i && e.type === "HELPER_FUNCTION" ? "DEFAULT" : e.type
1399
- } : e) : U, l = n === "METRIC" ? K?.map((e) => e.alias === t.alias ? {
1400
+ } : e) : W, l = n === "METRIC" ? K?.map((e) => e.alias === t.alias ? {
1400
1401
  ...e,
1401
1402
  alias: s,
1402
1403
  ...yn(e, s),
@@ -1406,38 +1407,38 @@ var xt = {
1406
1407
  } : e) : K;
1407
1408
  switch (n) {
1408
1409
  case "DIMENSION":
1409
- W(c);
1410
+ G(c);
1410
1411
  break;
1411
1412
  case "METRIC":
1412
- q(l);
1413
+ J(l);
1413
1414
  break;
1414
1415
  default: console.warn("Invalid Drop");
1415
1416
  }
1416
1417
  let u = [...c, ...l], d = ke({
1417
- drillFilters: V.drillFilters || Lt,
1418
- drilldownChartSettings: P?.drilldownChartSettings,
1419
- previousDims: U,
1418
+ drillFilters: H.drillFilters || It,
1419
+ drilldownChartSettings: F?.drilldownChartSettings,
1420
+ previousDims: W,
1420
1421
  selectedDims: c
1421
- }), f = P?.configV2?.levels?.length ? ve({
1422
- config: P.configV2,
1422
+ }), f = F?.configV2?.levels?.length ? ve({
1423
+ config: F.configV2,
1423
1424
  selectedDims: c,
1424
1425
  selectedMetrics: l,
1425
- previousSelectedDims: U,
1426
+ previousSelectedDims: W,
1426
1427
  previousSelectedMetrics: K
1427
- }) : P?.configV2;
1428
- (n === "DIMENSION" || n === "METRIC" && P?.configV2?.levels?.length) && (n === "DIMENSION" && Rt(d.drillFilters || []), Ze((e) => ({
1428
+ }) : F?.configV2;
1429
+ (n === "DIMENSION" || n === "METRIC" && F?.configV2?.levels?.length) && (n === "DIMENSION" && Lt(d.drillFilters || []), Xe((e) => ({
1429
1430
  ...e,
1430
1431
  drilldownChartSettings: n === "DIMENSION" ? d.drilldownChartSettings : e.drilldownChartSettings,
1431
1432
  configV2: f
1432
- }))), It((e) => e.filter((e) => u?.some((t) => t.alias === (e.columnName?.column?.alias || e.columnName?.label))));
1433
+ }))), Ft((e) => e.filter((e) => u?.some((t) => t.alias === (e.columnName?.column?.alias || e.columnName?.label))));
1433
1434
  let { aggregates: p, dimensions: m } = w(u), h = {
1434
- ...V,
1435
+ ...H,
1435
1436
  dimensions: m,
1436
1437
  aggregates: p,
1437
1438
  drillFilters: d.drillFilters,
1438
- orders: G(V?.orders || [], u)
1439
+ orders: q(H?.orders || [], u)
1439
1440
  };
1440
- H(h), $({
1441
+ U(h), $({
1441
1442
  prevConfiguration: h,
1442
1443
  chartFieldParams: {
1443
1444
  chartDimensions: Q(c),
@@ -1449,9 +1450,9 @@ var xt = {
1449
1450
  updatedMetrics: n === "METRIC" ? l : void 0
1450
1451
  });
1451
1452
  }, xn = ({ column: e, helperFunction: t, type: n, functionConfiguration: r, percentileValue: i, partitionBy: a, partitionByColumns: s }) => {
1452
- let c = t.value === "NONE", l = ye?.includes(t?.value || "") && U?.length && U?.[0]?.helperFunction !== "distinct", u = l ? `${re("distinct of", E || "")} ${U?.[0]?.dataMartColumnAlias || U?.[0]?.name}` : "", d = `${c ? e.dataMartColumnAlias || e.name : `${re(`${t.label?.toLowerCase()} of`, E || "")} ${e.dataMartColumnAlias || e.name}`}`, f = n === "DIMENSION" ? U : K;
1453
- [...U, ...K].some((t) => d === t?.alias && !(t?.alias === e?.alias && f.includes(t))) && (d = `${d}_${pe(4)?.toLowerCase()}`), d = E?.toLowerCase() === "opensearch" ? d.replaceAll(" ", "_")?.replace("*", "_") : d, it?.(o, e.dataMartColumnAlias || e.name);
1454
- let p = n === "DIMENSION" ? U?.map((n) => n.alias === e.alias ? {
1453
+ let c = t.value === "NONE", l = ye?.includes(t?.value || "") && W?.length && W?.[0]?.helperFunction !== "distinct", u = l ? `${re("distinct of", E || "")} ${W?.[0]?.dataMartColumnAlias || W?.[0]?.name}` : "", d = `${c ? e.dataMartColumnAlias || e.name : `${re(`${t.label?.toLowerCase()} of`, E || "")} ${e.dataMartColumnAlias || e.name}`}`, f = n === "DIMENSION" ? W : K;
1454
+ [...W, ...K].some((t) => d === t?.alias && !(t?.alias === e?.alias && f.includes(t))) && (d = `${d}_${pe(4)?.toLowerCase()}`), d = E?.toLowerCase() === "opensearch" ? d.replaceAll(" ", "_")?.replace("*", "_") : d, nt?.(o, e.dataMartColumnAlias || e.name);
1455
+ let p = n === "DIMENSION" ? W?.map((n) => n.alias === e.alias ? {
1455
1456
  ...n,
1456
1457
  helperFunction: t.value,
1457
1458
  alias: d,
@@ -1460,13 +1461,13 @@ var xt = {
1460
1461
  configType: "DIMENSION",
1461
1462
  type: c ? "DEFAULT" : "HELPER_FUNCTION",
1462
1463
  functionConfiguration: r
1463
- } : n) : l ? U?.map((e, t) => t === 0 ? {
1464
+ } : n) : l ? W?.map((e, t) => t === 0 ? {
1464
1465
  ...e,
1465
1466
  helperFunction: "distinct",
1466
1467
  alias: u,
1467
1468
  configType: "DIMENSION",
1468
1469
  type: "HELPER_FUNCTION"
1469
- } : e) : U, m = n === "METRIC" ? K?.map((n) => n.alias === e.alias ? {
1470
+ } : e) : W, m = n === "METRIC" ? K?.map((n) => n.alias === e.alias ? {
1470
1471
  ...n,
1471
1472
  helperFunction: t.value,
1472
1473
  alias: d,
@@ -1479,38 +1480,38 @@ var xt = {
1479
1480
  } : n) : K;
1480
1481
  switch (n) {
1481
1482
  case "DIMENSION":
1482
- W(p);
1483
+ G(p);
1483
1484
  break;
1484
1485
  case "METRIC":
1485
- l && p?.length && W(p), q(m);
1486
+ l && p?.length && G(p), J(m);
1486
1487
  break;
1487
1488
  default: console.warn("Invalid Drop");
1488
1489
  }
1489
1490
  let h = [...p, ...m], g = ke({
1490
- drillFilters: V.drillFilters || Lt,
1491
- drilldownChartSettings: P?.drilldownChartSettings,
1492
- previousDims: U,
1491
+ drillFilters: H.drillFilters || It,
1492
+ drilldownChartSettings: F?.drilldownChartSettings,
1493
+ previousDims: W,
1493
1494
  selectedDims: p
1494
- }), ee = P?.configV2?.levels?.length ? ve({
1495
- config: P.configV2,
1495
+ }), ee = F?.configV2?.levels?.length ? ve({
1496
+ config: F.configV2,
1496
1497
  selectedDims: p,
1497
1498
  selectedMetrics: m,
1498
- previousSelectedDims: U,
1499
+ previousSelectedDims: W,
1499
1500
  previousSelectedMetrics: K
1500
- }) : P?.configV2;
1501
- (n === "DIMENSION" || n === "METRIC" && P?.configV2?.levels?.length) && (n === "DIMENSION" && Rt(g.drillFilters || []), Ze((e) => ({
1501
+ }) : F?.configV2;
1502
+ (n === "DIMENSION" || n === "METRIC" && F?.configV2?.levels?.length) && (n === "DIMENSION" && Lt(g.drillFilters || []), Xe((e) => ({
1502
1503
  ...e,
1503
1504
  drilldownChartSettings: n === "DIMENSION" ? g.drilldownChartSettings : e.drilldownChartSettings,
1504
1505
  configV2: ee
1505
- }))), It((e) => e.filter((e) => h?.some((t) => t.alias === (e.columnName?.column?.alias || e.columnName?.label))));
1506
+ }))), Ft((e) => e.filter((e) => h?.some((t) => t.alias === (e.columnName?.column?.alias || e.columnName?.label))));
1506
1507
  let { aggregates: te, dimensions: _ } = w(h), ne = {
1507
- ...V,
1508
+ ...H,
1508
1509
  dimensions: _,
1509
1510
  aggregates: te,
1510
1511
  drillFilters: g.drillFilters,
1511
- orders: G(V?.orders || [], h)
1512
+ orders: q(H?.orders || [], h)
1512
1513
  };
1513
- H(ne), $({
1514
+ U(ne), $({
1514
1515
  prevConfiguration: ne,
1515
1516
  chartFieldParams: {
1516
1517
  chartDimensions: Q(p),
@@ -1527,12 +1528,12 @@ var xt = {
1527
1528
  return i ? [...n?.filter((e) => !a(e)), r] : [...n, r];
1528
1529
  }, Cn = ({ alias: e, column: t, type: n, editCol: r, editColumn: i }) => {
1529
1530
  if (!t) return;
1530
- let a = E?.toLowerCase() === "opensearch" ? e.replaceAll(" ", "_")?.replace("*", "_") : e, o = i || (r ? (n === "DIMENSION" ? U : K).find((e) => e?.alias === r) : void 0), s = [...U, ...K].filter((e) => o?.uniqueId ? e?.uniqueId !== o.uniqueId : !o || !(e === o || o.arithmeticConfig && e?.arithmeticConfig === o.arithmeticConfig)).map((e) => e?.alias).filter((e) => !!e), c = xe(a, s, () => pe(4)?.toLowerCase(), { caseInsensitive: E?.toLowerCase() === ie }), l = Et(t.firstOperand) ? void 0 : t.firstOperand, u = Et(t.secondOperand) ? void 0 : t.secondOperand, d = l || u;
1531
+ let a = E?.toLowerCase() === "opensearch" ? e.replaceAll(" ", "_")?.replace("*", "_") : e, o = i || (r ? (n === "DIMENSION" ? W : K).find((e) => e?.alias === r) : void 0), s = [...W, ...K].filter((e) => o?.uniqueId ? e?.uniqueId !== o.uniqueId : !o || !(e === o || o.arithmeticConfig && e?.arithmeticConfig === o.arithmeticConfig)).map((e) => e?.alias).filter((e) => !!e), c = xe(a, s, () => pe(4)?.toLowerCase(), { caseInsensitive: E?.toLowerCase() === ie }), l = Tt(t.firstOperand) ? void 0 : t.firstOperand, u = Tt(t.secondOperand) ? void 0 : t.secondOperand, d = l || u;
1531
1532
  if (!d) return;
1532
1533
  let f = {
1533
1534
  uniqueId: o?.uniqueId || pe(10),
1534
1535
  alias: c,
1535
- configType: jt({
1536
+ configType: Mt({
1536
1537
  type: n,
1537
1538
  firstOperand: l,
1538
1539
  secondOperand: u
@@ -1560,7 +1561,7 @@ var xt = {
1560
1561
  listType: "DIMENSION",
1561
1562
  editColumn: o,
1562
1563
  newColumn: f,
1563
- selectedColumns: U
1564
+ selectedColumns: W
1564
1565
  }), m = Sn({
1565
1566
  type: n,
1566
1567
  listType: "METRIC",
@@ -1570,10 +1571,10 @@ var xt = {
1570
1571
  });
1571
1572
  switch (n) {
1572
1573
  case "DIMENSION":
1573
- W(p);
1574
+ G(p);
1574
1575
  break;
1575
1576
  case "METRIC":
1576
- q(m);
1577
+ J(m);
1577
1578
  break;
1578
1579
  default: console.warn("Invalid Drop");
1579
1580
  }
@@ -1603,11 +1604,11 @@ var xt = {
1603
1604
  }
1604
1605
  }));
1605
1606
  let h = [...p, ...m], { aggregates: g, dimensions: ee } = w(h), te = {
1606
- ...V,
1607
+ ...H,
1607
1608
  dimensions: ee,
1608
1609
  aggregates: g
1609
1610
  };
1610
- H(te), $({
1611
+ U(te), $({
1611
1612
  prevConfiguration: te,
1612
1613
  chartFieldParams: {
1613
1614
  chartDimensions: Q(p),
@@ -1648,12 +1649,12 @@ var xt = {
1648
1649
  joins: []
1649
1650
  } : e;
1650
1651
  };
1651
- return Re(() => {
1652
+ return ze(() => {
1652
1653
  let e = _?.error, t = _;
1653
- if (e || !_) R(e ? kt(e, dt, I) : void 0);
1654
+ if (e || !_) z(e ? Ot(e, ut, L) : void 0);
1654
1655
  else if (t?.tableList?.length) {
1655
1656
  let e = t?.tableList || [], n = t?.relationships || [];
1656
- xt(n);
1657
+ bt(n);
1657
1658
  let r = ((e) => {
1658
1659
  let t = Array.from(new Set(e.filter((e) => e.tableName.endsWith("*")).map((e) => e.tableName)));
1659
1660
  if (t.length === 0) return e;
@@ -1721,14 +1722,14 @@ var xt = {
1721
1722
  wildcard: e.wildcard
1722
1723
  };
1723
1724
  }));
1724
- _t(r), r?.length && !I && gt(r?.[0]);
1725
+ gt(r), r?.length && !L && ht(r?.[0]);
1725
1726
  }
1726
1727
  }, [
1727
1728
  _,
1728
- zt?.dataMartTables,
1729
- I
1730
- ]), Re(() => {
1731
- let e = [...U || [], ...K || []].filter((e) => e.transform && e.transform !== "original").map((e) => ({
1729
+ Rt?.dataMartTables,
1730
+ L
1731
+ ]), ze(() => {
1732
+ let e = [...W || [], ...K || []].filter((e) => e.transform && e.transform !== "original").map((e) => ({
1732
1733
  columns: [e.alias || e.name],
1733
1734
  formatter: e.transform,
1734
1735
  prefix: "",
@@ -1746,30 +1747,30 @@ var xt = {
1746
1747
  })()
1747
1748
  }));
1748
1749
  }, [
1749
- U,
1750
+ W,
1750
1751
  K,
1751
1752
  T
1752
- ]), Re(() => {
1753
- if (!F && I && mt && B?.length) {
1754
- let e = B[0];
1755
- gt(e), ot && (M(!0), ut({
1753
+ ]), ze(() => {
1754
+ if (!I && L && pt && V?.length) {
1755
+ let e = V[0];
1756
+ ht(e), it && (A(!0), lt({
1756
1757
  data: {
1757
- query: ot,
1758
- companyId: nt,
1758
+ query: it,
1759
+ companyId: tt,
1759
1760
  workspaceId: qe,
1760
- metricId: I,
1761
+ metricId: L,
1761
1762
  isCustomSql: !0,
1762
1763
  databaseName: E || "",
1763
- datasourceId: Qe
1764
+ datasourceId: Ze
1764
1765
  },
1765
1766
  token: Ke || "",
1766
- isFrontendApp: ct,
1767
- encryptedClientId: lt || ""
1767
+ isFrontendApp: st,
1768
+ encryptedClientId: ct || ""
1768
1769
  }, {
1769
1770
  onSuccess(t) {
1770
1771
  let n = t?.data;
1771
1772
  if (Array.isArray(n) && n.length) {
1772
- k(Ue(n));
1773
+ O(We(n));
1773
1774
  let t = D?.xAxis, r = D?.yAxisList || [], i = e || {}, a = `${x(i?.schemaName || "", E)}_${(i?.tableName || "").replaceAll(" ", "_")?.replace("*", "_")}`, o = (e) => {
1774
1775
  let t = {
1775
1776
  percentile_cont_: "PERCENTILE_CONT",
@@ -1811,36 +1812,36 @@ var xt = {
1811
1812
  label: e
1812
1813
  };
1813
1814
  }, c = [], l = [];
1814
- t && c.push(s(t, "DIMENSION", 0)), r.forEach((e, t) => l.push(s(e, "METRIC", t))), c.length && W(c), l.length && q(l);
1815
+ t && c.push(s(t, "DIMENSION", 0)), r.forEach((e, t) => l.push(s(e, "METRIC", t))), c.length && G(c), l.length && J(l);
1815
1816
  }
1816
- M(!1);
1817
+ A(!1);
1817
1818
  },
1818
1819
  onError() {
1819
- M(!1);
1820
+ A(!1);
1820
1821
  }
1821
- })), ht(!1);
1822
- } else if (F && I && mt && B?.length) {
1823
- let e = F?.configuration || be, t = _?.relationships || [], n = !Ne(e?.table?.joins || [], t, !0, Y, E, e?.table) || !je(Tt(e, t), _?.tableList || [], !0, Y, E), r = F?.newDatasetSettings?.isChatMode || !1, i = Me(F, un), a = i?.newDatasetSettings?.selectedMainTable || (r ? B?.[0] : void 0), o = i?.newDatasetSettings?.selectedDims || [], s = i?.newDatasetSettings?.selectedMetrics || [], c = {
1824
- ...F?.configuration || be,
1825
- rlsConditions: st
1822
+ })), mt(!1);
1823
+ } else if (I && L && pt && V?.length) {
1824
+ let e = I?.configuration || be, t = _?.relationships || [], n = !Ne(e?.table?.joins || [], t, !0, Bt, E, e?.table) || !je(wt(e, t), _?.tableList || [], !0, Bt, E), r = I?.newDatasetSettings?.isChatMode || !1, i = Me(I, un), a = i?.newDatasetSettings?.selectedMainTable || (r ? V?.[0] : void 0), o = i?.newDatasetSettings?.selectedDims || [], s = i?.newDatasetSettings?.selectedMetrics || [], c = {
1825
+ ...I?.configuration || be,
1826
+ rlsConditions: ot
1826
1827
  };
1827
- if (H(c), Pt(F?.createdFilters?.map((e) => ({
1828
+ if (U(c), Pt(I?.createdFilters?.map((e) => ({
1828
1829
  ...e,
1829
1830
  tableName: p(e.tableName),
1830
1831
  columnName: p(e.columnName)
1831
- }))?.filter((e) => e.type !== "client") || []), It(F?.createdSorts?.map((e) => ({
1832
+ }))?.filter((e) => e.type !== "client") || []), Ft(I?.createdSorts?.map((e) => ({
1832
1833
  ...e,
1833
1834
  columnName: p(e.columnName),
1834
1835
  tableName: p(e.tableName)
1835
- })) || []), Mt(F?.selectedTable?.value ? p(F.selectedTable) : {
1836
+ })) || []), At(I?.selectedTable?.value ? p(I.selectedTable) : {
1836
1837
  label: "",
1837
1838
  value: ""
1838
- }), W(o), q(s), gt(a), n && !r) {
1839
- R("Something went wrong! Please try again later."), k([]), ze(""), M(!1), ht(!1);
1839
+ }), G(o), J(s), ht(a), n && !r) {
1840
+ z("Something went wrong! Please try again later."), O([]), Re(""), A(!1), mt(!1);
1840
1841
  return;
1841
1842
  }
1842
1843
  if (r) {
1843
- ht(!1);
1844
+ mt(!1);
1844
1845
  return;
1845
1846
  }
1846
1847
  $({
@@ -1852,27 +1853,27 @@ var xt = {
1852
1853
  chartDimensions: Q(o),
1853
1854
  chartMetrics: Q(s)
1854
1855
  }
1855
- }), ht(!1);
1856
+ }), mt(!1);
1856
1857
  }
1857
1858
  }, [
1858
- F,
1859
1859
  I,
1860
- mt,
1861
- B,
1862
- st,
1860
+ L,
1861
+ pt,
1862
+ V,
1863
+ ot,
1863
1864
  Ke,
1865
+ st,
1864
1866
  ct,
1865
- lt,
1866
- Y,
1867
+ Bt,
1867
1868
  E
1868
1869
  ]), {
1869
- selectedMainTable: z,
1870
+ selectedMainTable: B,
1870
1871
  companySubsetTableList: X,
1871
- setSelectedMainTable: gt,
1872
- pivotDrillState: St,
1873
- setPivotDrillState: Ct,
1874
- configuration: V,
1875
- selectedDims: U,
1872
+ setSelectedMainTable: ht,
1873
+ pivotDrillState: xt,
1874
+ setPivotDrillState: St,
1875
+ configuration: H,
1876
+ selectedDims: W,
1876
1877
  selectedMetrics: K,
1877
1878
  onDropColumn: vn,
1878
1879
  functionOptions: an,
@@ -1883,23 +1884,23 @@ var xt = {
1883
1884
  onChangeAlias: bn,
1884
1885
  onChangeHelperFunction: xn,
1885
1886
  onRemoveColumn: ({ column: e, type: t }) => {
1886
- let n = Ft.filter((t) => {
1887
+ let n = Y.filter((t) => {
1887
1888
  if (!t.columnName.value) return !1;
1888
1889
  let n = t.columnName.badge?.toLowerCase();
1889
1890
  if (n === "new") return (t.columnName.column?.alias || t.columnName.label) !== e.alias;
1890
1891
  let [r, i] = t.columnName.value?.split("^^^^^^");
1891
1892
  return n === "custom" || n === "group by" ? e.sql !== i : !0;
1892
1893
  });
1893
- switch (It(n), t) {
1894
+ switch (Ft(n), t) {
1894
1895
  case "DIMENSION":
1895
- W((t) => t.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias));
1896
+ G((t) => t.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias));
1896
1897
  break;
1897
1898
  case "METRIC":
1898
- q((t) => t.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias));
1899
+ J((t) => t.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias));
1899
1900
  break;
1900
1901
  default: console.warn("Invalid Drop");
1901
1902
  }
1902
- let r = t === "DIMENSION" ? U.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : U, i = t === "METRIC" ? K.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : K, a = [
1903
+ let r = t === "DIMENSION" ? W.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : W, i = t === "METRIC" ? K.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : K, a = [
1903
1904
  v.line,
1904
1905
  v.bar,
1905
1906
  v.stack,
@@ -1907,16 +1908,16 @@ var xt = {
1907
1908
  v.horizontalStack
1908
1909
  ].includes(D?.chartType), o, s = !1;
1909
1910
  a && (r.length === 2 && i.length === 1 ? o = Q([r[1]])?.[0] : s = !0);
1910
- let c = [...r, ...i], l = [...U, ...K], u = G(Oe(n).filter((e) => e.name), c), d = V.table;
1911
- L && (d = wn(d, U.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias), K.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias), Nt, n));
1911
+ let c = [...r, ...i], l = [...W, ...K], u = q(Oe(n).filter((e) => e.name), c), d = H.table;
1912
+ R && (d = wn(d, W.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias), K.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias), Nt, n));
1912
1913
  let f = {
1913
- ...V,
1914
- dimensions: V.dimensions.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias),
1915
- aggregates: V.aggregates.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias),
1914
+ ...H,
1915
+ dimensions: H.dimensions.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias),
1916
+ aggregates: H.aggregates.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias),
1916
1917
  orders: u.filter((e) => e.name),
1917
1918
  table: d
1918
1919
  };
1919
- H(f), $({
1920
+ U(f), $({
1920
1921
  prevConfiguration: f,
1921
1922
  chartFieldParams: {
1922
1923
  chartDimensions: Q(l.filter((e) => e.dropType === "DIMENSION").filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias)),
@@ -1927,19 +1928,19 @@ var xt = {
1927
1928
  },
1928
1929
  isRemoveGroupBy: s,
1929
1930
  isGroupByAction: !!o,
1930
- updatedDims: t === "DIMENSION" ? U.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : void 0,
1931
+ updatedDims: t === "DIMENSION" ? W.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : void 0,
1931
1932
  updatedMetrics: t === "METRIC" ? K.filter((t) => t.uniqueId ? t.uniqueId !== e?.uniqueId : t.alias !== e.alias) : void 0
1932
1933
  });
1933
1934
  },
1934
1935
  selectedTable: Qt,
1935
- createdSorts: Ft,
1936
- setCreatedSorts: It,
1936
+ createdSorts: Y,
1937
+ setCreatedSorts: Ft,
1937
1938
  onApplyFilter: (e, t, n) => {
1938
- let r = V.table;
1939
+ let r = H.table;
1939
1940
  if (t) {
1940
- L && (r = wn(r, U, K, [], Ft));
1941
+ R && (r = wn(r, W, K, [], Y));
1941
1942
  let t = {
1942
- ...V,
1943
+ ...H,
1943
1944
  filters: [],
1944
1945
  table: r
1945
1946
  };
@@ -1951,7 +1952,7 @@ var xt = {
1951
1952
  }
1952
1953
  let i = Nt.filter((e, t) => t !== n)?.map((e) => {
1953
1954
  let [t, n, r, i, a, o, s, c] = e?.columnName.value?.split("^^^^^^"), l = e?.operator?.value || "=", u = e?.value?.timeValue ? "time" : "default", d, f, p = e?.columnName?.dimension?.isApplyTimezone;
1954
- return e?.columnName?.badge === "New" && !e?.value?.timeValue && (u = c === "DIMENSION" ? "dimension" : "agr"), u === "agr" && (d = V?.aggregates?.find((e) => e.alias === s)), (u === "time" || u === "dimension") && (f = V?.dimensions?.find((e) => e.alias === s)), e?.type === "custom" ? {
1955
+ return e?.columnName?.badge === "New" && !e?.value?.timeValue && (u = c === "DIMENSION" ? "dimension" : "agr"), u === "agr" && (d = H?.aggregates?.find((e) => e.alias === s)), (u === "time" || u === "dimension") && (f = H?.dimensions?.find((e) => e.alias === s)), e?.type === "custom" ? {
1955
1956
  isApplyTimezone: !!p,
1956
1957
  alias: e?.name,
1957
1958
  columnName: e?.sql,
@@ -1984,23 +1985,23 @@ var xt = {
1984
1985
  dimension: f
1985
1986
  };
1986
1987
  });
1987
- L && (r = wn(r, U, K, Nt.filter((e, t) => t !== n), Ft));
1988
+ R && (r = wn(r, W, K, Nt.filter((e, t) => t !== n), Y));
1988
1989
  let a = {
1989
- ...V,
1990
+ ...H,
1990
1991
  filters: i,
1991
1992
  table: r
1992
1993
  };
1993
- H(a), $({
1994
+ U(a), $({
1994
1995
  prevConfiguration: a,
1995
1996
  queryConfiguration: hn(a)
1996
1997
  }), e();
1997
1998
  },
1998
1999
  onApplySort: (e, t, n) => {
1999
- let r = V.table;
2000
+ let r = H.table;
2000
2001
  if (t) {
2001
- L && (r = wn(r, U, K, Nt, []));
2002
- let t = G([], [...U, ...K]), n = {
2003
- ...V,
2002
+ R && (r = wn(r, W, K, Nt, []));
2003
+ let t = q([], [...W, ...K]), n = {
2004
+ ...H,
2004
2005
  orders: t,
2005
2006
  table: r
2006
2007
  };
@@ -2010,7 +2011,7 @@ var xt = {
2010
2011
  }), e();
2011
2012
  return;
2012
2013
  }
2013
- let i = Ft.filter((e, t) => t !== n)?.map((e) => {
2014
+ let i = Y.filter((e, t) => t !== n)?.map((e) => {
2014
2015
  let t = e.columnName.badge?.toLowerCase(), n = e.method.value, r = e.columnName.column;
2015
2016
  if (!e.columnName.value) return {
2016
2017
  method: "",
@@ -2038,14 +2039,14 @@ var xt = {
2038
2039
  method: e.method.value,
2039
2040
  name: `${a}.${o}`
2040
2041
  };
2041
- }), a = G(i.filter((e) => e.name), [...U, ...K]);
2042
- L && (r = wn(r, U, K, Nt, Ft.filter((e, t) => t !== n)));
2042
+ }), a = q(i.filter((e) => e.name), [...W, ...K]);
2043
+ R && (r = wn(r, W, K, Nt, Y.filter((e, t) => t !== n)));
2043
2044
  let o = {
2044
- ...V,
2045
+ ...H,
2045
2046
  orders: a.filter((e) => e.name),
2046
2047
  table: r
2047
2048
  };
2048
- H(o), $({
2049
+ U(o), $({
2049
2050
  prevConfiguration: o,
2050
2051
  queryConfiguration: hn(o)
2051
2052
  }), e();
@@ -2057,7 +2058,7 @@ var xt = {
2057
2058
  getFilterDropDownType: ln,
2058
2059
  onSelectTimeSeries: (e) => {
2059
2060
  if (e !== v.timeSeries) return;
2060
- let t = U.find((e) => {
2061
+ let t = W.find((e) => {
2061
2062
  let t = e.cast?.value && e?.cast?.value !== "NONE" ? e.cast.value : e.datatype || "";
2062
2063
  return C(t);
2063
2064
  });
@@ -2071,19 +2072,19 @@ var xt = {
2071
2072
  }, E) },
2072
2073
  alias: n
2073
2074
  };
2074
- W((e) => e?.map((e) => e.alias === t.alias ? r : e));
2075
+ G((e) => e?.map((e) => e.alias === t.alias ? r : e));
2075
2076
  let i = [r, ...K], { aggregates: a, dimensions: o } = w(i), s = [{
2076
2077
  method: "ASC",
2077
2078
  name: n,
2078
2079
  type: "selected_column"
2079
2080
  }], c = {
2080
- ...V,
2081
+ ...H,
2081
2082
  dimensions: o,
2082
2083
  aggregates: a,
2083
- orders: [...s, ...V?.orders?.filter((e) => e.type !== "selected_column" || i.some((t) => t.alias === e.name && n !== e.name))],
2084
+ orders: [...s, ...H?.orders?.filter((e) => e.type !== "selected_column" || i.some((t) => t.alias === e.name && n !== e.name))],
2084
2085
  isApplyMetricFilter: !0
2085
2086
  };
2086
- H(c), $({
2087
+ U(c), $({
2087
2088
  isTimeseriesAction: !0,
2088
2089
  prevConfiguration: c,
2089
2090
  chartFieldParams: {
@@ -2093,38 +2094,38 @@ var xt = {
2093
2094
  chartType: e,
2094
2095
  chartTimeColumns: Q([r])
2095
2096
  },
2096
- updatedDims: U?.map((e) => e.alias === t.alias ? r : e)
2097
+ updatedDims: W?.map((e) => e.alias === t.alias ? r : e)
2097
2098
  });
2098
2099
  },
2099
2100
  setChartFields: pn,
2100
2101
  resetCharSettings: (e) => {
2101
- let t = [...U, ...K], { aggregates: n, dimensions: r } = w(t), i = {
2102
- ...V,
2102
+ let t = [...W, ...K], { aggregates: n, dimensions: r } = w(t), i = {
2103
+ ...H,
2103
2104
  dimensions: r,
2104
2105
  aggregates: n,
2105
- orders: G(V?.orders || [], t)
2106
+ orders: q(H?.orders || [], t)
2106
2107
  };
2107
- H(i), $({
2108
+ U(i), $({
2108
2109
  prevConfiguration: i,
2109
2110
  chartFieldParams: {
2110
- chartDimensions: Q(U),
2111
+ chartDimensions: Q(W),
2111
2112
  chartMetrics: Q(K),
2112
2113
  chartAggregateColumns: Q(K.filter((e) => e.configType === "AGGREGATE")),
2113
2114
  pivotHeaderColumns: [],
2114
2115
  chartType: e,
2115
- chartTimeColumns: Q([...U, ...K].filter((e) => C(e?.datatype)))
2116
+ chartTimeColumns: Q([...W, ...K].filter((e) => C(e?.datatype)))
2116
2117
  },
2117
2118
  isRemoveGroupBy: !0,
2118
- updatedDims: U,
2119
+ updatedDims: W,
2119
2120
  updatedMetrics: K
2120
2121
  });
2121
2122
  },
2122
2123
  onDrillPivotTable: ({ filters: n, nextLevel: r, currentValue: i }) => {
2123
- let { headerColumns: a, nonHeaderColumns: o } = U.reduce((e, t) => (D.pivotTableSettings2?.headers?.includes(t.alias) ? e.headerColumns.push(t) : e.nonHeaderColumns.push(t), e), {
2124
+ let { headerColumns: a, nonHeaderColumns: o } = W.reduce((e, t) => (D.pivotTableSettings2?.headers?.includes(t.alias) ? e.headerColumns.push(t) : e.nonHeaderColumns.push(t), e), {
2124
2125
  headerColumns: [],
2125
2126
  nonHeaderColumns: []
2126
2127
  }), s = n?.map((e) => `${e.columnName};;${e.value}`).join(";;");
2127
- Ct((e) => ({
2128
+ St((e) => ({
2128
2129
  ...e,
2129
2130
  data: e.data.filter((e) => e.key !== s),
2130
2131
  error: "",
@@ -2132,7 +2133,7 @@ var xt = {
2132
2133
  currentValue: i
2133
2134
  }));
2134
2135
  let c = o.slice(0, r), l = n?.map((e) => {
2135
- let t = U.find((t) => t.alias === e.columnName || Ee(t) === e.columnName);
2136
+ let t = W.find((t) => t.alias === e.columnName || Ee(t) === e.columnName);
2136
2137
  if (t) return {
2137
2138
  alias: t.alias || "",
2138
2139
  columnName: t.name,
@@ -2148,14 +2149,14 @@ var xt = {
2148
2149
  ...c,
2149
2150
  ...K,
2150
2151
  ...a
2151
- ], { aggregates: d, dimensions: f } = w(u), p = G(Oe(Ft), u), m = {
2152
- ...V,
2152
+ ], { aggregates: d, dimensions: f } = w(u), p = q(Oe(Y), u), m = {
2153
+ ...H,
2153
2154
  dimensions: f,
2154
2155
  aggregates: d,
2155
- filters: [...V.filters, ...l],
2156
+ filters: [...H.filters, ...l],
2156
2157
  isApplyMetricFilter: !0,
2157
2158
  orders: p
2158
- }, h = B?.find((e) => e.tableName === m?.table?.name && e.schemaName === m?.table?.schema), g = m?.table?.joins?.map((e) => B?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter(Boolean) || [], ee = h ? [...g, h] : g, _ = t && ee?.map((e) => ({
2159
+ }, h = V?.find((e) => e.tableName === m?.table?.name && e.schemaName === m?.table?.schema), g = m?.table?.joins?.map((e) => V?.find((t) => t?.schemaName === e?.schema && t?.tableName === e?.name))?.filter(Boolean) || [], ee = h ? [...g, h] : g, _ = t && ee?.map((e) => ({
2159
2160
  name: e?.clientColumn || "",
2160
2161
  datatype: e?.columnsWithDataType?.find((t) => t.name === e?.clientColumn)?.dataType || "",
2161
2162
  table: e
@@ -2166,7 +2167,7 @@ var xt = {
2166
2167
  method: "=",
2167
2168
  parentAlias: `${x(t.table?.schemaName || "", E)}_${t.table?.tableName}`,
2168
2169
  type: "client",
2169
- value: Xe === "NUMBER" ? Number(e) : e,
2170
+ value: Ye === "NUMBER" ? Number(e) : e,
2170
2171
  relationOperator: "AND",
2171
2172
  isApplyTimezone: !1
2172
2173
  })) || [];
@@ -2178,22 +2179,22 @@ var xt = {
2178
2179
  filters: Ht ? m?.filters?.filter((e) => e?.type !== "client") : _?.length ? [...m?.filters, ..._] : m?.filters
2179
2180
  },
2180
2181
  id: qe,
2181
- datasourceId: Qe,
2182
- dashboardId: tt,
2182
+ datasourceId: Ze,
2183
+ dashboardId: Qe,
2183
2184
  isCreateMetric: !0
2184
2185
  },
2185
2186
  token: Ke
2186
2187
  }, { onSuccess(e) {
2187
2188
  let t = e?.error, n = e?.data;
2188
- if (t?.message) Ct((e) => ({
2189
+ if (t?.message) St((e) => ({
2189
2190
  ...e,
2190
2191
  error: t?.message,
2191
2192
  isLoading: !1,
2192
2193
  currentValue: ""
2193
2194
  }));
2194
2195
  else {
2195
- let e = Ue(te(Array.isArray(n) ? n : [], U, K));
2196
- Ct((t) => ({
2196
+ let e = We(te(Array.isArray(n) ? n : [], W, K));
2197
+ St((t) => ({
2197
2198
  data: [...t.data, {
2198
2199
  key: s,
2199
2200
  data: e
@@ -2213,53 +2214,53 @@ var xt = {
2213
2214
  } });
2214
2215
  },
2215
2216
  onSelectPivotTable: (e, t) => {
2216
- Ct({
2217
+ St({
2217
2218
  data: [],
2218
2219
  error: "",
2219
2220
  isLoading: !1,
2220
2221
  currentValue: ""
2221
2222
  });
2222
- let { headerColumns: n, nonHeaderColumns: r } = U.reduce((e, n) => (t.includes(n.alias) ? e.headerColumns.push(n) : e.nonHeaderColumns.push(n), e), {
2223
+ let { headerColumns: n, nonHeaderColumns: r } = W.reduce((e, n) => (t.includes(n.alias) ? e.headerColumns.push(n) : e.nonHeaderColumns.push(n), e), {
2223
2224
  headerColumns: [],
2224
2225
  nonHeaderColumns: []
2225
- }), i = r.slice(0, 1), a = e === v.pivotV3 ? [...U, ...K] : [
2226
+ }), i = r.slice(0, 1), a = e === v.pivotV3 ? [...W, ...K] : [
2226
2227
  ...i,
2227
2228
  ...K,
2228
2229
  ...n
2229
2230
  ], { aggregates: o, dimensions: s } = w(a), c = et({
2230
- configuration: V,
2231
- savedConfiguration: F?.configuration
2231
+ configuration: H,
2232
+ savedConfiguration: I?.configuration
2232
2233
  }), l = {
2233
2234
  ...c,
2234
2235
  dimensions: s,
2235
2236
  aggregates: o,
2236
- orders: G(c.orders || [], a)
2237
+ orders: q(c.orders || [], a)
2237
2238
  };
2238
- H(l), $({
2239
+ U(l), $({
2239
2240
  prevConfiguration: l,
2240
2241
  chartFieldParams: {
2241
- chartDimensions: Q(U),
2242
+ chartDimensions: Q(W),
2242
2243
  chartMetrics: Q(K),
2243
2244
  chartAggregateColumns: Q(K.filter((e) => e.configType === "AGGREGATE")),
2244
2245
  pivotHeaderColumns: t,
2245
2246
  chartType: e,
2246
- chartTimeColumns: Q([...U, ...K].filter((e) => C(e?.datatype)))
2247
+ chartTimeColumns: Q([...W, ...K].filter((e) => C(e?.datatype)))
2247
2248
  },
2248
- updatedDims: U,
2249
+ updatedDims: W,
2249
2250
  updatedMetrics: K,
2250
2251
  isPivotAction: !0,
2251
2252
  isRemoveGroupBy: !0
2252
2253
  });
2253
2254
  },
2254
2255
  onChangeChartGroupByValue: (e) => {
2255
- let t = e || D?.seriesField || "", n = t && t !== "ungrouped" ? sn(U, t) : void 0, r = U?.[0], i = n ? [r, n] : [r], a = [...i, ...K], { aggregates: o, dimensions: s } = w(a), c = {
2256
- ...V,
2256
+ let t = e || D?.seriesField || "", n = t && t !== "ungrouped" ? sn(W, t) : void 0, r = W?.[0], i = n ? [r, n] : [r], a = [...i, ...K], { aggregates: o, dimensions: s } = w(a), c = {
2257
+ ...H,
2257
2258
  dimensions: s,
2258
2259
  aggregates: o,
2259
- orders: G(V?.orders || [], a),
2260
+ orders: q(H?.orders || [], a),
2260
2261
  isApplyMetricFilter: !0
2261
2262
  };
2262
- H(c), $({
2263
+ U(c), $({
2263
2264
  isTimeseriesAction: !0,
2264
2265
  prevConfiguration: c,
2265
2266
  chartFieldParams: {
@@ -2268,13 +2269,13 @@ var xt = {
2268
2269
  chartAggregateColumns: Q(K.filter((e) => e.configType === "AGGREGATE")),
2269
2270
  chartTimeColumns: Q(i?.filter((e) => C(e?.datatype)))
2270
2271
  },
2271
- updatedDims: U,
2272
+ updatedDims: W,
2272
2273
  isGroupByAction: !0
2273
2274
  });
2274
2275
  },
2275
2276
  onChangeTimeseriesFormat: (e, t) => {
2276
2277
  if (D.chartType !== v.timeSeries) return;
2277
- let n = t || D?.seriesField || "", r = n && n !== "ungrouped", i = U.find((e) => {
2278
+ let n = t || D?.seriesField || "", r = n && n !== "ungrouped", i = W.find((e) => {
2278
2279
  let t = e.cast?.value && e?.cast?.value !== "NONE" ? e.cast.value : e.datatype || "";
2279
2280
  return C(t);
2280
2281
  });
@@ -2285,19 +2286,19 @@ var xt = {
2285
2286
  functionConfiguration: { dateFormat: Ae(e, E) },
2286
2287
  alias: `${e.value} of ${i.name}`
2287
2288
  };
2288
- W((e) => e?.map((e) => e.alias === i.alias ? o : e));
2289
- let s = r ? sn(U, n) : void 0, c = s ? [o, s] : [o], l = [...c, ...K], { aggregates: u, dimensions: d } = w(l), f = [{
2289
+ G((e) => e?.map((e) => e.alias === i.alias ? o : e));
2290
+ let s = r ? sn(W, n) : void 0, c = s ? [o, s] : [o], l = [...c, ...K], { aggregates: u, dimensions: d } = w(l), f = [{
2290
2291
  method: "ASC",
2291
2292
  name: a,
2292
2293
  type: "selected_column"
2293
2294
  }], p = {
2294
- ...V,
2295
+ ...H,
2295
2296
  dimensions: d,
2296
2297
  aggregates: u,
2297
- orders: [...f, ...V?.orders?.filter((e) => e.type !== "selected_column" || l.some((t) => t.alias === e.name && a !== e.name))],
2298
+ orders: [...f, ...H?.orders?.filter((e) => e.type !== "selected_column" || l.some((t) => t.alias === e.name && a !== e.name))],
2298
2299
  isApplyMetricFilter: !0
2299
2300
  };
2300
- H(p), $({
2301
+ U(p), $({
2301
2302
  isTimeseriesAction: !0,
2302
2303
  prevConfiguration: p,
2303
2304
  chartFieldParams: {
@@ -2306,37 +2307,37 @@ var xt = {
2306
2307
  chartAggregateColumns: Q(K.filter((e) => e.configType === "AGGREGATE")),
2307
2308
  chartTimeColumns: Q(c?.filter((e) => C(e?.datatype)))
2308
2309
  },
2309
- updatedDims: U?.map((e) => e.alias === i.alias ? o : e)
2310
+ updatedDims: W?.map((e) => e.alias === i.alias ? o : e)
2310
2311
  });
2311
2312
  },
2312
2313
  isDisableChartDrillDown: Kt,
2313
2314
  isAllowDrillDown: Gt,
2314
2315
  onChangeDrillDown: (e, t, n, r) => {
2315
2316
  let i = r !== void 0;
2316
- n && (t ? (Ze((e) => ({
2317
+ n && (t ? (Xe((e) => ({
2317
2318
  ...e,
2318
2319
  isEnableGroupBy: !0
2319
- })), Rt([])) : (Ze((e) => ({
2320
+ })), Lt([])) : (Xe((e) => ({
2320
2321
  ...e,
2321
2322
  isEnableGroupBy: !1,
2322
2323
  drilldownChartSettings: void 0
2323
- })), Rt([])));
2324
- let a = (r || 0) > 0 && Lt.length ? Lt.slice(0, -1) : [], o = e?.name, s = U?.[U.length > Lt.length ? Lt.length : 0]?.alias, c = i ? a : n ? [] : U.length > Lt.length && s ? [...Lt, {
2324
+ })), Lt([])));
2325
+ let a = (r || 0) > 0 && It.length ? It.slice(0, -1) : [], o = e?.name, s = W?.[W.length > It.length ? It.length : 0]?.alias, c = i ? a : n ? [] : W.length > It.length && s ? [...It, {
2325
2326
  columnName: s,
2326
2327
  value: o
2327
- }] : [], l = U?.[U.length > c.length ? c.length : 0]?.alias || "", u = c?.length >= U?.length, d = P?.drilldownChartSettings?.find((e) => e.name === l)?.chartSettings, f = {
2328
- ...V,
2328
+ }] : [], l = W?.[W.length > c.length ? c.length : 0]?.alias || "", u = c?.length >= W?.length, d = F?.drilldownChartSettings?.find((e) => e.name === l)?.chartSettings, f = {
2329
+ ...H,
2329
2330
  isEnableDrill: !n || !!t,
2330
2331
  drillFilters: c
2331
2332
  };
2332
- H(f), $({
2333
+ U(f), $({
2333
2334
  prevConfiguration: f,
2334
2335
  chartFieldParams: {
2335
2336
  chartDimensions: [l],
2336
2337
  chartType: u ? "table" : d?.chartType
2337
2338
  },
2338
2339
  onSuccess: () => {
2339
- Rt(c), u || Ze((e) => ({
2340
+ Lt(c), u || Xe((e) => ({
2340
2341
  ...e,
2341
2342
  drilldownChartSettings: [...e.drilldownChartSettings?.filter((e) => e.name !== s) || [], {
2342
2343
  name: s,
@@ -2346,13 +2347,13 @@ var xt = {
2346
2347
  }
2347
2348
  });
2348
2349
  },
2349
- drillFilters: Lt,
2350
+ drillFilters: It,
2350
2351
  selectedJoinColumnOptions: $t,
2351
2352
  onChangeLimit: async (e) => {
2352
2353
  $({ prevLimit: e });
2353
2354
  },
2354
2355
  onChangeChartType: (e) => {
2355
- let t = K, n = U;
2356
+ let t = K, n = W;
2356
2357
  ([
2357
2358
  v.singleValue,
2358
2359
  v.gaugeV2,
@@ -2364,13 +2365,13 @@ var xt = {
2364
2365
  v.rose,
2365
2366
  v.pie,
2366
2367
  v.doughnut
2367
- ].includes(e) && U?.length) && (t = [K?.[0]], q(t)), ![v.table, v.pivotV2].includes(e) && !([
2368
+ ].includes(e) && W?.length) && (t = [K?.[0]], J(t)), ![v.table, v.pivotV2].includes(e) && !([
2368
2369
  v.line,
2369
2370
  v.bar,
2370
2371
  v.stack,
2371
2372
  v.row,
2372
2373
  v.horizontalStack
2373
- ].includes(e) && U?.length === 2 && K?.length === 1) && U?.length > 1 && (n = [U?.[0]], W(n));
2374
+ ].includes(e) && W?.length === 2 && K?.length === 1) && W?.length > 1 && (n = [W?.[0]], G(n));
2374
2375
  let r = [
2375
2376
  v.line,
2376
2377
  v.bar,
@@ -2380,12 +2381,12 @@ var xt = {
2380
2381
  ].includes(e), i, a = !1;
2381
2382
  r && n.length === 2 && t.length === 1 ? i = Q([n[1]])?.[0] : a = !0;
2382
2383
  let o = [...n, ...t], { aggregates: s, dimensions: c } = w(o), l = {
2383
- ...V,
2384
+ ...H,
2384
2385
  dimensions: c,
2385
2386
  aggregates: s,
2386
- orders: G(V?.orders || [], o)
2387
+ orders: q(H?.orders || [], o)
2387
2388
  };
2388
- H(l), $({
2389
+ U(l), $({
2389
2390
  prevConfiguration: l,
2390
2391
  chartFieldParams: {
2391
2392
  chartDimensions: Q(n),
@@ -2402,22 +2403,22 @@ var xt = {
2402
2403
  });
2403
2404
  },
2404
2405
  joinTableOption: en,
2405
- currentSelectedTable: J,
2406
- setCurrentSelectedTable: Mt,
2406
+ currentSelectedTable: kt,
2407
+ setCurrentSelectedTable: At,
2407
2408
  arithmeticColumnOptions: nn,
2408
2409
  onSaveArithMetricOption: Cn,
2409
- onSaveMetricFilter: O((e, t) => {
2410
+ onSaveMetricFilter: k((e, t) => {
2410
2411
  let n = (e) => (e || "").trim().toLowerCase(), r = n(e.name), i = n(t);
2411
- if ((V?.rlsConditions || []).some((e) => {
2412
+ if ((H?.rlsConditions || []).some((e) => {
2412
2413
  let t = n(e.name);
2413
2414
  return t === r && (!i || t !== i);
2414
2415
  })) return !1;
2415
2416
  let a = {
2416
- ...V,
2417
+ ...H,
2417
2418
  isApplyMetricFilter: !0,
2418
- rlsConditions: [...(V?.rlsConditions || []).filter((n) => n.name !== e.name && (!t || n.name !== t)), e]
2419
+ rlsConditions: [...(H?.rlsConditions || []).filter((n) => n.name !== e.name && (!t || n.name !== t)), e]
2419
2420
  };
2420
- return H(a), Ge((e) => e && {
2421
+ return U(a), Ue((e) => e && {
2421
2422
  ...e,
2422
2423
  configuration: a,
2423
2424
  newDatasetSettings: e.newDatasetSettings ? {
@@ -2426,16 +2427,16 @@ var xt = {
2426
2427
  } : e.newDatasetSettings
2427
2428
  }), $({ prevConfiguration: a }), !0;
2428
2429
  }, [
2429
- V,
2430
+ H,
2430
2431
  $,
2431
- Ge
2432
+ Ue
2432
2433
  ]),
2433
- onRemoveMetricFilter: O((e) => {
2434
+ onRemoveMetricFilter: k((e) => {
2434
2435
  let t = {
2435
- ...V,
2436
- rlsConditions: (V?.rlsConditions || []).filter((t) => t.name !== e)
2436
+ ...H,
2437
+ rlsConditions: (H?.rlsConditions || []).filter((t) => t.name !== e)
2437
2438
  };
2438
- H(t), Ge((e) => e && {
2439
+ U(t), Ue((e) => e && {
2439
2440
  ...e,
2440
2441
  configuration: t,
2441
2442
  newDatasetSettings: e.newDatasetSettings ? {
@@ -2444,12 +2445,12 @@ var xt = {
2444
2445
  } : e.newDatasetSettings
2445
2446
  }), $({ prevConfiguration: t });
2446
2447
  }, [
2447
- V,
2448
+ H,
2448
2449
  $,
2449
- Ge
2450
+ Ue
2450
2451
  ]),
2451
- onChangeMetricFilterValue: O((e, t, n, r, i, a) => {
2452
- let o = (V?.rlsConditions || []).map((o) => o.name === e ? r ? {
2452
+ onChangeMetricFilterValue: k((e, t, n, r, i, a) => {
2453
+ let o = (H?.rlsConditions || []).map((o) => o.name === e ? r ? {
2453
2454
  ...o,
2454
2455
  value: t,
2455
2456
  options: o.options?.map((e) => t === e.name ? {
@@ -2483,21 +2484,21 @@ var xt = {
2483
2484
  label: n || t
2484
2485
  } : void 0
2485
2486
  } : o), s = {
2486
- ...V,
2487
+ ...H,
2487
2488
  rlsConditions: o
2488
2489
  };
2489
- H(s), $({ prevConfiguration: s });
2490
- }, [V, $]),
2491
- builderError: ft
2490
+ U(s), $({ prevConfiguration: s });
2491
+ }, [H, $]),
2492
+ builderError: dt
2492
2493
  };
2493
- }, Nt = (e) => !e || e === "transparent" || /rgba\([^)]*,\s*0\s*\)$/.test(e), Pt = (e) => /^rgb\(/.test(e) || /rgba\([^)]*,\s*1\s*\)$/.test(e), Ft = (e) => {
2494
+ }, Pt = (e) => !e || e === "transparent" || /rgba\([^)]*,\s*0\s*\)$/.test(e), Y = (e) => /^rgb\(/.test(e) || /rgba\([^)]*,\s*1\s*\)$/.test(e), Ft = (e) => {
2494
2495
  let t;
2495
2496
  for (let n = e; n; n = n.parentElement) {
2496
2497
  let e = getComputedStyle(n).backgroundColor;
2497
- if (!Nt(e)) {
2498
+ if (!Pt(e)) {
2498
2499
  if (!t) {
2499
- if (t = e, Pt(e)) return { surface: t };
2500
- } else if (Pt(e)) return {
2500
+ if (t = e, Y(e)) return { surface: t };
2501
+ } else if (Y(e)) return {
2501
2502
  surface: t,
2502
2503
  backdrop: e
2503
2504
  };
@@ -2513,8 +2514,8 @@ var xt = {
2513
2514
  } : void 0;
2514
2515
  }, Lt = (e, t) => e?.fontColor === t?.fontColor && e?.fontFamily === t?.fontFamily && e?.surface === t?.surface && e?.backdrop === t?.backdrop;
2515
2516
  function Rt(e) {
2516
- let [t, n] = j(void 0);
2517
- return ze(() => {
2517
+ let [t, n] = M(void 0);
2518
+ return A(() => {
2518
2519
  if (!e) return;
2519
2520
  let t = () => {
2520
2521
  let t = It(e);
@@ -2537,7 +2538,7 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2537
2538
  if (e == null) return null;
2538
2539
  let t = typeof e == "string" ? e : String(e);
2539
2540
  return t.length ? t : null;
2540
- }, Y = ({ config: e, value: t, carryFilters: n = [] }) => {
2541
+ }, Vt = ({ config: e, value: t, carryFilters: n = [] }) => {
2541
2542
  if (!e?.isEnable) return {
2542
2543
  ok: !1,
2543
2544
  reason: "disabled"
@@ -2563,7 +2564,7 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2563
2564
  a.forEach((e) => {
2564
2565
  o.set(e.column, e.value);
2565
2566
  });
2566
- let s = `/externalDashboard/${encodeURIComponent(e.dashboardId)}/?${o.toString()}`, c = T(s, { routeType: "internal" });
2567
+ let s = `/externalDashboard/${encodeURIComponent(e.dashboardId)}/?${o.toString()}`, c = Le(s, { routeType: "internal" });
2567
2568
  return c.ok ? {
2568
2569
  ok: !0,
2569
2570
  intent: {
@@ -2580,7 +2581,7 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2580
2581
  navigation: c.code
2581
2582
  }
2582
2583
  };
2583
- }, Vt = (e, t) => {
2584
+ }, Ht = (e, t) => {
2584
2585
  let n = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : null, { params: r, rowFilters: i } = t, a = e?.valueColumn?.trim();
2585
2586
  if (a) {
2586
2587
  let e = (i ?? []).find((e) => e?.columnName === a);
@@ -2589,7 +2590,7 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2589
2590
  if (r && r.name !== void 0 && r.name !== null) return n(r.name);
2590
2591
  let o = (i ?? []).find((e) => e?.value !== void 0 && e?.value !== null);
2591
2592
  return o ? n(o.value) : null;
2592
- }, Ht = E("triangle-alert", [
2593
+ }, Ut = D("triangle-alert", [
2593
2594
  ["path", {
2594
2595
  d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3",
2595
2596
  key: "wmoenq"
@@ -2602,11 +2603,11 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2602
2603
  d: "M12 17h.01",
2603
2604
  key: "p32p05"
2604
2605
  }]
2605
- ]), Ut = e.createContext({
2606
+ ]), Wt = e.createContext({
2606
2607
  navigate: null,
2607
2608
  carryFilters: []
2608
- }), Wt = [], X = ({ children: t, isEnabled: n = !1, onNavigate: r, carryFilters: i }) => {
2609
- let a = i?.length ? i : Wt, o = e.useMemo(() => ({
2609
+ }), X = [], Gt = ({ children: t, isEnabled: n = !1, onNavigate: r, carryFilters: i }) => {
2610
+ let a = i?.length ? i : X, o = e.useMemo(() => ({
2610
2611
  navigate: n && r ? r : null,
2611
2612
  carryFilters: a
2612
2613
  }), [
@@ -2614,28 +2615,138 @@ var zt = (e) => !!e && e !== "null" && e !== "undefined", Bt = (e) => {
2614
2615
  r,
2615
2616
  a
2616
2617
  ]);
2617
- return /* @__PURE__ */ M(Ut.Provider, {
2618
+ return /* @__PURE__ */ Ve(Wt.Provider, {
2618
2619
  value: o,
2619
2620
  children: t
2620
2621
  });
2621
- }, Gt = () => {
2622
- let { navigate: t, carryFilters: n } = e.useContext(Ut), r = e.useCallback((e, r) => {
2622
+ }, Kt = () => {
2623
+ let { navigate: t, carryFilters: n } = e.useContext(Wt), r = e.useCallback((e, r) => {
2623
2624
  if (!t) return !1;
2624
2625
  let i = e?.clickActions?.chartWithDashboard;
2625
2626
  if (!i?.isEnable) return !1;
2626
- let a = Y({
2627
+ let a = Vt({
2627
2628
  config: i,
2628
- value: Vt(i, r),
2629
+ value: Ht(i, r),
2629
2630
  carryFilters: n
2630
2631
  });
2631
2632
  return a.ok ? (t(a.intent), !0) : (typeof a.reason == "object" && a.reason.code === "unsafe_target" && console.warn(`[chartNavigation] dashboard navigation rejected: ${a.reason.navigation}`), !1);
2632
2633
  }, [t, n]);
2633
2634
  return t ? r : null;
2634
- }, Kt = (e) => {
2635
+ }, Z = (e) => {
2635
2636
  if (typeof e == "function") return (t) => e(t);
2636
- };
2637
+ }, qt = /(?:^|[_\s.-])(id|ids|uuid|guid|sku|code|no|num|number|zip|zipcode|postcode|pincode|phone|isbn|ean|upc)$/i, Jt = /* @__PURE__ */ new Set([
2638
+ "id",
2639
+ "ids",
2640
+ "url",
2641
+ "uri",
2642
+ "sku",
2643
+ "usd",
2644
+ "eur",
2645
+ "gbp",
2646
+ "api",
2647
+ "utm",
2648
+ "ip",
2649
+ "ltv",
2650
+ "arr",
2651
+ "mrr",
2652
+ "kpi",
2653
+ "roi",
2654
+ "cpc",
2655
+ "ctr",
2656
+ "gmv",
2657
+ "aov",
2658
+ "sla",
2659
+ "uuid"
2660
+ ]);
2661
+ function Yt(e) {
2662
+ let t = String(e ?? "").trim();
2663
+ if (!t) return "";
2664
+ let n = t.lastIndexOf("."), r = n >= 0 ? t.slice(n + 1) : t, i = r.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/[_\-\s]+/g, " ").replace(/([a-zA-Z])(\d)/g, "$1 $2").trim().split(" ").filter(Boolean);
2665
+ return i.length ? i.map((e, t) => {
2666
+ let n = e.toLowerCase();
2667
+ return Jt.has(n) ? n.toUpperCase() : e.length > 1 && e === e.toUpperCase() && /[A-Z]/.test(e) ? e : t === 0 ? n.charAt(0).toUpperCase() + n.slice(1) : n;
2668
+ }).join(" ") : r;
2669
+ }
2670
+ function Xt(e) {
2671
+ let t = String(e ?? "").trim();
2672
+ if (!t) return "";
2673
+ let n = t.lastIndexOf(".");
2674
+ return (n >= 0 ? t.slice(n + 1) : t).toLowerCase();
2675
+ }
2676
+ function Zt(e) {
2677
+ return String(e?.configType ?? "").toUpperCase() === "AGGREGATE" || String(e?.dropType ?? "").toUpperCase() === "METRIC";
2678
+ }
2679
+ function Qt(e, t) {
2680
+ for (let n of e ?? []) {
2681
+ let e = n?.[t];
2682
+ if (e != null && e !== "") return typeof e == "number" ? Number.isFinite(e) ? "number" : "text" : typeof e == "boolean" ? "boolean" : "text";
2683
+ }
2684
+ return "text";
2685
+ }
2686
+ function $t({ keys: e, rows: t = [], selectedDims: n = [], selectedMetrics: r = [] }) {
2687
+ let i = /* @__PURE__ */ new Map(), a = (e) => {
2688
+ if (e) for (let t of [
2689
+ e.alias,
2690
+ e.name,
2691
+ e.label
2692
+ ]) {
2693
+ let n = Xt(t);
2694
+ n && !i.has(n) && i.set(n, e);
2695
+ }
2696
+ };
2697
+ n.forEach(a), r.forEach(a);
2698
+ let o = (e, t, ...n) => e !== "number" || t ? e : n.some((e) => e && qt.test(e.trim())) ? "identifier" : e;
2699
+ return (e ?? []).map((e) => {
2700
+ let n = i.get(Xt(e));
2701
+ if (!n) {
2702
+ let n = Yt(e);
2703
+ return {
2704
+ key: e,
2705
+ label: n,
2706
+ kind: o(Qt(t, e), !1, e, n),
2707
+ isMeasure: !1,
2708
+ isDerived: !0
2709
+ };
2710
+ }
2711
+ let r = Zt(n), a = T(n.datatype), s = r ? "number" : a === "number" || a === "date" || a === "boolean" ? a : Qt(t, e), c = n.label?.trim() || n.alias?.trim() || n.name?.trim() || Yt(e);
2712
+ return {
2713
+ key: e,
2714
+ label: c,
2715
+ kind: o(s, r, e, c, n.name),
2716
+ isMeasure: r,
2717
+ isDerived: !1
2718
+ };
2719
+ });
2720
+ }
2721
+ function en(e) {
2722
+ if (!Number.isFinite(e)) return "";
2723
+ try {
2724
+ return new Intl.NumberFormat(void 0, { maximumFractionDigits: 6 }).format(e);
2725
+ } catch {
2726
+ return String(e);
2727
+ }
2728
+ }
2729
+ function tn(e, t, n) {
2730
+ if (e == null || e === "") return "-";
2731
+ if (t.kind === "identifier" || t.kind !== "number") return String(e);
2732
+ let r = typeof e == "number" ? e : Number(e);
2733
+ return Number.isFinite(r) ? t.isMeasure && n ? n(r, t.key) : en(r) : String(e);
2734
+ }
2735
+ function nn({ keys: e, selectedDims: t = [], selectedMetrics: n = [], metricTitle: r }) {
2736
+ let i = {}, a = $t({
2737
+ keys: e,
2738
+ selectedDims: t,
2739
+ selectedMetrics: n
2740
+ }), o = new Set(e);
2741
+ for (let e of a) {
2742
+ let t = e.label.trim();
2743
+ !e.isDerived && t && t !== e.key && (o.has(t) || (o.add(t), i[e.key] = t));
2744
+ }
2745
+ let s = r?.trim(), [c] = a;
2746
+ return s && a.length === 1 && c.isMeasure && !i[c.key] && s !== c.key && (i[c.key] = s), i;
2747
+ }
2637
2748
  // src/core/metric-builder/permissions.ts
2638
- function Z(e, t) {
2749
+ function rn(e, t) {
2639
2750
  return {
2640
2751
  canCreateMetric: !!e?.isAllowedToCreateMetrics && !t?.disableMetricCreation,
2641
2752
  canManageMetrics: !!e?.isAllowedManageMetrics && !t?.disableManageMetrics,
@@ -2656,9 +2767,9 @@ function Z(e, t) {
2656
2767
  };
2657
2768
  }
2658
2769
  // src/hooks/useLoadingDeadline.ts
2659
- var qt = 6e4, Jt = (e, t = qt) => {
2660
- let [n, r] = j(null), [i, a] = j(0);
2661
- Re(() => {
2770
+ var an = 6e4, Q = (e, t = an) => {
2771
+ let [n, r] = M(null), [i, a] = M(0);
2772
+ ze(() => {
2662
2773
  if (!e) {
2663
2774
  r(null);
2664
2775
  return;
@@ -2670,10 +2781,10 @@ var qt = 6e4, Jt = (e, t = qt) => {
2670
2781
  t,
2671
2782
  i
2672
2783
  ]);
2673
- let o = O(() => a((e) => e + 1), []);
2784
+ let o = k(() => a((e) => e + 1), []);
2674
2785
  return {
2675
2786
  expired: e && n === i,
2676
2787
  restart: o
2677
2788
  };
2678
2789
  };
2679
- export { Qe as _, Kt as a, We as b, Y as c, G as d, Mt as f, Xe as g, F as h, X as i, Rt as l, wt as m, Jt as n, Gt as o, Ct as p, Z as r, Ht as s, qt as t, q as u, P as v, Ue as x, Ze as y };
2790
+ export { Ge as C, F as S, Ct as _, $t as a, I as b, Z as c, Vt as d, Rt as f, H as g, Nt as h, tn as i, Kt as l, q as m, Q as n, nn as o, kt as p, rn as r, Gt as s, an as t, Ut as u, Qe as v, We as w, Ze as x, Xe as y };