@databrainhq/plugin 0.17.9-beta.33 → 0.17.9-beta.34

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 (47) hide show
  1. package/dist/{Accordion-BdGcYoH_.mjs → Accordion-DtzU-kv3.mjs} +1 -1
  2. package/dist/{Chart-D3fn0ghg.mjs → Chart-BKjKglnR.mjs} +760 -760
  3. package/dist/{CreateGlobalFilter-8t6GSGyT.mjs → CreateGlobalFilter-COJr9pxx.mjs} +195 -195
  4. package/dist/{CreateMetricV2-BJoSn42i.mjs → CreateMetricV2-CfcDgw3E.mjs} +146 -146
  5. package/dist/{DraggableItem-CzPHM5Ek.mjs → DraggableItem-B8IW0_no.mjs} +139 -139
  6. package/dist/{HorizontalStackTable-DNBbrIFn.mjs → HorizontalStackTable-BgTor_KQ.mjs} +48 -48
  7. package/dist/{ManageMetricsV2-1fBC-FFm.mjs → ManageMetricsV2-DM8gofxF.mjs} +3 -3
  8. package/dist/{MetricCardV2-D7p6yAv5.mjs → MetricCardV2-Ff__3yWl.mjs} +146 -146
  9. package/dist/{NoDataFound-1gLzunO6.mjs → NoDataFound-Ifpvns9-.mjs} +1 -1
  10. package/dist/{NoDataState-rNtw1p0V.mjs → NoDataState-DPVhHP6M.mjs} +2 -2
  11. package/dist/{Panel-DQXH8IBE.mjs → Panel-BUwtA4r-.mjs} +1 -1
  12. package/dist/{PivotTableV2-DfzyY9RC.mjs → PivotTableV2-DQU2H33d.mjs} +2 -2
  13. package/dist/{PivotTableV3-B97O3ZLD.mjs → PivotTableV3-BLp5-cQr.mjs} +4 -4
  14. package/dist/{Portal-DE_CdG2S.mjs → Portal-BP2ivXF8.mjs} +2480 -2388
  15. package/dist/{RadioButton-BOkJ0ZLZ.mjs → RadioButton-oGBMxhHq.mjs} +2 -2
  16. package/dist/{ScheduleEmail-BpdnxS9q.mjs → ScheduleEmail-CiO6PMLd.mjs} +517 -517
  17. package/dist/{SearchMetricData-sBWIMhvT.mjs → SearchMetricData-C4stwNY9.mjs} +1272 -1272
  18. package/dist/{SortPanel-CNjSmhPX.mjs → SortPanel-Cy82r5dX.mjs} +1332 -1332
  19. package/dist/{Table-ODMPh1l7.mjs → Table-Cg4EZCAG.mjs} +296 -296
  20. package/dist/{TagInputField-DYDsUtvi.mjs → TagInputField-DuY_whs7.mjs} +9 -9
  21. package/dist/{TextAreaField-D4VprIA4.mjs → TextAreaField-D5O-kEVL.mjs} +297 -297
  22. package/dist/{TimeSeriesSettings-BTj3ofRS.mjs → TimeSeriesSettings-TXu0_07R.mjs} +11 -11
  23. package/dist/{arrayToCsvString-D9T6ms_d.mjs → arrayToCsvString-Bj2E5XgM.mjs} +1 -1
  24. package/dist/{cardActions-BLBLsjcd.mjs → cardActions-BPRHHm2G.mjs} +21 -7
  25. package/dist/{cardQueryError-tZcXyRqS.mjs → cardQueryError-DFKFCfFx.mjs} +1274 -1274
  26. package/dist/{charts-CY0Vq7Bn.mjs → charts-C2loGjFP.mjs} +3 -3
  27. package/dist/{chevron-down-mMC3ps2h.mjs → chevron-down-BWD1dxqC.mjs} +6 -6
  28. package/dist/{conditionalFormatting-LaI9Vca7.mjs → conditionalFormatting-Ca-leGbK.mjs} +1 -1
  29. package/dist/{contrast-Clo5ZlPI.mjs → contrast-EppiiunY.mjs} +117 -112
  30. package/dist/{createGlobalFilter.module-CWkuVq9m.mjs → createGlobalFilter.module-B3yI7_04.mjs} +1 -1
  31. package/dist/data.cjs +1 -1
  32. package/dist/data.mjs +1 -1
  33. package/dist/{echarts-mz_HZpET.mjs → echarts-CsSfDZ5q.mjs} +2 -2
  34. package/dist/{metric.mutation-B8OUNYhj.mjs → metric.mutation-hYspHj1p.mjs} +1 -1
  35. package/dist/{option-ywDB8mz_.mjs → option-B1zeYJnm.mjs} +1 -1
  36. package/dist/{permissions-Rp1874rG.mjs → permissions-Bc9NDT2w.mjs} +359 -359
  37. package/dist/{pluginV3Request-CK6p_HfU.mjs → pluginV3Request-DFy6TETh.mjs} +1 -1
  38. package/dist/{renderer-DEc5om01.mjs → renderer-Bk8GbA94.mjs} +2 -2
  39. package/dist/{theme-CU-AvQm_.mjs → theme-BA-MvZE0.mjs} +1 -1
  40. package/dist/{timeseries-BBiiZaG9.mjs → timeseries-kGhqoQ6V.mjs} +1948 -1942
  41. package/dist/{toTasteAppearance-BnmM-nar.mjs → toTasteAppearance-CGUd4zvZ.mjs} +1 -1
  42. package/dist/{useGuesTokenUsageLog-CTqOyx82.mjs → useGuesTokenUsageLog-CVeQacbL.mjs} +1 -1
  43. package/dist/{usePublishArchivedMetrics-BsHt2ki1.mjs → usePublishArchivedMetrics-BGEBFLub.mjs} +2 -2
  44. package/dist/{useQuery-B_9KK0aG.mjs → useQuery-CNVFkkjT.mjs} +1 -1
  45. package/dist/webcomponents.es.js +3942 -3939
  46. package/dist/webcomponents.umd.js +184 -184
  47. package/package.json +2 -2
@@ -3,23 +3,23 @@ import "react-dom";
3
3
  import "react-dom/client";
4
4
  import { o as e } from "./rolldown-runtime-C1JUX4Ur.mjs";
5
5
  import { c as t, s as n } from "./cardStates-DiUMQ7_o.mjs";
6
- import { Bt as r, It as i, Vt as a, Zt as o, a as s, c, l, m as u, u as d, zt as f } from "./pluginV3Request-CK6p_HfU.mjs";
7
- import { $ as p, K as m, O as ee, Q as h, U as g, X as _, Y as v, Z as y, a as te, at as b, d as x, et as S, i as ne, l as C, lt as w, q as T, s as re, tt as E } from "./metric.mutation-B8OUNYhj.mjs";
8
- import { $n as D, $t as ie, Aa as O, An as ae, Bt as oe, Cn as se, Da as ce, Dn as le, Gn as ue, Gt as de, Hn as fe, Ht as pe, Ia as me, Jt as he, Kn as ge, La as k, Li as A, Ln as _e, Lt as ve, Ra as j, Rt as ye, Sr as M, Tt as be, Va as xe, Vn as Se, Wt as Ce, Xn as we, Xt as Te, Yn as Ee, Zn as De, Zt as Oe, _n as ke, an as Ae, bn as je, dn as Me, en as Ne, fn as Pe, hn as Fe, jn as Ie, jr as Le, kn as Re, la as ze, li as Be, on as Ve, pn as He, qi as Ue, qn as We, s as Ge, si as Ke, tn as qe, un as Je, xn as Ye, yn as Xe, za as Ze } from "./Portal-DE_CdG2S.mjs";
9
- import { t as N } from "./useQuery-B_9KK0aG.mjs";
10
- import { i as Qe } from "./chevron-down-mMC3ps2h.mjs";
11
- import { n as $e } from "./timeseries-BBiiZaG9.mjs";
12
- import { i as et } from "./text-CtrvkDIo.mjs";
13
- import { a as tt, r as nt, s as rt } from "./permissions-Rp1874rG.mjs";
14
- import { f as it, o as at } from "./RadioButton-BOkJ0ZLZ.mjs";
15
- import { r as ot } from "./cardActions-BLBLsjcd.mjs";
16
- import { t as st } from "./TimeSeriesSettings-BTj3ofRS.mjs";
17
- import { t as ct } from "./createLucideIcon-C-N26TaJ.mjs";
18
- import * as lt from "react";
19
- import { createContext as ut, useCallback as P, useContext as dt, useEffect as F, useLayoutEffect as ft, useMemo as I, useRef as L, useState as R } from "react";
20
- import { jsx as pt, jsxs as mt } from "react/jsx-runtime";
6
+ import { Bt as r, It as i, Vt as a, Zt as o, a as s, c, l, m as u, u as d, zt as f } from "./pluginV3Request-DFy6TETh.mjs";
7
+ import { $ as p, K as m, O as h, Q as g, U as _, X as v, Y as y, Z as b, a as x, at as S, d as C, et as w, i as ee, l as T, lt as E, q as D, s as te, tt as O } from "./metric.mutation-hYspHj1p.mjs";
8
+ import { $t as ne, An as re, Ba as ie, Bt as ae, Cn as oe, Cr as se, Dn as ce, Gt as le, Ha as ue, Hn as de, Ht as fe, Ji as pe, Jn as me, Jt as he, Kn as ge, La as _e, Ln as k, Lt as ve, Mr as ye, Oa as be, Qn as xe, Ra as Se, Ri as Ce, Rt as we, Tt as Te, Vn as Ee, Wt as De, Xn as Oe, Xt as ke, Zn as Ae, Zt as je, _n as Me, an as Ne, bn as Pe, ci as Fe, dn as Ie, en as Le, er as Re, fn as ze, hn as Be, ja as A, jn as Ve, kn as He, on as Ue, pn as We, qn as Ge, s as Ke, tn as qe, ua as Je, ui as Ye, un as Xe, xn as Ze, yn as Qe, za as $e } from "./Portal-BP2ivXF8.mjs";
9
+ import { t as j } from "./useQuery-CNVFkkjT.mjs";
10
+ import { i as et } from "./chevron-down-BWD1dxqC.mjs";
11
+ import { n as tt } from "./timeseries-kGhqoQ6V.mjs";
12
+ import { i as nt } from "./text-CtrvkDIo.mjs";
13
+ import { a as rt, r as it, s as at } from "./permissions-Bc9NDT2w.mjs";
14
+ import { f as ot, o as st } from "./RadioButton-oGBMxhHq.mjs";
15
+ import { i as ct } from "./cardActions-BPRHHm2G.mjs";
16
+ import { t as lt } from "./TimeSeriesSettings-TXu0_07R.mjs";
17
+ import { t as ut } from "./createLucideIcon-C-N26TaJ.mjs";
18
+ import * as dt from "react";
19
+ import { createContext as ft, useCallback as M, useContext as pt, useEffect as N, useLayoutEffect as mt, useMemo as P, useRef as F, useState as I } from "react";
20
+ import { jsx as ht, jsxs as gt } from "react/jsx-runtime";
21
21
  //#region src/helpers/getValidRlsConditionOptions.ts
22
- var ht = (e, t) => {
22
+ var _t = (e, t) => {
23
23
  if (!t?.[e.name]) return;
24
24
  let n = t?.[e.name]?.defaultOption?.toString(), r = (t?.[e.name]?.options)?.filter((t) => {
25
25
  if (t == null) return !1;
@@ -37,7 +37,7 @@ var ht = (e, t) => {
37
37
  "last",
38
38
  "this",
39
39
  "custom"
40
- ].includes(e || "") || n && !D({
40
+ ].includes(e || "") || n && !Re({
41
41
  endDate: t.endDate ?? t.toDate,
42
42
  endTime: t.endTime,
43
43
  startDate: t.startDate ?? t.fromDate,
@@ -66,7 +66,7 @@ var ht = (e, t) => {
66
66
  }) ? n : void 0,
67
67
  options: r
68
68
  };
69
- }, gt = ({ rlsConditions: e, isFrontendApp: t }) => e.filter((e) => (t || !e.isAppFilter) && !e.isHiddenInUi), _t = ut({}), vt = () => dt(_t), yt = /* @__PURE__ */ e(Ze()), bt = /;\s*$/, xt = (e) => e.replace(bt, ""), St = (e) => `${e?.token || ""}|${+!!e?.isFrontendApp}|${e?.clientId || ""}`, Ct = (e, t = {}) => e?.id ? e.drillConfig?.levels?.some((e) => !!e?.filters?.length) ? {
69
+ }, vt = ({ rlsConditions: e, isFrontendApp: t }) => e.filter((e) => (t || !e.isAppFilter) && !e.isHiddenInUi), yt = ft({}), bt = () => pt(yt), xt = /* @__PURE__ */ e(ie()), St = /;\s*$/, Ct = (e) => e.replace(St, ""), wt = (e) => `${e?.token || ""}|${+!!e?.isFrontendApp}|${e?.clientId || ""}`, Tt = (e, t = {}) => e?.id ? e.drillConfig?.levels?.some((e) => !!e?.filters?.length) ? {
70
70
  eligible: !1,
71
71
  reason: "drill-filtered"
72
72
  } : e.isEncrypted && !t.isGuestTokenSession ? {
@@ -75,14 +75,14 @@ var ht = (e, t) => {
75
75
  } : { eligible: !0 } : {
76
76
  eligible: !1,
77
77
  reason: "no-metric-id"
78
- }, wt = (e, t, n, r = "embed", i) => ({
78
+ }, Et = (e, t, n, r = "embed", i) => ({
79
79
  key: e,
80
80
  externalMetricId: t.id,
81
81
  ...r === "platform" && n ? { clientId: n } : {},
82
82
  ...r === "platform" && t.timezone ? { timezone: t.timezone } : {},
83
83
  ...t.isEncrypted && i ? {
84
- rlsConditions: t.rlsConditions?.length ? k(t.rlsConditions, i) : [],
85
- globalFilters: t.globalFilters?.filters?.length ? k(t.globalFilters, i) : {
84
+ rlsConditions: t.rlsConditions?.length ? Se(t.rlsConditions, i) : [],
85
+ globalFilters: t.globalFilters?.filters?.length ? Se(t.globalFilters, i) : {
86
86
  tableName: "",
87
87
  filters: []
88
88
  }
@@ -104,7 +104,7 @@ var ht = (e, t) => {
104
104
  comparisonCount: t.comparisonCount,
105
105
  drillConfig: t.drillConfig,
106
106
  ...t.isEncrypted && i ? { isEncrypted: !0 } : {}
107
- }), Tt = (e) => {
107
+ }), Dt = (e) => {
108
108
  let t = [];
109
109
  if (typeof e.data == "string") try {
110
110
  t = JSON.parse(e.data);
@@ -125,7 +125,7 @@ var ht = (e, t) => {
125
125
  ...e.notices ? { notices: e.notices } : {},
126
126
  ...e.error ? { error: e.error } : {}
127
127
  };
128
- }, Et = 45e3, Dt = 1e3, Ot = 1500, kt = class {
128
+ }, Ot = 45e3, kt = 1e3, At = 1500, jt = class {
129
129
  options;
130
130
  queue = [];
131
131
  flushScheduled = !1;
@@ -210,7 +210,7 @@ var ht = (e, t) => {
210
210
  }
211
211
  let n = /* @__PURE__ */ new Map();
212
212
  e.forEach((e) => {
213
- let t = St(e.session), r = n.get(t);
213
+ let t = wt(e.session), r = n.get(t);
214
214
  r ? r.push(e) : n.set(t, [e]);
215
215
  });
216
216
  let { coldHeadSize: r, maxBatchSize: i } = this.options, a = t ? Math.min(r, i) : 0, o = [];
@@ -241,7 +241,7 @@ var ht = (e, t) => {
241
241
  s = await this.options.transport(e.map((e) => e.request), t.signal, e[0]?.session || {}), i = !0, o();
242
242
  } catch (t) {
243
243
  if (i = !0, o(), r) {
244
- let t = new y(this.options.timeoutMs);
244
+ let t = new b(this.options.timeoutMs);
245
245
  e.forEach((e) => {
246
246
  e.reject(t);
247
247
  });
@@ -285,51 +285,51 @@ var ht = (e, t) => {
285
285
  this.settleWithFallback(e);
286
286
  return;
287
287
  }
288
- let r = Tt(n);
288
+ let r = Dt(n);
289
289
  e.resolve(r);
290
290
  });
291
291
  }
292
292
  settleWithFallback(e) {
293
293
  e.fallback().then(e.resolve, e.reject);
294
294
  }
295
- }, At = "dbnMetricBatch", jt = "@dbn:metricQueryBatch", Mt = () => {
295
+ }, Mt = "dbnMetricBatch", L = "@dbn:metricQueryBatch", Nt = () => {
296
296
  try {
297
- let e = window.localStorage.getItem(jt);
297
+ let e = window.localStorage.getItem(L);
298
298
  if (e === "on" || e === "off") return e;
299
299
  } catch {}
300
300
  return null;
301
- }, Nt = (e) => {
301
+ }, Pt = (e) => {
302
302
  try {
303
- e === null ? window.localStorage.removeItem(jt) : window.localStorage.setItem(jt, e);
303
+ e === null ? window.localStorage.removeItem(L) : window.localStorage.setItem(L, e);
304
304
  } catch {}
305
- }, Pt = () => {
305
+ }, Ft = () => {
306
306
  try {
307
- let e = new URLSearchParams(window.location.search).get(At);
308
- (e === "on" || e === "off") && Nt(e);
307
+ let e = new URLSearchParams(window.location.search).get(Mt);
308
+ (e === "on" || e === "off") && Pt(e);
309
309
  } catch {}
310
- }, z = () => typeof window > "u" || window.dbn?.disableMetricQueryBatch ? "off" : (Pt(), Mt() ?? "auto"), Ft = () => z() !== "off", B = /* @__PURE__ */ new Set(), It = () => {
310
+ }, R = () => typeof window > "u" || window.dbn?.disableMetricQueryBatch ? "off" : (Ft(), Nt() ?? "auto"), It = () => R() !== "off", z = /* @__PURE__ */ new Set(), Lt = () => {
311
311
  let e;
312
- return B.forEach((t) => {
312
+ return z.forEach((t) => {
313
313
  if (!e) try {
314
314
  let n = t();
315
315
  n && Object.keys(n).length && (e = n);
316
316
  } catch {}
317
317
  }), e;
318
- }, Lt = "/hasuraActions/externalMetricQueryBatch", Rt = "/api/v3/metric/queryBatch", zt = [
318
+ }, Rt = "/hasuraActions/externalMetricQueryBatch", zt = "/api/v3/metric/queryBatch", Bt = [
319
319
  404,
320
320
  405,
321
321
  501
322
- ], Bt = [
322
+ ], Vt = [
323
323
  200,
324
324
  400,
325
325
  401,
326
326
  403
327
- ], V = (e) => !!e.token || !!(e.isFrontendApp && e.clientId), Vt = (e = {}) => typeof window > "u" || typeof fetch != "function" || window.dbn?.isEnableProxyAuth ? null : V(e) ? "embed" : It() ? "platform" : null, Ht = (e = "platform") => `${window.dbn?.baseUrl || u}${e === "embed" ? Rt : Lt}`, Ut = async (e, t, r = {}) => {
328
- let i = Vt(r);
329
- if (!i) throw new v("No credentials available for batched queries");
327
+ ], B = (e) => !!e.token || !!(e.isFrontendApp && e.clientId), Ht = (e = {}) => typeof window > "u" || typeof fetch != "function" || window.dbn?.isEnableProxyAuth ? null : B(e) ? "embed" : Lt() ? "platform" : null, Ut = (e = "platform") => `${window.dbn?.baseUrl || u}${e === "embed" ? zt : Rt}`, Wt = async (e, t, r = {}) => {
328
+ let i = Ht(r);
329
+ if (!i) throw new y("No credentials available for batched queries");
330
330
  let a;
331
331
  if (i === "embed") a = await c({
332
- path: Rt,
332
+ path: zt,
333
333
  method: "POST",
334
334
  signal: t,
335
335
  token: r.token,
@@ -339,9 +339,9 @@ var ht = (e, t) => {
339
339
  throwOnHttpError: !1
340
340
  });
341
341
  else {
342
- let n = It();
343
- if (!n) throw new v("No access token available for batched queries");
344
- a = await fetch(Ht(i), {
342
+ let n = Lt();
343
+ if (!n) throw new y("No access token available for batched queries");
344
+ a = await fetch(Ut(i), {
345
345
  method: "POST",
346
346
  signal: t,
347
347
  headers: {
@@ -353,62 +353,62 @@ var ht = (e, t) => {
353
353
  body: JSON.stringify({ input: { input: { requests: e } } })
354
354
  });
355
355
  }
356
- if (zt.includes(a.status)) throw new _(`Batch endpoint responded ${a.status}`);
356
+ if (Bt.includes(a.status)) throw new v(`Batch endpoint responded ${a.status}`);
357
357
  let o;
358
358
  try {
359
359
  o = await a.json();
360
360
  } catch {
361
- throw new _("Batch endpoint returned a non-JSON body");
361
+ throw new v("Batch endpoint returned a non-JSON body");
362
362
  }
363
363
  let s = n(o);
364
364
  if (s?.code === "UNAUTHORIZED_ORIGIN" || s?.details?.reason === "UNAUTHORIZED_ORIGIN") throw Object.assign(Error(s.message || "UNAUTHORIZED_ORIGIN"), s, { code: "UNAUTHORIZED_ORIGIN" });
365
365
  let l = o?.error && typeof o.error == "object" ? o.error : void 0;
366
- if (l && Bt.includes(a.status)) throw new v(l.message || "Unauthorized request!");
367
- if (a.status === 401 || a.status === 403) throw new v(`Batch endpoint responded ${a.status}`);
366
+ if (l && Vt.includes(a.status)) throw new y(l.message || "Unauthorized request!");
367
+ if (a.status === 401 || a.status === 403) throw new y(`Batch endpoint responded ${a.status}`);
368
368
  if (!a.ok) throw Error(o?.message || `Batch request failed with status ${a.status}`);
369
- if (!Array.isArray(o?.results) && typeof o?.error != "string") throw new _("Batch endpoint response did not match the expected shape");
369
+ if (!Array.isArray(o?.results) && typeof o?.error != "string") throw new v("Batch endpoint response did not match the expected shape");
370
370
  return o;
371
- }, Wt = null, Gt = 50, Kt = 4, qt = () => (Wt ||= new kt({
372
- transport: Ut,
371
+ }, Gt = null, Kt = 50, qt = 4, Jt = () => (Gt ||= new jt({
372
+ transport: Wt,
373
373
  coalesceWindowMs: 500,
374
- visibleCoalesceWindowMs: Gt,
375
- coalesceIdleMs: Dt,
376
- coalesceMaxWaitMs: Ot,
377
- coldHeadSize: Kt
378
- }), Wt), Jt = async ({ payload: e, savedMetricQuery: t, dbName: n, savedMetricIdentifiers: r, clientId: i, key: a, hints: o, batchPolicy: s, session: c, single: l }) => {
379
- t !== void 0 && ue(t, "metric.query", n), ge(r);
380
- let u = Ee(e);
381
- if (!Ft()) return l(u);
382
- let d = Vt(c);
383
- if (!d || !Ct(u, o).eligible) return l(u);
374
+ visibleCoalesceWindowMs: Kt,
375
+ coalesceIdleMs: kt,
376
+ coalesceMaxWaitMs: At,
377
+ coldHeadSize: qt
378
+ }), Gt), Yt = async ({ payload: e, savedMetricQuery: t, dbName: n, savedMetricIdentifiers: r, clientId: i, key: a, hints: o, batchPolicy: s, session: c, single: l }) => {
379
+ t !== void 0 && ge(t, "metric.query", n), Ge(r);
380
+ let u = Oe(e);
381
+ if (!It()) return l(u);
382
+ let d = Ht(c);
383
+ if (!d || !Tt(u, o).eligible) return l(u);
384
384
  let f = {
385
- request: wt(a, u, i, d, c?.token),
385
+ request: Et(a, u, i, d, c?.token),
386
386
  fallback: () => l(u),
387
387
  batchPolicy: s,
388
388
  session: c
389
389
  };
390
- return qt().enqueue(f);
391
- }, Yt = ut("standard"), Xt = 134217728, Zt = /* @__PURE__ */ new WeakMap(), Qt = (e, t = /* @__PURE__ */ new WeakSet()) => {
390
+ return Jt().enqueue(f);
391
+ }, Xt = ft("standard"), Zt = 134217728, Qt = /* @__PURE__ */ new WeakMap(), $t = (e, t = /* @__PURE__ */ new WeakSet()) => {
392
392
  if (e == null) return 0;
393
393
  if (typeof e == "string") return e.length * 2;
394
394
  if (typeof e == "number" || typeof e == "bigint") return 8;
395
395
  if (typeof e == "boolean") return 4;
396
396
  if (typeof e != "object") return 0;
397
- let n = e, r = Zt.get(n);
397
+ let n = e, r = Qt.get(n);
398
398
  if (r !== void 0) return r;
399
399
  if (t.has(n)) return 0;
400
400
  t.add(n);
401
401
  let i = 32;
402
- if (Array.isArray(e)) for (let n of e) i += 8 + Qt(n, t);
403
- else for (let [n, r] of Object.entries(e)) i += n.length * 2 + 8 + Qt(r, t);
404
- return Zt.set(n, i), i;
405
- }, $t = (e, { maxEntries: t = 128, maxBytes: n = Xt } = {}) => {
402
+ if (Array.isArray(e)) for (let n of e) i += 8 + $t(n, t);
403
+ else for (let [n, r] of Object.entries(e)) i += n.length * 2 + 8 + $t(r, t);
404
+ return Qt.set(n, i), i;
405
+ }, en = (e, { maxEntries: t = 128, maxBytes: n = Zt } = {}) => {
406
406
  let r = e.getQueryCache().findAll({
407
407
  queryKey: [f],
408
408
  type: "inactive"
409
409
  }).map((e) => ({
410
410
  query: e,
411
- bytes: Qt(e.state.data)
411
+ bytes: $t(e.state.data)
412
412
  })).sort((e, t) => e.query.state.dataUpdatedAt - t.query.state.dataUpdatedAt), i = r.reduce((e, t) => e + t.bytes, 0);
413
413
  for (; r.length > t || i > n && r.length > 1;) {
414
414
  let t = r.shift();
@@ -419,11 +419,11 @@ var ht = (e, t) => {
419
419
  type: "inactive"
420
420
  });
421
421
  }
422
- }, H = /* @__PURE__ */ new WeakSet(), en = (e) => {
423
- if (H.has(e)) return;
424
- H.add(e);
422
+ }, V = /* @__PURE__ */ new WeakSet(), tn = (e) => {
423
+ if (V.has(e)) return;
424
+ V.add(e);
425
425
  let t = () => {
426
- H.delete(e), $t(e);
426
+ V.delete(e), en(e);
427
427
  }, n = globalThis.scheduler;
428
428
  if (typeof n?.postTask == "function") {
429
429
  n.postTask(t, { priority: "background" });
@@ -434,43 +434,43 @@ var ht = (e, t) => {
434
434
  return;
435
435
  }
436
436
  setTimeout(t, 0);
437
- }, U = (e) => {
437
+ }, H = (e) => {
438
438
  let t = Object.getPrototypeOf(e);
439
439
  return (t === Object.prototype || t === null) && !("toJSON" in e);
440
- }, W = (e, t) => {
440
+ }, U = (e, t) => {
441
441
  if (e === t) return !0;
442
442
  if (e === null || t === null || typeof e != "object" || typeof t != "object") return !1;
443
443
  if (Array.isArray(e)) {
444
444
  if (!Array.isArray(t) || e.length !== t.length) return !1;
445
- for (let n = 0; n < e.length; n += 1) if (!W(e[n], t[n])) return !1;
445
+ for (let n = 0; n < e.length; n += 1) if (!U(e[n], t[n])) return !1;
446
446
  return !0;
447
447
  }
448
- if (Array.isArray(t) || !U(e) || !U(t)) return !1;
448
+ if (Array.isArray(t) || !H(e) || !H(t)) return !1;
449
449
  let n = Object.keys(e);
450
450
  if (n.length !== Object.keys(t).length) return !1;
451
- for (let r of n) if (!Object.hasOwn(t, r) || !W(e[r], t[r])) return !1;
451
+ for (let r of n) if (!Object.hasOwn(t, r) || !U(e[r], t[r])) return !1;
452
452
  return !0;
453
- }, tn = "dbn:metric-query:guest-principal:v1", nn = 8, G = /* @__PURE__ */ new Map(), rn = (e) => {
453
+ }, nn = "dbn:metric-query:guest-principal:v1", rn = 8, W = /* @__PURE__ */ new Map(), an = (e) => {
454
454
  if (!e) return;
455
- let t = G.get(e);
455
+ let t = W.get(e);
456
456
  if (t !== void 0) return t;
457
- let n = yt.default.HmacSHA256(e, tn).toString(yt.default.enc.Hex);
458
- if (G.size >= nn) {
459
- let e = G.keys().next().value;
460
- e !== void 0 && G.delete(e);
457
+ let n = xt.default.HmacSHA256(e, nn).toString(xt.default.enc.Hex);
458
+ if (W.size >= rn) {
459
+ let e = W.keys().next().value;
460
+ e !== void 0 && W.delete(e);
461
461
  }
462
- return G.set(e, n), n;
463
- }, an = "dbn:metric-query:client-scope:v1", on = 16, sn = /* @__PURE__ */ new Map(), cn = (e) => {
462
+ return W.set(e, n), n;
463
+ }, on = "dbn:metric-query:client-scope:v1", sn = 16, cn = /* @__PURE__ */ new Map(), ln = (e) => {
464
464
  if (!e) return;
465
- let t = sn.get(e);
465
+ let t = cn.get(e);
466
466
  if (t !== void 0) return t;
467
- let n = yt.default.HmacSHA256(e, an).toString(yt.default.enc.Hex);
468
- if (sn.size >= on) {
469
- let e = sn.keys().next().value;
470
- e !== void 0 && sn.delete(e);
467
+ let n = xt.default.HmacSHA256(e, on).toString(xt.default.enc.Hex);
468
+ if (cn.size >= sn) {
469
+ let e = cn.keys().next().value;
470
+ e !== void 0 && cn.delete(e);
471
471
  }
472
- return sn.set(e, n), n;
473
- }, ln = [
472
+ return cn.set(e, n), n;
473
+ }, un = [
474
474
  "updatedAt",
475
475
  "query",
476
476
  "metricQuery",
@@ -483,56 +483,56 @@ var ht = (e, t) => {
483
483
  "groupBy",
484
484
  "selectedGroupBy",
485
485
  "timeGrain"
486
- ], un = /* @__PURE__ */ new WeakMap(), dn = (e) => {
486
+ ], dn = /* @__PURE__ */ new WeakMap(), fn = (e) => {
487
487
  if (!e) return;
488
- let t = un.get(e);
488
+ let t = dn.get(e);
489
489
  if (t !== void 0) return t;
490
- let n = e, r = yt.default.SHA256(JSON.stringify(ln.map((e) => n[e] ?? null))).toString(yt.default.enc.Hex).slice(0, 16);
491
- return un.set(e, r), r;
492
- }, K = (e, t, n) => {
490
+ let n = e, r = xt.default.SHA256(JSON.stringify(un.map((e) => n[e] ?? null))).toString(xt.default.enc.Hex).slice(0, 16);
491
+ return dn.set(e, r), r;
492
+ }, G = (e, t, n) => {
493
493
  if (!t) return e;
494
- let r = cn(n);
494
+ let r = ln(n);
495
495
  return r ? { clientScope: r } : e;
496
- }, fn = ({ queryName: e, data: t, clientId: n, clientCacheScope: r, isFrontendApp: i, token: a, isFullScreen: o, metricRevision: s }) => [
496
+ }, pn = ({ queryName: e, data: t, clientId: n, clientCacheScope: r, isFrontendApp: i, token: a, isFullScreen: o, metricRevision: s }) => [
497
497
  e,
498
498
  t,
499
- K(n, i, r),
499
+ G(n, i, r),
500
500
  i,
501
- a ? { guestPrincipal: rn(a) } : void 0,
501
+ a ? { guestPrincipal: an(a) } : void 0,
502
502
  o,
503
503
  s
504
- ], pn = (e, t) => !e || !!t, mn = /* @__PURE__ */ new WeakMap(), hn = 512, gn = /* @__PURE__ */ new Map(), _n = (e) => {
504
+ ], mn = (e, t) => !e || !!t, hn = /* @__PURE__ */ new WeakMap(), gn = 512, _n = /* @__PURE__ */ new Map(), vn = (e) => {
505
505
  switch (typeof e) {
506
506
  case "string": return JSON.stringify(e);
507
507
  case "boolean": return e ? "true" : "false";
508
508
  case "undefined": return "null";
509
- default: return ee([e]).slice(1, -1);
509
+ default: return h([e]).slice(1, -1);
510
510
  }
511
- }, vn = (e, t, n) => {
512
- if (gn.delete(e), gn.size >= hn) {
513
- let e = gn.keys().next().value;
514
- e !== void 0 && gn.delete(e);
511
+ }, yn = (e, t, n) => {
512
+ if (_n.delete(e), _n.size >= gn) {
513
+ let e = _n.keys().next().value;
514
+ e !== void 0 && _n.delete(e);
515
515
  }
516
- gn.set(e, {
516
+ _n.set(e, {
517
517
  payload: t,
518
518
  hash: n
519
519
  });
520
- }, yn = (e) => {
521
- if (typeof e != "object" || !e) return _n(e);
522
- let t = mn.get(e);
520
+ }, bn = (e) => {
521
+ if (typeof e != "object" || !e) return vn(e);
522
+ let t = hn.get(e);
523
523
  if (t !== void 0) return t;
524
- let n = e.id, r = typeof n == "string" ? gn.get(n) : void 0, i = r && W(r.payload, e) ? r.hash : _n(e);
525
- return mn.set(e, i), typeof n == "string" && vn(n, e, i), i;
526
- }, bn = (e) => `[${e.map((e, t) => t === 1 ? yn(e) : _n(e)).join(",")}]`, q = ({ queryName: e, workspaceId: t, guestToken: n, isFrontendApp: r, encryptedClientId: i }) => [
524
+ let n = e.id, r = typeof n == "string" ? _n.get(n) : void 0, i = r && U(r.payload, e) ? r.hash : vn(e);
525
+ return hn.set(e, i), typeof n == "string" && yn(n, e, i), i;
526
+ }, xn = (e) => `[${e.map((e, t) => t === 1 ? bn(e) : vn(e)).join(",")}]`, K = ({ queryName: e, workspaceId: t, guestToken: n, isFrontendApp: r, encryptedClientId: i }) => [
527
527
  e,
528
528
  t,
529
529
  {
530
- guestPrincipal: rn(n),
530
+ guestPrincipal: an(n),
531
531
  isFrontendApp: r,
532
532
  encryptedClientId: i
533
533
  }
534
- ], xn = ({ clientId: e, clientCacheScope: n, metricRevision: r, data: i, token: a, isFrontendApp: s, isFullScreen: c = "", batchHints: l, savedMetricQuery: u, savedMetricIdentifiers: d, dbName: m, timeoutMs: ee = Et }, _) => {
535
- let v = g(), y = dt(Yt), te = !!i.id && !_?.isDisableQuery && (!s || !!e), b = fn({
534
+ ], Sn = ({ clientId: e, clientCacheScope: n, metricRevision: r, data: i, token: a, isFrontendApp: s, isFullScreen: c = "", batchHints: l, savedMetricQuery: u, savedMetricIdentifiers: d, dbName: m, timeoutMs: h = Ot }, v) => {
535
+ let y = _(), b = pt(Xt), x = !!i.id && !v?.isDisableQuery && (!s || !!e), S = pn({
536
536
  queryName: f,
537
537
  data: i,
538
538
  clientId: e,
@@ -542,42 +542,42 @@ var ht = (e, t) => {
542
542
  isFullScreen: c,
543
543
  metricRevision: r
544
544
  });
545
- F(() => {
546
- E() && p("metric-query-enabled-state", {
547
- isQueryEnabled: te,
545
+ N(() => {
546
+ O() && p("metric-query-enabled-state", {
547
+ isQueryEnabled: x,
548
548
  hasMetricId: !!i.id,
549
- isDisableQuery: !!_?.isDisableQuery,
549
+ isDisableQuery: !!v?.isDisableQuery,
550
550
  isFrontendApp: s,
551
551
  hasClientId: !!e,
552
552
  hasToken: !!a,
553
553
  isFullScreen: c,
554
- payload: w(i)
554
+ payload: E(i)
555
555
  });
556
556
  }, [
557
- te,
557
+ x,
558
558
  i,
559
- _?.isDisableQuery,
559
+ v?.isDisableQuery,
560
560
  s,
561
561
  e,
562
562
  a,
563
563
  c
564
564
  ]);
565
- let x = (t) => {
565
+ let C = (t) => {
566
566
  let n = t || i;
567
- return E() && p("metric-query-fetch-start", {
567
+ return O() && p("metric-query-fetch-start", {
568
568
  path: o,
569
569
  clientId: e,
570
570
  isFrontendApp: s,
571
571
  hasToken: !!a,
572
572
  isFullScreen: c,
573
- payload: w(n)
574
- }), T(o, {
573
+ payload: E(n)
574
+ }), D(o, {
575
575
  method: "POST",
576
576
  data: {
577
577
  ...n || {},
578
578
  ...!s && a ? {
579
- ...Array.isArray(n?.rlsConditions) && n.rlsConditions.length ? { rlsConditions: k(n.rlsConditions, a) } : { rlsConditions: [] },
580
- ...typeof n?.globalFilters == "object" && n.globalFilters !== null && "filters" in n.globalFilters && Array.isArray(n.globalFilters.filters) && n.globalFilters.filters.length ? { globalFilters: k(n.globalFilters, a) } : { globalFilters: {
579
+ ...Array.isArray(n?.rlsConditions) && n.rlsConditions.length ? { rlsConditions: Se(n.rlsConditions, a) } : { rlsConditions: [] },
580
+ ...typeof n?.globalFilters == "object" && n.globalFilters !== null && "filters" in n.globalFilters && Array.isArray(n.globalFilters.filters) && n.globalFilters.filters.length ? { globalFilters: Se(n.globalFilters, a) } : { globalFilters: {
581
581
  tableName: "",
582
582
  filters: []
583
583
  } }
@@ -586,16 +586,16 @@ var ht = (e, t) => {
586
586
  isFrontend: s,
587
587
  clientId: e,
588
588
  token: a,
589
- timeoutMs: ee
589
+ timeoutMs: h
590
590
  });
591
- }, S = N({
592
- queryKey: b,
593
- queryKeyHashFn: bn,
594
- queryFn: () => (E() && p("metric-query-dispatch", {
591
+ }, w = j({
592
+ queryKey: S,
593
+ queryKeyHashFn: xn,
594
+ queryFn: () => (O() && p("metric-query-dispatch", {
595
595
  metricId: i?.id,
596
- payload: w(i)
597
- }), Jt({
598
- batchPolicy: y,
596
+ payload: E(i)
597
+ }), Yt({
598
+ batchPolicy: b,
599
599
  payload: i,
600
600
  savedMetricQuery: u,
601
601
  savedMetricIdentifiers: d,
@@ -611,63 +611,63 @@ var ht = (e, t) => {
611
611
  isFrontendApp: s,
612
612
  clientId: e
613
613
  },
614
- single: x
614
+ single: C
615
615
  })),
616
- enabled: te,
617
- meta: a || !pn(s, n) ? { persist: !1 } : void 0,
618
- retry: (e, n) => t(n).code !== "UNAUTHORIZED_ORIGIN" && !h(n) && e < 2,
616
+ enabled: x,
617
+ meta: a || !mn(s, n) ? { persist: !1 } : void 0,
618
+ retry: (e, n) => t(n).code !== "UNAUTHORIZED_ORIGIN" && !g(n) && e < 2,
619
619
  staleTime: 3e5,
620
620
  gcTime: 9e5
621
- }), ne = bn(b), C = I(() => ({
622
- queryHash: ne,
623
- dataUpdatedAt: S.dataUpdatedAt,
624
- errorUpdatedAt: S.errorUpdatedAt,
625
- fetchStatus: S.fetchStatus,
626
- isSuccess: S.isSuccess,
627
- isError: S.isError,
628
- data: S.data,
629
- error: S.error
621
+ }), ee = xn(S), T = P(() => ({
622
+ queryHash: ee,
623
+ dataUpdatedAt: w.dataUpdatedAt,
624
+ errorUpdatedAt: w.errorUpdatedAt,
625
+ fetchStatus: w.fetchStatus,
626
+ isSuccess: w.isSuccess,
627
+ isError: w.isError,
628
+ data: w.data,
629
+ error: w.error
630
630
  }), [
631
- ne,
632
- S.dataUpdatedAt,
633
- S.errorUpdatedAt,
634
- S.fetchStatus,
635
- S.isSuccess,
636
- S.isError,
637
- S.data,
638
- S.error
639
- ]), re = L(i);
640
- re.current = i;
641
- let D = L(_);
642
- return D.current = _, F(() => {
643
- if (!C.isSuccess || C.fetchStatus !== "idle") return;
644
- let e = C.data;
645
- E() && p("metric-query-success", {
646
- payload: w(re.current),
631
+ ee,
632
+ w.dataUpdatedAt,
633
+ w.errorUpdatedAt,
634
+ w.fetchStatus,
635
+ w.isSuccess,
636
+ w.isError,
637
+ w.data,
638
+ w.error
639
+ ]), te = F(i);
640
+ te.current = i;
641
+ let ne = F(v);
642
+ return ne.current = v, N(() => {
643
+ if (!T.isSuccess || T.fetchStatus !== "idle") return;
644
+ let e = T.data;
645
+ O() && p("metric-query-success", {
646
+ payload: E(te.current),
647
647
  responseDataType: typeof e?.data,
648
648
  responseRowCount: Array.isArray(e?.data) ? e?.data?.length : void 0,
649
649
  totalRecords: e?.totalRecords
650
- }), D.current?.onSuccess?.(e), en(v);
651
- }, [C, v]), F(() => () => en(v), [v]), F(() => {
652
- if (C.fetchStatus !== "idle" || !C.isSuccess && !C.isError) return;
653
- let e = C.data, t = C.error;
654
- E() && p("metric-query-settled", {
655
- payload: w(re.current),
650
+ }), ne.current?.onSuccess?.(e), tn(y);
651
+ }, [T, y]), N(() => () => tn(y), [y]), N(() => {
652
+ if (T.fetchStatus !== "idle" || !T.isSuccess && !T.isError) return;
653
+ let e = T.data, t = T.error;
654
+ O() && p("metric-query-settled", {
655
+ payload: E(te.current),
656
656
  hasError: !!t,
657
657
  errorMessage: t instanceof Error ? t.message : t?.message,
658
658
  responseDataType: typeof e?.data,
659
659
  responseRowCount: Array.isArray(e?.data) ? e?.data?.length : void 0
660
- }), D.current?.onSettled?.(e, t);
661
- }, [C]), S;
662
- }, J = async ({ workspaceId: e, token: t, isFrontend: n, encryptedClientId: i }) => (n && await l(), T(`${r}?id=${e}`, {
660
+ }), ne.current?.onSettled?.(e, t);
661
+ }, [T]), w;
662
+ }, q = async ({ workspaceId: e, token: t, isFrontend: n, encryptedClientId: i }) => (n && await l(), D(`${r}?id=${e}`, {
663
663
  method: "GET",
664
664
  token: n ? "" : t || "",
665
665
  isFrontend: n,
666
666
  clientId: i
667
- })), Sn = (e, t, n, r) => {
668
- let { token: i } = xe(), o = n ? "" : t || i || "";
669
- return N({
670
- queryKey: q({
667
+ })), Cn = (e, t, n, r) => {
668
+ let { token: i } = ue(), o = n ? "" : t || i || "";
669
+ return j({
670
+ queryKey: K({
671
671
  queryName: a,
672
672
  workspaceId: e,
673
673
  guestToken: o,
@@ -675,7 +675,7 @@ var ht = (e, t) => {
675
675
  encryptedClientId: r
676
676
  }),
677
677
  meta: { persist: !1 },
678
- queryFn: () => J({
678
+ queryFn: () => q({
679
679
  workspaceId: e,
680
680
  token: o,
681
681
  isFrontend: n,
@@ -683,17 +683,17 @@ var ht = (e, t) => {
683
683
  }),
684
684
  enabled: !!e
685
685
  });
686
- }, Cn = ({ language: e, translationDictionary: t }) => !e || !t ? !1 : Object.values(t).some((t) => !!t?.[e]), wn = ({ language: e, translationDictionary: t }) => !Cn({
686
+ }, wn = ({ language: e, translationDictionary: t }) => !e || !t ? !1 : Object.values(t).some((t) => !!t?.[e]), Tn = ({ language: e, translationDictionary: t }) => !wn({
687
687
  language: e,
688
688
  translationDictionary: t
689
- }), Tn = ({ language: e, tableLimit: t, translationDictionary: n }) => wn({
689
+ }), En = ({ language: e, tableLimit: t, translationDictionary: n }) => Tn({
690
690
  language: e,
691
691
  translationDictionary: n
692
692
  }) ? {
693
693
  limit: String(t.limit),
694
694
  offset: String(t.offset)
695
- } : {}, Y = ({ language: e, search: t, searchColumns: n, translationDictionary: r }) => {
696
- if (!wn({
695
+ } : {}, J = ({ language: e, search: t, searchColumns: n, translationDictionary: r }) => {
696
+ if (!Tn({
697
697
  language: e,
698
698
  translationDictionary: r
699
699
  })) return {};
@@ -702,13 +702,13 @@ var ht = (e, t) => {
702
702
  search: i && a ? i : void 0,
703
703
  searchColumns: i && a ? n : void 0
704
704
  };
705
- }, En = ({ currentSearchValue: e, nextValue: t, shouldUseServerSideSearch: n, tableLimit: r }) => {
705
+ }, Dn = ({ currentSearchValue: e, nextValue: t, shouldUseServerSideSearch: n, tableLimit: r }) => {
706
706
  let i = String(t).trim() !== (e || "").trim(), a = r.offset !== 0;
707
707
  return {
708
708
  shouldResetPageOffset: a,
709
709
  shouldSetTablePending: a || n && i
710
710
  };
711
- }, Dn = ({ isPythonMode: e, search: t, shouldUseServerSideSearch: n }) => e ? !0 : !n, On = ({ columnName: e, disableDownloadUnderlyingDataNoFilters: t, isLoading: n, isSingleValueChart: r }) => !n && !t && !!(e || r), kn = ({ isPrev: e, nextOffset: t, prev: n, resetValue: r }) => r === void 0 ? t === void 0 ? {
711
+ }, On = ({ isPythonMode: e, search: t, shouldUseServerSideSearch: n }) => e ? !0 : !n, kn = ({ columnName: e, disableDownloadUnderlyingDataNoFilters: t, isLoading: n, isSingleValueChart: r }) => !n && !t && !!(e || r), An = ({ isPrev: e, nextOffset: t, prev: n, resetValue: r }) => r === void 0 ? t === void 0 ? {
712
712
  limit: n.limit,
713
713
  offset: e ? Math.max(n.offset - n.limit, 0) : n.offset + n.limit
714
714
  } : {
@@ -717,15 +717,15 @@ var ht = (e, t) => {
717
717
  } : {
718
718
  limit: r,
719
719
  offset: 0
720
- }, An = (e) => e == null ? e : _e(e.toString()), jn = (e, t) => [...e ?? [], ...t ?? []].some((e) => !!e?.columnName && e.value !== void 0), Mn = (e = []) => e.filter((e) => e?.columnName && e.value !== void 0), X = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => {
721
- let o = Mn(n);
720
+ }, jn = (e) => e == null ? e : k(e.toString()), Mn = (e, t) => [...e ?? [], ...t ?? []].some((e) => !!e?.columnName && e.value !== void 0), Nn = (e = []) => e.filter((e) => e?.columnName && e.value !== void 0), Y = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => {
721
+ let o = Nn(n);
722
722
  return i || !e || a === void 0 ? o : [...o.filter((t) => t.columnName !== e || String(t.value) !== String(a)), {
723
723
  columnName: e,
724
724
  dataType: t,
725
725
  expressionSql: r,
726
726
  value: a
727
727
  }];
728
- }, Nn = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => X({
728
+ }, Pn = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => Y({
729
729
  columnName: e,
730
730
  dataType: t,
731
731
  drillFilters: n,
@@ -736,30 +736,30 @@ var ht = (e, t) => {
736
736
  columnName: e.columnName,
737
737
  dataType: e.dataType,
738
738
  expressionSql: e.expressionSql,
739
- value: An(e.value)
740
- })), Pn = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => X({
739
+ value: jn(e.value)
740
+ })), Fn = ({ columnName: e, dataType: t, drillFilters: n = [], expressionSql: r, isSingleValueChart: i, value: a }) => Y({
741
741
  columnName: e,
742
742
  dataType: t,
743
743
  drillFilters: n,
744
744
  expressionSql: r,
745
745
  isSingleValueChart: i,
746
746
  value: a
747
- }), Fn = ({ query: e, limit: t, offset: n, dbName: r }) => {
748
- let i = M === r?.toLowerCase(), a = [Be, Ke].includes(r?.toLowerCase() || ""), o = A === r?.toLowerCase(), s = (e) => n ? `OFFSET ${n} LIMIT ${e}` : `LIMIT ${e}`, c = xt(e), l = (c?.toLowerCase() ?? "").includes("order"), u = parseInt(t, 10);
747
+ }), In = ({ query: e, limit: t, offset: n, dbName: r }) => {
748
+ let i = se === r?.toLowerCase(), a = [Ye, Fe].includes(r?.toLowerCase() || ""), o = Ce === r?.toLowerCase(), s = (e) => n ? `OFFSET ${n} LIMIT ${e}` : `LIMIT ${e}`, c = Ct(e), l = (c?.toLowerCase() ?? "").includes("order"), u = parseInt(t, 10);
749
749
  if (c?.toLowerCase().includes("limit")) {
750
750
  let e = parseInt(c?.toLowerCase().split("limit")?.[1]?.trim() ?? "0", 10), r = n ? t : Math.min(e, u);
751
751
  o ? (c = c.replace(`limit ${e}`, s(r)), c = c.replace(`LIMIT ${e}`, s(r))) : a || i ? (c = c.replace(`limit ${e}`, `${l || i || o ? "" : "order by(select null)"} ${`offset ${n || 0} rows`} fetch next ${r} rows only`), c = c.replace(`LIMIT ${e}`, `${l || i || o ? "" : " ORDER BY(SELECT NULL) "} OFFSET ${n || 0} ROWS FETCH NEXT ${r} ROWS ONLY`)) : (c = c.replace(`limit ${e}`, `limit ${r} ${n ? `OFFSET ${n}` : ""}`), c = c.replace(`LIMIT ${e}`, `LIMIT ${r} ${n ? `OFFSET ${n}` : ""}`));
752
752
  } else c?.toLowerCase().includes("fetch") || c?.toLowerCase().includes("limit") || (r?.toLowerCase() === "mssql" || r?.toLowerCase() === "athena" || r?.toLowerCase() === "microsoft fabric" ? c += ` ${l || i || o ? "" : " ORDER BY(SELECT NULL) "} ${`offset ${n || 0} rows`} fetch next ${u} rows only` : c += o ? ` ${s(u)}` : ` limit ${u} ${n ? `OFFSET ${n}` : ""}`);
753
753
  return c;
754
- }, In = (e) => {
754
+ }, Ln = (e) => {
755
755
  try {
756
756
  return JSON.stringify(e);
757
757
  } catch {
758
758
  return String(Date.now()) + ":" + Math.random().toString(36).slice(2);
759
759
  }
760
- }, Ln = (e, t) => {
760
+ }, Rn = (e, t) => {
761
761
  if (t?.error && !(Array.isArray(t?.data) && t.data.length)) {
762
- Rn(e, t.error);
762
+ zn(e, t.error);
763
763
  return;
764
764
  }
765
765
  let n = t?.data, r = typeof t?.totalRecords == "number" ? t.totalRecords : 0, i = n && Array.isArray(n) && n.length ? n : [];
@@ -767,36 +767,36 @@ var ht = (e, t) => {
767
767
  e.setTotalRecords?.(r), e.setData(i), e.setLoading(!1);
768
768
  });
769
769
  };
770
- function Rn(e, t) {
770
+ function zn(e, t) {
771
771
  e.forEach((e) => {
772
772
  e.onError?.(t), e.setData([]), e.setLoading(!1), e.setTotalRecords?.(0);
773
773
  });
774
774
  }
775
- var zn = ({ datasourceId: e, clientName: t, dbName: n, tenancyType: r, values: i, query: a, companyId: o, workspaceId: s, metricId: c, dashboardId: l, token: u, isFrontendApp: d, encryptedClientId: f, globalFilters: p, isAllClient: m, rlsConditions: ee, dataMartRelationships: h, customSql: g, isEnableCustomSQL: _, drillFilters: v }) => {
776
- let { mutateAsync: y } = C(), { data: te } = Sn(s, void 0, d, f), b = te?.weekStartDay === "sunday" ? "sunday" : "monday", x = L(/* @__PURE__ */ new Map()), S = L({
775
+ var Bn = ({ datasourceId: e, clientName: t, dbName: n, tenancyType: r, values: i, query: a, companyId: o, workspaceId: s, metricId: c, dashboardId: l, token: u, isFrontendApp: d, encryptedClientId: f, globalFilters: p, isAllClient: m, rlsConditions: h, dataMartRelationships: g, customSql: _, isEnableCustomSQL: v, drillFilters: y }) => {
776
+ let { mutateAsync: b } = T(), { data: x } = Cn(s, void 0, d, f), S = x?.weekStartDay === "sunday" ? "sunday" : "monday", C = F(/* @__PURE__ */ new Map()), w = F({
777
777
  token: u,
778
778
  epoch: 0
779
779
  });
780
- S.current.token !== u && (S.current = {
780
+ w.current.token !== u && (w.current = {
781
781
  token: u,
782
- epoch: S.current.epoch + 1
782
+ epoch: w.current.epoch + 1
783
783
  });
784
- let ne = S.current.epoch;
785
- return F(() => {
786
- let e = x.current;
784
+ let ee = w.current.epoch;
785
+ return N(() => {
786
+ let e = C.current;
787
787
  return () => {
788
788
  e.clear();
789
789
  };
790
- }, []), { getUnderlyingData: P(({ columnName: te, dataType: S, expressionSql: C, value: w, setData: T, setLoading: re, isSingleValueChart: E, clientColumnType: D, limit: ie, offset: O, search: ae, searchColumns: oe, setTotalRecords: se, pointFilters: ce, onError: le, withoutFilters: ue }) => {
791
- let de = r === "MULTI_DATABASE" && t || "", fe = _ && g ? g : ie !== void 0 || O !== void 0 ? a : Fn({
790
+ }, []), { getUnderlyingData: M(({ columnName: x, dataType: w, expressionSql: T, value: E, setData: D, setLoading: te, isSingleValueChart: O, clientColumnType: ne, limit: re, offset: ie, search: ae, searchColumns: oe, setTotalRecords: se, pointFilters: ce, onError: le, withoutFilters: ue }) => {
791
+ let de = r === "MULTI_DATABASE" && t || "", fe = v && _ ? _ : re !== void 0 || ie !== void 0 ? a : In({
792
792
  query: a,
793
793
  limit: "5000",
794
794
  dbName: n
795
795
  }), pe = ue ? {
796
796
  ...p,
797
797
  filters: p.filters.filter((e) => e.isVariableFilter)
798
- } : p, me = ee, he = Re({
799
- clientColumnType: D,
798
+ } : p, me = h, he = He({
799
+ clientColumnType: ne,
800
800
  query: fe || "",
801
801
  dbName: n,
802
802
  rlsConditions: me,
@@ -805,116 +805,116 @@ var zn = ({ datasourceId: e, clientName: t, dbName: n, tenancyType: r, values: i
805
805
  globalFilters: pe,
806
806
  values: i,
807
807
  isAllClient: m,
808
- dataMartRelationships: h,
809
- weekStartDay: b
810
- }), ge = E && !_ ? it(he) : he, k = jn(v, ce) ? Nn({
811
- columnName: te,
812
- dataType: S,
813
- drillFilters: ce?.length ? [...v ?? [], ...ce] : v,
814
- expressionSql: C,
815
- isSingleValueChart: E,
816
- value: w
817
- }) : [], A = {
818
- columnName: E ? void 0 : te,
808
+ dataMartRelationships: g,
809
+ weekStartDay: S
810
+ }), ge = O && !v ? ot(he) : he, _e = Mn(y, ce) ? Pn({
811
+ columnName: x,
812
+ dataType: w,
813
+ drillFilters: ce?.length ? [...y ?? [], ...ce] : y,
814
+ expressionSql: T,
815
+ isSingleValueChart: O,
816
+ value: E
817
+ }) : [], k = {
818
+ columnName: O ? void 0 : x,
819
819
  companyId: o,
820
- query: j(ge, o),
821
- dataType: E ? void 0 : S,
822
- expressionSql: E ? void 0 : C,
823
- value: E ? void 0 : An(w),
824
- drillFilters: k.length ? k : void 0,
820
+ query: $e(ge, o),
821
+ dataType: O ? void 0 : w,
822
+ expressionSql: O ? void 0 : T,
823
+ value: O ? void 0 : jn(E),
824
+ drillFilters: _e.length ? _e : void 0,
825
825
  workspaceId: s,
826
826
  metricId: c,
827
827
  dashboardId: l,
828
- isCustomSql: _ && !!g,
828
+ isCustomSql: v && !!_,
829
829
  databaseName: de,
830
830
  datasourceId: e,
831
- limit: ie,
832
- offset: O,
831
+ limit: re,
832
+ offset: ie,
833
833
  search: ae,
834
834
  searchColumns: oe,
835
835
  globalFilters: pe,
836
836
  rlsConditions: me,
837
837
  filterValues: i,
838
- isSingleValueChart: E && !_
838
+ isSingleValueChart: O && !v
839
839
  };
840
- T([]), re(!0);
841
- let _e = In({
842
- columnName: A.columnName,
843
- value: A.value,
844
- dataType: A.dataType,
845
- expressionSql: A.expressionSql,
846
- drillFilters: A.drillFilters,
847
- limit: A.limit,
848
- offset: A.offset,
849
- search: A.search,
850
- searchColumns: A.searchColumns,
840
+ D([]), te(!0);
841
+ let ve = Ln({
842
+ columnName: k.columnName,
843
+ value: k.value,
844
+ dataType: k.dataType,
845
+ expressionSql: k.expressionSql,
846
+ drillFilters: k.drillFilters,
847
+ limit: k.limit,
848
+ offset: k.offset,
849
+ search: k.search,
850
+ searchColumns: k.searchColumns,
851
851
  finalQuery: ge,
852
- companyId: A.companyId,
853
- workspaceId: A.workspaceId,
854
- metricId: A.metricId,
855
- dashboardId: A.dashboardId,
856
- datasourceId: A.datasourceId,
857
- databaseName: A.databaseName,
858
- isCustomSql: A.isCustomSql,
859
- isSingleValueChart: E,
860
- principal: `${+!!d}|${f || ""}|${ne}`
861
- }), ve = {
862
- setData: T,
863
- setLoading: re,
852
+ companyId: k.companyId,
853
+ workspaceId: k.workspaceId,
854
+ metricId: k.metricId,
855
+ dashboardId: k.dashboardId,
856
+ datasourceId: k.datasourceId,
857
+ databaseName: k.databaseName,
858
+ isCustomSql: k.isCustomSql,
859
+ isSingleValueChart: O,
860
+ principal: `${+!!d}|${f || ""}|${ee}`
861
+ }), ye = {
862
+ setData: D,
863
+ setLoading: te,
864
864
  setTotalRecords: se,
865
865
  onError: le
866
- }, ye = x.current.get(_e);
867
- if (ye) {
868
- ye.subscribers.add(ve);
866
+ }, be = C.current.get(ve);
867
+ if (be) {
868
+ be.subscribers.add(ye);
869
869
  return;
870
870
  }
871
- let M = /* @__PURE__ */ new Set([ve]);
872
- x.current.set(_e, { subscribers: M }), y({
873
- data: A,
871
+ let xe = /* @__PURE__ */ new Set([ye]);
872
+ C.current.set(ve, { subscribers: xe }), b({
873
+ data: k,
874
874
  token: u || "",
875
875
  isFrontendApp: d,
876
876
  encryptedClientId: d && f || ""
877
877
  }).then((e) => {
878
- let t = x.current.get(_e);
879
- x.current.delete(_e), Ln(t?.subscribers ?? M, e);
878
+ let t = C.current.get(ve);
879
+ C.current.delete(ve), Rn(t?.subscribers ?? xe, e);
880
880
  }).catch((e) => {
881
- let t = x.current.get(_e);
882
- x.current.delete(_e), Rn(t?.subscribers ?? M, e);
881
+ let t = C.current.get(ve);
882
+ C.current.delete(ve), zn(t?.subscribers ?? xe, e);
883
883
  });
884
884
  }, [
885
885
  t,
886
886
  o,
887
+ _,
887
888
  g,
888
- h,
889
889
  e,
890
890
  n,
891
- v,
891
+ y,
892
892
  p,
893
893
  m,
894
- _,
894
+ v,
895
895
  c,
896
896
  l,
897
897
  u,
898
898
  d,
899
899
  f,
900
- ne,
901
- a,
902
900
  ee,
901
+ a,
902
+ h,
903
903
  r,
904
- y,
905
- i,
906
904
  b,
905
+ i,
906
+ S,
907
907
  s
908
908
  ]) };
909
- }, Bn = [
909
+ }, Vn = [
910
910
  "backend-cap",
911
911
  "metric-limit",
912
912
  "client-window",
913
913
  "chart-coverage"
914
- ], Vn = (e) => typeof e == "string" && Bn.includes(e), Hn = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, Z = (e) => e.of === null ? Infinity : Math.max(0, e.of - e.at), Un = (e) => {
915
- let t = e[0], n = Z(t);
914
+ ], Hn = (e) => typeof e == "string" && Vn.includes(e), Un = (e) => typeof e == "number" && Number.isFinite(e) && e >= 0, X = (e) => e.of === null ? Infinity : Math.max(0, e.of - e.at), Wn = (e) => {
915
+ let t = e[0], n = X(t);
916
916
  for (let r = 1; r < e.length; r += 1) {
917
- let i = Z(e[r]);
917
+ let i = X(e[r]);
918
918
  i > n && (t = e[r], n = i);
919
919
  }
920
920
  return {
@@ -923,11 +923,11 @@ var zn = ({ datasourceId: e, clientName: t, dbName: n, tenancyType: r, values: i
923
923
  by: t.by,
924
924
  stages: e
925
925
  };
926
- }, Wn = (e) => ({
926
+ }, Gn = (e) => ({
927
927
  rows: e,
928
928
  truncated: null
929
929
  });
930
- function Gn(e, t, n) {
930
+ function Kn(e, t, n) {
931
931
  let r = e.rows.length, i = n.length;
932
932
  if (i >= r) return e;
933
933
  let a = {
@@ -937,53 +937,53 @@ function Gn(e, t, n) {
937
937
  };
938
938
  return {
939
939
  rows: n,
940
- truncated: Un(e.truncated ? [...e.truncated.stages, a] : [a])
940
+ truncated: Wn(e.truncated ? [...e.truncated.stages, a] : [a])
941
941
  };
942
942
  }
943
- function Kn(e, t) {
943
+ function qn(e, t) {
944
944
  if (!e || typeof e != "object") return null;
945
945
  let n = e, r = Array.isArray(n.stages) ? n.stages : [], i = [];
946
946
  for (let e of r) {
947
947
  if (!e || typeof e != "object") continue;
948
948
  let { by: t, at: n, of: r } = e;
949
- Vn(t) && Hn(n) && i.push({
949
+ Hn(t) && Un(n) && i.push({
950
950
  by: t,
951
951
  at: n,
952
- of: Hn(r) ? r : null
952
+ of: Un(r) ? r : null
953
953
  });
954
954
  }
955
955
  if (!i.length) {
956
- if (!Vn(n.by) || !Hn(n.at)) return null;
956
+ if (!Hn(n.by) || !Un(n.at)) return null;
957
957
  i.push({
958
958
  by: n.by,
959
959
  at: n.at,
960
- of: Hn(n.of) ? n.of : null
960
+ of: Un(n.of) ? n.of : null
961
961
  });
962
962
  }
963
- if (Hn(t)) {
963
+ if (Un(t)) {
964
964
  let e = i[i.length - 1];
965
965
  e.at !== t && (i[i.length - 1] = {
966
966
  ...e,
967
967
  at: t
968
968
  });
969
969
  }
970
- return Un(i);
970
+ return Wn(i);
971
971
  }
972
- function qn(e, t = (e) => e.toLocaleString()) {
972
+ function Jn(e, t = (e) => e.toLocaleString()) {
973
973
  return e ? e.of === null ? `Displaying the first ${t(e.at)} rows` : `Displaying ${t(e.at)} of ${t(e.of)}` : null;
974
974
  }
975
975
  //#endregion
976
976
  //#region src/components/Chart/metricCardResult.ts
977
- var Jn = { rows: [] }, Yn = {
977
+ var Yn = { rows: [] }, Xn = {
978
978
  rows: [],
979
979
  error: {
980
980
  code: "INVALID_METRIC_RESULT",
981
981
  message: "Could not load chart data.",
982
982
  hint: "Retry the chart. If it still fails, contact your workspace admin."
983
983
  }
984
- }, Xn = (e) => typeof e == "object" && !!e && !Array.isArray(e), Zn = (e) => {
985
- if (e == null) return Jn;
986
- if (!Xn(e)) return Yn;
984
+ }, Zn = (e) => typeof e == "object" && !!e && !Array.isArray(e), Qn = (e) => {
985
+ if (e == null) return Yn;
986
+ if (!Zn(e)) return Xn;
987
987
  let t = e.errorDetail ? n(e) ?? e.error : e.error, r = e.data;
988
988
  if (typeof r == "string") try {
989
989
  r = JSON.parse(r);
@@ -991,9 +991,9 @@ var Jn = { rows: [] }, Yn = {
991
991
  return t ? {
992
992
  rows: [],
993
993
  error: t
994
- } : Yn;
994
+ } : Xn;
995
995
  }
996
- if (Xn(r) && (r.error || r.errorDetail)) return {
996
+ if (Zn(r) && (r.error || r.errorDetail)) return {
997
997
  rows: [],
998
998
  error: r.errorDetail ? n(r) ?? r.error : r.error
999
999
  };
@@ -1001,35 +1001,35 @@ var Jn = { rows: [] }, Yn = {
1001
1001
  rows: [],
1002
1002
  error: t
1003
1003
  };
1004
- if (Xn(r) && typeof r.code == "string" && typeof r.message == "string") return {
1004
+ if (Zn(r) && typeof r.code == "string" && typeof r.message == "string") return {
1005
1005
  rows: [],
1006
1006
  error: {
1007
1007
  code: r.code,
1008
1008
  message: r.message
1009
1009
  }
1010
1010
  };
1011
- if (!Array.isArray(r) || !r.every(Xn)) return Yn;
1012
- let i = Array.isArray(e.notices) && e.notices.some((e) => Xn(e) && e.code === "FILTER_NOT_APPLIED");
1011
+ if (!Array.isArray(r) || !r.every(Zn)) return Xn;
1012
+ let i = Array.isArray(e.notices) && e.notices.some((e) => Zn(e) && e.code === "FILTER_NOT_APPLIED");
1013
1013
  return {
1014
1014
  rows: r,
1015
1015
  ...i ? { isFilterNotApplied: !0 } : {}
1016
1016
  };
1017
- }, Qn = "__dbnFullscreenDrillState", $n = (e) => typeof e == "object" && !!e, er = (e) => Array.isArray(e), tr = (e, t) => ({
1017
+ }, $n = "__dbnFullscreenDrillState", er = (e) => typeof e == "object" && !!e, tr = (e) => Array.isArray(e), nr = (e, t) => ({
1018
1018
  ...e,
1019
1019
  ...t,
1020
1020
  metric: {
1021
1021
  ...e.metric,
1022
- [Qn]: t
1022
+ [$n]: t
1023
1023
  }
1024
- }), Q = (e, t = {}) => {
1025
- let n = $n(e) && $n(e.__dbnFullscreenDrillState) ? e[Qn] : {};
1024
+ }), Z = (e, t = {}) => {
1025
+ let n = er(e) && er(e.__dbnFullscreenDrillState) ? e[$n] : {};
1026
1026
  return {
1027
1027
  drilledLevel: t.drilledLevel ?? (typeof n.drilledLevel == "number" ? n.drilledLevel : void 0),
1028
- drillFilters: t.drillFilters ?? (er(n.drillFilters) ? n.drillFilters : void 0),
1028
+ drillFilters: t.drillFilters ?? (tr(n.drillFilters) ? n.drillFilters : void 0),
1029
1029
  drillType: t.drillType ?? (typeof n.drillType == "string" ? n.drillType : void 0),
1030
- underlyingDataDrillFilters: t.underlyingDataDrillFilters ?? (er(n.underlyingDataDrillFilters) ? n.underlyingDataDrillFilters : void 0)
1030
+ underlyingDataDrillFilters: t.underlyingDataDrillFilters ?? (tr(n.underlyingDataDrillFilters) ? n.underlyingDataDrillFilters : void 0)
1031
1031
  };
1032
- }, nr = (e, t) => {
1032
+ }, rr = (e, t) => {
1033
1033
  if (!e || e.isEnableGroupBy === !1 || t.drilledLevel === void 0 && t.drillFilters === void 0 && t.drillType === void 0 && t.underlyingDataDrillFilters === void 0) return e;
1034
1034
  let n = e.configV2?.levels;
1035
1035
  if (!n?.length) return t.drillType === void 0 ? e : {
@@ -1051,15 +1051,15 @@ var Jn = { rows: [] }, Yn = {
1051
1051
  }))
1052
1052
  }
1053
1053
  };
1054
- }, rr = (e) => e.includes(";;") ? e.split(";;") : e, ir = (e, t) => e === void 0 ? t : [...Array.isArray(e) ? e : [e], ...Array.isArray(t) ? t : [t]], ar = [
1054
+ }, ir = (e) => e.includes(";;") ? e.split(";;") : e, ar = (e, t) => e === void 0 ? t : [...Array.isArray(e) ? e : [e], ...Array.isArray(t) ? t : [t]], or = [
1055
1055
  "dashboardId",
1056
1056
  "configId",
1057
1057
  "embed",
1058
1058
  "isDbn"
1059
- ], or = (e) => `dbn.${e}.`, sr = "drill.", cr = (e) => {
1059
+ ], sr = (e) => `dbn.${e}.`, cr = "drill.", lr = (e) => {
1060
1060
  let t = encodeURIComponent(e.levelIndex);
1061
1061
  return e.filters?.length ? `${t}~${e.filters.map((e) => `${encodeURIComponent(e.columnName)}:${encodeURIComponent(String(e.value ?? ""))}`).join("|")}` : t;
1062
- }, lr = (e) => {
1062
+ }, ur = (e) => {
1063
1063
  if (!e) return null;
1064
1064
  let t = e.indexOf("~"), n = t === -1 ? e : e.slice(0, t), r = decodeURIComponent(n);
1065
1065
  return r ? t === -1 ? {
@@ -1077,18 +1077,18 @@ var Jn = { rows: [] }, Yn = {
1077
1077
  } : null;
1078
1078
  }).filter((e) => e !== null)
1079
1079
  } : null;
1080
- }, ur = (e, t) => {
1080
+ }, dr = (e, t) => {
1081
1081
  if (!t) return {};
1082
- let n = `${or(t)}${sr}`, r = {};
1082
+ let n = `${sr(t)}${cr}`, r = {};
1083
1083
  return new URLSearchParams(e).forEach((e, t) => {
1084
1084
  if (!t.startsWith(n)) return;
1085
- let i = t.slice(n.length), a = lr(e);
1085
+ let i = t.slice(n.length), a = ur(e);
1086
1086
  i && a && (r[i] = a);
1087
1087
  }), r;
1088
- }, dr = ({ currentSearch: e, dashboardId: t, entries: n, legacyGlobals: r = {}, namespaced: i = !0 }) => {
1088
+ }, fr = ({ currentSearch: e, dashboardId: t, entries: n, legacyGlobals: r = {}, namespaced: i = !0 }) => {
1089
1089
  if (!i) {
1090
1090
  let e = new URLSearchParams();
1091
- return ar.forEach((n) => {
1091
+ return or.forEach((n) => {
1092
1092
  let i = r[n];
1093
1093
  if (n === "dashboardId") {
1094
1094
  e.set(n, t ?? "");
@@ -1101,7 +1101,7 @@ var Jn = { rows: [] }, Yn = {
1101
1101
  }
1102
1102
  let a = new URLSearchParams(e);
1103
1103
  if (!t) return a;
1104
- let o = or(t), s = [];
1104
+ let o = sr(t), s = [];
1105
1105
  return a.forEach((e, t) => {
1106
1106
  t.startsWith(o) && s.push(t);
1107
1107
  }), s.forEach((e) => {
@@ -1109,7 +1109,7 @@ var Jn = { rows: [] }, Yn = {
1109
1109
  }), n.forEach(({ key: e, value: t }) => {
1110
1110
  a.set(`${o}${e}`, t);
1111
1111
  }), a;
1112
- }, fr = (e, t) => {
1112
+ }, pr = (e, t) => {
1113
1113
  let n = e?.levels;
1114
1114
  if (!e || !n?.length) return null;
1115
1115
  let r = n.findIndex((e) => e?.index === t.levelIndex);
@@ -1125,9 +1125,9 @@ var Jn = { rows: [] }, Yn = {
1125
1125
  filters: n > r ? [] : e?.filters
1126
1126
  })
1127
1127
  };
1128
- }, pr = (e, t) => {
1129
- let n = new URLSearchParams(e), r = {}, i = {}, a = t ? or(t) : null, o = (e, t, n) => {
1130
- e[t] = ir(e[t], rr(n));
1128
+ }, mr = (e, t) => {
1129
+ let n = new URLSearchParams(e), r = {}, i = {}, a = t ? sr(t) : null, o = (e, t, n) => {
1130
+ e[t] = ar(e[t], ir(n));
1131
1131
  };
1132
1132
  return n.forEach((e, t) => {
1133
1133
  if (a && t.startsWith(a)) {
@@ -1141,40 +1141,40 @@ var Jn = { rows: [] }, Yn = {
1141
1141
  ...r,
1142
1142
  ...i
1143
1143
  };
1144
- }, mr = Symbol("cross-filter-source-metric"), hr = (e, t) => (t && Object.defineProperty(e, mr, { value: t }), e);
1145
- function gr({ filters: e, metricId: t, isGroupByEnabled: n, enableCrossFilterBeforeDrill: r = !1 }) {
1144
+ }, hr = Symbol("cross-filter-source-metric"), gr = (e, t) => (t && Object.defineProperty(e, hr, { value: t }), e);
1145
+ function _r({ filters: e, metricId: t, isGroupByEnabled: n, enableCrossFilterBeforeDrill: r = !1 }) {
1146
1146
  return r ? (e || []).filter((e) => {
1147
- let r = e[mr];
1147
+ let r = e[hr];
1148
1148
  return r ? r !== t : !n;
1149
1149
  }) : n ? [] : e || [];
1150
1150
  }
1151
- function _r(e, t, n) {
1151
+ function vr(e, t, n) {
1152
1152
  return t === "DATABASE" ? `${n}.${e?.split(".").slice(1).join(".")}` : e;
1153
1153
  }
1154
- var vr = (e) => {
1154
+ var yr = (e) => {
1155
1155
  let t = e?.table?.schemaName, n = e?.table?.tableName;
1156
1156
  if (t && n) return `${t}.${n}`;
1157
- }, yr = (e) => typeof e == "string" && !!e.trim(), br = (e, t) => t?.find((t) => t?.alias === e || t?.name === e), xr = ({ columnName: e, selectedDims: t }) => {
1158
- if (!yr(e)) return;
1157
+ }, br = (e) => typeof e == "string" && !!e.trim(), xr = (e, t) => t?.find((t) => t?.alias === e || t?.name === e), Sr = ({ columnName: e, selectedDims: t }) => {
1158
+ if (!br(e)) return;
1159
1159
  if (!t?.length) return e;
1160
- let n = br(e, t);
1161
- if (n && vr(n)) return yr(n.name) ? n.name : e;
1162
- }, Sr = "This filter column is no longer available. Refresh the metric and select a column before filtering.", Cr = ({ columnName: e, rowFilters: t, selectedDims: n, requiresSchemaMetadata: r = !1 }) => {
1160
+ let n = xr(e, t);
1161
+ if (n && yr(n)) return br(n.name) ? n.name : e;
1162
+ }, Cr = "This filter column is no longer available. Refresh the metric and select a column before filtering.", wr = ({ columnName: e, rowFilters: t, selectedDims: n, requiresSchemaMetadata: r = !1 }) => {
1163
1163
  let i = t?.length ? t.map((e) => e.columnName) : e === void 0 ? [] : [e];
1164
- return i.some((e) => !yr(e)) || (t?.length || r) && !n?.length || i.some((e) => !!n?.length && !xr({
1164
+ return i.some((e) => !br(e)) || (t?.length || r) && !n?.length || i.some((e) => !!n?.length && !Sr({
1165
1165
  columnName: e,
1166
1166
  selectedDims: n
1167
- })) ? Sr : void 0;
1167
+ })) ? Cr : void 0;
1168
1168
  };
1169
- function wr(e) {
1169
+ function Tr(e) {
1170
1170
  let t = e.value === null || e.value === void 0, n = t ? "null" : e.value;
1171
- return hr({
1171
+ return gr({
1172
1172
  columnName: e.columnName,
1173
1173
  datatype: "string",
1174
1174
  isAddOnMetrics: !0,
1175
1175
  name: "cross-filter",
1176
1176
  options: [n],
1177
- tableName: _r(e.tableName, e.tenancyLevel, e.clientId),
1177
+ tableName: vr(e.tableName, e.tenancyLevel, e.clientId),
1178
1178
  value: [n],
1179
1179
  ...t ? { filterVariant: {
1180
1180
  label: "IN",
@@ -1182,17 +1182,17 @@ function wr(e) {
1182
1182
  } } : {}
1183
1183
  }, e.sourceMetricId);
1184
1184
  }
1185
- function Tr({ existing: e, isReset: t, levelIndex: n, hasCurrentLevel: r, filterValue: i, columnName: a, rowFilters: o, selectedDims: s, activeLevelTableName: c, tenancyLevel: l, clientId: u, sourceMetricId: d }) {
1185
+ function Er({ existing: e, isReset: t, levelIndex: n, hasCurrentLevel: r, filterValue: i, columnName: a, rowFilters: o, selectedDims: s, activeLevelTableName: c, tenancyLevel: l, clientId: u, sourceMetricId: d }) {
1186
1186
  if (t || n) return [];
1187
- let f = i != null && yr(a);
1187
+ let f = i != null && br(a);
1188
1188
  if (!((f || o?.length) && r)) return [];
1189
1189
  if (o?.length) {
1190
1190
  let t = o.map((e) => {
1191
- let t = xr({
1191
+ let t = Sr({
1192
1192
  columnName: e?.columnName,
1193
1193
  selectedDims: s
1194
- }), n = vr(t ? br(e.columnName, s) : void 0);
1195
- if (n && t) return wr({
1194
+ }), n = yr(t ? xr(e.columnName, s) : void 0);
1195
+ if (n && t) return Tr({
1196
1196
  columnName: t,
1197
1197
  value: e?.value,
1198
1198
  tableName: n,
@@ -1204,7 +1204,7 @@ function Tr({ existing: e, isReset: t, levelIndex: n, hasCurrentLevel: r, filter
1204
1204
  return [...e || [], ...t];
1205
1205
  }
1206
1206
  if (f) {
1207
- if (d) return jr({
1207
+ if (d) return Mr({
1208
1208
  existing: e,
1209
1209
  columnName: a,
1210
1210
  value: i,
@@ -1213,11 +1213,11 @@ function Tr({ existing: e, isReset: t, levelIndex: n, hasCurrentLevel: r, filter
1213
1213
  clientId: u,
1214
1214
  sourceMetricId: d
1215
1215
  });
1216
- let t = xr({
1216
+ let t = Sr({
1217
1217
  columnName: a,
1218
1218
  selectedDims: s
1219
1219
  });
1220
- return t ? [...e || [], wr({
1220
+ return t ? [...e || [], Tr({
1221
1221
  columnName: t,
1222
1222
  value: i,
1223
1223
  tableName: c,
@@ -1228,42 +1228,42 @@ function Tr({ existing: e, isReset: t, levelIndex: n, hasCurrentLevel: r, filter
1228
1228
  }
1229
1229
  return [];
1230
1230
  }
1231
- var Er = /* @__PURE__ */ new Set([
1232
- O.progressBar,
1233
- O.progressBarV2,
1234
- O.linearGauge,
1235
- O.linearGaugeV2,
1236
- O.gauge,
1237
- O.gaugeV2
1231
+ var Dr = /* @__PURE__ */ new Set([
1232
+ A.progressBar,
1233
+ A.progressBarV2,
1234
+ A.linearGauge,
1235
+ A.linearGaugeV2,
1236
+ A.gauge,
1237
+ A.gaugeV2
1238
1238
  ]);
1239
- function Dr({ runtimeEnabled: e, metricEnabled: t }) {
1239
+ function Or({ runtimeEnabled: e, metricEnabled: t }) {
1240
1240
  return !!e || !!t;
1241
1241
  }
1242
- function Or({ chartType: e, isDrillEnabled: t, dimensions: n, drilledLevel: r, drillLevels: i }) {
1243
- if (e && Er.has(e)) return "terminal";
1242
+ function kr({ chartType: e, isDrillEnabled: t, dimensions: n, drilledLevel: r, drillLevels: i }) {
1243
+ if (e && Dr.has(e)) return "terminal";
1244
1244
  if (!t || (n?.length ?? 0) === r) return "none";
1245
1245
  let a = i || [];
1246
1246
  return a[a.length - 1]?.isEnable ? "none" : "drill";
1247
1247
  }
1248
- function kr({ chartType: e, params: t, rowFilters: n, dimensions: r }) {
1249
- return e === O.table ? {
1248
+ function Ar({ chartType: e, params: t, rowFilters: n, dimensions: r }) {
1249
+ return e === A.table ? {
1250
1250
  name: n?.find((e) => r?.some((t) => e?.columnName === t))?.value,
1251
1251
  rowFilters: n
1252
1252
  } : t;
1253
1253
  }
1254
- function Ar(e, t) {
1255
- if (!yr(e)) return !1;
1256
- let n = br(e, t);
1257
- return !!n && !!vr(n);
1254
+ function jr(e, t) {
1255
+ if (!br(e)) return !1;
1256
+ let n = xr(e, t);
1257
+ return !!n && !!yr(n);
1258
1258
  }
1259
- function jr({ existing: e, columnName: t, value: n, mode: r = "only", selectedDims: i, tenancyLevel: a, clientId: o, sourceMetricId: s }) {
1260
- if (!yr(t) || n === void 0) return e || [];
1261
- let c = br(t, i), l = xr({
1259
+ function Mr({ existing: e, columnName: t, value: n, mode: r = "only", selectedDims: i, tenancyLevel: a, clientId: o, sourceMetricId: s }) {
1260
+ if (!br(t) || n === void 0) return e || [];
1261
+ let c = xr(t, i), l = Sr({
1262
1262
  columnName: t,
1263
1263
  selectedDims: i
1264
- }), u = vr(c);
1264
+ }), u = yr(c);
1265
1265
  if (!u || !l) return e || [];
1266
- let d = wr({
1266
+ let d = Tr({
1267
1267
  columnName: l,
1268
1268
  value: n,
1269
1269
  tableName: u,
@@ -1274,41 +1274,41 @@ function jr({ existing: e, columnName: t, value: n, mode: r = "only", selectedDi
1274
1274
  label: "NOT IN",
1275
1275
  value: "NOT IN"
1276
1276
  };
1277
- return [...f, r === "exclude" ? hr({
1277
+ return [...f, r === "exclude" ? gr({
1278
1278
  ...d,
1279
1279
  filterVariant: p
1280
1280
  }, s) : d];
1281
1281
  }
1282
1282
  //#endregion
1283
1283
  //#region src/core/metric-builder/drillPoint.ts
1284
- var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim() !== ""), Pr = (e) => !!e.columnName && Nr(e.value), Fr = (e, t) => ({
1284
+ var Nr = "Empty", Pr = (e) => e !== void 0 && (typeof e != "string" || e.trim() !== ""), Fr = (e) => !!e.columnName && Pr(e.value), Ir = (e, t) => ({
1285
1285
  columnName: e,
1286
1286
  value: t,
1287
1287
  ...t === null ? { operator: "isNull" } : {}
1288
- }), Ir = (e, t = (e) => e) => {
1288
+ }), Lr = (e, t = (e) => e) => {
1289
1289
  let n = e?.dimensions || [], r = [], i = [];
1290
1290
  return n.forEach((e) => {
1291
- if (!Pr(e)) {
1291
+ if (!Fr(e)) {
1292
1292
  e.columnName && i.push(e);
1293
1293
  return;
1294
1294
  }
1295
- r.push(t(Fr(e.columnName, e.value)));
1295
+ r.push(t(Ir(e.columnName, e.value)));
1296
1296
  }), {
1297
1297
  filters: r,
1298
1298
  skipped: i
1299
1299
  };
1300
- }, Lr = (e) => (e?.dimensions || []).filter((e) => e.value !== void 0).map((e) => ({
1300
+ }, Rr = (e) => (e?.dimensions || []).filter((e) => e.value !== void 0).map((e) => ({
1301
1301
  label: e.label || e.columnName,
1302
1302
  value: e.formatted ?? (e.value === null ? "Empty" : String(e.value)),
1303
1303
  role: e.role
1304
- })), Rr = (e) => {
1304
+ })), zr = (e) => {
1305
1305
  let t = e?.measure;
1306
1306
  if (t && t.value !== void 0) return t.formatted ?? String(t.value ?? "Empty");
1307
1307
  let n = (e?.dimensions || []).find((e) => e.value !== void 0);
1308
1308
  if (n) return n.formatted ?? String(n.value ?? "Empty");
1309
- }, zr = (e) => {
1309
+ }, Q = (e) => {
1310
1310
  if (e !== void 0) return e === null ? null : typeof e == "string" || typeof e == "number" || typeof e == "boolean" ? e : String(e);
1311
- }, Br = (e) => e === void 0 ? void 0 : e === null ? Mr : String(e), Vr = (e, t) => {
1311
+ }, Br = (e) => e === void 0 ? void 0 : e === null ? Nr : String(e), Vr = (e, t) => {
1312
1312
  let n = Br(e);
1313
1313
  if (!t || typeof e != "number") return n;
1314
1314
  try {
@@ -1320,7 +1320,7 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1320
1320
  let a = e?.rowFilters;
1321
1321
  if (a?.length) return {
1322
1322
  dimensions: a.filter((e) => !!e?.columnName).map((e) => {
1323
- let t = zr(e.value);
1323
+ let t = Q(e.value);
1324
1324
  return {
1325
1325
  columnName: e.columnName,
1326
1326
  value: t,
@@ -1332,7 +1332,7 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1332
1332
  };
1333
1333
  let o = [];
1334
1334
  if (t?.columnName) {
1335
- let n = zr(e?.name);
1335
+ let n = Q(e?.name);
1336
1336
  o.push({
1337
1337
  columnName: t.columnName,
1338
1338
  label: t.label,
@@ -1342,7 +1342,7 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1342
1342
  });
1343
1343
  }
1344
1344
  if (n?.columnName) {
1345
- let t = zr(e?.seriesName);
1345
+ let t = Q(e?.seriesName);
1346
1346
  o.push({
1347
1347
  columnName: n.columnName,
1348
1348
  label: n.label,
@@ -1351,7 +1351,7 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1351
1351
  role: "series"
1352
1352
  });
1353
1353
  }
1354
- let s = zr(e?.value), c = { dimensions: o }, l = n?.columnName ? r?.columnName : r?.columnName ?? zr(e?.seriesName);
1354
+ let s = Q(e?.value), c = { dimensions: o }, l = n?.columnName ? r?.columnName : r?.columnName ?? Q(e?.seriesName);
1355
1355
  return (s !== void 0 || l) && (c.measure = {
1356
1356
  columnName: typeof l == "string" ? l : void 0,
1357
1357
  label: r?.label,
@@ -1579,14 +1579,14 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1579
1579
  comboAxisSymbols: i?.comboAxisSymbols,
1580
1580
  switchAxisNumberFormatter: i?.switchAxisNumberFormatter,
1581
1581
  ...r.customSettings
1582
- }, o = a.numberFormatter, s = e?.chartType === O.singleValue, c = t?.customSettings?.labelPrefix ?? (s ? a.singleValuePrefix ?? a.labelPrefix : a.labelPrefix ?? a.singleValuePrefix), l = t?.customSettings?.labelSuffix ?? (s ? a.singleValueSuffix ?? a.labelSuffix : a.labelSuffix ?? a.singleValueSuffix), u = a.comboAxisSettings?.map((e) => ({
1582
+ }, o = a.numberFormatter, s = e?.chartType === A.singleValue, c = t?.customSettings?.labelPrefix ?? (s ? a.singleValuePrefix ?? a.labelPrefix : a.labelPrefix ?? a.singleValuePrefix), l = t?.customSettings?.labelSuffix ?? (s ? a.singleValueSuffix ?? a.labelSuffix : a.labelSuffix ?? a.singleValueSuffix), u = a.comboAxisSettings?.map((e) => ({
1583
1583
  columns: e.measures,
1584
1584
  formatter: e.numberFormatter || o,
1585
1585
  prefix: e.prefix,
1586
1586
  suffix: e.suffix
1587
1587
  })) || [];
1588
1588
  if (!o && !c && !l && !a.numberFormat && !u.length) return r;
1589
- let d = r.tableSettings, f = t?.chartType === O.table ? t.tableSettings : e?.chartType === O.table ? e.tableSettings : void 0;
1589
+ let d = r.tableSettings, f = t?.chartType === A.table ? t.tableSettings : e?.chartType === A.table ? e.tableSettings : void 0;
1590
1590
  return {
1591
1591
  ...r,
1592
1592
  customSettings: a,
@@ -1665,7 +1665,7 @@ var Mr = "Empty", Nr = (e) => e !== void 0 && (typeof e != "string" || e.trim()
1665
1665
  outcome: "jump"
1666
1666
  };
1667
1667
  if (a) {
1668
- let t = a.parentFilters || [], n = typeof r == "string" && r.trim() === "", i = r != null && !n && !!a.columnName, l = (e) => e.filter((e) => Nr(e.value)), u = l(a.pointFilters ?? []), d = l(p.map(li).map(o)), f = u.length ? [...t, ...u] : d.length ? [...t, ...d] : i ? [...t, o({
1668
+ let t = a.parentFilters || [], n = typeof r == "string" && r.trim() === "", i = r != null && !n && !!a.columnName, l = (e) => e.filter((e) => Pr(e.value)), u = l(a.pointFilters ?? []), d = l(p.map(li).map(o)), f = u.length ? [...t, ...u] : d.length ? [...t, ...d] : i ? [...t, o({
1669
1669
  columnName: a.columnName,
1670
1670
  value: r
1671
1671
  })] : t;
@@ -1902,9 +1902,9 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
1902
1902
  renderEmpty: !0,
1903
1903
  missingField: "datasetMetricSettings.newDatasetSettings.selectedDims"
1904
1904
  };
1905
- }, Ti = ut([]), Ei = () => {
1906
- let e = dt(Ti), { data: t } = xe(), n = t?.externalDashboard?.dashboardFiltersLayout;
1907
- return I(() => e.length ? e : Array.isArray(n) ? n.filter((e) => typeof e == "string") : [], [e, n]);
1905
+ }, Ti = ft([]), Ei = () => {
1906
+ let e = pt(Ti), { data: t } = ue(), n = t?.externalDashboard?.dashboardFiltersLayout;
1907
+ return P(() => e.length ? e : Array.isArray(n) ? n.filter((e) => typeof e == "string") : [], [e, n]);
1908
1908
  }, Di = (e, t, n = []) => {
1909
1909
  if (!t.length || e.length < 2) return e;
1910
1910
  let r = (e) => {
@@ -1931,8 +1931,8 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
1931
1931
  index: t
1932
1932
  })).sort((e, t) => e.position >= 0 && t.position < 0 ? -1 : e.position < 0 && t.position >= 0 ? 1 : e.position === t.position ? e.index - t.index : e.position - t.position).map((e) => e.filter);
1933
1933
  }, Oi = 100, ki = (e) => {
1934
- let [t, n] = R(e);
1935
- return F(() => {
1934
+ let [t, n] = I(e);
1935
+ return N(() => {
1936
1936
  if (e) {
1937
1937
  n(!0);
1938
1938
  return;
@@ -1950,18 +1950,18 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
1950
1950
  clientId: t,
1951
1951
  isFrontendApp: n
1952
1952
  }
1953
- }), Ni = (e, t) => e?.includes(t) ? e : [...e || [], t], Pi = (e, t) => e?.includes(t) ? e.filter((e) => e !== t) : e, Fi = (e, t) => !!(e && e.data?.data === t.data && e.data?.name === t.name && e.data?.description === t.description && e.isLoading === t.isLoading && e.key === t.key), Ii = (e) => e.isMetric !== !1 || e.elementSettings?.elementType?.value === "metricExpression", Li = ({ metric: e, isAllClient: t, tenancyLevel: n, appliedMetricFilters: r, firstLoadAppliedMetricFilters: i, tableColumnFilters: a, chartSettings: o, isPythonMode: s, globalFilters: c, filterValues: l, tableLimit: u, calendarType: d, comparisonCount: f, datasourceId: p, drillConfig: m, isFrontendApp: ee, guestToken: h }) => ({
1953
+ }), Ni = (e, t) => e?.includes(t) ? e : [...e || [], t], Pi = (e, t) => e?.includes(t) ? e.filter((e) => e !== t) : e, Fi = (e, t) => !!(e && e.data?.data === t.data && e.data?.name === t.name && e.data?.description === t.description && e.isLoading === t.isLoading && e.key === t.key), Ii = (e) => e.isMetric !== !1 || e.elementSettings?.elementType?.value === "metricExpression", Li = ({ metric: e, isAllClient: t, tenancyLevel: n, appliedMetricFilters: r, firstLoadAppliedMetricFilters: i, tableColumnFilters: a, chartSettings: o, isPythonMode: s, globalFilters: c, filterValues: l, tableLimit: u, calendarType: d, comparisonCount: f, datasourceId: p, drillConfig: m, isFrontendApp: h, guestToken: g }) => ({
1954
1954
  isAllClient: t,
1955
1955
  id: e?.id,
1956
1956
  tenancyLevel: n,
1957
- rlsConditions: [...(r?.length ? r : i) || [], ...o?.tableSettings?.isServerSidePagination && o?.chartType === O.table ? a.map((e) => e.condition).filter((e) => ae(e)) : []],
1957
+ rlsConditions: [...(r?.length ? r : i) || [], ...o?.tableSettings?.isServerSidePagination && o?.chartType === A.table ? a.map((e) => e.condition).filter((e) => re(e)) : []],
1958
1958
  globalFilters: s ? void 0 : {
1959
1959
  ...c,
1960
1960
  filters: c?.filters?.filter((e) => Array.isArray(e?.value) ? e?.value?.length : e)
1961
1961
  },
1962
1962
  filterValues: s ? void 0 : l,
1963
- limit: o?.tableSettings?.isServerSidePagination && o?.chartType === O.table ? Math.min(u.limit, 1e3) : void 0,
1964
- offset: o?.tableSettings?.isServerSidePagination && o?.chartType === O.table ? u.offset : void 0,
1963
+ limit: o?.tableSettings?.isServerSidePagination && o?.chartType === A.table ? Math.min(u.limit, 1e3) : void 0,
1964
+ offset: o?.tableSettings?.isServerSidePagination && o?.chartType === A.table ? u.offset : void 0,
1965
1965
  disableStringify: !0,
1966
1966
  pivotHeaders: o?.pivotTableSettings2?.headers || [],
1967
1967
  timeseriesSettings: s ? void 0 : {
@@ -1972,29 +1972,29 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
1972
1972
  chartSeriesField: o?.seriesField !== "ungrouped" && o?.seriesField && o?.isDynamicSeries ? o?.seriesField : void 0,
1973
1973
  comparisonCount: f,
1974
1974
  dynamicXAxis: {
1975
- isEnable: !!(o?.dynamicXAxis?.isEnabled || o?.enduserMeasureAndDimensions?.isEnabled) && Ue.includes(o?.chartType || ""),
1975
+ isEnable: !!(o?.dynamicXAxis?.isEnabled || o?.enduserMeasureAndDimensions?.isEnabled) && pe.includes(o?.chartType || ""),
1976
1976
  xaxis: o?.xAxis || "",
1977
1977
  customField: o?.dynamicXAxis?.selectedOption?.column
1978
1978
  },
1979
1979
  dbId: p,
1980
1980
  elementSettings: e?.elementSettings?.metricExpression,
1981
1981
  drillConfig: vi(e?.datasetMetricSettings) ? bi(m) : m,
1982
- isEncrypted: !(ee || !h)
1982
+ isEncrypted: !(h || !g)
1983
1983
  }), Ri = (e) => {
1984
1984
  let t = e.object.customTable?.query;
1985
1985
  return e.object.wId ? !t || !t.includes("{{") : !1;
1986
- }, zi = (e, t) => e.customTable ? "" : e.tableName ? j(e.tableName, t) : e.tableName, Bi = (e, t) => {
1987
- if (!e.customColumnSql) return e.columnName ? j(e.columnName, t) : e.columnName;
1986
+ }, zi = (e, t) => e.customTable ? "" : e.tableName ? $e(e.tableName, t) : e.tableName, Bi = (e, t) => {
1987
+ if (!e.customColumnSql) return e.columnName ? $e(e.columnName, t) : e.columnName;
1988
1988
  }, Vi = (e) => {
1989
1989
  let { object: t } = e, n = t.wId;
1990
1990
  return {
1991
1991
  ...t,
1992
1992
  tableName: zi(t, n),
1993
1993
  columnName: Bi(t, n),
1994
- filter: t.filter?.length ? k(t.filter, n) : [],
1994
+ filter: t.filter?.length ? Se(t.filter, n) : [],
1995
1995
  customTable: t.customTable?.query ? {
1996
- query: j(t.customTable.query, n),
1997
- alias: j(t.customTable.alias, n)
1996
+ query: $e(t.customTable.query, n),
1997
+ alias: $e(t.customTable.alias, n)
1998
1998
  } : t.customTable
1999
1999
  };
2000
2000
  }, Hi = async (e, t, n) => {
@@ -2028,11 +2028,11 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2028
2028
  o();
2029
2029
  }
2030
2030
  }, Wi = ({ savedDrillDownSettings: e, initialDrillState: t }) => {
2031
- let [n, r] = R([]), i = t.drillFilters ?? [], a = L(i), o = L(t.underlyingDataDrillFilters), s = nr(e, t), [c, l] = R(i), [u, d] = R(s ?? {
2031
+ let [n, r] = I([]), i = t.drillFilters ?? [], a = F(i), o = F(t.underlyingDataDrillFilters), s = rr(e, t), [c, l] = I(i), [u, d] = I(s ?? {
2032
2032
  isEnableGroupBy: !1,
2033
2033
  isEnableCrossFilter: !1,
2034
2034
  drillType: ""
2035
- }), [f, p] = R([]);
2035
+ }), [f, p] = I([]);
2036
2036
  return {
2037
2037
  drilldownCols: n,
2038
2038
  setDrillDownCols: r,
@@ -2096,13 +2096,13 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2096
2096
  error: "There is no data to summarize.",
2097
2097
  empty: !0
2098
2098
  }, ea = () => {
2099
- let [e, t] = R(Zi), n = L(null), r = L(null), i = P(() => {
2099
+ let [e, t] = I(Zi), n = F(null), r = F(null), i = M(() => {
2100
2100
  let e = r.current;
2101
2101
  r.current = null, n.current = null, e?.abort(), t(Zi);
2102
- }, []), a = P(() => {
2102
+ }, []), a = M(() => {
2103
2103
  let e = r.current;
2104
2104
  r.current = null, e?.abort(), t(Zi);
2105
- }, []), o = P((e, i) => {
2105
+ }, []), o = M((e, i) => {
2106
2106
  if (n.current === e) return;
2107
2107
  if (n.current = e, r.current?.release(), r.current = null, !i) {
2108
2108
  t($i);
@@ -2131,7 +2131,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2131
2131
  r.current === a && t(s(e) ? Zi : Qi);
2132
2132
  });
2133
2133
  }, []);
2134
- return F(() => () => {
2134
+ return N(() => () => {
2135
2135
  r.current?.release(), r.current = null, n.current = null;
2136
2136
  }, []), {
2137
2137
  state: e,
@@ -2140,13 +2140,13 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2140
2140
  reset: i
2141
2141
  };
2142
2142
  }, ta = (e) => {
2143
- let t = L(e);
2144
- return t.current !== e && !W(t.current, e) && (t.current = e), t.current;
2143
+ let t = F(e);
2144
+ return t.current !== e && !U(t.current, e) && (t.current = e), t.current;
2145
2145
  }, $ = (e) => {
2146
2146
  if (!e) return null;
2147
2147
  let t = new Date(e);
2148
2148
  return t instanceof Date && !Number.isNaN(t.getTime()) ? t : null;
2149
- }, na = (e) => be(e || {}) ? {
2149
+ }, na = (e) => Te(e || {}) ? {
2150
2150
  startTime: e?.startTime,
2151
2151
  endTime: e?.endTime,
2152
2152
  isTimeFilter: !0
@@ -2165,75 +2165,75 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2165
2165
  ...n
2166
2166
  } : e;
2167
2167
  }, la = ({ raw: e, selectedDims: t, selectedMetrics: n, datasetSettings: r, integrationName: i, isPythonMode: a }) => {
2168
- let o = Zn({ data: e });
2168
+ let o = Qn({ data: e });
2169
2169
  if (!o.rows.length) return aa;
2170
2170
  let s = ve(o.rows, t || [], n || []), c = s;
2171
2171
  if (i?.toLowerCase() === "redshift" && !a) {
2172
- let e = r?.selectedMetrics || [], t = [...((r?.selectedDims)?.filter((e) => !et(e?.alias)) || [])?.map((e) => e.alias), ...e?.map((e) => e.alias)];
2173
- c = Pe(t, s);
2172
+ let e = r?.selectedMetrics || [], t = [...((r?.selectedDims)?.filter((e) => !nt(e?.alias)) || [])?.map((e) => e.alias), ...e?.map((e) => e.alias)];
2173
+ c = ze(t, s);
2174
2174
  }
2175
- let l = rt(c);
2175
+ let l = at(c);
2176
2176
  return !Array.isArray(l) || !l.length ? aa : l;
2177
2177
  }, ua = ({ externalDashboardClientId: e, metric: t, globalFilters: n = {
2178
2178
  tableName: "",
2179
2179
  filters: []
2180
- }, rlsFilters: r, clientId: a, tenancyLevel: o, isInternalApp: s, appFilters: c, setCrossDashboardFilters: l, crossDashboardFilters: u, enableCrossFilter: d, enableCrossFilterBeforeDrill: f = !1, metricFilterOptions: ee, isAllClient: h, isFrontendApp: g, guestToken: _, encryptedClientId: v, clientCacheScope: y, dashboardId: C, workspaceId: T, metricStore: E, setMetricStore: D, summaryReferencedMetricIds: ue, onServerEvent: fe, clientColumnType: ge, datasourceId: k, appliedCardMetricFilters: A, onMetricFiltersChange: _e, language: j, translationDictionary: M, calendarType: be, setLoadedCardMetadata: xe, isRulePending: Ee = !1, setSettledCardIds: Pe, drillUrlState: Be, isFullScreen: Ke, setMetricMetadata: Ze, viewMetricData: N, generatingPdf: et, dataMartTables: it, isDisableQuery: ot = !1, token: ct, drilledLevel: lt, drillFilters: ut, drillType: dt, underlyingDataDrillFilters: pt }) => {
2181
- let [mt, _t] = R(!1), vt = x(), [yt, bt] = R(null), { state: xt, start: St, stop: Ct, reset: wt } = ea(), Tt = xt.summary, Et = xt.error, Dt = xt.empty, Ot = xt.status === "running", kt = L(null), At = L(null), [jt, Mt] = R({
2180
+ }, rlsFilters: r, clientId: a, tenancyLevel: o, isInternalApp: s, appFilters: c, setCrossDashboardFilters: l, crossDashboardFilters: u, enableCrossFilter: d, enableCrossFilterBeforeDrill: f = !1, metricFilterOptions: h, isAllClient: g, isFrontendApp: _, guestToken: v, encryptedClientId: y, clientCacheScope: b, dashboardId: T, workspaceId: D, metricStore: O, setMetricStore: ie, summaryReferencedMetricIds: se, onServerEvent: ue, clientColumnType: de, datasourceId: ge, appliedCardMetricFilters: k, onMetricFiltersChange: Se, language: Ce, translationDictionary: Te, calendarType: Oe, setLoadedCardMetadata: Fe, isRulePending: Re = !1, setSettledCardIds: ze, drillUrlState: Ge, isFullScreen: Ye, setMetricMetadata: $e, viewMetricData: j, generatingPdf: nt, dataMartTables: ot, isDisableQuery: ct = !1, token: ut, drilledLevel: dt, drillFilters: ft, drillType: pt, underlyingDataDrillFilters: ht }) => {
2181
+ let [gt, yt] = I(!1), bt = C(), [xt, St] = I(null), { state: Ct, start: wt, stop: Tt, reset: Et } = ea(), Dt = Ct.summary, Ot = Ct.error, kt = Ct.empty, At = Ct.status === "running", jt = F(null), Mt = F(null), [L, Nt] = I({
2182
2182
  limit: parseInt(t?.chartOptions?.tableSettings?.defaultRowSize || "100", 10),
2183
2183
  offset: 0
2184
- }), [Nt, Pt] = R(0), [z, Ft] = R(0), [B, It] = R(t?.rlsConditions || []), [Lt, Rt] = R([]), [zt, Bt] = R(!1), [V, Vt] = R(), [Ht, Ut] = R(""), [Wt, Gt] = R([]), [Kt, qt] = R({
2184
+ }), [Pt, Ft] = I(0), [R, It] = I(0), [z, Lt] = I(t?.rlsConditions || []), [Rt, zt] = I([]), [Bt, Vt] = I(!1), [B, Ht] = I(), [Ut, Wt] = I(""), [Gt, Kt] = I([]), [qt, Jt] = I({
2185
2185
  isOpen: !1,
2186
2186
  report: "",
2187
2187
  isLoading: !1
2188
- }), [Jt, Yt] = R(!1), { drilldownCols: Xt, setDrillDownCols: Zt, initialDrillFiltersRef: Qt, initialUnderlyingDataDrillFiltersRef: $t, drillFilters: H, setDrillFilters: en, drillDownSettings: U, setDrillDownSettings: W, adhocDrillDims: tn, setAdhocDrillDims: nn } = Wi({
2188
+ }), [Yt, Xt] = I(!1), { drilldownCols: Zt, setDrillDownCols: Qt, initialDrillFiltersRef: $t, initialUnderlyingDataDrillFiltersRef: en, drillFilters: V, setDrillFilters: tn, drillDownSettings: H, setDrillDownSettings: U, adhocDrillDims: nn, setAdhocDrillDims: rn } = Wi({
2189
2189
  savedDrillDownSettings: t?.drillDownSettings,
2190
2190
  initialDrillState: {
2191
- drilledLevel: lt,
2192
- drillFilters: ut,
2193
- drillType: dt,
2194
- underlyingDataDrillFilters: pt
2191
+ drilledLevel: dt,
2192
+ drillFilters: ft,
2193
+ drillType: pt,
2194
+ underlyingDataDrillFilters: ht
2195
2195
  }
2196
- }), G = !s && f === !0, rn = Dr({
2196
+ }), W = !s && f === !0, an = Or({
2197
2197
  runtimeEnabled: d,
2198
2198
  metricEnabled: t?.drillDownSettings?.isEnableCrossFilter
2199
- }), [an, on] = R([]), [sn, cn] = R(!1), [ln, un] = R(!1), [K, fn] = R([]), pn = L(_e);
2200
- pn.current = _e;
2201
- let mn = P((e) => {
2202
- fn((n) => {
2199
+ }), [on, sn] = I([]), [cn, ln] = I(!1), [un, dn] = I(!1), [G, pn] = I([]), mn = F(Se);
2200
+ mn.current = Se;
2201
+ let hn = M((e) => {
2202
+ pn((n) => {
2203
2203
  let r = typeof e == "function" ? e(n) : e;
2204
2204
  return Si({
2205
2205
  metricId: t?.id,
2206
2206
  filters: r,
2207
- onChange: pn.current
2207
+ onChange: mn.current
2208
2208
  }), r;
2209
2209
  });
2210
- }, [t?.id]), [hn, gn] = R({}), [_n, vn] = R(!1), [yn, bn] = R([]), [q, J] = R(ca(t?.chartOptions, t?.drillDownSettings)), Cn = L(""), [wn, Tn] = R({
2210
+ }, [t?.id]), [gn, _n] = I({}), [vn, yn] = I(!1), [bn, xn] = I([]), [K, q] = I(ca(t?.chartOptions, t?.drillDownSettings)), wn = F(""), [Tn, En] = I({
2211
2211
  data: [],
2212
2212
  error: "",
2213
2213
  isLoading: !1,
2214
2214
  currentValue: ""
2215
- }), Y = I(() => !!t?.datasetMetricSettings?.newDatasetSettings?.isPythonMode, [t?.datasetMetricSettings?.newDatasetSettings?.isPythonMode]), En = I(() => vi(t?.datasetMetricSettings), [t?.datasetMetricSettings]), Dn = P((e) => ae(e) ? !0 : e?.isAddOnMetrics && e?.datatype === "date" ? !1 : !!(e?.isAddOnMetrics && e?.client?.isEnable && e?.client?.columnName && e?.client?.as && !h && a), [a, h]), On = I(() => t?.externalDashboardMetrics?.[0]?.externalDashboard?.companyWorkspace?.datamart?.datamartRelationships || [], [t]), kn = I(() => {
2215
+ }), J = P(() => !!t?.datasetMetricSettings?.newDatasetSettings?.isPythonMode, [t?.datasetMetricSettings?.newDatasetSettings?.isPythonMode]), Dn = P(() => vi(t?.datasetMetricSettings), [t?.datasetMetricSettings]), On = M((e) => re(e) ? !0 : e?.isAddOnMetrics && e?.datatype === "date" ? !1 : !!(e?.isAddOnMetrics && e?.client?.isEnable && e?.client?.columnName && e?.client?.as && !g && a), [a, g]), kn = P(() => t?.externalDashboardMetrics?.[0]?.externalDashboard?.companyWorkspace?.datamart?.datamartRelationships || [], [t]), An = P(() => {
2216
2216
  let e = {};
2217
2217
  if (r?.values) for (let t in r.values) {
2218
2218
  let n = `${t}_variable`;
2219
2219
  e[n] = r.values[t];
2220
2220
  }
2221
2221
  return e;
2222
- }, [r?.values]), An = I(() => {
2222
+ }, [r?.values]), jn = P(() => {
2223
2223
  let e = t?.datasetMetricSettings?.newDatasetSettings?.selectedMainTable;
2224
- return (it?.find((t) => t.tableName === e?.tableName))?.customColumnFields?.map((n) => ({
2224
+ return (ot?.find((t) => t.tableName === e?.tableName))?.customColumnFields?.map((n) => ({
2225
2225
  value: n?.columnName,
2226
2226
  label: n?.columnName,
2227
2227
  isCustomField: !0,
2228
2228
  column: {
2229
- uniqueId: Ce(10),
2229
+ uniqueId: De(10),
2230
2230
  alias: n?.columnName,
2231
2231
  configType: "DIMENSION",
2232
2232
  datatype: n?.datatype,
2233
2233
  dropType: "DIMENSION",
2234
2234
  index: 1e3,
2235
2235
  name: n?.columnName,
2236
- parentAlias: `${Ve(e?.schemaName, t?.companyIntegration?.name || "")}_${e?.tableName?.replaceAll(" ", "_")?.replace("*", "_")}`,
2236
+ parentAlias: `${Ue(e?.schemaName, t?.companyIntegration?.name || "")}_${e?.tableName?.replaceAll(" ", "_")?.replace("*", "_")}`,
2237
2237
  table: t?.datasetMetricSettings?.newDatasetSettings?.selectedMainTable,
2238
2238
  type: "DEFAULT",
2239
2239
  draggableItemData: {
@@ -2251,141 +2251,141 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2251
2251
  }, [
2252
2252
  t?.datasetMetricSettings?.newDatasetSettings?.selectedMainTable,
2253
2253
  t?.companyIntegration?.name,
2254
- it
2255
- ]), jn = I(() => {
2254
+ ot
2255
+ ]), Mn = P(() => {
2256
2256
  let e = t?.drillDownSettings?.isEnableGroupBy;
2257
- return (G ? [...B?.length ? B : [], ...gr({
2257
+ return (W ? [...z?.length ? z : [], ..._r({
2258
2258
  filters: u,
2259
2259
  metricId: t?.id,
2260
2260
  isGroupByEnabled: e,
2261
2261
  enableCrossFilterBeforeDrill: !0
2262
- })] : e ? B || [] : [...B?.length ? B : [], ...u || []]).filter((e) => e.isAddOnMetrics).map((e) => s ? {
2262
+ })] : e ? z || [] : [...z?.length ? z : [], ...u || []]).filter((e) => e.isAddOnMetrics).map((e) => s ? {
2263
2263
  ...e,
2264
- dimensionColumn: q?.xAxis || "",
2265
- measureColumn: q?.yAxisList?.[0] || "",
2264
+ dimensionColumn: K?.xAxis || "",
2265
+ measureColumn: K?.yAxisList?.[0] || "",
2266
2266
  options: e.datatype === "date" ? e.options : [],
2267
2267
  variableOptions: e.datatype === "date" ? e.variableOptions : []
2268
2268
  } : {
2269
2269
  ...e,
2270
- dimensionColumn: q?.xAxis || "",
2271
- measureColumn: q?.yAxisList?.[0] || "",
2270
+ dimensionColumn: K?.xAxis || "",
2271
+ measureColumn: K?.yAxisList?.[0] || "",
2272
2272
  value: e.isAppFilter ? e.datatype === "date" ? qe(c?.values?.[e.name], e?.datePresetOptions || e?.presetDateOptions) || (e?.options)?.find((t) => t.name === (c?.values?.[e.name] ?? e.value)) : c?.values?.[e.name] ?? e.value : e.value,
2273
- options: e.datatype === "date" ? e?.options?.map((t) => be === "ind" && e.datatype === "date" ? {
2273
+ options: e.datatype === "date" ? e?.options?.map((t) => Oe === "ind" && e.datatype === "date" ? {
2274
2274
  ...t,
2275
2275
  isFiscal: !0
2276
2276
  } : t) : [],
2277
2277
  variableOptions: e.datatype === "date" ? e.variableOptions : []
2278
- }).filter((e) => Dn(e));
2278
+ }).filter((e) => On(e));
2279
2279
  }, [
2280
2280
  c?.values,
2281
- be,
2282
- q?.xAxis,
2283
- q?.yAxisList,
2281
+ Oe,
2282
+ K?.xAxis,
2283
+ K?.yAxisList,
2284
2284
  u,
2285
2285
  t?.id,
2286
- G,
2286
+ W,
2287
2287
  s,
2288
2288
  t?.drillDownSettings?.isEnableGroupBy,
2289
- B,
2290
- Dn
2291
- ]), Mn = I(() => JSON.stringify(Lt), [Lt]), X = ta(I(() => ({
2289
+ z,
2290
+ On
2291
+ ]), Nn = P(() => JSON.stringify(Rt), [Rt]), Y = ta(P(() => ({
2292
2292
  ...Li({
2293
2293
  metric: t,
2294
- isAllClient: h,
2294
+ isAllClient: g,
2295
2295
  tenancyLevel: o,
2296
- appliedMetricFilters: K,
2297
- firstLoadAppliedMetricFilters: jn,
2298
- tableColumnFilters: Lt,
2299
- chartSettings: q,
2300
- isPythonMode: Y,
2296
+ appliedMetricFilters: G,
2297
+ firstLoadAppliedMetricFilters: Mn,
2298
+ tableColumnFilters: Rt,
2299
+ chartSettings: K,
2300
+ isPythonMode: J,
2301
2301
  globalFilters: n,
2302
- filterValues: kn,
2303
- tableLimit: jt,
2304
- calendarType: be,
2305
- comparisonCount: z,
2306
- datasourceId: k,
2307
- drillConfig: U?.configV2,
2308
- isFrontendApp: g,
2309
- guestToken: _
2302
+ filterValues: An,
2303
+ tableLimit: L,
2304
+ calendarType: Oe,
2305
+ comparisonCount: R,
2306
+ datasourceId: ge,
2307
+ drillConfig: H?.configV2,
2308
+ isFrontendApp: _,
2309
+ guestToken: v
2310
2310
  }),
2311
- dashboardId: C
2311
+ dashboardId: T
2312
2312
  }), [
2313
- q,
2314
- h,
2315
- t,
2316
2313
  K,
2317
- jn,
2318
- Y,
2319
- kn,
2320
- H,
2314
+ g,
2315
+ t,
2316
+ G,
2317
+ Mn,
2318
+ J,
2319
+ An,
2320
+ V,
2321
2321
  o,
2322
2322
  n,
2323
- jt,
2324
- z,
2325
- Ue,
2326
- k,
2327
- be,
2328
- U?.configV2,
2323
+ L,
2324
+ R,
2325
+ pe,
2326
+ ge,
2327
+ Oe,
2328
+ H?.configV2,
2329
+ v,
2329
2330
  _,
2330
- g,
2331
- C,
2332
- Mn
2333
- ])), Nn = I(() => JSON.stringify(X), [X]), Pn = wi(q, t?.datasetMetricSettings), Fn = t?.datasetMetricSettings, In = We(Fn), Ln = ot || Pn.renderEmpty || !!In, Rn = g ? v || "" : a || "", Bn = I(() => Mi({
2334
- query: X,
2335
- clientId: Rn,
2336
- isFrontendApp: g
2337
- }), [
2338
- Rn,
2339
- g,
2340
- X
2341
- ]), Vn = I(() => ji({
2342
- clientId: Rn,
2343
- guestToken: _,
2344
- isFrontendApp: g
2331
+ T,
2332
+ Nn
2333
+ ])), Pn = P(() => JSON.stringify(Y), [Y]), Fn = wi(K, t?.datasetMetricSettings), In = t?.datasetMetricSettings, Ln = me(In), Rn = ct || Fn.renderEmpty || !!Ln, zn = _ ? y || "" : a || "", Vn = P(() => Mi({
2334
+ query: Y,
2335
+ clientId: zn,
2336
+ isFrontendApp: _
2345
2337
  }), [
2346
- Rn,
2338
+ zn,
2347
2339
  _,
2348
- g
2340
+ Y
2341
+ ]), Hn = P(() => ji({
2342
+ clientId: zn,
2343
+ guestToken: v,
2344
+ isFrontendApp: _
2345
+ }), [
2346
+ zn,
2347
+ v,
2348
+ _
2349
2349
  ]);
2350
- F(() => {
2350
+ N(() => {
2351
2351
  p("metric-query-payload-prepared", {
2352
2352
  metricId: t?.id,
2353
2353
  metricName: t?.name,
2354
- chartType: q?.chartType,
2355
- payload: w(X)
2354
+ chartType: K?.chartType,
2355
+ payload: E(Y)
2356
2356
  });
2357
2357
  }, [
2358
- X,
2358
+ Y,
2359
2359
  t?.id,
2360
2360
  t?.name,
2361
- q?.chartType
2361
+ K?.chartType
2362
2362
  ]);
2363
- let Hn = I(() => dn(t), [t]), { data: Z, dataUpdatedAt: Un, isFetching: Wn, isLoading: Gn, error: Jn, refetch: Yn } = xn({
2364
- data: X,
2365
- clientId: g ? v || "" : a,
2366
- clientCacheScope: g ? y : void 0,
2367
- metricRevision: Hn,
2368
- token: _,
2369
- isFrontendApp: g,
2370
- isFullScreen: Ke,
2371
- savedMetricQuery: t?.isMetric === !1 || !t?.query ? void 0 : me(t?.query, t?.companyId),
2372
- savedMetricIdentifiers: Fn,
2363
+ let Un = P(() => fn(t), [t]), { data: X, dataUpdatedAt: Wn, isFetching: Gn, isLoading: Kn, error: Yn, refetch: Xn } = Sn({
2364
+ data: Y,
2365
+ clientId: _ ? y || "" : a,
2366
+ clientCacheScope: _ ? b : void 0,
2367
+ metricRevision: Un,
2368
+ token: v,
2369
+ isFrontendApp: _,
2370
+ isFullScreen: Ye,
2371
+ savedMetricQuery: t?.isMetric === !1 || !t?.query ? void 0 : _e(t?.query, t?.companyId),
2372
+ savedMetricIdentifiers: In,
2373
2373
  dbName: t?.companyIntegration?.name || t?.integrationName,
2374
2374
  batchHints: {
2375
- chartType: q?.chartType,
2376
- isEnableComparisonFilter: !!q?.isEnableComparisonFilter,
2377
- isMultiDimension: !!q?.isMultiDimension,
2378
- isDynamicSeries: !!q?.isDynamicSeries,
2379
- seriesField: q?.seriesField,
2375
+ chartType: K?.chartType,
2376
+ isEnableComparisonFilter: !!K?.isEnableComparisonFilter,
2377
+ isMultiDimension: !!K?.isMultiDimension,
2378
+ isDynamicSeries: !!K?.isDynamicSeries,
2379
+ seriesField: K?.seriesField,
2380
2380
  isDataMartQuery: !!(t?.datasetMetricSettings)?.newDatasetSettings?.isDataMartQuery
2381
2381
  }
2382
2382
  }, {
2383
- isDisableQuery: Ln,
2383
+ isDisableQuery: Rn,
2384
2384
  onSuccess: (e) => {
2385
- let t = Zn(e), n = rt(t.rows), r = ia(ia(t.error, "details"), "legacyCode");
2386
- if (xe && ia(t.error, "code") !== "E1001" && r !== "E1001") {
2387
- let e = X?.id, t = !!n?.length && (q?.chartType !== O.singleValue || n?.[0]?.[q?.singleValue || ""] != null);
2388
- xe?.((n) => {
2385
+ let t = Qn(e), n = at(t.rows), r = ia(ia(t.error, "details"), "legacyCode");
2386
+ if (Fe && ia(t.error, "code") !== "E1001" && r !== "E1001") {
2387
+ let e = Y?.id, t = !!n?.length && (K?.chartType !== A.singleValue || n?.[0]?.[K?.singleValue || ""] != null);
2388
+ Fe?.((n) => {
2389
2389
  let r = n?.find((t) => t?.id === e);
2390
2390
  return r && r.isDataFound === t ? n : [...n?.filter((t) => t?.id !== e) || [], {
2391
2391
  id: e,
@@ -2395,77 +2395,77 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2395
2395
  }
2396
2396
  },
2397
2397
  onSettled: () => {
2398
- let e = X?.id;
2399
- Pe && e && Pe((t) => Ni(t, e));
2398
+ let e = Y?.id;
2399
+ ze && e && ze((t) => Ni(t, e));
2400
2400
  }
2401
- }), Xn = ki(Gn), Qn = Wn && !Gn && Un > 0, $n = I(() => Zn(Z), [Z]), er = !Ln && !Wn && !Jn && $n.isFilterNotApplied ? "This drill filter could not be applied to a custom SQL metric." : void 0, tr = L(void 0);
2402
- F(() => {
2403
- er && tr.current !== Z && (tr.current = Z, m("metric.filter_not_applied", { error_code: "FILTER_NOT_APPLIED" }));
2404
- }, [er, Z]);
2405
- let Q = I(() => la({
2406
- raw: $n.rows,
2401
+ }), Zn = ki(Kn), $n = Gn && !Kn && Wn > 0, er = P(() => Qn(X), [X]), tr = !Rn && !Gn && !Yn && er.isFilterNotApplied ? "This drill filter could not be applied to a custom SQL metric." : void 0, nr = F(void 0);
2402
+ N(() => {
2403
+ tr && nr.current !== X && (nr.current = X, m("metric.filter_not_applied", { error_code: "FILTER_NOT_APPLIED" }));
2404
+ }, [tr, X]);
2405
+ let Z = P(() => la({
2406
+ raw: er.rows,
2407
2407
  selectedDims: (t?.datasetMetricSettings)?.newDatasetSettings?.selectedDims,
2408
2408
  selectedMetrics: (t?.datasetMetricSettings)?.newDatasetSettings?.selectedMetrics,
2409
2409
  datasetSettings: t?.datasetMetricSettings?.newDatasetSettings,
2410
2410
  integrationName: t?.companyIntegration?.name,
2411
- isPythonMode: Y
2411
+ isPythonMode: J
2412
2412
  }), [
2413
- $n.rows,
2413
+ er.rows,
2414
2414
  t?.datasetMetricSettings,
2415
2415
  t?.companyIntegration?.name,
2416
- Y
2417
- ]), rr = I(() => Kn(Z?.metaData?.truncation, Q.length), [Z, Q]), ir = I(() => qn(rr), [rr]), ar = In || Jn || $n.error;
2418
- F(() => {
2419
- if (!ar) return;
2420
- let e = ar instanceof Error ? ar.message : ia(ar, "message"), n = ia(ar, "context");
2416
+ J
2417
+ ]), ir = P(() => qn(X?.metaData?.truncation, Z.length), [X, Z]), ar = P(() => Jn(ir), [ir]), or = Ln || Yn || er.error;
2418
+ N(() => {
2419
+ if (!or) return;
2420
+ let e = or instanceof Error ? or.message : ia(or, "message"), n = ia(or, "context");
2421
2421
  p("metric-query-error-observed", {
2422
2422
  metricId: t?.id,
2423
2423
  metricName: t?.name,
2424
- chartType: q?.chartType,
2424
+ chartType: K?.chartType,
2425
2425
  message: e,
2426
2426
  context: n,
2427
- payload: w(X)
2427
+ payload: E(Y)
2428
2428
  });
2429
2429
  }, [
2430
- ar,
2430
+ or,
2431
2431
  t?.id,
2432
2432
  t?.name,
2433
- q?.chartType
2434
- ]), F(() => {
2435
- let e = X?.id;
2436
- Ln && Pe && e && Pe((t) => Ni(t, e));
2433
+ K?.chartType
2434
+ ]), N(() => {
2435
+ let e = Y?.id;
2436
+ Rn && ze && e && ze((t) => Ni(t, e));
2437
2437
  }, [
2438
- Ln,
2439
- X?.id,
2440
- Pe
2441
- ]), F(() => {
2442
- let e = X?.id;
2443
- !Ln && Pe && e && Pe((t) => Pi(t, e));
2438
+ Rn,
2439
+ Y?.id,
2440
+ ze
2441
+ ]), N(() => {
2442
+ let e = Y?.id;
2443
+ !Rn && ze && e && ze((t) => Pi(t, e));
2444
2444
  }, [
2445
- Ln,
2446
- Nn,
2447
- Pe
2445
+ Rn,
2446
+ Pn,
2447
+ ze
2448
2448
  ]);
2449
- let { data: or } = Sn(T, void 0, g, v), sr = I(() => or?.weekStartDay === "sunday" ? "sunday" : "monday", [or]), { mutate: lr } = ne(), { mutateAsync: ur } = te(), dr = I(() => JSON.stringify({
2450
- metricViewFilters: N?.metricViewFilters || [],
2451
- xAxisSettings: N?.xAxisSettings || [],
2452
- yAxisSettings: N?.yAxisSettings || []
2449
+ let { data: sr } = Cn(D, void 0, _, y), cr = P(() => sr?.weekStartDay === "sunday" ? "sunday" : "monday", [sr]), { mutate: ur } = ee(), { mutateAsync: dr } = x(), fr = P(() => JSON.stringify({
2450
+ metricViewFilters: j?.metricViewFilters || [],
2451
+ xAxisSettings: j?.xAxisSettings || [],
2452
+ yAxisSettings: j?.yAxisSettings || []
2453
2453
  }), [
2454
- N?.metricViewFilters,
2455
- N?.xAxisSettings,
2456
- N?.yAxisSettings
2457
- ]), pr = I(() => JSON.stringify(A || []), [A]), mr = L(N);
2458
- mr.current = N;
2459
- let hr = L(A);
2460
- hr.current = A;
2461
- let _r = L(t?.id);
2462
- _r.current = t?.id, F(() => {
2463
- let e = mr.current, n = hr.current, r = _r.current, i = Cn.current !== dr, s = [...e?.metricViewFilters?.find((e) => e.id === r)?.filters?.filter((e) => !n?.find((t) => e?.name === t?.name)) || [], ...n || []];
2464
- It((e) => {
2454
+ j?.metricViewFilters,
2455
+ j?.xAxisSettings,
2456
+ j?.yAxisSettings
2457
+ ]), mr = P(() => JSON.stringify(k || []), [k]), hr = F(j);
2458
+ hr.current = j;
2459
+ let gr = F(k);
2460
+ gr.current = k;
2461
+ let vr = F(t?.id);
2462
+ vr.current = t?.id, N(() => {
2463
+ let e = hr.current, n = gr.current, r = vr.current, i = wn.current !== fr, s = [...e?.metricViewFilters?.find((e) => e.id === r)?.filters?.filter((e) => !n?.find((t) => e?.name === t?.name)) || [], ...n || []];
2464
+ Lt((e) => {
2465
2465
  let n = t?.rlsConditions?.map((t) => {
2466
2466
  let n = e?.find((e) => e.name === t.name && e.datatype === t.datatype && e.tableName === t.tableName && e.columnName === t.columnName), r = t;
2467
- if (ee) {
2468
- let e = ht(r, ee);
2467
+ if (h) {
2468
+ let e = _t(r, h);
2469
2469
  if (e) {
2470
2470
  let t = r.datatype === "date" ? e.options?.find((t) => t.name === e.value) : void 0;
2471
2471
  r = {
@@ -2521,7 +2521,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2521
2521
  ...r?.selectedDropdownValue === void 0 && n?.selectedDropdownValue !== void 0 ? { selectedDropdownValue: n.selectedDropdownValue } : {},
2522
2522
  ...r?.selectedVariableValue === void 0 && n?.selectedVariableValue !== void 0 ? { selectedVariableValue: n.selectedVariableValue } : {}
2523
2523
  }), r?.datatype === "date" && r?.options?.find((e) => e.range === "Custom Date") && r?.isEnableDynamicDate && r?.dynamicDate?.value) {
2524
- let e = he(ze?.find((e) => e.value === r?.dynamicDate?.value)?.count || 0), t = Ge(e), n = Ge(e);
2524
+ let e = he(Je?.find((e) => e.value === r?.dynamicDate?.value)?.count || 0), t = Ke(e), n = Ke(e);
2525
2525
  r = {
2526
2526
  ...r,
2527
2527
  options: r?.options?.map((r) => r.range === "Custom Date" ? {
@@ -2537,59 +2537,59 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2537
2537
  tableName: `${a}.${t.tableName.split(".").slice(1).join(".")}`
2538
2538
  } : r;
2539
2539
  }) || [];
2540
- return ye(e || [], n || []) ? e : n || [];
2540
+ return we(e || [], n || []) ? e : n || [];
2541
2541
  });
2542
2542
  }, [
2543
2543
  t?.rlsConditions,
2544
- ee,
2544
+ h,
2545
2545
  o,
2546
2546
  a,
2547
- pr,
2548
- dr
2549
- ]), F(() => {
2550
- Cn.current = dr;
2551
- }, [dr]), F(() => {
2552
- t?.id && Ze && !Y && t?.isMetric && Ze?.((e) => {
2547
+ mr,
2548
+ fr
2549
+ ]), N(() => {
2550
+ wn.current = fr;
2551
+ }, [fr]), N(() => {
2552
+ t?.id && $e && !J && t?.isMetric && $e?.((e) => {
2553
2553
  let n = {
2554
- filters: [...K || [], ...q?.tableSettings?.isServerSidePagination && q?.chartType === O.table ? Lt?.map((e) => e.condition)?.filter((e) => ae(e)) : []],
2554
+ filters: [...G || [], ...K?.tableSettings?.isServerSidePagination && K?.chartType === A.table ? Rt?.map((e) => e.condition)?.filter((e) => re(e)) : []],
2555
2555
  xAxisSettings: {
2556
- isEnable: !!(q?.dynamicXAxis?.isEnabled || q?.enduserMeasureAndDimensions?.isEnabled) && Ue.includes(q?.chartType || ""),
2557
- xaxis: q?.xAxis || ""
2556
+ isEnable: !!(K?.dynamicXAxis?.isEnabled || K?.enduserMeasureAndDimensions?.isEnabled) && pe.includes(K?.chartType || ""),
2557
+ xaxis: K?.xAxis || ""
2558
2558
  },
2559
2559
  yAxisSettings: {
2560
- isEnable: !(q?.dynamicYAxis?.isEnabled && q?.dynamicYAxis?.selectedOption && !Array.isArray(q?.dynamicYAxis?.selectedOption)),
2561
- yAxis: q?.dynamicYAxis?.selectedOption || ""
2560
+ isEnable: !(K?.dynamicYAxis?.isEnabled && K?.dynamicYAxis?.selectedOption && !Array.isArray(K?.dynamicYAxis?.selectedOption)),
2561
+ yAxis: K?.dynamicYAxis?.selectedOption || ""
2562
2562
  },
2563
2563
  id: t?.id,
2564
2564
  metricRequestData: {
2565
- isAllClient: h,
2566
- timeseriesSettings: Y ? void 0 : {
2567
- format: q?.timeSeriesSettings?.groupBySettings?.value?.toLowerCase() || "monthly",
2568
- seriesField: q?.seriesField || "",
2569
- isFiscal: be === "ind"
2565
+ isAllClient: g,
2566
+ timeseriesSettings: J ? void 0 : {
2567
+ format: K?.timeSeriesSettings?.groupBySettings?.value?.toLowerCase() || "monthly",
2568
+ seriesField: K?.seriesField || "",
2569
+ isFiscal: Oe === "ind"
2570
2570
  }
2571
2571
  }
2572
2572
  }, r = e?.find((e) => e.id === t?.id);
2573
- return r && ye(r, n) ? e : [...e?.filter((e) => e.id !== t?.id) || [], n];
2573
+ return r && we(r, n) ? e : [...e?.filter((e) => e.id !== t?.id) || [], n];
2574
2574
  });
2575
2575
  }, [
2576
2576
  t?.id,
2577
2577
  t?.isMetric,
2578
- K,
2579
- q?.timeSeriesSettings,
2580
- q?.seriesField,
2581
- Y,
2582
- be,
2583
- h,
2584
- Lt,
2585
- q?.tableSettings?.isServerSidePagination,
2586
- q?.chartType,
2587
- q?.dynamicYAxis,
2588
- q?.dynamicXAxis
2589
- ]), F(() => {
2578
+ G,
2579
+ K?.timeSeriesSettings,
2580
+ K?.seriesField,
2581
+ J,
2582
+ Oe,
2583
+ g,
2584
+ Rt,
2585
+ K?.tableSettings?.isServerSidePagination,
2586
+ K?.chartType,
2587
+ K?.dynamicYAxis,
2588
+ K?.dynamicXAxis
2589
+ ]), N(() => {
2590
2590
  if (t?.drillDownSettings?.isEnableGroupBy) {
2591
2591
  let e = t?.datasetMetricSettings;
2592
- if (!t?.drillDownSettings?.configV2 && !U?.configV2 && e?.newDatasetSettings?.selectedMetrics?.length && e?.newDatasetSettings?.selectedDims?.length) {
2592
+ if (!t?.drillDownSettings?.configV2 && !H?.configV2 && e?.newDatasetSettings?.selectedMetrics?.length && e?.newDatasetSettings?.selectedDims?.length) {
2593
2593
  let n = {
2594
2594
  ...t?.drillDownSettings || {},
2595
2595
  configV2: {
@@ -2597,47 +2597,47 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2597
2597
  levels: oi({
2598
2598
  selectedDims: e?.newDatasetSettings?.selectedDims,
2599
2599
  selectedMetrics: e?.newDatasetSettings?.selectedMetrics,
2600
- chartSettings: q,
2600
+ chartSettings: K,
2601
2601
  drilldownChartSettings: t?.drillDownSettings?.drilldownChartSettings,
2602
- makeIndex: () => Ce(4)
2602
+ makeIndex: () => De(4)
2603
2603
  })
2604
2604
  }
2605
2605
  };
2606
- W(() => nr(n, {
2607
- drilledLevel: lt,
2608
- drillFilters: ut,
2609
- drillType: dt,
2610
- underlyingDataDrillFilters: pt
2606
+ U(() => rr(n, {
2607
+ drilledLevel: dt,
2608
+ drillFilters: ft,
2609
+ drillType: pt,
2610
+ underlyingDataDrillFilters: ht
2611
2611
  }) ?? n);
2612
- } else U?.isEnableGroupBy || W(t?.drillDownSettings);
2612
+ } else H?.isEnableGroupBy || U(t?.drillDownSettings);
2613
2613
  }
2614
2614
  }, [
2615
2615
  t?.drillDownSettings?.isEnableGroupBy,
2616
2616
  t?.drillDownSettings?.configV2,
2617
2617
  t?.datasetMetricSettings,
2618
- q,
2619
- ut,
2620
- lt,
2618
+ K,
2619
+ ft,
2621
2620
  dt,
2622
2621
  pt,
2623
- W
2622
+ ht,
2623
+ U
2624
2624
  ]);
2625
- let vr = L(!1);
2626
- F(() => {
2627
- if (vr.current) return;
2628
- let e = Be?.position;
2629
- if (!Be?.enabled || !e || !t?.id) return;
2630
- let n = U?.configV2;
2625
+ let yr = F(!1);
2626
+ N(() => {
2627
+ if (yr.current) return;
2628
+ let e = Ge?.position;
2629
+ if (!Ge?.enabled || !e || !t?.id) return;
2630
+ let n = H?.configV2;
2631
2631
  if (!n?.levels?.length) return;
2632
- vr.current = !0;
2633
- let r = fr(n, e);
2632
+ yr.current = !0;
2633
+ let r = pr(n, e);
2634
2634
  if (!r) return;
2635
- W((e) => ({
2635
+ U((e) => ({
2636
2636
  ...e,
2637
2637
  configV2: r
2638
2638
  }));
2639
2639
  let i = r.levels?.find((e) => e?.isEnable);
2640
- i?.chartSettings && J((e) => ({
2640
+ i?.chartSettings && q((e) => ({
2641
2641
  ...e,
2642
2642
  ...i.chartSettings
2643
2643
  })), p("drill-restored-from-url", {
@@ -2646,66 +2646,66 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2646
2646
  filterCount: e.filters?.length || 0
2647
2647
  });
2648
2648
  }, [
2649
- Be?.enabled,
2650
- Be?.position,
2651
- U?.configV2,
2649
+ Ge?.enabled,
2650
+ Ge?.position,
2651
+ H?.configV2,
2652
2652
  t?.id,
2653
- W
2653
+ U
2654
2654
  ]);
2655
- let yr = L(void 0);
2656
- F(() => {
2657
- if (!Be?.enabled || !Be.onChange || !t?.id) return;
2658
- let e = U?.configV2?.levels || [], n = e.findIndex((e) => e?.isEnable), r = n >= 0 ? e[n] : void 0, i = n > 0 && r?.index ? cr({
2655
+ let br = F(void 0);
2656
+ N(() => {
2657
+ if (!Ge?.enabled || !Ge.onChange || !t?.id) return;
2658
+ let e = H?.configV2?.levels || [], n = e.findIndex((e) => e?.isEnable), r = n >= 0 ? e[n] : void 0, i = n > 0 && r?.index ? lr({
2659
2659
  levelIndex: r.index,
2660
2660
  filters: (r.filters || []).filter((e) => e?.columnName).map((e) => ({
2661
2661
  columnName: String(e.columnName),
2662
2662
  value: String(e.value ?? "")
2663
2663
  }))
2664
2664
  }) : null;
2665
- yr.current !== i && (yr.current = i, Be.onChange(t.id, i));
2665
+ br.current !== i && (br.current = i, Ge.onChange(t.id, i));
2666
2666
  }, [
2667
- Be?.enabled,
2668
- Be?.onChange,
2669
- U?.configV2,
2667
+ Ge?.enabled,
2668
+ Ge?.onChange,
2669
+ H?.configV2,
2670
2670
  t?.id
2671
2671
  ]);
2672
- let { mutateAsync: br } = re(), xr = I(() => JSON.stringify(n?.filters), [n?.filters]), Sr = I(() => {
2672
+ let { mutateAsync: xr } = te(), Sr = P(() => JSON.stringify(n?.filters), [n?.filters]), Cr = P(() => {
2673
2673
  let e = t?.datasetMetricSettings?.metricVariables || [];
2674
2674
  if (!e || !Array.isArray(e) || !e?.length) return [];
2675
2675
  let r = [];
2676
2676
  for (let i = 0; i < e?.length; i++) {
2677
2677
  let s = e[i], c = s.type.value === "custom" && s.customQuery && s.customColumnName, l = c ? {
2678
- query: Re({
2678
+ query: He({
2679
2679
  query: s?.customQuery || "",
2680
2680
  tenancyLevel: o,
2681
2681
  clientId: a,
2682
- isAllClient: h,
2683
- clientColumnType: ge || "STRING",
2682
+ isAllClient: g,
2683
+ clientColumnType: de || "STRING",
2684
2684
  dbName: t?.companyIntegration?.name,
2685
- rlsConditions: K?.filter((e) => e.isVariableFilter),
2685
+ rlsConditions: G?.filter((e) => e.isVariableFilter),
2686
2686
  globalFilters: {
2687
2687
  ...n,
2688
2688
  filters: n?.filters?.filter((e) => e?.isVariableFilter && !!(Array.isArray(e?.value) ? e?.value?.length : e))
2689
2689
  },
2690
- weekStartDay: sr
2690
+ weekStartDay: cr
2691
2691
  }),
2692
- alias: Le
2693
- } : void 0, u = s.dependOnOptions?.length ? K?.filter((e) => s.dependOnOptions.some((t) => t.type === "metric" && t.filter?.value === e.name && t.column)) : [], d = s.dependOnOptions?.length ? n?.filters?.filter((e) => Array.isArray(e?.value) ? e?.value?.length : e && s.dependOnOptions.some((t) => t.type === "dashboard" && t.filter?.value === e.label && t.column)) : [], f = u?.map((e) => {
2694
- let t = De(e);
2692
+ alias: ye
2693
+ } : void 0, u = s.dependOnOptions?.length ? G?.filter((e) => s.dependOnOptions.some((t) => t.type === "metric" && t.filter?.value === e.name && t.column)) : [], d = s.dependOnOptions?.length ? n?.filters?.filter((e) => Array.isArray(e?.value) ? e?.value?.length : e && s.dependOnOptions.some((t) => t.type === "dashboard" && t.filter?.value === e.label && t.column)) : [], f = u?.map((e) => {
2694
+ let t = xe(e);
2695
2695
  return e.datatype === "date" && t === void 0 ? null : {
2696
2696
  columnName: s.dependOnOptions.find((t) => e.name === t.filter?.value)?.column || "",
2697
2697
  value: t,
2698
2698
  as: e.datatype
2699
2699
  };
2700
2700
  }).filter(Boolean), p = d?.map((e) => {
2701
- let t = e.as === "date" ? we(e) : Ie(e?.value);
2701
+ let t = e.as === "date" ? Ae(e) : Ve(e?.value);
2702
2702
  return e.as === "date" && t === void 0 ? null : {
2703
2703
  columnName: s.dependOnOptions.find((t) => e.label === t.filter?.value)?.column || "",
2704
2704
  value: t,
2705
2705
  as: e.as
2706
2706
  };
2707
2707
  }).filter(Boolean);
2708
- s.isClientScoped && a && ge && !h && o === "TABLE" && s.clientColumn?.name?.value && s.clientColumn?.datatype?.value && f.push({
2708
+ s.isClientScoped && a && de && !g && o === "TABLE" && s.clientColumn?.name?.value && s.clientColumn?.datatype?.value && f.push({
2709
2709
  columnName: s.clientColumn?.name?.value,
2710
2710
  value: a,
2711
2711
  as: s.clientColumn?.datatype?.value
@@ -2713,14 +2713,14 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2713
2713
  let m = [...f, ...p];
2714
2714
  r.push({
2715
2715
  object: {
2716
- wId: T,
2716
+ wId: D,
2717
2717
  tableName: c ? "" : s?.table?.value,
2718
2718
  columnName: c ? s?.customColumnName || "" : s?.column?.value || "",
2719
2719
  filter: m,
2720
2720
  customTable: l,
2721
2721
  aggregate: c ? "" : s?.column?.aggregate || "",
2722
2722
  limit: "1",
2723
- datasourceId: k,
2723
+ datasourceId: ge,
2724
2724
  databaseName: o === "MULTI_DATABASE" && a || ""
2725
2725
  },
2726
2726
  element: s
@@ -2729,177 +2729,177 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2729
2729
  return r;
2730
2730
  }, [
2731
2731
  t?.datasetMetricSettings?.metricVariables,
2732
- xr,
2733
- K,
2734
- ge,
2735
- T,
2732
+ Sr,
2733
+ G,
2734
+ de,
2735
+ D,
2736
2736
  o,
2737
2737
  a,
2738
- h,
2739
- k
2740
- ]), wr = I(() => JSON.stringify(Sr), [Sr]), Er = L(null), Or = L(0), kr = L({
2738
+ g,
2739
+ ge
2740
+ ]), Tr = P(() => JSON.stringify(Cr), [Cr]), Dr = F(null), kr = F(0), Ar = F({
2741
2741
  clientId: a,
2742
- encryptedClientId: v,
2743
- isFrontendApp: g,
2744
- token: ct
2742
+ encryptedClientId: y,
2743
+ isFrontendApp: _,
2744
+ token: ut
2745
2745
  });
2746
- kr.current.clientId = a, kr.current.encryptedClientId = v, kr.current.isFrontendApp = g, kr.current.token = ct;
2747
- let Ar = L(br);
2748
- Ar.current = br, F(() => {
2749
- Or.current += 1;
2750
- let e = Or.current, t = () => Or.current !== e;
2751
- if (Sr?.length) {
2752
- let { clientId: e, encryptedClientId: n, isFrontendApp: r, token: i } = kr.current;
2746
+ Ar.current.clientId = a, Ar.current.encryptedClientId = y, Ar.current.isFrontendApp = _, Ar.current.token = ut;
2747
+ let jr = F(xr);
2748
+ jr.current = xr, N(() => {
2749
+ kr.current += 1;
2750
+ let e = kr.current, t = () => kr.current !== e;
2751
+ if (Cr?.length) {
2752
+ let { clientId: e, encryptedClientId: n, isFrontendApp: r, token: i } = Ar.current;
2753
2753
  Ui({
2754
- entries: Sr,
2755
- fetchColumnValues: Ar.current,
2754
+ entries: Cr,
2755
+ fetchColumnValues: jr.current,
2756
2756
  ctx: {
2757
2757
  clientId: e,
2758
2758
  encryptedClientId: n,
2759
2759
  isFrontendApp: r,
2760
2760
  token: i
2761
2761
  },
2762
- onSeed: (e) => gn(e),
2763
- onResolved: (e, t) => gn((n) => ({
2762
+ onSeed: (e) => _n(e),
2763
+ onResolved: (e, t) => _n((n) => ({
2764
2764
  ...n,
2765
2765
  [e]: t
2766
2766
  })),
2767
- onLoading: (e) => _t(e),
2767
+ onLoading: (e) => yt(e),
2768
2768
  onSettle: () => {
2769
- Er.current && clearTimeout(Er.current), Er.current = setTimeout(() => {
2770
- Er.current = null, _t(!1);
2769
+ Dr.current && clearTimeout(Dr.current), Dr.current = setTimeout(() => {
2770
+ Dr.current = null, yt(!1);
2771
2771
  }, 200);
2772
2772
  },
2773
2773
  isCancelled: t
2774
2774
  }).catch(() => {});
2775
2775
  }
2776
2776
  return () => {
2777
- Or.current += 1, Er.current &&= (clearTimeout(Er.current), null);
2777
+ kr.current += 1, Dr.current &&= (clearTimeout(Dr.current), null);
2778
2778
  };
2779
- }, [wr]);
2780
- let Mr = I(() => (t?.datasetMetricSettings)?.newDatasetSettings?.selectedDims?.[0]?.name, [t]);
2781
- I(() => ie(t?.datasetMetricSettings?.selectedDimensions?.[H.length < t?.datasetMetricSettings?.selectedDimensions?.length ? H.length : 0] || ""), [t?.datasetMetricSettings, H]);
2782
- let Nr = I(() => {
2779
+ }, [Tr]);
2780
+ let Nr = P(() => (t?.datasetMetricSettings)?.newDatasetSettings?.selectedDims?.[0]?.name, [t]);
2781
+ P(() => ne(t?.datasetMetricSettings?.selectedDimensions?.[V.length < t?.datasetMetricSettings?.selectedDimensions?.length ? V.length : 0] || ""), [t?.datasetMetricSettings, V]);
2782
+ let Pr = P(() => {
2783
2783
  let e = t?.drillDownSettings?.isEnableGroupBy;
2784
- return G ? [...B?.length ? B : [], ...gr({
2784
+ return W ? [...z?.length ? z : [], ..._r({
2785
2785
  filters: u,
2786
2786
  metricId: t?.id,
2787
2787
  isGroupByEnabled: e,
2788
2788
  enableCrossFilterBeforeDrill: !0
2789
- })] : e ? B || [] : [...B?.length ? B : [], ...u || []];
2789
+ })] : e ? z || [] : [...z?.length ? z : [], ...u || []];
2790
2790
  }, [
2791
2791
  u,
2792
2792
  t?.id,
2793
- G,
2793
+ W,
2794
2794
  t?.drillDownSettings?.isEnableGroupBy,
2795
- B
2796
- ]), Pr = P((e = []) => e.filter((e) => e.isAddOnMetrics).map((e) => s ? {
2795
+ z
2796
+ ]), Fr = M((e = []) => e.filter((e) => e.isAddOnMetrics).map((e) => s ? {
2797
2797
  ...e,
2798
- dimensionColumn: q?.xAxis || "",
2799
- measureColumn: q?.yAxisList?.[0] || "",
2798
+ dimensionColumn: K?.xAxis || "",
2799
+ measureColumn: K?.yAxisList?.[0] || "",
2800
2800
  options: e.datatype === "date" ? e.options : [],
2801
2801
  variableOptions: e.datatype === "date" ? e.variableOptions : []
2802
2802
  } : {
2803
2803
  ...e,
2804
- dimensionColumn: q?.xAxis || "",
2805
- measureColumn: q?.yAxisList?.[0] || "",
2804
+ dimensionColumn: K?.xAxis || "",
2805
+ measureColumn: K?.yAxisList?.[0] || "",
2806
2806
  value: e.isAppFilter ? e.datatype === "date" ? qe(c?.values?.[e.name], e?.datePresetOptions || e?.presetDateOptions) || (e?.options)?.find((t) => t.name === (c?.values?.[e.name] ?? e.value)) : c?.values?.[e.name] ?? e.value : e.value,
2807
- options: e.datatype === "date" ? e?.options?.map((t) => be === "ind" && e.datatype === "date" ? {
2807
+ options: e.datatype === "date" ? e?.options?.map((t) => Oe === "ind" && e.datatype === "date" ? {
2808
2808
  ...t,
2809
2809
  isFiscal: !0
2810
2810
  } : t) : [],
2811
2811
  variableOptions: e.datatype === "date" ? e.variableOptions : []
2812
- }).filter((e) => Dn(e)), [
2812
+ }).filter((e) => On(e)), [
2813
2813
  c?.values,
2814
- be,
2815
- q?.xAxis,
2816
- q?.yAxisList,
2814
+ Oe,
2815
+ K?.xAxis,
2816
+ K?.yAxisList,
2817
2817
  s,
2818
- Dn
2818
+ On
2819
2819
  ]);
2820
- I(() => Pr(Nr), [Pr, Nr]), F(() => {
2821
- Nr?.some((e) => e.isAddOnMetrics) ? mn(Pr(Nr)) : mn([]);
2822
- }, [Pr, Nr]);
2823
- let Fr = I(() => q?.chartType === O.singleValue && !!q?.customSettings?.comparisonValueShow && !!q?.customSettings?.comparisonTimeGrain && !!q?.customSettings?.comparisonTimePeriod && !!q?.singleValue, [q]);
2824
- F(() => {
2825
- let e = Z;
2826
- if (Tn({
2820
+ P(() => Fr(Pr), [Fr, Pr]), N(() => {
2821
+ Pr?.some((e) => e.isAddOnMetrics) ? hn(Fr(Pr)) : hn([]);
2822
+ }, [Fr, Pr]);
2823
+ let Ir = P(() => K?.chartType === A.singleValue && !!K?.customSettings?.comparisonValueShow && !!K?.customSettings?.comparisonTimeGrain && !!K?.customSettings?.comparisonTimePeriod && !!K?.singleValue, [K]);
2824
+ N(() => {
2825
+ let e = X;
2826
+ if (En({
2827
2827
  data: [],
2828
2828
  error: "",
2829
2829
  isLoading: !1,
2830
2830
  currentValue: ""
2831
- }), q?.chartType === O.table) {
2831
+ }), K?.chartType === A.table) {
2832
2832
  let t = e?.totalRecords;
2833
- typeof t == "number" && Pt(t);
2833
+ typeof t == "number" && Ft(t);
2834
2834
  }
2835
2835
  p("metric-query-response-applied", {
2836
2836
  metricId: t?.id,
2837
2837
  metricName: t?.name,
2838
- chartType: q?.chartType,
2839
- rowCount: Q?.length || 0,
2840
- columns: Object.keys(Q?.[0] || {}),
2838
+ chartType: K?.chartType,
2839
+ rowCount: Z?.length || 0,
2840
+ columns: Object.keys(Z?.[0] || {}),
2841
2841
  totalRecords: e?.totalRecords,
2842
- truncation: rr,
2843
- drillConfig: b(U?.configV2)
2842
+ truncation: ir,
2843
+ drillConfig: S(H?.configV2)
2844
2844
  });
2845
- let n = !!U?.isEnableGroupBy && !!U?.configV2?.isEnable && !!U?.configV2?.levels?.some((e) => e?.isEnable);
2846
- if (t?.datasetMetricSettings?.isUseRawSQL && !(En && n)) {
2847
- let e = Object.keys(Q?.[0] || {});
2848
- J((t) => ({
2845
+ let n = !!H?.isEnableGroupBy && !!H?.configV2?.isEnable && !!H?.configV2?.levels?.some((e) => e?.isEnable);
2846
+ if (t?.datasetMetricSettings?.isUseRawSQL && !(Dn && n)) {
2847
+ let e = Object.keys(Z?.[0] || {});
2848
+ q((t) => ({
2849
2849
  ...t,
2850
2850
  yAxisList: e.length ? e : t?.yAxisList || []
2851
2851
  }));
2852
2852
  }
2853
2853
  let r = e?.metaData;
2854
- on(Ne(r?.groupbyColumnList)), qt((e) => ({
2854
+ sn(Le(r?.groupbyColumnList)), Jt((e) => ({
2855
2855
  ...e,
2856
2856
  report: "",
2857
2857
  isLoading: e?.isLoading,
2858
2858
  isOpen: e?.isOpen
2859
2859
  }));
2860
2860
  }, [
2861
- Z,
2861
+ X,
2862
2862
  t?.datasetMetricSettings,
2863
- Q,
2864
- rr,
2865
- En,
2866
- U?.isEnableGroupBy,
2867
- U?.configV2
2868
- ]), F(() => {
2869
- t?.datasetMetricSettings?.createdSorts?.length ? vn(!0) : vn(!1);
2870
- }, [t?.datasetMetricSettings?.createdSorts?.length]), F(() => {
2871
- q?.chartType === O.timeSeries && q?.timeSeriesSettings?.groupBySettings?.value && !Y && J((e) => ({
2863
+ Z,
2864
+ ir,
2865
+ Dn,
2866
+ H?.isEnableGroupBy,
2867
+ H?.configV2
2868
+ ]), N(() => {
2869
+ t?.datasetMetricSettings?.createdSorts?.length ? yn(!0) : yn(!1);
2870
+ }, [t?.datasetMetricSettings?.createdSorts?.length]), N(() => {
2871
+ K?.chartType === A.timeSeries && K?.timeSeriesSettings?.groupBySettings?.value && !J && q((e) => ({
2872
2872
  ...e,
2873
- xAxis: `${q?.timeSeriesSettings?.groupBySettings?.value?.toLowerCase()} of ${Mr}`
2873
+ xAxis: `${K?.timeSeriesSettings?.groupBySettings?.value?.toLowerCase()} of ${Nr}`
2874
2874
  }));
2875
2875
  }, [
2876
- Q,
2877
- q?.chartType,
2878
- q?.timeSeriesSettings,
2879
- Y
2880
- ]), F(() => {
2881
- if (q?.isEnableComparisonFilter && [O.line].includes(q?.chartType)) {
2882
- let e = t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics || [], n = Object?.keys(Q?.[0] || {});
2883
- J((t) => ({
2876
+ Z,
2877
+ K?.chartType,
2878
+ K?.timeSeriesSettings,
2879
+ J
2880
+ ]), N(() => {
2881
+ if (K?.isEnableComparisonFilter && [A.line].includes(K?.chartType)) {
2882
+ let e = t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics || [], n = Object?.keys(Z?.[0] || {});
2883
+ q((t) => ({
2884
2884
  ...t,
2885
2885
  yAxisList: [...n.filter((t) => e?.some((e) => t.startsWith(e.alias)))]
2886
2886
  }));
2887
2887
  }
2888
2888
  }, [
2889
- Q,
2890
- q?.isEnableComparisonFilter,
2891
- z,
2892
- q?.chartType
2889
+ Z,
2890
+ K?.isEnableComparisonFilter,
2891
+ R,
2892
+ K?.chartType
2893
2893
  ]);
2894
- let Lr = P((e, n, r, a, o, s) => {
2895
- S("metric-filter-applied", {
2894
+ let Rr = M((e, n, r, a, o, s) => {
2895
+ w("metric-filter-applied", {
2896
2896
  metricId: t?.id,
2897
2897
  hasCustomValue: !!a,
2898
2898
  hasStringValues: !!o?.length,
2899
2899
  stringValueCount: o?.length || 0,
2900
2900
  hasTimeGrain: !!s,
2901
- rlsConditionCount: B?.length || 0
2902
- }), fe?.(i, t?.id), It(a ? (t) => t?.map((t) => t.name === e ? {
2901
+ rlsConditionCount: z?.length || 0
2902
+ }), ue?.(i, t?.id), Lt(a ? (t) => t?.map((t) => t.name === e ? {
2903
2903
  ...t,
2904
2904
  value: n,
2905
2905
  options: t.options?.map((e) => n === e.name ? {
@@ -2936,95 +2936,95 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
2936
2936
  label: r || n
2937
2937
  }
2938
2938
  } : t));
2939
- }, []), Rr = P((e) => {
2939
+ }, []), zr = M((e) => {
2940
2940
  e?.event && e?.event?.event?.preventDefault(), p("chart-click-params-captured", {
2941
2941
  metricId: t?.id,
2942
2942
  metricName: t?.name,
2943
- chartType: q?.chartType,
2943
+ chartType: K?.chartType,
2944
2944
  name: e?.name,
2945
2945
  value: e?.value,
2946
2946
  seriesName: e?.seriesName,
2947
2947
  dataIndex: e?.dataIndex,
2948
- drillConfig: b(U?.configV2)
2949
- }), Vt(e);
2948
+ drillConfig: S(H?.configV2)
2949
+ }), Ht(e);
2950
2950
  }, [
2951
2951
  t?.id,
2952
2952
  t?.name,
2953
- q?.chartType,
2954
- U?.configV2
2955
- ]), zr = I(() => {
2956
- let e = Array.isArray(Q) && Q.length && V?.name != null ? Q?.map((e) => Object.entries(e).find(([, e]) => (typeof e == "number" && typeof V?.name == "string" ? e?.toString() : e) === V.name)?.[0]).filter((e) => e)[0] : "";
2953
+ K?.chartType,
2954
+ H?.configV2
2955
+ ]), Q = P(() => {
2956
+ let e = Array.isArray(Z) && Z.length && B?.name != null ? Z?.map((e) => Object.entries(e).find(([, e]) => (typeof e == "number" && typeof B?.name == "string" ? e?.toString() : e) === B.name)?.[0]).filter((e) => e)[0] : "";
2957
2957
  if (!e) return e;
2958
- let n = t?.datasetMetricSettings?.newDatasetSettings, r = [...n?.selectedDims || [], ...n?.selectedMetrics || []], i = U?.configV2?.levels?.flatMap((e) => e?.dimensions || []) || [];
2959
- return Xe(e, {
2958
+ let n = t?.datasetMetricSettings?.newDatasetSettings, r = [...n?.selectedDims || [], ...n?.selectedMetrics || []], i = H?.configV2?.levels?.flatMap((e) => e?.dimensions || []) || [];
2959
+ return Qe(e, {
2960
2960
  selectedColumns: r,
2961
2961
  levelColumns: i,
2962
2962
  dbName: t?.companyIntegration?.name
2963
2963
  });
2964
2964
  }, [
2965
- Q,
2966
- V?.name,
2965
+ Z,
2966
+ B?.name,
2967
2967
  t?.datasetMetricSettings,
2968
2968
  t?.companyIntegration?.name,
2969
- U?.configV2?.levels
2970
- ]), Br = I(() => {
2971
- if (!V) return;
2972
- let e = q?.isMultiDimension || q?.isDynamicSeries ? q?.seriesField : void 0, t = e === "ungrouped" ? void 0 : e, n = !t && typeof V.seriesName == "string" ? V.seriesName : q?.yAxisList?.[0] || q?.singleValue, r = Qe(q);
2969
+ H?.configV2?.levels
2970
+ ]), Br = P(() => {
2971
+ if (!B) return;
2972
+ let e = K?.isMultiDimension || K?.isDynamicSeries ? K?.seriesField : void 0, t = e === "ungrouped" ? void 0 : e, n = !t && typeof B.seriesName == "string" ? B.seriesName : K?.yAxisList?.[0] || K?.singleValue, r = et(K);
2973
2973
  return Hr({
2974
- params: V,
2975
- axisDimension: zr ? { columnName: zr } : void 0,
2974
+ params: B,
2975
+ axisDimension: Q ? { columnName: Q } : void 0,
2976
2976
  seriesDimension: t ? { columnName: t } : void 0,
2977
2977
  measure: n ? { columnName: n } : void 0,
2978
2978
  formatMeasure: r ? (e) => r(e, n) : void 0
2979
2979
  });
2980
2980
  }, [
2981
- V,
2982
- zr,
2983
- q
2984
- ]), Vr = I(() => {
2981
+ B,
2982
+ Q,
2983
+ K
2984
+ ]), Vr = P(() => {
2985
2985
  let e = t?.datasetMetricSettings?.newDatasetSettings;
2986
2986
  return {
2987
2987
  selectedDims: e?.selectedDims,
2988
2988
  selectedMetrics: e?.selectedMetrics,
2989
- levelDimensions: U?.configV2?.levels?.flatMap((e) => e?.dimensions || []) || []
2989
+ levelDimensions: H?.configV2?.levels?.flatMap((e) => e?.dimensions || []) || []
2990
2990
  };
2991
- }, [U?.configV2?.levels, t?.datasetMetricSettings]), Ur = P((e) => oe({
2991
+ }, [H?.configV2?.levels, t?.datasetMetricSettings]), Ur = M((e) => ae({
2992
2992
  filter: e,
2993
2993
  ...Vr
2994
- }), [Vr]), Wr = I(() => {
2995
- if ($t.current !== void 0 && H === Qt.current) return $t.current;
2996
- let e = U?.configV2?.levels?.find((e) => e?.isEnable)?.filters || [];
2997
- return (e.length ? e : H).map(Ur);
2994
+ }), [Vr]), Wr = P(() => {
2995
+ if (en.current !== void 0 && V === $t.current) return en.current;
2996
+ let e = H?.configV2?.levels?.find((e) => e?.isEnable)?.filters || [];
2997
+ return (e.length ? e : V).map(Ur);
2998
2998
  }, [
2999
- U?.configV2?.levels,
3000
- H,
2999
+ H?.configV2?.levels,
3000
+ V,
3001
3001
  Ur,
3002
- Qt,
3003
- $t
3004
- ]), Gr = I(() => je({
3005
- columnName: zr,
3002
+ $t,
3003
+ en
3004
+ ]), Gr = P(() => Pe({
3005
+ columnName: Q,
3006
3006
  ...Vr
3007
- }), [zr, Vr]), { getUnderlyingData: Kr } = zn({
3007
+ }), [Q, Vr]), { getUnderlyingData: Kr } = Bn({
3008
3008
  clientName: a,
3009
3009
  dbName: t?.companyIntegration?.name,
3010
3010
  tenancyType: o,
3011
- values: kn,
3011
+ values: An,
3012
3012
  companyId: t?.companyId,
3013
- query: me(t?.query, t?.companyId),
3014
- workspaceId: T,
3013
+ query: _e(t?.query, t?.companyId),
3014
+ workspaceId: D,
3015
3015
  metricId: t?.id,
3016
- dashboardId: C,
3017
- rlsConditions: K,
3016
+ dashboardId: T,
3017
+ rlsConditions: G,
3018
3018
  globalFilters: n,
3019
- isAllClient: !!h,
3020
- dataMartRelationships: On,
3019
+ isAllClient: !!g,
3020
+ dataMartRelationships: kn,
3021
3021
  customSql: t?.clickActions?.underlyingData?.sql,
3022
- isEnableCustomSQL: q?.chartType === O.singleValue && t?.clickActions?.underlyingData?.isEnable && t?.clickActions?.underlyingData?.sql,
3023
- datasourceId: k,
3022
+ isEnableCustomSQL: K?.chartType === A.singleValue && t?.clickActions?.underlyingData?.isEnable && t?.clickActions?.underlyingData?.sql,
3023
+ datasourceId: ge,
3024
3024
  drillFilters: Wr,
3025
- token: ct || "",
3026
- isFrontendApp: g,
3027
- encryptedClientId: g ? v || "" : a || ""
3025
+ token: ut || "",
3026
+ isFrontendApp: _,
3027
+ encryptedClientId: _ ? y || "" : a || ""
3028
3028
  }), qr = async (e, n, r, i, s, c) => {
3029
3029
  p("drill-config-change-start", {
3030
3030
  metricId: t?.id,
@@ -3034,14 +3034,14 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3034
3034
  clickName: n?.name,
3035
3035
  clickValue: n?.value,
3036
3036
  rowFilters: n?.rowFilters,
3037
- incomingConfig: b(e),
3038
- stateConfig: b(U?.configV2)
3037
+ incomingConfig: S(e),
3038
+ stateConfig: S(H?.configV2)
3039
3039
  });
3040
3040
  let d = t?.datasetMetricSettings;
3041
- if (!e || !En && !d?.newDatasetSettings?.configuration || !t?.companyIntegration?.name) {
3041
+ if (!e || !Dn && !d?.newDatasetSettings?.configuration || !t?.companyIntegration?.name) {
3042
3042
  p("drill-config-change-skipped", {
3043
3043
  metricId: t?.id,
3044
- hasStateConfig: !!U?.configV2,
3044
+ hasStateConfig: !!H?.configV2,
3045
3045
  hasIncomingConfig: !!e,
3046
3046
  hasDatasetConfiguration: !!d?.newDatasetSettings?.configuration,
3047
3047
  integrationName: t?.companyIntegration?.name
@@ -3051,8 +3051,8 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3051
3051
  });
3052
3052
  return;
3053
3053
  }
3054
- let f = n?.name, ee = (e?.levels || []).find((e) => r ? e?.index === r : e?.isEnable), h = ee?.dimensions?.[0]?.alias, g = n?.rowFilters || [], { config: _, outcome: v } = ui({
3055
- config: En && bi(e) || e,
3054
+ let f = n?.name, h = (e?.levels || []).find((e) => r ? e?.index === r : e?.isEnable), g = h?.dimensions?.[0]?.alias, _ = n?.rowFilters || [], { config: v, outcome: y } = ui({
3055
+ config: Dn && bi(e) || e,
3056
3056
  clickedLevelIndex: r,
3057
3057
  isReset: i,
3058
3058
  clickedValue: f,
@@ -3063,12 +3063,12 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3063
3063
  if (p("drill-config-level-change-resolved", {
3064
3064
  metricId: t?.id,
3065
3065
  clickedLevelIndex: r,
3066
- outcome: v,
3066
+ outcome: y,
3067
3067
  filterValue: f,
3068
3068
  rowFilters: n?.rowFilters,
3069
- resolvedConfig: b(_)
3070
- }), v === "unrepresentable") {
3071
- bt(hi({
3069
+ resolvedConfig: S(v)
3070
+ }), y === "unrepresentable") {
3071
+ St(hi({
3072
3072
  kind: "none",
3073
3073
  reason: "blank-value"
3074
3074
  })), m("metric.drill_blocked", {
@@ -3077,15 +3077,15 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3077
3077
  });
3078
3078
  return;
3079
3079
  }
3080
- let y = _, te = [...s || [], ...tn], x = te.length ? [...d?.newDatasetSettings?.selectedDims || [], ...te] : d?.newDatasetSettings?.selectedDims;
3081
- if (y = En ? y : Fe({
3082
- config: y,
3083
- selectedDims: x,
3080
+ let b = v, x = [...s || [], ...nn], C = x.length ? [...d?.newDatasetSettings?.selectedDims || [], ...x] : d?.newDatasetSettings?.selectedDims;
3081
+ if (b = Dn ? b : Be({
3082
+ config: b,
3083
+ selectedDims: C,
3084
3084
  selectedMetrics: d?.newDatasetSettings?.selectedMetrics,
3085
- previousSelectedDims: x,
3085
+ previousSelectedDims: C,
3086
3086
  previousSelectedMetrics: d?.newDatasetSettings?.selectedMetrics
3087
- }) || y, v === "descend" && si(y?.levels?.find((e) => e?.isEnable))) {
3088
- bt(hi({
3087
+ }) || b, y === "descend" && si(b?.levels?.find((e) => e?.isEnable))) {
3088
+ St(hi({
3089
3089
  kind: "none",
3090
3090
  reason: "level-without-measure"
3091
3091
  })), m("metric.drill_blocked", {
@@ -3094,76 +3094,76 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3094
3094
  });
3095
3095
  return;
3096
3096
  }
3097
- bt(null);
3098
- let S = y?.levels?.find((e) => e?.isEnable), ne = !!y?.levels?.[y?.levels?.length - 1]?.isEnable, C = y?.levels?.[0]?.isEnable, w = ii({
3099
- parentSettings: q,
3100
- levelSettings: S?.chartSettings,
3101
- measures: S?.measures
3102
- }) || q, T = w?.chartType === O.table, re = [...S?.dimensions?.map((e) => e.alias) || [], ...S?.measures?.map((e) => e.alias) || []], E = {
3103
- ...w,
3104
- xAxis: S?.dimensions?.[0]?.alias || "",
3105
- yAxisList: ne && !w?.chartType || T ? re : S?.measures?.map((e) => e.alias) || [],
3106
- chartType: ne && !w?.chartType ? O.table : w?.chartType
3107
- }, D = `${S?.dimensions?.[0]?.table?.schemaName}.${S?.dimensions?.[0]?.table?.tableName}`;
3097
+ St(null);
3098
+ let w = b?.levels?.find((e) => e?.isEnable), ee = !!b?.levels?.[b?.levels?.length - 1]?.isEnable, T = b?.levels?.[0]?.isEnable, E = ii({
3099
+ parentSettings: K,
3100
+ levelSettings: w?.chartSettings,
3101
+ measures: w?.measures
3102
+ }) || K, D = E?.chartType === A.table, te = [...w?.dimensions?.map((e) => e.alias) || [], ...w?.measures?.map((e) => e.alias) || []], O = {
3103
+ ...E,
3104
+ xAxis: w?.dimensions?.[0]?.alias || "",
3105
+ yAxisList: ee && !E?.chartType || D ? te : w?.measures?.map((e) => e.alias) || [],
3106
+ chartType: ee && !E?.chartType ? A.table : E?.chartType
3107
+ }, ne = `${w?.dimensions?.[0]?.table?.schemaName}.${w?.dimensions?.[0]?.table?.tableName}`;
3108
3108
  if (p("drill-config-next-state-ready", {
3109
3109
  metricId: t?.id,
3110
3110
  activeLevel: {
3111
- index: S?.index,
3112
- name: S?.name,
3113
- filters: S?.filters
3111
+ index: w?.index,
3112
+ name: w?.name,
3113
+ filters: w?.filters
3114
3114
  },
3115
- isLastLevel: ne,
3116
- isFirstLevelActive: C,
3117
- chartType: E?.chartType,
3118
- xAxis: E?.xAxis,
3119
- yAxisList: E?.yAxisList,
3120
- tableColumns: re,
3121
- updatedConfig: b(y)
3122
- }), W((e) => ({
3115
+ isLastLevel: ee,
3116
+ isFirstLevelActive: T,
3117
+ chartType: O?.chartType,
3118
+ xAxis: O?.xAxis,
3119
+ yAxisList: O?.yAxisList,
3120
+ tableColumns: te,
3121
+ updatedConfig: S(b)
3122
+ }), U((e) => ({
3123
3123
  ...e,
3124
3124
  configV2: {
3125
- ...y || {},
3126
- levels: y?.levels?.map((e) => e.index === S?.index ? {
3125
+ ...b || {},
3126
+ levels: b?.levels?.map((e) => e.index === w?.index ? {
3127
3127
  ...e,
3128
- chartSettings: E
3128
+ chartSettings: O
3129
3129
  } : e) || []
3130
3130
  }
3131
- })), J((e) => E), v === "descend" || v === "adhoc-descend") {
3132
- let e = At.current, t = e ? e.querySelector("[data-chart-engine=\"v2\"]") ? "v2" : "v1" : void 0;
3131
+ })), q((e) => O), y === "descend" || y === "adhoc-descend") {
3132
+ let e = Mt.current, t = e ? e.querySelector("[data-chart-engine=\"v2\"]") ? "v2" : "v1" : void 0;
3133
3133
  m("metric.drilled", {
3134
- level: y.levels?.findIndex((e) => e.isEnable) ?? -1,
3134
+ level: b.levels?.findIndex((e) => e.isEnable) ?? -1,
3135
3135
  ...t ? { engine: t } : {}
3136
3136
  });
3137
3137
  }
3138
3138
  if (p("drill-config-state-committed", {
3139
3139
  metricId: t?.id,
3140
- chartType: E?.chartType,
3141
- activeLevelIndex: S?.index,
3142
- drillConfig: b(y)
3143
- }), rn && !En) {
3144
- let e = Tr({
3140
+ chartType: O?.chartType,
3141
+ activeLevelIndex: w?.index,
3142
+ drillConfig: S(b)
3143
+ }), an && !Dn) {
3144
+ let e = Er({
3145
3145
  existing: u,
3146
3146
  isReset: i,
3147
3147
  levelIndex: r,
3148
- hasCurrentLevel: !!ee,
3148
+ hasCurrentLevel: !!h,
3149
3149
  filterValue: f,
3150
- columnName: h,
3151
- rowFilters: g,
3150
+ columnName: g,
3151
+ rowFilters: _,
3152
3152
  selectedDims: d?.newDatasetSettings?.selectedDims,
3153
- activeLevelTableName: D,
3153
+ activeLevelTableName: ne,
3154
3154
  tenancyLevel: o,
3155
3155
  clientId: a,
3156
- sourceMetricId: G ? t?.id : void 0
3157
- }), n = !i && !r ? Cr({
3158
- columnName: h,
3159
- rowFilters: g,
3156
+ sourceMetricId: W ? t?.id : void 0
3157
+ }), n = !i && !r ? wr({
3158
+ columnName: g,
3159
+ rowFilters: _,
3160
3160
  selectedDims: d?.newDatasetSettings?.selectedDims
3161
3161
  }) : void 0;
3162
3162
  p("drill-cross-filter-state-committed", {
3163
3163
  metricId: t?.id,
3164
3164
  crossFilterCount: e?.length || 0,
3165
3165
  drillCrossFilters: e
3166
- }), n ? (bt({
3166
+ }), n ? (St({
3167
3167
  title: "Filter unavailable",
3168
3168
  body: n
3169
3169
  }), m("metric.drill_blocked", {
@@ -3173,14 +3173,14 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3173
3173
  })) : l?.(e);
3174
3174
  }
3175
3175
  }, Jr = ({ columnName: e, value: n, mode: r = "only" }) => {
3176
- if (!rn) return;
3177
- let i = t?.datasetMetricSettings, s = Cr({
3176
+ if (!an) return;
3177
+ let i = t?.datasetMetricSettings, s = wr({
3178
3178
  columnName: e,
3179
3179
  selectedDims: i?.newDatasetSettings?.selectedDims,
3180
3180
  requiresSchemaMetadata: !0
3181
3181
  });
3182
3182
  if (s) {
3183
- bt({
3183
+ St({
3184
3184
  title: "Filter unavailable",
3185
3185
  body: s
3186
3186
  }), m("metric.drill_blocked", {
@@ -3190,7 +3190,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3190
3190
  });
3191
3191
  return;
3192
3192
  }
3193
- let c = jr({
3193
+ let c = Mr({
3194
3194
  existing: u,
3195
3195
  columnName: e,
3196
3196
  value: n,
@@ -3198,7 +3198,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3198
3198
  selectedDims: i?.newDatasetSettings?.selectedDims,
3199
3199
  tenancyLevel: o,
3200
3200
  clientId: a,
3201
- sourceMetricId: G ? t?.id : void 0
3201
+ sourceMetricId: W ? t?.id : void 0
3202
3202
  });
3203
3203
  p("point-cross-filter-committed", {
3204
3204
  metricId: t?.id,
@@ -3208,13 +3208,13 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3208
3208
  }), l?.(c);
3209
3209
  }, Yr = ({ columnName: e, value: n, mode: r = "only" }) => {
3210
3210
  if (!t?.id) return;
3211
- let i = t?.datasetMetricSettings, s = Cr({
3211
+ let i = t?.datasetMetricSettings, s = wr({
3212
3212
  columnName: e,
3213
3213
  selectedDims: i?.newDatasetSettings?.selectedDims,
3214
3214
  requiresSchemaMetadata: !0
3215
3215
  });
3216
3216
  if (s) {
3217
- bt({
3217
+ St({
3218
3218
  title: "Filter unavailable",
3219
3219
  body: s
3220
3220
  }), m("metric.drill_blocked", {
@@ -3224,8 +3224,8 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3224
3224
  });
3225
3225
  return;
3226
3226
  }
3227
- let c = jr({
3228
- existing: A,
3227
+ let c = Mr({
3228
+ existing: k,
3229
3229
  columnName: e,
3230
3230
  value: n,
3231
3231
  mode: r,
@@ -3238,7 +3238,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3238
3238
  columnName: e,
3239
3239
  mode: r,
3240
3240
  filterCount: c?.length || 0
3241
- }), _e?.(t.id, c);
3241
+ }), Se?.(t.id, c);
3242
3242
  }, Xr = async (e, n) => {
3243
3243
  p("drill-down-handler-start", {
3244
3244
  metricId: t?.id,
@@ -3247,21 +3247,21 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3247
3247
  paramsValue: e?.value,
3248
3248
  paramsSeriesName: e?.seriesName,
3249
3249
  rowFilters: e?.rowFilters || n,
3250
- drillConfig: b(U?.configV2)
3251
- }), await qr(U?.configV2, e), p("drill-down-handler-complete", {
3250
+ drillConfig: S(H?.configV2)
3251
+ }), await qr(H?.configV2, e), p("drill-down-handler-complete", {
3252
3252
  metricId: t?.id,
3253
3253
  metricName: t?.name
3254
3254
  });
3255
3255
  }, Zr = async ({ dimension: e, params: n, point: r }) => {
3256
3256
  if (!e?.alias) return;
3257
- let i = t?.datasetMetricSettings, a = U?.configV2, o = a?.levels || [], s = o.findIndex((e) => e?.isEnable), c = (s >= 0 ? o.slice(0, s + 1) : []).map((e) => ({
3257
+ let i = t?.datasetMetricSettings, a = H?.configV2, o = a?.levels || [], s = o.findIndex((e) => e?.isEnable), c = (s >= 0 ? o.slice(0, s + 1) : []).map((e) => ({
3258
3258
  ...e,
3259
3259
  isEnable: !1
3260
3260
  })), l = ai({
3261
3261
  dimension: e,
3262
3262
  measures: i?.newDatasetSettings?.selectedMetrics || [],
3263
- index: Ce(4),
3264
- chartSettings: q
3263
+ index: De(4),
3264
+ chartSettings: K
3265
3265
  }), u = {
3266
3266
  ...a || {},
3267
3267
  isEnable: !0,
@@ -3269,33 +3269,33 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3269
3269
  }, d = c[c.length - 1], f = {
3270
3270
  columnName: d?.dimensions?.[0]?.alias || i?.newDatasetSettings?.selectedDims?.[0]?.alias,
3271
3271
  parentFilters: d?.filters || [],
3272
- pointFilters: Ir(r, Ur).filters
3272
+ pointFilters: Lr(r, Ur).filters
3273
3273
  };
3274
3274
  p("adhoc-drill-start", {
3275
3275
  metricId: t?.id,
3276
3276
  dimensionAlias: e?.alias,
3277
3277
  clickedValue: n?.name,
3278
3278
  seededConfig: !a,
3279
- drillConfig: b(u)
3280
- }), nn((t) => t.some((t) => t?.alias === e?.alias) ? t : [...t, e]), W((e) => ({
3279
+ drillConfig: S(u)
3280
+ }), rn((t) => t.some((t) => t?.alias === e?.alias) ? t : [...t, e]), U((e) => ({
3281
3281
  ...e,
3282
3282
  isEnableGroupBy: !0,
3283
3283
  configV2: u
3284
3284
  })), await qr(u, n, void 0, !1, [e], f);
3285
3285
  }, Qr = ({ filters: e, nextLevel: r, currentValue: i }) => {
3286
- let o = t?.datasetMetricSettings?.newDatasetSettings, s = o?.configuration, c = o?.selectedDims || [], l = o?.selectedMetrics || [], u = t?.datasetMetricSettings?.createdSorts || [], { headerColumns: d, nonHeaderColumns: f } = c.reduce((e, t) => (q?.pivotTableSettings2?.headers?.includes(t.alias) ? e.headerColumns.push(t) : e.nonHeaderColumns.push(t), e), {
3286
+ let o = t?.datasetMetricSettings?.newDatasetSettings, s = o?.configuration, c = o?.selectedDims || [], l = o?.selectedMetrics || [], u = t?.datasetMetricSettings?.createdSorts || [], { headerColumns: d, nonHeaderColumns: f } = c.reduce((e, t) => (K?.pivotTableSettings2?.headers?.includes(t.alias) ? e.headerColumns.push(t) : e.nonHeaderColumns.push(t), e), {
3287
3287
  headerColumns: [],
3288
3288
  nonHeaderColumns: []
3289
3289
  }), p = e?.map((e) => `${e.columnName};;${e.value}`).join(";;");
3290
- Tn((e) => ({
3290
+ En((e) => ({
3291
3291
  ...e,
3292
3292
  data: e.data.filter((e) => e.key !== p),
3293
3293
  error: "",
3294
3294
  isLoading: !0,
3295
3295
  currentValue: i
3296
3296
  }));
3297
- let m = f.slice(0, r), ee = e?.map((e) => {
3298
- let t = c.find((t) => t.alias === e.columnName || Oe(t) === e.columnName);
3297
+ let m = f.slice(0, r), h = e?.map((e) => {
3298
+ let t = c.find((t) => t.alias === e.columnName || je(t) === e.columnName);
3299
3299
  if (t) return {
3300
3300
  alias: t.alias || "",
3301
3301
  columnName: t.name,
@@ -3306,43 +3306,43 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3306
3306
  value: e.value,
3307
3307
  relationOperator: "AND"
3308
3308
  };
3309
- }).filter((e) => e), h = [
3309
+ }).filter((e) => e), g = [
3310
3310
  ...m,
3311
3311
  ...l,
3312
3312
  ...d
3313
- ], { aggregates: y, dimensions: te } = Te(h), b = pe(u), x = nt(b, h), S = {
3313
+ ], { aggregates: b, dimensions: x } = ke(g), S = fe(u), C = it(S, g), w = {
3314
3314
  ...s,
3315
- dimensions: te,
3316
- aggregates: y,
3317
- filters: [...s.filters, ...ee],
3318
- orders: x,
3315
+ dimensions: x,
3316
+ aggregates: b,
3317
+ filters: [...s.filters, ...h],
3318
+ orders: C,
3319
3319
  isApplyGlobalFilter: !0,
3320
3320
  isApplyMetricFilter: !0,
3321
3321
  globalFilters: n,
3322
- rlsConditions: K
3322
+ rlsConditions: G
3323
3323
  };
3324
- lr({
3324
+ ur({
3325
3325
  data: {
3326
- configuration: S,
3327
- id: T,
3328
- datasourceId: k,
3326
+ configuration: w,
3327
+ id: D,
3328
+ datasourceId: ge,
3329
3329
  dashboardId: "",
3330
3330
  isCreateMetric: !0
3331
3331
  },
3332
- clientId: g ? v || "" : a,
3333
- token: _ || "",
3334
- isFrontendApp: g
3332
+ clientId: _ ? y || "" : a,
3333
+ token: v || "",
3334
+ isFrontendApp: _
3335
3335
  }, { onSuccess(e) {
3336
3336
  let n = e?.error, r = e?.data;
3337
- if (n?.message) Tn((e) => ({
3337
+ if (n?.message) En((e) => ({
3338
3338
  ...e,
3339
3339
  error: n?.message,
3340
3340
  isLoading: !1,
3341
3341
  currentValue: ""
3342
3342
  }));
3343
3343
  else {
3344
- let e = ve(Array.isArray(r) ? r : [], c, l), n = rt(e);
3345
- Tn((e) => ({
3344
+ let e = ve(Array.isArray(r) ? r : [], c, l), n = at(e);
3345
+ En((e) => ({
3346
3346
  data: [...e.data, {
3347
3347
  key: p,
3348
3348
  data: n
@@ -3350,81 +3350,81 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3350
3350
  error: "",
3351
3351
  isLoading: !1,
3352
3352
  currentValue: ""
3353
- })), J((e) => ({
3353
+ })), q((e) => ({
3354
3354
  ...e,
3355
3355
  pivotTableSettings2: {
3356
- ...q?.pivotTableSettings2,
3357
- dimensions: de(f, t?.companyIntegration?.name || ""),
3358
- headers: de(d, t?.companyIntegration?.name || "")
3356
+ ...K?.pivotTableSettings2,
3357
+ dimensions: le(f, t?.companyIntegration?.name || ""),
3358
+ headers: le(d, t?.companyIntegration?.name || "")
3359
3359
  }
3360
3360
  }));
3361
3361
  }
3362
3362
  } });
3363
- }, $r = P(async (e, n) => {
3363
+ }, $r = M(async (e, n) => {
3364
3364
  p("drill-level-click-handler-start", {
3365
3365
  metricId: t?.id,
3366
3366
  metricName: t?.name,
3367
3367
  clickedLevelIndex: e,
3368
3368
  isReset: !!n,
3369
- drillConfig: b(U?.configV2)
3370
- }), n && nn([]), bt(null), await qr(U?.configV2, void 0, e, n), p("drill-level-click-handler-complete", {
3369
+ drillConfig: S(H?.configV2)
3370
+ }), n && rn([]), St(null), await qr(H?.configV2, void 0, e, n), p("drill-level-click-handler-complete", {
3371
3371
  metricId: t?.id,
3372
3372
  metricName: t?.name,
3373
3373
  clickedLevelIndex: e,
3374
3374
  isReset: !!n
3375
3375
  });
3376
3376
  }, [
3377
- U?.configV2,
3377
+ H?.configV2,
3378
3378
  t?.id,
3379
3379
  t?.name,
3380
- nn
3381
- ]), ei = P((e) => {
3382
- if (e) It((e) => [...e?.filter((e) => e.group !== `${z}`)]), Ft((e) => e - 1);
3380
+ rn
3381
+ ]), ei = M((e) => {
3382
+ if (e) Lt((e) => [...e?.filter((e) => e.group !== `${R}`)]), It((e) => e - 1);
3383
3383
  else {
3384
- let e = B.filter((e) => !e?.group)?.map((e) => ({
3384
+ let e = z.filter((e) => !e?.group)?.map((e) => ({
3385
3385
  ...e,
3386
- name: `${e?.name}_${z + 1}`,
3387
- group: `${z + 1}`,
3386
+ name: `${e?.name}_${R + 1}`,
3387
+ group: `${R + 1}`,
3388
3388
  dependOn: e.dependOn ? {
3389
- value: `${e.dependOn?.value}_${z + 1}`,
3390
- label: `${e.dependOn?.label}_${z + 1}`,
3389
+ value: `${e.dependOn?.value}_${R + 1}`,
3390
+ label: `${e.dependOn?.label}_${R + 1}`,
3391
3391
  customColumnName: e.dependOn?.customColumnName
3392
3392
  } : void 0,
3393
3393
  dependOns: e?.dependOns?.map((e) => ({
3394
- value: `${e?.value}_${z + 1}`,
3395
- label: `${e?.label}_${z + 1}`,
3394
+ value: `${e?.value}_${R + 1}`,
3395
+ label: `${e?.label}_${R + 1}`,
3396
3396
  customColumnName: e?.customColumnName
3397
3397
  })) || []
3398
3398
  }));
3399
- e.length && (It((t) => [...t, ...e]), Ft((e) => e + 1));
3399
+ e.length && (Lt((t) => [...t, ...e]), It((e) => e + 1));
3400
3400
  }
3401
- }, [B]), ti = P(async () => {
3402
- Kt.report ? qt((e) => ({
3401
+ }, [z]), ti = M(async () => {
3402
+ qt.report ? Jt((e) => ({
3403
3403
  ...e,
3404
3404
  isOpen: !0
3405
- })) : (qt({
3405
+ })) : (Jt({
3406
3406
  report: "",
3407
3407
  isLoading: !0,
3408
3408
  isOpen: !0
3409
- }), await ur({
3409
+ }), await dr({
3410
3410
  data: {
3411
- data: Q,
3412
- wId: T
3411
+ data: Z,
3412
+ wId: D
3413
3413
  },
3414
- clientId: g ? v || "" : a,
3415
- token: _ || "",
3416
- isFrontendApp: g
3414
+ clientId: _ ? y || "" : a,
3415
+ token: v || "",
3416
+ isFrontendApp: _
3417
3417
  }, {
3418
3418
  onSuccess(e) {
3419
3419
  let t = e?.content;
3420
- qt((e) => ({
3420
+ Jt((e) => ({
3421
3421
  ...e,
3422
3422
  report: t || "",
3423
3423
  isLoading: !1
3424
3424
  }));
3425
3425
  },
3426
3426
  onError() {
3427
- qt((e) => ({
3427
+ Jt((e) => ({
3428
3428
  ...e,
3429
3429
  report: "",
3430
3430
  isLoading: !1
@@ -3432,74 +3432,74 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3432
3432
  }
3433
3433
  }));
3434
3434
  }, [
3435
- Q,
3435
+ Z,
3436
3436
  a,
3437
- g,
3438
3437
  _,
3439
3438
  v,
3439
+ y,
3440
3440
  a,
3441
- Kt
3442
- ]), ni = I(() => {
3443
- let e = t?.datasetMetricSettings?.newDatasetSettings, n = e?.configuration, r = le(Q || []), i = r, a = e?.selectedDims?.some((e) => Me(e?.datatype)) || Je(Q?.[0] || ""), o = e?.selectedDims?.length > 1 && e?.selectedMetrics?.length > 0, s = [
3444
- O.pivot,
3445
- O.pivotV2,
3446
- O.pivotV3,
3447
- O.timeSeries,
3448
- O.treeMap,
3449
- O.indianMap,
3450
- O.geoBarMap,
3451
- O.geoMap,
3452
- O.geoScatterMap,
3453
- O.worldMap
3441
+ qt
3442
+ ]), ni = P(() => {
3443
+ let e = t?.datasetMetricSettings?.newDatasetSettings, n = e?.configuration, r = ce(Z || []), i = r, a = e?.selectedDims?.some((e) => Ie(e?.datatype)) || Xe(Z?.[0] || ""), o = e?.selectedDims?.length > 1 && e?.selectedMetrics?.length > 0, s = [
3444
+ A.pivot,
3445
+ A.pivotV2,
3446
+ A.pivotV3,
3447
+ A.timeSeries,
3448
+ A.treeMap,
3449
+ A.indianMap,
3450
+ A.geoBarMap,
3451
+ A.geoMap,
3452
+ A.geoScatterMap,
3453
+ A.worldMap
3454
3454
  ], c = !!n?.aggregates?.length && !!n?.dimensions?.length;
3455
- return c && a && (i = [...r?.filter((e) => !s?.includes(e)), ...s]), c && !a && (i = [...r?.filter((e) => !s?.includes(e)), ...s?.filter((e) => e !== O.timeSeries)]), !c && a && (i = [...r?.filter((e) => !s?.includes(e)), O.timeSeries]), !c && !a && (i = r?.filter((e) => !s?.includes(e))), U?.isEnableGroupBy && U?.configV2 && (i = i?.filter((e) => ce?.includes(e))), o || (i = i?.filter((e) => e !== O.bubbleV2)), i;
3455
+ return c && a && (i = [...r?.filter((e) => !s?.includes(e)), ...s]), c && !a && (i = [...r?.filter((e) => !s?.includes(e)), ...s?.filter((e) => e !== A.timeSeries)]), !c && a && (i = [...r?.filter((e) => !s?.includes(e)), A.timeSeries]), !c && !a && (i = r?.filter((e) => !s?.includes(e))), H?.isEnableGroupBy && H?.configV2 && (i = i?.filter((e) => be?.includes(e))), o || (i = i?.filter((e) => e !== A.bubbleV2)), i;
3456
3456
  }, [
3457
- Q,
3458
- q?.xAxis,
3459
- U?.isEnableGroupBy,
3460
- U?.configV2,
3457
+ Z,
3458
+ K?.xAxis,
3459
+ H?.isEnableGroupBy,
3460
+ H?.configV2,
3461
3461
  t?.datasetMetricSettings?.newDatasetSettings?.configuration?.aggregates,
3462
3462
  t?.datasetMetricSettings?.newDatasetSettings?.configuration?.dimensions
3463
3463
  ]), ri = (e) => {
3464
- let n = t?.datasetMetricSettings?.newDatasetSettings, r = n?.configuration, i = n?.selectedDims || [], a = n?.selectedMetrics || [], o = t?.companyIntegration?.name, s = q?.enduserMeasureAndDimensions?.isEnabled;
3465
- Ye({
3466
- chartAggregateColumns: Ae(de(a?.filter((e) => e.configType === "AGGREGATE" && s ? q?.enduserMeasureAndDimensions?.measures?.some((t) => t.value === e.alias) : !0) || [], o), Q || []),
3467
- chartDimensions: Ae(de(i?.filter((e) => !s || q?.enduserMeasureAndDimensions?.dimensions?.some((t) => t.value === e.alias)) || [], o), Q || []),
3468
- chartMetrics: Ae(de(a?.filter((e) => !s || q?.enduserMeasureAndDimensions?.measures?.some((t) => t.value === e.alias)) || [], o), Q || []),
3469
- chartSettings: q,
3470
- chartTimeColumns: de(i?.filter((e) => Me(e.datatype)), o),
3464
+ let n = t?.datasetMetricSettings?.newDatasetSettings, r = n?.configuration, i = n?.selectedDims || [], a = n?.selectedMetrics || [], o = t?.companyIntegration?.name, s = K?.enduserMeasureAndDimensions?.isEnabled;
3465
+ Ze({
3466
+ chartAggregateColumns: Ne(le(a?.filter((e) => e.configType === "AGGREGATE" && s ? K?.enduserMeasureAndDimensions?.measures?.some((t) => t.value === e.alias) : !0) || [], o), Z || []),
3467
+ chartDimensions: Ne(le(i?.filter((e) => !s || K?.enduserMeasureAndDimensions?.dimensions?.some((t) => t.value === e.alias)) || [], o), Z || []),
3468
+ chartMetrics: Ne(le(a?.filter((e) => !s || K?.enduserMeasureAndDimensions?.measures?.some((t) => t.value === e.alias)) || [], o), Z || []),
3469
+ chartSettings: K,
3470
+ chartTimeColumns: le(i?.filter((e) => Ie(e.datatype)), o),
3471
3471
  chartType: e,
3472
3472
  configAggregates: r?.aggregates,
3473
3473
  configuration: n?.configuration,
3474
3474
  dbName: o,
3475
3475
  pivotHeaderColumns: [],
3476
- resultData: Q || [],
3477
- setChartSettings: J
3476
+ resultData: Z || [],
3477
+ setChartSettings: q
3478
3478
  });
3479
- }, ci = I(() => Se(B.filter((e) => e.group && e.isAddOnMetrics && !e.isHiddenInUi && !e.isAppFilter), "group"), [B]), li = I(() => q?.customSettings?.comparisonValueShow && q?.chartType === O.singleValue ? n?.filters?.find((e) => e?.as === "date") : void 0, [
3480
- q?.customSettings?.comparisonValueShow,
3481
- q?.chartType,
3479
+ }, ci = P(() => Ee(z.filter((e) => e.group && e.isAddOnMetrics && !e.isHiddenInUi && !e.isAppFilter), "group"), [z]), li = P(() => K?.customSettings?.comparisonValueShow && K?.chartType === A.singleValue ? n?.filters?.find((e) => e?.as === "date") : void 0, [
3480
+ K?.customSettings?.comparisonValueShow,
3481
+ K?.chartType,
3482
3482
  n?.filters?.find((e) => e?.as === "date")
3483
3483
  ]);
3484
- F(() => {
3485
- Q?.length && an.length ? cn(!0) : cn(!1);
3484
+ N(() => {
3485
+ Z?.length && on.length ? ln(!0) : ln(!1);
3486
3486
  }, [
3487
- Q,
3488
- an.length,
3487
+ Z,
3488
+ on.length,
3489
3489
  t?.integrationName,
3490
3490
  t?.query
3491
3491
  ]);
3492
- let di = I(() => t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics?.some((e) => e.configType === "AGGREGATE") && t?.datasetMetricSettings?.newDatasetSettings?.selectedDims?.map((e) => ({
3492
+ let di = P(() => t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics?.some((e) => e.configType === "AGGREGATE") && t?.datasetMetricSettings?.newDatasetSettings?.selectedDims?.map((e) => ({
3493
3493
  value: e.alias,
3494
3494
  label: e.alias
3495
- })) || [], [t?.datasetMetricSettings?.newDatasetSettings]), fi = I(() => t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics?.map((e) => ({
3495
+ })) || [], [t?.datasetMetricSettings?.newDatasetSettings]), fi = P(() => t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics?.map((e) => ({
3496
3496
  value: e?.alias || e?.name,
3497
3497
  label: e?.alias || e?.name
3498
- })) || [], [t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics]), pi = Ei(), { metricFilters: mi, leftPositionedMetricFilters: gi, rightPositionedMetricFilters: _i } = I(() => {
3499
- let r = gt({
3500
- rlsConditions: B,
3501
- isFrontendApp: g
3502
- }), i = at({
3498
+ })) || [], [t?.datasetMetricSettings?.newDatasetSettings?.selectedMetrics]), pi = Ei(), { metricFilters: mi, leftPositionedMetricFilters: gi, rightPositionedMetricFilters: _i } = P(() => {
3499
+ let r = vt({
3500
+ rlsConditions: z,
3501
+ isFrontendApp: _
3502
+ }), i = st({
3503
3503
  metric: {
3504
3504
  clientId: t?.clientId,
3505
3505
  isCreatedByClient: t?.isCreatedByClient
@@ -3507,14 +3507,14 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3507
3507
  dashboard: { createdBy: e },
3508
3508
  principal: {
3509
3509
  clientId: a,
3510
- isAllClient: h
3510
+ isAllClient: g
3511
3511
  },
3512
3512
  tenancyLevel: o,
3513
3513
  rlsConditions: r,
3514
- clientColumnType: ge,
3515
- dataMartTables: it
3514
+ clientColumnType: de,
3515
+ dataMartTables: ot
3516
3516
  }).rls, s = i.filter((e) => e.isAddOnMetrics);
3517
- et && (s = s.filter((e) => ae(e, !0)));
3517
+ nt && (s = s.filter((e) => re(e, !0)));
3518
3518
  let c = [], l = [];
3519
3519
  return s = Di(s, pi, n?.filters), s.forEach((e) => {
3520
3520
  e.position === "top-right" ? l.push(e) : c.push(e);
@@ -3524,70 +3524,70 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3524
3524
  rightPositionedMetricFilters: l
3525
3525
  };
3526
3526
  }, [
3527
- B,
3528
- g,
3529
- et,
3527
+ z,
3528
+ _,
3529
+ nt,
3530
3530
  t?.isCreatedByClient,
3531
3531
  t?.clientId,
3532
3532
  e,
3533
3533
  o,
3534
3534
  a,
3535
- h,
3536
- ge,
3537
- it,
3535
+ g,
3536
+ de,
3537
+ ot,
3538
3538
  pi,
3539
3539
  n?.filters
3540
3540
  ]), yi = [
3541
- O.pie,
3542
- O.doughnut,
3543
- O.rose,
3544
- O.funnel,
3545
- O.singleValue,
3546
- O.table,
3547
- O.pivot,
3548
- O.horizontalStackTable,
3549
- O.geoBarMap,
3550
- O.geoMap,
3551
- O.geoScatterMap,
3552
- O.sankey,
3553
- O.timeSeries,
3554
- O.geoBarMap,
3555
- O.geoMap,
3556
- O.geoScatterMap,
3557
- O.worldMap,
3558
- O.boxplot,
3559
- O.timeSeries,
3560
- O.gantt
3561
- ].includes(q?.chartType) || (q?.isMultiDimension || q?.isDynamicSeries) && q?.seriesField !== "ungrouped", xi = P((e) => {
3541
+ A.pie,
3542
+ A.doughnut,
3543
+ A.rose,
3544
+ A.funnel,
3545
+ A.singleValue,
3546
+ A.table,
3547
+ A.pivot,
3548
+ A.horizontalStackTable,
3549
+ A.geoBarMap,
3550
+ A.geoMap,
3551
+ A.geoScatterMap,
3552
+ A.sankey,
3553
+ A.timeSeries,
3554
+ A.geoBarMap,
3555
+ A.geoMap,
3556
+ A.geoScatterMap,
3557
+ A.worldMap,
3558
+ A.boxplot,
3559
+ A.timeSeries,
3560
+ A.gantt
3561
+ ].includes(K?.chartType) || (K?.isMultiDimension || K?.isDynamicSeries) && K?.seriesField !== "ungrouped", xi = M((e) => {
3562
3562
  let n = t?.dataSecuritySettings?.csvColumns || [];
3563
3563
  return e?.length ? e?.map((e) => {
3564
3564
  let t = {};
3565
3565
  for (let r in e) n?.includes(r) || (t[r] = e[r]);
3566
3566
  return t;
3567
3567
  }) : [];
3568
- }, [t?.dataSecuritySettings]), Ci = I(() => xi(Q), [Q, xi]);
3569
- F(() => {
3570
- q || (J(t?.chartOptions), Mt({
3568
+ }, [t?.dataSecuritySettings]), Ci = P(() => xi(Z), [Z, xi]);
3569
+ N(() => {
3570
+ K || (q(t?.chartOptions), Nt({
3571
3571
  limit: parseInt(t?.chartOptions?.tableSettings?.defaultRowSize || "100", 10),
3572
3572
  offset: 0
3573
3573
  }));
3574
- }, [t?.chartOptions, q]), F(() => {
3575
- q?.tableSettings?.isServerSidePagination && q?.chartType === O.table && Mt({
3576
- limit: parseInt(q?.tableSettings?.defaultRowSize || "100", 10),
3574
+ }, [t?.chartOptions, K]), N(() => {
3575
+ K?.tableSettings?.isServerSidePagination && K?.chartType === A.table && Nt({
3576
+ limit: parseInt(K?.tableSettings?.defaultRowSize || "100", 10),
3577
3577
  offset: 0
3578
3578
  });
3579
3579
  }, [
3580
- q?.tableSettings?.isServerSidePagination,
3581
- q?.chartType,
3582
- q?.tableSettings?.defaultRowSize
3580
+ K?.tableSettings?.isServerSidePagination,
3581
+ K?.chartType,
3582
+ K?.tableSettings?.defaultRowSize
3583
3583
  ]);
3584
- let Ti = L(n);
3585
- Ti.current = n, F(() => {
3586
- if (q?.chartType === O.timeSeries && q?.timeSeriesSettings?.groupBySettings?.isGlobalFilter && Mr) {
3587
- let e = Ti.current?.filters?.find((e) => e.label === q?.timeSeriesSettings?.groupBySettings?.globalFilterOption?.value)?.value;
3584
+ let Ti = F(n);
3585
+ Ti.current = n, N(() => {
3586
+ if (K?.chartType === A.timeSeries && K?.timeSeriesSettings?.groupBySettings?.isGlobalFilter && Nr) {
3587
+ let e = Ti.current?.filters?.find((e) => e.label === K?.timeSeriesSettings?.groupBySettings?.globalFilterOption?.value)?.value;
3588
3588
  if ((typeof e == "string" || typeof e == "object" && e?.value) && e) {
3589
- let t = typeof e == "string" ? Ie(e)?.toLowerCase() : q?.timeSeriesSettings?.groupBySettings?.formatWithValue?.find((t) => t.value === Ie(e?.value))?.format?.toLowerCase() || "";
3590
- st?.find((e) => e?.value?.toLowerCase() === t) && J((e) => ({
3589
+ let t = typeof e == "string" ? Ve(e)?.toLowerCase() : K?.timeSeriesSettings?.groupBySettings?.formatWithValue?.find((t) => t.value === Ve(e?.value))?.format?.toLowerCase() || "";
3590
+ lt?.find((e) => e?.value?.toLowerCase() === t) && q((e) => ({
3591
3591
  ...e,
3592
3592
  timeSeriesSettings: {
3593
3593
  ...e?.timeSeriesSettings,
@@ -3596,109 +3596,109 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3596
3596
  value: t
3597
3597
  }
3598
3598
  },
3599
- xAxis: Y ? e.xAxis : `${t} of ${Mr}`
3599
+ xAxis: J ? e.xAxis : `${t} of ${Nr}`
3600
3600
  }));
3601
3601
  }
3602
3602
  }
3603
3603
  }, [
3604
- xr,
3605
- q?.chartType,
3606
- q?.timeSeriesSettings?.groupBySettings?.isGlobalFilter,
3607
- q?.timeSeriesSettings?.groupBySettings?.globalFilterOption,
3608
- Mr
3609
- ]), F(() => {
3610
- q?.isDynamicSeries && (q?.seriesOptions?.includes("ungrouped") ? q?.ungroupedAlias ? bn(q?.seriesOptions?.map((e) => e === "ungrouped" ? {
3604
+ Sr,
3605
+ K?.chartType,
3606
+ K?.timeSeriesSettings?.groupBySettings?.isGlobalFilter,
3607
+ K?.timeSeriesSettings?.groupBySettings?.globalFilterOption,
3608
+ Nr
3609
+ ]), N(() => {
3610
+ K?.isDynamicSeries && (K?.seriesOptions?.includes("ungrouped") ? K?.ungroupedAlias ? xn(K?.seriesOptions?.map((e) => e === "ungrouped" ? {
3611
3611
  value: e,
3612
- label: q?.ungroupedAlias
3612
+ label: K?.ungroupedAlias
3613
3613
  } : {
3614
3614
  value: e,
3615
3615
  label: e
3616
- })) : bn(q?.seriesOptions?.map((e) => ({
3616
+ })) : xn(K?.seriesOptions?.map((e) => ({
3617
3617
  value: e,
3618
3618
  label: e
3619
- }))) : bn([...q?.seriesOptions?.map((e) => ({
3619
+ }))) : xn([...K?.seriesOptions?.map((e) => ({
3620
3620
  value: e,
3621
3621
  label: e
3622
3622
  })) ?? []]));
3623
3623
  }, [
3624
- q?.seriesOptions,
3625
- q?.isDynamicSeries,
3626
- q?.ungroupedAlias
3624
+ K?.seriesOptions,
3625
+ K?.isDynamicSeries,
3626
+ K?.ungroupedAlias
3627
3627
  ]);
3628
- let [Oi, Ri] = R(!1), zi = (e) => {
3628
+ let [Oi, Ri] = I(!1), zi = (e) => {
3629
3629
  e.key === "Control" && Ri(!0);
3630
3630
  }, Bi = (e) => {
3631
3631
  e.key === "Control" && Ri(!1);
3632
3632
  };
3633
- F(() => {
3634
- Q?.length && Gt(Object.keys(Q?.[0] || {}));
3635
- }, [Q?.length]), F(() => (q?.customSettings?.chartZoom?.isZoomEnabled && (window.addEventListener("keydown", zi), window.addEventListener("keyup", Bi)), () => {
3633
+ N(() => {
3634
+ Z?.length && Kt(Object.keys(Z?.[0] || {}));
3635
+ }, [Z?.length]), N(() => (K?.customSettings?.chartZoom?.isZoomEnabled && (window.addEventListener("keydown", zi), window.addEventListener("keyup", Bi)), () => {
3636
3636
  window.removeEventListener("keydown", zi), window.removeEventListener("keyup", Bi);
3637
3637
  }), []);
3638
- let Vi = I(() => {
3638
+ let Vi = P(() => {
3639
3639
  let e = !1;
3640
- if (Q?.length) {
3641
- let t = q?.singleValue;
3642
- e = Q[0][t] === null && q?.chartType === O.singleValue;
3640
+ if (Z?.length) {
3641
+ let t = K?.singleValue;
3642
+ e = Z[0][t] === null && K?.chartType === A.singleValue;
3643
3643
  }
3644
3644
  return e;
3645
3645
  }, [
3646
- Q?.length,
3647
- q?.singleValue,
3648
- q?.chartType === O.singleValue
3649
- ]), Hi = I(() => $e({
3650
- chartOptions: q,
3651
- data: Q || []
3646
+ Z?.length,
3647
+ K?.singleValue,
3648
+ K?.chartType === A.singleValue
3649
+ ]), Hi = P(() => tt({
3650
+ chartOptions: K,
3651
+ data: Z || []
3652
3652
  }), [
3653
- Q,
3654
- q?.xAxis,
3655
- q?.yAxisList,
3656
- q?.dynamicXAxis?.isEnabled,
3657
- q?.chartType,
3658
- q?.seriesField,
3659
- q?.customSettings?.cumulativeBar,
3660
- q?.isGroupXAxis,
3661
- q?.timeSeriesSettings?.seriesType[0],
3662
- q?.timeSeriesSettings?.groupBySettings?.fillXAxis
3663
- ]), Gi = I(() => se({
3664
- text: ke(t?.name || "", hn) || "",
3665
- selectedLanguage: j,
3666
- translationDictionary: M
3653
+ Z,
3654
+ K?.xAxis,
3655
+ K?.yAxisList,
3656
+ K?.dynamicXAxis?.isEnabled,
3657
+ K?.chartType,
3658
+ K?.seriesField,
3659
+ K?.customSettings?.cumulativeBar,
3660
+ K?.isGroupXAxis,
3661
+ K?.timeSeriesSettings?.seriesType[0],
3662
+ K?.timeSeriesSettings?.groupBySettings?.fillXAxis
3663
+ ]), Gi = P(() => oe({
3664
+ text: Me(t?.name || "", gn) || "",
3665
+ selectedLanguage: Ce,
3666
+ translationDictionary: Te
3667
3667
  }), [
3668
3668
  t?.name,
3669
- hn,
3670
- M,
3671
- j
3672
- ]), Ki = I(() => se({
3673
- text: ke(t?.longDescription || "", hn) || "",
3674
- selectedLanguage: j,
3675
- translationDictionary: M
3669
+ gn,
3670
+ Te,
3671
+ Ce
3672
+ ]), Ki = P(() => oe({
3673
+ text: Me(t?.longDescription || "", gn) || "",
3674
+ selectedLanguage: Ce,
3675
+ translationDictionary: Te
3676
3676
  }), [
3677
3677
  t?.longDescription,
3678
- hn,
3679
- j,
3680
- M
3681
- ]), qi = I(() => se({
3682
- text: ke(t?.description || "", hn) || "",
3683
- selectedLanguage: j,
3684
- translationDictionary: M
3678
+ gn,
3679
+ Ce,
3680
+ Te
3681
+ ]), qi = P(() => oe({
3682
+ text: Me(t?.description || "", gn) || "",
3683
+ selectedLanguage: Ce,
3684
+ translationDictionary: Te
3685
3685
  }), [
3686
3686
  t?.description,
3687
- hn,
3688
- j,
3689
- M
3690
- ]), Ji = I(() => se({
3691
- text: ke(t?.footNote || "", hn) || "",
3692
- selectedLanguage: j,
3693
- translationDictionary: M
3687
+ gn,
3688
+ Ce,
3689
+ Te
3690
+ ]), Ji = P(() => oe({
3691
+ text: Me(t?.footNote || "", gn) || "",
3692
+ selectedLanguage: Ce,
3693
+ translationDictionary: Te
3694
3694
  }), [
3695
3695
  t?.footNote,
3696
- hn,
3697
- j,
3698
- M
3699
- ]), Yi = I(() => `${Q?.[0]?.dbn_metric_expression_data || "No Data Found"}`, [Q]), Xi = I(() => t?.rlsConditions?.map((e) => {
3696
+ gn,
3697
+ Ce,
3698
+ Te
3699
+ ]), Yi = P(() => `${Z?.[0]?.dbn_metric_expression_data || "No Data Found"}`, [Z]), Xi = P(() => t?.rlsConditions?.map((e) => {
3700
3700
  if (e?.datatype === "date" && e?.options?.find((e) => e.range === "Custom Date") && e?.isEnableDynamicDate && e?.dynamicDate?.value) {
3701
- let t = he(ze?.find((t) => t.value === e?.dynamicDate?.value)?.count || 0), n = Ge(t), r = Ge(t);
3701
+ let t = he(Je?.find((t) => t.value === e?.dynamicDate?.value)?.count || 0), n = Ke(t), r = Ke(t);
3702
3702
  return {
3703
3703
  ...e,
3704
3704
  options: e?.options?.map((e) => e.range === "Custom Date" ? {
@@ -3711,9 +3711,9 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3711
3711
  }
3712
3712
  return e;
3713
3713
  }), [t?.rlsConditions]);
3714
- ft(() => {
3715
- if (Gn && D?.((e) => {
3716
- if (Ai(e?.get(t?.id), Bn)) return e;
3714
+ mt(() => {
3715
+ if (Kn && ie?.((e) => {
3716
+ if (Ai(e?.get(t?.id), Vn)) return e;
3717
3717
  let n = new Map(e);
3718
3718
  return n.set(t?.id, {
3719
3719
  data: {
@@ -3721,18 +3721,18 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3721
3721
  name: "",
3722
3722
  description: ""
3723
3723
  },
3724
- isLoading: Gn,
3725
- key: Bn
3724
+ isLoading: Kn,
3725
+ key: Vn
3726
3726
  }), n;
3727
- }), Z?.data && E) {
3728
- let e = da(t?.id, ue) ? Z?.data : void 0;
3729
- D?.((n) => {
3727
+ }), X?.data && O) {
3728
+ let e = da(t?.id, se) ? X?.data : void 0;
3729
+ ie?.((n) => {
3730
3730
  if (Fi(n?.get(t?.id), {
3731
3731
  data: e,
3732
3732
  name: t?.name || "",
3733
3733
  description: t?.description || "",
3734
- isLoading: Gn,
3735
- key: Bn
3734
+ isLoading: Kn,
3735
+ key: Vn
3736
3736
  })) return n;
3737
3737
  let r = new Map(n);
3738
3738
  return r.set(t?.id, {
@@ -3741,16 +3741,16 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3741
3741
  name: t?.name || "",
3742
3742
  description: t?.description || ""
3743
3743
  },
3744
- isLoading: Gn,
3745
- key: Bn
3744
+ isLoading: Kn,
3745
+ key: Vn
3746
3746
  }), r;
3747
3747
  });
3748
3748
  }
3749
- if (!Gn && ar) {
3749
+ if (!Kn && or) {
3750
3750
  let e = Ii(t);
3751
- D?.((n) => {
3751
+ ie?.((n) => {
3752
3752
  let r = n?.get(t?.id);
3753
- if (r && !r.isLoading && !!r.error === e && r.key === Bn) return n;
3753
+ if (r && !r.isLoading && !!r.error === e && r.key === Vn) return n;
3754
3754
  let i = new Map(n);
3755
3755
  return i.set(t?.id, {
3756
3756
  data: r?.data ?? {
@@ -3759,23 +3759,23 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3759
3759
  description: ""
3760
3760
  },
3761
3761
  isLoading: !1,
3762
- key: Bn,
3762
+ key: Vn,
3763
3763
  ...e ? { error: "failed" } : {}
3764
3764
  }), i;
3765
3765
  });
3766
3766
  }
3767
3767
  }, [
3768
- Z?.data,
3769
- Gn,
3770
- Bn,
3771
- ar
3768
+ X?.data,
3769
+ Kn,
3770
+ Vn,
3771
+ or
3772
3772
  ]);
3773
- let Zi = L(t?.id);
3773
+ let Zi = F(t?.id);
3774
3774
  Zi.current = t?.id;
3775
- let Qi = L(E);
3776
- Qi.current = E;
3777
- let $i = L(D);
3778
- $i.current = D, F(() => () => {
3775
+ let Qi = F(O);
3776
+ Qi.current = O;
3777
+ let $i = F(ie);
3778
+ $i.current = ie, N(() => () => {
3779
3779
  let e = Zi.current, t = Qi.current, n = $i.current;
3780
3780
  e && t && n && t.get(e)?.data?.data && n((t) => {
3781
3781
  let n = t.get(e);
@@ -3790,30 +3790,30 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3790
3790
  }), r;
3791
3791
  });
3792
3792
  }, []);
3793
- let aa = !!t?.elementSettings?.summary?.metricList?.length, [ua, fa] = R(0);
3794
- F(() => {
3795
- let e = E?.subscribe;
3793
+ let aa = !!t?.elementSettings?.summary?.metricList?.length, [ua, fa] = I(0);
3794
+ N(() => {
3795
+ let e = O?.subscribe;
3796
3796
  if (aa && typeof e == "function") return e(() => fa((e) => e + 1));
3797
- }, [E, aa]), ft(() => {
3798
- kt.current !== Vn && (kt.current = Vn, wt());
3799
- }, [Vn, wt]);
3800
- let pa = () => !!t?.elementSettings?.summary?.metricList?.some((e) => E?.get(e.value)?.isLoading === !0);
3801
- ft(() => {
3797
+ }, [O, aa]), mt(() => {
3798
+ jt.current !== Hn && (jt.current = Hn, Et());
3799
+ }, [Hn, Et]);
3800
+ let pa = () => !!t?.elementSettings?.summary?.metricList?.some((e) => O?.get(e.value)?.isLoading === !0);
3801
+ mt(() => {
3802
3802
  let e = t?.elementSettings?.summary;
3803
- if (!e?.metricList?.length || !E?.get(t?.id)) return;
3804
- let n = e.metricList.map((e) => E.get(e.value));
3803
+ if (!e?.metricList?.length || !O?.get(t?.id)) return;
3804
+ let n = e.metricList.map((e) => O.get(e.value));
3805
3805
  if (n.some((e) => e?.isLoading)) return;
3806
3806
  let r = JSON.stringify({
3807
3807
  keys: n.map((e) => [e?.key, !!e?.data?.data?.length]),
3808
3808
  prompt: e.summaryPrompt,
3809
3809
  id: t?.id,
3810
- identity: Vn
3810
+ identity: Hn
3811
3811
  }), i = n.map((e) => ({
3812
3812
  data: e?.data?.data || [],
3813
3813
  metricName: e?.data?.name,
3814
3814
  metricDescription: e?.data?.description
3815
3815
  })), o = i.every((e) => e.data.length > 0);
3816
- St(r, o ? (r) => vt.mutateAsync({
3816
+ wt(r, o ? (r) => bt.mutateAsync({
3817
3817
  signal: r,
3818
3818
  data: {
3819
3819
  metricData: i,
@@ -3822,43 +3822,43 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3822
3822
  filters: n.map((e) => e?.key).join("###"),
3823
3823
  name: t?.name,
3824
3824
  description: t?.description,
3825
- workspaceId: T
3825
+ workspaceId: D
3826
3826
  },
3827
- token: _ || "",
3828
- clientId: g ? v || "" : a,
3829
- isFrontendApp: g
3827
+ token: v || "",
3828
+ clientId: _ ? y || "" : a,
3829
+ isFrontendApp: _
3830
3830
  }) : void 0);
3831
3831
  }, [
3832
3832
  t?.elementSettings,
3833
3833
  t?.id,
3834
3834
  t?.name,
3835
3835
  t?.description,
3836
- E,
3836
+ O,
3837
3837
  ua,
3838
- Vn,
3839
- St,
3840
- vt,
3841
- T,
3842
- _,
3843
- g,
3838
+ Hn,
3839
+ wt,
3840
+ bt,
3841
+ D,
3844
3842
  v,
3843
+ _,
3844
+ y,
3845
3845
  a
3846
- ]), F(() => {
3847
- let e = tt(q?.customSettings?.comboAxisSettings || []), t = e?.flatMap((e) => e?.measures), n = q?.yAxisList?.every((e) => t?.includes(e));
3848
- if (q?.yAxisList?.length && q?.yAxisList?.length !== t?.length && !t?.length && [
3849
- O.combo,
3850
- O.timeSeries,
3851
- O.horizontalCombo
3852
- ].includes(q?.chartType || "")) {
3853
- let e = q?.yAxisList?.filter((e) => !q?.comboBarList?.includes(e))?.filter((e) => !t?.includes(e)), n = q?.customSettings?.comboStackAxisSymbols?.name || "", r = q?.customSettings?.comboLabelFormatter?.find((e) => e.axis === (n || "stack"))?.formatter, i = q?.comboBarList?.join(" and "), a = q?.customSettings?.comboLabelFormatter?.find((e) => e.axis === i)?.formatter;
3854
- J((t) => ({
3846
+ ]), N(() => {
3847
+ let e = rt(K?.customSettings?.comboAxisSettings || []), t = e?.flatMap((e) => e?.measures), n = K?.yAxisList?.every((e) => t?.includes(e));
3848
+ if (K?.yAxisList?.length && K?.yAxisList?.length !== t?.length && !t?.length && [
3849
+ A.combo,
3850
+ A.timeSeries,
3851
+ A.horizontalCombo
3852
+ ].includes(K?.chartType || "")) {
3853
+ let e = K?.yAxisList?.filter((e) => !K?.comboBarList?.includes(e))?.filter((e) => !t?.includes(e)), n = K?.customSettings?.comboStackAxisSymbols?.name || "", r = K?.customSettings?.comboLabelFormatter?.find((e) => e.axis === (n || "stack"))?.formatter, i = K?.comboBarList?.join(" and "), a = K?.customSettings?.comboLabelFormatter?.find((e) => e.axis === i)?.formatter;
3854
+ q((t) => ({
3855
3855
  ...t,
3856
3856
  customSettings: {
3857
3857
  ...t.customSettings,
3858
- comboAxisSettings: tt([
3858
+ comboAxisSettings: rt([
3859
3859
  ...t.customSettings?.comboAxisSettings || [],
3860
3860
  ...e?.map((e) => {
3861
- let t = q?.customSettings?.comboLabelFormatter?.find((t) => t.axis === e)?.formatter, n = q?.customSettings?.comboAxisSymbols?.find((t) => t.name === e);
3861
+ let t = K?.customSettings?.comboLabelFormatter?.find((t) => t.axis === e)?.formatter, n = K?.customSettings?.comboAxisSymbols?.find((t) => t.name === e);
3862
3862
  return {
3863
3863
  axis: e,
3864
3864
  measures: [e],
@@ -3866,36 +3866,36 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3866
3866
  axis: e,
3867
3867
  type: "line"
3868
3868
  }],
3869
- numberFormatter: q?.customSettings?.numberFormatter,
3869
+ numberFormatter: K?.customSettings?.numberFormatter,
3870
3870
  labelFormatter: t,
3871
3871
  prefix: n?.prefix || "",
3872
3872
  suffix: n?.suffix || "",
3873
3873
  isEnableLabelFormatter: !!t?.length
3874
3874
  };
3875
3875
  }),
3876
- ...q?.comboBarList?.length && (q?.customSettings?.isCombineBarAxis || q?.customSettings?.isStackBar) ? [{
3877
- axis: q?.customSettings?.isStackBar && n || i,
3878
- measures: q?.comboBarList,
3879
- chartTypes: q?.comboBarList?.map((e) => ({
3876
+ ...K?.comboBarList?.length && (K?.customSettings?.isCombineBarAxis || K?.customSettings?.isStackBar) ? [{
3877
+ axis: K?.customSettings?.isStackBar && n || i,
3878
+ measures: K?.comboBarList,
3879
+ chartTypes: K?.comboBarList?.map((e) => ({
3880
3880
  axis: e,
3881
3881
  type: "bar"
3882
3882
  })),
3883
- isEnableStackBar: q?.customSettings?.isStackBar,
3884
- numberFormatter: q?.customSettings?.numberFormatter,
3885
- ...q?.customSettings?.isStackBar ? {
3886
- prefix: q?.customSettings?.comboStackAxisSymbols?.prefix || "",
3887
- suffix: q?.customSettings?.comboStackAxisSymbols?.suffix || "",
3883
+ isEnableStackBar: K?.customSettings?.isStackBar,
3884
+ numberFormatter: K?.customSettings?.numberFormatter,
3885
+ ...K?.customSettings?.isStackBar ? {
3886
+ prefix: K?.customSettings?.comboStackAxisSymbols?.prefix || "",
3887
+ suffix: K?.customSettings?.comboStackAxisSymbols?.suffix || "",
3888
3888
  labelFormatter: r,
3889
3889
  isEnableLabelFormatter: !!r?.length
3890
3890
  } : {
3891
- prefix: q?.customSettings?.combinedAxisPrefix || "",
3892
- suffix: q?.customSettings?.combinedAxisSuffix || "",
3891
+ prefix: K?.customSettings?.combinedAxisPrefix || "",
3892
+ suffix: K?.customSettings?.combinedAxisSuffix || "",
3893
3893
  labelFormatter: a,
3894
3894
  isEnableLabelFormatter: !!a?.length
3895
3895
  }
3896
3896
  }] : [],
3897
- ...q?.comboBarList?.length && !q?.customSettings?.isCombineBarAxis && !q?.customSettings?.isStackBar ? q?.comboBarList?.map((e) => {
3898
- let t = q?.customSettings?.comboLabelFormatter?.find((t) => t.axis === e)?.formatter, n = q?.customSettings?.comboAxisSymbols?.find((t) => t.name === e);
3897
+ ...K?.comboBarList?.length && !K?.customSettings?.isCombineBarAxis && !K?.customSettings?.isStackBar ? K?.comboBarList?.map((e) => {
3898
+ let t = K?.customSettings?.comboLabelFormatter?.find((t) => t.axis === e)?.formatter, n = K?.customSettings?.comboAxisSymbols?.find((t) => t.name === e);
3899
3899
  return {
3900
3900
  axis: e,
3901
3901
  measures: [e],
@@ -3903,7 +3903,7 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3903
3903
  axis: e,
3904
3904
  type: "bar"
3905
3905
  }],
3906
- numberFormatter: q?.customSettings?.numberFormatter,
3906
+ numberFormatter: K?.customSettings?.numberFormatter,
3907
3907
  labelFormatter: t,
3908
3908
  prefix: n?.prefix || "",
3909
3909
  suffix: n?.suffix || "",
@@ -3922,29 +3922,29 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3922
3922
  comboBarList: []
3923
3923
  }));
3924
3924
  }
3925
- if (t?.length && q?.yAxisList?.length && (q?.yAxisList?.length !== t?.length || q?.yAxisList?.length === t?.length && !n) && [
3926
- O.combo,
3927
- O.timeSeries,
3928
- O.horizontalCombo
3929
- ].includes(q?.chartType || "")) {
3930
- let e = q?.yAxisList?.filter((e) => !t?.includes(e));
3931
- (t?.filter((e) => !q?.yAxisList?.includes(e)))?.forEach((e) => {
3932
- let t = q?.customSettings?.comboAxisSettings?.find((t) => t.measures?.includes(e)), n = t?.axis, r = (t?.measures?.length || 0) > 1;
3933
- J((t) => ({
3925
+ if (t?.length && K?.yAxisList?.length && (K?.yAxisList?.length !== t?.length || K?.yAxisList?.length === t?.length && !n) && [
3926
+ A.combo,
3927
+ A.timeSeries,
3928
+ A.horizontalCombo
3929
+ ].includes(K?.chartType || "")) {
3930
+ let e = K?.yAxisList?.filter((e) => !t?.includes(e));
3931
+ (t?.filter((e) => !K?.yAxisList?.includes(e)))?.forEach((e) => {
3932
+ let t = K?.customSettings?.comboAxisSettings?.find((t) => t.measures?.includes(e)), n = t?.axis, r = (t?.measures?.length || 0) > 1;
3933
+ q((t) => ({
3934
3934
  ...t,
3935
3935
  customSettings: {
3936
3936
  ...t.customSettings,
3937
- comboAxisSettings: tt(r ? t.customSettings?.comboAxisSettings?.map((t) => t.axis === n ? {
3937
+ comboAxisSettings: rt(r ? t.customSettings?.comboAxisSettings?.map((t) => t.axis === n ? {
3938
3938
  ...t,
3939
3939
  measures: t?.measures?.filter((t) => t !== e)
3940
3940
  } : t)?.filter((e) => e?.measures?.length) || [] : t.customSettings?.comboAxisSettings?.filter((e) => e.axis !== n && e?.measures?.length) || [])
3941
3941
  }
3942
3942
  }));
3943
- }), e?.length && J((t) => ({
3943
+ }), e?.length && q((t) => ({
3944
3944
  ...t,
3945
3945
  customSettings: {
3946
3946
  ...t.customSettings,
3947
- comboAxisSettings: tt([...t.customSettings?.comboAxisSettings || [], ...e?.map((e) => ({
3947
+ comboAxisSettings: rt([...t.customSettings?.comboAxisSettings || [], ...e?.map((e) => ({
3948
3948
  axis: e,
3949
3949
  measures: [e],
3950
3950
  chartTypes: [{
@@ -3955,11 +3955,11 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3955
3955
  }
3956
3956
  }));
3957
3957
  }
3958
- t?.length && q?.yAxisList?.length && q?.yAxisList?.length === t?.length && n && [
3959
- O.combo,
3960
- O.timeSeries,
3961
- O.horizontalCombo
3962
- ].includes(q?.chartType || "") && q?.customSettings?.comboAxisSettings?.length !== e?.length && J((t) => ({
3958
+ t?.length && K?.yAxisList?.length && K?.yAxisList?.length === t?.length && n && [
3959
+ A.combo,
3960
+ A.timeSeries,
3961
+ A.horizontalCombo
3962
+ ].includes(K?.chartType || "") && K?.customSettings?.comboAxisSettings?.length !== e?.length && q((t) => ({
3963
3963
  ...t,
3964
3964
  customSettings: {
3965
3965
  ...t?.customSettings,
@@ -3967,43 +3967,43 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
3967
3967
  }
3968
3968
  }));
3969
3969
  }, [
3970
- q?.yAxisList,
3971
- q?.customSettings?.comboAxisSettings,
3972
- q?.comboBarList,
3973
- q?.customSettings?.isCombineBarAxis,
3974
- q?.customSettings?.isStackBar,
3975
- q?.customSettings?.comboStackAxisSymbols?.name,
3976
- q?.customSettings?.comboStackAxisSymbols?.prefix,
3977
- q?.customSettings?.comboStackAxisSymbols?.suffix,
3978
- q?.customSettings?.comboLabelFormatter,
3979
- q?.customSettings?.comboAxisSymbols,
3980
- q?.customSettings?.numberFormatter,
3981
- q?.customSettings?.combinedAxisPrefix,
3982
- q?.customSettings?.combinedAxisSuffix,
3983
- q?.chartType
3984
- ]), F(() => {
3985
- q?.yAxisList?.length && q?.yAxisList?.length < 5 && q?.chartType === O.boxplot && J((e) => ({
3970
+ K?.yAxisList,
3971
+ K?.customSettings?.comboAxisSettings,
3972
+ K?.comboBarList,
3973
+ K?.customSettings?.isCombineBarAxis,
3974
+ K?.customSettings?.isStackBar,
3975
+ K?.customSettings?.comboStackAxisSymbols?.name,
3976
+ K?.customSettings?.comboStackAxisSymbols?.prefix,
3977
+ K?.customSettings?.comboStackAxisSymbols?.suffix,
3978
+ K?.customSettings?.comboLabelFormatter,
3979
+ K?.customSettings?.comboAxisSymbols,
3980
+ K?.customSettings?.numberFormatter,
3981
+ K?.customSettings?.combinedAxisPrefix,
3982
+ K?.customSettings?.combinedAxisSuffix,
3983
+ K?.chartType
3984
+ ]), N(() => {
3985
+ K?.yAxisList?.length && K?.yAxisList?.length < 5 && K?.chartType === A.boxplot && q((e) => ({
3986
3986
  ...e,
3987
- chartType: O.line
3988
- })), !q?.yAxisList?.length && q?.chartType === O.funnelV2 && J((e) => ({
3987
+ chartType: A.line
3988
+ })), !K?.yAxisList?.length && K?.chartType === A.funnelV2 && q((e) => ({
3989
3989
  ...e,
3990
- chartType: O.singleValue
3990
+ chartType: A.singleValue
3991
3991
  }));
3992
- }, [q?.chartType, q?.yAxisList?.length]);
3992
+ }, [K?.chartType, K?.yAxisList?.length]);
3993
3993
  let ma = ({ columnAlias: e, value: n, isClear: r = !1 }) => {
3994
3994
  let i = t?.datasetMetricSettings;
3995
- i && He({
3995
+ i && We({
3996
3996
  columnAlias: e,
3997
3997
  datasetSettings: i,
3998
- setTableColumnFilters: Rt,
3998
+ setTableColumnFilters: zt,
3999
3999
  value: n,
4000
4000
  isClear: r
4001
4001
  });
4002
4002
  };
4003
- F(() => {
4004
- if (!q?.dynamicYAxis?.isEnabled || !q?.dynamicYAxis?.selectedOption || Array.isArray(q?.dynamicYAxis?.selectedOption)) return;
4005
- let e = q?.dynamicYAxis?.selectedOption;
4006
- J((t) => ({
4003
+ N(() => {
4004
+ if (!K?.dynamicYAxis?.isEnabled || !K?.dynamicYAxis?.selectedOption || Array.isArray(K?.dynamicYAxis?.selectedOption)) return;
4005
+ let e = K?.dynamicYAxis?.selectedOption;
4006
+ q((t) => ({
4007
4007
  ...t,
4008
4008
  dynamicYAxis: {
4009
4009
  ...t?.dynamicYAxis,
@@ -4011,14 +4011,14 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
4011
4011
  },
4012
4012
  yAxisList: [e?.value]
4013
4013
  }));
4014
- }, [q?.dynamicYAxis?.selectedOption, q?.dynamicYAxis?.isEnabled]), F(() => {
4015
- let e = N?.yAxisSettings?.find((e) => e?.yAxisSettings?.isEnable && e?.id === t?.id && e?.yAxisSettings?.yAxis && Array.isArray(e?.yAxisSettings?.yAxis) && e?.yAxisSettings?.yAxis?.length > 0), n = N?.xAxisSettings?.find((e) => e?.xAxisSettings?.isEnable && e?.id === t?.id && e?.xAxisSettings?.xaxis), r = U?.configV2?.levels?.length ? U : t?.drillDownSettings, i = ca(t?.chartOptions, r), a = i !== t?.chartOptions;
4016
- if (!q?.dynamicYAxis?.isEnabled && !q?.dynamicXAxis?.isEnabled && !a || !e && !n && !a) {
4017
- J((e) => t?.chartOptions || e);
4014
+ }, [K?.dynamicYAxis?.selectedOption, K?.dynamicYAxis?.isEnabled]), N(() => {
4015
+ let e = j?.yAxisSettings?.find((e) => e?.yAxisSettings?.isEnable && e?.id === t?.id && e?.yAxisSettings?.yAxis && Array.isArray(e?.yAxisSettings?.yAxis) && e?.yAxisSettings?.yAxis?.length > 0), n = j?.xAxisSettings?.find((e) => e?.xAxisSettings?.isEnable && e?.id === t?.id && e?.xAxisSettings?.xaxis), r = H?.configV2?.levels?.length ? H : t?.drillDownSettings, i = ca(t?.chartOptions, r), a = i !== t?.chartOptions;
4016
+ if (!K?.dynamicYAxis?.isEnabled && !K?.dynamicXAxis?.isEnabled && !a || !e && !n && !a) {
4017
+ q((e) => t?.chartOptions || e);
4018
4018
  return;
4019
4019
  }
4020
4020
  let o = e?.yAxisSettings?.yAxis?.[0];
4021
- J((e) => {
4021
+ q((e) => {
4022
4022
  let t = a ? {
4023
4023
  ...e,
4024
4024
  ...i
@@ -4041,18 +4041,18 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
4041
4041
  };
4042
4042
  });
4043
4043
  }, [
4044
- N?.yAxisSettings,
4044
+ j?.yAxisSettings,
4045
4045
  t?.id,
4046
- N?.xAxisSettings,
4047
- q?.dynamicYAxis?.isEnabled,
4048
- q?.dynamicXAxis?.isEnabled,
4049
- U,
4050
- U?.configV2?.isEnable,
4051
- U?.configV2?.levels,
4046
+ j?.xAxisSettings,
4047
+ K?.dynamicYAxis?.isEnabled,
4048
+ K?.dynamicXAxis?.isEnabled,
4049
+ H,
4050
+ H?.configV2?.isEnable,
4051
+ H?.configV2?.levels,
4052
4052
  t?.chartOptions,
4053
4053
  t?.drillDownSettings
4054
- ]), F(() => {
4055
- q?.customSettings?.isShowDuration && q?.chartType === O.gantt && !q?.customSettings?.ganttTooltipKeys?.includes("Duration") && J((e) => ({
4054
+ ]), N(() => {
4055
+ K?.customSettings?.isShowDuration && K?.chartType === A.gantt && !K?.customSettings?.ganttTooltipKeys?.includes("Duration") && q((e) => ({
4056
4056
  ...e,
4057
4057
  customSettings: {
4058
4058
  ...e?.customSettings,
@@ -4060,59 +4060,59 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
4060
4060
  }
4061
4061
  }));
4062
4062
  }, [
4063
- q?.customSettings?.isShowDuration,
4064
- q?.chartType,
4065
- q?.customSettings?.ganttTooltipKeys
4063
+ K?.customSettings?.isShowDuration,
4064
+ K?.chartType,
4065
+ K?.customSettings?.ganttTooltipKeys
4066
4066
  ]);
4067
- let ha = I(() => t?.datasetMetricSettings?.selectedDimensions?.map((e) => ie(e || "none")) || sa, [t?.datasetMetricSettings?.selectedDimensions]);
4067
+ let ha = P(() => t?.datasetMetricSettings?.selectedDimensions?.map((e) => ne(e || "none")) || sa, [t?.datasetMetricSettings?.selectedDimensions]);
4068
4068
  return {
4069
- drillBlockedNotice: yt,
4070
- filterNotAppliedNotice: er,
4071
- dismissDrillBlockedNotice: () => bt(null),
4072
- elementSummary: Tt,
4073
- elementSummaryError: Et,
4074
- elementSummaryEmpty: Dt,
4075
- isLoadingSummary: Ot,
4076
- stopSummary: Ct,
4069
+ drillBlockedNotice: xt,
4070
+ filterNotAppliedNotice: tr,
4071
+ dismissDrillBlockedNotice: () => St(null),
4072
+ elementSummary: Dt,
4073
+ elementSummaryError: Ot,
4074
+ elementSummaryEmpty: kt,
4075
+ isLoadingSummary: At,
4076
+ stopSummary: Tt,
4077
4077
  isMetricListLoading: pa,
4078
4078
  onDrillLevelClick: $r,
4079
4079
  onDrillDown: Xr,
4080
4080
  onFilterDashboardTo: Jr,
4081
4081
  onFilterMetricTo: Yr,
4082
- handleChartClick: Rr,
4083
- dataDb: Q,
4084
- truncation: rr,
4085
- truncationNotice: ir,
4082
+ handleChartClick: zr,
4083
+ dataDb: Z,
4084
+ truncation: ir,
4085
+ truncationNotice: ar,
4086
4086
  getUnderlyingData: Kr,
4087
- onChangeFilterValue: Lr,
4088
- isShowChartPopup: zt,
4089
- setShowChartPopup: Bt,
4090
- columnName: zr,
4087
+ onChangeFilterValue: Rr,
4088
+ isShowChartPopup: Bt,
4089
+ setShowChartPopup: Vt,
4090
+ columnName: Q,
4091
4091
  underlyingDataPoint: Br,
4092
- chartParams: V,
4093
- isQueryLoading: !In && (Gn || mt || Xn || Ee && (!Q?.length || Vi)),
4094
- isMetricUpdating: Qn,
4092
+ chartParams: B,
4093
+ isQueryLoading: !Ln && (Kn || gt || Zn || Re && (!Z?.length || Vi)),
4094
+ isMetricUpdating: $n,
4095
4095
  isSingleValueNull: Vi,
4096
- dynamicOptions: yn,
4097
- chartSettings: q,
4098
- setChartSettings: J,
4096
+ dynamicOptions: bn,
4097
+ chartSettings: K,
4098
+ setChartSettings: q,
4099
4099
  isEnableZoom: Oi,
4100
- filterValues: kn,
4101
- containerRef: At,
4102
- drilledLevel: H.length,
4100
+ filterValues: An,
4101
+ containerRef: Mt,
4102
+ drilledLevel: V.length,
4103
4103
  dimensions: ha,
4104
- rlsConditions: B,
4105
- setRlsConditions: It,
4106
- setTableLimit: Mt,
4107
- isEnableNextBtn: Nt > jt?.limit + jt?.offset,
4108
- isEnablePrevBtn: jt?.offset !== 0,
4104
+ rlsConditions: z,
4105
+ setRlsConditions: Lt,
4106
+ setTableLimit: Nt,
4107
+ isEnableNextBtn: Pt > L?.limit + L?.offset,
4108
+ isEnablePrevBtn: L?.offset !== 0,
4109
4109
  paginationInfo: {
4110
- limit: jt?.limit,
4111
- offset: jt?.offset,
4112
- totalRecords: Nt
4110
+ limit: L?.limit,
4111
+ offset: L?.offset,
4112
+ totalRecords: Pt
4113
4113
  },
4114
4114
  onChangePage: (e, t, n) => {
4115
- Mt(t ? {
4115
+ Nt(t ? {
4116
4116
  limit: t,
4117
4117
  offset: 0
4118
4118
  } : (t) => {
@@ -4123,13 +4123,13 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
4123
4123
  };
4124
4124
  });
4125
4125
  },
4126
- isExternalChart: q?.tableSettings?.isServerSidePagination && q?.chartType === O.table,
4127
- isEnablePivotTable: sn,
4128
- groupByList: an,
4126
+ isExternalChart: K?.tableSettings?.isServerSidePagination && K?.chartType === A.table,
4127
+ isEnablePivotTable: cn,
4128
+ groupByList: on,
4129
4129
  hasNumberKeys: !0,
4130
4130
  isEnableGauge: !0,
4131
4131
  updateFilter: (e) => {
4132
- It((t) => t?.map((t) => t.name === e.name && t.datatype === e.datatype && t.tableName === e.tableName && t.columnName === e.columnName ? {
4132
+ Lt((t) => t?.map((t) => t.name === e.name && t.datatype === e.datatype && t.tableName === e.tableName && t.columnName === e.columnName ? {
4133
4133
  ...t,
4134
4134
  isAddOnMetrics: !t.isAddOnMetrics
4135
4135
  } : t));
@@ -4137,55 +4137,55 @@ var gi = (e) => typeof e == "object" && !!e && !Array.isArray(e), _i = (e) => ty
4137
4137
  metricFilters: mi,
4138
4138
  leftPositionedMetricFilters: gi,
4139
4139
  rightPositionedMetricFilters: _i,
4140
- drillFilters: H,
4140
+ drillFilters: V,
4141
4141
  underlyingDataColumnMetadata: Gr,
4142
4142
  underlyingDataDrillFilters: Wr,
4143
- drillType: U?.drillType,
4143
+ drillType: H?.drillType,
4144
4144
  tableResultsDownloadData: Ci,
4145
4145
  filterCsvColumns: xi,
4146
- appliedMetricFilters: K,
4146
+ appliedMetricFilters: G,
4147
4147
  pivotHeaderOptions: di,
4148
- pivotDrillState: wn,
4148
+ pivotDrillState: Tn,
4149
4149
  onDrillPivotTable: Qr,
4150
4150
  legendData: Hi,
4151
- timeseriesDimension: Mr,
4152
- isPythonMode: Y,
4153
- sortOrder: Ht,
4154
- setSortOrder: Ut,
4155
- isNotFirstRender: Jt,
4156
- setNotFirstRender: Yt,
4157
- isSorted: _n,
4151
+ timeseriesDimension: Nr,
4152
+ isPythonMode: J,
4153
+ sortOrder: Ut,
4154
+ setSortOrder: Wt,
4155
+ isNotFirstRender: Yt,
4156
+ setNotFirstRender: Xt,
4157
+ isSorted: vn,
4158
4158
  isInavlidForSort: yi,
4159
4159
  onAddComparison: ei,
4160
4160
  groupedRlsConditions: ci,
4161
4161
  onGenerateMetricSummary: ti,
4162
- summary: Kt,
4163
- setSummary: qt,
4164
- dataMartRelationships: On,
4162
+ summary: qt,
4163
+ setSummary: Jt,
4164
+ dataMartRelationships: kn,
4165
4165
  onChartChange: ri,
4166
- isCompareValue: Fr,
4167
- isShowChartPropertyPanel: ln,
4168
- setShowChartPropertyPanel: un,
4169
- columnList: Wt,
4170
- variables: hn,
4166
+ isCompareValue: Ir,
4167
+ isShowChartPropertyPanel: un,
4168
+ setShowChartPropertyPanel: dn,
4169
+ columnList: Gt,
4170
+ variables: gn,
4171
4171
  metricName: Gi,
4172
4172
  longDescription: Ki,
4173
4173
  footNote: Ji,
4174
4174
  description: qi,
4175
- drilldownCols: Xt,
4175
+ drilldownCols: Zt,
4176
4176
  switchMeasureOptions: fi,
4177
4177
  metricExpressionResult: Yi,
4178
4178
  dateFilter: li,
4179
- drillDownSettings: U,
4179
+ drillDownSettings: H,
4180
4180
  onDrillIntoDimension: Zr,
4181
- adhocDrillDims: tn,
4181
+ adhocDrillDims: nn,
4182
4182
  enabledCharts: ni,
4183
- tableColumnFilters: Lt,
4183
+ tableColumnFilters: Rt,
4184
4184
  onChangePaginationColumnFilters: ma,
4185
- queryError: ar,
4186
- queryPermissionDenied: !!Jn?.isBatchAuth,
4187
- refetchMetricData: Yn,
4188
- customSwitchXAxis: An,
4185
+ queryError: or,
4186
+ queryPermissionDenied: !!Yn?.isBatchAuth,
4187
+ refetchMetricData: Xn,
4188
+ customSwitchXAxis: jn,
4189
4189
  savedMetricFilters: Xi || oa
4190
4190
  };
4191
4191
  };
@@ -4224,7 +4224,7 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4224
4224
  a.forEach((e) => {
4225
4225
  o.set(e.column, e.value);
4226
4226
  });
4227
- let s = `/externalDashboard/${encodeURIComponent(e.dashboardId)}/?${o.toString()}`, c = ot(s, { routeType: "internal" });
4227
+ let s = `/externalDashboard/${encodeURIComponent(e.dashboardId)}/?${o.toString()}`, c = ct(s, { routeType: "internal" });
4228
4228
  return c.ok ? {
4229
4229
  ok: !0,
4230
4230
  intent: {
@@ -4250,7 +4250,7 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4250
4250
  if (r && r.name !== void 0 && r.name !== null) return n(r.name);
4251
4251
  let o = (i ?? []).find((e) => e?.value !== void 0 && e?.value !== null);
4252
4252
  return o ? n(o.value) : null;
4253
- }, ga = ct("triangle-alert", [
4253
+ }, ga = ut("triangle-alert", [
4254
4254
  ["path", {
4255
4255
  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",
4256
4256
  key: "wmoenq"
@@ -4266,14 +4266,14 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4266
4266
  ]), _a = {
4267
4267
  notice: "_notice_vwpz7_1",
4268
4268
  icon: "_icon_vwpz7_15"
4269
- }, va = ({ text: e }) => e ? /* @__PURE__ */ mt("div", {
4269
+ }, va = ({ text: e }) => e ? /* @__PURE__ */ gt("div", {
4270
4270
  className: _a.notice,
4271
4271
  role: "status",
4272
4272
  "data-testid": "custom-sql-filter-notice",
4273
- children: [/* @__PURE__ */ pt(ga, {
4273
+ children: [/* @__PURE__ */ ht(ga, {
4274
4274
  className: _a.icon,
4275
4275
  "aria-hidden": "true"
4276
- }), /* @__PURE__ */ pt("span", { children: e })]
4276
+ }), /* @__PURE__ */ ht("span", { children: e })]
4277
4277
  }) : null, ya = (e) => {
4278
4278
  let t = e.value ?? e.selectedVariableValue?.value;
4279
4279
  return Array.isArray(t) ? t.length > 0 : typeof t == "string" ? t.trim().length > 0 : t != null;
@@ -4282,7 +4282,7 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4282
4282
  return typeof t == "string" && t.trim() ? t.trim() : "Filter";
4283
4283
  }, xa = ({ isCustomSqlMetric: e, query: t, metricId: n, filters: r }) => {
4284
4284
  if (!e) return [];
4285
- let i = fe(t || "");
4285
+ let i = de(t || "");
4286
4286
  return (r || []).flatMap((e) => {
4287
4287
  let t = e.restrictedMetrics?.some((e) => e.value === n);
4288
4288
  if (!e.isVariableFilter || e.isFilterApplied === !1 || e.isHiddenInUi || t || !ya(e)) return [];
@@ -4299,14 +4299,14 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4299
4299
  return n.length ? `${r} Add ${Sa(n)} to the metric SQL.` : `${r} Configure matching filter variables in the metric SQL.`;
4300
4300
  }, wa = ({ chart: e, valueColumn: t, isDrillEnabled: n, drilledLevel: r, dimensionCount: i, params: a, passAllData: o }) => {
4301
4301
  let s = e?.chartType;
4302
- return s === O.table || s === O.singleValue || n && r === i ? o ? a?.reduce((e, t) => (e[t.columnName] = t.value, e), {}) : a?.find((e) => e.columnName === t)?.value : [O.sankey, O.treeMap].includes(s) ? o ? {
4302
+ return s === A.table || s === A.singleValue || n && r === i ? o ? a?.reduce((e, t) => (e[t.columnName] = t.value, e), {}) : a?.find((e) => e.columnName === t)?.value : [A.sankey, A.treeMap].includes(s) ? o ? {
4303
4303
  name: a?.name,
4304
4304
  value: a?.value
4305
4305
  } : a?.value : o ? {
4306
4306
  name: a?.name,
4307
4307
  value: a?.value,
4308
4308
  columnName: a?.seriesName
4309
- } : t === e?.xAxis || s === O.gauge && t === e?.gaugeSettings?.dimensions?.join(", ") ? a?.name : a?.seriesName === t || s === O.gauge && t === e?.gaugeSettings?.metric || [O.funnel].includes(s) ? a?.value : null;
4309
+ } : t === e?.xAxis || s === A.gauge && t === e?.gaugeSettings?.dimensions?.join(", ") ? a?.name : a?.seriesName === t || s === A.gauge && t === e?.gaugeSettings?.metric || [A.funnel].includes(s) ? a?.value : null;
4310
4310
  }, Ta = (e, t, n) => !e || t === n, Ea = ({ chart: e, chartWithMetric: t, chartWithDashboard: n, isDrillEnabled: r, drilledLevel: i, dimensionCount: a, isLastConfiguredDrillLevel: o, isTableRedirectAllowed: s = !0 }) => {
4311
4311
  let c = Ta(r, i, a), l = c || !!o, u = !!e?.isEnable && l && s, d = e?.routeType === "user";
4312
4312
  return {
@@ -4315,11 +4315,11 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4315
4315
  openNestedMetric: !!t?.isEnable && c,
4316
4316
  openDashboard: !!n?.isEnable && l
4317
4317
  };
4318
- }, Da = lt.createContext({
4318
+ }, Da = dt.createContext({
4319
4319
  navigate: null,
4320
4320
  carryFilters: []
4321
4321
  }), Oa = [], ka = ({ children: e, isEnabled: t = !1, onNavigate: n, carryFilters: r }) => {
4322
- let i = r?.length ? r : Oa, a = lt.useMemo(() => ({
4322
+ let i = r?.length ? r : Oa, a = dt.useMemo(() => ({
4323
4323
  navigate: t && n ? n : null,
4324
4324
  carryFilters: i
4325
4325
  }), [
@@ -4327,12 +4327,12 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4327
4327
  n,
4328
4328
  i
4329
4329
  ]);
4330
- return /* @__PURE__ */ pt(Da.Provider, {
4330
+ return /* @__PURE__ */ ht(Da.Provider, {
4331
4331
  value: a,
4332
4332
  children: e
4333
4333
  });
4334
4334
  }, Aa = () => {
4335
- let { navigate: e, carryFilters: t } = lt.useContext(Da), n = lt.useCallback((n, r) => {
4335
+ let { navigate: e, carryFilters: t } = dt.useContext(Da), n = dt.useCallback((n, r) => {
4336
4336
  if (!e) return !1;
4337
4337
  let i = n?.clickActions?.chartWithDashboard;
4338
4338
  if (!i?.isEnable) return !1;
@@ -4359,4 +4359,4 @@ var fa = (e) => !!e && e !== "null" && e !== "undefined", pa = (e) => {
4359
4359
  return n.code === "JOIN_COLUMN_HIDDEN" ? t(Ma("column")) : n.code === "JOIN_PATH_MISSING" ? t(Ma("join")) : n;
4360
4360
  };
4361
4361
  //#endregion
4362
- export { vt as $, Dr as A, Wn as B, Mr as C, Hr as D, Ir as E, pr as F, kn as G, Gn as H, ur as I, En as J, Pn as K, Q as L, sr as M, dr as N, kr as O, or as P, _t as Q, nr as R, Gr as S, Rr as T, On as U, qn as V, wn as W, Dn as X, Y, Sn as Z, Ur as _, Aa as a, ci as b, Ca as c, ma as d, gt as et, ua as f, hi as g, pi as h, ja as i, Or as j, Ar as k, va as l, xi as m, Na as n, Ea as o, Gi as p, Tn as q, ka as r, wa as s, Ma as t, ga as u, ni as v, Lr as w, Xr as x, ri as y, tr as z };
4362
+ export { bt as $, Or as A, Gn as B, Nr as C, Hr as D, Lr as E, mr as F, An as G, Kn as H, dr as I, Dn as J, Fn as K, Z as L, cr as M, fr as N, Ar as O, sr as P, yt as Q, rr as R, Gr as S, zr as T, kn as U, Jn as V, Tn as W, On as X, J as Y, Cn as Z, Ur as _, Aa as a, ci as b, Ca as c, ma as d, vt as et, ua as f, hi as g, pi as h, ja as i, kr as j, jr as k, va as l, xi as m, Na as n, Ea as o, Gi as p, En as q, ka as r, wa as s, Ma as t, ga as u, ni as v, Rr as w, Xr as x, ri as y, nr as z };